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

347 lines
11 KiB
Java

package androidx.customview.widget;
import android.graphics.Rect;
import java.util.Comparator;
/* loaded from: classes.dex */
class FocusStrategy {
/* loaded from: classes.dex */
public interface BoundsAdapter<T> {
void a(Object obj, Rect rect);
}
/* loaded from: classes.dex */
public interface CollectionAdapter<T, V> {
}
/* loaded from: classes.dex */
public static class SequentialComparator<T> implements Comparator<T> {
/* renamed from: c, reason: collision with root package name */
public final Rect f937c = new Rect();
public final Rect f = new Rect();
public final boolean g;
public final BoundsAdapter h;
public SequentialComparator(boolean z, BoundsAdapter boundsAdapter) {
this.g = z;
this.h = boundsAdapter;
}
@Override // java.util.Comparator
public final int compare(Object obj, Object obj2) {
BoundsAdapter boundsAdapter = this.h;
Rect rect = this.f937c;
boundsAdapter.a(obj, rect);
Rect rect2 = this.f;
boundsAdapter.a(obj2, rect2);
int i = rect.top;
int i2 = rect2.top;
if (i >= i2) {
if (i <= i2) {
int i3 = rect.left;
int i4 = rect2.left;
boolean z = this.g;
if (i3 < i4) {
if (!z) {
return -1;
}
return 1;
}
if (i3 > i4) {
if (z) {
return -1;
}
return 1;
}
int i5 = rect.bottom;
int i6 = rect2.bottom;
if (i5 >= i6) {
if (i5 <= i6) {
int i7 = rect.right;
int i8 = rect2.right;
if (i7 < i8) {
if (!z) {
return -1;
}
return 1;
}
if (i7 > i8) {
if (z) {
return -1;
}
return 1;
}
return 0;
}
return 1;
}
return -1;
}
return 1;
}
return -1;
}
}
/* JADX WARN: Code restructure failed: missing block: B:10:0x0025, code lost:
if (r9.bottom <= r11.top) goto L24;
*/
/* JADX WARN: Code restructure failed: missing block: B:13:0x0042, code lost:
if (r8 == 17) goto L41;
*/
/* JADX WARN: Code restructure failed: missing block: B:14:0x0044, code lost:
if (r8 != 66) goto L27;
*/
/* JADX WARN: Code restructure failed: missing block: B:15:0x0047, code lost:
r10 = d(r8, r9, r10);
*/
/* JADX WARN: Code restructure failed: missing block: B:16:0x004b, code lost:
if (r8 == 17) goto L38;
*/
/* JADX WARN: Code restructure failed: missing block: B:17:0x004d, code lost:
if (r8 == 33) goto L37;
*/
/* JADX WARN: Code restructure failed: missing block: B:18:0x004f, code lost:
if (r8 == 66) goto L36;
*/
/* JADX WARN: Code restructure failed: missing block: B:19:0x0051, code lost:
if (r8 != 130) goto L34;
*/
/* JADX WARN: Code restructure failed: missing block: B:20:0x0053, code lost:
r8 = r11.bottom;
r9 = r9.bottom;
*/
/* JADX WARN: Code restructure failed: missing block: B:23:0x0072, code lost:
if (r10 >= java.lang.Math.max(1, r8 - r9)) goto L44;
*/
/* JADX WARN: Code restructure failed: missing block: B:24:?, code lost:
return false;
*/
/* JADX WARN: Code restructure failed: missing block: B:26:0x005e, code lost:
throw new java.lang.IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
*/
/* JADX WARN: Code restructure failed: missing block: B:27:0x005f, code lost:
r8 = r11.right;
r9 = r9.right;
*/
/* JADX WARN: Code restructure failed: missing block: B:28:0x0064, code lost:
r8 = r9.top;
r9 = r11.top;
*/
/* JADX WARN: Code restructure failed: missing block: B:29:0x0069, code lost:
r8 = r9.left;
r9 = r11.left;
*/
/* JADX WARN: Code restructure failed: missing block: B:33:0x0032, code lost:
if (r9.right <= r11.left) goto L24;
*/
/* JADX WARN: Code restructure failed: missing block: B:35:0x0039, code lost:
if (r9.top >= r11.bottom) goto L24;
*/
/* JADX WARN: Code restructure failed: missing block: B:37:0x0040, code lost:
if (r9.left >= r11.right) goto L24;
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static boolean a(int r8, android.graphics.Rect r9, android.graphics.Rect r10, android.graphics.Rect r11) {
/*
boolean r0 = b(r8, r9, r10)
boolean r1 = b(r8, r9, r11)
if (r1 != 0) goto L75
if (r0 != 0) goto Le
goto L75
Le:
java.lang.String r0 = "direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}."
r1 = 130(0x82, float:1.82E-43)
r2 = 33
r3 = 66
r4 = 17
r5 = 1
if (r8 == r4) goto L3c
if (r8 == r2) goto L35
if (r8 == r3) goto L2e
if (r8 != r1) goto L28
int r6 = r9.bottom
int r7 = r11.top
if (r6 > r7) goto L74
goto L42
L28:
java.lang.IllegalArgumentException r8 = new java.lang.IllegalArgumentException
r8.<init>(r0)
throw r8
L2e:
int r6 = r9.right
int r7 = r11.left
if (r6 > r7) goto L74
goto L42
L35:
int r6 = r9.top
int r7 = r11.bottom
if (r6 < r7) goto L74
goto L42
L3c:
int r6 = r9.left
int r7 = r11.right
if (r6 < r7) goto L74
L42:
if (r8 == r4) goto L74
if (r8 != r3) goto L47
goto L74
L47:
int r10 = d(r8, r9, r10)
if (r8 == r4) goto L69
if (r8 == r2) goto L64
if (r8 == r3) goto L5f
if (r8 != r1) goto L59
int r8 = r11.bottom
int r9 = r9.bottom
L57:
int r8 = r8 - r9
goto L6e
L59:
java.lang.IllegalArgumentException r8 = new java.lang.IllegalArgumentException
r8.<init>(r0)
throw r8
L5f:
int r8 = r11.right
int r9 = r9.right
goto L57
L64:
int r8 = r9.top
int r9 = r11.top
goto L57
L69:
int r8 = r9.left
int r9 = r11.left
goto L57
L6e:
int r8 = java.lang.Math.max(r5, r8)
if (r10 >= r8) goto L75
L74:
return r5
L75:
r8 = 0
return r8
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.customview.widget.FocusStrategy.a(int, android.graphics.Rect, android.graphics.Rect, android.graphics.Rect):boolean");
}
public static boolean b(int i, Rect rect, Rect rect2) {
if (i != 17) {
if (i != 33) {
if (i != 66) {
if (i != 130) {
throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
}
}
}
if (rect2.right >= rect.left && rect2.left <= rect.right) {
return true;
}
return false;
}
if (rect2.bottom >= rect.top && rect2.top <= rect.bottom) {
return true;
}
return false;
}
public static boolean c(int i, Rect rect, Rect rect2) {
if (i != 17) {
if (i != 33) {
if (i != 66) {
if (i == 130) {
int i2 = rect.top;
int i3 = rect2.top;
if ((i2 < i3 || rect.bottom <= i3) && rect.bottom < rect2.bottom) {
return true;
}
return false;
}
throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
}
int i4 = rect.left;
int i5 = rect2.left;
if ((i4 < i5 || rect.right <= i5) && rect.right < rect2.right) {
return true;
}
return false;
}
int i6 = rect.bottom;
int i7 = rect2.bottom;
if ((i6 > i7 || rect.top >= i7) && rect.top > rect2.top) {
return true;
}
return false;
}
int i8 = rect.right;
int i9 = rect2.right;
if ((i8 > i9 || rect.left >= i9) && rect.left > rect2.left) {
return true;
}
return false;
}
public static int d(int i, Rect rect, Rect rect2) {
int i2;
int i3;
if (i != 17) {
if (i != 33) {
if (i != 66) {
if (i == 130) {
i2 = rect2.top;
i3 = rect.bottom;
} else {
throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
}
} else {
i2 = rect2.left;
i3 = rect.right;
}
} else {
i2 = rect.top;
i3 = rect2.bottom;
}
} else {
i2 = rect.left;
i3 = rect2.right;
}
return Math.max(0, i2 - i3);
}
public static int e(int i, Rect rect, Rect rect2) {
if (i != 17) {
if (i != 33) {
if (i != 66) {
if (i != 130) {
throw new IllegalArgumentException("direction must be one of {FOCUS_UP, FOCUS_DOWN, FOCUS_LEFT, FOCUS_RIGHT}.");
}
}
}
return Math.abs(((rect.width() / 2) + rect.left) - ((rect2.width() / 2) + rect2.left));
}
return Math.abs(((rect.height() / 2) + rect.top) - ((rect2.height() / 2) + rect2.top));
}
}