soul-browser/app/smali/com/google/android/gms/common/util/Hex.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

394 lines
6.8 KiB
Smali

.class public Lcom/google/android/gms/common/util/Hex;
.super Ljava/lang/Object;
.source "SourceFile"
# annotations
.annotation build Lcom/google/android/gms/common/annotation/KeepForSdk;
.end annotation
.annotation build Lcom/google/android/gms/common/internal/ShowFirstParty;
.end annotation
# static fields
.field private static final zza:[C
.field private static final zzb:[C
# direct methods
.method static constructor <clinit>()V
.locals 2
const/16 v0, 0x10
new-array v1, v0, [C
fill-array-data v1, :array_0
sput-object v1, Lcom/google/android/gms/common/util/Hex;->zza:[C
new-array v0, v0, [C
fill-array-data v0, :array_1
sput-object v0, Lcom/google/android/gms/common/util/Hex;->zzb:[C
return-void
nop
:array_0
.array-data 2
0x30s
0x31s
0x32s
0x33s
0x34s
0x35s
0x36s
0x37s
0x38s
0x39s
0x41s
0x42s
0x43s
0x44s
0x45s
0x46s
.end array-data
:array_1
.array-data 2
0x30s
0x31s
0x32s
0x33s
0x34s
0x35s
0x36s
0x37s
0x38s
0x39s
0x61s
0x62s
0x63s
0x64s
0x65s
0x66s
.end array-data
.end method
.method public constructor <init>()V
.locals 0
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method public static bytesToStringLowercase([B)Ljava/lang/String;
.locals 7
.param p0 # [B
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroidx/annotation/NonNull;
.end annotation
.annotation build Lcom/google/android/gms/common/annotation/KeepForSdk;
.end annotation
.line 1
array-length v0, p0
.line 2
add-int/2addr v0, v0
.line 3
new-array v0, v0, [C
.line 4
.line 5
const/4 v1, 0x0
.line 6
move v2, v1
.line 7
:goto_0
array-length v3, p0
.line 8
if-ge v1, v3, :cond_0
.line 9
.line 10
aget-byte v3, p0, v1
.line 11
.line 12
and-int/lit16 v4, v3, 0xff
.line 13
.line 14
add-int/lit8 v5, v2, 0x1
.line 15
.line 16
sget-object v6, Lcom/google/android/gms/common/util/Hex;->zzb:[C
.line 17
.line 18
ushr-int/lit8 v4, v4, 0x4
.line 19
.line 20
aget-char v4, v6, v4
.line 21
.line 22
aput-char v4, v0, v2
.line 23
.line 24
and-int/lit8 v3, v3, 0xf
.line 25
.line 26
aget-char v3, v6, v3
.line 27
.line 28
aput-char v3, v0, v5
.line 29
.line 30
add-int/lit8 v2, v2, 0x2
.line 31
.line 32
add-int/lit8 v1, v1, 0x1
.line 33
.line 34
goto :goto_0
.line 35
:cond_0
new-instance p0, Ljava/lang/String;
.line 36
.line 37
invoke-direct {p0, v0}, Ljava/lang/String;-><init>([C)V
.line 38
.line 39
.line 40
return-object p0
.end method
.method public static bytesToStringUppercase([B)Ljava/lang/String;
.locals 1
.param p0 # [B
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroidx/annotation/NonNull;
.end annotation
.annotation build Lcom/google/android/gms/common/annotation/KeepForSdk;
.end annotation
const/4 v0, 0x0
.line 1
invoke-static {p0, v0}, Lcom/google/android/gms/common/util/Hex;->bytesToStringUppercase([BZ)Ljava/lang/String;
move-result-object p0
return-object p0
.end method
.method public static bytesToStringUppercase([BZ)Ljava/lang/String;
.locals 5
.param p0 # [B
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroidx/annotation/NonNull;
.end annotation
.annotation build Lcom/google/android/gms/common/annotation/KeepForSdk;
.end annotation
.line 2
array-length v0, p0
add-int v1, v0, v0
new-instance v2, Ljava/lang/StringBuilder;
.line 3
invoke-direct {v2, v1}, Ljava/lang/StringBuilder;-><init>(I)V
const/4 v1, 0x0
:goto_0
if-ge v1, v0, :cond_1
if-eqz p1, :cond_0
add-int/lit8 v3, v0, -0x1
if-ne v1, v3, :cond_0
.line 4
aget-byte v3, p0, v1
and-int/lit16 v3, v3, 0xff
if-eqz v3, :cond_1
:cond_0
sget-object v3, Lcom/google/android/gms/common/util/Hex;->zza:[C
.line 5
aget-byte v4, p0, v1
and-int/lit16 v4, v4, 0xf0
ushr-int/lit8 v4, v4, 0x4
aget-char v4, v3, v4
invoke-virtual {v2, v4}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
.line 6
aget-byte v4, p0, v1
and-int/lit8 v4, v4, 0xf
aget-char v3, v3, v4
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(C)Ljava/lang/StringBuilder;
add-int/lit8 v1, v1, 0x1
goto :goto_0
:cond_1
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object p0
return-object p0
.end method
.method public static stringToBytes(Ljava/lang/String;)[B
.locals 6
.param p0 # Ljava/lang/String;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Landroidx/annotation/NonNull;
.end annotation
.annotation build Lcom/google/android/gms/common/annotation/KeepForSdk;
.end annotation
.line 1
invoke-virtual {p0}, Ljava/lang/String;->length()I
.line 2
.line 3
.line 4
move-result v0
.line 5
rem-int/lit8 v1, v0, 0x2
.line 6
.line 7
if-nez v1, :cond_1
.line 8
.line 9
div-int/lit8 v1, v0, 0x2
.line 10
.line 11
new-array v1, v1, [B
.line 12
.line 13
const/4 v2, 0x0
.line 14
:goto_0
if-ge v2, v0, :cond_0
.line 15
.line 16
div-int/lit8 v3, v2, 0x2
.line 17
.line 18
add-int/lit8 v4, v2, 0x2
.line 19
.line 20
invoke-virtual {p0, v2, v4}, Ljava/lang/String;->substring(II)Ljava/lang/String;
.line 21
.line 22
.line 23
move-result-object v2
.line 24
const/16 v5, 0x10
.line 25
.line 26
invoke-static {v2, v5}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;I)I
.line 27
.line 28
.line 29
move-result v2
.line 30
int-to-byte v2, v2
.line 31
aput-byte v2, v1, v3
.line 32
.line 33
move v2, v4
.line 34
goto :goto_0
.line 35
:cond_0
return-object v1
.line 36
:cond_1
new-instance p0, Ljava/lang/IllegalArgumentException;
.line 37
.line 38
const-string v0, "Hex string has odd number of characters"
.line 39
.line 40
invoke-direct {p0, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
.line 41
.line 42
.line 43
throw p0
.end method