soul-browser/app/smali_classes3/com/google/common/math/IntMath.smali
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

494 lines
7.4 KiB
Smali

.class public final Lcom/google/common/math/IntMath;
.super Ljava/lang/Object;
.source "SourceFile"
# annotations
.annotation build Lcom/google/common/annotations/GwtCompatible;
.end annotation
# direct methods
.method public static a(IILjava/math/RoundingMode;)I
.locals 5
.line 1
invoke-virtual {p2}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
.line 2
.line 3
.line 4
if-eqz p1, :cond_7
.line 5
.line 6
div-int v0, p0, p1
.line 7
.line 8
mul-int v1, p1, v0
.line 9
.line 10
sub-int v1, p0, v1
.line 11
.line 12
if-nez v1, :cond_0
.line 13
.line 14
goto :goto_3
.line 15
:cond_0
xor-int/2addr p0, p1
.line 16
shr-int/lit8 p0, p0, 0x1f
.line 17
.line 18
const/4 v2, 0x1
.line 19
or-int/2addr p0, v2
.line 20
sget-object v3, Lcom/google/common/math/IntMath$1;->a:[I
.line 21
.line 22
invoke-virtual {p2}, Ljava/lang/Enum;->ordinal()I
.line 23
.line 24
.line 25
move-result v4
.line 26
aget v3, v3, v4
.line 27
.line 28
packed-switch v3, :pswitch_data_0
.line 29
.line 30
.line 31
new-instance p0, Ljava/lang/AssertionError;
.line 32
.line 33
invoke-direct {p0}, Ljava/lang/AssertionError;-><init>()V
.line 34
.line 35
.line 36
throw p0
.line 37
:pswitch_0
invoke-static {v1}, Ljava/lang/Math;->abs(I)I
.line 38
.line 39
.line 40
move-result v1
.line 41
invoke-static {p1}, Ljava/lang/Math;->abs(I)I
.line 42
.line 43
.line 44
move-result p1
.line 45
sub-int/2addr p1, v1
.line 46
sub-int/2addr v1, p1
.line 47
if-nez v1, :cond_3
.line 48
.line 49
sget-object p1, Ljava/math/RoundingMode;->HALF_UP:Ljava/math/RoundingMode;
.line 50
.line 51
if-eq p2, p1, :cond_4
.line 52
.line 53
sget-object p1, Ljava/math/RoundingMode;->HALF_EVEN:Ljava/math/RoundingMode;
.line 54
.line 55
const/4 v1, 0x0
.line 56
if-ne p2, p1, :cond_1
.line 57
.line 58
move p1, v2
.line 59
goto :goto_0
.line 60
:cond_1
move p1, v1
.line 61
:goto_0
and-int/lit8 p2, v0, 0x1
.line 62
.line 63
if-eqz p2, :cond_2
.line 64
.line 65
goto :goto_1
.line 66
:cond_2
move v2, v1
.line 67
:goto_1
and-int/2addr p1, v2
.line 68
if-eqz p1, :cond_5
.line 69
.line 70
goto :goto_2
.line 71
:cond_3
if-lez v1, :cond_5
.line 72
.line 73
goto :goto_2
.line 74
:pswitch_1
if-lez p0, :cond_5
.line 75
.line 76
goto :goto_2
.line 77
:pswitch_2
if-gez p0, :cond_5
.line 78
.line 79
:cond_4
:goto_2
:pswitch_3
add-int/2addr v0, p0
.line 80
return v0
.line 81
:pswitch_4
if-nez v1, :cond_6
.line 82
.line 83
:cond_5
:goto_3
:pswitch_5
return v0
.line 84
:cond_6
new-instance p0, Ljava/lang/ArithmeticException;
.line 85
.line 86
const-string p1, "mode was UNNECESSARY, but rounding was necessary"
.line 87
.line 88
invoke-direct {p0, p1}, Ljava/lang/ArithmeticException;-><init>(Ljava/lang/String;)V
.line 89
.line 90
.line 91
throw p0
.line 92
:cond_7
new-instance p0, Ljava/lang/ArithmeticException;
.line 93
.line 94
const-string p1, "/ by zero"
.line 95
.line 96
invoke-direct {p0, p1}, Ljava/lang/ArithmeticException;-><init>(Ljava/lang/String;)V
.line 97
.line 98
.line 99
throw p0
.line 100
nop
.line 101
:pswitch_data_0
.packed-switch 0x1
:pswitch_4
:pswitch_5
:pswitch_2
:pswitch_3
:pswitch_1
:pswitch_0
:pswitch_0
:pswitch_0
.end packed-switch
.end method
.method public static b(I)I
.locals 4
.line 1
sget-object v0, Ljava/math/RoundingMode;->UNNECESSARY:Ljava/math/RoundingMode;
.line 2
.line 3
if-lez p0, :cond_3
.line 4
.line 5
sget-object v1, Lcom/google/common/math/IntMath$1;->a:[I
.line 6
.line 7
invoke-virtual {v0}, Ljava/lang/Enum;->ordinal()I
.line 8
.line 9
.line 10
move-result v0
.line 11
aget v0, v1, v0
.line 12
.line 13
const/4 v1, 0x1
.line 14
packed-switch v0, :pswitch_data_0
.line 15
.line 16
.line 17
new-instance p0, Ljava/lang/AssertionError;
.line 18
.line 19
invoke-direct {p0}, Ljava/lang/AssertionError;-><init>()V
.line 20
.line 21
.line 22
throw p0
.line 23
:pswitch_0
invoke-static {p0}, Ljava/lang/Integer;->numberOfLeadingZeros(I)I
.line 24
.line 25
.line 26
move-result v0
.line 27
const v1, -0x4afb0ccd
.line 28
.line 29
.line 30
ushr-int/2addr v1, v0
.line 31
rsub-int/lit8 v0, v0, 0x1f
.line 32
.line 33
sub-int/2addr v1, p0
.line 34
not-int p0, v1
.line 35
not-int p0, p0
.line 36
ushr-int/lit8 p0, p0, 0x1f
.line 37
.line 38
add-int/2addr v0, p0
.line 39
return v0
.line 40
:pswitch_1
sub-int/2addr p0, v1
.line 41
invoke-static {p0}, Ljava/lang/Integer;->numberOfLeadingZeros(I)I
.line 42
.line 43
.line 44
move-result p0
.line 45
rsub-int/lit8 p0, p0, 0x20
.line 46
.line 47
return p0
.line 48
:pswitch_2
const/4 v0, 0x0
.line 49
if-lez p0, :cond_0
.line 50
.line 51
move v2, v1
.line 52
goto :goto_0
.line 53
:cond_0
move v2, v0
.line 54
:goto_0
add-int/lit8 v3, p0, -0x1
.line 55
.line 56
and-int/2addr v3, p0
.line 57
if-nez v3, :cond_1
.line 58
.line 59
goto :goto_1
.line 60
:cond_1
move v1, v0
.line 61
:goto_1
and-int v0, v2, v1
.line 62
.line 63
if-eqz v0, :cond_2
.line 64
.line 65
:pswitch_3
invoke-static {p0}, Ljava/lang/Integer;->numberOfLeadingZeros(I)I
.line 66
.line 67
.line 68
move-result p0
.line 69
rsub-int/lit8 p0, p0, 0x1f
.line 70
.line 71
return p0
.line 72
:cond_2
new-instance p0, Ljava/lang/ArithmeticException;
.line 73
.line 74
const-string v0, "mode was UNNECESSARY, but rounding was necessary"
.line 75
.line 76
invoke-direct {p0, v0}, Ljava/lang/ArithmeticException;-><init>(Ljava/lang/String;)V
.line 77
.line 78
.line 79
throw p0
.line 80
:cond_3
new-instance v0, Ljava/lang/IllegalArgumentException;
.line 81
.line 82
const-string v1, "x ("
.line 83
.line 84
const-string v2, ") must be > 0"
.line 85
.line 86
invoke-static {p0, v1, v2}, Landroid/support/v4/media/a;->f(ILjava/lang/String;Ljava/lang/String;)Ljava/lang/String;
.line 87
.line 88
.line 89
move-result-object p0
.line 90
invoke-direct {v0, p0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
.line 91
.line 92
.line 93
throw v0
.line 94
nop
.line 95
:pswitch_data_0
.packed-switch 0x1
:pswitch_2
:pswitch_3
:pswitch_3
:pswitch_1
:pswitch_1
:pswitch_0
:pswitch_0
:pswitch_0
.end packed-switch
.end method