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

146 lines
6.4 KiB
Java

package com.google.android.gms.internal.ads;
import android.text.TextUtils;
import com.google.android.gms.ads.RequestConfiguration;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.GZIPOutputStream;
import org.json.JSONObject;
import org.jsoup.helper.HttpConnection;
/* loaded from: classes.dex */
public final class zzegd implements zzflu {
public static final Pattern d = Pattern.compile("([^;]+=[^;]+)(;\\s|$)", 2);
/* renamed from: a, reason: collision with root package name */
public final String f6472a;
public final zzfne b;
/* renamed from: c, reason: collision with root package name */
public final zzfno f6473c;
public zzegd(String str, zzfno zzfnoVar, zzfne zzfneVar) {
this.f6472a = str;
this.f6473c = zzfnoVar;
this.b = zzfneVar;
}
@Override // com.google.android.gms.internal.ads.zzflu
public final Object zza(Object obj) {
zzebr zzebrVar;
String str;
JSONObject jSONObject;
String str2;
zzegc zzegcVar = (zzegc) obj;
int optInt = zzegcVar.f6471a.optInt("http_timeout_millis", 60000);
zzbzc zzbzcVar = zzegcVar.b;
int i = zzbzcVar.g;
String str3 = zzbzcVar.m;
String str4 = zzbzcVar.f4981c;
zzfne zzfneVar = this.b;
zzfno zzfnoVar = this.f6473c;
int i2 = 1;
String str5 = RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED;
if (i == -2) {
HashMap hashMap = new HashMap();
if (zzbzcVar.e) {
String str6 = this.f6472a;
if (!TextUtils.isEmpty(str6)) {
if (((Boolean) com.google.android.gms.ads.internal.client.zzbd.zzc().a(zzbgk.t1)).booleanValue()) {
if (TextUtils.isEmpty(str6)) {
str2 = RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED;
} else {
Matcher matcher = d.matcher(str6);
str2 = RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED;
while (matcher.find()) {
String group = matcher.group(i2);
if (group != null) {
Locale locale = Locale.ROOT;
if (group.toLowerCase(locale).startsWith("id=") || group.toLowerCase(locale).startsWith("ide=")) {
if (!TextUtils.isEmpty(str2)) {
str2 = str2.concat("; ");
}
str2 = str2.concat(group);
}
}
i2 = 1;
}
}
if (!TextUtils.isEmpty(str2)) {
hashMap.put("Cookie", str2);
}
} else {
hashMap.put("Cookie", str6);
}
}
}
if (zzbzcVar.d && (jSONObject = zzegcVar.f6471a) != null) {
JSONObject optJSONObject = jSONObject.optJSONObject("pii");
if (optJSONObject != null) {
if (!TextUtils.isEmpty(optJSONObject.optString("doritos", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED))) {
hashMap.put("x-afma-drt-cookie", optJSONObject.optString("doritos", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED));
}
if (!TextUtils.isEmpty(optJSONObject.optString("doritos_v2", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED))) {
hashMap.put("x-afma-drt-v2-cookie", optJSONObject.optString("doritos_v2", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED));
}
} else {
com.google.android.gms.ads.internal.util.zze.zza("DSID signal does not exist.");
}
}
byte[] bArr = new byte[0];
if (!TextUtils.isEmpty(str4)) {
byte[] bytes = str4.getBytes(StandardCharsets.UTF_8);
if (zzbzcVar.l) {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
try {
GZIPOutputStream gZIPOutputStream = new GZIPOutputStream(byteArrayOutputStream);
try {
gZIPOutputStream.write(bytes);
gZIPOutputStream.finish();
bArr = byteArrayOutputStream.toByteArray();
gZIPOutputStream.close();
} finally {
}
} catch (IOException e) {
com.google.android.gms.ads.internal.util.zze.zzb("gzip compression failed, sending uncompressed.", e);
com.google.android.gms.ads.internal.zzt.zzh().f("PrepareRequestFunction.apply", e);
bArr = null;
}
if (bArr != null) {
hashMap.put(HttpConnection.CONTENT_ENCODING, "gzip");
}
}
bArr = bytes;
}
if (!TextUtils.isEmpty(str3)) {
str = str3;
} else {
str = RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED;
}
zzfneVar.zzd(true);
zzfnoVar.a(zzfneVar);
return new zzefy(zzbzcVar.f, optInt, hashMap, bArr, str);
}
if (i == 1) {
List list = zzbzcVar.f4980a;
if (list != null) {
str5 = TextUtils.join(", ", list);
int i3 = com.google.android.gms.ads.internal.util.zze.zza;
com.google.android.gms.ads.internal.util.client.zzo.zzf(str5);
}
zzebrVar = new zzebr(2, "Error building request URL: ".concat(String.valueOf(str5)));
} else {
zzebrVar = new zzebr(1);
}
zzfneVar.a(zzebrVar);
zzfneVar.zzd(false);
zzfnoVar.a(zzfneVar);
throw zzebrVar;
}
}