* 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>
43 lines
1.2 KiB
Java
43 lines
1.2 KiB
Java
package com.google.mlkit.vision.common.internal;
|
|
|
|
import android.graphics.Matrix;
|
|
import com.google.android.gms.ads.RequestConfiguration;
|
|
import com.google.android.gms.common.annotation.KeepForSdk;
|
|
import com.google.android.gms.common.internal.GmsLogger;
|
|
|
|
@KeepForSdk
|
|
/* loaded from: classes3.dex */
|
|
public class ImageUtils {
|
|
|
|
/* renamed from: a, reason: collision with root package name */
|
|
public static final ImageUtils f12810a;
|
|
|
|
static {
|
|
new GmsLogger("MLKitImageUtils", RequestConfiguration.MAX_AD_CONTENT_RATING_UNSPECIFIED);
|
|
f12810a = new ImageUtils();
|
|
}
|
|
|
|
private ImageUtils() {
|
|
}
|
|
|
|
@KeepForSdk
|
|
public static ImageUtils getInstance() {
|
|
return f12810a;
|
|
}
|
|
|
|
@KeepForSdk
|
|
public Matrix getUprightRotationMatrix(int width, int height, int rotation) {
|
|
if (rotation == 0) {
|
|
return null;
|
|
}
|
|
Matrix matrix = new Matrix();
|
|
matrix.postTranslate((-width) / 2.0f, (-height) / 2.0f);
|
|
matrix.postRotate(rotation * 90.0f);
|
|
if ((rotation % 2) != 0) {
|
|
matrix.postTranslate(height / 2.0f, width / 2.0f);
|
|
} else {
|
|
matrix.postTranslate(width / 2.0f, height / 2.0f);
|
|
}
|
|
return matrix;
|
|
}
|
|
}
|