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

183 lines
6.6 KiB
Java

package com.google.android.gms.internal.ads;
import android.content.Context;
import android.net.Uri;
import com.google.android.gms.ads.RequestConfiguration;
import com.google.android.gms.common.util.IOUtils;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collections;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicLong;
/* loaded from: classes.dex */
public final class zzcge implements zzhb {
/* renamed from: a, reason: collision with root package name */
public final Context f5125a;
public final zzhm b;
/* renamed from: c, reason: collision with root package name */
public final String f5126c;
public final int d;
public final boolean e;
public InputStream f;
public boolean g;
public Uri h;
public volatile zzbev i;
public boolean j = false;
public boolean k = false;
public zzhf l;
public zzcge(Context context, zzhm zzhmVar, String str, int i) {
this.f5125a = context;
this.b = zzhmVar;
this.f5126c = str;
this.d = i;
new AtomicLong(-1L);
this.e = ((Boolean) com.google.android.gms.ads.internal.client.zzbd.zzc().a(zzbgk.u2)).booleanValue();
}
@Override // com.google.android.gms.internal.ads.zzhb
public final long a(zzhf zzhfVar) {
Long l;
if (!this.g) {
this.g = true;
Uri uri = zzhfVar.f8483a;
this.h = uri;
this.l = zzhfVar;
this.i = zzbev.F(uri);
boolean booleanValue = ((Boolean) com.google.android.gms.ads.internal.client.zzbd.zzc().a(zzbgk.h5)).booleanValue();
zzbes zzbesVar = null;
String str = RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED;
if (booleanValue) {
if (this.i != null) {
this.i.l = zzhfVar.f8484c;
zzbev zzbevVar = this.i;
String str2 = this.f5126c;
if (str2 != null) {
str = str2;
}
zzbevVar.m = str;
this.i.n = this.d;
if (this.i.k) {
l = (Long) com.google.android.gms.ads.internal.client.zzbd.zzc().a(zzbgk.j5);
} else {
l = (Long) com.google.android.gms.ads.internal.client.zzbd.zzc().a(zzbgk.i5);
}
long longValue = l.longValue();
com.google.android.gms.ads.internal.zzt.zzk().elapsedRealtime();
com.google.android.gms.ads.internal.zzt.zzz();
Future a2 = zzbfg.a(this.f5125a, this.i);
try {
try {
zzbfh zzbfhVar = (zzbfh) ((zzcdt) a2).f5072c.get(longValue, TimeUnit.MILLISECONDS);
zzbfhVar.getClass();
this.j = zzbfhVar.f4611c;
this.k = zzbfhVar.e;
if (!d()) {
this.f = zzbfhVar.f4610a;
}
} catch (InterruptedException unused) {
((zzbez) a2).cancel(false);
Thread.currentThread().interrupt();
} catch (ExecutionException | TimeoutException unused2) {
((zzbez) a2).cancel(false);
}
} catch (Throwable unused3) {
}
com.google.android.gms.ads.internal.zzt.zzk().elapsedRealtime();
throw null;
}
} else {
if (this.i != null) {
this.i.l = zzhfVar.f8484c;
zzbev zzbevVar2 = this.i;
String str3 = this.f5126c;
if (str3 != null) {
str = str3;
}
zzbevVar2.m = str;
this.i.n = this.d;
zzbesVar = com.google.android.gms.ads.internal.zzt.zzj().b(this.i);
}
if (zzbesVar != null && zzbesVar.zza()) {
this.j = zzbesVar.k0();
this.k = zzbesVar.G();
if (!d()) {
this.f = zzbesVar.F();
return -1L;
}
}
}
if (this.i != null) {
zzhe zzheVar = new zzhe(zzhfVar);
zzheVar.f8449a = Uri.parse(this.i.f4600c);
this.l = zzheVar.a();
}
return this.b.a(this.l);
}
throw new IOException("Attempt to open an already open CacheDataSource.");
}
@Override // com.google.android.gms.internal.ads.zzj
public final int b(byte[] bArr, int i, int i2) {
if (this.g) {
InputStream inputStream = this.f;
if (inputStream != null) {
return inputStream.read(bArr, i, i2);
}
return this.b.b(bArr, i, i2);
}
throw new IOException("Attempt to read closed CacheDataSource.");
}
@Override // com.google.android.gms.internal.ads.zzhb
public final void c(zzhz zzhzVar) {
}
public final boolean d() {
if (!this.e) {
return false;
}
if (((Boolean) com.google.android.gms.ads.internal.client.zzbd.zzc().a(zzbgk.k5)).booleanValue() && !this.j) {
return true;
}
if (!((Boolean) com.google.android.gms.ads.internal.client.zzbd.zzc().a(zzbgk.l5)).booleanValue() || this.k) {
return false;
}
return true;
}
@Override // com.google.android.gms.internal.ads.zzhb
public final Uri zzc() {
return this.h;
}
@Override // com.google.android.gms.internal.ads.zzhb
public final void zzd() {
if (this.g) {
this.g = false;
this.h = null;
InputStream inputStream = this.f;
if (inputStream != null) {
IOUtils.closeQuietly(inputStream);
this.f = null;
return;
} else {
this.b.zzd();
return;
}
}
throw new IOException("Attempt to close an already closed CacheDataSource.");
}
@Override // com.google.android.gms.internal.ads.zzhb
public final Map zzj() {
return Collections.EMPTY_MAP;
}
}