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

248 lines
8.9 KiB
Java

package androidx.appcompat.app;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import androidx.activity.ComponentActivity;
import androidx.activity.contextaware.OnContextAvailableListener;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.appcompat.widget.VectorEnabledTintResources;
import androidx.core.app.NavUtils;
import androidx.core.app.TaskStackBuilder;
import androidx.fragment.app.FragmentActivity;
import androidx.savedstate.SavedStateRegistry;
import java.util.ArrayList;
/* loaded from: classes.dex */
public class AppCompatActivity extends FragmentActivity implements AppCompatCallback, TaskStackBuilder.SupportParentable, ActionBarDrawerToggle.DelegateProvider {
public AppCompatDelegate E;
public AppCompatActivity() {
this.h.b.c("androidx:appcompat", new SavedStateRegistry.SavedStateProvider() { // from class: androidx.appcompat.app.AppCompatActivity.1
@Override // androidx.savedstate.SavedStateRegistry.SavedStateProvider
public final Bundle a() {
Bundle bundle = new Bundle();
AppCompatActivity.this.V().getClass();
return bundle;
}
});
Q(new OnContextAvailableListener() { // from class: androidx.appcompat.app.AppCompatActivity.2
@Override // androidx.activity.contextaware.OnContextAvailableListener
public final void a(ComponentActivity componentActivity) {
AppCompatActivity appCompatActivity = AppCompatActivity.this;
AppCompatDelegate V = appCompatActivity.V();
V.n();
appCompatActivity.h.b.a("androidx:appcompat");
V.r();
}
});
}
public final AppCompatDelegate V() {
if (this.E == null) {
AppCompatDelegate.SerialExecutor serialExecutor = AppCompatDelegate.f84c;
this.E = new AppCompatDelegateImpl(this, null, this, this);
}
return this.E;
}
public final ActionBar W() {
return V().m();
}
@Override // androidx.activity.ComponentActivity, android.app.Activity
public final void addContentView(View view, ViewGroup.LayoutParams layoutParams) {
R();
V().c(view, layoutParams);
}
@Override // android.app.Activity, android.view.ContextThemeWrapper, android.content.ContextWrapper
public final void attachBaseContext(Context context) {
super.attachBaseContext(V().f(context));
}
@Override // android.app.Activity
public final void closeOptionsMenu() {
ActionBar W = W();
if (getWindow().hasFeature(0)) {
if (W == null || !W.e()) {
super.closeOptionsMenu();
}
}
}
@Override // androidx.core.app.ComponentActivity, android.app.Activity, android.view.Window.Callback
public final boolean dispatchKeyEvent(KeyEvent keyEvent) {
int keyCode = keyEvent.getKeyCode();
ActionBar W = W();
if (keyCode == 82 && W != null && W.n(keyEvent)) {
return true;
}
return super.dispatchKeyEvent(keyEvent);
}
@Override // android.app.Activity
public final View findViewById(int i) {
return V().g(i);
}
@Override // android.app.Activity
public final MenuInflater getMenuInflater() {
return V().l();
}
@Override // android.view.ContextThemeWrapper, android.content.ContextWrapper, android.content.Context
public final Resources getResources() {
int i = VectorEnabledTintResources.f349a;
return super.getResources();
}
@Override // android.app.Activity
public final void invalidateOptionsMenu() {
V().o();
}
@Override // androidx.activity.ComponentActivity, android.app.Activity, android.content.ComponentCallbacks
public void onConfigurationChanged(Configuration configuration) {
super.onConfigurationChanged(configuration);
V().q(configuration);
}
@Override // android.app.Activity, android.view.Window.Callback
public final void onContentChanged() {
}
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
public void onDestroy() {
super.onDestroy();
V().s();
}
@Override // android.app.Activity, android.view.KeyEvent.Callback
public boolean onKeyDown(int i, KeyEvent keyEvent) {
Window window;
if (Build.VERSION.SDK_INT < 26 && !keyEvent.isCtrlPressed() && !KeyEvent.metaStateHasNoModifiers(keyEvent.getMetaState()) && keyEvent.getRepeatCount() == 0 && !KeyEvent.isModifierKey(keyEvent.getKeyCode()) && (window = getWindow()) != null && window.getDecorView() != null && window.getDecorView().dispatchKeyShortcutEvent(keyEvent)) {
return true;
}
return super.onKeyDown(i, keyEvent);
}
@Override // androidx.fragment.app.FragmentActivity, androidx.activity.ComponentActivity, android.app.Activity, android.view.Window.Callback
public final boolean onMenuItemSelected(int i, MenuItem menuItem) {
Intent b;
if (!super.onMenuItemSelected(i, menuItem)) {
ActionBar W = W();
if (menuItem.getItemId() != 16908332 || W == null || (W.h() & 4) == 0 || (b = NavUtils.b(this)) == null) {
return false;
}
if (shouldUpRecreateTask(b)) {
TaskStackBuilder taskStackBuilder = new TaskStackBuilder(this);
Intent b2 = NavUtils.b(this);
if (b2 == null) {
b2 = NavUtils.b(this);
}
ArrayList arrayList = taskStackBuilder.f646c;
Context context = taskStackBuilder.f;
if (b2 != null) {
ComponentName component = b2.getComponent();
if (component == null) {
component = b2.resolveActivity(context.getPackageManager());
}
taskStackBuilder.a(component);
arrayList.add(b2);
}
if (!arrayList.isEmpty()) {
Intent[] intentArr = (Intent[]) arrayList.toArray(new Intent[0]);
intentArr[0] = new Intent(intentArr[0]).addFlags(268484608);
context.startActivities(intentArr, null);
try {
finishAffinity();
} catch (IllegalStateException unused) {
finish();
}
} else {
throw new IllegalStateException("No intents added to TaskStackBuilder; cannot startActivities");
}
} else {
navigateUpTo(b);
return true;
}
}
return true;
}
@Override // android.app.Activity
public final void onPostCreate(Bundle bundle) {
super.onPostCreate(bundle);
V().t();
}
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
public final void onPostResume() {
super.onPostResume();
V().u();
}
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
public void onStart() {
super.onStart();
V().v();
}
@Override // androidx.fragment.app.FragmentActivity, android.app.Activity
public void onStop() {
super.onStop();
V().w();
}
@Override // android.app.Activity
public final void onTitleChanged(CharSequence charSequence, int i) {
super.onTitleChanged(charSequence, i);
V().F(charSequence);
}
@Override // android.app.Activity
public final void openOptionsMenu() {
ActionBar W = W();
if (getWindow().hasFeature(0)) {
if (W == null || !W.o()) {
super.openOptionsMenu();
}
}
}
@Override // androidx.activity.ComponentActivity, android.app.Activity
public final void setContentView(int i) {
R();
V().A(i);
}
@Override // android.app.Activity, android.view.ContextThemeWrapper, android.content.ContextWrapper, android.content.Context
public final void setTheme(int i) {
super.setTheme(i);
V().E(i);
}
@Override // androidx.activity.ComponentActivity, android.app.Activity
public void setContentView(View view) {
R();
V().B(view);
}
@Override // androidx.activity.ComponentActivity, android.app.Activity
public final void setContentView(View view, ViewGroup.LayoutParams layoutParams) {
R();
V().C(view, layoutParams);
}
}