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

141 lines
5.4 KiB
Java

package com.google.android.material.motion;
import android.os.Build;
import android.view.View;
import android.window.BackEvent;
import android.window.OnBackAnimationCallback;
import android.window.OnBackInvokedCallback;
import android.window.OnBackInvokedDispatcher;
import androidx.activity.BackEventCompat;
import androidx.annotation.DoNotInline;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import j$.util.Objects;
import kotlin.time.DurationKt;
@RestrictTo
/* loaded from: classes3.dex */
public final class MaterialBackOrchestrator {
/* renamed from: a, reason: collision with root package name */
public final Api33BackCallbackDelegate f11831a;
public final MaterialBackHandler b;
/* renamed from: c, reason: collision with root package name */
public final View f11832c;
@RequiresApi
/* loaded from: classes3.dex */
public static class Api33BackCallbackDelegate implements BackCallbackDelegate {
/* renamed from: a, reason: collision with root package name */
public OnBackInvokedCallback f11833a;
@Override // com.google.android.material.motion.MaterialBackOrchestrator.BackCallbackDelegate
@DoNotInline
public void a(@NonNull MaterialBackHandler materialBackHandler, @NonNull View view, boolean z) {
OnBackInvokedDispatcher findOnBackInvokedDispatcher;
int i;
if (this.f11833a != null || (findOnBackInvokedDispatcher = view.findOnBackInvokedDispatcher()) == null) {
return;
}
OnBackInvokedCallback c2 = c(materialBackHandler);
this.f11833a = c2;
if (z) {
i = DurationKt.NANOS_IN_MILLIS;
} else {
i = 0;
}
findOnBackInvokedDispatcher.registerOnBackInvokedCallback(i, c2);
}
@Override // com.google.android.material.motion.MaterialBackOrchestrator.BackCallbackDelegate
@DoNotInline
public void b(@NonNull View view) {
OnBackInvokedDispatcher findOnBackInvokedDispatcher;
if (this.f11833a == null || (findOnBackInvokedDispatcher = view.findOnBackInvokedDispatcher()) == null) {
return;
}
findOnBackInvokedDispatcher.unregisterOnBackInvokedCallback(this.f11833a);
this.f11833a = null;
}
public OnBackInvokedCallback c(final MaterialBackHandler materialBackHandler) {
Objects.requireNonNull(materialBackHandler);
return new OnBackInvokedCallback() { // from class: com.google.android.material.motion.a
public final void onBackInvoked() {
MaterialBackHandler.this.d();
}
};
}
}
@RequiresApi
/* loaded from: classes3.dex */
public static class Api34BackCallbackDelegate extends Api33BackCallbackDelegate {
@Override // com.google.android.material.motion.MaterialBackOrchestrator.Api33BackCallbackDelegate
public final OnBackInvokedCallback c(final MaterialBackHandler materialBackHandler) {
return new OnBackAnimationCallback() { // from class: com.google.android.material.motion.MaterialBackOrchestrator.Api34BackCallbackDelegate.1
public final void onBackCancelled() {
if (Api34BackCallbackDelegate.this.f11833a != null) {
materialBackHandler.f();
}
}
public final void onBackInvoked() {
materialBackHandler.d();
}
public final void onBackProgressed(BackEvent backEvent) {
if (Api34BackCallbackDelegate.this.f11833a != null) {
materialBackHandler.c(new BackEventCompat(backEvent));
}
}
public final void onBackStarted(BackEvent backEvent) {
if (Api34BackCallbackDelegate.this.f11833a != null) {
materialBackHandler.b(new BackEventCompat(backEvent));
}
}
};
}
}
/* loaded from: classes3.dex */
public interface BackCallbackDelegate {
void a(MaterialBackHandler materialBackHandler, View view, boolean z);
void b(View view);
}
/* JADX WARN: Multi-variable type inference failed */
public MaterialBackOrchestrator(MaterialBackHandler materialBackHandler, View view) {
Api33BackCallbackDelegate api33BackCallbackDelegate;
int i = Build.VERSION.SDK_INT;
if (i >= 34) {
api33BackCallbackDelegate = new Object();
} else if (i >= 33) {
api33BackCallbackDelegate = new Object();
} else {
api33BackCallbackDelegate = null;
}
this.f11831a = api33BackCallbackDelegate;
this.b = materialBackHandler;
this.f11832c = view;
}
public final void a(boolean z) {
Api33BackCallbackDelegate api33BackCallbackDelegate = this.f11831a;
if (api33BackCallbackDelegate != null) {
api33BackCallbackDelegate.a(this.b, this.f11832c, z);
}
}
public final void b() {
Api33BackCallbackDelegate api33BackCallbackDelegate = this.f11831a;
if (api33BackCallbackDelegate != null) {
api33BackCallbackDelegate.b(this.f11832c);
}
}
}