soul-browser/sources/java/com/google/android/gms/common/GoogleApiAvailabilityLight.java
KaKi87 550ddb0413
Decompile and recreate Soul Browser v1.4.85 with APK CI builds (#1)
* 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>
2026-08-10 16:07:14 +02:00

187 lines
6.4 KiB
Java

package com.google.android.gms.common;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.android.gms.common.annotation.KeepForSdk;
import com.google.android.gms.common.internal.HideFirstParty;
import com.google.android.gms.common.internal.ShowFirstParty;
import com.google.android.gms.common.util.DeviceProperties;
import com.google.android.gms.common.wrappers.Wrappers;
@ShowFirstParty
@KeepForSdk
/* loaded from: classes.dex */
public class GoogleApiAvailabilityLight {
@NonNull
@KeepForSdk
public static final String GOOGLE_PLAY_SERVICES_PACKAGE = "com.google.android.gms";
@NonNull
@KeepForSdk
public static final String GOOGLE_PLAY_STORE_PACKAGE = "com.android.vending";
@KeepForSdk
static final String TRACKING_SOURCE_DIALOG = "d";
@KeepForSdk
static final String TRACKING_SOURCE_NOTIFICATION = "n";
@KeepForSdk
public static final int GOOGLE_PLAY_SERVICES_VERSION_CODE = GooglePlayServicesUtilLight.GOOGLE_PLAY_SERVICES_VERSION_CODE;
private static final GoogleApiAvailabilityLight zza = new GoogleApiAvailabilityLight();
@KeepForSdk
public GoogleApiAvailabilityLight() {
}
@NonNull
@ShowFirstParty
@KeepForSdk
public static GoogleApiAvailabilityLight getInstance() {
return zza;
}
@KeepForSdk
public void cancelAvailabilityErrorNotifications(@NonNull Context context) {
GooglePlayServicesUtilLight.cancelAvailabilityErrorNotifications(context);
}
@ShowFirstParty
@KeepForSdk
public int getApkVersion(@NonNull Context context) {
return GooglePlayServicesUtilLight.getApkVersion(context);
}
@ShowFirstParty
@KeepForSdk
public int getClientVersion(@NonNull Context context) {
return GooglePlayServicesUtilLight.getClientVersion(context);
}
@Deprecated
@Nullable
@ShowFirstParty
@KeepForSdk
public Intent getErrorResolutionIntent(int i) {
return getErrorResolutionIntent(null, i, null);
}
@Nullable
@KeepForSdk
public PendingIntent getErrorResolutionPendingIntent(@NonNull Context context, int i, int i2) {
return getErrorResolutionPendingIntent(context, i, i2, null);
}
@NonNull
@KeepForSdk
public String getErrorString(int i) {
return GooglePlayServicesUtilLight.getErrorString(i);
}
@HideFirstParty
@KeepForSdk
public int isGooglePlayServicesAvailable(@NonNull Context context) {
return isGooglePlayServicesAvailable(context, GOOGLE_PLAY_SERVICES_VERSION_CODE);
}
@ShowFirstParty
@KeepForSdk
public boolean isPlayServicesPossiblyUpdating(@NonNull Context context, int i) {
return GooglePlayServicesUtilLight.isPlayServicesPossiblyUpdating(context, i);
}
@ShowFirstParty
@KeepForSdk
public boolean isPlayStorePossiblyUpdating(@NonNull Context context, int i) {
return GooglePlayServicesUtilLight.isPlayStorePossiblyUpdating(context, i);
}
@KeepForSdk
public boolean isUninstalledAppPossiblyUpdating(@NonNull Context context, @NonNull String str) {
return GooglePlayServicesUtilLight.zza(context, str);
}
@KeepForSdk
public boolean isUserResolvableError(int i) {
return GooglePlayServicesUtilLight.isUserRecoverableError(i);
}
@KeepForSdk
public void verifyGooglePlayServicesIsAvailable(@NonNull Context context, int i) {
GooglePlayServicesUtilLight.ensurePlayServicesAvailable(context, i);
}
@Nullable
@ShowFirstParty
@KeepForSdk
public Intent getErrorResolutionIntent(@Nullable Context context, int i, @Nullable String str) {
if (i != 1 && i != 2) {
if (i != 3) {
return null;
}
Uri fromParts = Uri.fromParts("package", "com.google.android.gms", null);
Intent intent = new Intent("android.settings.APPLICATION_DETAILS_SETTINGS");
intent.setData(fromParts);
return intent;
}
if (context != null && DeviceProperties.isWearableWithoutPlayStore(context)) {
Intent intent2 = new Intent("com.google.android.clockwork.home.UPDATE_ANDROID_WEAR_ACTION");
intent2.setPackage("com.google.android.wearable.app");
return intent2;
}
StringBuilder sb = new StringBuilder("gcore_");
sb.append(GOOGLE_PLAY_SERVICES_VERSION_CODE);
sb.append("-");
if (!TextUtils.isEmpty(str)) {
sb.append(str);
}
sb.append("-");
if (context != null) {
sb.append(context.getPackageName());
}
sb.append("-");
if (context != null) {
try {
sb.append(Wrappers.packageManager(context).getPackageInfo(context.getPackageName(), 0).versionCode);
} catch (PackageManager.NameNotFoundException unused) {
}
}
String sb2 = sb.toString();
Intent intent3 = new Intent("android.intent.action.VIEW");
Uri.Builder appendQueryParameter = Uri.parse("market://details").buildUpon().appendQueryParameter("id", "com.google.android.gms");
if (!TextUtils.isEmpty(sb2)) {
appendQueryParameter.appendQueryParameter("pcampaignid", sb2);
}
intent3.setData(appendQueryParameter.build());
intent3.setPackage("com.android.vending");
intent3.addFlags(524288);
return intent3;
}
@Nullable
@ShowFirstParty
@KeepForSdk
public PendingIntent getErrorResolutionPendingIntent(@NonNull Context context, int i, int i2, @Nullable String str) {
Intent errorResolutionIntent = getErrorResolutionIntent(context, i, str);
if (errorResolutionIntent == null) {
return null;
}
return PendingIntent.getActivity(context, i2, errorResolutionIntent, 201326592);
}
@KeepForSdk
public int isGooglePlayServicesAvailable(@NonNull Context context, int i) {
int isGooglePlayServicesAvailable = GooglePlayServicesUtilLight.isGooglePlayServicesAvailable(context, i);
if (GooglePlayServicesUtilLight.isPlayServicesPossiblyUpdating(context, isGooglePlayServicesAvailable)) {
return 18;
}
return isGooglePlayServicesAvailable;
}
}