mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-17 19:37:18 +01:00
73 lines
3.3 KiB
Java
73 lines
3.3 KiB
Java
package androidx.webkit.internal;
|
|
|
|
import android.webkit.WebView;
|
|
import java.lang.reflect.InvocationHandler;
|
|
import java.lang.reflect.InvocationTargetException;
|
|
import java.lang.reflect.Method;
|
|
import okio.Buffer$$ExternalSyntheticBUOutline0;
|
|
import org.chromium.support_lib_boundary.WebViewProviderFactoryBoundaryInterface;
|
|
import org.chromium.support_lib_boundary.util.BoundaryInterfaceReflectionUtil;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes14.dex */
|
|
public class WebViewGlueCommunicator {
|
|
private static final String GLUE_FACTORY_PROVIDER_FETCHER_CLASS = "org.chromium.support_lib_glue.SupportLibReflectionUtil";
|
|
private static final String GLUE_FACTORY_PROVIDER_FETCHER_METHOD = "createWebViewProviderFactory";
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
public static class LAZY_COMPAT_CONVERTER_HOLDER {
|
|
static final WebkitToCompatConverter INSTANCE = new WebkitToCompatConverter(WebViewGlueCommunicator.getFactory().getWebkitToCompatConverter());
|
|
|
|
private LAZY_COMPAT_CONVERTER_HOLDER() {
|
|
}
|
|
}
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
public static class LAZY_FACTORY_HOLDER {
|
|
static final WebViewProviderFactory INSTANCE = WebViewGlueCommunicator.createGlueProviderFactory();
|
|
|
|
private LAZY_FACTORY_HOLDER() {
|
|
}
|
|
}
|
|
|
|
private WebViewGlueCommunicator() {
|
|
}
|
|
|
|
public static WebViewProviderFactory createGlueProviderFactory() {
|
|
try {
|
|
return new WebViewProviderFactoryAdapter((WebViewProviderFactoryBoundaryInterface) BoundaryInterfaceReflectionUtil.castToSuppLibClass(WebViewProviderFactoryBoundaryInterface.class, fetchGlueProviderFactoryImpl()));
|
|
} catch (ClassNotFoundException unused) {
|
|
return new IncompatibleApkWebViewProviderFactory();
|
|
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
|
|
Buffer$$ExternalSyntheticBUOutline0.m(e);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
private static InvocationHandler fetchGlueProviderFactoryImpl() throws IllegalAccessException, InvocationTargetException, ClassNotFoundException, NoSuchMethodException {
|
|
return (InvocationHandler) Class.forName(GLUE_FACTORY_PROVIDER_FETCHER_CLASS, false, getWebViewClassLoader()).getDeclaredMethod(GLUE_FACTORY_PROVIDER_FETCHER_METHOD, null).invoke(null, null);
|
|
}
|
|
|
|
public static WebkitToCompatConverter getCompatConverter() {
|
|
return LAZY_COMPAT_CONVERTER_HOLDER.INSTANCE;
|
|
}
|
|
|
|
public static WebViewProviderFactory getFactory() {
|
|
return LAZY_FACTORY_HOLDER.INSTANCE;
|
|
}
|
|
|
|
public static ClassLoader getWebViewClassLoader() {
|
|
return ApiHelperForP.getWebViewClassLoader();
|
|
}
|
|
|
|
private static Object getWebViewProviderFactory() {
|
|
try {
|
|
Method declaredMethod = WebView.class.getDeclaredMethod("getFactory", null);
|
|
declaredMethod.setAccessible(true);
|
|
return declaredMethod.invoke(null, null);
|
|
} catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
|
|
Buffer$$ExternalSyntheticBUOutline0.m(e);
|
|
return null;
|
|
}
|
|
}
|
|
}
|