- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
107 lines
3.8 KiB
Java
107 lines
3.8 KiB
Java
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);
|
|
}
|
|
}
|
|
}
|