soul-browser/app/smali/androidx/profileinstaller/DeviceProfileWriter.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

267 lines
5.4 KiB
Smali

.class public Landroidx/profileinstaller/DeviceProfileWriter;
.super Ljava/lang/Object;
.source "SourceFile"
# annotations
.annotation build Landroidx/annotation/RequiresApi;
.end annotation
.annotation build Landroidx/annotation/RestrictTo;
.end annotation
# instance fields
.field public final a:Ljava/util/concurrent/Executor;
.field public final b:Landroidx/profileinstaller/ProfileInstaller$DiagnosticsCallback;
.field public final c:[B
.field public final d:Ljava/io/File;
.field public final e:Ljava/lang/String;
.field public f:Z
.field public g:[Landroidx/profileinstaller/DexProfileData;
.field public h:[B
# direct methods
.method public constructor <init>(Landroid/content/res/AssetManager;Ljava/util/concurrent/Executor;Landroidx/profileinstaller/ProfileInstaller$DiagnosticsCallback;Ljava/lang/String;Ljava/io/File;)V
.locals 0
.line 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 2
.line 3
.line 4
const/4 p1, 0x0
.line 5
iput-boolean p1, p0, Landroidx/profileinstaller/DeviceProfileWriter;->f:Z
.line 6
.line 7
iput-object p2, p0, Landroidx/profileinstaller/DeviceProfileWriter;->a:Ljava/util/concurrent/Executor;
.line 8
.line 9
iput-object p3, p0, Landroidx/profileinstaller/DeviceProfileWriter;->b:Landroidx/profileinstaller/ProfileInstaller$DiagnosticsCallback;
.line 10
.line 11
iput-object p4, p0, Landroidx/profileinstaller/DeviceProfileWriter;->e:Ljava/lang/String;
.line 12
.line 13
iput-object p5, p0, Landroidx/profileinstaller/DeviceProfileWriter;->d:Ljava/io/File;
.line 14
.line 15
sget p1, Landroid/os/Build$VERSION;->SDK_INT:I
.line 16
.line 17
const/16 p2, 0x18
.line 18
.line 19
const/4 p3, 0x0
.line 20
if-lt p1, p2, :cond_1
.line 21
.line 22
const/16 p2, 0x22
.line 23
.line 24
if-le p1, p2, :cond_0
.line 25
.line 26
goto :goto_0
.line 27
:cond_0
packed-switch p1, :pswitch_data_0
.line 28
.line 29
.line 30
goto :goto_0
.line 31
:pswitch_0
sget-object p3, Landroidx/profileinstaller/ProfileVersion;->a:[B
.line 32
.line 33
goto :goto_0
.line 34
:pswitch_1
sget-object p3, Landroidx/profileinstaller/ProfileVersion;->b:[B
.line 35
.line 36
goto :goto_0
.line 37
:pswitch_2
sget-object p3, Landroidx/profileinstaller/ProfileVersion;->c:[B
.line 38
.line 39
goto :goto_0
.line 40
:pswitch_3
sget-object p3, Landroidx/profileinstaller/ProfileVersion;->d:[B
.line 41
.line 42
goto :goto_0
.line 43
:pswitch_4
sget-object p3, Landroidx/profileinstaller/ProfileVersion;->e:[B
.line 44
.line 45
:cond_1
:goto_0
iput-object p3, p0, Landroidx/profileinstaller/DeviceProfileWriter;->c:[B
.line 46
.line 47
return-void
.line 48
nop
.line 49
:pswitch_data_0
.packed-switch 0x18
:pswitch_4
:pswitch_4
:pswitch_3
:pswitch_2
:pswitch_1
:pswitch_1
:pswitch_1
:pswitch_0
:pswitch_0
:pswitch_0
:pswitch_0
.end packed-switch
.end method
# virtual methods
.method public final a(Landroid/content/res/AssetManager;Ljava/lang/String;)Ljava/io/FileInputStream;
.locals 0
.line 1
:try_start_0
invoke-virtual {p1, p2}, Landroid/content/res/AssetManager;->openFd(Ljava/lang/String;)Landroid/content/res/AssetFileDescriptor;
.line 2
.line 3
.line 4
move-result-object p1
.line 5
invoke-virtual {p1}, Landroid/content/res/AssetFileDescriptor;->createInputStream()Ljava/io/FileInputStream;
.line 6
.line 7
.line 8
move-result-object p1
:try_end_0
.catch Ljava/io/FileNotFoundException; {:try_start_0 .. :try_end_0} :catch_0
.line 9
return-object p1
.line 10
:catch_0
move-exception p1
.line 11
invoke-virtual {p1}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String;
.line 12
.line 13
.line 14
move-result-object p1
.line 15
if-eqz p1, :cond_0
.line 16
.line 17
const-string p2, "compressed"
.line 18
.line 19
invoke-virtual {p1, p2}, Ljava/lang/String;->contains(Ljava/lang/CharSequence;)Z
.line 20
.line 21
.line 22
move-result p1
.line 23
if-eqz p1, :cond_0
.line 24
.line 25
iget-object p1, p0, Landroidx/profileinstaller/DeviceProfileWriter;->b:Landroidx/profileinstaller/ProfileInstaller$DiagnosticsCallback;
.line 26
.line 27
invoke-interface {p1}, Landroidx/profileinstaller/ProfileInstaller$DiagnosticsCallback;->a()V
.line 28
.line 29
.line 30
:cond_0
const/4 p1, 0x0
.line 31
return-object p1
.end method
.method public final b(ILjava/io/Serializable;)V
.locals 2
.line 1
new-instance v0, Landroidx/activity/g;
.line 2
.line 3
const/4 v1, 0x2
.line 4
invoke-direct {v0, p1, v1, p0, p2}, Landroidx/activity/g;-><init>(IILjava/lang/Object;Ljava/lang/Object;)V
.line 5
.line 6
.line 7
iget-object p1, p0, Landroidx/profileinstaller/DeviceProfileWriter;->a:Ljava/util/concurrent/Executor;
.line 8
.line 9
invoke-interface {p1, v0}, Ljava/util/concurrent/Executor;->execute(Ljava/lang/Runnable;)V
.line 10
.line 11
.line 12
return-void
.end method