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

377 lines
8.2 KiB
Smali

.class public final Lcom/google/android/gms/common/util/IOUtils;
.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
.annotation runtime Ljava/lang/Deprecated;
.end annotation
# direct methods
.method private constructor <init>()V
.locals 0
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
return-void
.end method
.method public static closeQuietly(Landroid/os/ParcelFileDescriptor;)V
.locals 0
.param p0 # Landroid/os/ParcelFileDescriptor;
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.end param
.annotation build Lcom/google/android/gms/common/annotation/KeepForSdk;
.end annotation
if-eqz p0, :cond_0
.line 1
:try_start_0
invoke-virtual {p0}, Landroid/os/ParcelFileDescriptor;->close()V
:try_end_0
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
:catch_0
:cond_0
return-void
.end method
.method public static closeQuietly(Ljava/io/Closeable;)V
.locals 0
.param p0 # Ljava/io/Closeable;
.annotation runtime Ljavax/annotation/Nullable;
.end annotation
.end param
.annotation build Lcom/google/android/gms/common/annotation/KeepForSdk;
.end annotation
if-eqz p0, :cond_0
.line 2
:try_start_0
invoke-interface {p0}, Ljava/io/Closeable;->close()V
:try_end_0
.catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0
:catch_0
:cond_0
return-void
.end method
.method public static copyStream(Ljava/io/InputStream;Ljava/io/OutputStream;)J
.locals 2
.param p0 # Ljava/io/InputStream;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.param p1 # Ljava/io/OutputStream;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Lcom/google/android/gms/common/annotation/KeepForSdk;
.end annotation
.annotation runtime Ljava/lang/Deprecated;
.end annotation
const/4 v0, 0x0
const/16 v1, 0x400
.line 1
invoke-static {p0, p1, v0, v1}, Lcom/google/android/gms/common/util/IOUtils;->copyStream(Ljava/io/InputStream;Ljava/io/OutputStream;ZI)J
move-result-wide p0
return-wide p0
.end method
.method public static copyStream(Ljava/io/InputStream;Ljava/io/OutputStream;ZI)J
.locals 7
.param p0 # Ljava/io/InputStream;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.param p1 # Ljava/io/OutputStream;
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Lcom/google/android/gms/common/annotation/KeepForSdk;
.end annotation
.annotation runtime Ljava/lang/Deprecated;
.end annotation
.line 2
new-array v0, p3, [B
const-wide/16 v1, 0x0
:goto_0
const/4 v3, 0x0
.line 3
:try_start_0
invoke-virtual {p0, v0, v3, p3}, Ljava/io/InputStream;->read([BII)I
move-result v4
const/4 v5, -0x1
if-eq v4, v5, :cond_0
int-to-long v5, v4
add-long/2addr v1, v5
.line 4
invoke-virtual {p1, v0, v3, v4}, Ljava/io/OutputStream;->write([BII)V
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
goto :goto_0
:catchall_0
move-exception p3
goto :goto_1
:cond_0
if-eqz p2, :cond_1
.line 5
invoke-static {p0}, Lcom/google/android/gms/common/util/IOUtils;->closeQuietly(Ljava/io/Closeable;)V
.line 6
invoke-static {p1}, Lcom/google/android/gms/common/util/IOUtils;->closeQuietly(Ljava/io/Closeable;)V
:cond_1
return-wide v1
:goto_1
if-nez p2, :cond_2
goto :goto_2
.line 7
:cond_2
invoke-static {p0}, Lcom/google/android/gms/common/util/IOUtils;->closeQuietly(Ljava/io/Closeable;)V
.line 8
invoke-static {p1}, Lcom/google/android/gms/common/util/IOUtils;->closeQuietly(Ljava/io/Closeable;)V
.line 9
:goto_2
throw p3
.end method
.method public static isGzipByteBuffer([B)Z
.locals 3
.param p0 # [B
.annotation build Landroidx/annotation/NonNull;
.end annotation
.end param
.annotation build Lcom/google/android/gms/common/annotation/KeepForSdk;
.end annotation
.line 1
array-length v0, p0
.line 2
const/4 v1, 0x0
.line 3
const/4 v2, 0x1
.line 4
if-le v0, v2, :cond_0
.line 5
.line 6
aget-byte v0, p0, v1
.line 7
.line 8
and-int/lit16 v0, v0, 0xff
.line 9
.line 10
aget-byte p0, p0, v2
.line 11
.line 12
and-int/lit16 p0, p0, 0xff
.line 13
.line 14
shl-int/lit8 p0, p0, 0x8
.line 15
.line 16
or-int/2addr p0, v0
.line 17
const v0, 0x8b1f
.line 18
.line 19
.line 20
if-ne p0, v0, :cond_0
.line 21
.line 22
return v2
.line 23
:cond_0
return v1
.end method
.method public static readInputStreamFully(Ljava/io/InputStream;)[B
.locals 1
.param p0 # Ljava/io/InputStream;
.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 runtime Ljava/lang/Deprecated;
.end annotation
const/4 v0, 0x1
.line 1
invoke-static {p0, v0}, Lcom/google/android/gms/common/util/IOUtils;->readInputStreamFully(Ljava/io/InputStream;Z)[B
move-result-object p0
return-object p0
.end method
.method public static readInputStreamFully(Ljava/io/InputStream;Z)[B
.locals 2
.param p0 # Ljava/io/InputStream;
.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 runtime Ljava/lang/Deprecated;
.end annotation
.line 2
new-instance v0, Ljava/io/ByteArrayOutputStream;
invoke-direct {v0}, Ljava/io/ByteArrayOutputStream;-><init>()V
const/16 v1, 0x400
.line 3
invoke-static {p0, v0, p1, v1}, Lcom/google/android/gms/common/util/IOUtils;->copyStream(Ljava/io/InputStream;Ljava/io/OutputStream;ZI)J
.line 4
invoke-virtual {v0}, Ljava/io/ByteArrayOutputStream;->toByteArray()[B
move-result-object p0
return-object p0
.end method
.method public static toByteArray(Ljava/io/InputStream;)[B
.locals 4
.param p0 # Ljava/io/InputStream;
.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 runtime Ljava/lang/Deprecated;
.end annotation
.line 1
new-instance v0, Ljava/io/ByteArrayOutputStream;
.line 2
.line 3
invoke-direct {v0}, Ljava/io/ByteArrayOutputStream;-><init>()V
.line 4
.line 5
.line 6
invoke-static {p0}, Lcom/google/android/gms/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
.line 7
.line 8
.line 9
invoke-static {v0}, Lcom/google/android/gms/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
.line 10
.line 11
.line 12
const/16 v1, 0x1000
.line 13
.line 14
new-array v1, v1, [B
.line 15
.line 16
:goto_0
invoke-virtual {p0, v1}, Ljava/io/InputStream;->read([B)I
.line 17
.line 18
.line 19
move-result v2
.line 20
const/4 v3, -0x1
.line 21
if-ne v2, v3, :cond_0
.line 22
.line 23
invoke-virtual {v0}, Ljava/io/ByteArrayOutputStream;->toByteArray()[B
.line 24
.line 25
.line 26
move-result-object p0
.line 27
return-object p0
.line 28
:cond_0
const/4 v3, 0x0
.line 29
invoke-virtual {v0, v1, v3, v2}, Ljava/io/OutputStream;->write([BII)V
.line 30
.line 31
.line 32
goto :goto_0
.end method