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

179 lines
6.1 KiB
Java

package androidx.appcompat.widget;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import androidx.appcompat.R;
import androidx.core.view.ViewCompat;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public class AppCompatBackgroundHelper {
/* renamed from: a, reason: collision with root package name */
public final View f220a;
public TintInfo d;
public TintInfo e;
public TintInfo f;
/* renamed from: c, reason: collision with root package name */
public int f221c = -1;
public final AppCompatDrawableManager b = AppCompatDrawableManager.a();
public AppCompatBackgroundHelper(View view) {
this.f220a = view;
}
/* JADX WARN: Type inference failed for: r2v5, types: [java.lang.Object, androidx.appcompat.widget.TintInfo] */
public final void a() {
View view = this.f220a;
Drawable background = view.getBackground();
if (background != null) {
if (this.d != null) {
if (this.f == null) {
this.f = new Object();
}
TintInfo tintInfo = this.f;
tintInfo.f329a = null;
tintInfo.d = false;
tintInfo.b = null;
tintInfo.f330c = false;
ColorStateList i = ViewCompat.i(view);
if (i != null) {
tintInfo.d = true;
tintInfo.f329a = i;
}
PorterDuff.Mode j = ViewCompat.j(view);
if (j != null) {
tintInfo.f330c = true;
tintInfo.b = j;
}
if (tintInfo.d || tintInfo.f330c) {
AppCompatDrawableManager.e(background, tintInfo, view.getDrawableState());
return;
}
}
TintInfo tintInfo2 = this.e;
if (tintInfo2 != null) {
AppCompatDrawableManager.e(background, tintInfo2, view.getDrawableState());
return;
}
TintInfo tintInfo3 = this.d;
if (tintInfo3 != null) {
AppCompatDrawableManager.e(background, tintInfo3, view.getDrawableState());
}
}
}
public final ColorStateList b() {
TintInfo tintInfo = this.e;
if (tintInfo != null) {
return tintInfo.f329a;
}
return null;
}
public final PorterDuff.Mode c() {
TintInfo tintInfo = this.e;
if (tintInfo != null) {
return tintInfo.b;
}
return null;
}
public final void d(AttributeSet attributeSet, int i) {
ColorStateList h;
View view = this.f220a;
TintTypedArray e = TintTypedArray.e(view.getContext(), attributeSet, R.styleable.ViewBackgroundHelper, i);
TypedArray typedArray = e.b;
View view2 = this.f220a;
ViewCompat.y(view2, view2.getContext(), R.styleable.ViewBackgroundHelper, attributeSet, e.b, i);
try {
if (typedArray.hasValue(R.styleable.ViewBackgroundHelper_android_background)) {
this.f221c = typedArray.getResourceId(R.styleable.ViewBackgroundHelper_android_background, -1);
AppCompatDrawableManager appCompatDrawableManager = this.b;
Context context = view.getContext();
int i2 = this.f221c;
synchronized (appCompatDrawableManager) {
h = appCompatDrawableManager.f236a.h(context, i2);
}
if (h != null) {
g(h);
}
}
if (typedArray.hasValue(R.styleable.ViewBackgroundHelper_backgroundTint)) {
ViewCompat.C(view, e.a(R.styleable.ViewBackgroundHelper_backgroundTint));
}
if (typedArray.hasValue(R.styleable.ViewBackgroundHelper_backgroundTintMode)) {
ViewCompat.D(view, DrawableUtils.c(typedArray.getInt(R.styleable.ViewBackgroundHelper_backgroundTintMode, -1), null));
}
e.f();
} catch (Throwable th) {
e.f();
throw th;
}
}
public final void e() {
this.f221c = -1;
g(null);
a();
}
public final void f(int i) {
ColorStateList colorStateList;
this.f221c = i;
AppCompatDrawableManager appCompatDrawableManager = this.b;
if (appCompatDrawableManager != null) {
Context context = this.f220a.getContext();
synchronized (appCompatDrawableManager) {
colorStateList = appCompatDrawableManager.f236a.h(context, i);
}
} else {
colorStateList = null;
}
g(colorStateList);
a();
}
/* JADX WARN: Type inference failed for: r0v2, types: [java.lang.Object, androidx.appcompat.widget.TintInfo] */
public final void g(ColorStateList colorStateList) {
if (colorStateList != null) {
if (this.d == null) {
this.d = new Object();
}
TintInfo tintInfo = this.d;
tintInfo.f329a = colorStateList;
tintInfo.d = true;
} else {
this.d = null;
}
a();
}
/* JADX WARN: Type inference failed for: r0v2, types: [java.lang.Object, androidx.appcompat.widget.TintInfo] */
public final void h(ColorStateList colorStateList) {
if (this.e == null) {
this.e = new Object();
}
TintInfo tintInfo = this.e;
tintInfo.f329a = colorStateList;
tintInfo.d = true;
a();
}
/* JADX WARN: Type inference failed for: r0v2, types: [java.lang.Object, androidx.appcompat.widget.TintInfo] */
public final void i(PorterDuff.Mode mode) {
if (this.e == null) {
this.e = new Object();
}
TintInfo tintInfo = this.e;
tintInfo.b = mode;
tintInfo.f330c = true;
a();
}
}