soul-browser/app/smali/com/google/android/gms/dynamic/ObjectWrapper.smali
KaKi87 e2c18960ec
Fix PDF translation stuck on "Updating the text module" (#22)
* Bundle on-device ML Kit OCR to fix PDF translation hang

Sideloaded builds never receive Play Services install-time OCR modules, so
image/PDF translation could sit forever on "Updating the text module".
Ship bundled text-recognition models/native code via the build script, and
cap DialogOcrLoad retries so the wait dialog cannot loop indefinitely.
Bump version to 2.0.0-testing.36.

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Add GMS dynamic API aliases for bundled OCR

Bundled text-recognition-common calls IObjectWrapper.Stub.asInterface and
ObjectWrapper.unwrap, but R8 renamed those to I1/f2 in this APK. Add public
aliases so OCR init no longer throws NoSuchMethodError. Bump to 2.0.0-testing.37.

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Restore ImageUtils APIs required by bundled OCR

text-recognition-bundled-common calls ImageUtils.getInstance and
getUprightRotationMatrix, which R8 had stripped from vision-common.
Restore those methods, add ImageConvertUtils buffer helpers and
ObjectWrapper.wrap for the same public API surface. Bump to 2.0.0-testing.38.

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Move restored ImageUtils helpers to smali_classes4

classes3 is at the DEX method-ref ceiling; relocating ImageUtils and
ImageConvertUtils keeps apktool builds reliable after restoring the
bundled-OCR public APIs.

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Download ML Kit OCR models at runtime from Maven

Stop packaging OCR assets and native libs into the APK. DialogOcrLoad now
fetches text-recognition AARs from Google Maven, extracts models + the
pipeline .so, and activates them via System.load / AssetManager.addAssetPath.
Keep only the small module dex in the APK (JVM jars cannot be loaded on-device).
Bump to 2.0.0-testing.39.

Co-authored-by: KaKi87 <KaKi87@pm.me>

* Move OCR install helpers to smali_classes4

Avoid DEX method-ref overflow in classes3 when assembling DialogOcrLoad
install task/progress classes.

Co-authored-by: KaKi87 <KaKi87@pm.me>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-08-12 16:53:38 +02:00

327 lines
6.7 KiB
Smali

.class public final Lcom/google/android/gms/dynamic/ObjectWrapper;
.super Lcom/google/android/gms/dynamic/IObjectWrapper$Stub;
.source "SourceFile"
# annotations
.annotation build Lcom/google/android/gms/common/annotation/KeepForSdk;
.end annotation
.annotation build Lcom/google/android/gms/common/util/RetainForClient;
.end annotation
.annotation system Ldalvik/annotation/Signature;
value = {
"<T:",
"Ljava/lang/Object;",
">",
"Lcom/google/android/gms/dynamic/IObjectWrapper$Stub;"
}
.end annotation
# instance fields
.field public final c:Ljava/lang/Object;
# direct methods
.method public constructor <init>(Ljava/lang/Object;)V
.locals 1
.line 1
const-string v0, "com.google.android.gms.dynamic.IObjectWrapper"
.line 2
.line 3
invoke-direct {p0, v0}, Lcom/google/android/gms/internal/common/zzb;-><init>(Ljava/lang/String;)V
.line 4
.line 5
.line 6
iput-object p1, p0, Lcom/google/android/gms/dynamic/ObjectWrapper;->c:Ljava/lang/Object;
.line 7
.line 8
return-void
.end method
.method public static f2(Lcom/google/android/gms/dynamic/IObjectWrapper;)Ljava/lang/Object;
.locals 7
.line 1
instance-of v0, p0, Lcom/google/android/gms/dynamic/ObjectWrapper;
.line 2
.line 3
if-eqz v0, :cond_0
.line 4
.line 5
check-cast p0, Lcom/google/android/gms/dynamic/ObjectWrapper;
.line 6
.line 7
iget-object p0, p0, Lcom/google/android/gms/dynamic/ObjectWrapper;->c:Ljava/lang/Object;
.line 8
.line 9
return-object p0
.line 10
:cond_0
invoke-interface {p0}, Landroid/os/IInterface;->asBinder()Landroid/os/IBinder;
.line 11
.line 12
.line 13
move-result-object p0
.line 14
invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;
.line 15
.line 16
.line 17
move-result-object v0
.line 18
invoke-virtual {v0}, Ljava/lang/Class;->getDeclaredFields()[Ljava/lang/reflect/Field;
.line 19
.line 20
.line 21
move-result-object v0
.line 22
array-length v1, v0
.line 23
const/4 v2, 0x0
.line 24
const/4 v3, 0x0
.line 25
move-object v4, v3
.line 26
move v3, v2
.line 27
:goto_0
if-ge v2, v1, :cond_2
.line 28
.line 29
aget-object v5, v0, v2
.line 30
.line 31
invoke-virtual {v5}, Ljava/lang/reflect/Field;->isSynthetic()Z
.line 32
.line 33
.line 34
move-result v6
.line 35
if-nez v6, :cond_1
.line 36
.line 37
add-int/lit8 v3, v3, 0x1
.line 38
.line 39
move-object v4, v5
.line 40
:cond_1
add-int/lit8 v2, v2, 0x1
.line 41
.line 42
goto :goto_0
.line 43
:cond_2
const/4 v1, 0x1
.line 44
if-ne v3, v1, :cond_4
.line 45
.line 46
invoke-static {v4}, Lcom/google/android/gms/common/internal/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object;
.line 47
.line 48
.line 49
invoke-virtual {v4}, Ljava/lang/reflect/AccessibleObject;->isAccessible()Z
.line 50
.line 51
.line 52
move-result v0
.line 53
if-nez v0, :cond_3
.line 54
.line 55
invoke-virtual {v4, v1}, Ljava/lang/reflect/AccessibleObject;->setAccessible(Z)V
.line 56
.line 57
.line 58
:try_start_0
invoke-virtual {v4, p0}, Ljava/lang/reflect/Field;->get(Ljava/lang/Object;)Ljava/lang/Object;
.line 59
.line 60
.line 61
move-result-object p0
:try_end_0
.catch Ljava/lang/NullPointerException; {:try_start_0 .. :try_end_0} :catch_1
.catch Ljava/lang/IllegalAccessException; {:try_start_0 .. :try_end_0} :catch_0
.line 62
return-object p0
.line 63
:catch_0
move-exception p0
.line 64
new-instance v0, Ljava/lang/IllegalArgumentException;
.line 65
.line 66
const-string v1, "Could not access the field in remoteBinder."
.line 67
.line 68
invoke-direct {v0, v1, p0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V
.line 69
.line 70
.line 71
throw v0
.line 72
:catch_1
move-exception p0
.line 73
new-instance v0, Ljava/lang/IllegalArgumentException;
.line 74
.line 75
const-string v1, "Binder object is null."
.line 76
.line 77
invoke-direct {v0, v1, p0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V
.line 78
.line 79
.line 80
throw v0
.line 81
:cond_3
new-instance p0, Ljava/lang/IllegalArgumentException;
.line 82
.line 83
const-string v0, "IObjectWrapper declared field not private!"
.line 84
.line 85
invoke-direct {p0, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
.line 86
.line 87
.line 88
throw p0
.line 89
:cond_4
new-instance p0, Ljava/lang/IllegalArgumentException;
.line 90
.line 91
array-length v0, v0
.line 92
invoke-static {v0}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;
.line 93
.line 94
.line 95
move-result-object v1
.line 96
invoke-virtual {v1}, Ljava/lang/String;->length()I
.line 97
.line 98
.line 99
move-result v1
.line 100
new-instance v2, Ljava/lang/StringBuilder;
.line 101
.line 102
add-int/lit8 v1, v1, 0x35
.line 103
.line 104
invoke-direct {v2, v1}, Ljava/lang/StringBuilder;-><init>(I)V
.line 105
.line 106
.line 107
const-string v1, "Unexpected number of IObjectWrapper declared fields: "
.line 108
.line 109
invoke-static {v0, v1, v2}, Landroidx/work/impl/workers/a;->r(ILjava/lang/String;Ljava/lang/StringBuilder;)Ljava/lang/String;
.line 110
.line 111
.line 112
move-result-object v0
.line 113
invoke-direct {p0, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
.line 114
.line 115
.line 116
throw p0
.end method
# Bundled ML Kit OCR calls ObjectWrapper.unwrap; R8 renamed it to f2.
.method public static unwrap(Lcom/google/android/gms/dynamic/IObjectWrapper;)Ljava/lang/Object;
.locals 0
invoke-static {p0}, Lcom/google/android/gms/dynamic/ObjectWrapper;->f2(Lcom/google/android/gms/dynamic/IObjectWrapper;)Ljava/lang/Object;
move-result-object p0
return-object p0
.end method
.method public static wrap(Ljava/lang/Object;)Lcom/google/android/gms/dynamic/IObjectWrapper;
.locals 1
.annotation build Lcom/google/android/gms/common/annotation/KeepForSdk;
.end annotation
new-instance v0, Lcom/google/android/gms/dynamic/ObjectWrapper;
invoke-direct {v0, p0}, Lcom/google/android/gms/dynamic/ObjectWrapper;-><init>(Ljava/lang/Object;)V
return-object v0
.end method