soul-browser/sources/java/com/google/android/gms/internal/auth/zzcg.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

157 lines
6.3 KiB
Java

package com.google.android.gms.internal.auth;
import android.content.ContentResolver;
import android.database.ContentObserver;
import android.database.Cursor;
import android.database.sqlite.SQLiteException;
import android.net.Uri;
import android.os.Binder;
import android.os.StrictMode;
import android.util.Log;
import androidx.collection.ArrayMap;
import androidx.collection.SimpleArrayMap;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
/* loaded from: classes.dex */
public final class zzcg implements zzcl {
public static final ArrayMap g = new SimpleArrayMap(0);
public static final String[] h = {"key", "value"};
/* renamed from: a, reason: collision with root package name */
public final ContentResolver f9507a;
public final Uri b;
/* renamed from: c, reason: collision with root package name */
public final ContentObserver f9508c;
public final Object d;
public volatile Map e;
public final ArrayList f;
public zzcg(ContentResolver contentResolver, Uri uri) {
zzcf zzcfVar = new zzcf(this);
this.f9508c = zzcfVar;
this.d = new Object();
this.f = new ArrayList();
contentResolver.getClass();
uri.getClass();
this.f9507a = contentResolver;
this.b = uri;
contentResolver.registerContentObserver(uri, false, zzcfVar);
}
public static zzcg b(ContentResolver contentResolver, Uri uri) {
zzcg zzcgVar;
synchronized (zzcg.class) {
ArrayMap arrayMap = g;
zzcgVar = (zzcg) arrayMap.get(uri);
if (zzcgVar == null) {
try {
zzcg zzcgVar2 = new zzcg(contentResolver, uri);
try {
arrayMap.put(uri, zzcgVar2);
} catch (SecurityException unused) {
}
zzcgVar = zzcgVar2;
} catch (SecurityException unused2) {
}
}
}
return zzcgVar;
}
public static synchronized void c() {
synchronized (zzcg.class) {
try {
for (zzcg zzcgVar : g.values()) {
zzcgVar.f9507a.unregisterContentObserver(zzcgVar.f9508c);
}
g.clear();
} catch (Throwable th) {
throw th;
}
}
}
/* JADX WARN: Type inference failed for: r0v4, types: [android.os.StrictMode$ThreadPolicy, java.util.Map] */
/* JADX WARN: Type inference failed for: r2v3, types: [com.google.android.gms.internal.auth.zzce] */
@Override // com.google.android.gms.internal.auth.zzcl
public final Object a(String str) {
Map map;
Map map2;
Object a2;
Map map3 = this.e;
Map map4 = map3;
if (map3 == null) {
synchronized (this.d) {
?? r0 = this.e;
if (r0 != 0) {
map2 = r0;
} else {
try {
StrictMode.ThreadPolicy allowThreadDiskReads = StrictMode.allowThreadDiskReads();
try {
?? r2 = new zzck() { // from class: com.google.android.gms.internal.auth.zzce
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r2v4, types: [androidx.collection.SimpleArrayMap] */
public final Object a() {
HashMap hashMap;
zzcg zzcgVar = zzcg.this;
Cursor query = zzcgVar.f9507a.query(zzcgVar.b, zzcg.h, null, null, null);
if (query == null) {
return Collections.EMPTY_MAP;
}
try {
int count = query.getCount();
if (count == 0) {
return Collections.EMPTY_MAP;
}
if (count <= 256) {
hashMap = new SimpleArrayMap(count);
} else {
hashMap = new HashMap(count, 1.0f);
}
while (query.moveToNext()) {
hashMap.put(query.getString(0), query.getString(1));
}
return hashMap;
} finally {
query.close();
}
}
};
try {
a2 = r2.a();
} catch (SecurityException unused) {
long clearCallingIdentity = Binder.clearCallingIdentity();
try {
a2 = r2.a();
} finally {
Binder.restoreCallingIdentity(clearCallingIdentity);
}
}
map = (Map) a2;
StrictMode.setThreadPolicy(allowThreadDiskReads);
} catch (SQLiteException | IllegalStateException | SecurityException unused2) {
Log.e("ConfigurationContentLdr", "PhenotypeFlag unable to load ContentProvider, using default values");
StrictMode.setThreadPolicy(allowThreadDiskReads);
map = null;
}
this.e = map;
map2 = map;
} catch (Throwable th) {
StrictMode.setThreadPolicy(r0);
throw th;
}
}
}
map4 = map2;
}
if (map4 == null) {
map4 = Collections.EMPTY_MAP;
}
return (String) map4.get(str);
}
}