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

package com.google.android.gms.internal.ads;
import android.content.Context;
import android.content.SharedPreferences;
import android.text.TextUtils;
import com.google.android.gms.ads.RequestConfiguration;
import com.google.android.gms.ads.internal.util.client.VersionInfoParcel;
import com.google.android.gms.common.GooglePlayServicesUtilLight;
import com.google.android.gms.common.util.ClientLibraryUtils;
import com.google.android.gms.dynamite.DynamiteModule;
import com.google.android.gms.dynamite.descriptors.com.google.android.gms.ads.dynamite.ModuleDescriptor;
import com.google.api.client.http.HttpMethods;
import com.google.common.util.concurrent.ListenableFuture;
import j$.util.Objects;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicBoolean;
import org.json.JSONException;
import org.json.JSONObject;
/* loaded from: classes.dex */
public final class zzbyw extends zzbyt {
public final Context b;
/* renamed from: c, reason: collision with root package name */
public SharedPreferences f4976c;
public final zzbsj d;
public final VersionInfoParcel e;
public final Executor g;
/* renamed from: a, reason: collision with root package name */
public final Object f4975a = new Object();
public final AtomicBoolean f = new AtomicBoolean(false);
public zzbyw(Context context, zzbsj zzbsjVar, VersionInfoParcel versionInfoParcel, Executor executor) {
this.b = context.getApplicationContext();
this.e = versionInfoParcel;
this.d = zzbsjVar;
this.g = executor;
}
public static JSONObject b(Context context, VersionInfoParcel versionInfoParcel) {
JSONObject jSONObject = new JSONObject();
try {
if (((Boolean) zzbik.f.c()).booleanValue()) {
jSONObject.put("package_name", context.getPackageName());
}
jSONObject.put("js", versionInfoParcel.afmaVersion);
jSONObject.put("mf", zzbik.g.c());
jSONObject.put("cl", "829525209");
jSONObject.put("rapid_rc", "dev");
jSONObject.put("rapid_rollup", HttpMethods.HEAD);
jSONObject.put("admob_module_version", GooglePlayServicesUtilLight.GOOGLE_PLAY_SERVICES_VERSION_CODE);
jSONObject.put("dynamite_local_version", ModuleDescriptor.MODULE_VERSION);
jSONObject.put("dynamite_version", DynamiteModule.d(context, ModuleDescriptor.MODULE_ID, false));
jSONObject.put("container_version", GooglePlayServicesUtilLight.GOOGLE_PLAY_SERVICES_VERSION_CODE);
} catch (JSONException unused) {
}
return jSONObject;
}
public final ListenableFuture a() {
Executor executor;
synchronized (this.f4975a) {
try {
if (this.f4976c == null) {
this.f4976c = this.b.getSharedPreferences("google_ads_flags_meta", 0);
}
} finally {
}
}
SharedPreferences sharedPreferences = this.f4976c;
long j = 0;
if (sharedPreferences != null) {
j = sharedPreferences.getLong("js_last_update", 0L);
}
if (com.google.android.gms.ads.internal.zzt.zzk().currentTimeMillis() - j < ((Long) zzbik.h.c()).longValue()) {
return zzgyq.f;
}
ListenableFuture a2 = this.d.a(b(this.b, this.e));
zzgpr zzgprVar = new zzgpr() { // from class: com.google.android.gms.internal.ads.zzbyu
@Override // com.google.android.gms.internal.ads.zzgpr
public final Object apply(Object obj) {
SharedPreferences sharedPreferences2;
JSONObject jSONObject = (JSONObject) obj;
zzbgb zzbgbVar = zzbgk.f4658a;
com.google.android.gms.ads.internal.client.zzbd.zza();
zzbyw zzbywVar = zzbyw.this;
Context context = zzbywVar.b;
SharedPreferences a3 = zzbgd.a(context);
if (a3 != null) {
SharedPreferences.Editor edit = a3.edit();
Objects.requireNonNull(com.google.android.gms.ads.internal.client.zzbd.zzb());
ArrayList arrayList = com.google.android.gms.ads.internal.client.zzbd.zzb().f4649a;
int size = arrayList.size();
int i = 0;
while (i < size) {
Object obj2 = arrayList.get(i);
i++;
zzbgb zzbgbVar2 = (zzbgb) obj2;
if (zzbgbVar2.f4647a == 1) {
zzbgbVar2.b(edit, zzbgbVar2.c(jSONObject));
}
}
if (jSONObject != null) {
edit.putString("flag_configuration", jSONObject.toString());
} else {
com.google.android.gms.ads.internal.util.client.zzo.zzf("Flag Json is null.");
}
if ((((Boolean) zzbik.o.c()).booleanValue() || ((Boolean) zzbik.p.c()).booleanValue()) && !ClientLibraryUtils.isPackageSide()) {
com.google.android.gms.ads.internal.client.zzbd.zza();
edit.apply();
} else {
com.google.android.gms.ads.internal.client.zzbd.zza();
edit.commit();
}
if (((Boolean) zzbik.e.c()).booleanValue() && !TextUtils.equals(context.getPackageName(), "com.google.android.gms")) {
com.google.android.gms.ads.internal.client.zzbd.zza();
try {
sharedPreferences2 = context.getSharedPreferences("google_adapter_flags", 0);
} catch (IllegalStateException e) {
com.google.android.gms.ads.internal.util.client.zzo.zzj(RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED, e);
sharedPreferences2 = null;
}
if (sharedPreferences2 != null) {
SharedPreferences.Editor edit2 = sharedPreferences2.edit();
com.google.android.gms.ads.internal.client.zzbd.zzb();
JSONObject jSONObject2 = new JSONObject();
Iterator<String> keys = jSONObject.keys();
while (keys.hasNext()) {
String next = keys.next();
if (next.startsWith("adapter:")) {
try {
jSONObject2.put(next, jSONObject.get(next));
} catch (JSONException unused) {
}
}
}
edit2.putString("flag_configuration", jSONObject2.toString());
edit2.apply();
}
}
SharedPreferences sharedPreferences3 = zzbywVar.f4976c;
if (sharedPreferences3 != null) {
sharedPreferences3.edit().putLong("js_last_update", com.google.android.gms.ads.internal.zzt.zzk().currentTimeMillis()).apply();
}
}
return null;
}
};
if (((Boolean) zzbik.m.c()).booleanValue()) {
executor = this.g;
} else {
executor = zzcdo.g;
}
return zzgym.i(a2, zzgprVar, executor);
}
}