* 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>
65 lines
2.4 KiB
Java
65 lines
2.4 KiB
Java
package com.google.android.gms.dynamic;
|
|
|
|
import android.os.IBinder;
|
|
import androidx.work.impl.workers.a;
|
|
import com.google.android.gms.common.annotation.KeepForSdk;
|
|
import com.google.android.gms.common.internal.Preconditions;
|
|
import com.google.android.gms.common.util.RetainForClient;
|
|
import com.google.android.gms.dynamic.IObjectWrapper;
|
|
import java.lang.reflect.Field;
|
|
|
|
@RetainForClient
|
|
@KeepForSdk
|
|
/* loaded from: classes.dex */
|
|
public final class ObjectWrapper<T> extends IObjectWrapper.Stub {
|
|
|
|
/* renamed from: c, reason: collision with root package name */
|
|
public final Object f3726c;
|
|
|
|
public ObjectWrapper(Object obj) {
|
|
super("com.google.android.gms.dynamic.IObjectWrapper");
|
|
this.f3726c = obj;
|
|
}
|
|
|
|
public static Object f2(IObjectWrapper iObjectWrapper) {
|
|
if (iObjectWrapper instanceof ObjectWrapper) {
|
|
return ((ObjectWrapper) iObjectWrapper).f3726c;
|
|
}
|
|
IBinder asBinder = iObjectWrapper.asBinder();
|
|
Field[] declaredFields = asBinder.getClass().getDeclaredFields();
|
|
Field field = null;
|
|
int i = 0;
|
|
for (Field field2 : declaredFields) {
|
|
if (!field2.isSynthetic()) {
|
|
i++;
|
|
field = field2;
|
|
}
|
|
}
|
|
if (i == 1) {
|
|
Preconditions.checkNotNull(field);
|
|
if (!field.isAccessible()) {
|
|
field.setAccessible(true);
|
|
try {
|
|
return field.get(asBinder);
|
|
} catch (IllegalAccessException e) {
|
|
throw new IllegalArgumentException("Could not access the field in remoteBinder.", e);
|
|
} catch (NullPointerException e2) {
|
|
throw new IllegalArgumentException("Binder object is null.", e2);
|
|
}
|
|
}
|
|
throw new IllegalArgumentException("IObjectWrapper declared field not private!");
|
|
}
|
|
int length = declaredFields.length;
|
|
throw new IllegalArgumentException(a.r(length, "Unexpected number of IObjectWrapper declared fields: ", new StringBuilder(String.valueOf(length).length() + 53)));
|
|
}
|
|
|
|
/** Public API alias for bundled ML Kit OCR (expects unwrap). */
|
|
public static Object unwrap(IObjectWrapper iObjectWrapper) {
|
|
return f2(iObjectWrapper);
|
|
}
|
|
|
|
@KeepForSdk
|
|
public static IObjectWrapper wrap(Object obj) {
|
|
return new ObjectWrapper(obj);
|
|
}
|
|
}
|