soul-browser/app/smali_classes3/com/google/firebase/components/ComponentDiscovery.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

397 lines
8.2 KiB
Smali

.class public final Lcom/google/firebase/components/ComponentDiscovery;
.super Ljava/lang/Object;
.source "SourceFile"
# annotations
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/google/firebase/components/ComponentDiscovery$MetadataRegistrarNameRetriever;,
Lcom/google/firebase/components/ComponentDiscovery$RegistrarNameRetriever;
}
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">",
"Ljava/lang/Object;"
}
.end annotation
# instance fields
.field public final a:Landroid/content/Context;
# direct methods
.method public constructor <init>(Landroid/content/Context;Lcom/google/firebase/components/ComponentDiscovery$MetadataRegistrarNameRetriever;)V
.locals 0
.line 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 2
.line 3
.line 4
iput-object p1, p0, Lcom/google/firebase/components/ComponentDiscovery;->a:Landroid/content/Context;
.line 5
.line 6
return-void
.end method
.method public static b(Landroid/content/Context;)Lcom/google/firebase/components/ComponentDiscovery;
.locals 2
.line 1
new-instance v0, Lcom/google/firebase/components/ComponentDiscovery;
.line 2
.line 3
new-instance v1, Lcom/google/firebase/components/ComponentDiscovery$MetadataRegistrarNameRetriever;
.line 4
.line 5
invoke-direct {v1}, Ljava/lang/Object;-><init>()V
.line 6
.line 7
.line 8
invoke-direct {v0, p0, v1}, Lcom/google/firebase/components/ComponentDiscovery;-><init>(Landroid/content/Context;Lcom/google/firebase/components/ComponentDiscovery$MetadataRegistrarNameRetriever;)V
.line 9
.line 10
.line 11
return-object v0
.end method
# virtual methods
.method public final a()Ljava/util/ArrayList;
.locals 7
.line 1
new-instance v0, Ljava/util/ArrayList;
.line 2
.line 3
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
.line 4
.line 5
.line 6
iget-object v1, p0, Lcom/google/firebase/components/ComponentDiscovery;->a:Landroid/content/Context;
.line 7
.line 8
const-class v2, Lcom/google/mlkit/common/internal/MlKitComponentDiscoveryService;
.line 9
.line 10
const-string v3, "ComponentDiscovery"
.line 11
.line 12
const/4 v4, 0x0
.line 13
:try_start_0
invoke-virtual {v1}, Landroid/content/Context;->getPackageManager()Landroid/content/pm/PackageManager;
.line 14
.line 15
.line 16
move-result-object v5
.line 17
if-nez v5, :cond_0
.line 18
.line 19
const-string v1, "Context has no PackageManager."
.line 20
.line 21
invoke-static {v3, v1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
.line 22
.line 23
.line 24
goto :goto_0
.line 25
:cond_0
new-instance v6, Landroid/content/ComponentName;
.line 26
.line 27
invoke-direct {v6, v1, v2}, Landroid/content/ComponentName;-><init>(Landroid/content/Context;Ljava/lang/Class;)V
.line 28
.line 29
.line 30
const/16 v1, 0x80
.line 31
.line 32
invoke-virtual {v5, v6, v1}, Landroid/content/pm/PackageManager;->getServiceInfo(Landroid/content/ComponentName;I)Landroid/content/pm/ServiceInfo;
.line 33
.line 34
.line 35
move-result-object v1
.line 36
if-nez v1, :cond_1
.line 37
.line 38
new-instance v1, Ljava/lang/StringBuilder;
.line 39
.line 40
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
.line 41
.line 42
.line 43
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
.line 44
.line 45
.line 46
const-string v2, " has no service info."
.line 47
.line 48
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
.line 49
.line 50
.line 51
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
.line 52
.line 53
.line 54
move-result-object v1
.line 55
invoke-static {v3, v1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
.line 56
.line 57
.line 58
goto :goto_0
.line 59
:cond_1
iget-object v4, v1, Landroid/content/pm/ServiceInfo;->metaData:Landroid/os/Bundle;
:try_end_0
.catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_0 .. :try_end_0} :catch_0
.line 60
.line 61
goto :goto_0
.line 62
:catch_0
const-string v1, "Application info not found."
.line 63
.line 64
invoke-static {v3, v1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
.line 65
.line 66
.line 67
:goto_0
if-nez v4, :cond_2
.line 68
.line 69
const-string v1, "Could not retrieve metadata, returning empty list of registrars."
.line 70
.line 71
invoke-static {v3, v1}, Landroid/util/Log;->w(Ljava/lang/String;Ljava/lang/String;)I
.line 72
.line 73
.line 74
sget-object v1, Ljava/util/Collections;->EMPTY_LIST:Ljava/util/List;
.line 75
.line 76
goto :goto_2
.line 77
:cond_2
new-instance v1, Ljava/util/ArrayList;
.line 78
.line 79
invoke-direct {v1}, Ljava/util/ArrayList;-><init>()V
.line 80
.line 81
.line 82
invoke-virtual {v4}, Landroid/os/BaseBundle;->keySet()Ljava/util/Set;
.line 83
.line 84
.line 85
move-result-object v2
.line 86
invoke-interface {v2}, Ljava/util/Set;->iterator()Ljava/util/Iterator;
.line 87
.line 88
.line 89
move-result-object v2
.line 90
:cond_3
:goto_1
invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z
.line 91
.line 92
.line 93
move-result v3
.line 94
if-eqz v3, :cond_4
.line 95
.line 96
invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;
.line 97
.line 98
.line 99
move-result-object v3
.line 100
check-cast v3, Ljava/lang/String;
.line 101
.line 102
invoke-virtual {v4, v3}, Landroid/os/BaseBundle;->get(Ljava/lang/String;)Ljava/lang/Object;
.line 103
.line 104
.line 105
move-result-object v5
.line 106
const-string v6, "com.google.firebase.components.ComponentRegistrar"
.line 107
.line 108
invoke-virtual {v6, v5}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
.line 109
.line 110
.line 111
move-result v5
.line 112
if-eqz v5, :cond_3
.line 113
.line 114
const-string v5, "com.google.firebase.components:"
.line 115
.line 116
invoke-virtual {v3, v5}, Ljava/lang/String;->startsWith(Ljava/lang/String;)Z
.line 117
.line 118
.line 119
move-result v5
.line 120
if-eqz v5, :cond_3
.line 121
.line 122
const/16 v5, 0x1f
.line 123
.line 124
invoke-virtual {v3, v5}, Ljava/lang/String;->substring(I)Ljava/lang/String;
.line 125
.line 126
.line 127
move-result-object v3
.line 128
invoke-virtual {v1, v3}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
.line 129
.line 130
.line 131
goto :goto_1
.line 132
:cond_4
:goto_2
invoke-interface {v1}, Ljava/util/List;->iterator()Ljava/util/Iterator;
.line 133
.line 134
.line 135
move-result-object v1
.line 136
:goto_3
invoke-interface {v1}, Ljava/util/Iterator;->hasNext()Z
.line 137
.line 138
.line 139
move-result v2
.line 140
if-eqz v2, :cond_5
.line 141
.line 142
invoke-interface {v1}, Ljava/util/Iterator;->next()Ljava/lang/Object;
.line 143
.line 144
.line 145
move-result-object v2
.line 146
check-cast v2, Ljava/lang/String;
.line 147
.line 148
new-instance v3, Lcom/google/firebase/components/ComponentDiscovery$$Lambda$1;
.line 149
.line 150
invoke-direct {v3, v2}, Lcom/google/firebase/components/ComponentDiscovery$$Lambda$1;-><init>(Ljava/lang/String;)V
.line 151
.line 152
.line 153
invoke-virtual {v0, v3}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
.line 154
.line 155
.line 156
goto :goto_3
.line 157
:cond_5
return-object v0
.end method