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

160 lines
5.1 KiB
Java

package com.google.android.gms.internal.ads;
import com.google.api.client.http.HttpStatusCodes;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Arrays;
import kotlin.KotlinVersion;
/* loaded from: classes.dex */
public final class zzgec {
/* renamed from: a, reason: collision with root package name */
public MessageDigest f7867a;
public final zzgnc b;
/* renamed from: c, reason: collision with root package name */
public final Object f7868c = new Object();
public boolean d = false;
public SecureRandom e;
public zzgec(zzgnc zzgncVar) {
this.b = zzgncVar;
}
/* JADX WARN: Not initialized variable reg: 1, insn: 0x0039: INVOKE (r1 I:com.google.android.gms.internal.ads.zzgna) VIRTUAL call: com.google.android.gms.internal.ads.zzgna.c():void A[Catch: all -> 0x0037, MD:():void (m), TRY_ENTER] (LINE:58), block:B:24:0x0039 */
public final void a() {
zzgna c2;
if (!b()) {
SecureRandom secureRandom = new SecureRandom();
synchronized (this) {
try {
zzgna a2 = this.b.a(HttpStatusCodes.STATUS_CODE_ACCEPTED);
try {
a2.a();
this.e = secureRandom;
this.f7867a = MessageDigest.getInstance("MD5");
this.d = true;
} catch (NoSuchAlgorithmException e) {
a2.b(e);
} catch (Throwable th) {
a2.b(th);
throw th;
}
a2.c();
} catch (Throwable th2) {
c2.c();
throw th2;
}
}
}
}
public final synchronized boolean b() {
return this.d;
}
public final byte[] c(String str, boolean z, byte[] bArr) {
int i;
boolean z2;
byte[] bytes;
int length = bArr.length;
if (true != z) {
i = 255;
} else {
i = 239;
}
if (length <= i) {
z2 = true;
} else {
z2 = false;
}
zzgqa.a(z2);
ByteBuffer put = ByteBuffer.allocate(i + 1).put((byte) length);
if (length < i) {
int i2 = i - length;
byte[] bArr2 = new byte[i2];
this.e.nextBytes(bArr2);
bArr = Arrays.copyOf(bArr, length + i2);
System.arraycopy(bArr2, 0, bArr, length, i2);
}
byte[] array = put.put(bArr).array();
if (z) {
array = ByteBuffer.allocate(256).put(d(array)).put(array).array();
}
byte[] bArr3 = new byte[256];
zzgef[] zzgefVarArr = new zzges().G2;
int length2 = zzgefVarArr.length;
for (int i3 = 0; i3 < 12; i3++) {
zzgefVarArr[i3].a(array, bArr3);
}
if (!zzgpz.a(str)) {
if (str.length() > 32) {
bytes = str.substring(0, 32).getBytes(StandardCharsets.UTF_8);
} else {
bytes = str.getBytes(StandardCharsets.UTF_8);
}
zzgee zzgeeVar = new zzgee(bytes);
int i4 = 0;
int i5 = 0;
for (int i6 = 0; i6 < 256; i6++) {
i4 = (i4 + 1) & KotlinVersion.MAX_COMPONENT_VALUE;
byte[] bArr4 = zzgeeVar.f7870a;
byte b = bArr4[i4];
i5 = (i5 + b) & KotlinVersion.MAX_COMPONENT_VALUE;
bArr4[i4] = bArr4[i5];
bArr4[i5] = b;
bArr3[i6] = (byte) (bArr4[(bArr4[i4] + b) & KotlinVersion.MAX_COMPONENT_VALUE] ^ bArr3[i6]);
}
}
return bArr3;
}
public final byte[] d(byte[] bArr) {
byte[] digest;
synchronized (this.f7868c) {
this.f7867a.reset();
this.f7867a.update(bArr);
digest = this.f7867a.digest();
}
return digest;
}
public final zzaxf e(String str, byte[] bArr) {
zzaxf D = zzaxg.D();
byte[] d = d(bArr);
zzhzl zzhzlVar = zzhzl.f;
zzhzl B = zzhzl.B(d, 0, d.length);
D.k();
((zzaxg) D.f).F(B);
ArrayList arrayList = new ArrayList();
int i = 0;
while (true) {
int length = bArr.length;
if (i >= ((length - 1) / KotlinVersion.MAX_COMPONENT_VALUE) + 1) {
break;
}
int i2 = i * KotlinVersion.MAX_COMPONENT_VALUE;
int i3 = i2 + KotlinVersion.MAX_COMPONENT_VALUE;
if (length > i3) {
length = i3;
}
arrayList.add(Arrays.copyOfRange(bArr, i2, length));
i++;
}
int size = arrayList.size();
int i4 = 0;
while (i4 < size) {
Object obj = arrayList.get(i4);
i4++;
zzhzl B2 = zzhzl.B(c(str, false, (byte[]) obj), 0, 256);
D.k();
((zzaxg) D.f).E(B2);
}
return D;
}
}