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

441 lines
8.8 KiB
Smali

.class public Lcom/google/android/gms/common/util/ProcessUtils;
.super Ljava/lang/Object;
.source "SourceFile"
# annotations
.annotation build Lcom/google/android/gms/common/annotation/KeepForSdk;
.end annotation
# static fields
.field private static zza:Ljava/lang/String;
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.end field
.field private static zzb:I
.field private static zzc:Ljava/lang/Boolean;
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.end field
# direct methods
.method private constructor <init>()V
.locals 0
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method public static getMyProcessName()Ljava/lang/String;
.locals 6
.annotation build Landroidx/annotation/Nullable;
.end annotation
.annotation build Lcom/google/android/gms/common/annotation/KeepForSdk;
.end annotation
.line 1
sget-object v0, Lcom/google/android/gms/common/util/ProcessUtils;->zza:Ljava/lang/String;
.line 2
.line 3
if-nez v0, :cond_3
.line 4
.line 5
sget v0, Landroid/os/Build$VERSION;->SDK_INT:I
.line 6
.line 7
const/16 v1, 0x1c
.line 8
.line 9
if-lt v0, v1, :cond_0
.line 10
.line 11
invoke-static {}, Landroid/app/Application;->getProcessName()Ljava/lang/String;
.line 12
.line 13
.line 14
move-result-object v0
.line 15
sput-object v0, Lcom/google/android/gms/common/util/ProcessUtils;->zza:Ljava/lang/String;
.line 16
.line 17
goto :goto_3
.line 18
:cond_0
sget v0, Lcom/google/android/gms/common/util/ProcessUtils;->zzb:I
.line 19
.line 20
if-nez v0, :cond_1
.line 21
.line 22
invoke-static {}, Landroid/os/Process;->myPid()I
.line 23
.line 24
.line 25
move-result v0
.line 26
sput v0, Lcom/google/android/gms/common/util/ProcessUtils;->zzb:I
.line 27
.line 28
:cond_1
const-string v1, "/cmdline"
.line 29
.line 30
const-string v2, "/proc/"
.line 31
.line 32
const/4 v3, 0x0
.line 33
if-gtz v0, :cond_2
.line 34
.line 35
goto :goto_2
.line 36
:cond_2
:try_start_0
invoke-static {v0}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;
.line 37
.line 38
.line 39
move-result-object v4
.line 40
invoke-virtual {v4}, Ljava/lang/String;->length()I
.line 41
.line 42
.line 43
move-result v4
.line 44
add-int/lit8 v4, v4, 0xe
.line 45
.line 46
new-instance v5, Ljava/lang/StringBuilder;
.line 47
.line 48
invoke-direct {v5, v4}, Ljava/lang/StringBuilder;-><init>(I)V
.line 49
.line 50
.line 51
invoke-virtual {v5, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
.line 52
.line 53
.line 54
invoke-virtual {v5, v0}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;
.line 55
.line 56
.line 57
invoke-virtual {v5, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
.line 58
.line 59
.line 60
invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
.line 61
.line 62
.line 63
move-result-object v0
.line 64
invoke-static {}, Landroid/os/StrictMode;->allowThreadDiskReads()Landroid/os/StrictMode$ThreadPolicy;
.line 65
.line 66
.line 67
move-result-object v1
:try_end_0
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_1
.catchall {:try_start_0 .. :try_end_0} :catchall_1
.line 68
:try_start_1
new-instance v2, Ljava/io/BufferedReader;
.line 69
.line 70
new-instance v4, Ljava/io/FileReader;
.line 71
.line 72
invoke-direct {v4, v0}, Ljava/io/FileReader;-><init>(Ljava/lang/String;)V
.line 73
.line 74
.line 75
invoke-direct {v2, v4}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;)V
:try_end_1
.catchall {:try_start_1 .. :try_end_1} :catchall_2
.line 76
.line 77
.line 78
:try_start_2
invoke-static {v1}, Landroid/os/StrictMode;->setThreadPolicy(Landroid/os/StrictMode$ThreadPolicy;)V
:try_end_2
.catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_1
.catchall {:try_start_2 .. :try_end_2} :catchall_1
.line 79
.line 80
.line 81
:try_start_3
invoke-virtual {v2}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;
.line 82
.line 83
.line 84
move-result-object v0
.line 85
invoke-static {v0}, Lcom/google/android/gms/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
.line 86
.line 87
.line 88
invoke-virtual {v0}, Ljava/lang/String;->trim()Ljava/lang/String;
.line 89
.line 90
.line 91
move-result-object v3
:try_end_3
.catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_0
.catchall {:try_start_3 .. :try_end_3} :catchall_0
.line 92
:catch_0
:goto_0
invoke-static {v2}, Lcom/google/android/gms/common/util/IOUtils;->closeQuietly(Ljava/io/Closeable;)V
.line 93
.line 94
.line 95
goto :goto_2
.line 96
:catchall_0
move-exception v0
.line 97
move-object v3, v2
.line 98
goto :goto_1
.line 99
:catchall_1
move-exception v0
.line 100
goto :goto_1
.line 101
:catchall_2
move-exception v0
.line 102
:try_start_4
invoke-static {v1}, Landroid/os/StrictMode;->setThreadPolicy(Landroid/os/StrictMode$ThreadPolicy;)V
.line 103
.line 104
.line 105
throw v0
:try_end_4
.catch Ljava/io/IOException; {:try_start_4 .. :try_end_4} :catch_1
.catchall {:try_start_4 .. :try_end_4} :catchall_1
.line 106
:goto_1
invoke-static {v3}, Lcom/google/android/gms/common/util/IOUtils;->closeQuietly(Ljava/io/Closeable;)V
.line 107
.line 108
.line 109
throw v0
.line 110
:catch_1
move-object v2, v3
.line 111
goto :goto_0
.line 112
:goto_2
sput-object v3, Lcom/google/android/gms/common/util/ProcessUtils;->zza:Ljava/lang/String;
.line 113
.line 114
:cond_3
:goto_3
sget-object v0, Lcom/google/android/gms/common/util/ProcessUtils;->zza:Ljava/lang/String;
.line 115
.line 116
return-object v0
.end method
.method public static zza()Z
.locals 4
.line 1
sget-object v0, Lcom/google/android/gms/common/util/ProcessUtils;->zzc:Ljava/lang/Boolean;
.line 2
.line 3
if-nez v0, :cond_2
.line 4
.line 5
invoke-static {}, Lcom/google/android/gms/common/util/PlatformVersion;->isAtLeastP()Z
.line 6
.line 7
.line 8
move-result v0
.line 9
if-eqz v0, :cond_0
.line 10
.line 11
invoke-static {}, Landroid/os/Process;->isIsolated()Z
.line 12
.line 13
.line 14
move-result v0
.line 15
invoke-static {v0}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;
.line 16
.line 17
.line 18
move-result-object v0
.line 19
goto :goto_0
.line 20
:cond_0
:try_start_0
const-class v0, Landroid/os/Process;
.line 21
.line 22
const/4 v1, 0x0
.line 23
new-array v2, v1, [Lcom/google/android/gms/internal/common/zzi;
.line 24
.line 25
const-string v3, "isIsolated"
.line 26
.line 27
invoke-static {v0, v3, v2}, Lcom/google/android/gms/internal/common/zzj;->a(Ljava/lang/Class;Ljava/lang/String;[Lcom/google/android/gms/internal/common/zzi;)Ljava/lang/Object;
.line 28
.line 29
.line 30
move-result-object v0
.line 31
new-array v1, v1, [Ljava/lang/Object;
.line 32
.line 33
const-string v2, "expected a non-null reference"
.line 34
.line 35
if-eqz v0, :cond_1
.line 36
.line 37
check-cast v0, Ljava/lang/Boolean;
.line 38
.line 39
goto :goto_0
.line 40
:cond_1
new-instance v0, Lcom/google/android/gms/internal/common/zzy;
.line 41
.line 42
invoke-static {v2, v1}, Lcom/google/android/gms/internal/common/zzx;->a(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
.line 43
.line 44
.line 45
move-result-object v1
.line 46
invoke-direct {v0, v1}, Ljava/lang/RuntimeException;-><init>(Ljava/lang/String;)V
.line 47
.line 48
.line 49
throw v0
:try_end_0
.catch Ljava/lang/ReflectiveOperationException; {:try_start_0 .. :try_end_0} :catch_0
.line 50
:catch_0
sget-object v0, Ljava/lang/Boolean;->FALSE:Ljava/lang/Boolean;
.line 51
.line 52
:goto_0
sput-object v0, Lcom/google/android/gms/common/util/ProcessUtils;->zzc:Ljava/lang/Boolean;
.line 53
.line 54
:cond_2
invoke-virtual {v0}, Ljava/lang/Boolean;->booleanValue()Z
.line 55
.line 56
.line 57
move-result v0
.line 58
return v0
.end method