Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
package androidx.webkit;
import android.webkit.CookieManager;
import androidx.annotation.NonNull;
import androidx.webkit.internal.CookieManagerAdapter;
import androidx.webkit.internal.WebViewFeatureInternal;
import androidx.webkit.internal.WebViewGlueCommunicator;
import java.util.List;
/* loaded from: classes.dex */
public class CookieManagerCompat {
private CookieManagerCompat() {
}
@NonNull
public static List<String> getCookieInfo(@NonNull CookieManager cookieManager, @NonNull String str) {
if (WebViewFeatureInternal.GET_COOKIE_INFO.isSupportedByWebView()) {
return getAdapter(cookieManager).getCookieInfo(str);
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
private static CookieManagerAdapter getAdapter(CookieManager cookieManager) {
return WebViewGlueCommunicator.getCompatConverter().convertCookieManager(cookieManager);
}
}

View File

@@ -0,0 +1,72 @@
package androidx.webkit;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.os.ParcelFileDescriptor;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.webkit.internal.WebViewGlueCommunicator;
import java.io.FileNotFoundException;
import org.chromium.support_lib_boundary.DropDataContentProviderBoundaryInterface;
/* loaded from: classes.dex */
public final class DropDataContentProvider extends ContentProvider {
DropDataContentProviderBoundaryInterface mImpl;
@Override // android.content.ContentProvider
public boolean onCreate() {
return true;
}
@Override // android.content.ContentProvider
@Nullable
public ParcelFileDescriptor openFile(@NonNull Uri uri, @NonNull String str) throws FileNotFoundException {
return getDropImpl().openFile(this, uri);
}
@Override // android.content.ContentProvider
@Nullable
public Cursor query(@NonNull Uri uri, @Nullable String[] strArr, @Nullable String str, @Nullable String[] strArr2, @Nullable String str2) {
return getDropImpl().query(uri, strArr, str, strArr2, str2);
}
@Override // android.content.ContentProvider
@Nullable
public String getType(@NonNull Uri uri) {
return getDropImpl().getType(uri);
}
@Override // android.content.ContentProvider
@Nullable
public Uri insert(@NonNull Uri uri, @Nullable ContentValues contentValues) {
throw new UnsupportedOperationException("Insert method is not supported.");
}
@Override // android.content.ContentProvider
public int delete(@NonNull Uri uri, @Nullable String str, @Nullable String[] strArr) {
throw new UnsupportedOperationException("delete method is not supported.");
}
@Override // android.content.ContentProvider
public int update(@NonNull Uri uri, @Nullable ContentValues contentValues, @Nullable String str, @Nullable String[] strArr) {
throw new UnsupportedOperationException("update method is not supported.");
}
@Override // android.content.ContentProvider
@Nullable
public Bundle call(@NonNull String str, @Nullable String str2, @Nullable Bundle bundle) {
return getDropImpl().call(str, str2, bundle);
}
private DropDataContentProviderBoundaryInterface getDropImpl() {
if (this.mImpl == null) {
DropDataContentProviderBoundaryInterface dropDataProvider = WebViewGlueCommunicator.getFactory().getDropDataProvider();
this.mImpl = dropDataProvider;
dropDataProvider.onCreate();
}
return this.mImpl;
}
}

View File

@@ -0,0 +1,15 @@
package androidx.webkit;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
/* loaded from: classes.dex */
public abstract class JavaScriptReplyProxy {
public abstract void postMessage(@NonNull String str);
public abstract void postMessage(@NonNull byte[] bArr);
@RestrictTo({RestrictTo.Scope.LIBRARY})
public JavaScriptReplyProxy() {
}
}

View File

@@ -0,0 +1,97 @@
package androidx.webkit;
import android.content.Context;
import androidx.annotation.GuardedBy;
import androidx.annotation.NonNull;
import androidx.lifecycle.LifecycleKt$$ExternalSyntheticBackportWithForwarding0;
import androidx.webkit.internal.ApiHelperForP;
import androidx.webkit.internal.WebViewFeatureInternal;
import java.io.File;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.concurrent.atomic.AtomicReference;
import org.chromium.support_lib_boundary.ProcessGlobalConfigConstants;
/* loaded from: classes.dex */
public class ProcessGlobalConfig {
String mCacheDirectoryBasePath;
String mDataDirectoryBasePath;
String mDataDirectorySuffix;
private static final AtomicReference<HashMap<String, Object>> sProcessGlobalConfig = new AtomicReference<>();
private static final Object sLock = new Object();
@GuardedBy("sLock")
private static boolean sApplyCalled = false;
@NonNull
public ProcessGlobalConfig setDataDirectorySuffix(@NonNull Context context, @NonNull String str) {
if (!WebViewFeatureInternal.STARTUP_FEATURE_SET_DATA_DIRECTORY_SUFFIX.isSupported(context)) {
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
if (str.equals("")) {
throw new IllegalArgumentException("Suffix cannot be an empty string");
}
if (str.indexOf(File.separatorChar) < 0) {
this.mDataDirectorySuffix = str;
return this;
}
throw new IllegalArgumentException("Suffix " + str + " contains a path separator");
}
@NonNull
public ProcessGlobalConfig setDirectoryBasePaths(@NonNull Context context, @NonNull File file, @NonNull File file2) {
if (!WebViewFeatureInternal.STARTUP_FEATURE_SET_DIRECTORY_BASE_PATH.isSupported(context)) {
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
if (!file.isAbsolute()) {
throw new IllegalArgumentException("dataDirectoryBasePath must be a non-empty absolute path");
}
if (!file2.isAbsolute()) {
throw new IllegalArgumentException("cacheDirectoryBasePath must be a non-empty absolute path");
}
this.mDataDirectoryBasePath = file.getAbsolutePath();
this.mCacheDirectoryBasePath = file2.getAbsolutePath();
return this;
}
public static void apply(@NonNull ProcessGlobalConfig processGlobalConfig) {
synchronized (sLock) {
if (sApplyCalled) {
throw new IllegalStateException("ProcessGlobalConfig#apply was called more than once, which is an illegal operation. The configuration settings provided by ProcessGlobalConfig take effect only once, when WebView is first loaded into the current process. Every process should only ever create a single instance of ProcessGlobalConfig and apply it once, before any calls to android.webkit APIs, such as during early app startup.");
}
sApplyCalled = true;
}
HashMap hashMap = new HashMap();
if (webViewCurrentlyLoaded()) {
throw new IllegalStateException("WebView has already been loaded in the current process, so any attempt to apply the settings in ProcessGlobalConfig will have no effect. ProcessGlobalConfig#apply needs to be called before any calls to android.webkit APIs, such as during early app startup.");
}
if (processGlobalConfig.mDataDirectorySuffix != null) {
if (WebViewFeatureInternal.STARTUP_FEATURE_SET_DATA_DIRECTORY_SUFFIX.isSupportedByFramework()) {
ApiHelperForP.setDataDirectorySuffix(processGlobalConfig.mDataDirectorySuffix);
} else {
hashMap.put(ProcessGlobalConfigConstants.DATA_DIRECTORY_SUFFIX, processGlobalConfig.mDataDirectorySuffix);
}
}
String str = processGlobalConfig.mDataDirectoryBasePath;
if (str != null) {
hashMap.put(ProcessGlobalConfigConstants.DATA_DIRECTORY_BASE_PATH, str);
}
String str2 = processGlobalConfig.mCacheDirectoryBasePath;
if (str2 != null) {
hashMap.put(ProcessGlobalConfigConstants.CACHE_DIRECTORY_BASE_PATH, str2);
}
if (!LifecycleKt$$ExternalSyntheticBackportWithForwarding0.m(sProcessGlobalConfig, null, hashMap)) {
throw new RuntimeException("Attempting to set ProcessGlobalConfig#sProcessGlobalConfig when it was already set");
}
}
private static boolean webViewCurrentlyLoaded() {
try {
Field declaredField = Class.forName("android.webkit.WebViewFactory").getDeclaredField("sProviderInstance");
declaredField.setAccessible(true);
return declaredField.get(null) != null;
} catch (Exception unused) {
return false;
}
}
}

View File

@@ -0,0 +1,27 @@
package androidx.webkit;
import android.webkit.CookieManager;
import android.webkit.GeolocationPermissions;
import android.webkit.ServiceWorkerController;
import android.webkit.WebStorage;
import androidx.annotation.NonNull;
/* loaded from: classes.dex */
public interface Profile {
public static final String DEFAULT_PROFILE_NAME = "Default";
@NonNull
CookieManager getCookieManager();
@NonNull
GeolocationPermissions getGeolocationPermissions();
@NonNull
String getName();
@NonNull
ServiceWorkerController getServiceWorkerController();
@NonNull
WebStorage getWebStorage();
}

View File

@@ -0,0 +1,31 @@
package androidx.webkit;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import androidx.webkit.internal.ProfileStoreImpl;
import androidx.webkit.internal.WebViewFeatureInternal;
import java.util.List;
@UiThread
/* loaded from: classes.dex */
public interface ProfileStore {
boolean deleteProfile(@NonNull String str);
@NonNull
List<String> getAllProfileNames();
@NonNull
Profile getOrCreateProfile(@NonNull String str);
@Nullable
Profile getProfile(@NonNull String str);
@NonNull
static ProfileStore getInstance() {
if (WebViewFeatureInternal.MULTI_PROFILE.isSupportedByWebView()) {
return ProfileStoreImpl.getInstance();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}

View File

@@ -0,0 +1,157 @@
package androidx.webkit;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/* loaded from: classes.dex */
public final class ProxyConfig {
private static final String BYPASS_RULE_REMOVE_IMPLICIT = "<-loopback>";
private static final String BYPASS_RULE_SIMPLE_NAMES = "<local>";
private static final String DIRECT = "direct://";
public static final String MATCH_ALL_SCHEMES = "*";
public static final String MATCH_HTTP = "http";
public static final String MATCH_HTTPS = "https";
private List<String> mBypassRules;
private List<ProxyRule> mProxyRules;
private boolean mReverseBypass;
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public @interface ProxyScheme {
}
public boolean isReverseBypassEnabled() {
return this.mReverseBypass;
}
@RestrictTo({RestrictTo.Scope.LIBRARY})
public ProxyConfig(@NonNull List<ProxyRule> list, @NonNull List<String> list2, boolean z) {
this.mProxyRules = list;
this.mBypassRules = list2;
this.mReverseBypass = z;
}
@NonNull
public List<ProxyRule> getProxyRules() {
return Collections.unmodifiableList(this.mProxyRules);
}
@NonNull
public List<String> getBypassRules() {
return Collections.unmodifiableList(this.mBypassRules);
}
public static final class ProxyRule {
private String mSchemeFilter;
private String mUrl;
@NonNull
public String getSchemeFilter() {
return this.mSchemeFilter;
}
@NonNull
public String getUrl() {
return this.mUrl;
}
@RestrictTo({RestrictTo.Scope.LIBRARY})
public ProxyRule(@NonNull String str, @NonNull String str2) {
this.mSchemeFilter = str;
this.mUrl = str2;
}
@RestrictTo({RestrictTo.Scope.LIBRARY})
public ProxyRule(@NonNull String str) {
this(ProxyConfig.MATCH_ALL_SCHEMES, str);
}
}
public static final class Builder {
private List<String> mBypassRules;
private List<ProxyRule> mProxyRules;
private boolean mReverseBypass;
@NonNull
private List<String> bypassRules() {
return this.mBypassRules;
}
@NonNull
private List<ProxyRule> proxyRules() {
return this.mProxyRules;
}
private boolean reverseBypass() {
return this.mReverseBypass;
}
@NonNull
public Builder setReverseBypassEnabled(boolean z) {
this.mReverseBypass = z;
return this;
}
public Builder() {
this.mReverseBypass = false;
this.mProxyRules = new ArrayList();
this.mBypassRules = new ArrayList();
}
public Builder(@NonNull ProxyConfig proxyConfig) {
this.mReverseBypass = false;
this.mProxyRules = proxyConfig.getProxyRules();
this.mBypassRules = proxyConfig.getBypassRules();
this.mReverseBypass = proxyConfig.isReverseBypassEnabled();
}
@NonNull
public ProxyConfig build() {
return new ProxyConfig(proxyRules(), bypassRules(), reverseBypass());
}
@NonNull
public Builder addProxyRule(@NonNull String str) {
this.mProxyRules.add(new ProxyRule(str));
return this;
}
@NonNull
public Builder addProxyRule(@NonNull String str, @NonNull String str2) {
this.mProxyRules.add(new ProxyRule(str2, str));
return this;
}
@NonNull
public Builder addBypassRule(@NonNull String str) {
this.mBypassRules.add(str);
return this;
}
@NonNull
public Builder addDirect(@NonNull String str) {
this.mProxyRules.add(new ProxyRule(str, ProxyConfig.DIRECT));
return this;
}
@NonNull
public Builder addDirect() {
return addDirect(ProxyConfig.MATCH_ALL_SCHEMES);
}
@NonNull
public Builder bypassSimpleHostnames() {
return addBypassRule(ProxyConfig.BYPASS_RULE_SIMPLE_NAMES);
}
@NonNull
public Builder removeImplicitRules() {
return addBypassRule(ProxyConfig.BYPASS_RULE_REMOVE_IMPLICIT);
}
}
}

View File

@@ -0,0 +1,32 @@
package androidx.webkit;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import androidx.webkit.internal.ProxyControllerImpl;
import java.util.concurrent.Executor;
/* loaded from: classes.dex */
public abstract class ProxyController {
public abstract void clearProxyOverride(@NonNull Executor executor, @NonNull Runnable runnable);
public abstract void setProxyOverride(@NonNull ProxyConfig proxyConfig, @NonNull Executor executor, @NonNull Runnable runnable);
@RestrictTo({RestrictTo.Scope.LIBRARY})
public ProxyController() {
}
@NonNull
public static ProxyController getInstance() {
if (!WebViewFeature.isFeatureSupported(WebViewFeature.PROXY_OVERRIDE)) {
throw new UnsupportedOperationException("Proxy override not supported");
}
return LAZY_HOLDER.INSTANCE;
}
public static class LAZY_HOLDER {
static final ProxyController INSTANCE = new ProxyControllerImpl();
private LAZY_HOLDER() {
}
}
}

View File

@@ -0,0 +1,7 @@
package androidx.webkit;
/* loaded from: classes.dex */
public final class R {
private R() {
}
}

View File

@@ -0,0 +1,16 @@
package androidx.webkit;
import androidx.annotation.RestrictTo;
/* loaded from: classes.dex */
public abstract class SafeBrowsingResponseCompat {
public abstract void backToSafety(boolean z);
public abstract void proceed(boolean z);
public abstract void showInterstitial(boolean z);
@RestrictTo({RestrictTo.Scope.LIBRARY})
public SafeBrowsingResponseCompat() {
}
}

View File

@@ -0,0 +1,6 @@
package androidx.webkit;
/* loaded from: classes.dex */
public interface ScriptHandler {
void remove();
}

View File

@@ -0,0 +1,14 @@
package androidx.webkit;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.WorkerThread;
/* loaded from: classes.dex */
public abstract class ServiceWorkerClientCompat {
@Nullable
@WorkerThread
public abstract WebResourceResponse shouldInterceptRequest(@NonNull WebResourceRequest webResourceRequest);
}

View File

@@ -0,0 +1,30 @@
package androidx.webkit;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.webkit.internal.ServiceWorkerControllerImpl;
/* loaded from: classes.dex */
public abstract class ServiceWorkerControllerCompat {
@NonNull
public abstract ServiceWorkerWebSettingsCompat getServiceWorkerWebSettings();
public abstract void setServiceWorkerClient(@Nullable ServiceWorkerClientCompat serviceWorkerClientCompat);
@RestrictTo({RestrictTo.Scope.LIBRARY})
public ServiceWorkerControllerCompat() {
}
@NonNull
public static ServiceWorkerControllerCompat getInstance() {
return LAZY_HOLDER.INSTANCE;
}
public static class LAZY_HOLDER {
static final ServiceWorkerControllerCompat INSTANCE = new ServiceWorkerControllerImpl();
private LAZY_HOLDER() {
}
}
}

View File

@@ -0,0 +1,41 @@
package androidx.webkit;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Set;
/* loaded from: classes.dex */
public abstract class ServiceWorkerWebSettingsCompat {
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public @interface CacheMode {
}
public abstract boolean getAllowContentAccess();
public abstract boolean getAllowFileAccess();
public abstract boolean getBlockNetworkLoads();
public abstract int getCacheMode();
@NonNull
public abstract Set<String> getRequestedWithHeaderOriginAllowList();
public abstract void setAllowContentAccess(boolean z);
public abstract void setAllowFileAccess(boolean z);
public abstract void setBlockNetworkLoads(boolean z);
public abstract void setCacheMode(int i);
public abstract void setRequestedWithHeaderOriginAllowList(@NonNull Set<String> set);
@RestrictTo({RestrictTo.Scope.LIBRARY})
public ServiceWorkerWebSettingsCompat() {
}
}

View File

@@ -0,0 +1,96 @@
package androidx.webkit;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
/* loaded from: classes.dex */
public class TracingConfig {
public static final int CATEGORIES_ALL = 1;
public static final int CATEGORIES_ANDROID_WEBVIEW = 2;
public static final int CATEGORIES_FRAME_VIEWER = 64;
public static final int CATEGORIES_INPUT_LATENCY = 8;
public static final int CATEGORIES_JAVASCRIPT_AND_RENDERING = 32;
public static final int CATEGORIES_NONE = 0;
public static final int CATEGORIES_RENDERING = 16;
public static final int CATEGORIES_WEB_DEVELOPER = 4;
public static final int RECORD_CONTINUOUSLY = 1;
public static final int RECORD_UNTIL_FULL = 0;
private final List<String> mCustomIncludedCategories;
private int mPredefinedCategories;
private int mTracingMode;
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public @interface PredefinedCategories {
}
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public @interface TracingMode {
}
@NonNull
public List<String> getCustomIncludedCategories() {
return this.mCustomIncludedCategories;
}
public int getPredefinedCategories() {
return this.mPredefinedCategories;
}
public int getTracingMode() {
return this.mTracingMode;
}
@RestrictTo({RestrictTo.Scope.LIBRARY})
public TracingConfig(int i, @NonNull List<String> list, int i2) {
ArrayList arrayList = new ArrayList();
this.mCustomIncludedCategories = arrayList;
this.mPredefinedCategories = i;
arrayList.addAll(list);
this.mTracingMode = i2;
}
public static class Builder {
private int mPredefinedCategories = 0;
private final List<String> mCustomIncludedCategories = new ArrayList();
private int mTracingMode = 1;
@NonNull
public Builder setTracingMode(int i) {
this.mTracingMode = i;
return this;
}
@NonNull
public TracingConfig build() {
return new TracingConfig(this.mPredefinedCategories, this.mCustomIncludedCategories, this.mTracingMode);
}
@NonNull
public Builder addCategories(@NonNull int... iArr) {
for (int i : iArr) {
this.mPredefinedCategories = i | this.mPredefinedCategories;
}
return this;
}
@NonNull
public Builder addCategories(@NonNull String... strArr) {
this.mCustomIncludedCategories.addAll(Arrays.asList(strArr));
return this;
}
@NonNull
public Builder addCategories(@NonNull Collection<String> collection) {
this.mCustomIncludedCategories.addAll(collection);
return this;
}
}
}

View File

@@ -0,0 +1,33 @@
package androidx.webkit;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.webkit.internal.TracingControllerImpl;
import java.io.OutputStream;
import java.util.concurrent.Executor;
/* loaded from: classes.dex */
public abstract class TracingController {
public abstract boolean isTracing();
public abstract void start(@NonNull TracingConfig tracingConfig);
public abstract boolean stop(@Nullable OutputStream outputStream, @NonNull Executor executor);
@RestrictTo({RestrictTo.Scope.LIBRARY})
public TracingController() {
}
@NonNull
public static TracingController getInstance() {
return LAZY_HOLDER.INSTANCE;
}
public static class LAZY_HOLDER {
static final TracingController INSTANCE = new TracingControllerImpl();
private LAZY_HOLDER() {
}
}
}

View File

@@ -0,0 +1,127 @@
package androidx.webkit;
import android.net.Uri;
import android.webkit.MimeTypeMap;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import csdk.gluads.Consts;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.nio.charset.Charset;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/* loaded from: classes.dex */
public final class URLUtilCompat {
private static final Pattern DISPOSITION_PATTERN = Pattern.compile("\\s*(\\S+?) # Group 1: parameter name\n\\s*=\\s* # Match equals sign\n(?: # non-capturing group of options\n '( (?: [^'\\\\] | \\\\. )* )' # Group 2: single-quoted\n | \"( (?: [^\"\\\\] | \\\\. )* )\" # Group 3: double-quoted\n | ( [^'\"][^;\\s]* ) # Group 4: un-quoted parameter\n)\\s*;? # Optional end semicolon", 4);
private URLUtilCompat() {
}
@NonNull
public static String guessFileName(@NonNull String str, @Nullable String str2, @Nullable String str3) {
String filenameSuggestion = getFilenameSuggestion(str, str2);
String suggestExtensionFromMimeType = suggestExtensionFromMimeType(str3);
if (filenameSuggestion.indexOf(46) < 0) {
return filenameSuggestion + suggestExtensionFromMimeType;
}
if (str3 == null || !extensionDifferentFromMimeType(filenameSuggestion, str3)) {
return filenameSuggestion;
}
return filenameSuggestion + suggestExtensionFromMimeType;
}
@NonNull
private static String getFilenameSuggestion(@NonNull String str, @Nullable String str2) {
String lastPathSegment;
String filenameFromContentDisposition;
if (str2 != null && (filenameFromContentDisposition = getFilenameFromContentDisposition(str2)) != null) {
return replacePathSeparators(filenameFromContentDisposition);
}
Uri parse = Uri.parse(str);
return (parse == null || (lastPathSegment = parse.getLastPathSegment()) == null) ? "downloadfile" : replacePathSeparators(lastPathSegment);
}
@NonNull
private static String replacePathSeparators(@NonNull String str) {
return str.replaceAll("/", "_");
}
private static boolean extensionDifferentFromMimeType(@NonNull String str, @NonNull String str2) {
String mimeTypeFromExtension = MimeTypeMap.getSingleton().getMimeTypeFromExtension(str.substring(str.lastIndexOf(46) + 1));
return (mimeTypeFromExtension == null || mimeTypeFromExtension.equalsIgnoreCase(str2)) ? false : true;
}
@NonNull
private static String suggestExtensionFromMimeType(@Nullable String str) {
if (str == null) {
return ".bin";
}
String extensionFromMimeType = MimeTypeMap.getSingleton().getExtensionFromMimeType(str);
if (extensionFromMimeType == null) {
return str.equalsIgnoreCase("text/html") ? ".html" : str.toLowerCase(Locale.ROOT).startsWith("text/") ? ".txt" : ".bin";
}
return Consts.STRING_PERIOD + extensionFromMimeType;
}
@Nullable
public static String getFilenameFromContentDisposition(@NonNull String str) {
String group;
String[] split = str.trim().split(";", 2);
String str2 = null;
if (split.length < 2 || "inline".equalsIgnoreCase(split[0].trim())) {
return null;
}
Matcher matcher = DISPOSITION_PATTERN.matcher(split[1]);
String str3 = null;
while (matcher.find()) {
String group2 = matcher.group(1);
if (matcher.group(2) != null) {
group = removeSlashEscapes(matcher.group(2));
} else if (matcher.group(3) != null) {
group = removeSlashEscapes(matcher.group(3));
} else {
group = matcher.group(4);
}
if (group2 != null && group != null) {
if ("filename*".equalsIgnoreCase(group2)) {
str2 = parseExtValueString(group);
} else if ("filename".equalsIgnoreCase(group2)) {
str3 = group;
}
}
}
return str2 != null ? str2 : str3;
}
private static String removeSlashEscapes(String str) {
if (str == null) {
return null;
}
return str.replaceAll("\\\\(.)", "$1");
}
private static String parseExtValueString(String str) {
String[] split = str.split("'", 3);
if (split.length < 3) {
return null;
}
String str2 = split[0];
try {
return URLDecoder.decode(encodePlusCharacters(split[2], str2), str2);
} catch (UnsupportedEncodingException | RuntimeException unused) {
return null;
}
}
@NonNull
private static String encodePlusCharacters(@NonNull String str, @NonNull String str2) {
Charset forName = Charset.forName(str2);
StringBuilder sb = new StringBuilder();
for (byte b : forName.encode("+").array()) {
sb.append(String.format("%02x", Byte.valueOf(b)));
}
return str.replaceAll("\\+", sb.toString());
}
}

View File

@@ -0,0 +1,301 @@
package androidx.webkit;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/* loaded from: classes.dex */
public final class UserAgentMetadata {
public static final int BITNESS_DEFAULT = 0;
private final String mArchitecture;
private int mBitness;
private final List<BrandVersion> mBrandVersionList;
private final String mFullVersion;
private boolean mMobile;
private final String mModel;
private final String mPlatform;
private final String mPlatformVersion;
private boolean mWow64;
@Nullable
public String getArchitecture() {
return this.mArchitecture;
}
public int getBitness() {
return this.mBitness;
}
@NonNull
public List<BrandVersion> getBrandVersionList() {
return this.mBrandVersionList;
}
@Nullable
public String getFullVersion() {
return this.mFullVersion;
}
@Nullable
public String getModel() {
return this.mModel;
}
@Nullable
public String getPlatform() {
return this.mPlatform;
}
@Nullable
public String getPlatformVersion() {
return this.mPlatformVersion;
}
public boolean isMobile() {
return this.mMobile;
}
public boolean isWow64() {
return this.mWow64;
}
@RestrictTo({RestrictTo.Scope.LIBRARY})
private UserAgentMetadata(@NonNull List<BrandVersion> list, @Nullable String str, @Nullable String str2, @Nullable String str3, @Nullable String str4, @Nullable String str5, boolean z, int i, boolean z2) {
this.mBrandVersionList = list;
this.mFullVersion = str;
this.mPlatform = str2;
this.mPlatformVersion = str3;
this.mArchitecture = str4;
this.mModel = str5;
this.mMobile = z;
this.mBitness = i;
this.mWow64 = z2;
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof UserAgentMetadata)) {
return false;
}
UserAgentMetadata userAgentMetadata = (UserAgentMetadata) obj;
return this.mMobile == userAgentMetadata.mMobile && this.mBitness == userAgentMetadata.mBitness && this.mWow64 == userAgentMetadata.mWow64 && Objects.equals(this.mBrandVersionList, userAgentMetadata.mBrandVersionList) && Objects.equals(this.mFullVersion, userAgentMetadata.mFullVersion) && Objects.equals(this.mPlatform, userAgentMetadata.mPlatform) && Objects.equals(this.mPlatformVersion, userAgentMetadata.mPlatformVersion) && Objects.equals(this.mArchitecture, userAgentMetadata.mArchitecture) && Objects.equals(this.mModel, userAgentMetadata.mModel);
}
public int hashCode() {
return Objects.hash(this.mBrandVersionList, this.mFullVersion, this.mPlatform, this.mPlatformVersion, this.mArchitecture, this.mModel, Boolean.valueOf(this.mMobile), Integer.valueOf(this.mBitness), Boolean.valueOf(this.mWow64));
}
public static final class BrandVersion {
private final String mBrand;
private final String mFullVersion;
private final String mMajorVersion;
@NonNull
public String getBrand() {
return this.mBrand;
}
@NonNull
public String getFullVersion() {
return this.mFullVersion;
}
@NonNull
public String getMajorVersion() {
return this.mMajorVersion;
}
@RestrictTo({RestrictTo.Scope.LIBRARY})
private BrandVersion(@NonNull String str, @NonNull String str2, @NonNull String str3) {
this.mBrand = str;
this.mMajorVersion = str2;
this.mFullVersion = str3;
}
@NonNull
public String toString() {
return this.mBrand + "," + this.mMajorVersion + "," + this.mFullVersion;
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof BrandVersion)) {
return false;
}
BrandVersion brandVersion = (BrandVersion) obj;
return Objects.equals(this.mBrand, brandVersion.mBrand) && Objects.equals(this.mMajorVersion, brandVersion.mMajorVersion) && Objects.equals(this.mFullVersion, brandVersion.mFullVersion);
}
public int hashCode() {
return Objects.hash(this.mBrand, this.mMajorVersion, this.mFullVersion);
}
public static final class Builder {
private String mBrand;
private String mFullVersion;
private String mMajorVersion;
public Builder() {
}
public Builder(@NonNull BrandVersion brandVersion) {
this.mBrand = brandVersion.getBrand();
this.mMajorVersion = brandVersion.getMajorVersion();
this.mFullVersion = brandVersion.getFullVersion();
}
@NonNull
public BrandVersion build() {
String str;
String str2;
String str3 = this.mBrand;
if (str3 == null || str3.trim().isEmpty() || (str = this.mMajorVersion) == null || str.trim().isEmpty() || (str2 = this.mFullVersion) == null || str2.trim().isEmpty()) {
throw new IllegalStateException("Brand name, major version and full version should not be null or blank.");
}
return new BrandVersion(this.mBrand, this.mMajorVersion, this.mFullVersion);
}
@NonNull
public Builder setBrand(@NonNull String str) {
if (str.trim().isEmpty()) {
throw new IllegalArgumentException("Brand should not be blank.");
}
this.mBrand = str;
return this;
}
@NonNull
public Builder setMajorVersion(@NonNull String str) {
if (str.trim().isEmpty()) {
throw new IllegalArgumentException("MajorVersion should not be blank.");
}
this.mMajorVersion = str;
return this;
}
@NonNull
public Builder setFullVersion(@NonNull String str) {
if (str.trim().isEmpty()) {
throw new IllegalArgumentException("FullVersion should not be blank.");
}
this.mFullVersion = str;
return this;
}
}
}
public static final class Builder {
private String mArchitecture;
private int mBitness;
private List<BrandVersion> mBrandVersionList;
private String mFullVersion;
private boolean mMobile;
private String mModel;
private String mPlatform;
private String mPlatformVersion;
private boolean mWow64;
@NonNull
public Builder setArchitecture(@Nullable String str) {
this.mArchitecture = str;
return this;
}
@NonNull
public Builder setBitness(int i) {
this.mBitness = i;
return this;
}
@NonNull
public Builder setBrandVersionList(@NonNull List<BrandVersion> list) {
this.mBrandVersionList = list;
return this;
}
@NonNull
public Builder setMobile(boolean z) {
this.mMobile = z;
return this;
}
@NonNull
public Builder setModel(@Nullable String str) {
this.mModel = str;
return this;
}
@NonNull
public Builder setPlatformVersion(@Nullable String str) {
this.mPlatformVersion = str;
return this;
}
@NonNull
public Builder setWow64(boolean z) {
this.mWow64 = z;
return this;
}
public Builder() {
this.mBrandVersionList = new ArrayList();
this.mMobile = true;
this.mBitness = 0;
this.mWow64 = false;
}
public Builder(@NonNull UserAgentMetadata userAgentMetadata) {
this.mBrandVersionList = new ArrayList();
this.mMobile = true;
this.mBitness = 0;
this.mWow64 = false;
this.mBrandVersionList = userAgentMetadata.getBrandVersionList();
this.mFullVersion = userAgentMetadata.getFullVersion();
this.mPlatform = userAgentMetadata.getPlatform();
this.mPlatformVersion = userAgentMetadata.getPlatformVersion();
this.mArchitecture = userAgentMetadata.getArchitecture();
this.mModel = userAgentMetadata.getModel();
this.mMobile = userAgentMetadata.isMobile();
this.mBitness = userAgentMetadata.getBitness();
this.mWow64 = userAgentMetadata.isWow64();
}
@NonNull
public UserAgentMetadata build() {
return new UserAgentMetadata(this.mBrandVersionList, this.mFullVersion, this.mPlatform, this.mPlatformVersion, this.mArchitecture, this.mModel, this.mMobile, this.mBitness, this.mWow64);
}
@NonNull
public Builder setFullVersion(@Nullable String str) {
if (str == null) {
this.mFullVersion = null;
return this;
}
if (str.trim().isEmpty()) {
throw new IllegalArgumentException("Full version should not be blank.");
}
this.mFullVersion = str;
return this;
}
@NonNull
public Builder setPlatform(@Nullable String str) {
if (str == null) {
this.mPlatform = null;
return this;
}
if (str.trim().isEmpty()) {
throw new IllegalArgumentException("Platform should not be blank.");
}
this.mPlatform = str;
return this;
}
}
}

View File

@@ -0,0 +1,87 @@
package androidx.webkit;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import com.facebook.internal.AnalyticsEvents;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Objects;
/* loaded from: classes.dex */
public class WebMessageCompat {
public static final int TYPE_ARRAY_BUFFER = 1;
public static final int TYPE_STRING = 0;
@Nullable
private final byte[] mArrayBuffer;
@Nullable
private final WebMessagePortCompat[] mPorts;
@Nullable
private final String mString;
private final int mType;
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public @interface Type {
}
@NonNull
private String typeToString(int i) {
return i != 0 ? i != 1 ? AnalyticsEvents.PARAMETER_DIALOG_OUTCOME_VALUE_UNKNOWN : "ArrayBuffer" : "String";
}
@Nullable
public WebMessagePortCompat[] getPorts() {
return this.mPorts;
}
public int getType() {
return this.mType;
}
public WebMessageCompat(@Nullable String str) {
this(str, (WebMessagePortCompat[]) null);
}
public WebMessageCompat(@Nullable String str, @Nullable WebMessagePortCompat[] webMessagePortCompatArr) {
this.mString = str;
this.mArrayBuffer = null;
this.mPorts = webMessagePortCompatArr;
this.mType = 0;
}
public WebMessageCompat(@NonNull byte[] bArr) {
this(bArr, (WebMessagePortCompat[]) null);
}
public WebMessageCompat(@NonNull byte[] bArr, @Nullable WebMessagePortCompat[] webMessagePortCompatArr) {
Objects.requireNonNull(bArr);
this.mArrayBuffer = bArr;
this.mString = null;
this.mPorts = webMessagePortCompatArr;
this.mType = 1;
}
@NonNull
public byte[] getArrayBuffer() {
checkType(1);
Objects.requireNonNull(this.mArrayBuffer);
return this.mArrayBuffer;
}
@Nullable
public String getData() {
checkType(0);
return this.mString;
}
private void checkType(int i) {
if (i == this.mType) {
return;
}
throw new IllegalStateException("Wrong data accessor type detected. " + typeToString(this.mType) + " expected, but got " + typeToString(i));
}
}

View File

@@ -0,0 +1,39 @@
package androidx.webkit;
import android.os.Handler;
import android.webkit.WebMessagePort;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import java.lang.reflect.InvocationHandler;
/* loaded from: classes.dex */
public abstract class WebMessagePortCompat {
public static abstract class WebMessageCallbackCompat {
public void onMessage(@NonNull WebMessagePortCompat webMessagePortCompat, @Nullable WebMessageCompat webMessageCompat) {
}
}
public abstract void close();
@NonNull
@RequiresApi(23)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public abstract WebMessagePort getFrameworkPort();
@NonNull
@RestrictTo({RestrictTo.Scope.LIBRARY})
public abstract InvocationHandler getInvocationHandler();
public abstract void postMessage(@NonNull WebMessageCompat webMessageCompat);
public abstract void setWebMessageCallback(@Nullable Handler handler, @NonNull WebMessageCallbackCompat webMessageCallbackCompat);
public abstract void setWebMessageCallback(@NonNull WebMessageCallbackCompat webMessageCallbackCompat);
@RestrictTo({RestrictTo.Scope.LIBRARY})
public WebMessagePortCompat() {
}
}

View File

@@ -0,0 +1,24 @@
package androidx.webkit;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/* loaded from: classes.dex */
public abstract class WebResourceErrorCompat {
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public @interface NetErrorCode {
}
@NonNull
public abstract CharSequence getDescription();
public abstract int getErrorCode();
@RestrictTo({RestrictTo.Scope.LIBRARY})
public WebResourceErrorCompat() {
}
}

View File

@@ -0,0 +1,30 @@
package androidx.webkit;
import android.webkit.WebResourceRequest;
import androidx.annotation.NonNull;
import androidx.webkit.internal.ApiFeature;
import androidx.webkit.internal.ApiHelperForN;
import androidx.webkit.internal.WebResourceRequestAdapter;
import androidx.webkit.internal.WebViewFeatureInternal;
import androidx.webkit.internal.WebViewGlueCommunicator;
/* loaded from: classes.dex */
public class WebResourceRequestCompat {
private WebResourceRequestCompat() {
}
public static boolean isRedirect(@NonNull WebResourceRequest webResourceRequest) {
ApiFeature.N n = WebViewFeatureInternal.WEB_RESOURCE_REQUEST_IS_REDIRECT;
if (n.isSupportedByFramework()) {
return ApiHelperForN.isRedirect(webResourceRequest);
}
if (n.isSupportedByWebView()) {
return getAdapter(webResourceRequest).isRedirect();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
private static WebResourceRequestAdapter getAdapter(WebResourceRequest webResourceRequest) {
return WebViewGlueCommunicator.getCompatConverter().convertWebResourceRequest(webResourceRequest);
}
}

View File

@@ -0,0 +1,277 @@
package androidx.webkit;
import android.webkit.WebSettings;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import androidx.webkit.internal.ApiFeature;
import androidx.webkit.internal.ApiHelperForM;
import androidx.webkit.internal.ApiHelperForN;
import androidx.webkit.internal.ApiHelperForO;
import androidx.webkit.internal.ApiHelperForQ;
import androidx.webkit.internal.WebSettingsAdapter;
import androidx.webkit.internal.WebViewFeatureInternal;
import androidx.webkit.internal.WebViewGlueCommunicator;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.Set;
/* loaded from: classes.dex */
public class WebSettingsCompat {
public static final int ATTRIBUTION_BEHAVIOR_APP_SOURCE_AND_APP_TRIGGER = 3;
public static final int ATTRIBUTION_BEHAVIOR_APP_SOURCE_AND_WEB_TRIGGER = 1;
public static final int ATTRIBUTION_BEHAVIOR_DISABLED = 0;
public static final int ATTRIBUTION_BEHAVIOR_WEB_SOURCE_AND_WEB_TRIGGER = 2;
@Deprecated
public static final int DARK_STRATEGY_PREFER_WEB_THEME_OVER_USER_AGENT_DARKENING = 2;
@Deprecated
public static final int DARK_STRATEGY_USER_AGENT_DARKENING_ONLY = 0;
@Deprecated
public static final int DARK_STRATEGY_WEB_THEME_DARKENING_ONLY = 1;
@Deprecated
public static final int FORCE_DARK_AUTO = 1;
@Deprecated
public static final int FORCE_DARK_OFF = 0;
@Deprecated
public static final int FORCE_DARK_ON = 2;
@Target({ElementType.PARAMETER, ElementType.METHOD})
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public @interface ForceDark {
}
@Target({ElementType.PARAMETER, ElementType.METHOD})
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public @interface ForceDarkStrategy {
}
@Target({ElementType.PARAMETER, ElementType.METHOD})
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public @interface MenuItemFlags {
}
private WebSettingsCompat() {
}
public static void setOffscreenPreRaster(@NonNull WebSettings webSettings, boolean z) {
ApiFeature.M m = WebViewFeatureInternal.OFF_SCREEN_PRERASTER;
if (m.isSupportedByFramework()) {
ApiHelperForM.setOffscreenPreRaster(webSettings, z);
} else {
if (m.isSupportedByWebView()) {
getAdapter(webSettings).setOffscreenPreRaster(z);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}
public static boolean getOffscreenPreRaster(@NonNull WebSettings webSettings) {
ApiFeature.M m = WebViewFeatureInternal.OFF_SCREEN_PRERASTER;
if (m.isSupportedByFramework()) {
return ApiHelperForM.getOffscreenPreRaster(webSettings);
}
if (m.isSupportedByWebView()) {
return getAdapter(webSettings).getOffscreenPreRaster();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
public static void setSafeBrowsingEnabled(@NonNull WebSettings webSettings, boolean z) {
ApiFeature.O o = WebViewFeatureInternal.SAFE_BROWSING_ENABLE;
if (o.isSupportedByFramework()) {
ApiHelperForO.setSafeBrowsingEnabled(webSettings, z);
} else {
if (o.isSupportedByWebView()) {
getAdapter(webSettings).setSafeBrowsingEnabled(z);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}
public static boolean getSafeBrowsingEnabled(@NonNull WebSettings webSettings) {
ApiFeature.O o = WebViewFeatureInternal.SAFE_BROWSING_ENABLE;
if (o.isSupportedByFramework()) {
return ApiHelperForO.getSafeBrowsingEnabled(webSettings);
}
if (o.isSupportedByWebView()) {
return getAdapter(webSettings).getSafeBrowsingEnabled();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
public static void setDisabledActionModeMenuItems(@NonNull WebSettings webSettings, int i) {
ApiFeature.N n = WebViewFeatureInternal.DISABLED_ACTION_MODE_MENU_ITEMS;
if (n.isSupportedByFramework()) {
ApiHelperForN.setDisabledActionModeMenuItems(webSettings, i);
} else {
if (n.isSupportedByWebView()) {
getAdapter(webSettings).setDisabledActionModeMenuItems(i);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}
public static int getDisabledActionModeMenuItems(@NonNull WebSettings webSettings) {
ApiFeature.N n = WebViewFeatureInternal.DISABLED_ACTION_MODE_MENU_ITEMS;
if (n.isSupportedByFramework()) {
return ApiHelperForN.getDisabledActionModeMenuItems(webSettings);
}
if (n.isSupportedByWebView()) {
return getAdapter(webSettings).getDisabledActionModeMenuItems();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@Deprecated
public static void setForceDark(@NonNull WebSettings webSettings, int i) {
ApiFeature.Q q = WebViewFeatureInternal.FORCE_DARK;
if (q.isSupportedByFramework()) {
ApiHelperForQ.setForceDark(webSettings, i);
} else {
if (q.isSupportedByWebView()) {
getAdapter(webSettings).setForceDark(i);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}
@Deprecated
public static int getForceDark(@NonNull WebSettings webSettings) {
ApiFeature.Q q = WebViewFeatureInternal.FORCE_DARK;
if (q.isSupportedByFramework()) {
return ApiHelperForQ.getForceDark(webSettings);
}
if (q.isSupportedByWebView()) {
return getAdapter(webSettings).getForceDark();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
public static void setAlgorithmicDarkeningAllowed(@NonNull WebSettings webSettings, boolean z) {
if (WebViewFeatureInternal.ALGORITHMIC_DARKENING.isSupportedByWebView()) {
getAdapter(webSettings).setAlgorithmicDarkeningAllowed(z);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
public static boolean isAlgorithmicDarkeningAllowed(@NonNull WebSettings webSettings) {
if (WebViewFeatureInternal.ALGORITHMIC_DARKENING.isSupportedByWebView()) {
return getAdapter(webSettings).isAlgorithmicDarkeningAllowed();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@Deprecated
public static void setForceDarkStrategy(@NonNull WebSettings webSettings, int i) {
if (WebViewFeatureInternal.FORCE_DARK_STRATEGY.isSupportedByWebView()) {
getAdapter(webSettings).setForceDarkStrategy(i);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@Deprecated
public static int getForceDarkStrategy(@NonNull WebSettings webSettings) {
if (WebViewFeatureInternal.FORCE_DARK_STRATEGY.isSupportedByWebView()) {
return getAdapter(webSettings).getForceDark();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
public static void setEnterpriseAuthenticationAppLinkPolicyEnabled(@NonNull WebSettings webSettings, boolean z) {
if (WebViewFeatureInternal.ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY.isSupportedByWebView()) {
getAdapter(webSettings).setEnterpriseAuthenticationAppLinkPolicyEnabled(z);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
public static boolean getEnterpriseAuthenticationAppLinkPolicyEnabled(@NonNull WebSettings webSettings) {
if (WebViewFeatureInternal.ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY.isSupportedByWebView()) {
return getAdapter(webSettings).getEnterpriseAuthenticationAppLinkPolicyEnabled();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@NonNull
public static Set<String> getRequestedWithHeaderOriginAllowList(@NonNull WebSettings webSettings) {
if (WebViewFeatureInternal.REQUESTED_WITH_HEADER_ALLOW_LIST.isSupportedByWebView()) {
return getAdapter(webSettings).getRequestedWithHeaderOriginAllowList();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
public static void setRequestedWithHeaderOriginAllowList(@NonNull WebSettings webSettings, @NonNull Set<String> set) {
if (WebViewFeatureInternal.REQUESTED_WITH_HEADER_ALLOW_LIST.isSupportedByWebView()) {
getAdapter(webSettings).setRequestedWithHeaderOriginAllowList(set);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
public static void setUserAgentMetadata(@NonNull WebSettings webSettings, @NonNull UserAgentMetadata userAgentMetadata) {
if (WebViewFeatureInternal.USER_AGENT_METADATA.isSupportedByWebView()) {
getAdapter(webSettings).setUserAgentMetadata(userAgentMetadata);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@NonNull
public static UserAgentMetadata getUserAgentMetadata(@NonNull WebSettings webSettings) {
if (WebViewFeatureInternal.USER_AGENT_METADATA.isSupportedByWebView()) {
return getAdapter(webSettings).getUserAgentMetadata();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
public static void setAttributionRegistrationBehavior(@NonNull WebSettings webSettings, int i) {
if (WebViewFeatureInternal.ATTRIBUTION_REGISTRATION_BEHAVIOR.isSupportedByWebView()) {
getAdapter(webSettings).setAttributionRegistrationBehavior(i);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
public static int getAttributionRegistrationBehavior(@NonNull WebSettings webSettings) {
if (WebViewFeatureInternal.ATTRIBUTION_REGISTRATION_BEHAVIOR.isSupportedByWebView()) {
return getAdapter(webSettings).getAttributionRegistrationBehavior();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
public static void setWebViewMediaIntegrityApiStatus(@NonNull WebSettings webSettings, @NonNull WebViewMediaIntegrityApiStatusConfig webViewMediaIntegrityApiStatusConfig) {
if (WebViewFeatureInternal.WEBVIEW_MEDIA_INTEGRITY_API_STATUS.isSupportedByWebView()) {
getAdapter(webSettings).setWebViewMediaIntegrityApiStatus(webViewMediaIntegrityApiStatusConfig);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@NonNull
public static WebViewMediaIntegrityApiStatusConfig getWebViewMediaIntegrityApiStatus(@NonNull WebSettings webSettings) {
if (WebViewFeatureInternal.WEBVIEW_MEDIA_INTEGRITY_API_STATUS.isSupportedByWebView()) {
return getAdapter(webSettings).getWebViewMediaIntegrityApiStatus();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
private static WebSettingsAdapter getAdapter(WebSettings webSettings) {
return WebViewGlueCommunicator.getCompatConverter().convertSettings(webSettings);
}
}

View File

@@ -0,0 +1,233 @@
package androidx.webkit;
import android.content.Context;
import android.content.res.Resources;
import android.net.Uri;
import android.util.Log;
import android.webkit.WebResourceResponse;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.annotation.WorkerThread;
import androidx.core.util.Pair;
import androidx.webkit.internal.AssetHelper;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/* loaded from: classes.dex */
public final class WebViewAssetLoader {
public static final String DEFAULT_DOMAIN = "appassets.androidplatform.net";
private static final String TAG = "WebViewAssetLoader";
private final List<PathMatcher> mMatchers;
public interface PathHandler {
@Nullable
@WorkerThread
WebResourceResponse handle(@NonNull String str);
}
public static final class AssetsPathHandler implements PathHandler {
private AssetHelper mAssetHelper;
public AssetsPathHandler(@NonNull Context context) {
this.mAssetHelper = new AssetHelper(context);
}
@VisibleForTesting
public AssetsPathHandler(@NonNull AssetHelper assetHelper) {
this.mAssetHelper = assetHelper;
}
@Override // androidx.webkit.WebViewAssetLoader.PathHandler
@Nullable
@WorkerThread
public WebResourceResponse handle(@NonNull String str) {
try {
return new WebResourceResponse(AssetHelper.guessMimeType(str), null, this.mAssetHelper.openAsset(str));
} catch (IOException e) {
Log.e(WebViewAssetLoader.TAG, "Error opening asset path: " + str, e);
return new WebResourceResponse(null, null, null);
}
}
}
public static final class ResourcesPathHandler implements PathHandler {
private AssetHelper mAssetHelper;
public ResourcesPathHandler(@NonNull Context context) {
this.mAssetHelper = new AssetHelper(context);
}
@VisibleForTesting
public ResourcesPathHandler(@NonNull AssetHelper assetHelper) {
this.mAssetHelper = assetHelper;
}
@Override // androidx.webkit.WebViewAssetLoader.PathHandler
@Nullable
@WorkerThread
public WebResourceResponse handle(@NonNull String str) {
try {
return new WebResourceResponse(AssetHelper.guessMimeType(str), null, this.mAssetHelper.openResource(str));
} catch (Resources.NotFoundException e) {
Log.e(WebViewAssetLoader.TAG, "Resource not found from the path: " + str, e);
return new WebResourceResponse(null, null, null);
} catch (IOException e2) {
Log.e(WebViewAssetLoader.TAG, "Error opening resource from the path: " + str, e2);
return new WebResourceResponse(null, null, null);
}
}
}
public static final class InternalStoragePathHandler implements PathHandler {
private static final String[] FORBIDDEN_DATA_DIRS = {"app_webview/", "databases/", "lib/", "shared_prefs/", "code_cache/"};
@NonNull
private final File mDirectory;
public InternalStoragePathHandler(@NonNull Context context, @NonNull File file) {
try {
this.mDirectory = new File(AssetHelper.getCanonicalDirPath(file));
if (isAllowedInternalStorageDir(context)) {
return;
}
throw new IllegalArgumentException("The given directory \"" + file + "\" doesn't exist under an allowed app internal storage directory");
} catch (IOException e) {
throw new IllegalArgumentException("Failed to resolve the canonical path for the given directory: " + file.getPath(), e);
}
}
private boolean isAllowedInternalStorageDir(@NonNull Context context) throws IOException {
String canonicalDirPath = AssetHelper.getCanonicalDirPath(this.mDirectory);
String canonicalDirPath2 = AssetHelper.getCanonicalDirPath(context.getCacheDir());
String canonicalDirPath3 = AssetHelper.getCanonicalDirPath(AssetHelper.getDataDir(context));
if ((!canonicalDirPath.startsWith(canonicalDirPath2) && !canonicalDirPath.startsWith(canonicalDirPath3)) || canonicalDirPath.equals(canonicalDirPath2) || canonicalDirPath.equals(canonicalDirPath3)) {
return false;
}
for (String str : FORBIDDEN_DATA_DIRS) {
if (canonicalDirPath.startsWith(canonicalDirPath3 + str)) {
return false;
}
}
return true;
}
@Override // androidx.webkit.WebViewAssetLoader.PathHandler
@NonNull
@WorkerThread
public WebResourceResponse handle(@NonNull String str) {
File canonicalFileIfChild;
try {
canonicalFileIfChild = AssetHelper.getCanonicalFileIfChild(this.mDirectory, str);
} catch (IOException e) {
Log.e(WebViewAssetLoader.TAG, "Error opening the requested path: " + str, e);
}
if (canonicalFileIfChild != null) {
return new WebResourceResponse(AssetHelper.guessMimeType(str), null, AssetHelper.openFile(canonicalFileIfChild));
}
Log.e(WebViewAssetLoader.TAG, String.format("The requested file: %s is outside the mounted directory: %s", str, this.mDirectory));
return new WebResourceResponse(null, null, null);
}
}
@VisibleForTesting
public static class PathMatcher {
static final String HTTPS_SCHEME = "https";
static final String HTTP_SCHEME = "http";
@NonNull
final String mAuthority;
@NonNull
final PathHandler mHandler;
final boolean mHttpEnabled;
@NonNull
final String mPath;
public PathMatcher(@NonNull String str, @NonNull String str2, boolean z, @NonNull PathHandler pathHandler) {
if (str2.isEmpty() || str2.charAt(0) != '/') {
throw new IllegalArgumentException("Path should start with a slash '/'.");
}
if (!str2.endsWith("/")) {
throw new IllegalArgumentException("Path should end with a slash '/'");
}
this.mAuthority = str;
this.mPath = str2;
this.mHttpEnabled = z;
this.mHandler = pathHandler;
}
@Nullable
@WorkerThread
public PathHandler match(@NonNull Uri uri) {
if (uri.getScheme().equals("http") && !this.mHttpEnabled) {
return null;
}
if ((uri.getScheme().equals("http") || uri.getScheme().equals("https")) && uri.getAuthority().equals(this.mAuthority) && uri.getPath().startsWith(this.mPath)) {
return this.mHandler;
}
return null;
}
@NonNull
@WorkerThread
public String getSuffixPath(@NonNull String str) {
return str.replaceFirst(this.mPath, "");
}
}
public static final class Builder {
private String mDomain = WebViewAssetLoader.DEFAULT_DOMAIN;
@NonNull
private final List<Pair<String, PathHandler>> mHandlerList = new ArrayList();
private boolean mHttpAllowed;
@NonNull
public Builder setDomain(@NonNull String str) {
this.mDomain = str;
return this;
}
@NonNull
public Builder setHttpAllowed(boolean z) {
this.mHttpAllowed = z;
return this;
}
@NonNull
public Builder addPathHandler(@NonNull String str, @NonNull PathHandler pathHandler) {
this.mHandlerList.add(Pair.create(str, pathHandler));
return this;
}
@NonNull
public WebViewAssetLoader build() {
ArrayList arrayList = new ArrayList();
for (Pair<String, PathHandler> pair : this.mHandlerList) {
arrayList.add(new PathMatcher(this.mDomain, pair.first, this.mHttpAllowed, pair.second));
}
return new WebViewAssetLoader(arrayList);
}
}
public WebViewAssetLoader(@NonNull List<PathMatcher> list) {
this.mMatchers = list;
}
@Nullable
@WorkerThread
public WebResourceResponse shouldInterceptRequest(@NonNull Uri uri) {
WebResourceResponse handle;
for (PathMatcher pathMatcher : this.mMatchers) {
PathHandler match = pathMatcher.match(uri);
if (match != null && (handle = match.handle(pathMatcher.getSuffixPath(uri.getPath()))) != null) {
return handle;
}
}
return null;
}
}

View File

@@ -0,0 +1,103 @@
package androidx.webkit;
import android.app.PendingIntent;
import android.webkit.SafeBrowsingResponse;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.annotation.UiThread;
import androidx.webkit.internal.ApiHelperForLollipop;
import androidx.webkit.internal.SafeBrowsingResponseImpl;
import androidx.webkit.internal.WebResourceErrorImpl;
import androidx.webkit.internal.WebViewFeatureInternal;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.reflect.InvocationHandler;
import org.chromium.support_lib_boundary.WebViewClientBoundaryInterface;
/* loaded from: classes.dex */
public class WebViewClientCompat extends WebViewClient implements WebViewClientBoundaryInterface {
private static final String[] sSupportedFeatures = {WebViewFeature.VISUAL_STATE_CALLBACK, WebViewFeature.RECEIVE_WEB_RESOURCE_ERROR, WebViewFeature.RECEIVE_HTTP_ERROR, WebViewFeature.SHOULD_OVERRIDE_WITH_REDIRECTS, WebViewFeature.SAFE_BROWSING_HIT};
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public @interface SafeBrowsingThreat {
}
@Override // org.chromium.support_lib_boundary.FeatureFlagHolderBoundaryInterface
@NonNull
@RestrictTo({RestrictTo.Scope.LIBRARY})
public final String[] getSupportedFeatures() {
return sSupportedFeatures;
}
@Override // android.webkit.WebViewClient, org.chromium.support_lib_boundary.WebViewClientBoundaryInterface
@UiThread
public void onPageCommitVisible(@NonNull WebView webView, @NonNull String str) {
}
@Override // android.webkit.WebViewClient, org.chromium.support_lib_boundary.WebViewClientBoundaryInterface
@UiThread
public void onReceivedHttpError(@NonNull WebView webView, @NonNull WebResourceRequest webResourceRequest, @NonNull WebResourceResponse webResourceResponse) {
}
@Override // org.chromium.support_lib_boundary.WebViewClientBoundaryInterface
@RestrictTo({RestrictTo.Scope.LIBRARY})
public boolean onWebAuthnIntent(@NonNull WebView webView, @NonNull PendingIntent pendingIntent, @NonNull InvocationHandler invocationHandler) {
return false;
}
@Override // org.chromium.support_lib_boundary.WebViewClientBoundaryInterface
@RequiresApi(21)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public final void onReceivedError(@NonNull WebView webView, @NonNull WebResourceRequest webResourceRequest, @NonNull InvocationHandler invocationHandler) {
onReceivedError(webView, webResourceRequest, new WebResourceErrorImpl(invocationHandler));
}
@Override // android.webkit.WebViewClient
@RequiresApi(23)
public final void onReceivedError(@NonNull WebView webView, @NonNull WebResourceRequest webResourceRequest, @NonNull WebResourceError webResourceError) {
onReceivedError(webView, webResourceRequest, new WebResourceErrorImpl(webResourceError));
}
@RequiresApi(21)
@UiThread
public void onReceivedError(@NonNull WebView webView, @NonNull WebResourceRequest webResourceRequest, @NonNull WebResourceErrorCompat webResourceErrorCompat) {
if (WebViewFeature.isFeatureSupported(WebViewFeature.WEB_RESOURCE_ERROR_GET_CODE) && WebViewFeature.isFeatureSupported(WebViewFeature.WEB_RESOURCE_ERROR_GET_DESCRIPTION) && ApiHelperForLollipop.isForMainFrame(webResourceRequest)) {
onReceivedError(webView, webResourceErrorCompat.getErrorCode(), webResourceErrorCompat.getDescription().toString(), ApiHelperForLollipop.getUrl(webResourceRequest).toString());
}
}
@Override // org.chromium.support_lib_boundary.WebViewClientBoundaryInterface
@RestrictTo({RestrictTo.Scope.LIBRARY})
public final void onSafeBrowsingHit(@NonNull WebView webView, @NonNull WebResourceRequest webResourceRequest, int i, @NonNull InvocationHandler invocationHandler) {
onSafeBrowsingHit(webView, webResourceRequest, i, new SafeBrowsingResponseImpl(invocationHandler));
}
@Override // android.webkit.WebViewClient
@RequiresApi(27)
public final void onSafeBrowsingHit(@NonNull WebView webView, @NonNull WebResourceRequest webResourceRequest, int i, @NonNull SafeBrowsingResponse safeBrowsingResponse) {
onSafeBrowsingHit(webView, webResourceRequest, i, new SafeBrowsingResponseImpl(safeBrowsingResponse));
}
@UiThread
public void onSafeBrowsingHit(@NonNull WebView webView, @NonNull WebResourceRequest webResourceRequest, int i, @NonNull SafeBrowsingResponseCompat safeBrowsingResponseCompat) {
if (WebViewFeature.isFeatureSupported(WebViewFeature.SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL)) {
safeBrowsingResponseCompat.showInterstitial(true);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@Override // android.webkit.WebViewClient, org.chromium.support_lib_boundary.WebViewClientBoundaryInterface
@RequiresApi(21)
@UiThread
public boolean shouldOverrideUrlLoading(@NonNull WebView webView, @NonNull WebResourceRequest webResourceRequest) {
return shouldOverrideUrlLoading(webView, ApiHelperForLollipop.getUrl(webResourceRequest).toString());
}
}

View File

@@ -0,0 +1,367 @@
package androidx.webkit;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Looper;
import android.webkit.ValueCallback;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.annotation.UiThread;
import androidx.webkit.internal.ApiFeature;
import androidx.webkit.internal.ApiHelperForM;
import androidx.webkit.internal.ApiHelperForO;
import androidx.webkit.internal.ApiHelperForOMR1;
import androidx.webkit.internal.ApiHelperForP;
import androidx.webkit.internal.ApiHelperForQ;
import androidx.webkit.internal.WebMessageAdapter;
import androidx.webkit.internal.WebMessagePortImpl;
import androidx.webkit.internal.WebViewFeatureInternal;
import androidx.webkit.internal.WebViewGlueCommunicator;
import androidx.webkit.internal.WebViewProviderAdapter;
import androidx.webkit.internal.WebViewProviderFactory;
import androidx.webkit.internal.WebViewRenderProcessClientFrameworkAdapter;
import androidx.webkit.internal.WebViewRenderProcessImpl;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Executor;
import org.chromium.support_lib_boundary.WebViewProviderBoundaryInterface;
/* loaded from: classes.dex */
public class WebViewCompat {
private static final Uri WILDCARD_URI = Uri.parse(ProxyConfig.MATCH_ALL_SCHEMES);
private static final Uri EMPTY_URI = Uri.parse("");
public interface VisualStateCallback {
@UiThread
void onComplete(long j);
}
public interface WebMessageListener {
@UiThread
void onPostMessage(@NonNull WebView webView, @NonNull WebMessageCompat webMessageCompat, @NonNull Uri uri, boolean z, @NonNull JavaScriptReplyProxy javaScriptReplyProxy);
}
private WebViewCompat() {
}
public static void postVisualStateCallback(@NonNull WebView webView, long j, @NonNull VisualStateCallback visualStateCallback) {
ApiFeature.M m = WebViewFeatureInternal.VISUAL_STATE_CALLBACK;
if (m.isSupportedByFramework()) {
ApiHelperForM.postVisualStateCallback(webView, j, visualStateCallback);
} else {
if (m.isSupportedByWebView()) {
checkThread(webView);
getProvider(webView).insertVisualStateCallback(j, visualStateCallback);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}
public static void startSafeBrowsing(@NonNull Context context, @Nullable ValueCallback<Boolean> valueCallback) {
ApiFeature.O_MR1 o_mr1 = WebViewFeatureInternal.START_SAFE_BROWSING;
if (o_mr1.isSupportedByFramework()) {
ApiHelperForOMR1.startSafeBrowsing(context, valueCallback);
} else {
if (o_mr1.isSupportedByWebView()) {
getFactory().getStatics().initSafeBrowsing(context, valueCallback);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}
public static void setSafeBrowsingAllowlist(@NonNull Set<String> set, @Nullable ValueCallback<Boolean> valueCallback) {
ApiFeature.O_MR1 o_mr1 = WebViewFeatureInternal.SAFE_BROWSING_ALLOWLIST_PREFERRED_TO_PREFERRED;
ApiFeature.O_MR1 o_mr12 = WebViewFeatureInternal.SAFE_BROWSING_ALLOWLIST_PREFERRED_TO_DEPRECATED;
if (o_mr1.isSupportedByWebView()) {
getFactory().getStatics().setSafeBrowsingAllowlist(set, valueCallback);
return;
}
ArrayList arrayList = new ArrayList(set);
if (o_mr12.isSupportedByFramework()) {
ApiHelperForOMR1.setSafeBrowsingWhitelist(arrayList, valueCallback);
} else {
if (o_mr12.isSupportedByWebView()) {
getFactory().getStatics().setSafeBrowsingWhitelist(arrayList, valueCallback);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}
@Deprecated
public static void setSafeBrowsingWhitelist(@NonNull List<String> list, @Nullable ValueCallback<Boolean> valueCallback) {
setSafeBrowsingAllowlist(new HashSet(list), valueCallback);
}
@NonNull
public static Uri getSafeBrowsingPrivacyPolicyUrl() {
ApiFeature.O_MR1 o_mr1 = WebViewFeatureInternal.SAFE_BROWSING_PRIVACY_POLICY_URL;
if (o_mr1.isSupportedByFramework()) {
return ApiHelperForOMR1.getSafeBrowsingPrivacyPolicyUrl();
}
if (o_mr1.isSupportedByWebView()) {
return getFactory().getStatics().getSafeBrowsingPrivacyPolicyUrl();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@Nullable
public static PackageInfo getCurrentWebViewPackage(@NonNull Context context) {
PackageInfo currentLoadedWebViewPackage = getCurrentLoadedWebViewPackage();
return currentLoadedWebViewPackage != null ? currentLoadedWebViewPackage : getNotYetLoadedWebViewPackageInfo(context);
}
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY})
public static PackageInfo getCurrentLoadedWebViewPackage() {
return ApiHelperForO.getCurrentWebViewPackage();
}
@SuppressLint({"PrivateApi"})
private static PackageInfo getLoadedWebViewPackageInfo() throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
return (PackageInfo) Class.forName("android.webkit.WebViewFactory").getMethod("getLoadedPackageInfo", new Class[0]).invoke(null, new Object[0]);
}
@SuppressLint({"PrivateApi"})
private static PackageInfo getNotYetLoadedWebViewPackageInfo(Context context) {
try {
String str = (String) Class.forName("android.webkit.WebViewUpdateService").getMethod("getCurrentWebViewPackageName", new Class[0]).invoke(null, new Object[0]);
if (str == null) {
return null;
}
return context.getPackageManager().getPackageInfo(str, 0);
} catch (PackageManager.NameNotFoundException | ClassNotFoundException | IllegalAccessException | NoSuchMethodException | InvocationTargetException unused) {
return null;
}
}
private static WebViewProviderAdapter getProvider(WebView webView) {
return new WebViewProviderAdapter(createProvider(webView));
}
@NonNull
public static WebMessagePortCompat[] createWebMessageChannel(@NonNull WebView webView) {
ApiFeature.M m = WebViewFeatureInternal.CREATE_WEB_MESSAGE_CHANNEL;
if (m.isSupportedByFramework()) {
return WebMessagePortImpl.portsToCompat(ApiHelperForM.createWebMessageChannel(webView));
}
if (m.isSupportedByWebView()) {
return getProvider(webView).createWebMessageChannel();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
public static void postWebMessage(@NonNull WebView webView, @NonNull WebMessageCompat webMessageCompat, @NonNull Uri uri) {
if (WILDCARD_URI.equals(uri)) {
uri = EMPTY_URI;
}
ApiFeature.M m = WebViewFeatureInternal.POST_WEB_MESSAGE;
if (m.isSupportedByFramework() && webMessageCompat.getType() == 0) {
ApiHelperForM.postWebMessage(webView, WebMessagePortImpl.compatToFrameworkMessage(webMessageCompat), uri);
} else {
if (m.isSupportedByWebView() && WebMessageAdapter.isMessagePayloadTypeSupportedByWebView(webMessageCompat.getType())) {
getProvider(webView).postWebMessage(webMessageCompat, uri);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}
public static void addWebMessageListener(@NonNull WebView webView, @NonNull String str, @NonNull Set<String> set, @NonNull WebMessageListener webMessageListener) {
if (WebViewFeatureInternal.WEB_MESSAGE_LISTENER.isSupportedByWebView()) {
getProvider(webView).addWebMessageListener(str, (String[]) set.toArray(new String[0]), webMessageListener);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
public static void removeWebMessageListener(@NonNull WebView webView, @NonNull String str) {
if (WebViewFeatureInternal.WEB_MESSAGE_LISTENER.isSupportedByWebView()) {
getProvider(webView).removeWebMessageListener(str);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@NonNull
public static ScriptHandler addDocumentStartJavaScript(@NonNull WebView webView, @NonNull String str, @NonNull Set<String> set) {
if (WebViewFeatureInternal.DOCUMENT_START_SCRIPT.isSupportedByWebView()) {
return getProvider(webView).addDocumentStartJavaScript(str, (String[]) set.toArray(new String[0]));
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@NonNull
public static WebViewClient getWebViewClient(@NonNull WebView webView) {
ApiFeature.O o = WebViewFeatureInternal.GET_WEB_VIEW_CLIENT;
if (o.isSupportedByFramework()) {
return ApiHelperForO.getWebViewClient(webView);
}
if (o.isSupportedByWebView()) {
return getProvider(webView).getWebViewClient();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@Nullable
public static WebChromeClient getWebChromeClient(@NonNull WebView webView) {
ApiFeature.O o = WebViewFeatureInternal.GET_WEB_CHROME_CLIENT;
if (o.isSupportedByFramework()) {
return ApiHelperForO.getWebChromeClient(webView);
}
if (o.isSupportedByWebView()) {
return getProvider(webView).getWebChromeClient();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@Nullable
public static WebViewRenderProcess getWebViewRenderProcess(@NonNull WebView webView) {
ApiFeature.Q q = WebViewFeatureInternal.GET_WEB_VIEW_RENDERER;
if (q.isSupportedByFramework()) {
android.webkit.WebViewRenderProcess webViewRenderProcess = ApiHelperForQ.getWebViewRenderProcess(webView);
if (webViewRenderProcess != null) {
return WebViewRenderProcessImpl.forFrameworkObject(webViewRenderProcess);
}
return null;
}
if (q.isSupportedByWebView()) {
return getProvider(webView).getWebViewRenderProcess();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@SuppressLint({"LambdaLast"})
public static void setWebViewRenderProcessClient(@NonNull WebView webView, @NonNull Executor executor, @NonNull WebViewRenderProcessClient webViewRenderProcessClient) {
ApiFeature.Q q = WebViewFeatureInternal.WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE;
if (q.isSupportedByFramework()) {
ApiHelperForQ.setWebViewRenderProcessClient(webView, executor, webViewRenderProcessClient);
} else {
if (q.isSupportedByWebView()) {
getProvider(webView).setWebViewRenderProcessClient(executor, webViewRenderProcessClient);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}
public static void setWebViewRenderProcessClient(@NonNull WebView webView, @Nullable WebViewRenderProcessClient webViewRenderProcessClient) {
ApiFeature.Q q = WebViewFeatureInternal.WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE;
if (q.isSupportedByFramework()) {
ApiHelperForQ.setWebViewRenderProcessClient(webView, webViewRenderProcessClient);
} else {
if (q.isSupportedByWebView()) {
getProvider(webView).setWebViewRenderProcessClient(null, webViewRenderProcessClient);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}
@Nullable
public static WebViewRenderProcessClient getWebViewRenderProcessClient(@NonNull WebView webView) {
ApiFeature.Q q = WebViewFeatureInternal.WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE;
if (q.isSupportedByFramework()) {
android.webkit.WebViewRenderProcessClient webViewRenderProcessClient = ApiHelperForQ.getWebViewRenderProcessClient(webView);
if (webViewRenderProcessClient == null || !(webViewRenderProcessClient instanceof WebViewRenderProcessClientFrameworkAdapter)) {
return null;
}
return ((WebViewRenderProcessClientFrameworkAdapter) webViewRenderProcessClient).getFrameworkRenderProcessClient();
}
if (q.isSupportedByWebView()) {
return getProvider(webView).getWebViewRenderProcessClient();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
public static boolean isMultiProcessEnabled() {
if (WebViewFeatureInternal.MULTI_PROCESS.isSupportedByWebView()) {
return getFactory().getStatics().isMultiProcessEnabled();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@NonNull
public static String getVariationsHeader() {
if (WebViewFeatureInternal.GET_VARIATIONS_HEADER.isSupportedByWebView()) {
return getFactory().getStatics().getVariationsHeader();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@UiThread
public static void setProfile(@NonNull WebView webView, @NonNull String str) {
if (WebViewFeatureInternal.MULTI_PROFILE.isSupportedByWebView()) {
getProvider(webView).setProfileWithName(str);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@NonNull
@UiThread
public static Profile getProfile(@NonNull WebView webView) {
if (WebViewFeatureInternal.MULTI_PROFILE.isSupportedByWebView()) {
return getProvider(webView).getProfile();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
public static boolean isAudioMuted(@NonNull WebView webView) {
if (WebViewFeatureInternal.MUTE_AUDIO.isSupportedByWebView()) {
return getProvider(webView).isAudioMuted();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
public static void setAudioMuted(@NonNull WebView webView, boolean z) {
if (WebViewFeatureInternal.MUTE_AUDIO.isSupportedByWebView()) {
getProvider(webView).setAudioMuted(z);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
private static WebViewProviderFactory getFactory() {
return WebViewGlueCommunicator.getFactory();
}
private static WebViewProviderBoundaryInterface createProvider(WebView webView) {
return getFactory().createWebView(webView);
}
private static void checkThread(WebView webView) {
if (Build.VERSION.SDK_INT >= 28) {
Looper webViewLooper = ApiHelperForP.getWebViewLooper(webView);
if (webViewLooper == Looper.myLooper()) {
return;
}
throw new RuntimeException("A WebView method was called on thread '" + Thread.currentThread().getName() + "'. All WebView methods must be called on the same thread. (Expected Looper " + webViewLooper + " called on " + Looper.myLooper() + ", FYI main Looper is " + Looper.getMainLooper() + ")");
}
try {
Method declaredMethod = WebView.class.getDeclaredMethod("checkThread", new Class[0]);
declaredMethod.setAccessible(true);
declaredMethod.invoke(webView, new Object[0]);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (NoSuchMethodException e2) {
throw new RuntimeException(e2);
} catch (InvocationTargetException e3) {
throw new RuntimeException(e3);
}
}
}

View File

@@ -0,0 +1,100 @@
package androidx.webkit;
import android.annotation.SuppressLint;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import androidx.webkit.internal.WebViewFeatureInternal;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/* loaded from: classes.dex */
public class WebViewFeature {
public static final String ALGORITHMIC_DARKENING = "ALGORITHMIC_DARKENING";
public static final String ATTRIBUTION_REGISTRATION_BEHAVIOR = "ATTRIBUTION_REGISTRATION_BEHAVIOR";
public static final String CREATE_WEB_MESSAGE_CHANNEL = "CREATE_WEB_MESSAGE_CHANNEL";
@SuppressLint({"IntentName"})
public static final String DISABLED_ACTION_MODE_MENU_ITEMS = "DISABLED_ACTION_MODE_MENU_ITEMS";
public static final String DOCUMENT_START_SCRIPT = "DOCUMENT_START_SCRIPT";
public static final String ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY = "ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY";
public static final String FORCE_DARK = "FORCE_DARK";
public static final String FORCE_DARK_STRATEGY = "FORCE_DARK_STRATEGY";
public static final String GET_COOKIE_INFO = "GET_COOKIE_INFO";
public static final String GET_VARIATIONS_HEADER = "GET_VARIATIONS_HEADER";
public static final String GET_WEB_CHROME_CLIENT = "GET_WEB_CHROME_CLIENT";
public static final String GET_WEB_VIEW_CLIENT = "GET_WEB_VIEW_CLIENT";
public static final String GET_WEB_VIEW_RENDERER = "GET_WEB_VIEW_RENDERER";
public static final String MULTI_PROCESS = "MULTI_PROCESS";
public static final String MULTI_PROFILE = "MULTI_PROFILE";
public static final String MUTE_AUDIO = "MUTE_AUDIO";
public static final String OFF_SCREEN_PRERASTER = "OFF_SCREEN_PRERASTER";
public static final String POST_WEB_MESSAGE = "POST_WEB_MESSAGE";
public static final String PROXY_OVERRIDE = "PROXY_OVERRIDE";
public static final String PROXY_OVERRIDE_REVERSE_BYPASS = "PROXY_OVERRIDE_REVERSE_BYPASS";
public static final String RECEIVE_HTTP_ERROR = "RECEIVE_HTTP_ERROR";
public static final String RECEIVE_WEB_RESOURCE_ERROR = "RECEIVE_WEB_RESOURCE_ERROR";
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public static final String REQUESTED_WITH_HEADER_ALLOW_LIST = "REQUESTED_WITH_HEADER_ALLOW_LIST";
public static final String SAFE_BROWSING_ALLOWLIST = "SAFE_BROWSING_ALLOWLIST";
public static final String SAFE_BROWSING_ENABLE = "SAFE_BROWSING_ENABLE";
public static final String SAFE_BROWSING_HIT = "SAFE_BROWSING_HIT";
public static final String SAFE_BROWSING_PRIVACY_POLICY_URL = "SAFE_BROWSING_PRIVACY_POLICY_URL";
public static final String SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY = "SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY";
public static final String SAFE_BROWSING_RESPONSE_PROCEED = "SAFE_BROWSING_RESPONSE_PROCEED";
public static final String SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL = "SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL";
@Deprecated
public static final String SAFE_BROWSING_WHITELIST = "SAFE_BROWSING_WHITELIST";
public static final String SERVICE_WORKER_BASIC_USAGE = "SERVICE_WORKER_BASIC_USAGE";
public static final String SERVICE_WORKER_BLOCK_NETWORK_LOADS = "SERVICE_WORKER_BLOCK_NETWORK_LOADS";
public static final String SERVICE_WORKER_CACHE_MODE = "SERVICE_WORKER_CACHE_MODE";
public static final String SERVICE_WORKER_CONTENT_ACCESS = "SERVICE_WORKER_CONTENT_ACCESS";
public static final String SERVICE_WORKER_FILE_ACCESS = "SERVICE_WORKER_FILE_ACCESS";
public static final String SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST = "SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST";
public static final String SHOULD_OVERRIDE_WITH_REDIRECTS = "SHOULD_OVERRIDE_WITH_REDIRECTS";
public static final String STARTUP_FEATURE_SET_DATA_DIRECTORY_SUFFIX = "STARTUP_FEATURE_SET_DATA_DIRECTORY_SUFFIX";
public static final String STARTUP_FEATURE_SET_DIRECTORY_BASE_PATHS = "STARTUP_FEATURE_SET_DIRECTORY_BASE_PATHS";
public static final String START_SAFE_BROWSING = "START_SAFE_BROWSING";
public static final String TRACING_CONTROLLER_BASIC_USAGE = "TRACING_CONTROLLER_BASIC_USAGE";
public static final String USER_AGENT_METADATA = "USER_AGENT_METADATA";
public static final String VISUAL_STATE_CALLBACK = "VISUAL_STATE_CALLBACK";
public static final String WEBVIEW_MEDIA_INTEGRITY_API_STATUS = "WEBVIEW_MEDIA_INTEGRITY_API_STATUS";
public static final String WEB_MESSAGE_ARRAY_BUFFER = "WEB_MESSAGE_ARRAY_BUFFER";
public static final String WEB_MESSAGE_CALLBACK_ON_MESSAGE = "WEB_MESSAGE_CALLBACK_ON_MESSAGE";
public static final String WEB_MESSAGE_LISTENER = "WEB_MESSAGE_LISTENER";
public static final String WEB_MESSAGE_PORT_CLOSE = "WEB_MESSAGE_PORT_CLOSE";
public static final String WEB_MESSAGE_PORT_POST_MESSAGE = "WEB_MESSAGE_PORT_POST_MESSAGE";
public static final String WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK = "WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK";
public static final String WEB_RESOURCE_ERROR_GET_CODE = "WEB_RESOURCE_ERROR_GET_CODE";
public static final String WEB_RESOURCE_ERROR_GET_DESCRIPTION = "WEB_RESOURCE_ERROR_GET_DESCRIPTION";
public static final String WEB_RESOURCE_REQUEST_IS_REDIRECT = "WEB_RESOURCE_REQUEST_IS_REDIRECT";
public static final String WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE = "WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE";
public static final String WEB_VIEW_RENDERER_TERMINATE = "WEB_VIEW_RENDERER_TERMINATE";
@Target({ElementType.PARAMETER, ElementType.METHOD})
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public @interface WebViewStartupFeature {
}
@Target({ElementType.PARAMETER, ElementType.METHOD})
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public @interface WebViewSupportFeature {
}
private WebViewFeature() {
}
public static boolean isFeatureSupported(@NonNull String str) {
return WebViewFeatureInternal.isSupported(str);
}
public static boolean isStartupFeatureSupported(@NonNull Context context, @NonNull String str) {
return WebViewFeatureInternal.isStartupFeatureSupported(str, context);
}
}

View File

@@ -0,0 +1,56 @@
package androidx.webkit;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import java.util.HashMap;
import java.util.Map;
/* loaded from: classes.dex */
public class WebViewMediaIntegrityApiStatusConfig {
public static final int WEBVIEW_MEDIA_INTEGRITY_API_DISABLED = 0;
public static final int WEBVIEW_MEDIA_INTEGRITY_API_ENABLED = 2;
public static final int WEBVIEW_MEDIA_INTEGRITY_API_ENABLED_WITHOUT_APP_IDENTITY = 1;
private int mDefaultStatus;
private Map<String, Integer> mOverrideRules;
public int getDefaultStatus() {
return this.mDefaultStatus;
}
@NonNull
public Map<String, Integer> getOverrideRules() {
return this.mOverrideRules;
}
public WebViewMediaIntegrityApiStatusConfig(@NonNull Builder builder) {
this.mDefaultStatus = builder.mDefaultStatus;
this.mOverrideRules = builder.mOverrideRules;
}
public static final class Builder {
private int mDefaultStatus;
private Map<String, Integer> mOverrideRules = new HashMap();
@NonNull
@RestrictTo({RestrictTo.Scope.LIBRARY})
public Builder setOverrideRules(@NonNull Map<String, Integer> map) {
this.mOverrideRules = map;
return this;
}
public Builder(int i) {
this.mDefaultStatus = i;
}
@NonNull
public Builder addOverrideRule(@NonNull String str, int i) {
this.mOverrideRules.put(str, Integer.valueOf(i));
return this;
}
@NonNull
public WebViewMediaIntegrityApiStatusConfig build() {
return new WebViewMediaIntegrityApiStatusConfig(this);
}
}
}

View File

@@ -0,0 +1,6 @@
package androidx.webkit;
/* loaded from: classes.dex */
public abstract class WebViewRenderProcess {
public abstract boolean terminate();
}

View File

@@ -0,0 +1,12 @@
package androidx.webkit;
import android.webkit.WebView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
/* loaded from: classes.dex */
public abstract class WebViewRenderProcessClient {
public abstract void onRenderProcessResponsive(@NonNull WebView webView, @Nullable WebViewRenderProcess webViewRenderProcess);
public abstract void onRenderProcessUnresponsive(@NonNull WebView webView, @Nullable WebViewRenderProcess webViewRenderProcess);
}

View File

@@ -0,0 +1,148 @@
package androidx.webkit.internal;
import android.os.Build;
import androidx.annotation.ChecksSdkIntAtLeast;
import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import org.chromium.support_lib_boundary.util.BoundaryInterfaceReflectionUtil;
/* loaded from: classes.dex */
public abstract class ApiFeature implements ConditionallySupportedFeature {
private static final Set<ApiFeature> sValues = new HashSet();
private final String mInternalFeatureValue;
private final String mPublicFeatureValue;
@Override // androidx.webkit.internal.ConditionallySupportedFeature
@NonNull
public String getPublicFeatureName() {
return this.mPublicFeatureValue;
}
public abstract boolean isSupportedByFramework();
public ApiFeature(@NonNull String str, @NonNull String str2) {
this.mPublicFeatureValue = str;
this.mInternalFeatureValue = str2;
sValues.add(this);
}
@Override // androidx.webkit.internal.ConditionallySupportedFeature
public boolean isSupported() {
return isSupportedByFramework() || isSupportedByWebView();
}
@ChecksSdkIntAtLeast(api = 21)
public boolean isSupportedByWebView() {
return BoundaryInterfaceReflectionUtil.containsFeature(LAZY_HOLDER.WEBVIEW_APK_FEATURES, this.mInternalFeatureValue);
}
@NonNull
public static Set<ApiFeature> values() {
return Collections.unmodifiableSet(sValues);
}
@NonNull
@VisibleForTesting
public static Set<String> getWebViewApkFeaturesForTesting() {
return LAZY_HOLDER.WEBVIEW_APK_FEATURES;
}
public static class LAZY_HOLDER {
static final Set<String> WEBVIEW_APK_FEATURES = new HashSet(Arrays.asList(WebViewGlueCommunicator.getFactory().getWebViewFeatures()));
private LAZY_HOLDER() {
}
}
public static class NoFramework extends ApiFeature {
@Override // androidx.webkit.internal.ApiFeature
public final boolean isSupportedByFramework() {
return false;
}
public NoFramework(@NonNull String str, @NonNull String str2) {
super(str, str2);
}
}
public static class M extends ApiFeature {
@Override // androidx.webkit.internal.ApiFeature
public final boolean isSupportedByFramework() {
return true;
}
public M(@NonNull String str, @NonNull String str2) {
super(str, str2);
}
}
public static class N extends ApiFeature {
@Override // androidx.webkit.internal.ApiFeature
public final boolean isSupportedByFramework() {
return true;
}
public N(@NonNull String str, @NonNull String str2) {
super(str, str2);
}
}
public static class O extends ApiFeature {
@Override // androidx.webkit.internal.ApiFeature
public final boolean isSupportedByFramework() {
return true;
}
public O(@NonNull String str, @NonNull String str2) {
super(str, str2);
}
}
public static class O_MR1 extends ApiFeature {
@Override // androidx.webkit.internal.ApiFeature
public final boolean isSupportedByFramework() {
return Build.VERSION.SDK_INT >= 27;
}
public O_MR1(@NonNull String str, @NonNull String str2) {
super(str, str2);
}
}
public static class P extends ApiFeature {
@Override // androidx.webkit.internal.ApiFeature
public final boolean isSupportedByFramework() {
return Build.VERSION.SDK_INT >= 28;
}
public P(@NonNull String str, @NonNull String str2) {
super(str, str2);
}
}
public static class Q extends ApiFeature {
@Override // androidx.webkit.internal.ApiFeature
public final boolean isSupportedByFramework() {
return Build.VERSION.SDK_INT >= 29;
}
public Q(@NonNull String str, @NonNull String str2) {
super(str, str2);
}
}
public static class T extends ApiFeature {
@Override // androidx.webkit.internal.ApiFeature
public final boolean isSupportedByFramework() {
return Build.VERSION.SDK_INT >= 33;
}
public T(@NonNull String str, @NonNull String str2) {
super(str, str2);
}
}
}

View File

@@ -0,0 +1,25 @@
package androidx.webkit.internal;
import android.net.Uri;
import android.webkit.WebResourceRequest;
import androidx.annotation.DoNotInline;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
@RequiresApi(21)
/* loaded from: classes.dex */
public class ApiHelperForLollipop {
private ApiHelperForLollipop() {
}
@DoNotInline
public static boolean isForMainFrame(@NonNull WebResourceRequest webResourceRequest) {
return webResourceRequest.isForMainFrame();
}
@NonNull
@DoNotInline
public static Uri getUrl(@NonNull WebResourceRequest webResourceRequest) {
return webResourceRequest.getUrl();
}
}

View File

@@ -0,0 +1,107 @@
package androidx.webkit.internal;
import android.net.Uri;
import android.os.Handler;
import android.webkit.WebMessage;
import android.webkit.WebMessagePort;
import android.webkit.WebResourceError;
import android.webkit.WebSettings;
import android.webkit.WebView;
import androidx.annotation.DoNotInline;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.webkit.WebMessageCompat;
import androidx.webkit.WebMessagePortCompat;
import androidx.webkit.WebViewCompat;
@RequiresApi(23)
/* loaded from: classes.dex */
public class ApiHelperForM {
private ApiHelperForM() {
}
@DoNotInline
public static void postMessage(@NonNull WebMessagePort webMessagePort, @NonNull WebMessage webMessage) {
webMessagePort.postMessage(webMessage);
}
@DoNotInline
public static void close(@NonNull WebMessagePort webMessagePort) {
webMessagePort.close();
}
@DoNotInline
public static void setWebMessageCallback(@NonNull WebMessagePort webMessagePort, @NonNull final WebMessagePortCompat.WebMessageCallbackCompat webMessageCallbackCompat) {
webMessagePort.setWebMessageCallback(new WebMessagePort.WebMessageCallback() { // from class: androidx.webkit.internal.ApiHelperForM.1
@Override // android.webkit.WebMessagePort.WebMessageCallback
public void onMessage(WebMessagePort webMessagePort2, WebMessage webMessage) {
WebMessagePortCompat.WebMessageCallbackCompat.this.onMessage(new WebMessagePortImpl(webMessagePort2), WebMessagePortImpl.frameworkMessageToCompat(webMessage));
}
});
}
@DoNotInline
public static void setWebMessageCallback(@NonNull WebMessagePort webMessagePort, @NonNull final WebMessagePortCompat.WebMessageCallbackCompat webMessageCallbackCompat, @Nullable Handler handler) {
webMessagePort.setWebMessageCallback(new WebMessagePort.WebMessageCallback() { // from class: androidx.webkit.internal.ApiHelperForM.2
@Override // android.webkit.WebMessagePort.WebMessageCallback
public void onMessage(WebMessagePort webMessagePort2, WebMessage webMessage) {
WebMessagePortCompat.WebMessageCallbackCompat.this.onMessage(new WebMessagePortImpl(webMessagePort2), WebMessagePortImpl.frameworkMessageToCompat(webMessage));
}
}, handler);
}
@NonNull
@DoNotInline
public static WebMessage createWebMessage(@NonNull WebMessageCompat webMessageCompat) {
return new WebMessage(webMessageCompat.getData(), WebMessagePortImpl.compatToPorts(webMessageCompat.getPorts()));
}
@NonNull
@DoNotInline
public static WebMessageCompat createWebMessageCompat(@NonNull WebMessage webMessage) {
return new WebMessageCompat(webMessage.getData(), WebMessagePortImpl.portsToCompat(webMessage.getPorts()));
}
@DoNotInline
public static int getErrorCode(@NonNull WebResourceError webResourceError) {
return webResourceError.getErrorCode();
}
@NonNull
@DoNotInline
public static CharSequence getDescription(@NonNull WebResourceError webResourceError) {
return webResourceError.getDescription();
}
@DoNotInline
public static void setOffscreenPreRaster(@NonNull WebSettings webSettings, boolean z) {
webSettings.setOffscreenPreRaster(z);
}
@DoNotInline
public static boolean getOffscreenPreRaster(@NonNull WebSettings webSettings) {
return webSettings.getOffscreenPreRaster();
}
@DoNotInline
public static void postVisualStateCallback(@NonNull WebView webView, long j, @NonNull final WebViewCompat.VisualStateCallback visualStateCallback) {
webView.postVisualStateCallback(j, new WebView.VisualStateCallback() { // from class: androidx.webkit.internal.ApiHelperForM.3
@Override // android.webkit.WebView.VisualStateCallback
public void onComplete(long j2) {
WebViewCompat.VisualStateCallback.this.onComplete(j2);
}
});
}
@DoNotInline
public static void postWebMessage(@NonNull WebView webView, @NonNull WebMessage webMessage, @NonNull Uri uri) {
webView.postWebMessage(webMessage, uri);
}
@NonNull
@DoNotInline
public static WebMessagePort[] createWebMessageChannel(@NonNull WebView webView) {
return webView.createWebMessageChannel();
}
}

View File

@@ -0,0 +1,110 @@
package androidx.webkit.internal;
import android.content.Context;
import android.webkit.ServiceWorkerClient;
import android.webkit.ServiceWorkerController;
import android.webkit.ServiceWorkerWebSettings;
import android.webkit.WebResourceRequest;
import android.webkit.WebSettings;
import androidx.annotation.DoNotInline;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.webkit.ServiceWorkerClientCompat;
import java.io.File;
@RequiresApi(24)
/* loaded from: classes.dex */
public class ApiHelperForN {
private ApiHelperForN() {
}
@NonNull
@DoNotInline
public static File getDataDir(@NonNull Context context) {
return context.getDataDir();
}
@NonNull
@DoNotInline
public static ServiceWorkerController getServiceWorkerControllerInstance() {
return ServiceWorkerController.getInstance();
}
@NonNull
@DoNotInline
public static ServiceWorkerWebSettings getServiceWorkerWebSettings(@NonNull ServiceWorkerController serviceWorkerController) {
return serviceWorkerController.getServiceWorkerWebSettings();
}
@NonNull
@DoNotInline
public static ServiceWorkerWebSettingsImpl getServiceWorkerWebSettingsImpl(@NonNull ServiceWorkerController serviceWorkerController) {
return new ServiceWorkerWebSettingsImpl(getServiceWorkerWebSettings(serviceWorkerController));
}
@DoNotInline
public static void setServiceWorkerClient(@NonNull ServiceWorkerController serviceWorkerController, @Nullable ServiceWorkerClient serviceWorkerClient) {
serviceWorkerController.setServiceWorkerClient(serviceWorkerClient);
}
@DoNotInline
public static void setServiceWorkerClientCompat(@NonNull ServiceWorkerController serviceWorkerController, @NonNull ServiceWorkerClientCompat serviceWorkerClientCompat) {
serviceWorkerController.setServiceWorkerClient(new FrameworkServiceWorkerClient(serviceWorkerClientCompat));
}
@DoNotInline
public static void setCacheMode(@NonNull ServiceWorkerWebSettings serviceWorkerWebSettings, int i) {
serviceWorkerWebSettings.setCacheMode(i);
}
@DoNotInline
public static int getCacheMode(@NonNull ServiceWorkerWebSettings serviceWorkerWebSettings) {
return serviceWorkerWebSettings.getCacheMode();
}
@DoNotInline
public static void setAllowContentAccess(@NonNull ServiceWorkerWebSettings serviceWorkerWebSettings, boolean z) {
serviceWorkerWebSettings.setAllowContentAccess(z);
}
@DoNotInline
public static boolean getAllowContentAccess(@NonNull ServiceWorkerWebSettings serviceWorkerWebSettings) {
return serviceWorkerWebSettings.getAllowContentAccess();
}
@DoNotInline
public static void setAllowFileAccess(@NonNull ServiceWorkerWebSettings serviceWorkerWebSettings, boolean z) {
serviceWorkerWebSettings.setAllowFileAccess(z);
}
@DoNotInline
public static boolean getAllowFileAccess(@NonNull ServiceWorkerWebSettings serviceWorkerWebSettings) {
return serviceWorkerWebSettings.getAllowFileAccess();
}
@DoNotInline
public static void setBlockNetworkLoads(@NonNull ServiceWorkerWebSettings serviceWorkerWebSettings, boolean z) {
serviceWorkerWebSettings.setBlockNetworkLoads(z);
}
@DoNotInline
public static boolean getBlockNetworkLoads(@NonNull ServiceWorkerWebSettings serviceWorkerWebSettings) {
return serviceWorkerWebSettings.getBlockNetworkLoads();
}
@DoNotInline
public static boolean isRedirect(@NonNull WebResourceRequest webResourceRequest) {
return webResourceRequest.isRedirect();
}
@DoNotInline
public static void setDisabledActionModeMenuItems(@NonNull WebSettings webSettings, int i) {
webSettings.setDisabledActionModeMenuItems(i);
}
@DoNotInline
public static int getDisabledActionModeMenuItems(@NonNull WebSettings webSettings) {
return webSettings.getDisabledActionModeMenuItems();
}
}

View File

@@ -0,0 +1,46 @@
package androidx.webkit.internal;
import android.content.pm.PackageInfo;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import androidx.annotation.DoNotInline;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
@RequiresApi(26)
/* loaded from: classes.dex */
public class ApiHelperForO {
private ApiHelperForO() {
}
@DoNotInline
public static void setSafeBrowsingEnabled(@NonNull WebSettings webSettings, boolean z) {
webSettings.setSafeBrowsingEnabled(z);
}
@DoNotInline
public static boolean getSafeBrowsingEnabled(@NonNull WebSettings webSettings) {
return webSettings.getSafeBrowsingEnabled();
}
@Nullable
@DoNotInline
public static WebViewClient getWebViewClient(@NonNull WebView webView) {
return webView.getWebViewClient();
}
@Nullable
@DoNotInline
public static WebChromeClient getWebChromeClient(@NonNull WebView webView) {
return webView.getWebChromeClient();
}
@NonNull
@DoNotInline
public static PackageInfo getCurrentWebViewPackage() {
return WebView.getCurrentWebViewPackage();
}
}

View File

@@ -0,0 +1,5 @@
package androidx.webkit.internal;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ApiHelperForOMR1$$ExternalSyntheticApiModelOutline0 {
}

View File

@@ -0,0 +1,5 @@
package androidx.webkit.internal;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ApiHelperForOMR1$$ExternalSyntheticApiModelOutline1 {
}

View File

@@ -0,0 +1,5 @@
package androidx.webkit.internal;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ApiHelperForOMR1$$ExternalSyntheticApiModelOutline2 {
}

View File

@@ -0,0 +1,5 @@
package androidx.webkit.internal;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ApiHelperForOMR1$$ExternalSyntheticApiModelOutline3 {
}

View File

@@ -0,0 +1,5 @@
package androidx.webkit.internal;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ApiHelperForOMR1$$ExternalSyntheticApiModelOutline4 {
}

View File

@@ -0,0 +1,5 @@
package androidx.webkit.internal;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ApiHelperForOMR1$$ExternalSyntheticApiModelOutline5 {
}

View File

@@ -0,0 +1,52 @@
package androidx.webkit.internal;
import android.content.Context;
import android.net.Uri;
import android.webkit.SafeBrowsingResponse;
import android.webkit.ValueCallback;
import android.webkit.WebView;
import androidx.annotation.DoNotInline;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import java.util.List;
@RequiresApi(27)
/* loaded from: classes.dex */
public class ApiHelperForOMR1 {
private ApiHelperForOMR1() {
}
@DoNotInline
public static void showInterstitial(@NonNull SafeBrowsingResponse safeBrowsingResponse, boolean z) {
safeBrowsingResponse.showInterstitial(z);
}
@DoNotInline
public static void proceed(@NonNull SafeBrowsingResponse safeBrowsingResponse, boolean z) {
safeBrowsingResponse.proceed(z);
}
@DoNotInline
public static void backToSafety(@NonNull SafeBrowsingResponse safeBrowsingResponse, boolean z) {
safeBrowsingResponse.backToSafety(z);
}
@DoNotInline
public static void startSafeBrowsing(@NonNull Context context, @Nullable ValueCallback<Boolean> valueCallback) {
WebView.startSafeBrowsing(context, valueCallback);
}
@DoNotInline
public static void setSafeBrowsingWhitelist(@NonNull List<String> list, @Nullable ValueCallback<Boolean> valueCallback) {
WebView.setSafeBrowsingWhitelist(list, valueCallback);
}
@NonNull
@DoNotInline
public static Uri getSafeBrowsingPrivacyPolicyUrl() {
Uri safeBrowsingPrivacyPolicyUrl;
safeBrowsingPrivacyPolicyUrl = WebView.getSafeBrowsingPrivacyPolicyUrl();
return safeBrowsingPrivacyPolicyUrl;
}
}

View File

@@ -0,0 +1,5 @@
package androidx.webkit.internal;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ApiHelperForP$$ExternalSyntheticApiModelOutline0 {
}

View File

@@ -0,0 +1,5 @@
package androidx.webkit.internal;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ApiHelperForP$$ExternalSyntheticApiModelOutline1 {
}

View File

@@ -0,0 +1,5 @@
package androidx.webkit.internal;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ApiHelperForP$$ExternalSyntheticApiModelOutline10 {
}

View File

@@ -0,0 +1,10 @@
package androidx.webkit.internal;
import android.webkit.TracingConfig;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ApiHelperForP$$ExternalSyntheticApiModelOutline11 {
public static /* synthetic */ TracingConfig.Builder m() {
return new TracingConfig.Builder();
}
}

View File

@@ -0,0 +1,5 @@
package androidx.webkit.internal;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ApiHelperForP$$ExternalSyntheticApiModelOutline2 {
}

View File

@@ -0,0 +1,5 @@
package androidx.webkit.internal;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ApiHelperForP$$ExternalSyntheticApiModelOutline3 {
}

View File

@@ -0,0 +1,5 @@
package androidx.webkit.internal;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ApiHelperForP$$ExternalSyntheticApiModelOutline4 {
}

View File

@@ -0,0 +1,5 @@
package androidx.webkit.internal;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ApiHelperForP$$ExternalSyntheticApiModelOutline5 {
}

View File

@@ -0,0 +1,5 @@
package androidx.webkit.internal;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ApiHelperForP$$ExternalSyntheticApiModelOutline6 {
}

View File

@@ -0,0 +1,5 @@
package androidx.webkit.internal;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ApiHelperForP$$ExternalSyntheticApiModelOutline7 {
}

View File

@@ -0,0 +1,5 @@
package androidx.webkit.internal;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ApiHelperForP$$ExternalSyntheticApiModelOutline8 {
}

View File

@@ -0,0 +1,5 @@
package androidx.webkit.internal;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ApiHelperForP$$ExternalSyntheticApiModelOutline9 {
}

View File

@@ -0,0 +1,77 @@
package androidx.webkit.internal;
import android.os.Looper;
import android.webkit.TracingConfig;
import android.webkit.TracingController;
import android.webkit.WebView;
import androidx.annotation.DoNotInline;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.webkit.TracingConfig;
import java.io.OutputStream;
import java.util.Collection;
import java.util.concurrent.Executor;
@RequiresApi(28)
/* loaded from: classes.dex */
public class ApiHelperForP {
private ApiHelperForP() {
}
@NonNull
@DoNotInline
public static TracingController getTracingControllerInstance() {
TracingController tracingController;
tracingController = TracingController.getInstance();
return tracingController;
}
@DoNotInline
public static boolean isTracing(@NonNull TracingController tracingController) {
boolean isTracing;
isTracing = tracingController.isTracing();
return isTracing;
}
@DoNotInline
public static void start(@NonNull TracingController tracingController, @NonNull TracingConfig tracingConfig) {
TracingConfig.Builder addCategories;
TracingConfig.Builder addCategories2;
TracingConfig.Builder tracingMode;
android.webkit.TracingConfig build;
addCategories = ApiHelperForP$$ExternalSyntheticApiModelOutline11.m().addCategories(tracingConfig.getPredefinedCategories());
addCategories2 = addCategories.addCategories((Collection<String>) tracingConfig.getCustomIncludedCategories());
tracingMode = addCategories2.setTracingMode(tracingConfig.getTracingMode());
build = tracingMode.build();
tracingController.start(build);
}
@DoNotInline
public static boolean stop(@NonNull TracingController tracingController, @Nullable OutputStream outputStream, @NonNull Executor executor) {
boolean stop;
stop = tracingController.stop(outputStream, executor);
return stop;
}
@NonNull
@DoNotInline
public static ClassLoader getWebViewClassLoader() {
ClassLoader webViewClassLoader;
webViewClassLoader = WebView.getWebViewClassLoader();
return webViewClassLoader;
}
@NonNull
@DoNotInline
public static Looper getWebViewLooper(@NonNull WebView webView) {
Looper webViewLooper;
webViewLooper = webView.getWebViewLooper();
return webViewLooper;
}
@DoNotInline
public static void setDataDirectorySuffix(@NonNull String str) {
WebView.setDataDirectorySuffix(str);
}
}

View File

@@ -0,0 +1,5 @@
package androidx.webkit.internal;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ApiHelperForQ$$ExternalSyntheticApiModelOutline0 {
}

View File

@@ -0,0 +1,5 @@
package androidx.webkit.internal;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ApiHelperForQ$$ExternalSyntheticApiModelOutline1 {
}

View File

@@ -0,0 +1,5 @@
package androidx.webkit.internal;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ApiHelperForQ$$ExternalSyntheticApiModelOutline2 {
}

View File

@@ -0,0 +1,5 @@
package androidx.webkit.internal;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ApiHelperForQ$$ExternalSyntheticApiModelOutline3 {
}

View File

@@ -0,0 +1,5 @@
package androidx.webkit.internal;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ApiHelperForQ$$ExternalSyntheticApiModelOutline4 {
}

View File

@@ -0,0 +1,5 @@
package androidx.webkit.internal;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ApiHelperForQ$$ExternalSyntheticApiModelOutline5 {
}

View File

@@ -0,0 +1,5 @@
package androidx.webkit.internal;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ApiHelperForQ$$ExternalSyntheticApiModelOutline6 {
}

View File

@@ -0,0 +1,65 @@
package androidx.webkit.internal;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewRenderProcess;
import androidx.annotation.DoNotInline;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.webkit.WebViewRenderProcessClient;
import java.util.concurrent.Executor;
@RequiresApi(29)
/* loaded from: classes.dex */
public class ApiHelperForQ {
private ApiHelperForQ() {
}
@DoNotInline
@Deprecated
public static void setForceDark(@NonNull WebSettings webSettings, int i) {
webSettings.setForceDark(i);
}
@DoNotInline
@Deprecated
public static int getForceDark(@NonNull WebSettings webSettings) {
int forceDark;
forceDark = webSettings.getForceDark();
return forceDark;
}
@Nullable
@DoNotInline
public static WebViewRenderProcess getWebViewRenderProcess(@NonNull WebView webView) {
WebViewRenderProcess webViewRenderProcess;
webViewRenderProcess = webView.getWebViewRenderProcess();
return webViewRenderProcess;
}
@DoNotInline
public static boolean terminate(@NonNull WebViewRenderProcess webViewRenderProcess) {
boolean terminate;
terminate = webViewRenderProcess.terminate();
return terminate;
}
@DoNotInline
public static void setWebViewRenderProcessClient(@NonNull WebView webView, @NonNull Executor executor, @Nullable WebViewRenderProcessClient webViewRenderProcessClient) {
webView.setWebViewRenderProcessClient(executor, webViewRenderProcessClient != null ? new WebViewRenderProcessClientFrameworkAdapter(webViewRenderProcessClient) : null);
}
@DoNotInline
public static void setWebViewRenderProcessClient(@NonNull WebView webView, @Nullable WebViewRenderProcessClient webViewRenderProcessClient) {
webView.setWebViewRenderProcessClient(webViewRenderProcessClient != null ? new WebViewRenderProcessClientFrameworkAdapter(webViewRenderProcessClient) : null);
}
@Nullable
@DoNotInline
public static android.webkit.WebViewRenderProcessClient getWebViewRenderProcessClient(@NonNull WebView webView) {
android.webkit.WebViewRenderProcessClient webViewRenderProcessClient;
webViewRenderProcessClient = webView.getWebViewRenderProcessClient();
return webViewRenderProcessClient;
}
}

View File

@@ -0,0 +1,5 @@
package androidx.webkit.internal;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ApiHelperForTiramisu$$ExternalSyntheticApiModelOutline0 {
}

View File

@@ -0,0 +1,5 @@
package androidx.webkit.internal;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ApiHelperForTiramisu$$ExternalSyntheticApiModelOutline1 {
}

View File

@@ -0,0 +1,28 @@
package androidx.webkit.internal;
import android.content.ComponentName;
import android.content.pm.PackageManager;
import android.content.pm.ServiceInfo;
import androidx.annotation.DoNotInline;
import androidx.annotation.RequiresApi;
@RequiresApi(33)
/* loaded from: classes.dex */
public class ApiHelperForTiramisu {
private ApiHelperForTiramisu() {
}
@DoNotInline
public static PackageManager.ComponentInfoFlags of(long j) {
PackageManager.ComponentInfoFlags of;
of = PackageManager.ComponentInfoFlags.of(j);
return of;
}
@DoNotInline
public static ServiceInfo getServiceInfo(PackageManager packageManager, ComponentName componentName, PackageManager.ComponentInfoFlags componentInfoFlags) throws PackageManager.NameNotFoundException {
ServiceInfo serviceInfo;
serviceInfo = packageManager.getServiceInfo(componentName, componentInfoFlags);
return serviceInfo;
}
}

View File

@@ -0,0 +1,107 @@
package androidx.webkit.internal;
import android.content.Context;
import android.content.res.Resources;
import android.util.TypedValue;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.zip.GZIPInputStream;
/* loaded from: classes.dex */
public class AssetHelper {
public static final String DEFAULT_MIME_TYPE = "text/plain";
@NonNull
private Context mContext;
public AssetHelper(@NonNull Context context) {
this.mContext = context;
}
@NonNull
private static InputStream handleSvgzStream(@NonNull String str, @NonNull InputStream inputStream) throws IOException {
return str.endsWith(".svgz") ? new GZIPInputStream(inputStream) : inputStream;
}
@NonNull
private static String removeLeadingSlash(@NonNull String str) {
return (str.length() <= 1 || str.charAt(0) != '/') ? str : str.substring(1);
}
private int getFieldId(@NonNull String str, @NonNull String str2) {
return this.mContext.getResources().getIdentifier(str2, str, this.mContext.getPackageName());
}
private int getValueType(int i) {
TypedValue typedValue = new TypedValue();
this.mContext.getResources().getValue(i, typedValue, true);
return typedValue.type;
}
@NonNull
public InputStream openResource(@NonNull String str) throws Resources.NotFoundException, IOException {
String removeLeadingSlash = removeLeadingSlash(str);
String[] split = removeLeadingSlash.split("/", -1);
if (split.length != 2) {
throw new IllegalArgumentException("Incorrect resource path: " + removeLeadingSlash);
}
String str2 = split[0];
String str3 = split[1];
int lastIndexOf = str3.lastIndexOf(46);
if (lastIndexOf != -1) {
str3 = str3.substring(0, lastIndexOf);
}
int fieldId = getFieldId(str2, str3);
int valueType = getValueType(fieldId);
if (valueType != 3) {
throw new IOException(String.format("Expected %s resource to be of TYPE_STRING but was %d", removeLeadingSlash, Integer.valueOf(valueType)));
}
return handleSvgzStream(removeLeadingSlash, this.mContext.getResources().openRawResource(fieldId));
}
@NonNull
public InputStream openAsset(@NonNull String str) throws IOException {
String removeLeadingSlash = removeLeadingSlash(str);
return handleSvgzStream(removeLeadingSlash, this.mContext.getAssets().open(removeLeadingSlash, 2));
}
@NonNull
public static InputStream openFile(@NonNull File file) throws FileNotFoundException, IOException {
return handleSvgzStream(file.getPath(), new FileInputStream(file));
}
@Nullable
public static File getCanonicalFileIfChild(@NonNull File file, @NonNull String str) throws IOException {
String canonicalDirPath = getCanonicalDirPath(file);
String canonicalPath = new File(file, str).getCanonicalPath();
if (canonicalPath.startsWith(canonicalDirPath)) {
return new File(canonicalPath);
}
return null;
}
@NonNull
public static String getCanonicalDirPath(@NonNull File file) throws IOException {
String canonicalPath = file.getCanonicalPath();
if (canonicalPath.endsWith("/")) {
return canonicalPath;
}
return canonicalPath + "/";
}
@NonNull
public static File getDataDir(@NonNull Context context) {
return ApiHelperForN.getDataDir(context);
}
@NonNull
public static String guessMimeType(@NonNull String str) {
String mimeFromFileName = MimeUtil.getMimeFromFileName(str);
return mimeFromFileName == null ? "text/plain" : mimeFromFileName;
}
}

View File

@@ -0,0 +1,11 @@
package androidx.webkit.internal;
import androidx.annotation.NonNull;
/* loaded from: classes.dex */
public interface ConditionallySupportedFeature {
@NonNull
String getPublicFeatureName();
boolean isSupported();
}

View File

@@ -0,0 +1,19 @@
package androidx.webkit.internal;
import androidx.annotation.NonNull;
import java.util.List;
import org.chromium.support_lib_boundary.WebViewCookieManagerBoundaryInterface;
/* loaded from: classes.dex */
public class CookieManagerAdapter {
private final WebViewCookieManagerBoundaryInterface mBoundaryInterface;
public CookieManagerAdapter(@NonNull WebViewCookieManagerBoundaryInterface webViewCookieManagerBoundaryInterface) {
this.mBoundaryInterface = webViewCookieManagerBoundaryInterface;
}
@NonNull
public List<String> getCookieInfo(@NonNull String str) {
return this.mBoundaryInterface.getCookieInfo(str);
}
}

View File

@@ -0,0 +1,25 @@
package androidx.webkit.internal;
import android.webkit.ServiceWorkerClient;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.webkit.ServiceWorkerClientCompat;
@RequiresApi(24)
/* loaded from: classes.dex */
public class FrameworkServiceWorkerClient extends ServiceWorkerClient {
private final ServiceWorkerClientCompat mImpl;
public FrameworkServiceWorkerClient(@NonNull ServiceWorkerClientCompat serviceWorkerClientCompat) {
this.mImpl = serviceWorkerClientCompat;
}
@Override // android.webkit.ServiceWorkerClient
@Nullable
public WebResourceResponse shouldInterceptRequest(@NonNull WebResourceRequest webResourceRequest) {
return this.mImpl.shouldInterceptRequest(webResourceRequest);
}
}

View File

@@ -0,0 +1,72 @@
package androidx.webkit.internal;
import android.webkit.WebView;
import androidx.annotation.NonNull;
import org.chromium.support_lib_boundary.DropDataContentProviderBoundaryInterface;
import org.chromium.support_lib_boundary.ProfileStoreBoundaryInterface;
import org.chromium.support_lib_boundary.ProxyControllerBoundaryInterface;
import org.chromium.support_lib_boundary.ServiceWorkerControllerBoundaryInterface;
import org.chromium.support_lib_boundary.StaticsBoundaryInterface;
import org.chromium.support_lib_boundary.TracingControllerBoundaryInterface;
import org.chromium.support_lib_boundary.WebViewProviderBoundaryInterface;
import org.chromium.support_lib_boundary.WebkitToCompatConverterBoundaryInterface;
/* loaded from: classes.dex */
public class IncompatibleApkWebViewProviderFactory implements WebViewProviderFactory {
private static final String[] EMPTY_STRING_ARRAY = new String[0];
private static final String UNSUPPORTED_EXCEPTION_EXPLANATION = "This should never happen, if this method was called it means we're trying to reach into WebView APK code on an incompatible device. This most likely means the current method is being called too early, or is being called on start-up rather than lazily";
@Override // androidx.webkit.internal.WebViewProviderFactory
@NonNull
public String[] getWebViewFeatures() {
return EMPTY_STRING_ARRAY;
}
@Override // androidx.webkit.internal.WebViewProviderFactory
@NonNull
public WebViewProviderBoundaryInterface createWebView(@NonNull WebView webView) {
throw new UnsupportedOperationException(UNSUPPORTED_EXCEPTION_EXPLANATION);
}
@Override // androidx.webkit.internal.WebViewProviderFactory
@NonNull
public WebkitToCompatConverterBoundaryInterface getWebkitToCompatConverter() {
throw new UnsupportedOperationException(UNSUPPORTED_EXCEPTION_EXPLANATION);
}
@Override // androidx.webkit.internal.WebViewProviderFactory
@NonNull
public StaticsBoundaryInterface getStatics() {
throw new UnsupportedOperationException(UNSUPPORTED_EXCEPTION_EXPLANATION);
}
@Override // androidx.webkit.internal.WebViewProviderFactory
@NonNull
public ServiceWorkerControllerBoundaryInterface getServiceWorkerController() {
throw new UnsupportedOperationException(UNSUPPORTED_EXCEPTION_EXPLANATION);
}
@Override // androidx.webkit.internal.WebViewProviderFactory
@NonNull
public TracingControllerBoundaryInterface getTracingController() {
throw new UnsupportedOperationException(UNSUPPORTED_EXCEPTION_EXPLANATION);
}
@Override // androidx.webkit.internal.WebViewProviderFactory
@NonNull
public ProxyControllerBoundaryInterface getProxyController() {
throw new UnsupportedOperationException(UNSUPPORTED_EXCEPTION_EXPLANATION);
}
@Override // androidx.webkit.internal.WebViewProviderFactory
@NonNull
public DropDataContentProviderBoundaryInterface getDropDataProvider() {
throw new UnsupportedOperationException(UNSUPPORTED_EXCEPTION_EXPLANATION);
}
@Override // androidx.webkit.internal.WebViewProviderFactory
@NonNull
public ProfileStoreBoundaryInterface getProfileStore() {
throw new UnsupportedOperationException(UNSUPPORTED_EXCEPTION_EXPLANATION);
}
}

View File

@@ -0,0 +1,48 @@
package androidx.webkit.internal;
import androidx.annotation.NonNull;
import androidx.webkit.JavaScriptReplyProxy;
import java.lang.reflect.InvocationHandler;
import java.util.Objects;
import java.util.concurrent.Callable;
import org.chromium.support_lib_boundary.JsReplyProxyBoundaryInterface;
import org.chromium.support_lib_boundary.util.BoundaryInterfaceReflectionUtil;
/* loaded from: classes.dex */
public class JavaScriptReplyProxyImpl extends JavaScriptReplyProxy {
private JsReplyProxyBoundaryInterface mBoundaryInterface;
public JavaScriptReplyProxyImpl(@NonNull JsReplyProxyBoundaryInterface jsReplyProxyBoundaryInterface) {
this.mBoundaryInterface = jsReplyProxyBoundaryInterface;
}
@NonNull
public static JavaScriptReplyProxyImpl forInvocationHandler(@NonNull InvocationHandler invocationHandler) {
final JsReplyProxyBoundaryInterface jsReplyProxyBoundaryInterface = (JsReplyProxyBoundaryInterface) BoundaryInterfaceReflectionUtil.castToSuppLibClass(JsReplyProxyBoundaryInterface.class, invocationHandler);
return (JavaScriptReplyProxyImpl) jsReplyProxyBoundaryInterface.getOrCreatePeer(new Callable<Object>() { // from class: androidx.webkit.internal.JavaScriptReplyProxyImpl.1
@Override // java.util.concurrent.Callable
public Object call() {
return new JavaScriptReplyProxyImpl(JsReplyProxyBoundaryInterface.this);
}
});
}
@Override // androidx.webkit.JavaScriptReplyProxy
public void postMessage(@NonNull String str) {
if (WebViewFeatureInternal.WEB_MESSAGE_LISTENER.isSupportedByWebView()) {
this.mBoundaryInterface.postMessage(str);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@Override // androidx.webkit.JavaScriptReplyProxy
public void postMessage(@NonNull byte[] bArr) {
Objects.requireNonNull(bArr, "ArrayBuffer must be non-null");
if (WebViewFeatureInternal.WEB_MESSAGE_ARRAY_BUFFER.isSupportedByWebView()) {
this.mBoundaryInterface.postMessageWithPayload(BoundaryInterfaceReflectionUtil.createInvocationHandlerFor(new WebMessagePayloadAdapter(bArr)));
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}

View File

@@ -0,0 +1,31 @@
package androidx.webkit.internal;
import java.net.URLConnection;
/* loaded from: classes.dex */
class MimeUtil {
public static String getMimeFromFileName(String str) {
if (str == null) {
return null;
}
String guessContentTypeFromName = URLConnection.guessContentTypeFromName(str);
return guessContentTypeFromName != null ? guessContentTypeFromName : guessHardcodedMime(str);
}
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
/* JADX WARN: Code restructure failed: missing block: B:50:0x004f, code lost:
if (r5.equals("mhtml") == false) goto L7;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private static java.lang.String guessHardcodedMime(java.lang.String r5) {
/*
Method dump skipped, instructions count: 1104
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.webkit.internal.MimeUtil.guessHardcodedMime(java.lang.String):java.lang.String");
}
}

View File

@@ -0,0 +1,67 @@
package androidx.webkit.internal;
import android.webkit.CookieManager;
import android.webkit.GeolocationPermissions;
import android.webkit.ServiceWorkerController;
import android.webkit.WebStorage;
import androidx.annotation.NonNull;
import androidx.webkit.Profile;
import org.chromium.support_lib_boundary.ProfileBoundaryInterface;
/* loaded from: classes.dex */
public class ProfileImpl implements Profile {
private final ProfileBoundaryInterface mProfileImpl;
public ProfileImpl(ProfileBoundaryInterface profileBoundaryInterface) {
this.mProfileImpl = profileBoundaryInterface;
}
private ProfileImpl() {
this.mProfileImpl = null;
}
@Override // androidx.webkit.Profile
@NonNull
public String getName() {
if (WebViewFeatureInternal.MULTI_PROFILE.isSupportedByWebView()) {
return this.mProfileImpl.getName();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@Override // androidx.webkit.Profile
@NonNull
public CookieManager getCookieManager() throws IllegalStateException {
if (WebViewFeatureInternal.MULTI_PROFILE.isSupportedByWebView()) {
return this.mProfileImpl.getCookieManager();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@Override // androidx.webkit.Profile
@NonNull
public WebStorage getWebStorage() throws IllegalStateException {
if (WebViewFeatureInternal.MULTI_PROFILE.isSupportedByWebView()) {
return this.mProfileImpl.getWebStorage();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@Override // androidx.webkit.Profile
@NonNull
public GeolocationPermissions getGeolocationPermissions() throws IllegalStateException {
if (WebViewFeatureInternal.MULTI_PROFILE.isSupportedByWebView()) {
return this.mProfileImpl.getGeoLocationPermissions();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@Override // androidx.webkit.Profile
@NonNull
public ServiceWorkerController getServiceWorkerController() throws IllegalStateException {
if (WebViewFeatureInternal.MULTI_PROFILE.isSupportedByWebView()) {
return this.mProfileImpl.getServiceWorkerController();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}

View File

@@ -0,0 +1,72 @@
package androidx.webkit.internal;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.webkit.Profile;
import androidx.webkit.ProfileStore;
import java.lang.reflect.InvocationHandler;
import java.util.List;
import org.chromium.support_lib_boundary.ProfileBoundaryInterface;
import org.chromium.support_lib_boundary.ProfileStoreBoundaryInterface;
import org.chromium.support_lib_boundary.util.BoundaryInterfaceReflectionUtil;
/* loaded from: classes.dex */
public class ProfileStoreImpl implements ProfileStore {
private static ProfileStore sInstance;
private final ProfileStoreBoundaryInterface mProfileStoreImpl;
private ProfileStoreImpl(ProfileStoreBoundaryInterface profileStoreBoundaryInterface) {
this.mProfileStoreImpl = profileStoreBoundaryInterface;
}
private ProfileStoreImpl() {
this.mProfileStoreImpl = null;
}
@NonNull
public static ProfileStore getInstance() {
if (sInstance == null) {
sInstance = new ProfileStoreImpl(WebViewGlueCommunicator.getFactory().getProfileStore());
}
return sInstance;
}
@Override // androidx.webkit.ProfileStore
@NonNull
public Profile getOrCreateProfile(@NonNull String str) {
if (WebViewFeatureInternal.MULTI_PROFILE.isSupportedByWebView()) {
return new ProfileImpl((ProfileBoundaryInterface) BoundaryInterfaceReflectionUtil.castToSuppLibClass(ProfileBoundaryInterface.class, this.mProfileStoreImpl.getOrCreateProfile(str)));
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@Override // androidx.webkit.ProfileStore
@Nullable
public Profile getProfile(@NonNull String str) {
if (WebViewFeatureInternal.MULTI_PROFILE.isSupportedByWebView()) {
InvocationHandler profile = this.mProfileStoreImpl.getProfile(str);
if (profile != null) {
return new ProfileImpl((ProfileBoundaryInterface) BoundaryInterfaceReflectionUtil.castToSuppLibClass(ProfileBoundaryInterface.class, profile));
}
return null;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@Override // androidx.webkit.ProfileStore
@NonNull
public List<String> getAllProfileNames() {
if (WebViewFeatureInternal.MULTI_PROFILE.isSupportedByWebView()) {
return this.mProfileStoreImpl.getAllProfileNames();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@Override // androidx.webkit.ProfileStore
public boolean deleteProfile(@NonNull String str) throws IllegalStateException {
if (WebViewFeatureInternal.MULTI_PROFILE.isSupportedByWebView()) {
return this.mProfileStoreImpl.deleteProfile(str);
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}

View File

@@ -0,0 +1,60 @@
package androidx.webkit.internal;
import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting;
import androidx.webkit.ProxyConfig;
import androidx.webkit.ProxyController;
import androidx.webkit.internal.ApiFeature;
import java.lang.reflect.Array;
import java.util.List;
import java.util.concurrent.Executor;
import org.chromium.support_lib_boundary.ProxyControllerBoundaryInterface;
/* loaded from: classes.dex */
public class ProxyControllerImpl extends ProxyController {
private ProxyControllerBoundaryInterface mBoundaryInterface;
@Override // androidx.webkit.ProxyController
public void setProxyOverride(@NonNull ProxyConfig proxyConfig, @NonNull Executor executor, @NonNull Runnable runnable) {
ApiFeature.NoFramework noFramework = WebViewFeatureInternal.PROXY_OVERRIDE;
ApiFeature.NoFramework noFramework2 = WebViewFeatureInternal.PROXY_OVERRIDE_REVERSE_BYPASS;
String[][] proxyRulesToStringArray = proxyRulesToStringArray(proxyConfig.getProxyRules());
String[] strArr = (String[]) proxyConfig.getBypassRules().toArray(new String[0]);
if (noFramework.isSupportedByWebView() && !proxyConfig.isReverseBypassEnabled()) {
getBoundaryInterface().setProxyOverride(proxyRulesToStringArray, strArr, runnable, executor);
} else {
if (noFramework.isSupportedByWebView() && noFramework2.isSupportedByWebView()) {
getBoundaryInterface().setProxyOverride(proxyRulesToStringArray, strArr, runnable, executor, proxyConfig.isReverseBypassEnabled());
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}
@Override // androidx.webkit.ProxyController
public void clearProxyOverride(@NonNull Executor executor, @NonNull Runnable runnable) {
if (WebViewFeatureInternal.PROXY_OVERRIDE.isSupportedByWebView()) {
getBoundaryInterface().clearProxyOverride(runnable, executor);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@NonNull
@VisibleForTesting
public static String[][] proxyRulesToStringArray(@NonNull List<ProxyConfig.ProxyRule> list) {
String[][] strArr = (String[][]) Array.newInstance((Class<?>) String.class, list.size(), 2);
for (int i = 0; i < list.size(); i++) {
strArr[i][0] = list.get(i).getSchemeFilter();
strArr[i][1] = list.get(i).getUrl();
}
return strArr;
}
private ProxyControllerBoundaryInterface getBoundaryInterface() {
if (this.mBoundaryInterface == null) {
this.mBoundaryInterface = WebViewGlueCommunicator.getFactory().getProxyController();
}
return this.mBoundaryInterface;
}
}

View File

@@ -0,0 +1,82 @@
package androidx.webkit.internal;
import android.webkit.SafeBrowsingResponse;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.webkit.SafeBrowsingResponseCompat;
import androidx.webkit.internal.ApiFeature;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
import org.chromium.support_lib_boundary.SafeBrowsingResponseBoundaryInterface;
import org.chromium.support_lib_boundary.util.BoundaryInterfaceReflectionUtil;
/* loaded from: classes.dex */
public class SafeBrowsingResponseImpl extends SafeBrowsingResponseCompat {
private SafeBrowsingResponseBoundaryInterface mBoundaryInterface;
private SafeBrowsingResponse mFrameworksImpl;
public SafeBrowsingResponseImpl(@NonNull InvocationHandler invocationHandler) {
this.mBoundaryInterface = (SafeBrowsingResponseBoundaryInterface) BoundaryInterfaceReflectionUtil.castToSuppLibClass(SafeBrowsingResponseBoundaryInterface.class, invocationHandler);
}
public SafeBrowsingResponseImpl(@NonNull SafeBrowsingResponse safeBrowsingResponse) {
this.mFrameworksImpl = safeBrowsingResponse;
}
@RequiresApi(27)
private SafeBrowsingResponse getFrameworksImpl() {
if (this.mFrameworksImpl == null) {
this.mFrameworksImpl = WebViewGlueCommunicator.getCompatConverter().convertSafeBrowsingResponse(Proxy.getInvocationHandler(this.mBoundaryInterface));
}
return this.mFrameworksImpl;
}
private SafeBrowsingResponseBoundaryInterface getBoundaryInterface() {
if (this.mBoundaryInterface == null) {
this.mBoundaryInterface = (SafeBrowsingResponseBoundaryInterface) BoundaryInterfaceReflectionUtil.castToSuppLibClass(SafeBrowsingResponseBoundaryInterface.class, WebViewGlueCommunicator.getCompatConverter().convertSafeBrowsingResponse(this.mFrameworksImpl));
}
return this.mBoundaryInterface;
}
@Override // androidx.webkit.SafeBrowsingResponseCompat
public void showInterstitial(boolean z) {
ApiFeature.O_MR1 o_mr1 = WebViewFeatureInternal.SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL;
if (o_mr1.isSupportedByFramework()) {
ApiHelperForOMR1.showInterstitial(getFrameworksImpl(), z);
} else {
if (o_mr1.isSupportedByWebView()) {
getBoundaryInterface().showInterstitial(z);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}
@Override // androidx.webkit.SafeBrowsingResponseCompat
public void proceed(boolean z) {
ApiFeature.O_MR1 o_mr1 = WebViewFeatureInternal.SAFE_BROWSING_RESPONSE_PROCEED;
if (o_mr1.isSupportedByFramework()) {
ApiHelperForOMR1.proceed(getFrameworksImpl(), z);
} else {
if (o_mr1.isSupportedByWebView()) {
getBoundaryInterface().proceed(z);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}
@Override // androidx.webkit.SafeBrowsingResponseCompat
public void backToSafety(boolean z) {
ApiFeature.O_MR1 o_mr1 = WebViewFeatureInternal.SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY;
if (o_mr1.isSupportedByFramework()) {
ApiHelperForOMR1.backToSafety(getFrameworksImpl(), z);
} else {
if (o_mr1.isSupportedByWebView()) {
getBoundaryInterface().backToSafety(z);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}
}

View File

@@ -0,0 +1,26 @@
package androidx.webkit.internal;
import androidx.annotation.NonNull;
import androidx.webkit.ScriptHandler;
import java.lang.reflect.InvocationHandler;
import org.chromium.support_lib_boundary.ScriptHandlerBoundaryInterface;
import org.chromium.support_lib_boundary.util.BoundaryInterfaceReflectionUtil;
/* loaded from: classes.dex */
public class ScriptHandlerImpl implements ScriptHandler {
private final ScriptHandlerBoundaryInterface mBoundaryInterface;
private ScriptHandlerImpl(@NonNull ScriptHandlerBoundaryInterface scriptHandlerBoundaryInterface) {
this.mBoundaryInterface = scriptHandlerBoundaryInterface;
}
@Override // androidx.webkit.ScriptHandler
public void remove() {
this.mBoundaryInterface.remove();
}
@NonNull
public static ScriptHandlerImpl toScriptHandler(@NonNull InvocationHandler invocationHandler) {
return new ScriptHandlerImpl((ScriptHandlerBoundaryInterface) BoundaryInterfaceReflectionUtil.castToSuppLibClass(ScriptHandlerBoundaryInterface.class, invocationHandler));
}
}

View File

@@ -0,0 +1,30 @@
package androidx.webkit.internal;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.webkit.ServiceWorkerClientCompat;
import androidx.webkit.WebViewFeature;
import org.chromium.support_lib_boundary.ServiceWorkerClientBoundaryInterface;
/* loaded from: classes.dex */
public class ServiceWorkerClientAdapter implements ServiceWorkerClientBoundaryInterface {
private final ServiceWorkerClientCompat mClient;
@Override // org.chromium.support_lib_boundary.FeatureFlagHolderBoundaryInterface
@NonNull
public String[] getSupportedFeatures() {
return new String[]{WebViewFeature.SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST};
}
public ServiceWorkerClientAdapter(@NonNull ServiceWorkerClientCompat serviceWorkerClientCompat) {
this.mClient = serviceWorkerClientCompat;
}
@Override // org.chromium.support_lib_boundary.ServiceWorkerClientBoundaryInterface
@Nullable
public WebResourceResponse shouldInterceptRequest(@NonNull WebResourceRequest webResourceRequest) {
return this.mClient.shouldInterceptRequest(webResourceRequest);
}
}

View File

@@ -0,0 +1,80 @@
package androidx.webkit.internal;
import android.webkit.ServiceWorkerController;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.webkit.ServiceWorkerClientCompat;
import androidx.webkit.ServiceWorkerControllerCompat;
import androidx.webkit.ServiceWorkerWebSettingsCompat;
import androidx.webkit.internal.ApiFeature;
import org.chromium.support_lib_boundary.ServiceWorkerControllerBoundaryInterface;
import org.chromium.support_lib_boundary.util.BoundaryInterfaceReflectionUtil;
/* loaded from: classes.dex */
public class ServiceWorkerControllerImpl extends ServiceWorkerControllerCompat {
private ServiceWorkerControllerBoundaryInterface mBoundaryInterface;
private ServiceWorkerController mFrameworksImpl;
private final ServiceWorkerWebSettingsCompat mWebSettings;
@Override // androidx.webkit.ServiceWorkerControllerCompat
@NonNull
public ServiceWorkerWebSettingsCompat getServiceWorkerWebSettings() {
return this.mWebSettings;
}
public ServiceWorkerControllerImpl() {
ApiFeature.N n = WebViewFeatureInternal.SERVICE_WORKER_BASIC_USAGE;
if (n.isSupportedByFramework()) {
this.mFrameworksImpl = ApiHelperForN.getServiceWorkerControllerInstance();
this.mBoundaryInterface = null;
this.mWebSettings = ApiHelperForN.getServiceWorkerWebSettingsImpl(getFrameworksImpl());
} else {
if (n.isSupportedByWebView()) {
this.mFrameworksImpl = null;
ServiceWorkerControllerBoundaryInterface serviceWorkerController = WebViewGlueCommunicator.getFactory().getServiceWorkerController();
this.mBoundaryInterface = serviceWorkerController;
this.mWebSettings = new ServiceWorkerWebSettingsImpl(serviceWorkerController.getServiceWorkerWebSettings());
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}
@RequiresApi(24)
private ServiceWorkerController getFrameworksImpl() {
if (this.mFrameworksImpl == null) {
this.mFrameworksImpl = ApiHelperForN.getServiceWorkerControllerInstance();
}
return this.mFrameworksImpl;
}
private ServiceWorkerControllerBoundaryInterface getBoundaryInterface() {
if (this.mBoundaryInterface == null) {
this.mBoundaryInterface = WebViewGlueCommunicator.getFactory().getServiceWorkerController();
}
return this.mBoundaryInterface;
}
@Override // androidx.webkit.ServiceWorkerControllerCompat
public void setServiceWorkerClient(@Nullable ServiceWorkerClientCompat serviceWorkerClientCompat) {
ApiFeature.N n = WebViewFeatureInternal.SERVICE_WORKER_BASIC_USAGE;
if (n.isSupportedByFramework()) {
if (serviceWorkerClientCompat == null) {
ApiHelperForN.setServiceWorkerClient(getFrameworksImpl(), null);
return;
} else {
ApiHelperForN.setServiceWorkerClientCompat(getFrameworksImpl(), serviceWorkerClientCompat);
return;
}
}
if (!n.isSupportedByWebView()) {
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
if (serviceWorkerClientCompat == null) {
getBoundaryInterface().setServiceWorkerClient(null);
} else {
getBoundaryInterface().setServiceWorkerClient(BoundaryInterfaceReflectionUtil.createInvocationHandlerFor(new ServiceWorkerClientAdapter(serviceWorkerClientCompat)));
}
}
}

View File

@@ -0,0 +1,163 @@
package androidx.webkit.internal;
import android.webkit.ServiceWorkerWebSettings;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.webkit.ServiceWorkerWebSettingsCompat;
import androidx.webkit.internal.ApiFeature;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
import java.util.Set;
import org.chromium.support_lib_boundary.ServiceWorkerWebSettingsBoundaryInterface;
import org.chromium.support_lib_boundary.util.BoundaryInterfaceReflectionUtil;
/* loaded from: classes.dex */
public class ServiceWorkerWebSettingsImpl extends ServiceWorkerWebSettingsCompat {
private ServiceWorkerWebSettingsBoundaryInterface mBoundaryInterface;
private ServiceWorkerWebSettings mFrameworksImpl;
public ServiceWorkerWebSettingsImpl(@NonNull ServiceWorkerWebSettings serviceWorkerWebSettings) {
this.mFrameworksImpl = serviceWorkerWebSettings;
}
public ServiceWorkerWebSettingsImpl(@NonNull InvocationHandler invocationHandler) {
this.mBoundaryInterface = (ServiceWorkerWebSettingsBoundaryInterface) BoundaryInterfaceReflectionUtil.castToSuppLibClass(ServiceWorkerWebSettingsBoundaryInterface.class, invocationHandler);
}
@RequiresApi(24)
private ServiceWorkerWebSettings getFrameworksImpl() {
if (this.mFrameworksImpl == null) {
this.mFrameworksImpl = WebViewGlueCommunicator.getCompatConverter().convertServiceWorkerSettings(Proxy.getInvocationHandler(this.mBoundaryInterface));
}
return this.mFrameworksImpl;
}
private ServiceWorkerWebSettingsBoundaryInterface getBoundaryInterface() {
if (this.mBoundaryInterface == null) {
this.mBoundaryInterface = (ServiceWorkerWebSettingsBoundaryInterface) BoundaryInterfaceReflectionUtil.castToSuppLibClass(ServiceWorkerWebSettingsBoundaryInterface.class, WebViewGlueCommunicator.getCompatConverter().convertServiceWorkerSettings(this.mFrameworksImpl));
}
return this.mBoundaryInterface;
}
@Override // androidx.webkit.ServiceWorkerWebSettingsCompat
public void setCacheMode(int i) {
ApiFeature.N n = WebViewFeatureInternal.SERVICE_WORKER_CACHE_MODE;
if (n.isSupportedByFramework()) {
ApiHelperForN.setCacheMode(getFrameworksImpl(), i);
} else {
if (n.isSupportedByWebView()) {
getBoundaryInterface().setCacheMode(i);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}
@Override // androidx.webkit.ServiceWorkerWebSettingsCompat
public int getCacheMode() {
ApiFeature.N n = WebViewFeatureInternal.SERVICE_WORKER_CACHE_MODE;
if (n.isSupportedByFramework()) {
return ApiHelperForN.getCacheMode(getFrameworksImpl());
}
if (n.isSupportedByWebView()) {
return getBoundaryInterface().getCacheMode();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@Override // androidx.webkit.ServiceWorkerWebSettingsCompat
public void setAllowContentAccess(boolean z) {
ApiFeature.N n = WebViewFeatureInternal.SERVICE_WORKER_CONTENT_ACCESS;
if (n.isSupportedByFramework()) {
ApiHelperForN.setAllowContentAccess(getFrameworksImpl(), z);
} else {
if (n.isSupportedByWebView()) {
getBoundaryInterface().setAllowContentAccess(z);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}
@Override // androidx.webkit.ServiceWorkerWebSettingsCompat
public boolean getAllowContentAccess() {
ApiFeature.N n = WebViewFeatureInternal.SERVICE_WORKER_CONTENT_ACCESS;
if (n.isSupportedByFramework()) {
return ApiHelperForN.getAllowContentAccess(getFrameworksImpl());
}
if (n.isSupportedByWebView()) {
return getBoundaryInterface().getAllowContentAccess();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@Override // androidx.webkit.ServiceWorkerWebSettingsCompat
public void setAllowFileAccess(boolean z) {
ApiFeature.N n = WebViewFeatureInternal.SERVICE_WORKER_FILE_ACCESS;
if (n.isSupportedByFramework()) {
ApiHelperForN.setAllowFileAccess(getFrameworksImpl(), z);
} else {
if (n.isSupportedByWebView()) {
getBoundaryInterface().setAllowFileAccess(z);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}
@Override // androidx.webkit.ServiceWorkerWebSettingsCompat
public boolean getAllowFileAccess() {
ApiFeature.N n = WebViewFeatureInternal.SERVICE_WORKER_FILE_ACCESS;
if (n.isSupportedByFramework()) {
return ApiHelperForN.getAllowFileAccess(getFrameworksImpl());
}
if (n.isSupportedByWebView()) {
return getBoundaryInterface().getAllowFileAccess();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@Override // androidx.webkit.ServiceWorkerWebSettingsCompat
public void setBlockNetworkLoads(boolean z) {
ApiFeature.N n = WebViewFeatureInternal.SERVICE_WORKER_BLOCK_NETWORK_LOADS;
if (n.isSupportedByFramework()) {
ApiHelperForN.setBlockNetworkLoads(getFrameworksImpl(), z);
} else {
if (n.isSupportedByWebView()) {
getBoundaryInterface().setBlockNetworkLoads(z);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}
@Override // androidx.webkit.ServiceWorkerWebSettingsCompat
public boolean getBlockNetworkLoads() {
ApiFeature.N n = WebViewFeatureInternal.SERVICE_WORKER_BLOCK_NETWORK_LOADS;
if (n.isSupportedByFramework()) {
return ApiHelperForN.getBlockNetworkLoads(getFrameworksImpl());
}
if (n.isSupportedByWebView()) {
return getBoundaryInterface().getBlockNetworkLoads();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@Override // androidx.webkit.ServiceWorkerWebSettingsCompat
@NonNull
public Set<String> getRequestedWithHeaderOriginAllowList() {
if (WebViewFeatureInternal.REQUESTED_WITH_HEADER_ALLOW_LIST.isSupportedByWebView()) {
return getBoundaryInterface().getRequestedWithHeaderOriginAllowList();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@Override // androidx.webkit.ServiceWorkerWebSettingsCompat
public void setRequestedWithHeaderOriginAllowList(@NonNull Set<String> set) {
if (WebViewFeatureInternal.REQUESTED_WITH_HEADER_ALLOW_LIST.isSupportedByWebView()) {
getBoundaryInterface().setRequestedWithHeaderOriginAllowList(set);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}

View File

@@ -0,0 +1,106 @@
package androidx.webkit.internal;
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ServiceInfo;
import android.os.Build;
import android.os.Bundle;
import androidx.annotation.ChecksSdkIntAtLeast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.webkit.WebViewCompat;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
/* loaded from: classes.dex */
public abstract class StartupApiFeature {
static final /* synthetic */ boolean $assertionsDisabled = false;
@VisibleForTesting
public static final String METADATA_HOLDER_SERVICE_NAME = "org.chromium.android_webview.services.StartupFeatureMetadataHolder";
private static final Set<StartupApiFeature> sValues = new HashSet();
private final String mInternalFeatureValue;
private final String mPublicFeatureValue;
@NonNull
public String getPublicFeatureName() {
return this.mPublicFeatureValue;
}
public abstract boolean isSupportedByFramework();
public StartupApiFeature(@NonNull String str, @NonNull String str2) {
this.mPublicFeatureValue = str;
this.mInternalFeatureValue = str2;
sValues.add(this);
}
public boolean isSupported(@NonNull Context context) {
return isSupportedByFramework() || isSupportedByWebView(context);
}
@ChecksSdkIntAtLeast(api = 21)
public boolean isSupportedByWebView(@NonNull Context context) {
Bundle metaDataFromWebViewManifestOrNull = getMetaDataFromWebViewManifestOrNull(context);
if (metaDataFromWebViewManifestOrNull == null) {
return false;
}
return metaDataFromWebViewManifestOrNull.containsKey(this.mInternalFeatureValue);
}
@NonNull
public static Set<StartupApiFeature> values() {
return Collections.unmodifiableSet(sValues);
}
@Nullable
private static Bundle getMetaDataFromWebViewManifestOrNull(@NonNull Context context) {
PackageInfo currentWebViewPackage = WebViewCompat.getCurrentWebViewPackage(context);
if (currentWebViewPackage == null) {
return null;
}
ComponentName componentName = new ComponentName(currentWebViewPackage.packageName, METADATA_HOLDER_SERVICE_NAME);
if (Build.VERSION.SDK_INT >= 33) {
try {
return ApiHelperForTiramisu.getServiceInfo(context.getPackageManager(), componentName, ApiHelperForTiramisu.of(640L)).metaData;
} catch (PackageManager.NameNotFoundException unused) {
return null;
}
}
try {
return getServiceInfo(context, componentName, 640).metaData;
} catch (PackageManager.NameNotFoundException unused2) {
return null;
}
}
private static ServiceInfo getServiceInfo(@NonNull Context context, ComponentName componentName, int i) throws PackageManager.NameNotFoundException {
return context.getPackageManager().getServiceInfo(componentName, i);
}
public static class P extends StartupApiFeature {
@Override // androidx.webkit.internal.StartupApiFeature
public final boolean isSupportedByFramework() {
return Build.VERSION.SDK_INT >= 28;
}
public P(@NonNull String str, @NonNull String str2) {
super(str, str2);
}
}
public static class NoFramework extends StartupApiFeature {
@Override // androidx.webkit.internal.StartupApiFeature
public final boolean isSupportedByFramework() {
return false;
}
public NoFramework(@NonNull String str, @NonNull String str2) {
super(str, str2);
}
}
}

View File

@@ -0,0 +1,10 @@
package androidx.webkit.internal;
/* loaded from: classes.dex */
public class StartupFeatures {
public static final String STARTUP_FEATURE_SET_DATA_DIRECTORY_SUFFIX = "STARTUP_FEATURE_SET_DATA_DIRECTORY_SUFFIX";
public static final String STARTUP_FEATURE_SET_DIRECTORY_BASE_PATH = "STARTUP_FEATURE_SET_DIRECTORY_BASE_PATH";
private StartupFeatures() {
}
}

View File

@@ -0,0 +1,88 @@
package androidx.webkit.internal;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.webkit.TracingConfig;
import androidx.webkit.TracingController;
import androidx.webkit.internal.ApiFeature;
import java.io.OutputStream;
import java.util.concurrent.Executor;
import org.chromium.support_lib_boundary.TracingControllerBoundaryInterface;
/* loaded from: classes.dex */
public class TracingControllerImpl extends TracingController {
private TracingControllerBoundaryInterface mBoundaryInterface;
private android.webkit.TracingController mFrameworksImpl;
public TracingControllerImpl() {
ApiFeature.P p = WebViewFeatureInternal.TRACING_CONTROLLER_BASIC_USAGE;
if (p.isSupportedByFramework()) {
this.mFrameworksImpl = ApiHelperForP.getTracingControllerInstance();
this.mBoundaryInterface = null;
} else {
if (p.isSupportedByWebView()) {
this.mFrameworksImpl = null;
this.mBoundaryInterface = WebViewGlueCommunicator.getFactory().getTracingController();
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}
@RequiresApi(28)
private android.webkit.TracingController getFrameworksImpl() {
if (this.mFrameworksImpl == null) {
this.mFrameworksImpl = ApiHelperForP.getTracingControllerInstance();
}
return this.mFrameworksImpl;
}
private TracingControllerBoundaryInterface getBoundaryInterface() {
if (this.mBoundaryInterface == null) {
this.mBoundaryInterface = WebViewGlueCommunicator.getFactory().getTracingController();
}
return this.mBoundaryInterface;
}
@Override // androidx.webkit.TracingController
public boolean isTracing() {
ApiFeature.P p = WebViewFeatureInternal.TRACING_CONTROLLER_BASIC_USAGE;
if (p.isSupportedByFramework()) {
return ApiHelperForP.isTracing(getFrameworksImpl());
}
if (p.isSupportedByWebView()) {
return getBoundaryInterface().isTracing();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@Override // androidx.webkit.TracingController
public void start(@NonNull TracingConfig tracingConfig) {
if (tracingConfig == null) {
throw new IllegalArgumentException("Tracing config must be non null");
}
ApiFeature.P p = WebViewFeatureInternal.TRACING_CONTROLLER_BASIC_USAGE;
if (p.isSupportedByFramework()) {
ApiHelperForP.start(getFrameworksImpl(), tracingConfig);
} else {
if (p.isSupportedByWebView()) {
getBoundaryInterface().start(tracingConfig.getPredefinedCategories(), tracingConfig.getCustomIncludedCategories(), tracingConfig.getTracingMode());
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}
@Override // androidx.webkit.TracingController
public boolean stop(@Nullable OutputStream outputStream, @NonNull Executor executor) {
ApiFeature.P p = WebViewFeatureInternal.TRACING_CONTROLLER_BASIC_USAGE;
if (p.isSupportedByFramework()) {
return ApiHelperForP.stop(getFrameworksImpl(), outputStream, executor);
}
if (p.isSupportedByWebView()) {
return getBoundaryInterface().stop(outputStream, executor);
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}

View File

@@ -0,0 +1,97 @@
package androidx.webkit.internal;
import androidx.annotation.NonNull;
import androidx.webkit.UserAgentMetadata;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/* loaded from: classes.dex */
public class UserAgentMetadataInternal {
private static final String ARCHITECTURE = "ARCHITECTURE";
private static final String BITNESS = "BITNESS";
private static final int BRAND_VERSION_LENGTH = 3;
private static final String BRAND_VERSION_LIST = "BRAND_VERSION_LIST";
private static final String FULL_VERSION = "FULL_VERSION";
private static final String MOBILE = "MOBILE";
private static final String MODEL = "MODEL";
private static final String PLATFORM = "PLATFORM";
private static final String PLATFORM_VERSION = "PLATFORM_VERSION";
private static final String WOW64 = "WOW64";
@NonNull
public static Map<String, Object> convertUserAgentMetadataToMap(@NonNull UserAgentMetadata userAgentMetadata) {
HashMap hashMap = new HashMap();
hashMap.put(BRAND_VERSION_LIST, getBrandVersionArray(userAgentMetadata.getBrandVersionList()));
hashMap.put(FULL_VERSION, userAgentMetadata.getFullVersion());
hashMap.put(PLATFORM, userAgentMetadata.getPlatform());
hashMap.put(PLATFORM_VERSION, userAgentMetadata.getPlatformVersion());
hashMap.put(ARCHITECTURE, userAgentMetadata.getArchitecture());
hashMap.put(MODEL, userAgentMetadata.getModel());
hashMap.put(MOBILE, Boolean.valueOf(userAgentMetadata.isMobile()));
hashMap.put(BITNESS, Integer.valueOf(userAgentMetadata.getBitness()));
hashMap.put(WOW64, Boolean.valueOf(userAgentMetadata.isWow64()));
return hashMap;
}
private static String[][] getBrandVersionArray(List<UserAgentMetadata.BrandVersion> list) {
if (list == null || list.isEmpty()) {
return null;
}
String[][] strArr = (String[][]) Array.newInstance((Class<?>) String.class, list.size(), 3);
for (int i = 0; i < list.size(); i++) {
strArr[i][0] = list.get(i).getBrand();
strArr[i][1] = list.get(i).getMajorVersion();
strArr[i][2] = list.get(i).getFullVersion();
}
return strArr;
}
@NonNull
public static UserAgentMetadata getUserAgentMetadataFromMap(@NonNull Map<String, Object> map) {
UserAgentMetadata.Builder builder = new UserAgentMetadata.Builder();
Object obj = map.get(BRAND_VERSION_LIST);
if (obj != null) {
ArrayList arrayList = new ArrayList();
for (String[] strArr : (String[][]) obj) {
arrayList.add(new UserAgentMetadata.BrandVersion.Builder().setBrand(strArr[0]).setMajorVersion(strArr[1]).setFullVersion(strArr[2]).build());
}
builder.setBrandVersionList(arrayList);
}
String str = (String) map.get(FULL_VERSION);
if (str != null) {
builder.setFullVersion(str);
}
String str2 = (String) map.get(PLATFORM);
if (str2 != null) {
builder.setPlatform(str2);
}
String str3 = (String) map.get(PLATFORM_VERSION);
if (str3 != null) {
builder.setPlatformVersion(str3);
}
String str4 = (String) map.get(ARCHITECTURE);
if (str4 != null) {
builder.setArchitecture(str4);
}
String str5 = (String) map.get(MODEL);
if (str5 != null) {
builder.setModel(str5);
}
Boolean bool = (Boolean) map.get(MOBILE);
if (bool != null) {
builder.setMobile(bool.booleanValue());
}
Integer num = (Integer) map.get(BITNESS);
if (num != null) {
builder.setBitness(num.intValue());
}
Boolean bool2 = (Boolean) map.get(WOW64);
if (bool2 != null) {
builder.setWow64(bool2.booleanValue());
}
return builder.build();
}
}

View File

@@ -0,0 +1,19 @@
package androidx.webkit.internal;
import androidx.annotation.NonNull;
import androidx.webkit.WebViewCompat;
import org.chromium.support_lib_boundary.VisualStateCallbackBoundaryInterface;
/* loaded from: classes.dex */
public class VisualStateCallbackAdapter implements VisualStateCallbackBoundaryInterface {
private final WebViewCompat.VisualStateCallback mVisualStateCallback;
public VisualStateCallbackAdapter(@NonNull WebViewCompat.VisualStateCallback visualStateCallback) {
this.mVisualStateCallback = visualStateCallback;
}
@Override // org.chromium.support_lib_boundary.VisualStateCallbackBoundaryInterface
public void onComplete(long j) {
this.mVisualStateCallback.onComplete(j);
}
}

View File

@@ -0,0 +1,99 @@
package androidx.webkit.internal;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.webkit.WebMessageCompat;
import androidx.webkit.WebMessagePortCompat;
import androidx.webkit.WebViewFeature;
import java.lang.reflect.InvocationHandler;
import java.util.Objects;
import org.chromium.support_lib_boundary.WebMessageBoundaryInterface;
import org.chromium.support_lib_boundary.WebMessagePayloadBoundaryInterface;
import org.chromium.support_lib_boundary.util.BoundaryInterfaceReflectionUtil;
/* loaded from: classes.dex */
public class WebMessageAdapter implements WebMessageBoundaryInterface {
private static final String[] sFeatures = {WebViewFeature.WEB_MESSAGE_ARRAY_BUFFER};
private WebMessageCompat mWebMessageCompat;
@Override // org.chromium.support_lib_boundary.FeatureFlagHolderBoundaryInterface
@NonNull
public String[] getSupportedFeatures() {
return sFeatures;
}
public WebMessageAdapter(@NonNull WebMessageCompat webMessageCompat) {
this.mWebMessageCompat = webMessageCompat;
}
@Override // org.chromium.support_lib_boundary.WebMessageBoundaryInterface
@Nullable
@Deprecated
public String getData() {
return this.mWebMessageCompat.getData();
}
@Override // org.chromium.support_lib_boundary.WebMessageBoundaryInterface
@Nullable
public InvocationHandler getMessagePayload() {
WebMessagePayloadAdapter webMessagePayloadAdapter;
int type = this.mWebMessageCompat.getType();
if (type == 0) {
webMessagePayloadAdapter = new WebMessagePayloadAdapter(this.mWebMessageCompat.getData());
} else if (type == 1) {
byte[] arrayBuffer = this.mWebMessageCompat.getArrayBuffer();
Objects.requireNonNull(arrayBuffer);
webMessagePayloadAdapter = new WebMessagePayloadAdapter(arrayBuffer);
} else {
throw new IllegalStateException("Unknown web message payload type: " + this.mWebMessageCompat.getType());
}
return BoundaryInterfaceReflectionUtil.createInvocationHandlerFor(webMessagePayloadAdapter);
}
@Override // org.chromium.support_lib_boundary.WebMessageBoundaryInterface
@Nullable
public InvocationHandler[] getPorts() {
WebMessagePortCompat[] ports = this.mWebMessageCompat.getPorts();
if (ports == null) {
return null;
}
InvocationHandler[] invocationHandlerArr = new InvocationHandler[ports.length];
for (int i = 0; i < ports.length; i++) {
invocationHandlerArr[i] = ports[i].getInvocationHandler();
}
return invocationHandlerArr;
}
public static boolean isMessagePayloadTypeSupportedByWebView(int i) {
if (i != 0) {
return i == 1 && WebViewFeatureInternal.WEB_MESSAGE_ARRAY_BUFFER.isSupportedByWebView();
}
return true;
}
@Nullable
public static WebMessageCompat webMessageCompatFromBoundaryInterface(@NonNull WebMessageBoundaryInterface webMessageBoundaryInterface) {
WebMessagePortCompat[] webMessagePortCompats = toWebMessagePortCompats(webMessageBoundaryInterface.getPorts());
if (WebViewFeatureInternal.WEB_MESSAGE_ARRAY_BUFFER.isSupportedByWebView()) {
WebMessagePayloadBoundaryInterface webMessagePayloadBoundaryInterface = (WebMessagePayloadBoundaryInterface) BoundaryInterfaceReflectionUtil.castToSuppLibClass(WebMessagePayloadBoundaryInterface.class, webMessageBoundaryInterface.getMessagePayload());
int type = webMessagePayloadBoundaryInterface.getType();
if (type == 0) {
return new WebMessageCompat(webMessagePayloadBoundaryInterface.getAsString(), webMessagePortCompats);
}
if (type != 1) {
return null;
}
return new WebMessageCompat(webMessagePayloadBoundaryInterface.getAsArrayBuffer(), webMessagePortCompats);
}
return new WebMessageCompat(webMessageBoundaryInterface.getData(), webMessagePortCompats);
}
@NonNull
private static WebMessagePortCompat[] toWebMessagePortCompats(InvocationHandler[] invocationHandlerArr) {
WebMessagePortCompat[] webMessagePortCompatArr = new WebMessagePortCompat[invocationHandlerArr.length];
for (int i = 0; i < invocationHandlerArr.length; i++) {
webMessagePortCompatArr[i] = new WebMessagePortImpl(invocationHandlerArr[i]);
}
return webMessagePortCompatArr;
}
}

View File

@@ -0,0 +1,33 @@
package androidx.webkit.internal;
import androidx.annotation.NonNull;
import androidx.webkit.WebMessageCompat;
import androidx.webkit.WebMessagePortCompat;
import androidx.webkit.WebViewFeature;
import java.lang.reflect.InvocationHandler;
import org.chromium.support_lib_boundary.WebMessageBoundaryInterface;
import org.chromium.support_lib_boundary.WebMessageCallbackBoundaryInterface;
import org.chromium.support_lib_boundary.util.BoundaryInterfaceReflectionUtil;
/* loaded from: classes.dex */
public class WebMessageCallbackAdapter implements WebMessageCallbackBoundaryInterface {
private final WebMessagePortCompat.WebMessageCallbackCompat mImpl;
@Override // org.chromium.support_lib_boundary.FeatureFlagHolderBoundaryInterface
@NonNull
public String[] getSupportedFeatures() {
return new String[]{WebViewFeature.WEB_MESSAGE_CALLBACK_ON_MESSAGE};
}
public WebMessageCallbackAdapter(@NonNull WebMessagePortCompat.WebMessageCallbackCompat webMessageCallbackCompat) {
this.mImpl = webMessageCallbackCompat;
}
@Override // org.chromium.support_lib_boundary.WebMessageCallbackBoundaryInterface
public void onMessage(@NonNull InvocationHandler invocationHandler, @NonNull InvocationHandler invocationHandler2) {
WebMessageCompat webMessageCompatFromBoundaryInterface = WebMessageAdapter.webMessageCompatFromBoundaryInterface((WebMessageBoundaryInterface) BoundaryInterfaceReflectionUtil.castToSuppLibClass(WebMessageBoundaryInterface.class, invocationHandler2));
if (webMessageCompatFromBoundaryInterface != null) {
this.mImpl.onMessage(new WebMessagePortImpl(invocationHandler), webMessageCompatFromBoundaryInterface);
}
}
}

View File

@@ -0,0 +1,35 @@
package androidx.webkit.internal;
import android.net.Uri;
import android.webkit.WebView;
import androidx.annotation.NonNull;
import androidx.webkit.WebMessageCompat;
import androidx.webkit.WebViewCompat;
import androidx.webkit.WebViewFeature;
import java.lang.reflect.InvocationHandler;
import org.chromium.support_lib_boundary.WebMessageBoundaryInterface;
import org.chromium.support_lib_boundary.WebMessageListenerBoundaryInterface;
import org.chromium.support_lib_boundary.util.BoundaryInterfaceReflectionUtil;
/* loaded from: classes.dex */
public class WebMessageListenerAdapter implements WebMessageListenerBoundaryInterface {
private WebViewCompat.WebMessageListener mWebMessageListener;
@Override // org.chromium.support_lib_boundary.FeatureFlagHolderBoundaryInterface
@NonNull
public String[] getSupportedFeatures() {
return new String[]{WebViewFeature.WEB_MESSAGE_LISTENER, WebViewFeature.WEB_MESSAGE_ARRAY_BUFFER};
}
public WebMessageListenerAdapter(@NonNull WebViewCompat.WebMessageListener webMessageListener) {
this.mWebMessageListener = webMessageListener;
}
@Override // org.chromium.support_lib_boundary.WebMessageListenerBoundaryInterface
public void onPostMessage(@NonNull WebView webView, @NonNull InvocationHandler invocationHandler, @NonNull Uri uri, boolean z, @NonNull InvocationHandler invocationHandler2) {
WebMessageCompat webMessageCompatFromBoundaryInterface = WebMessageAdapter.webMessageCompatFromBoundaryInterface((WebMessageBoundaryInterface) BoundaryInterfaceReflectionUtil.castToSuppLibClass(WebMessageBoundaryInterface.class, invocationHandler));
if (webMessageCompatFromBoundaryInterface != null) {
this.mWebMessageListener.onPostMessage(webView, webMessageCompatFromBoundaryInterface, uri, z, JavaScriptReplyProxyImpl.forInvocationHandler(invocationHandler2));
}
}
}

View File

@@ -0,0 +1,63 @@
package androidx.webkit.internal;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.util.Objects;
import org.chromium.support_lib_boundary.WebMessagePayloadBoundaryInterface;
/* loaded from: classes.dex */
public class WebMessagePayloadAdapter implements WebMessagePayloadBoundaryInterface {
@Nullable
private final byte[] mArrayBuffer;
@Nullable
private final String mString;
private final int mType;
@Override // org.chromium.support_lib_boundary.FeatureFlagHolderBoundaryInterface
@NonNull
public String[] getSupportedFeatures() {
return new String[0];
}
@Override // org.chromium.support_lib_boundary.WebMessagePayloadBoundaryInterface
public int getType() {
return this.mType;
}
public WebMessagePayloadAdapter(@Nullable String str) {
this.mType = 0;
this.mString = str;
this.mArrayBuffer = null;
}
public WebMessagePayloadAdapter(@NonNull byte[] bArr) {
this.mType = 1;
this.mString = null;
this.mArrayBuffer = bArr;
}
@Override // org.chromium.support_lib_boundary.WebMessagePayloadBoundaryInterface
@Nullable
public String getAsString() {
checkType(0);
return this.mString;
}
@Override // org.chromium.support_lib_boundary.WebMessagePayloadBoundaryInterface
@NonNull
public byte[] getAsArrayBuffer() {
checkType(1);
byte[] bArr = this.mArrayBuffer;
Objects.requireNonNull(bArr);
return bArr;
}
private void checkType(int i) {
if (this.mType == i) {
return;
}
throw new IllegalStateException("Expected " + i + ", but type is " + this.mType);
}
}

View File

@@ -0,0 +1,151 @@
package androidx.webkit.internal;
import android.os.Handler;
import android.webkit.WebMessage;
import android.webkit.WebMessagePort;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.webkit.WebMessageCompat;
import androidx.webkit.WebMessagePortCompat;
import androidx.webkit.internal.ApiFeature;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
import org.chromium.support_lib_boundary.WebMessagePortBoundaryInterface;
import org.chromium.support_lib_boundary.util.BoundaryInterfaceReflectionUtil;
/* loaded from: classes.dex */
public class WebMessagePortImpl extends WebMessagePortCompat {
private WebMessagePortBoundaryInterface mBoundaryInterface;
private WebMessagePort mFrameworksImpl;
public WebMessagePortImpl(@NonNull WebMessagePort webMessagePort) {
this.mFrameworksImpl = webMessagePort;
}
public WebMessagePortImpl(@NonNull InvocationHandler invocationHandler) {
this.mBoundaryInterface = (WebMessagePortBoundaryInterface) BoundaryInterfaceReflectionUtil.castToSuppLibClass(WebMessagePortBoundaryInterface.class, invocationHandler);
}
@RequiresApi(23)
private WebMessagePort getFrameworksImpl() {
if (this.mFrameworksImpl == null) {
this.mFrameworksImpl = WebViewGlueCommunicator.getCompatConverter().convertWebMessagePort(Proxy.getInvocationHandler(this.mBoundaryInterface));
}
return this.mFrameworksImpl;
}
private WebMessagePortBoundaryInterface getBoundaryInterface() {
if (this.mBoundaryInterface == null) {
this.mBoundaryInterface = (WebMessagePortBoundaryInterface) BoundaryInterfaceReflectionUtil.castToSuppLibClass(WebMessagePortBoundaryInterface.class, WebViewGlueCommunicator.getCompatConverter().convertWebMessagePort(this.mFrameworksImpl));
}
return this.mBoundaryInterface;
}
@Override // androidx.webkit.WebMessagePortCompat
public void postMessage(@NonNull WebMessageCompat webMessageCompat) {
ApiFeature.M m = WebViewFeatureInternal.WEB_MESSAGE_PORT_POST_MESSAGE;
if (m.isSupportedByFramework() && webMessageCompat.getType() == 0) {
ApiHelperForM.postMessage(getFrameworksImpl(), compatToFrameworkMessage(webMessageCompat));
} else {
if (m.isSupportedByWebView() && WebMessageAdapter.isMessagePayloadTypeSupportedByWebView(webMessageCompat.getType())) {
getBoundaryInterface().postMessage(BoundaryInterfaceReflectionUtil.createInvocationHandlerFor(new WebMessageAdapter(webMessageCompat)));
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}
@Override // androidx.webkit.WebMessagePortCompat
public void close() {
ApiFeature.M m = WebViewFeatureInternal.WEB_MESSAGE_PORT_CLOSE;
if (m.isSupportedByFramework()) {
ApiHelperForM.close(getFrameworksImpl());
} else {
if (m.isSupportedByWebView()) {
getBoundaryInterface().close();
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}
@Override // androidx.webkit.WebMessagePortCompat
public void setWebMessageCallback(@NonNull WebMessagePortCompat.WebMessageCallbackCompat webMessageCallbackCompat) {
ApiFeature.M m = WebViewFeatureInternal.WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK;
if (m.isSupportedByWebView()) {
getBoundaryInterface().setWebMessageCallback(BoundaryInterfaceReflectionUtil.createInvocationHandlerFor(new WebMessageCallbackAdapter(webMessageCallbackCompat)));
} else {
if (m.isSupportedByFramework()) {
ApiHelperForM.setWebMessageCallback(getFrameworksImpl(), webMessageCallbackCompat);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}
@Override // androidx.webkit.WebMessagePortCompat
public void setWebMessageCallback(@Nullable Handler handler, @NonNull WebMessagePortCompat.WebMessageCallbackCompat webMessageCallbackCompat) {
ApiFeature.M m = WebViewFeatureInternal.CREATE_WEB_MESSAGE_CHANNEL;
if (m.isSupportedByWebView()) {
getBoundaryInterface().setWebMessageCallback(BoundaryInterfaceReflectionUtil.createInvocationHandlerFor(new WebMessageCallbackAdapter(webMessageCallbackCompat)), handler);
} else {
if (m.isSupportedByFramework()) {
ApiHelperForM.setWebMessageCallback(getFrameworksImpl(), webMessageCallbackCompat, handler);
return;
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}
@Override // androidx.webkit.WebMessagePortCompat
@NonNull
@RequiresApi(23)
public WebMessagePort getFrameworkPort() {
return getFrameworksImpl();
}
@Override // androidx.webkit.WebMessagePortCompat
@NonNull
public InvocationHandler getInvocationHandler() {
return Proxy.getInvocationHandler(getBoundaryInterface());
}
@Nullable
public static WebMessagePortCompat[] portsToCompat(@Nullable WebMessagePort[] webMessagePortArr) {
if (webMessagePortArr == null) {
return null;
}
WebMessagePortCompat[] webMessagePortCompatArr = new WebMessagePortCompat[webMessagePortArr.length];
for (int i = 0; i < webMessagePortArr.length; i++) {
webMessagePortCompatArr[i] = new WebMessagePortImpl(webMessagePortArr[i]);
}
return webMessagePortCompatArr;
}
@Nullable
@RequiresApi(23)
public static WebMessagePort[] compatToPorts(@Nullable WebMessagePortCompat[] webMessagePortCompatArr) {
if (webMessagePortCompatArr == null) {
return null;
}
int length = webMessagePortCompatArr.length;
WebMessagePort[] webMessagePortArr = new WebMessagePort[length];
for (int i = 0; i < length; i++) {
webMessagePortArr[i] = webMessagePortCompatArr[i].getFrameworkPort();
}
return webMessagePortArr;
}
@NonNull
@RequiresApi(23)
public static WebMessage compatToFrameworkMessage(@NonNull WebMessageCompat webMessageCompat) {
return ApiHelperForM.createWebMessage(webMessageCompat);
}
@NonNull
@RequiresApi(23)
public static WebMessageCompat frameworkMessageToCompat(@NonNull WebMessage webMessage) {
return ApiHelperForM.createWebMessageCompat(webMessage);
}
}

View File

@@ -0,0 +1,65 @@
package androidx.webkit.internal;
import android.webkit.WebResourceError;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.webkit.WebResourceErrorCompat;
import androidx.webkit.internal.ApiFeature;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
import org.chromium.support_lib_boundary.WebResourceErrorBoundaryInterface;
import org.chromium.support_lib_boundary.util.BoundaryInterfaceReflectionUtil;
/* loaded from: classes.dex */
public class WebResourceErrorImpl extends WebResourceErrorCompat {
private WebResourceErrorBoundaryInterface mBoundaryInterface;
private WebResourceError mFrameworksImpl;
public WebResourceErrorImpl(@NonNull InvocationHandler invocationHandler) {
this.mBoundaryInterface = (WebResourceErrorBoundaryInterface) BoundaryInterfaceReflectionUtil.castToSuppLibClass(WebResourceErrorBoundaryInterface.class, invocationHandler);
}
public WebResourceErrorImpl(@NonNull WebResourceError webResourceError) {
this.mFrameworksImpl = webResourceError;
}
@RequiresApi(23)
private WebResourceError getFrameworksImpl() {
if (this.mFrameworksImpl == null) {
this.mFrameworksImpl = WebViewGlueCommunicator.getCompatConverter().convertWebResourceError(Proxy.getInvocationHandler(this.mBoundaryInterface));
}
return this.mFrameworksImpl;
}
private WebResourceErrorBoundaryInterface getBoundaryInterface() {
if (this.mBoundaryInterface == null) {
this.mBoundaryInterface = (WebResourceErrorBoundaryInterface) BoundaryInterfaceReflectionUtil.castToSuppLibClass(WebResourceErrorBoundaryInterface.class, WebViewGlueCommunicator.getCompatConverter().convertWebResourceError(this.mFrameworksImpl));
}
return this.mBoundaryInterface;
}
@Override // androidx.webkit.WebResourceErrorCompat
public int getErrorCode() {
ApiFeature.M m = WebViewFeatureInternal.WEB_RESOURCE_ERROR_GET_CODE;
if (m.isSupportedByFramework()) {
return ApiHelperForM.getErrorCode(getFrameworksImpl());
}
if (m.isSupportedByWebView()) {
return getBoundaryInterface().getErrorCode();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
@Override // androidx.webkit.WebResourceErrorCompat
@NonNull
public CharSequence getDescription() {
ApiFeature.M m = WebViewFeatureInternal.WEB_RESOURCE_ERROR_GET_DESCRIPTION;
if (m.isSupportedByFramework()) {
return ApiHelperForM.getDescription(getFrameworksImpl());
}
if (m.isSupportedByWebView()) {
return getBoundaryInterface().getDescription();
}
throw WebViewFeatureInternal.getUnsupportedOperationException();
}
}

View File

@@ -0,0 +1,17 @@
package androidx.webkit.internal;
import androidx.annotation.NonNull;
import org.chromium.support_lib_boundary.WebResourceRequestBoundaryInterface;
/* loaded from: classes.dex */
public class WebResourceRequestAdapter {
private final WebResourceRequestBoundaryInterface mBoundaryInterface;
public WebResourceRequestAdapter(@NonNull WebResourceRequestBoundaryInterface webResourceRequestBoundaryInterface) {
this.mBoundaryInterface = webResourceRequestBoundaryInterface;
}
public boolean isRedirect() {
return this.mBoundaryInterface.isRedirect();
}
}

View File

@@ -0,0 +1,107 @@
package androidx.webkit.internal;
import androidx.annotation.NonNull;
import androidx.webkit.UserAgentMetadata;
import androidx.webkit.WebViewMediaIntegrityApiStatusConfig;
import java.util.Set;
import org.chromium.support_lib_boundary.WebSettingsBoundaryInterface;
/* loaded from: classes.dex */
public class WebSettingsAdapter {
private final WebSettingsBoundaryInterface mBoundaryInterface;
public WebSettingsAdapter(@NonNull WebSettingsBoundaryInterface webSettingsBoundaryInterface) {
this.mBoundaryInterface = webSettingsBoundaryInterface;
}
public void setOffscreenPreRaster(boolean z) {
this.mBoundaryInterface.setOffscreenPreRaster(z);
}
public boolean getOffscreenPreRaster() {
return this.mBoundaryInterface.getOffscreenPreRaster();
}
public void setSafeBrowsingEnabled(boolean z) {
this.mBoundaryInterface.setSafeBrowsingEnabled(z);
}
public boolean getSafeBrowsingEnabled() {
return this.mBoundaryInterface.getSafeBrowsingEnabled();
}
public void setDisabledActionModeMenuItems(int i) {
this.mBoundaryInterface.setDisabledActionModeMenuItems(i);
}
public int getDisabledActionModeMenuItems() {
return this.mBoundaryInterface.getDisabledActionModeMenuItems();
}
public void setForceDark(int i) {
this.mBoundaryInterface.setForceDark(i);
}
public int getForceDark() {
return this.mBoundaryInterface.getForceDark();
}
public void setForceDarkStrategy(int i) {
this.mBoundaryInterface.setForceDarkBehavior(i);
}
public int getForceDarkStrategy() {
return this.mBoundaryInterface.getForceDarkBehavior();
}
public void setAlgorithmicDarkeningAllowed(boolean z) {
this.mBoundaryInterface.setAlgorithmicDarkeningAllowed(z);
}
public boolean isAlgorithmicDarkeningAllowed() {
return this.mBoundaryInterface.isAlgorithmicDarkeningAllowed();
}
public void setEnterpriseAuthenticationAppLinkPolicyEnabled(boolean z) {
this.mBoundaryInterface.setEnterpriseAuthenticationAppLinkPolicyEnabled(z);
}
public boolean getEnterpriseAuthenticationAppLinkPolicyEnabled() {
return this.mBoundaryInterface.getEnterpriseAuthenticationAppLinkPolicyEnabled();
}
@NonNull
public Set<String> getRequestedWithHeaderOriginAllowList() {
return this.mBoundaryInterface.getRequestedWithHeaderOriginAllowList();
}
public void setRequestedWithHeaderOriginAllowList(@NonNull Set<String> set) {
this.mBoundaryInterface.setRequestedWithHeaderOriginAllowList(set);
}
@NonNull
public UserAgentMetadata getUserAgentMetadata() {
return UserAgentMetadataInternal.getUserAgentMetadataFromMap(this.mBoundaryInterface.getUserAgentMetadataMap());
}
public void setUserAgentMetadata(@NonNull UserAgentMetadata userAgentMetadata) {
this.mBoundaryInterface.setUserAgentMetadataFromMap(UserAgentMetadataInternal.convertUserAgentMetadataToMap(userAgentMetadata));
}
public int getAttributionRegistrationBehavior() {
return this.mBoundaryInterface.getAttributionBehavior();
}
public void setAttributionRegistrationBehavior(int i) {
this.mBoundaryInterface.setAttributionBehavior(i);
}
public void setWebViewMediaIntegrityApiStatus(@NonNull WebViewMediaIntegrityApiStatusConfig webViewMediaIntegrityApiStatusConfig) {
this.mBoundaryInterface.setWebViewMediaIntegrityApiStatus(webViewMediaIntegrityApiStatusConfig.getDefaultStatus(), webViewMediaIntegrityApiStatusConfig.getOverrideRules());
}
@NonNull
public WebViewMediaIntegrityApiStatusConfig getWebViewMediaIntegrityApiStatus() {
return new WebViewMediaIntegrityApiStatusConfig.Builder(this.mBoundaryInterface.getWebViewMediaIntegrityApiDefaultStatus()).setOverrideRules(this.mBoundaryInterface.getWebViewMediaIntegrityApiOverrideRules()).build();
}
}

View File

@@ -0,0 +1,167 @@
package androidx.webkit.internal;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.os.Build;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import androidx.annotation.VisibleForTesting;
import androidx.webkit.WebViewCompat;
import androidx.webkit.WebViewFeature;
import androidx.webkit.internal.ApiFeature;
import androidx.webkit.internal.StartupApiFeature;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/* loaded from: classes.dex */
public class WebViewFeatureInternal {
public static final ApiFeature.M VISUAL_STATE_CALLBACK = new ApiFeature.M(WebViewFeature.VISUAL_STATE_CALLBACK, WebViewFeature.VISUAL_STATE_CALLBACK);
public static final ApiFeature.M OFF_SCREEN_PRERASTER = new ApiFeature.M(WebViewFeature.OFF_SCREEN_PRERASTER, WebViewFeature.OFF_SCREEN_PRERASTER);
public static final ApiFeature.O SAFE_BROWSING_ENABLE = new ApiFeature.O(WebViewFeature.SAFE_BROWSING_ENABLE, WebViewFeature.SAFE_BROWSING_ENABLE);
public static final ApiFeature.N DISABLED_ACTION_MODE_MENU_ITEMS = new ApiFeature.N(WebViewFeature.DISABLED_ACTION_MODE_MENU_ITEMS, WebViewFeature.DISABLED_ACTION_MODE_MENU_ITEMS);
public static final ApiFeature.O_MR1 START_SAFE_BROWSING = new ApiFeature.O_MR1(WebViewFeature.START_SAFE_BROWSING, WebViewFeature.START_SAFE_BROWSING);
@Deprecated
public static final ApiFeature.O_MR1 SAFE_BROWSING_ALLOWLIST_DEPRECATED_TO_DEPRECATED = new ApiFeature.O_MR1(WebViewFeature.SAFE_BROWSING_WHITELIST, WebViewFeature.SAFE_BROWSING_WHITELIST);
@Deprecated
public static final ApiFeature.O_MR1 SAFE_BROWSING_ALLOWLIST_DEPRECATED_TO_PREFERRED = new ApiFeature.O_MR1(WebViewFeature.SAFE_BROWSING_WHITELIST, WebViewFeature.SAFE_BROWSING_ALLOWLIST);
public static final ApiFeature.O_MR1 SAFE_BROWSING_ALLOWLIST_PREFERRED_TO_DEPRECATED = new ApiFeature.O_MR1(WebViewFeature.SAFE_BROWSING_ALLOWLIST, WebViewFeature.SAFE_BROWSING_WHITELIST);
public static final ApiFeature.O_MR1 SAFE_BROWSING_ALLOWLIST_PREFERRED_TO_PREFERRED = new ApiFeature.O_MR1(WebViewFeature.SAFE_BROWSING_ALLOWLIST, WebViewFeature.SAFE_BROWSING_ALLOWLIST);
public static final ApiFeature.O_MR1 SAFE_BROWSING_PRIVACY_POLICY_URL = new ApiFeature.O_MR1(WebViewFeature.SAFE_BROWSING_PRIVACY_POLICY_URL, WebViewFeature.SAFE_BROWSING_PRIVACY_POLICY_URL);
public static final ApiFeature.N SERVICE_WORKER_BASIC_USAGE = new ApiFeature.N(WebViewFeature.SERVICE_WORKER_BASIC_USAGE, WebViewFeature.SERVICE_WORKER_BASIC_USAGE);
public static final ApiFeature.N SERVICE_WORKER_CACHE_MODE = new ApiFeature.N(WebViewFeature.SERVICE_WORKER_CACHE_MODE, WebViewFeature.SERVICE_WORKER_CACHE_MODE);
public static final ApiFeature.N SERVICE_WORKER_CONTENT_ACCESS = new ApiFeature.N(WebViewFeature.SERVICE_WORKER_CONTENT_ACCESS, WebViewFeature.SERVICE_WORKER_CONTENT_ACCESS);
public static final ApiFeature.N SERVICE_WORKER_FILE_ACCESS = new ApiFeature.N(WebViewFeature.SERVICE_WORKER_FILE_ACCESS, WebViewFeature.SERVICE_WORKER_FILE_ACCESS);
public static final ApiFeature.N SERVICE_WORKER_BLOCK_NETWORK_LOADS = new ApiFeature.N(WebViewFeature.SERVICE_WORKER_BLOCK_NETWORK_LOADS, WebViewFeature.SERVICE_WORKER_BLOCK_NETWORK_LOADS);
public static final ApiFeature.N SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST = new ApiFeature.N(WebViewFeature.SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST, WebViewFeature.SERVICE_WORKER_SHOULD_INTERCEPT_REQUEST);
public static final ApiFeature.M RECEIVE_WEB_RESOURCE_ERROR = new ApiFeature.M(WebViewFeature.RECEIVE_WEB_RESOURCE_ERROR, WebViewFeature.RECEIVE_WEB_RESOURCE_ERROR);
public static final ApiFeature.M RECEIVE_HTTP_ERROR = new ApiFeature.M(WebViewFeature.RECEIVE_HTTP_ERROR, WebViewFeature.RECEIVE_HTTP_ERROR);
public static final ApiFeature.N SHOULD_OVERRIDE_WITH_REDIRECTS = new ApiFeature.N(WebViewFeature.SHOULD_OVERRIDE_WITH_REDIRECTS, WebViewFeature.SHOULD_OVERRIDE_WITH_REDIRECTS);
public static final ApiFeature.O_MR1 SAFE_BROWSING_HIT = new ApiFeature.O_MR1(WebViewFeature.SAFE_BROWSING_HIT, WebViewFeature.SAFE_BROWSING_HIT);
public static final ApiFeature.N WEB_RESOURCE_REQUEST_IS_REDIRECT = new ApiFeature.N(WebViewFeature.WEB_RESOURCE_REQUEST_IS_REDIRECT, WebViewFeature.WEB_RESOURCE_REQUEST_IS_REDIRECT);
public static final ApiFeature.M WEB_RESOURCE_ERROR_GET_DESCRIPTION = new ApiFeature.M(WebViewFeature.WEB_RESOURCE_ERROR_GET_DESCRIPTION, WebViewFeature.WEB_RESOURCE_ERROR_GET_DESCRIPTION);
public static final ApiFeature.M WEB_RESOURCE_ERROR_GET_CODE = new ApiFeature.M(WebViewFeature.WEB_RESOURCE_ERROR_GET_CODE, WebViewFeature.WEB_RESOURCE_ERROR_GET_CODE);
public static final ApiFeature.O_MR1 SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY = new ApiFeature.O_MR1(WebViewFeature.SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY, WebViewFeature.SAFE_BROWSING_RESPONSE_BACK_TO_SAFETY);
public static final ApiFeature.O_MR1 SAFE_BROWSING_RESPONSE_PROCEED = new ApiFeature.O_MR1(WebViewFeature.SAFE_BROWSING_RESPONSE_PROCEED, WebViewFeature.SAFE_BROWSING_RESPONSE_PROCEED);
public static final ApiFeature.O_MR1 SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL = new ApiFeature.O_MR1(WebViewFeature.SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL, WebViewFeature.SAFE_BROWSING_RESPONSE_SHOW_INTERSTITIAL);
public static final ApiFeature.M WEB_MESSAGE_PORT_POST_MESSAGE = new ApiFeature.M(WebViewFeature.WEB_MESSAGE_PORT_POST_MESSAGE, WebViewFeature.WEB_MESSAGE_PORT_POST_MESSAGE);
public static final ApiFeature.M WEB_MESSAGE_PORT_CLOSE = new ApiFeature.M(WebViewFeature.WEB_MESSAGE_PORT_CLOSE, WebViewFeature.WEB_MESSAGE_PORT_CLOSE);
public static final ApiFeature.NoFramework WEB_MESSAGE_ARRAY_BUFFER = new ApiFeature.NoFramework(WebViewFeature.WEB_MESSAGE_ARRAY_BUFFER, WebViewFeature.WEB_MESSAGE_ARRAY_BUFFER);
public static final ApiFeature.M WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK = new ApiFeature.M(WebViewFeature.WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK, WebViewFeature.WEB_MESSAGE_PORT_SET_MESSAGE_CALLBACK);
public static final ApiFeature.M CREATE_WEB_MESSAGE_CHANNEL = new ApiFeature.M(WebViewFeature.CREATE_WEB_MESSAGE_CHANNEL, WebViewFeature.CREATE_WEB_MESSAGE_CHANNEL);
public static final ApiFeature.M POST_WEB_MESSAGE = new ApiFeature.M(WebViewFeature.POST_WEB_MESSAGE, WebViewFeature.POST_WEB_MESSAGE);
public static final ApiFeature.M WEB_MESSAGE_CALLBACK_ON_MESSAGE = new ApiFeature.M(WebViewFeature.WEB_MESSAGE_CALLBACK_ON_MESSAGE, WebViewFeature.WEB_MESSAGE_CALLBACK_ON_MESSAGE);
public static final ApiFeature.O GET_WEB_VIEW_CLIENT = new ApiFeature.O(WebViewFeature.GET_WEB_VIEW_CLIENT, WebViewFeature.GET_WEB_VIEW_CLIENT);
public static final ApiFeature.O GET_WEB_CHROME_CLIENT = new ApiFeature.O(WebViewFeature.GET_WEB_CHROME_CLIENT, WebViewFeature.GET_WEB_CHROME_CLIENT);
public static final ApiFeature.Q GET_WEB_VIEW_RENDERER = new ApiFeature.Q(WebViewFeature.GET_WEB_VIEW_RENDERER, WebViewFeature.GET_WEB_VIEW_RENDERER);
public static final ApiFeature.Q WEB_VIEW_RENDERER_TERMINATE = new ApiFeature.Q(WebViewFeature.WEB_VIEW_RENDERER_TERMINATE, WebViewFeature.WEB_VIEW_RENDERER_TERMINATE);
public static final ApiFeature.P TRACING_CONTROLLER_BASIC_USAGE = new ApiFeature.P(WebViewFeature.TRACING_CONTROLLER_BASIC_USAGE, WebViewFeature.TRACING_CONTROLLER_BASIC_USAGE);
public static final StartupApiFeature.P STARTUP_FEATURE_SET_DATA_DIRECTORY_SUFFIX = new StartupApiFeature.P("STARTUP_FEATURE_SET_DATA_DIRECTORY_SUFFIX", "STARTUP_FEATURE_SET_DATA_DIRECTORY_SUFFIX");
public static final StartupApiFeature.NoFramework STARTUP_FEATURE_SET_DIRECTORY_BASE_PATH = new StartupApiFeature.NoFramework(WebViewFeature.STARTUP_FEATURE_SET_DIRECTORY_BASE_PATHS, StartupFeatures.STARTUP_FEATURE_SET_DIRECTORY_BASE_PATH);
public static final ApiFeature.Q WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE = new ApiFeature.Q(WebViewFeature.WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE, WebViewFeature.WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE);
public static final ApiFeature.T ALGORITHMIC_DARKENING = new ApiFeature.T(WebViewFeature.ALGORITHMIC_DARKENING, WebViewFeature.ALGORITHMIC_DARKENING) { // from class: androidx.webkit.internal.WebViewFeatureInternal.1
private final Pattern mVersionPattern = Pattern.compile("\\A\\d+");
@Override // androidx.webkit.internal.ApiFeature
public boolean isSupportedByWebView() {
boolean isSupportedByWebView = super.isSupportedByWebView();
if (!isSupportedByWebView || Build.VERSION.SDK_INT >= 29) {
return isSupportedByWebView;
}
PackageInfo currentLoadedWebViewPackage = WebViewCompat.getCurrentLoadedWebViewPackage();
if (currentLoadedWebViewPackage == null) {
return false;
}
Matcher matcher = this.mVersionPattern.matcher(currentLoadedWebViewPackage.versionName);
return matcher.find() && Integer.parseInt(currentLoadedWebViewPackage.versionName.substring(matcher.start(), matcher.end())) >= 105;
}
};
public static final ApiFeature.NoFramework PROXY_OVERRIDE = new ApiFeature.NoFramework(WebViewFeature.PROXY_OVERRIDE, "PROXY_OVERRIDE:3");
public static final ApiFeature.NoFramework MULTI_PROCESS = new ApiFeature.NoFramework(WebViewFeature.MULTI_PROCESS, "MULTI_PROCESS_QUERY");
public static final ApiFeature.Q FORCE_DARK = new ApiFeature.Q(WebViewFeature.FORCE_DARK, WebViewFeature.FORCE_DARK);
public static final ApiFeature.NoFramework FORCE_DARK_STRATEGY = new ApiFeature.NoFramework(WebViewFeature.FORCE_DARK_STRATEGY, "FORCE_DARK_BEHAVIOR");
public static final ApiFeature.NoFramework WEB_MESSAGE_LISTENER = new ApiFeature.NoFramework(WebViewFeature.WEB_MESSAGE_LISTENER, WebViewFeature.WEB_MESSAGE_LISTENER);
public static final ApiFeature.NoFramework DOCUMENT_START_SCRIPT = new ApiFeature.NoFramework(WebViewFeature.DOCUMENT_START_SCRIPT, "DOCUMENT_START_SCRIPT:1");
public static final ApiFeature.NoFramework PROXY_OVERRIDE_REVERSE_BYPASS = new ApiFeature.NoFramework(WebViewFeature.PROXY_OVERRIDE_REVERSE_BYPASS, WebViewFeature.PROXY_OVERRIDE_REVERSE_BYPASS);
public static final ApiFeature.NoFramework GET_VARIATIONS_HEADER = new ApiFeature.NoFramework(WebViewFeature.GET_VARIATIONS_HEADER, WebViewFeature.GET_VARIATIONS_HEADER);
public static final ApiFeature.NoFramework ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY = new ApiFeature.NoFramework(WebViewFeature.ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY, WebViewFeature.ENTERPRISE_AUTHENTICATION_APP_LINK_POLICY);
public static final ApiFeature.NoFramework GET_COOKIE_INFO = new ApiFeature.NoFramework(WebViewFeature.GET_COOKIE_INFO, WebViewFeature.GET_COOKIE_INFO);
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public static final ApiFeature.NoFramework REQUESTED_WITH_HEADER_ALLOW_LIST = new ApiFeature.NoFramework(WebViewFeature.REQUESTED_WITH_HEADER_ALLOW_LIST, WebViewFeature.REQUESTED_WITH_HEADER_ALLOW_LIST);
public static final ApiFeature.NoFramework USER_AGENT_METADATA = new ApiFeature.NoFramework(WebViewFeature.USER_AGENT_METADATA, WebViewFeature.USER_AGENT_METADATA);
public static final ApiFeature.NoFramework MULTI_PROFILE = new ApiFeature.NoFramework(WebViewFeature.MULTI_PROFILE, WebViewFeature.MULTI_PROFILE) { // from class: androidx.webkit.internal.WebViewFeatureInternal.2
@Override // androidx.webkit.internal.ApiFeature
public boolean isSupportedByWebView() {
if (super.isSupportedByWebView() && WebViewFeature.isFeatureSupported(WebViewFeature.MULTI_PROCESS)) {
return WebViewCompat.isMultiProcessEnabled();
}
return false;
}
};
public static final ApiFeature.NoFramework ATTRIBUTION_REGISTRATION_BEHAVIOR = new ApiFeature.NoFramework(WebViewFeature.ATTRIBUTION_REGISTRATION_BEHAVIOR, "ATTRIBUTION_BEHAVIOR");
public static final ApiFeature.NoFramework WEBVIEW_MEDIA_INTEGRITY_API_STATUS = new ApiFeature.NoFramework(WebViewFeature.WEBVIEW_MEDIA_INTEGRITY_API_STATUS, "WEBVIEW_INTEGRITY_API_STATUS");
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
public static final ApiFeature.NoFramework MUTE_AUDIO = new ApiFeature.NoFramework(WebViewFeature.MUTE_AUDIO, WebViewFeature.MUTE_AUDIO);
private WebViewFeatureInternal() {
}
public static boolean isSupported(@NonNull String str) {
return isSupported(str, ApiFeature.values());
}
public static boolean isStartupFeatureSupported(@NonNull String str, @NonNull Context context) {
return isStartupFeatureSupported(str, StartupApiFeature.values(), context);
}
@VisibleForTesting
public static <T extends ConditionallySupportedFeature> boolean isSupported(@NonNull String str, @NonNull Collection<T> collection) {
HashSet hashSet = new HashSet();
for (T t : collection) {
if (t.getPublicFeatureName().equals(str)) {
hashSet.add(t);
}
}
if (hashSet.isEmpty()) {
throw new RuntimeException("Unknown feature " + str);
}
Iterator it = hashSet.iterator();
while (it.hasNext()) {
if (((ConditionallySupportedFeature) it.next()).isSupported()) {
return true;
}
}
return false;
}
@VisibleForTesting
public static boolean isStartupFeatureSupported(@NonNull String str, @NonNull Collection<StartupApiFeature> collection, @NonNull Context context) {
HashSet hashSet = new HashSet();
for (StartupApiFeature startupApiFeature : collection) {
if (startupApiFeature.getPublicFeatureName().equals(str)) {
hashSet.add(startupApiFeature);
}
}
if (hashSet.isEmpty()) {
throw new RuntimeException("Unknown feature " + str);
}
Iterator it = hashSet.iterator();
while (it.hasNext()) {
if (((StartupApiFeature) it.next()).isSupported(context)) {
return true;
}
}
return false;
}
@NonNull
public static UnsupportedOperationException getUnsupportedOperationException() {
return new UnsupportedOperationException("This method is not supported by the current version of the framework and the current WebView APK");
}
}

View File

@@ -0,0 +1,84 @@
package androidx.webkit.internal;
import android.os.Build;
import android.webkit.WebView;
import androidx.annotation.NonNull;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import org.chromium.support_lib_boundary.WebViewProviderFactoryBoundaryInterface;
import org.chromium.support_lib_boundary.util.BoundaryInterfaceReflectionUtil;
/* loaded from: classes.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";
@NonNull
public static WebViewProviderFactory getFactory() {
return LAZY_FACTORY_HOLDER.INSTANCE;
}
@NonNull
public static WebkitToCompatConverter getCompatConverter() {
return LAZY_COMPAT_CONVERTER_HOLDER.INSTANCE;
}
public static class LAZY_FACTORY_HOLDER {
static final WebViewProviderFactory INSTANCE = WebViewGlueCommunicator.createGlueProviderFactory();
private LAZY_FACTORY_HOLDER() {
}
}
public static class LAZY_COMPAT_CONVERTER_HOLDER {
static final WebkitToCompatConverter INSTANCE = new WebkitToCompatConverter(WebViewGlueCommunicator.getFactory().getWebkitToCompatConverter());
private LAZY_COMPAT_CONVERTER_HOLDER() {
}
}
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, new Class[0]).invoke(null, new Object[0]);
}
@NonNull
public static WebViewProviderFactory createGlueProviderFactory() {
try {
return new WebViewProviderFactoryAdapter((WebViewProviderFactoryBoundaryInterface) BoundaryInterfaceReflectionUtil.castToSuppLibClass(WebViewProviderFactoryBoundaryInterface.class, fetchGlueProviderFactoryImpl()));
} catch (ClassNotFoundException unused) {
return new IncompatibleApkWebViewProviderFactory();
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (NoSuchMethodException e2) {
throw new RuntimeException(e2);
} catch (InvocationTargetException e3) {
throw new RuntimeException(e3);
}
}
@NonNull
public static ClassLoader getWebViewClassLoader() {
if (Build.VERSION.SDK_INT >= 28) {
return ApiHelperForP.getWebViewClassLoader();
}
return getWebViewProviderFactory().getClass().getClassLoader();
}
private static Object getWebViewProviderFactory() {
try {
Method declaredMethod = WebView.class.getDeclaredMethod("getFactory", new Class[0]);
declaredMethod.setAccessible(true);
return declaredMethod.invoke(null, new Object[0]);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (NoSuchMethodException e2) {
throw new RuntimeException(e2);
} catch (InvocationTargetException e3) {
throw new RuntimeException(e3);
}
}
private WebViewGlueCommunicator() {
}
}

View File

@@ -0,0 +1,105 @@
package androidx.webkit.internal;
import android.annotation.SuppressLint;
import android.net.Uri;
import android.webkit.WebChromeClient;
import android.webkit.WebViewClient;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.webkit.Profile;
import androidx.webkit.WebMessageCompat;
import androidx.webkit.WebMessagePortCompat;
import androidx.webkit.WebViewCompat;
import androidx.webkit.WebViewRenderProcess;
import androidx.webkit.WebViewRenderProcessClient;
import java.lang.reflect.InvocationHandler;
import java.util.concurrent.Executor;
import org.chromium.support_lib_boundary.ProfileBoundaryInterface;
import org.chromium.support_lib_boundary.WebViewProviderBoundaryInterface;
import org.chromium.support_lib_boundary.util.BoundaryInterfaceReflectionUtil;
/* loaded from: classes.dex */
public class WebViewProviderAdapter {
WebViewProviderBoundaryInterface mImpl;
public WebViewProviderAdapter(@NonNull WebViewProviderBoundaryInterface webViewProviderBoundaryInterface) {
this.mImpl = webViewProviderBoundaryInterface;
}
public void insertVisualStateCallback(long j, @NonNull WebViewCompat.VisualStateCallback visualStateCallback) {
this.mImpl.insertVisualStateCallback(j, BoundaryInterfaceReflectionUtil.createInvocationHandlerFor(new VisualStateCallbackAdapter(visualStateCallback)));
}
@NonNull
public WebMessagePortCompat[] createWebMessageChannel() {
InvocationHandler[] createWebMessageChannel = this.mImpl.createWebMessageChannel();
WebMessagePortCompat[] webMessagePortCompatArr = new WebMessagePortCompat[createWebMessageChannel.length];
for (int i = 0; i < createWebMessageChannel.length; i++) {
webMessagePortCompatArr[i] = new WebMessagePortImpl(createWebMessageChannel[i]);
}
return webMessagePortCompatArr;
}
public void postWebMessage(@NonNull WebMessageCompat webMessageCompat, @NonNull Uri uri) {
this.mImpl.postMessageToMainFrame(BoundaryInterfaceReflectionUtil.createInvocationHandlerFor(new WebMessageAdapter(webMessageCompat)), uri);
}
public void addWebMessageListener(@NonNull String str, @NonNull String[] strArr, @NonNull WebViewCompat.WebMessageListener webMessageListener) {
this.mImpl.addWebMessageListener(str, strArr, BoundaryInterfaceReflectionUtil.createInvocationHandlerFor(new WebMessageListenerAdapter(webMessageListener)));
}
@NonNull
public ScriptHandlerImpl addDocumentStartJavaScript(@NonNull String str, @NonNull String[] strArr) {
return ScriptHandlerImpl.toScriptHandler(this.mImpl.addDocumentStartJavaScript(str, strArr));
}
public void removeWebMessageListener(@NonNull String str) {
this.mImpl.removeWebMessageListener(str);
}
@NonNull
public WebViewClient getWebViewClient() {
return this.mImpl.getWebViewClient();
}
@Nullable
public WebChromeClient getWebChromeClient() {
return this.mImpl.getWebChromeClient();
}
@Nullable
public WebViewRenderProcess getWebViewRenderProcess() {
return WebViewRenderProcessImpl.forInvocationHandler(this.mImpl.getWebViewRenderer());
}
@Nullable
public WebViewRenderProcessClient getWebViewRenderProcessClient() {
InvocationHandler webViewRendererClient = this.mImpl.getWebViewRendererClient();
if (webViewRendererClient == null) {
return null;
}
return ((WebViewRenderProcessClientAdapter) BoundaryInterfaceReflectionUtil.getDelegateFromInvocationHandler(webViewRendererClient)).getWebViewRenderProcessClient();
}
@SuppressLint({"LambdaLast"})
public void setWebViewRenderProcessClient(@Nullable Executor executor, @Nullable WebViewRenderProcessClient webViewRenderProcessClient) {
this.mImpl.setWebViewRendererClient(webViewRenderProcessClient != null ? BoundaryInterfaceReflectionUtil.createInvocationHandlerFor(new WebViewRenderProcessClientAdapter(executor, webViewRenderProcessClient)) : null);
}
public void setProfileWithName(@NonNull String str) {
this.mImpl.setProfile(str);
}
@NonNull
public Profile getProfile() {
return new ProfileImpl((ProfileBoundaryInterface) BoundaryInterfaceReflectionUtil.castToSuppLibClass(ProfileBoundaryInterface.class, this.mImpl.getProfile()));
}
public boolean isAudioMuted() {
return this.mImpl.isAudioMuted();
}
public void setAudioMuted(boolean z) {
this.mImpl.setAudioMuted(z);
}
}

View File

@@ -0,0 +1,42 @@
package androidx.webkit.internal;
import android.webkit.WebView;
import androidx.annotation.NonNull;
import org.chromium.support_lib_boundary.DropDataContentProviderBoundaryInterface;
import org.chromium.support_lib_boundary.ProfileStoreBoundaryInterface;
import org.chromium.support_lib_boundary.ProxyControllerBoundaryInterface;
import org.chromium.support_lib_boundary.ServiceWorkerControllerBoundaryInterface;
import org.chromium.support_lib_boundary.StaticsBoundaryInterface;
import org.chromium.support_lib_boundary.TracingControllerBoundaryInterface;
import org.chromium.support_lib_boundary.WebViewProviderBoundaryInterface;
import org.chromium.support_lib_boundary.WebkitToCompatConverterBoundaryInterface;
/* loaded from: classes.dex */
public interface WebViewProviderFactory {
@NonNull
WebViewProviderBoundaryInterface createWebView(@NonNull WebView webView);
@NonNull
DropDataContentProviderBoundaryInterface getDropDataProvider();
@NonNull
ProfileStoreBoundaryInterface getProfileStore();
@NonNull
ProxyControllerBoundaryInterface getProxyController();
@NonNull
ServiceWorkerControllerBoundaryInterface getServiceWorkerController();
@NonNull
StaticsBoundaryInterface getStatics();
@NonNull
TracingControllerBoundaryInterface getTracingController();
@NonNull
String[] getWebViewFeatures();
@NonNull
WebkitToCompatConverterBoundaryInterface getWebkitToCompatConverter();
}

View File

@@ -0,0 +1,77 @@
package androidx.webkit.internal;
import android.webkit.WebView;
import androidx.annotation.NonNull;
import org.chromium.support_lib_boundary.DropDataContentProviderBoundaryInterface;
import org.chromium.support_lib_boundary.ProfileStoreBoundaryInterface;
import org.chromium.support_lib_boundary.ProxyControllerBoundaryInterface;
import org.chromium.support_lib_boundary.ServiceWorkerControllerBoundaryInterface;
import org.chromium.support_lib_boundary.StaticsBoundaryInterface;
import org.chromium.support_lib_boundary.TracingControllerBoundaryInterface;
import org.chromium.support_lib_boundary.WebViewProviderBoundaryInterface;
import org.chromium.support_lib_boundary.WebViewProviderFactoryBoundaryInterface;
import org.chromium.support_lib_boundary.WebkitToCompatConverterBoundaryInterface;
import org.chromium.support_lib_boundary.util.BoundaryInterfaceReflectionUtil;
/* loaded from: classes.dex */
public class WebViewProviderFactoryAdapter implements WebViewProviderFactory {
final WebViewProviderFactoryBoundaryInterface mImpl;
public WebViewProviderFactoryAdapter(@NonNull WebViewProviderFactoryBoundaryInterface webViewProviderFactoryBoundaryInterface) {
this.mImpl = webViewProviderFactoryBoundaryInterface;
}
@Override // androidx.webkit.internal.WebViewProviderFactory
@NonNull
public WebViewProviderBoundaryInterface createWebView(@NonNull WebView webView) {
return (WebViewProviderBoundaryInterface) BoundaryInterfaceReflectionUtil.castToSuppLibClass(WebViewProviderBoundaryInterface.class, this.mImpl.createWebView(webView));
}
@Override // androidx.webkit.internal.WebViewProviderFactory
@NonNull
public WebkitToCompatConverterBoundaryInterface getWebkitToCompatConverter() {
return (WebkitToCompatConverterBoundaryInterface) BoundaryInterfaceReflectionUtil.castToSuppLibClass(WebkitToCompatConverterBoundaryInterface.class, this.mImpl.getWebkitToCompatConverter());
}
@Override // androidx.webkit.internal.WebViewProviderFactory
@NonNull
public StaticsBoundaryInterface getStatics() {
return (StaticsBoundaryInterface) BoundaryInterfaceReflectionUtil.castToSuppLibClass(StaticsBoundaryInterface.class, this.mImpl.getStatics());
}
@Override // androidx.webkit.internal.WebViewProviderFactory
@NonNull
public String[] getWebViewFeatures() {
return this.mImpl.getSupportedFeatures();
}
@Override // androidx.webkit.internal.WebViewProviderFactory
@NonNull
public ServiceWorkerControllerBoundaryInterface getServiceWorkerController() {
return (ServiceWorkerControllerBoundaryInterface) BoundaryInterfaceReflectionUtil.castToSuppLibClass(ServiceWorkerControllerBoundaryInterface.class, this.mImpl.getServiceWorkerController());
}
@Override // androidx.webkit.internal.WebViewProviderFactory
@NonNull
public TracingControllerBoundaryInterface getTracingController() {
return (TracingControllerBoundaryInterface) BoundaryInterfaceReflectionUtil.castToSuppLibClass(TracingControllerBoundaryInterface.class, this.mImpl.getTracingController());
}
@Override // androidx.webkit.internal.WebViewProviderFactory
@NonNull
public ProxyControllerBoundaryInterface getProxyController() {
return (ProxyControllerBoundaryInterface) BoundaryInterfaceReflectionUtil.castToSuppLibClass(ProxyControllerBoundaryInterface.class, this.mImpl.getProxyController());
}
@Override // androidx.webkit.internal.WebViewProviderFactory
@NonNull
public DropDataContentProviderBoundaryInterface getDropDataProvider() {
return (DropDataContentProviderBoundaryInterface) BoundaryInterfaceReflectionUtil.castToSuppLibClass(DropDataContentProviderBoundaryInterface.class, this.mImpl.getDropDataProvider());
}
@Override // androidx.webkit.internal.WebViewProviderFactory
@NonNull
public ProfileStoreBoundaryInterface getProfileStore() {
return (ProfileStoreBoundaryInterface) BoundaryInterfaceReflectionUtil.castToSuppLibClass(ProfileStoreBoundaryInterface.class, this.mImpl.getProfileStore());
}
}

View File

@@ -0,0 +1,69 @@
package androidx.webkit.internal;
import android.annotation.SuppressLint;
import android.webkit.WebView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.webkit.WebViewFeature;
import androidx.webkit.WebViewRenderProcessClient;
import java.lang.reflect.InvocationHandler;
import java.util.concurrent.Executor;
import org.chromium.support_lib_boundary.WebViewRendererClientBoundaryInterface;
/* loaded from: classes.dex */
public class WebViewRenderProcessClientAdapter implements WebViewRendererClientBoundaryInterface {
private static final String[] sSupportedFeatures = {WebViewFeature.WEB_VIEW_RENDERER_CLIENT_BASIC_USAGE};
private final Executor mExecutor;
private final WebViewRenderProcessClient mWebViewRenderProcessClient;
@Override // org.chromium.support_lib_boundary.FeatureFlagHolderBoundaryInterface
@NonNull
public final String[] getSupportedFeatures() {
return sSupportedFeatures;
}
@Nullable
public WebViewRenderProcessClient getWebViewRenderProcessClient() {
return this.mWebViewRenderProcessClient;
}
@SuppressLint({"LambdaLast"})
public WebViewRenderProcessClientAdapter(@Nullable Executor executor, @Nullable WebViewRenderProcessClient webViewRenderProcessClient) {
this.mExecutor = executor;
this.mWebViewRenderProcessClient = webViewRenderProcessClient;
}
@Override // org.chromium.support_lib_boundary.WebViewRendererClientBoundaryInterface
public final void onRendererUnresponsive(@NonNull final WebView webView, @NonNull InvocationHandler invocationHandler) {
final WebViewRenderProcessImpl forInvocationHandler = WebViewRenderProcessImpl.forInvocationHandler(invocationHandler);
final WebViewRenderProcessClient webViewRenderProcessClient = this.mWebViewRenderProcessClient;
Executor executor = this.mExecutor;
if (executor == null) {
webViewRenderProcessClient.onRenderProcessUnresponsive(webView, forInvocationHandler);
} else {
executor.execute(new Runnable() { // from class: androidx.webkit.internal.WebViewRenderProcessClientAdapter.1
@Override // java.lang.Runnable
public void run() {
webViewRenderProcessClient.onRenderProcessUnresponsive(webView, forInvocationHandler);
}
});
}
}
@Override // org.chromium.support_lib_boundary.WebViewRendererClientBoundaryInterface
public final void onRendererResponsive(@NonNull final WebView webView, @NonNull InvocationHandler invocationHandler) {
final WebViewRenderProcessImpl forInvocationHandler = WebViewRenderProcessImpl.forInvocationHandler(invocationHandler);
final WebViewRenderProcessClient webViewRenderProcessClient = this.mWebViewRenderProcessClient;
Executor executor = this.mExecutor;
if (executor == null) {
webViewRenderProcessClient.onRenderProcessResponsive(webView, forInvocationHandler);
} else {
executor.execute(new Runnable() { // from class: androidx.webkit.internal.WebViewRenderProcessClientAdapter.2
@Override // java.lang.Runnable
public void run() {
webViewRenderProcessClient.onRenderProcessResponsive(webView, forInvocationHandler);
}
});
}
}
}

Some files were not shown because too many files have changed in this diff Show More