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

537 lines
13 KiB
Smali

.class public Lcom/google/android/gms/common/PackageSignatureVerifier;
.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 static volatile zza:Lcom/google/android/gms/common/zzac;
.annotation build Landroidx/annotation/Nullable;
.end annotation
.annotation build Landroidx/annotation/VisibleForTesting;
.end annotation
.end field
.field private static zzb:Lcom/google/android/gms/common/zzad;
.annotation build Landroidx/annotation/Nullable;
.end annotation
.end field
# direct methods
.method public constructor <init>()V
.locals 0
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method private static declared-synchronized zza(Landroid/content/Context;)Lcom/google/android/gms/common/zzad;
.locals 2
.line 1
const-class v0, Lcom/google/android/gms/common/PackageSignatureVerifier;
.line 2
.line 3
monitor-enter v0
.line 4
:try_start_0
sget-object v1, Lcom/google/android/gms/common/PackageSignatureVerifier;->zzb:Lcom/google/android/gms/common/zzad;
.line 5
.line 6
if-nez v1, :cond_0
.line 7
.line 8
new-instance v1, Lcom/google/android/gms/common/zzad;
.line 9
.line 10
invoke-direct {v1, p0}, Lcom/google/android/gms/common/zzad;-><init>(Landroid/content/Context;)V
.line 11
.line 12
.line 13
sput-object v1, Lcom/google/android/gms/common/PackageSignatureVerifier;->zzb:Lcom/google/android/gms/common/zzad;
.line 14
.line 15
goto :goto_0
.line 16
:catchall_0
move-exception p0
.line 17
goto :goto_1
.line 18
:cond_0
:goto_0
sget-object p0, Lcom/google/android/gms/common/PackageSignatureVerifier;->zzb:Lcom/google/android/gms/common/zzad;
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 19
.line 20
monitor-exit v0
.line 21
return-object p0
.line 22
:goto_1
:try_start_1
monitor-exit v0
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
.line 23
throw p0
.end method
# virtual methods
.method public queryPackageSignatureVerified(Landroid/content/Context;Ljava/lang/String;)Lcom/google/android/gms/common/PackageVerificationResult;
.locals 3
.param p1 # Landroid/content/Context;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.param p2 # 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
.annotation build Lcom/google/android/gms/common/internal/ShowFirstParty;
.end annotation
.line 1
invoke-static {p1}, Lcom/google/android/gms/common/GooglePlayServicesUtilLight;->honorsDebugCertificates(Landroid/content/Context;)Z
.line 2
.line 3
.line 4
move-result v0
.line 5
invoke-static {p1}, Lcom/google/android/gms/common/PackageSignatureVerifier;->zza(Landroid/content/Context;)Lcom/google/android/gms/common/zzad;
.line 6
.line 7
.line 8
sget v1, Lcom/google/android/gms/common/zzo;->zzh:I
.line 9
.line 10
invoke-static {}, Landroid/os/StrictMode;->allowThreadDiskReads()Landroid/os/StrictMode$ThreadPolicy;
.line 11
.line 12
.line 13
move-result-object v1
.line 14
:try_start_0
invoke-static {}, Lcom/google/android/gms/common/zzo;->zzb()V
.line 15
.line 16
.line 17
sget-object v2, Lcom/google/android/gms/common/zzo;->zzg:Lcom/google/android/gms/common/internal/zzad;
.line 18
.line 19
invoke-interface {v2}, Lcom/google/android/gms/common/internal/zzad;->zzi()Z
.line 20
.line 21
.line 22
move-result v2
:try_end_0
.catch Lcom/google/android/gms/dynamite/DynamiteModule$LoadingException; {:try_start_0 .. :try_end_0} :catch_1
.catch Landroid/os/RemoteException; {:try_start_0 .. :try_end_0} :catch_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
.line 23
invoke-static {v1}, Landroid/os/StrictMode;->setThreadPolicy(Landroid/os/StrictMode$ThreadPolicy;)V
.line 24
.line 25
.line 26
if-eqz v2, :cond_3
.line 27
.line 28
invoke-static {}, Lcom/google/android/gms/common/signatureverification/SignatureVerificationConfigurationProvider;->zza()Lcom/google/android/gms/common/signatureverification/SignatureVerificationConfiguration;
.line 29
.line 30
.line 31
move-result-object v1
.line 32
invoke-interface {v1}, Lcom/google/android/gms/common/signatureverification/SignatureVerificationConfiguration;->zza()Lcom/google/android/gms/common/signatureverification/SignatureVerificationLogger;
.line 33
.line 34
.line 35
invoke-static {p2}, Ljava/lang/String;->valueOf(Ljava/lang/Object;)Ljava/lang/String;
.line 36
.line 37
.line 38
move-result-object v1
.line 39
const/4 v2, 0x1
.line 40
if-eq v2, v0, :cond_0
.line 41
.line 42
const-string v2, "-0"
.line 43
.line 44
goto :goto_0
.line 45
:cond_0
const-string v2, "-1"
.line 46
.line 47
:goto_0
invoke-virtual {v1, v2}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
.line 48
.line 49
.line 50
move-result-object v1
.line 51
sget-object v2, Lcom/google/android/gms/common/PackageSignatureVerifier;->zza:Lcom/google/android/gms/common/zzac;
.line 52
.line 53
if-eqz v2, :cond_1
.line 54
.line 55
sget-object v2, Lcom/google/android/gms/common/PackageSignatureVerifier;->zza:Lcom/google/android/gms/common/zzac;
.line 56
.line 57
invoke-virtual {v2}, Lcom/google/android/gms/common/zzac;->zza()Ljava/lang/String;
.line 58
.line 59
.line 60
move-result-object v2
.line 61
invoke-virtual {v2, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
.line 62
.line 63
.line 64
move-result v2
.line 65
if-eqz v2, :cond_1
.line 66
.line 67
sget-object p1, Lcom/google/android/gms/common/PackageSignatureVerifier;->zza:Lcom/google/android/gms/common/zzac;
.line 68
.line 69
invoke-virtual {p1}, Lcom/google/android/gms/common/zzac;->zzb()Lcom/google/android/gms/common/PackageVerificationResult;
.line 70
.line 71
.line 72
move-result-object p1
.line 73
return-object p1
.line 74
:cond_1
invoke-virtual {p2}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
.line 75
.line 76
.line 77
invoke-static {p1}, Lcom/google/android/gms/common/PackageSignatureVerifier;->zza(Landroid/content/Context;)Lcom/google/android/gms/common/zzad;
.line 78
.line 79
.line 80
new-instance p1, Lcom/google/android/gms/common/zzv;
.line 81
.line 82
const/4 v2, 0x0
.line 83
invoke-direct {p1, v2}, Lcom/google/android/gms/common/zzv;-><init>([B)V
.line 84
.line 85
.line 86
invoke-virtual {p1, p2}, Lcom/google/android/gms/common/zzv;->zza(Ljava/lang/String;)Lcom/google/android/gms/common/zzv;
.line 87
.line 88
.line 89
invoke-virtual {p1, v0}, Lcom/google/android/gms/common/zzv;->zzb(Z)Lcom/google/android/gms/common/zzv;
.line 90
.line 91
.line 92
const/4 v0, 0x0
.line 93
invoke-virtual {p1, v0}, Lcom/google/android/gms/common/zzv;->zzc(Z)Lcom/google/android/gms/common/zzv;
.line 94
.line 95
.line 96
invoke-virtual {p1}, Lcom/google/android/gms/common/zzv;->zzd()Lcom/google/android/gms/common/zzw;
.line 97
.line 98
.line 99
move-result-object p1
.line 100
invoke-static {p1}, Lcom/google/android/gms/common/zzo;->zzc(Lcom/google/android/gms/common/zzw;)Lcom/google/android/gms/common/zzy;
.line 101
.line 102
.line 103
move-result-object p1
.line 104
iget-boolean v0, p1, Lcom/google/android/gms/common/zzy;->zza:Z
.line 105
.line 106
if-eqz v0, :cond_2
.line 107
.line 108
iget p1, p1, Lcom/google/android/gms/common/zzy;->zzd:I
.line 109
.line 110
invoke-static {p2, p1, v2}, Lcom/google/android/gms/common/PackageVerificationResult;->zzd(Ljava/lang/String;ILcom/google/android/gms/common/signatureverification/zza;)Lcom/google/android/gms/common/PackageVerificationResult;
.line 111
.line 112
.line 113
move-result-object p1
.line 114
new-instance p2, Lcom/google/android/gms/common/zzac;
.line 115
.line 116
invoke-direct {p2, v1, p1}, Lcom/google/android/gms/common/zzac;-><init>(Ljava/lang/String;Lcom/google/android/gms/common/PackageVerificationResult;)V
.line 117
.line 118
.line 119
sput-object p2, Lcom/google/android/gms/common/PackageSignatureVerifier;->zza:Lcom/google/android/gms/common/zzac;
.line 120
.line 121
return-object p1
.line 122
:cond_2
iget-object v0, p1, Lcom/google/android/gms/common/zzy;->zzb:Ljava/lang/String;
.line 123
.line 124
invoke-static {v0}, Lcom/google/android/gms/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
.line 125
.line 126
.line 127
iget-object p1, p1, Lcom/google/android/gms/common/zzy;->zzc:Ljava/lang/Throwable;
.line 128
.line 129
invoke-static {p2, v0, p1, v2}, Lcom/google/android/gms/common/PackageVerificationResult;->zza(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;Lcom/google/android/gms/common/signatureverification/zza;)Lcom/google/android/gms/common/PackageVerificationResult;
.line 130
.line 131
.line 132
move-result-object p1
.line 133
return-object p1
.line 134
:catchall_0
move-exception p1
.line 135
goto :goto_2
.line 136
:catch_0
move-exception p1
.line 137
goto :goto_1
.line 138
:catch_1
move-exception p1
.line 139
:goto_1
:try_start_1
const-string p2, "GoogleCertificates"
.line 140
.line 141
const-string v0, "Failed to get Google certificates from remote"
.line 142
.line 143
invoke-static {p2, v0, p1}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_0
.line 144
.line 145
.line 146
invoke-static {v1}, Landroid/os/StrictMode;->setThreadPolicy(Landroid/os/StrictMode$ThreadPolicy;)V
.line 147
.line 148
.line 149
:cond_3
new-instance p1, Lcom/google/android/gms/common/zzae;
.line 150
.line 151
invoke-direct {p1}, Lcom/google/android/gms/common/zzae;-><init>()V
.line 152
.line 153
.line 154
throw p1
.line 155
:goto_2
invoke-static {v1}, Landroid/os/StrictMode;->setThreadPolicy(Landroid/os/StrictMode$ThreadPolicy;)V
.line 156
.line 157
.line 158
throw p1
.end method
.method public queryPackageSignatureVerifiedWithRetry(Landroid/content/Context;Ljava/lang/String;)Lcom/google/android/gms/common/PackageVerificationResult;
.locals 2
.param p1 # Landroid/content/Context;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.param p2 # 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
.annotation build Lcom/google/android/gms/common/internal/ShowFirstParty;
.end annotation
.line 1
:try_start_0
invoke-virtual {p0, p1, p2}, Lcom/google/android/gms/common/PackageSignatureVerifier;->queryPackageSignatureVerified(Landroid/content/Context;Ljava/lang/String;)Lcom/google/android/gms/common/PackageVerificationResult;
.line 2
.line 3
.line 4
move-result-object v0
.line 5
invoke-virtual {v0}, Lcom/google/android/gms/common/PackageVerificationResult;->zzc()V
:try_end_0
.catch Ljava/lang/SecurityException; {:try_start_0 .. :try_end_0} :catch_0
.line 6
.line 7
.line 8
return-object v0
.line 9
:catch_0
move-exception v0
.line 10
invoke-virtual {p0, p1, p2}, Lcom/google/android/gms/common/PackageSignatureVerifier;->queryPackageSignatureVerified(Landroid/content/Context;Ljava/lang/String;)Lcom/google/android/gms/common/PackageVerificationResult;
.line 11
.line 12
.line 13
move-result-object p1
.line 14
invoke-virtual {p1}, Lcom/google/android/gms/common/PackageVerificationResult;->zzb()Z
.line 15
.line 16
.line 17
move-result p2
.line 18
if-eqz p2, :cond_0
.line 19
.line 20
const-string p2, "PkgSignatureVerifier"
.line 21
.line 22
const-string v1, "Got flaky result during package signature verification"
.line 23
.line 24
invoke-static {p2, v1, v0}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I
.line 25
.line 26
.line 27
:cond_0
return-object p1
.end method