soul-browser/sources/java/com/google/android/gms/common/zzo.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

159 lines
6.7 KiB
Java
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.google.android.gms.common;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.RemoteException;
import android.os.StrictMode;
import android.util.Log;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import com.google.android.gms.common.internal.Preconditions;
import com.google.android.gms.common.util.AndroidUtilsLight;
import com.google.android.gms.common.util.Hex;
import com.google.android.gms.dynamic.ObjectWrapper;
import com.google.android.gms.dynamite.DynamiteModule;
import java.security.MessageDigest;
import java.util.concurrent.Callable;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public final class zzo {
@VisibleForTesting
static volatile com.google.android.gms.common.internal.zzad zzg;
public static final /* synthetic */ int zzh = 0;
@Nullable
private static Context zzj;
static final zzm zza = new zzd(zzj.zzf("0\u0082\u0005È0\u0082\u0003° \u0003\u0002\u0001\u0002\u0002\u0014\u007f¢fú§p\u0085xb±"));
static final zzm zzb = new zze(zzj.zzf("0\u0082\u0006\u00040\u0082\u0003ì \u0003\u0002\u0001\u0002\u0002\u0014QÕÛ\u0004÷XçB\u0086<"));
static final zzm zzc = new zzf(zzj.zzf("0\u0082\u0005È0\u0082\u0003° \u0003\u0002\u0001\u0002\u0002\u0014\u0010\u008ae\bsù/\u008eQí"));
static final zzm zzd = new zzg(zzj.zzf("0\u0082\u0006\u00040\u0082\u0003ì \u0003\u0002\u0001\u0002\u0002\u0014\u0003£²\u00ad×árÊkì"));
static final zzm zze = new zzh(zzj.zzf("0\u0082\u0004C0\u0082\u0003+ \u0003\u0002\u0001\u0002\u0002\t\u0000Âà\u0087FdJ0\u008d0"));
static final zzm zzf = new zzi(zzj.zzf("0\u0082\u0004¨0\u0082\u0003\u0090 \u0003\u0002\u0001\u0002\u0002\t\u0000Õ\u0085¸l}ÓNõ0"));
private static final Object zzi = new Object();
public static synchronized void zza(Context context) {
synchronized (zzo.class) {
if (zzj == null) {
if (context != null) {
zzj = context.getApplicationContext();
return;
}
return;
}
Log.w("GoogleCertificates", "GoogleCertificates has been initialized already");
}
}
@VisibleForTesting
public static void zzb() {
if (zzg != null) {
return;
}
Preconditions.checkNotNull(zzj);
synchronized (zzi) {
try {
if (zzg == null) {
zzg = com.google.android.gms.common.internal.zzac.zzb(DynamiteModule.c(zzj, DynamiteModule.e, "com.google.android.gms.googlecertificates").b("com.google.android.gms.common.GoogleCertificatesImpl"));
}
} catch (Throwable th) {
throw th;
}
}
}
public static zzy zzc(zzw zzwVar) {
zzy zzd2;
zzr zzh2;
PackageManager.NameNotFoundException nameNotFoundException;
StrictMode.ThreadPolicy allowThreadDiskReads = StrictMode.allowThreadDiskReads();
try {
Preconditions.checkNotNull(zzj);
try {
zzb();
Preconditions.checkNotNull(zzj);
zzp zzb2 = zzwVar.zzb(zzj);
try {
if (zzwVar.zza()) {
zzh2 = zzg.zzf(zzb2);
} else {
zzh2 = zzg.zzh(zzb2);
}
if (zzh2.zza()) {
zzd2 = zzy.zzf(zzh2.zze(), zzh2.zzc());
} else {
String zzb3 = zzh2.zzb();
if (zzh2.zzd() == 4) {
nameNotFoundException = new PackageManager.NameNotFoundException();
} else {
nameNotFoundException = null;
}
if (zzb3 == null) {
zzb3 = "error checking package certificate";
}
zzd2 = zzy.zzg(zzh2.zze(), zzh2.zzd(), zzb3, nameNotFoundException);
}
} catch (RemoteException e) {
Log.e("GoogleCertificates", "Failed to get Google certificates from remote", e);
zzd2 = zzy.zzd("module call", e);
}
} catch (DynamiteModule.LoadingException e2) {
Log.e("GoogleCertificates", "Failed to get Google certificates from remote", e2);
zzd2 = zzy.zzd("module init: ".concat(String.valueOf(e2.getMessage())), e2);
}
StrictMode.setThreadPolicy(allowThreadDiskReads);
return zzd2;
} catch (Throwable th) {
StrictMode.setThreadPolicy(allowThreadDiskReads);
throw th;
}
}
@Deprecated
public static zzy zzd(String str, zzj zzjVar, boolean z, boolean z2) {
StrictMode.ThreadPolicy allowThreadDiskReads = StrictMode.allowThreadDiskReads();
try {
return zzf(str, zzjVar, z, z2);
} finally {
StrictMode.setThreadPolicy(allowThreadDiskReads);
}
}
public static /* synthetic */ String zze(boolean z, String str, zzj zzjVar) {
String str2;
if (!z && zzf(str, zzjVar, true, false).zza) {
str2 = "debug cert rejected";
} else {
str2 = "not allowed";
}
MessageDigest zza2 = AndroidUtilsLight.zza("SHA-256");
Preconditions.checkNotNull(zza2);
return str2 + ": pkg=" + str + ", sha256=" + Hex.bytesToStringLowercase(zza2.digest(zzjVar.zzc())) + ", atk=" + z + ", ver=12451000.false";
}
@Deprecated
private static zzy zzf(final String str, final zzj zzjVar, final boolean z, boolean z2) {
try {
zzb();
Preconditions.checkNotNull(zzj);
try {
if (zzg.zze(new zzt(str, zzjVar, z, z2), new ObjectWrapper(zzj.getPackageManager()))) {
return zzy.zzb();
}
return new zzx(new Callable() { // from class: com.google.android.gms.common.zzl
@Override // java.util.concurrent.Callable
public final /* synthetic */ Object call() {
return zzo.zze(z, str, zzjVar);
}
}, null);
} catch (RemoteException e) {
Log.e("GoogleCertificates", "Failed to get Google certificates from remote", e);
return zzy.zzd("module call", e);
}
} catch (DynamiteModule.LoadingException e2) {
Log.e("GoogleCertificates", "Failed to get Google certificates from remote", e2);
return zzy.zzd("module init: ".concat(String.valueOf(e2.getMessage())), e2);
}
}
}