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

282 lines
11 KiB
Java

package com.google.android.gms.internal.ads;
import android.app.Activity;
import android.app.Application;
import android.app.KeyguardManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.IntentFilter;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.PowerManager;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.Window;
import android.view.WindowManager;
import java.lang.ref.WeakReference;
import java.util.HashSet;
/* loaded from: classes.dex */
public final class zzbcm implements View.OnAttachStateChangeListener, ViewTreeObserver.OnGlobalLayoutListener, ViewTreeObserver.OnScrollChangedListener, Application.ActivityLifecycleCallbacks {
public static final long s = ((Long) com.google.android.gms.ads.internal.client.zzbd.zzc().a(zzbgk.R1)).longValue();
/* renamed from: c, reason: collision with root package name */
public final Context f4546c;
public final Application f;
public final PowerManager g;
public final KeyguardManager h;
public BroadcastReceiver i;
public WeakReference j;
public final WeakReference k;
public final zzbcy l;
public final com.google.android.gms.ads.internal.util.zzbu m = new com.google.android.gms.ads.internal.util.zzbu(s);
public boolean n = false;
public int o = -1;
public final HashSet p = new HashSet();
public final DisplayMetrics q;
public final Rect r;
public zzbcm(Context context, View view) {
View view2;
Context applicationContext = context.getApplicationContext();
this.f4546c = applicationContext;
WindowManager windowManager = (WindowManager) applicationContext.getSystemService("window");
this.g = (PowerManager) applicationContext.getSystemService("power");
this.h = (KeyguardManager) applicationContext.getSystemService("keyguard");
if (applicationContext instanceof Application) {
this.f = (Application) applicationContext;
this.l = new zzbcy((Application) applicationContext, this);
}
this.q = context.getResources().getDisplayMetrics();
Rect rect = new Rect();
this.r = rect;
rect.right = windowManager.getDefaultDisplay().getWidth();
rect.bottom = windowManager.getDefaultDisplay().getHeight();
WeakReference weakReference = this.k;
if (weakReference != null) {
view2 = (View) weakReference.get();
} else {
view2 = null;
}
if (view2 != null) {
view2.removeOnAttachStateChangeListener(this);
f(view2);
}
this.k = new WeakReference(view);
if (view != null) {
if (view.isAttachedToWindow()) {
e(view);
}
view.addOnAttachStateChangeListener(this);
}
}
public final Rect a(Rect rect) {
float f = rect.left;
float f2 = this.q.density;
return new Rect((int) (f / f2), (int) (rect.top / f2), (int) (rect.right / f2), (int) (rect.bottom / f2));
}
public final void b() {
com.google.android.gms.ads.internal.util.zzs.zza.post(new Runnable() { // from class: com.google.android.gms.internal.ads.zzbcl
@Override // java.lang.Runnable
public final /* synthetic */ void run() {
zzbcm.this.d(3);
}
});
}
public final void c(Activity activity, int i) {
Window window;
WeakReference weakReference = this.k;
if (weakReference != null && (window = activity.getWindow()) != null) {
View peekDecorView = window.peekDecorView();
View view = (View) weakReference.get();
if (view != null && peekDecorView != null && view.getRootView() == peekDecorView.getRootView()) {
this.o = i;
}
}
}
/* JADX WARN: Code restructure failed: missing block: B:111:0x015b, code lost:
if (r10 == 0) goto L54;
*/
/* JADX WARN: Code restructure failed: missing block: B:47:0x0136, code lost:
if (r10 == 0) goto L54;
*/
/* JADX WARN: Code restructure failed: missing block: B:48:0x0138, code lost:
r4 = 1;
r14 = true;
r15 = true;
r10 = r16;
*/
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r0v33, types: [java.util.List] */
/* JADX WARN: Type inference failed for: r0v34, types: [java.util.ArrayList] */
/* JADX WARN: Type inference failed for: r0v8, types: [java.util.List] */
/* JADX WARN: Type inference failed for: r0v9 */
/* JADX WARN: Type inference failed for: r18v0 */
/* JADX WARN: Type inference failed for: r18v1, types: [boolean] */
/* JADX WARN: Type inference failed for: r18v2 */
/* JADX WARN: Type inference failed for: r27v0, types: [boolean] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final void d(int r31) {
/*
Method dump skipped, instructions count: 581
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.ads.zzbcm.d(int):void");
}
public final void e(View view) {
ViewTreeObserver viewTreeObserver = view.getViewTreeObserver();
if (viewTreeObserver.isAlive()) {
this.j = new WeakReference(viewTreeObserver);
viewTreeObserver.addOnScrollChangedListener(this);
viewTreeObserver.addOnGlobalLayoutListener(this);
}
if (this.i == null) {
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("android.intent.action.SCREEN_ON");
intentFilter.addAction("android.intent.action.SCREEN_OFF");
intentFilter.addAction("android.intent.action.USER_PRESENT");
this.i = new zzbci(this);
com.google.android.gms.ads.internal.zzt.zzA().zzb(this.f4546c, this.i, intentFilter);
}
Application application = this.f;
if (application != null) {
try {
application.registerActivityLifecycleCallbacks(this.l);
} catch (Exception e) {
int i = com.google.android.gms.ads.internal.util.zze.zza;
com.google.android.gms.ads.internal.util.client.zzo.zzg("Error registering activity lifecycle callbacks.", e);
}
}
}
public final void f(View view) {
try {
WeakReference weakReference = this.j;
if (weakReference != null) {
ViewTreeObserver viewTreeObserver = (ViewTreeObserver) weakReference.get();
if (viewTreeObserver != null && viewTreeObserver.isAlive()) {
viewTreeObserver.removeOnScrollChangedListener(this);
viewTreeObserver.removeGlobalOnLayoutListener(this);
}
this.j = null;
}
} catch (Exception e) {
int i = com.google.android.gms.ads.internal.util.zze.zza;
com.google.android.gms.ads.internal.util.client.zzo.zzg("Error while unregistering listeners from the last ViewTreeObserver.", e);
}
try {
ViewTreeObserver viewTreeObserver2 = view.getViewTreeObserver();
if (viewTreeObserver2.isAlive()) {
viewTreeObserver2.removeOnScrollChangedListener(this);
viewTreeObserver2.removeGlobalOnLayoutListener(this);
}
} catch (Exception e2) {
int i2 = com.google.android.gms.ads.internal.util.zze.zza;
com.google.android.gms.ads.internal.util.client.zzo.zzg("Error while unregistering listeners from the ViewTreeObserver.", e2);
}
if (this.i != null) {
try {
com.google.android.gms.ads.internal.zzt.zzA().zzc(this.f4546c, this.i);
} catch (IllegalStateException e3) {
int i3 = com.google.android.gms.ads.internal.util.zze.zza;
com.google.android.gms.ads.internal.util.client.zzo.zzg("Failed trying to unregister the receiver", e3);
} catch (Exception e4) {
com.google.android.gms.ads.internal.zzt.zzh().f("ActiveViewUnit.stopScreenStatusMonitoring", e4);
}
this.i = null;
}
Application application = this.f;
if (application != null) {
try {
application.unregisterActivityLifecycleCallbacks(this.l);
} catch (Exception e5) {
int i4 = com.google.android.gms.ads.internal.util.zze.zza;
com.google.android.gms.ads.internal.util.client.zzo.zzg("Error registering activity lifecycle callbacks.", e5);
}
}
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public final void onActivityCreated(Activity activity, Bundle bundle) {
c(activity, 0);
d(3);
b();
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public final void onActivityDestroyed(Activity activity) {
d(3);
b();
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public final void onActivityPaused(Activity activity) {
c(activity, 4);
d(3);
b();
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public final void onActivityResumed(Activity activity) {
c(activity, 0);
d(3);
b();
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public final void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
d(3);
b();
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public final void onActivityStarted(Activity activity) {
c(activity, 0);
d(3);
b();
}
@Override // android.app.Application.ActivityLifecycleCallbacks
public final void onActivityStopped(Activity activity) {
d(3);
b();
}
@Override // android.view.ViewTreeObserver.OnGlobalLayoutListener
public final void onGlobalLayout() {
d(2);
b();
}
@Override // android.view.ViewTreeObserver.OnScrollChangedListener
public final void onScrollChanged() {
d(1);
}
@Override // android.view.View.OnAttachStateChangeListener
public final void onViewAttachedToWindow(View view) {
this.o = -1;
e(view);
d(3);
}
@Override // android.view.View.OnAttachStateChangeListener
public final void onViewDetachedFromWindow(View view) {
this.o = -1;
d(3);
b();
f(view);
}
}