soul-browser/sources/java/androidx/appcompat/view/ContextThemeWrapper.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

139 lines
4.7 KiB
Java

package androidx.appcompat.view;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.AssetManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.view.LayoutInflater;
import androidx.appcompat.R;
/* loaded from: classes.dex */
public class ContextThemeWrapper extends ContextWrapper {
public static Configuration f;
/* renamed from: a, reason: collision with root package name */
public int f144a;
public Resources.Theme b;
/* renamed from: c, reason: collision with root package name */
public LayoutInflater f145c;
public Configuration d;
public Resources e;
public ContextThemeWrapper(Context context, int i) {
super(context);
this.f144a = i;
}
public final void a(Configuration configuration) {
if (this.e == null) {
if (this.d == null) {
this.d = new Configuration(configuration);
return;
}
throw new IllegalStateException("Override configuration has already been set");
}
throw new IllegalStateException("getResources() or getAssets() has already been called");
}
@Override // android.content.ContextWrapper
public final void attachBaseContext(Context context) {
super.attachBaseContext(context);
}
public final void b() {
if (this.b == null) {
this.b = getResources().newTheme();
Resources.Theme theme = getBaseContext().getTheme();
if (theme != null) {
this.b.setTo(theme);
}
}
this.b.applyStyle(this.f144a, true);
}
@Override // android.content.ContextWrapper, android.content.Context
public final AssetManager getAssets() {
return getResources().getAssets();
}
/* JADX WARN: Code restructure failed: missing block: B:11:0x0022, code lost:
if (r0.equals(androidx.appcompat.view.ContextThemeWrapper.f) != false) goto L15;
*/
@Override // android.content.ContextWrapper, android.content.Context
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final android.content.res.Resources getResources() {
/*
r3 = this;
android.content.res.Resources r0 = r3.e
if (r0 != 0) goto L38
android.content.res.Configuration r0 = r3.d
if (r0 == 0) goto L32
int r1 = android.os.Build.VERSION.SDK_INT
r2 = 26
if (r1 < r2) goto L25
android.content.res.Configuration r1 = androidx.appcompat.view.ContextThemeWrapper.f
if (r1 != 0) goto L1c
android.content.res.Configuration r1 = new android.content.res.Configuration
r1.<init>()
r2 = 0
r1.fontScale = r2
androidx.appcompat.view.ContextThemeWrapper.f = r1
L1c:
android.content.res.Configuration r1 = androidx.appcompat.view.ContextThemeWrapper.f
boolean r0 = r0.equals(r1)
if (r0 == 0) goto L25
goto L32
L25:
android.content.res.Configuration r0 = r3.d
android.content.Context r0 = r3.createConfigurationContext(r0)
android.content.res.Resources r0 = r0.getResources()
r3.e = r0
goto L38
L32:
android.content.res.Resources r0 = super.getResources()
r3.e = r0
L38:
android.content.res.Resources r0 = r3.e
return r0
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.view.ContextThemeWrapper.getResources():android.content.res.Resources");
}
@Override // android.content.ContextWrapper, android.content.Context
public final Object getSystemService(String str) {
if ("layout_inflater".equals(str)) {
if (this.f145c == null) {
this.f145c = LayoutInflater.from(getBaseContext()).cloneInContext(this);
}
return this.f145c;
}
return getBaseContext().getSystemService(str);
}
@Override // android.content.ContextWrapper, android.content.Context
public final Resources.Theme getTheme() {
Resources.Theme theme = this.b;
if (theme != null) {
return theme;
}
if (this.f144a == 0) {
this.f144a = R.style.Theme_AppCompat_Light;
}
b();
return this.b;
}
@Override // android.content.ContextWrapper, android.content.Context
public final void setTheme(int i) {
if (this.f144a != i) {
this.f144a = i;
b();
}
}
}