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

299 lines
13 KiB
Java

package com.google.android.gms.internal.ads;
import android.content.Context;
import android.os.Bundle;
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 j$.util.Objects;
import j$.util.concurrent.ConcurrentHashMap;
import java.lang.reflect.Method;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import javax.annotation.ParametersAreNonnullByDefault;
@ParametersAreNonnullByDefault
/* loaded from: classes.dex */
public final class zzcbw {
/* renamed from: a, reason: collision with root package name */
public final AtomicReference f5030a = new AtomicReference(null);
public final Object b = new Object();
/* renamed from: c, reason: collision with root package name */
public String f5031c = null;
public final AtomicBoolean d = new AtomicBoolean(false);
public final AtomicInteger e = new AtomicInteger(-1);
public final AtomicReference f = new AtomicReference(null);
public final AtomicReference g = new AtomicReference(null);
public final ConcurrentHashMap h = new ConcurrentHashMap(9);
public final Object i = new Object();
public static final Bundle f(Map map) {
Bundle bundle = new Bundle();
if (map != null) {
for (String str : map.keySet()) {
try {
if (Objects.equals(str, "value")) {
bundle.putDouble(str, Double.parseDouble((String) map.get(str)));
} else {
bundle.putString(str, (String) map.get(str));
}
} catch (NullPointerException | NumberFormatException unused) {
}
}
}
return bundle;
}
public static final boolean g(Context context) {
if (!((Boolean) com.google.android.gms.ads.internal.client.zzbd.zzc().a(zzbgk.R0)).booleanValue()) {
return false;
}
if (DynamiteModule.a(context, ModuleDescriptor.MODULE_ID) < ((Integer) com.google.android.gms.ads.internal.client.zzbd.zzc().a(zzbgk.S0)).intValue()) {
return false;
}
if (((Boolean) com.google.android.gms.ads.internal.client.zzbd.zzc().a(zzbgk.T0)).booleanValue()) {
try {
context.getClassLoader().loadClass("com.google.firebase.analytics.FirebaseAnalytics");
return false;
} catch (ClassNotFoundException unused) {
}
}
return true;
}
public final boolean a(Context context) {
if (((Boolean) com.google.android.gms.ads.internal.client.zzbd.zzc().a(zzbgk.J0)).booleanValue() && !this.d.get()) {
if (!((Boolean) com.google.android.gms.ads.internal.client.zzbd.zzc().a(zzbgk.U0)).booleanValue()) {
AtomicInteger atomicInteger = this.e;
if (atomicInteger.get() == -1) {
com.google.android.gms.ads.internal.client.zzbb.zza();
if (!com.google.android.gms.ads.internal.util.client.zzf.zzx(context, GooglePlayServicesUtilLight.GOOGLE_PLAY_SERVICES_VERSION_CODE)) {
com.google.android.gms.ads.internal.client.zzbb.zza();
if (com.google.android.gms.ads.internal.util.client.zzf.zzy(context)) {
int i = com.google.android.gms.ads.internal.util.zze.zza;
com.google.android.gms.ads.internal.util.client.zzo.zzi("Google Play Service is out of date, the Google Mobile Ads SDK will not integrate with Firebase. Admob/Firebase integration requires updated Google Play Service.");
atomicInteger.set(0);
}
}
atomicInteger.set(1);
}
if (atomicInteger.get() == 1) {
}
}
return true;
}
return false;
}
public final String b(Context context) {
if (!a(context)) {
return null;
}
synchronized (this.b) {
try {
String str = this.f5031c;
if (str != null) {
return str;
}
String str2 = (String) k(context, "getGmpAppId");
this.f5031c = str2;
return str2;
} catch (Throwable th) {
throw th;
}
}
}
public final String c(final Context context) {
ExecutorService threadPoolExecutor;
if (a(context)) {
long longValue = ((Long) com.google.android.gms.ads.internal.client.zzbd.zzc().a(zzbgk.P0)).longValue();
if (longValue < 0) {
return (String) k(context, "getAppInstanceId");
}
AtomicReference atomicReference = this.f5030a;
if (atomicReference.get() == null) {
if (ClientLibraryUtils.isPackageSide()) {
zzfxi zzfxiVar = zzfxk.b;
zzfxj zzfxjVar = (zzfxj) zzfxiVar;
threadPoolExecutor = zzfxjVar.a(((Integer) com.google.android.gms.ads.internal.client.zzbd.zzc().a(zzbgk.Q0)).intValue(), new zzcbu(this));
} else {
zzbgb zzbgbVar = zzbgk.Q0;
threadPoolExecutor = new ThreadPoolExecutor(((Integer) com.google.android.gms.ads.internal.client.zzbd.zzc().a(zzbgbVar)).intValue(), ((Integer) com.google.android.gms.ads.internal.client.zzbd.zzc().a(zzbgbVar)).intValue(), 1L, TimeUnit.MINUTES, new LinkedBlockingQueue(), new zzcbu(this));
}
while (!atomicReference.compareAndSet(null, threadPoolExecutor) && atomicReference.get() == null) {
}
}
try {
return (String) ((ExecutorService) atomicReference.get()).submit(new Callable() { // from class: com.google.android.gms.internal.ads.zzcbv
@Override // java.util.concurrent.Callable
public final /* synthetic */ Object call() {
return (String) this.k(context, "getAppInstanceId");
}
}).get(longValue, TimeUnit.MILLISECONDS);
} catch (TimeoutException unused) {
return "TIME_OUT";
} catch (Exception unused2) {
}
}
return null;
}
public final String d(Context context) {
Object k;
if (a(context) && (k = k(context, "generateEventId")) != null) {
return k.toString();
}
return null;
}
public final void e(int i, Context context, String str, String str2, String str3) {
if (!a(context)) {
return;
}
Bundle bundle = new Bundle();
bundle.putString("_ai", str2);
bundle.putString("reward_type", str3);
bundle.putInt("reward_value", i);
h(context, "_ar", str, bundle);
StringBuilder sb = new StringBuilder(String.valueOf(str3).length() + 64 + String.valueOf(i).length());
sb.append("Log a Firebase reward video event, reward type: ");
sb.append(str3);
sb.append(", reward value: ");
sb.append(i);
com.google.android.gms.ads.internal.util.zze.zza(sb.toString());
}
public final void h(Context context, String str, String str2, Bundle bundle) {
if (a(context)) {
Bundle bundle2 = new Bundle();
try {
bundle2.putLong("_aeid", Long.parseLong(str2));
} catch (NullPointerException | NumberFormatException e) {
String valueOf = String.valueOf(str2);
int i = com.google.android.gms.ads.internal.util.zze.zza;
com.google.android.gms.ads.internal.util.client.zzo.zzg("Invalid event ID: ".concat(valueOf), e);
}
if ("_ac".equals(str)) {
bundle2.putInt("_r", 1);
}
if (bundle != null) {
bundle2.putAll(bundle);
}
AtomicReference atomicReference = this.f;
if (m(context, "com.google.android.gms.measurement.AppMeasurement", atomicReference, true)) {
ConcurrentHashMap concurrentHashMap = this.h;
Method method = (Method) concurrentHashMap.get("logEventInternal");
if (method == null) {
try {
method = context.getClassLoader().loadClass("com.google.android.gms.measurement.AppMeasurement").getDeclaredMethod("logEventInternal", String.class, String.class, Bundle.class);
concurrentHashMap.put("logEventInternal", method);
} catch (Exception unused) {
l("logEventInternal", true);
method = null;
}
}
try {
method.invoke(atomicReference.get(), "am", str, bundle2);
} catch (Exception unused2) {
l("logEventInternal", true);
}
}
}
}
public final Method i(Context context, String str) {
ConcurrentHashMap concurrentHashMap = this.h;
Method method = (Method) concurrentHashMap.get(str);
if (method != null) {
return method;
}
try {
Method declaredMethod = context.getClassLoader().loadClass("com.google.android.gms.measurement.AppMeasurement").getDeclaredMethod(str, null);
concurrentHashMap.put(str, declaredMethod);
return declaredMethod;
} catch (Exception unused) {
l(str, false);
return null;
}
}
public final void j(Context context, String str, String str2) {
AtomicReference atomicReference = this.f;
if (m(context, "com.google.android.gms.measurement.AppMeasurement", atomicReference, true)) {
ConcurrentHashMap concurrentHashMap = this.h;
Method method = (Method) concurrentHashMap.get(str2);
if (method == null) {
try {
method = context.getClassLoader().loadClass("com.google.android.gms.measurement.AppMeasurement").getDeclaredMethod(str2, String.class);
concurrentHashMap.put(str2, method);
} catch (Exception unused) {
l(str2, false);
method = null;
}
}
try {
method.invoke(atomicReference.get(), str);
StringBuilder sb = new StringBuilder(str2.length() + 37 + String.valueOf(str).length());
sb.append("Invoke Firebase method ");
sb.append(str2);
sb.append(", Ad Unit Id: ");
sb.append(str);
com.google.android.gms.ads.internal.util.zze.zza(sb.toString());
} catch (Exception unused2) {
l(str2, false);
}
}
}
public final Object k(Context context, String str) {
AtomicReference atomicReference = this.f;
if (!m(context, "com.google.android.gms.measurement.AppMeasurement", atomicReference, true)) {
return null;
}
try {
return i(context, str).invoke(atomicReference.get(), null);
} catch (Exception unused) {
l(str, true);
return null;
}
}
public final void l(String str, boolean z) {
AtomicBoolean atomicBoolean = this.d;
if (!atomicBoolean.get()) {
String q = android.support.v4.media.a.q(new StringBuilder(str.length() + 30), "Invoke Firebase method ", str, " error.");
int i = com.google.android.gms.ads.internal.util.zze.zza;
com.google.android.gms.ads.internal.util.client.zzo.zzi(q);
if (z) {
com.google.android.gms.ads.internal.util.client.zzo.zzi("The Google Mobile Ads SDK will not integrate with Firebase. Admob/Firebase integration requires the latest Firebase SDK jar, but Firebase SDK is either missing or out of date");
atomicBoolean.set(true);
}
}
}
public final boolean m(Context context, String str, AtomicReference atomicReference, boolean z) {
if (atomicReference.get() == null) {
try {
Object invoke = context.getClassLoader().loadClass(str).getDeclaredMethod("getInstance", Context.class).invoke(null, context);
while (!atomicReference.compareAndSet(null, invoke) && atomicReference.get() == null) {
}
} catch (Exception unused) {
l("getInstance", z);
return false;
}
}
return true;
}
}