soul-browser/app/smali/androidx/work/impl/utils/PackageManagerHelper.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

237 lines
4.6 KiB
Smali

.class public Landroidx/work/impl/utils/PackageManagerHelper;
.super Ljava/lang/Object;
.source "SourceFile"
# static fields
.field public static final a:Ljava/lang/String;
# direct methods
.method static constructor <clinit>()V
.locals 1
.line 1
const-string v0, "PackageManagerHelper"
.line 2
.line 3
invoke-static {v0}, Landroidx/work/Logger;->e(Ljava/lang/String;)Ljava/lang/String;
.line 4
.line 5
.line 6
move-result-object v0
.line 7
sput-object v0, Landroidx/work/impl/utils/PackageManagerHelper;->a:Ljava/lang/String;
.line 8
.line 9
return-void
.end method
.method public static a(Landroid/content/Context;Ljava/lang/Class;Z)V
.locals 8
.line 1
const-string v0, "disabled"
.line 2
.line 3
const-string v1, "enabled"
.line 4
.line 5
sget-object v2, Landroidx/work/impl/utils/PackageManagerHelper;->a:Ljava/lang/String;
.line 6
.line 7
const/4 v3, 0x0
.line 8
const/4 v4, 0x1
.line 9
:try_start_0
invoke-virtual {p0}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
.line 10
.line 11
.line 12
move-result-object v5
.line 13
new-instance v6, Landroid/content/ComponentName;
.line 14
.line 15
invoke-virtual {p1}, Ljava/lang/Class;->getName()Ljava/lang/String;
.line 16
.line 17
.line 18
move-result-object v7
.line 19
invoke-direct {v6, p0, v7}, Landroid/content/ComponentName;-><init>(Landroid/content/Context;Ljava/lang/String;)V
.line 20
.line 21
.line 22
if-eqz p2, :cond_0
.line 23
.line 24
move p0, v4
.line 25
goto :goto_0
.line 26
:cond_0
const/4 p0, 0x2
.line 27
:goto_0
invoke-virtual {v5, v6, p0, v4}, Landroid/content/pm/PackageManager;->setComponentEnabledSetting(Landroid/content/ComponentName;II)V
.line 28
.line 29
.line 30
invoke-static {}, Landroidx/work/Logger;->c()Landroidx/work/Logger;
.line 31
.line 32
.line 33
move-result-object p0
.line 34
invoke-virtual {p1}, Ljava/lang/Class;->getName()Ljava/lang/String;
.line 35
.line 36
.line 37
move-result-object v5
.line 38
if-eqz p2, :cond_1
.line 39
.line 40
move-object v6, v1
.line 41
goto :goto_1
.line 42
:cond_1
move-object v6, v0
.line 43
:goto_1
new-instance v7, Ljava/lang/StringBuilder;
.line 44
.line 45
invoke-direct {v7}, Ljava/lang/StringBuilder;-><init>()V
.line 46
.line 47
.line 48
invoke-virtual {v7, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
.line 49
.line 50
.line 51
const-string v5, " "
.line 52
.line 53
invoke-virtual {v7, v5}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
.line 54
.line 55
.line 56
invoke-virtual {v7, v6}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
.line 57
.line 58
.line 59
invoke-virtual {v7}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
.line 60
.line 61
.line 62
move-result-object v5
.line 63
new-array v6, v3, [Ljava/lang/Throwable;
.line 64
.line 65
invoke-virtual {p0, v2, v5, v6}, Landroidx/work/Logger;->a(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Throwable;)V
:try_end_0
.catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
.line 66
.line 67
.line 68
return-void
.line 69
:catch_0
move-exception p0
.line 70
invoke-static {}, Landroidx/work/Logger;->c()Landroidx/work/Logger;
.line 71
.line 72
.line 73
move-result-object v5
.line 74
invoke-virtual {p1}, Ljava/lang/Class;->getName()Ljava/lang/String;
.line 75
.line 76
.line 77
move-result-object p1
.line 78
if-eqz p2, :cond_2
.line 79
.line 80
move-object v0, v1
.line 81
:cond_2
const-string p2, " could not be "
.line 82
.line 83
invoke-static {p1, p2, v0}, Landroid/support/v4/media/a;->D(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
.line 84
.line 85
.line 86
move-result-object p1
.line 87
new-array p2, v4, [Ljava/lang/Throwable;
.line 88
.line 89
aput-object p0, p2, v3
.line 90
.line 91
invoke-virtual {v5, v2, p1, p2}, Landroidx/work/Logger;->a(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Throwable;)V
.line 92
.line 93
.line 94
return-void
.end method