soul-browser/sources/java/com/google/android/material/internal/ThemeEnforcement.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

107 lines
4.5 KiB
Java

package com.google.android.material.internal;
import android.content.Context;
import android.content.res.TypedArray;
import android.support.v4.media.a;
import android.util.AttributeSet;
import android.util.TypedValue;
import androidx.annotation.RestrictTo;
import androidx.appcompat.R;
@RestrictTo
/* loaded from: classes3.dex */
public final class ThemeEnforcement {
/* renamed from: a, reason: collision with root package name */
public static final int[] f11819a = {R.attr.colorPrimary};
public static final int[] b = {com.google.android.material.R.attr.colorPrimaryVariant};
public static void a(Context context, AttributeSet attributeSet, int i, int i2) {
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, com.google.android.material.R.styleable.ThemeEnforcement, i, i2);
boolean z = obtainStyledAttributes.getBoolean(com.google.android.material.R.styleable.ThemeEnforcement_enforceMaterialTheme, false);
obtainStyledAttributes.recycle();
if (z) {
TypedValue typedValue = new TypedValue();
if (!context.getTheme().resolveAttribute(com.google.android.material.R.attr.isMaterialTheme, typedValue, true) || (typedValue.type == 18 && typedValue.data == 0)) {
c(context, b, "Theme.MaterialComponents");
}
}
c(context, f11819a, "Theme.AppCompat");
}
/* JADX WARN: Code restructure failed: missing block: B:9:0x001e, code lost:
if (r0.getResourceId(com.google.android.material.R.styleable.ThemeEnforcement_android_textAppearance, -1) != (-1)) goto L10;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static void b(android.content.Context r5, android.util.AttributeSet r6, int[] r7, int r8, int r9, int... r10) {
/*
int[] r0 = com.google.android.material.R.styleable.ThemeEnforcement
android.content.res.TypedArray r0 = r5.obtainStyledAttributes(r6, r0, r8, r9)
int r1 = com.google.android.material.R.styleable.ThemeEnforcement_enforceTextAppearance
r2 = 0
boolean r1 = r0.getBoolean(r1, r2)
if (r1 != 0) goto L13
r0.recycle()
return
L13:
int r1 = r10.length
r3 = 1
r4 = -1
if (r1 != 0) goto L22
int r5 = com.google.android.material.R.styleable.ThemeEnforcement_android_textAppearance
int r5 = r0.getResourceId(r5, r4)
if (r5 == r4) goto L3d
L20:
r2 = r3
goto L3d
L22:
android.content.res.TypedArray r5 = r5.obtainStyledAttributes(r6, r7, r8, r9)
int r6 = r10.length
r7 = r2
L28:
if (r7 >= r6) goto L39
r8 = r10[r7]
int r8 = r5.getResourceId(r8, r4)
if (r8 != r4) goto L36
r5.recycle()
goto L3d
L36:
int r7 = r7 + 1
goto L28
L39:
r5.recycle()
goto L20
L3d:
r0.recycle()
if (r2 == 0) goto L43
return
L43:
java.lang.IllegalArgumentException r5 = new java.lang.IllegalArgumentException
java.lang.String r6 = "This component requires that you specify a valid TextAppearance attribute. Update your app theme to inherit from Theme.MaterialComponents (or a descendant)."
r5.<init>(r6)
throw r5
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.internal.ThemeEnforcement.b(android.content.Context, android.util.AttributeSet, int[], int, int, int[]):void");
}
public static void c(Context context, int[] iArr, String str) {
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(iArr);
for (int i = 0; i < iArr.length; i++) {
if (!obtainStyledAttributes.hasValue(i)) {
obtainStyledAttributes.recycle();
throw new IllegalArgumentException(a.l("The style on this component requires your app theme to be ", str, " (or a descendant)."));
}
}
obtainStyledAttributes.recycle();
}
public static TypedArray d(Context context, AttributeSet attributeSet, int[] iArr, int i, int i2, int... iArr2) {
a(context, attributeSet, i, i2);
b(context, attributeSet, iArr, i, i2, iArr2);
return context.obtainStyledAttributes(attributeSet, iArr, i, i2);
}
}