* Decompile and recreate Soul Browser v1.4.85 with APK CI builds Co-authored-by: KaKi87 <KaKi87@pm.me> * Fix CI build: include bundled google.jks and remove PR trigger The apktool build failed in CI because app/unknown/.../google.jks was excluded by the *.jks gitignore rule. Whitelist app-bundled JKS files and commit the missing resource. Also remove the redundant pull_request workflow trigger. Co-authored-by: KaKi87 <KaKi87@pm.me> * Change package ID to com.github.kaki87.soulbrowser Rename the application ID so the rebuilt APK can be installed alongside the original Soul Browser from Google Play. - Update AndroidManifest package, permissions, providers, and actions - Update R class references in smali (com/github/kaki87/soulbrowser/R) - Update shortcuts.xml targetPackage - Rename app label to "Soul Rebuild" for easy identification Co-authored-by: KaKi87 <KaKi87@pm.me> * Fix install compatibility: remove split APK metadata and bundle native libs The rebuilt APK still declared requiredSplitTypes and Play Store split metadata, causing Android to reject standalone installs as incompatible. - Remove requiredSplitTypes and split-related manifest meta-data - Merge native libs from all ABI splits with uncompressed storage - Page-align before signing for extractNativeLibs=false - Add .so to apktool doNotCompress list Co-authored-by: KaKi87 <KaKi87@pm.me> * Fix install failure: use apksigner v2/v3 and bundle arm64 native libs Target SDK 36 requires APK Signature Scheme v2+, but jarsigner only produces v1 signatures, causing Android to reject the install. - Sign with apksigner (v1+v2+v3) instead of jarsigner - Add arm64-v8a native libraries from universal Soul Browser 1.4.79 - Set extractNativeLibs=true for reliable sideload installs - Commit stable debug keystore for consistent signatures across builds Co-authored-by: KaKi87 <KaKi87@pm.me> * Add committed debug keystore for consistent APK signatures Co-authored-by: KaKi87 <KaKi87@pm.me> * Fix startup crash: use original classes2.dex desugar libraries Apktool recompiles smali_classes2 into a broken classes2.dex, causing ClassNotFoundException for j$.com.android.tools.r8.a at ML Kit init. Inject the original classes2.dex (Java 8+ desugar libs) after apktool build instead of using the recompiled version. Co-authored-by: KaKi87 <KaKi87@pm.me> * Fix missing drawable resources from density split APKs The base APK is an app bundle module; density-specific drawables like seek_thumb_nor_b live in config.xhdpi.apk and were missing after rebuild, causing Resources$NotFoundException at runtime. - Merge non-9-patch resources from split APKs before apktool build - Sync public.xml IDs from R smali only when backing files exist - Add 713 density-specific resource IDs to public.xml Co-authored-by: KaKi87 <KaKi87@pm.me> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
379 lines
15 KiB
Java
379 lines
15 KiB
Java
package com.google.android.gms.common;
|
|
|
|
import android.app.NotificationManager;
|
|
import android.app.PendingIntent;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.content.pm.ApplicationInfo;
|
|
import android.content.pm.PackageInfo;
|
|
import android.content.pm.PackageInstaller;
|
|
import android.content.pm.PackageManager;
|
|
import android.content.res.Resources;
|
|
import android.os.Build;
|
|
import android.os.Bundle;
|
|
import android.os.UserManager;
|
|
import android.util.Log;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import androidx.annotation.VisibleForTesting;
|
|
import com.google.android.gms.common.annotation.KeepForSdk;
|
|
import com.google.android.gms.common.internal.HideFirstParty;
|
|
import com.google.android.gms.common.internal.Preconditions;
|
|
import com.google.android.gms.common.internal.ShowFirstParty;
|
|
import com.google.android.gms.common.util.ClientLibraryUtils;
|
|
import com.google.android.gms.common.util.DeviceProperties;
|
|
import com.google.android.gms.common.util.UidVerifier;
|
|
import com.google.android.gms.common.wrappers.PackageManagerWrapper;
|
|
import com.google.android.gms.common.wrappers.Wrappers;
|
|
import java.util.Iterator;
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
|
@ShowFirstParty
|
|
@KeepForSdk
|
|
/* loaded from: classes.dex */
|
|
public class GooglePlayServicesUtilLight {
|
|
|
|
@KeepForSdk
|
|
static final int GMS_AVAILABILITY_NOTIFICATION_ID = 10436;
|
|
|
|
@KeepForSdk
|
|
static final int GMS_GENERAL_ERROR_NOTIFICATION_ID = 39789;
|
|
|
|
@NonNull
|
|
@KeepForSdk
|
|
public static final String GOOGLE_PLAY_GAMES_PACKAGE = "com.google.android.play.games";
|
|
|
|
@NonNull
|
|
@KeepForSdk
|
|
@Deprecated
|
|
public static final String GOOGLE_PLAY_SERVICES_PACKAGE = "com.google.android.gms";
|
|
|
|
@KeepForSdk
|
|
@Deprecated
|
|
public static final int GOOGLE_PLAY_SERVICES_VERSION_CODE = 12451000;
|
|
|
|
@NonNull
|
|
@KeepForSdk
|
|
public static final String GOOGLE_PLAY_STORE_PACKAGE = "com.android.vending";
|
|
|
|
@NonNull
|
|
@KeepForSdk
|
|
public static final String GOOGLE_SERVICES_FRAMEWORK_PACKAGE = "com.google.android.gsf";
|
|
|
|
@VisibleForTesting
|
|
public static boolean zza = false;
|
|
|
|
@VisibleForTesting
|
|
public static boolean zzb = false;
|
|
|
|
@KeepForSdk
|
|
@Deprecated
|
|
static final AtomicBoolean sCanceledAvailabilityNotification = new AtomicBoolean();
|
|
private static final AtomicBoolean zzc = new AtomicBoolean();
|
|
|
|
@KeepForSdk
|
|
public GooglePlayServicesUtilLight() {
|
|
}
|
|
|
|
@KeepForSdk
|
|
@Deprecated
|
|
public static void cancelAvailabilityErrorNotifications(@NonNull Context context) {
|
|
if (!sCanceledAvailabilityNotification.getAndSet(true)) {
|
|
try {
|
|
NotificationManager notificationManager = (NotificationManager) context.getSystemService("notification");
|
|
if (notificationManager != null) {
|
|
notificationManager.cancel(GMS_AVAILABILITY_NOTIFICATION_ID);
|
|
}
|
|
} catch (SecurityException e) {
|
|
Log.d("GooglePlayServicesUtil", "Suppressing Security Exception %s in cancelAvailabilityErrorNotifications.", e);
|
|
}
|
|
}
|
|
}
|
|
|
|
@ShowFirstParty
|
|
@KeepForSdk
|
|
public static void enableUsingApkIndependentContext() {
|
|
zzc.set(true);
|
|
}
|
|
|
|
@KeepForSdk
|
|
@Deprecated
|
|
public static void ensurePlayServicesAvailable(@NonNull Context context, int i) {
|
|
int isGooglePlayServicesAvailable = GoogleApiAvailabilityLight.getInstance().isGooglePlayServicesAvailable(context, i);
|
|
if (isGooglePlayServicesAvailable != 0) {
|
|
Intent errorResolutionIntent = GoogleApiAvailabilityLight.getInstance().getErrorResolutionIntent(context, isGooglePlayServicesAvailable, "e");
|
|
StringBuilder sb = new StringBuilder(String.valueOf(isGooglePlayServicesAvailable).length() + 46);
|
|
sb.append("GooglePlayServices not available due to error ");
|
|
sb.append(isGooglePlayServicesAvailable);
|
|
Log.e("GooglePlayServicesUtil", sb.toString());
|
|
if (errorResolutionIntent == null) {
|
|
throw new GooglePlayServicesNotAvailableException(isGooglePlayServicesAvailable);
|
|
}
|
|
throw new GooglePlayServicesRepairableException(isGooglePlayServicesAvailable, "Google Play Services not available", errorResolutionIntent);
|
|
}
|
|
}
|
|
|
|
@ShowFirstParty
|
|
@KeepForSdk
|
|
@Deprecated
|
|
public static int getApkVersion(@NonNull Context context) {
|
|
try {
|
|
return context.getPackageManager().getPackageInfo("com.google.android.gms", 0).versionCode;
|
|
} catch (PackageManager.NameNotFoundException unused) {
|
|
Log.w("GooglePlayServicesUtil", "Google Play services is missing.");
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
@ShowFirstParty
|
|
@KeepForSdk
|
|
@Deprecated
|
|
public static int getClientVersion(@NonNull Context context) {
|
|
Preconditions.checkState(true);
|
|
return ClientLibraryUtils.getClientVersion(context, context.getPackageName());
|
|
}
|
|
|
|
@Nullable
|
|
@KeepForSdk
|
|
@Deprecated
|
|
public static PendingIntent getErrorPendingIntent(int i, @NonNull Context context, int i2) {
|
|
return GoogleApiAvailabilityLight.getInstance().getErrorResolutionPendingIntent(context, i, i2);
|
|
}
|
|
|
|
@NonNull
|
|
@KeepForSdk
|
|
@Deprecated
|
|
public static String getErrorString(int i) {
|
|
return ConnectionResult.zza(i);
|
|
}
|
|
|
|
@Deprecated
|
|
@Nullable
|
|
@ShowFirstParty
|
|
@KeepForSdk
|
|
public static Intent getGooglePlayServicesAvailabilityRecoveryIntent(int i) {
|
|
return GoogleApiAvailabilityLight.getInstance().getErrorResolutionIntent(null, i, null);
|
|
}
|
|
|
|
@Nullable
|
|
@KeepForSdk
|
|
public static Context getRemoteContext(@NonNull Context context) {
|
|
try {
|
|
return context.createPackageContext("com.google.android.gms", 3);
|
|
} catch (PackageManager.NameNotFoundException unused) {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
@Nullable
|
|
@KeepForSdk
|
|
public static Resources getRemoteResource(@NonNull Context context) {
|
|
try {
|
|
return context.getPackageManager().getResourcesForApplication("com.google.android.gms");
|
|
} catch (PackageManager.NameNotFoundException unused) {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
@ShowFirstParty
|
|
@KeepForSdk
|
|
public static boolean honorsDebugCertificates(@NonNull Context context) {
|
|
int i;
|
|
try {
|
|
if (!zzb) {
|
|
try {
|
|
PackageManagerWrapper packageManager = Wrappers.packageManager(context);
|
|
if (Build.VERSION.SDK_INT >= 28) {
|
|
i = 134217792;
|
|
} else {
|
|
i = 64;
|
|
}
|
|
PackageInfo packageInfo = packageManager.getPackageInfo("com.google.android.gms", i);
|
|
GoogleSignatureVerifier.getInstance(context);
|
|
if (packageInfo != null && !GoogleSignatureVerifier.zza(packageInfo, false) && GoogleSignatureVerifier.zza(packageInfo, true)) {
|
|
zza = true;
|
|
} else {
|
|
zza = false;
|
|
}
|
|
zzb = true;
|
|
} catch (PackageManager.NameNotFoundException e) {
|
|
Log.w("GooglePlayServicesUtil", "Cannot find Google Play services package name.", e);
|
|
zzb = true;
|
|
}
|
|
}
|
|
if (!zza && DeviceProperties.isUserBuild()) {
|
|
return false;
|
|
}
|
|
return true;
|
|
} catch (Throwable th) {
|
|
zzb = true;
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
@HideFirstParty
|
|
@KeepForSdk
|
|
@Deprecated
|
|
public static int isGooglePlayServicesAvailable(@NonNull Context context) {
|
|
return isGooglePlayServicesAvailable(context, GOOGLE_PLAY_SERVICES_VERSION_CODE);
|
|
}
|
|
|
|
@KeepForSdk
|
|
@Deprecated
|
|
public static boolean isGooglePlayServicesUid(@NonNull Context context, int i) {
|
|
return UidVerifier.isGooglePlayServicesUid(context, i);
|
|
}
|
|
|
|
@ShowFirstParty
|
|
@KeepForSdk
|
|
@Deprecated
|
|
public static boolean isPlayServicesPossiblyUpdating(@NonNull Context context, int i) {
|
|
if (i == 18) {
|
|
return true;
|
|
}
|
|
if (i == 1) {
|
|
return zza(context, "com.google.android.gms");
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@ShowFirstParty
|
|
@KeepForSdk
|
|
@Deprecated
|
|
public static boolean isPlayStorePossiblyUpdating(@NonNull Context context, int i) {
|
|
if (i == 9) {
|
|
return zza(context, "com.android.vending");
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@KeepForSdk
|
|
public static boolean isRestrictedUserProfile(@NonNull Context context) {
|
|
Object systemService = context.getSystemService("user");
|
|
Preconditions.checkNotNull(systemService);
|
|
Bundle applicationRestrictions = ((UserManager) systemService).getApplicationRestrictions(context.getPackageName());
|
|
if (applicationRestrictions != null && "true".equals(applicationRestrictions.getString("restricted_profile"))) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@ShowFirstParty
|
|
@KeepForSdk
|
|
@Deprecated
|
|
public static boolean isSidewinderDevice(@NonNull Context context) {
|
|
return DeviceProperties.isSidewinder(context);
|
|
}
|
|
|
|
@KeepForSdk
|
|
@Deprecated
|
|
public static boolean isUserRecoverableError(int i) {
|
|
return i == 1 || i == 2 || i == 3 || i == 9;
|
|
}
|
|
|
|
@KeepForSdk
|
|
@Deprecated
|
|
public static boolean uidHasPackageName(@NonNull Context context, int i, @NonNull String str) {
|
|
return UidVerifier.uidHasPackageName(context, i, str);
|
|
}
|
|
|
|
public static boolean zza(Context context, String str) {
|
|
ApplicationInfo applicationInfo;
|
|
boolean equals = str.equals("com.google.android.gms");
|
|
try {
|
|
Iterator<PackageInstaller.SessionInfo> it = context.getPackageManager().getPackageInstaller().getAllSessions().iterator();
|
|
while (it.hasNext()) {
|
|
if (str.equals(it.next().getAppPackageName())) {
|
|
return true;
|
|
}
|
|
}
|
|
applicationInfo = context.getPackageManager().getApplicationInfo(str, 8192);
|
|
} catch (PackageManager.NameNotFoundException | Exception unused) {
|
|
}
|
|
if (equals) {
|
|
return applicationInfo.enabled;
|
|
}
|
|
if (!applicationInfo.enabled || isRestrictedUserProfile(context)) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
@KeepForSdk
|
|
@Deprecated
|
|
public static int isGooglePlayServicesAvailable(@NonNull Context context, int i) {
|
|
PackageInfo packageInfo;
|
|
try {
|
|
context.getResources().getString(R.string.common_google_play_services_unknown_issue);
|
|
} catch (Throwable unused) {
|
|
Log.e("GooglePlayServicesUtil", "The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.");
|
|
}
|
|
if (!"com.google.android.gms".equals(context.getPackageName()) && !zzc.get()) {
|
|
int zzb2 = com.google.android.gms.common.internal.zzae.zzb(context);
|
|
if (zzb2 != 0) {
|
|
if (zzb2 != GOOGLE_PLAY_SERVICES_VERSION_CODE) {
|
|
throw new GooglePlayServicesIncorrectManifestValueException(zzb2);
|
|
}
|
|
} else {
|
|
throw new GooglePlayServicesMissingManifestValueException();
|
|
}
|
|
}
|
|
boolean z = (DeviceProperties.isWearableWithoutPlayStore(context) || DeviceProperties.zzd(context)) ? false : true;
|
|
Preconditions.checkArgument(i >= 0);
|
|
String packageName = context.getPackageName();
|
|
PackageManager packageManager = context.getPackageManager();
|
|
if (z) {
|
|
try {
|
|
packageInfo = packageManager.getPackageInfo("com.android.vending", Build.VERSION.SDK_INT >= 28 ? 134225984 : 8256);
|
|
} catch (PackageManager.NameNotFoundException unused2) {
|
|
Log.w("GooglePlayServicesUtil", String.valueOf(packageName).concat(" requires the Google Play Store, but it is missing."));
|
|
}
|
|
} else {
|
|
packageInfo = null;
|
|
}
|
|
try {
|
|
PackageInfo packageInfo2 = packageManager.getPackageInfo("com.google.android.gms", Build.VERSION.SDK_INT >= 28 ? 134217792 : 64);
|
|
GoogleSignatureVerifier.getInstance(context);
|
|
if (!GoogleSignatureVerifier.zza(packageInfo2, true)) {
|
|
Log.w("GooglePlayServicesUtil", String.valueOf(packageName).concat(" requires Google Play services, but their signature is invalid."));
|
|
} else {
|
|
if (z) {
|
|
Preconditions.checkNotNull(packageInfo);
|
|
if (!GoogleSignatureVerifier.zza(packageInfo, true)) {
|
|
Log.w("GooglePlayServicesUtil", String.valueOf(packageName).concat(" requires Google Play Store, but its signature is invalid."));
|
|
}
|
|
}
|
|
if (z && packageInfo != null && !packageInfo.signatures[0].equals(packageInfo2.signatures[0])) {
|
|
Log.w("GooglePlayServicesUtil", String.valueOf(packageName).concat(" requires Google Play Store, but its signature doesn't match that of Google Play services."));
|
|
} else {
|
|
if (com.google.android.gms.common.util.zzb.zza(packageInfo2.versionCode) < com.google.android.gms.common.util.zzb.zza(i)) {
|
|
int i2 = packageInfo2.versionCode;
|
|
StringBuilder sb = new StringBuilder(String.valueOf(packageName).length() + 49 + String.valueOf(i).length() + 11 + String.valueOf(i2).length());
|
|
sb.append("Google Play services out of date for ");
|
|
sb.append(packageName);
|
|
sb.append(". Requires ");
|
|
sb.append(i);
|
|
sb.append(" but found ");
|
|
sb.append(i2);
|
|
Log.w("GooglePlayServicesUtil", sb.toString());
|
|
return 2;
|
|
}
|
|
ApplicationInfo applicationInfo = packageInfo2.applicationInfo;
|
|
if (applicationInfo == null) {
|
|
try {
|
|
applicationInfo = packageManager.getApplicationInfo("com.google.android.gms", 0);
|
|
} catch (PackageManager.NameNotFoundException e) {
|
|
Log.wtf("GooglePlayServicesUtil", String.valueOf(packageName).concat(" requires Google Play services, but they're missing when getting application info."), e);
|
|
return 1;
|
|
}
|
|
}
|
|
return !applicationInfo.enabled ? 3 : 0;
|
|
}
|
|
}
|
|
return 9;
|
|
} catch (PackageManager.NameNotFoundException unused3) {
|
|
Log.w("GooglePlayServicesUtil", String.valueOf(packageName).concat(" requires Google Play services, but they are missing."));
|
|
return 1;
|
|
}
|
|
}
|
|
}
|