what-the-bank/sources/o/C13045fOz.java

886 lines
33 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package o;
import android.content.Context;
import android.database.DatabaseErrorHandler;
import android.database.sqlite.SQLiteDatabase;
import android.os.Build;
import com.prolificinteractive.materialcalendarview.BuildConfig;
import io.beid.beidk.definitions.BeIDParams;
import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.StandardMethodCodec;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.simpleframework.xml.strategy.Name;
/* renamed from: o.fOz, reason: case insensitive filesystem */
/* loaded from: classes5.dex */
public final class C13045fOz implements FlutterPlugin, MethodChannel.MethodCallHandler {
private static String g;
private static InterfaceC13042fOw j;
private Context l;
private MethodChannel n;
private static Map<String, Integer> b = new HashMap();
private static Map<Integer, C13032fOm> i = new HashMap();
private static final Object h = new Object();
private static final Object f = new Object();
static int a = 0;
private static int c = 0;
private static int d = 1;
private static int e = 0;
private static Map c(int i2, boolean z, boolean z2) {
HashMap hashMap = new HashMap();
hashMap.put(Name.MARK, Integer.valueOf(i2));
Boolean bool = Boolean.TRUE;
if (z) {
hashMap.put("recovered", bool);
}
if (z2) {
hashMap.put("recoveredInTransaction", bool);
}
return hashMap;
}
@Override // io.flutter.embedding.engine.plugins.FlutterPlugin
public final void onAttachedToEngine(FlutterPlugin.FlutterPluginBinding flutterPluginBinding) {
Context applicationContext = flutterPluginBinding.getApplicationContext();
BinaryMessenger binaryMessenger = flutterPluginBinding.getBinaryMessenger();
this.l = applicationContext;
MethodChannel methodChannel = new MethodChannel(binaryMessenger, "com.tekartik.sqflite", StandardMethodCodec.INSTANCE, binaryMessenger.makeBackgroundTaskQueue());
this.n = methodChannel;
methodChannel.setMethodCallHandler(this);
}
@Override // io.flutter.embedding.engine.plugins.FlutterPlugin
public final void onDetachedFromEngine(FlutterPlugin.FlutterPluginBinding flutterPluginBinding) {
this.l = null;
this.n.setMethodCallHandler(null);
this.n = null;
}
private static C13032fOm e(MethodCall methodCall, MethodChannel.Result result) {
int intValue = ((Integer) methodCall.argument(Name.MARK)).intValue();
C13032fOm c13032fOm = i.get(Integer.valueOf(intValue));
if (c13032fOm != null) {
return c13032fOm;
}
result.error("sqlite_error", "database_closed ".concat(String.valueOf(intValue)), null);
return null;
}
/* JADX INFO: Access modifiers changed from: package-private */
public static /* synthetic */ void d(MethodCall methodCall, MethodChannel.Result result, final C13032fOm c13032fOm) {
final fOL fol = new fOL(methodCall, result);
c13032fOm.a(fol, new Runnable(c13032fOm, fol) { // from class: o.fOk
private fOP a;
private C13032fOm e;
@Override // java.lang.Runnable
public final void run() {
this.e.b(this.a);
}
{
this.e = c13032fOm;
this.a = fol;
}
});
}
/* JADX INFO: Access modifiers changed from: package-private */
public static /* synthetic */ void c(MethodCall methodCall, MethodChannel.Result result, final C13032fOm c13032fOm) {
final fOL fol = new fOL(methodCall, result);
c13032fOm.a(fol, new Runnable(c13032fOm, fol) { // from class: o.fOn
private fOP b;
private C13032fOm c;
@Override // java.lang.Runnable
public final void run() {
this.c.e(this.b);
}
{
this.c = c13032fOm;
this.b = fol;
}
});
}
/* JADX INFO: Access modifiers changed from: package-private */
public static /* synthetic */ void e(MethodCall methodCall, MethodChannel.Result result, final C13032fOm c13032fOm) {
final fOL fol = new fOL(methodCall, result);
c13032fOm.a(fol, new Runnable(c13032fOm, fol) { // from class: o.fOj
private fOP b;
private C13032fOm d;
@Override // java.lang.Runnable
public final void run() {
this.d.a(this.b);
}
{
this.d = c13032fOm;
this.b = fol;
}
});
}
/* JADX INFO: Access modifiers changed from: package-private */
public static /* synthetic */ void b(MethodCall methodCall, MethodChannel.Result result, final C13032fOm c13032fOm) {
final fOL fol = new fOL(methodCall, result);
c13032fOm.a(fol, new Runnable(c13032fOm, fol) { // from class: o.fOl
private fOP c;
private C13032fOm d;
@Override // java.lang.Runnable
public final void run() {
C13032fOm c13032fOm2 = this.d;
fOP fop = this.c;
Boolean a2 = fop.a();
boolean z = Boolean.TRUE.equals(a2) && fop.h();
if (z) {
int i2 = c13032fOm2.j + 1;
c13032fOm2.j = i2;
c13032fOm2.a = Integer.valueOf(i2);
}
if (!c13032fOm2.d(fop)) {
if (z) {
c13032fOm2.a = null;
}
} else if (z) {
HashMap hashMap = new HashMap();
hashMap.put(BeIDParams.BEID_TRANSACTION_ID, c13032fOm2.a);
fop.e(hashMap);
} else {
if (Boolean.FALSE.equals(a2)) {
c13032fOm2.a = null;
}
fop.e((Object) null);
}
}
{
this.d = c13032fOm;
this.c = fol;
}
});
}
/* JADX INFO: Access modifiers changed from: package-private */
public static /* synthetic */ void a(MethodCall methodCall, MethodChannel.Result result, final C13032fOm c13032fOm) {
final fOL fol = new fOL(methodCall, result);
c13032fOm.a(fol, new Runnable(c13032fOm, fol) { // from class: o.fOr
private fOP a;
private C13032fOm c;
@Override // java.lang.Runnable
public final void run() {
this.c.c(this.a);
}
{
this.c = c13032fOm;
this.a = fol;
}
});
}
/* JADX INFO: Access modifiers changed from: package-private */
public static /* synthetic */ void c(boolean z, String str, MethodChannel.Result result, Boolean bool, C13032fOm c13032fOm, MethodCall methodCall, boolean z2, int i2) {
synchronized (f) {
if (!z) {
try {
File file = new File(new File(str).getParent());
if (!file.exists() && !file.mkdirs() && !file.exists()) {
StringBuilder sb = new StringBuilder("open_failed ");
sb.append(str);
result.error("sqlite_error", sb.toString(), null);
return;
}
} catch (Throwable th) {
throw th;
}
}
try {
if (!Boolean.TRUE.equals(bool)) {
if (C13032fOm.b == null) {
Boolean valueOf = Boolean.valueOf(C13032fOm.b(c13032fOm.c));
C13032fOm.b = valueOf;
if (valueOf.booleanValue() && c13032fOm.g >= 2) {
c13032fOm.c();
}
}
c13032fOm.n = SQLiteDatabase.openDatabase(c13032fOm.f, null, C13032fOm.b.booleanValue() ? 805306368 : 268435456);
} else {
c13032fOm.n = SQLiteDatabase.openDatabase(c13032fOm.f, null, 1, new DatabaseErrorHandler(c13032fOm) { // from class: o.fOm.4
private C13032fOm e;
@Override // android.database.DatabaseErrorHandler
public final void onCorruption(SQLiteDatabase sQLiteDatabase) {
}
public AnonymousClass4(C13032fOm c13032fOm2) {
this.e = c13032fOm2;
}
});
}
synchronized (h) {
if (z2) {
b.put(str, Integer.valueOf(i2));
}
i.put(Integer.valueOf(i2), c13032fOm2);
}
if (c13032fOm2.g > 0) {
c13032fOm2.c();
}
result.success(c(i2, false, false));
} catch (Exception e2) {
c13032fOm2.a(e2, new fOL(methodCall, result));
}
}
}
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
@Override // io.flutter.plugin.common.MethodChannel.MethodCallHandler
public final void onMethodCall(final MethodCall methodCall, final MethodChannel.Result result) {
char c2;
Map<Integer, C13032fOm> map;
C13032fOm c13032fOm;
final int i2;
C13032fOm c13032fOm2;
String str = methodCall.method;
str.hashCode();
switch (str.hashCode()) {
case -1319569547:
if (str.equals("execute")) {
c2 = 0;
break;
}
c2 = 65535;
break;
case -1253581933:
if (str.equals("closeDatabase")) {
c2 = 1;
break;
}
c2 = 65535;
break;
case -1249474914:
if (str.equals("options")) {
c2 = 2;
break;
}
c2 = 65535;
break;
case -1183792455:
if (str.equals("insert")) {
c2 = 3;
break;
}
c2 = 65535;
break;
case -838846263:
if (str.equals("update")) {
c2 = 4;
break;
}
c2 = 65535;
break;
case -263511994:
if (str.equals("deleteDatabase")) {
c2 = 5;
break;
}
c2 = 65535;
break;
case -198450538:
if (str.equals("debugMode")) {
c2 = 6;
break;
}
c2 = 65535;
break;
case -17190427:
if (str.equals("openDatabase")) {
c2 = 7;
break;
}
c2 = 65535;
break;
case 93509434:
if (str.equals("batch")) {
c2 = '\b';
break;
}
c2 = 65535;
break;
case 95458899:
if (str.equals(BuildConfig.BUILD_TYPE)) {
c2 = '\t';
break;
}
c2 = 65535;
break;
case 107944136:
if (str.equals("query")) {
c2 = '\n';
break;
}
c2 = 65535;
break;
case 956410295:
if (str.equals("databaseExists")) {
c2 = 11;
break;
}
c2 = 65535;
break;
case 1193546321:
if (str.equals("queryCursorNext")) {
c2 = '\f';
break;
}
c2 = 65535;
break;
case 1385449135:
if (str.equals("getPlatformVersion")) {
c2 = '\r';
break;
}
c2 = 65535;
break;
case 1863829223:
if (str.equals("getDatabasesPath")) {
c2 = 14;
break;
}
c2 = 65535;
break;
default:
c2 = 65535;
break;
}
C13032fOm c13032fOm3 = null;
switch (c2) {
case 0:
final C13032fOm e2 = e(methodCall, result);
if (e2 != null) {
j.d(e2, new Runnable(methodCall, result, e2) { // from class: o.fOH
private C13032fOm b;
private MethodChannel.Result c;
private MethodCall d;
@Override // java.lang.Runnable
public final void run() {
C13045fOz.b(this.d, this.c, this.b);
}
{
this.d = methodCall;
this.c = result;
this.b = e2;
}
});
return;
}
return;
case 1:
int intValue = ((Integer) methodCall.argument(Name.MARK)).intValue();
C13032fOm e3 = e(methodCall, result);
if (e3 != null) {
if (e3.g > 0) {
e3.c();
String str2 = e3.f;
}
String str3 = e3.f;
synchronized (h) {
i.remove(Integer.valueOf(intValue));
if (e3.f9104o) {
b.remove(str3);
}
}
j.d(e3, new Runnable(this, e3, result) { // from class: o.fOz.5
private C13032fOm a;
private C13045fOz c;
private MethodChannel.Result d;
{
this.c = this;
this.a = e3;
this.d = result;
}
@Override // java.lang.Runnable
public final void run() {
synchronized (C13045fOz.f) {
C13045fOz.a(this.a);
}
this.d.success(null);
}
});
return;
}
return;
case 2:
Object argument = methodCall.argument("androidThreadPriority");
if (argument != null) {
c = ((Integer) argument).intValue();
}
Object argument2 = methodCall.argument("androidThreadCount");
if (argument2 != null && !argument2.equals(Integer.valueOf(d))) {
d = ((Integer) argument2).intValue();
InterfaceC13042fOw interfaceC13042fOw = j;
if (interfaceC13042fOw != null) {
interfaceC13042fOw.e();
j = null;
}
}
Integer num = (Integer) methodCall.argument("logLevel");
if (num != null) {
a = num.intValue();
}
result.success(null);
return;
case 3:
final C13032fOm e4 = e(methodCall, result);
if (e4 != null) {
j.d(e4, new Runnable(methodCall, result, e4) { // from class: o.fOy
private MethodChannel.Result a;
private C13032fOm b;
private MethodCall c;
@Override // java.lang.Runnable
public final void run() {
C13045fOz.e(this.c, this.a, this.b);
}
{
this.c = methodCall;
this.a = result;
this.b = e4;
}
});
return;
}
return;
case 4:
final C13032fOm e5 = e(methodCall, result);
if (e5 != null) {
j.d(e5, new Runnable(methodCall, result, e5) { // from class: o.fOA
private C13032fOm c;
private MethodCall d;
private MethodChannel.Result e;
@Override // java.lang.Runnable
public final void run() {
C13045fOz.a(this.d, this.e, this.c);
}
{
this.d = methodCall;
this.e = result;
this.c = e5;
}
});
return;
}
return;
case 5:
String str4 = (String) methodCall.argument("path");
synchronized (h) {
if (a >= 2) {
b.keySet();
}
Map<String, Integer> map2 = b;
Integer num2 = map2.get(str4);
if (num2 != null && (c13032fOm = (map = i).get(num2)) != null && c13032fOm.n.isOpen()) {
if (a >= 2) {
c13032fOm.c();
c13032fOm.e();
}
map.remove(num2);
map2.remove(str4);
c13032fOm3 = c13032fOm;
}
}
Runnable runnable = new Runnable(this, c13032fOm3, str4, result) { // from class: o.fOz.1
private String a;
private C13032fOm c;
private C13045fOz d;
private MethodChannel.Result e;
{
this.d = this;
this.c = c13032fOm3;
this.a = str4;
this.e = result;
}
@Override // java.lang.Runnable
public final void run() {
synchronized (C13045fOz.f) {
C13032fOm c13032fOm4 = this.c;
if (c13032fOm4 != null) {
C13045fOz.a(c13032fOm4);
}
try {
int i3 = C13045fOz.a;
SQLiteDatabase.deleteDatabase(new File(this.a));
} catch (Exception unused) {
int unused2 = C13045fOz.e;
}
}
this.e.success(null);
}
};
InterfaceC13042fOw interfaceC13042fOw2 = j;
if (interfaceC13042fOw2 != null) {
interfaceC13042fOw2.d(c13032fOm3, runnable);
return;
} else {
runnable.run();
return;
}
case 6:
boolean equals = Boolean.TRUE.equals(methodCall.arguments());
fOO.d = equals;
if (!equals) {
a = 0;
} else if (fOO.d) {
a = 1;
}
result.success(null);
return;
case 7:
final String str5 = (String) methodCall.argument("path");
final Boolean bool = (Boolean) methodCall.argument("readOnly");
final boolean z = str5 == null || str5.equals(":memory:");
boolean z2 = (Boolean.FALSE.equals(methodCall.argument("singleInstance")) || z) ? false : true;
if (z2) {
synchronized (h) {
if (a >= 2) {
b.keySet();
}
Integer num3 = b.get(str5);
if (num3 != null && (c13032fOm2 = i.get(num3)) != null) {
if (c13032fOm2.n.isOpen()) {
if (a >= 2) {
c13032fOm2.c();
c13032fOm2.e();
}
result.success(c(num3.intValue(), true, c13032fOm2.e()));
return;
}
if (a >= 2) {
c13032fOm2.c();
}
}
}
}
Object obj = h;
synchronized (obj) {
i2 = e + 1;
e = i2;
}
final C13032fOm c13032fOm4 = new C13032fOm(this.l, str5, i2, z2, a);
synchronized (obj) {
if (j == null) {
InterfaceC13042fOw b2 = InterfaceC13042fOw.b("Sqflite", d, c);
j = b2;
b2.a();
if (c13032fOm4.g > 0) {
c13032fOm4.c();
}
}
c13032fOm4.d = j;
if (c13032fOm4.g > 0) {
c13032fOm4.c();
}
final boolean z3 = z2;
j.d(c13032fOm4, new Runnable(z, str5, result, bool, c13032fOm4, methodCall, z3, i2) { // from class: o.fOE
private C13032fOm a;
private Boolean b;
private MethodChannel.Result c;
private boolean d;
private String e;
private int f;
private boolean g;
private MethodCall j;
@Override // java.lang.Runnable
public final void run() {
C13045fOz.c(this.d, this.e, this.c, this.b, this.a, this.j, this.g, this.f);
}
{
this.d = z;
this.e = str5;
this.c = result;
this.b = bool;
this.a = c13032fOm4;
this.j = methodCall;
this.g = z3;
this.f = i2;
}
});
}
return;
case '\b':
final C13032fOm e6 = e(methodCall, result);
if (e6 != null) {
j.d(e6, new Runnable(e6, methodCall, result) { // from class: o.fOG
private MethodChannel.Result b;
private C13032fOm c;
private MethodCall e;
@Override // java.lang.Runnable
public final void run() {
C13045fOz.d(this.c, this.e, this.b);
}
{
this.c = e6;
this.e = methodCall;
this.b = result;
}
});
return;
}
return;
case '\t':
String str6 = (String) methodCall.argument("cmd");
HashMap hashMap = new HashMap();
if ("get".equals(str6)) {
int i3 = a;
if (i3 > 0) {
hashMap.put("logLevel", Integer.valueOf(i3));
}
Map<Integer, C13032fOm> map3 = i;
if (!map3.isEmpty()) {
HashMap hashMap2 = new HashMap();
for (Map.Entry<Integer, C13032fOm> entry : map3.entrySet()) {
C13032fOm value = entry.getValue();
HashMap hashMap3 = new HashMap();
hashMap3.put("path", value.f);
hashMap3.put("singleInstance", Boolean.valueOf(value.f9104o));
if (value.g > 0) {
hashMap3.put("logLevel", Integer.valueOf(value.g));
}
hashMap2.put(entry.getKey().toString(), hashMap3);
}
hashMap.put("databases", hashMap2);
}
}
result.success(hashMap);
return;
case '\n':
final C13032fOm e7 = e(methodCall, result);
if (e7 != null) {
j.d(e7, new Runnable(methodCall, result, e7) { // from class: o.fOF
private MethodChannel.Result b;
private C13032fOm d;
private MethodCall e;
@Override // java.lang.Runnable
public final void run() {
C13045fOz.d(this.e, this.b, this.d);
}
{
this.e = methodCall;
this.b = result;
this.d = e7;
}
});
return;
}
return;
case 11:
result.success(Boolean.valueOf(C13032fOm.e((String) methodCall.argument("path"))));
return;
case '\f':
final C13032fOm e8 = e(methodCall, result);
if (e8 != null) {
j.d(e8, new Runnable(methodCall, result, e8) { // from class: o.fOC
private C13032fOm a;
private MethodCall c;
private MethodChannel.Result d;
@Override // java.lang.Runnable
public final void run() {
C13045fOz.c(this.c, this.d, this.a);
}
{
this.c = methodCall;
this.d = result;
this.a = e8;
}
});
return;
}
return;
case '\r':
StringBuilder sb = new StringBuilder("Android ");
sb.append(Build.VERSION.RELEASE);
result.success(sb.toString());
return;
case 14:
if (g == null) {
g = this.l.getDatabasePath("tekartik_sqflite.db").getParent();
}
result.success(g);
return;
default:
result.notImplemented();
return;
}
}
static /* synthetic */ void a(C13032fOm c13032fOm) {
try {
if (c13032fOm.g > 0) {
c13032fOm.c();
}
if (!c13032fOm.e.isEmpty() && c13032fOm.g > 0) {
c13032fOm.c();
c13032fOm.e.size();
}
c13032fOm.n.close();
} catch (Exception unused) {
}
synchronized (h) {
if (i.isEmpty() && j != null) {
if (c13032fOm.g > 0) {
c13032fOm.c();
}
j.e();
j = null;
}
}
}
/* JADX INFO: Access modifiers changed from: package-private */
public static /* synthetic */ void d(C13032fOm c13032fOm, MethodCall methodCall, MethodChannel.Result result) {
char c2;
fOL fol = new fOL(methodCall, result);
boolean b2 = fol.b();
boolean equals = Boolean.TRUE.equals(fol.e("continueOnError"));
List list = (List) fol.a.argument("operations");
ArrayList arrayList = new ArrayList();
Iterator it = list.iterator();
while (it.hasNext()) {
fOK fok = new fOK((Map) it.next(), b2);
String str = (String) fok.c.get("method");
str.hashCode();
switch (str.hashCode()) {
case -1319569547:
if (str.equals("execute")) {
c2 = 0;
break;
}
break;
case -1183792455:
if (str.equals("insert")) {
c2 = 1;
break;
}
break;
case -838846263:
if (str.equals("update")) {
c2 = 2;
break;
}
break;
case 107944136:
if (str.equals("query")) {
c2 = 3;
break;
}
break;
}
c2 = 65535;
if (c2 != 0) {
if (c2 != 1) {
if (c2 != 2) {
if (c2 == 3) {
if (c13032fOm.b(fok)) {
if (!fok.e) {
HashMap hashMap = new HashMap();
hashMap.put("result", fok.d.b);
arrayList.add(hashMap);
}
} else if (equals) {
if (!fok.e) {
arrayList.add(fok.f());
}
} else {
result.error(fok.d.c, fok.d.a, fok.d.d);
return;
}
} else {
StringBuilder sb = new StringBuilder("Batch method '");
sb.append(str);
sb.append("' not supported");
result.error("bad_param", sb.toString(), null);
return;
}
} else if (c13032fOm.c(fok)) {
if (!fok.e) {
HashMap hashMap2 = new HashMap();
hashMap2.put("result", fok.d.b);
arrayList.add(hashMap2);
}
} else if (equals) {
if (!fok.e) {
arrayList.add(fok.f());
}
} else {
result.error(fok.d.c, fok.d.a, fok.d.d);
return;
}
} else if (c13032fOm.a(fok)) {
if (!fok.e) {
HashMap hashMap3 = new HashMap();
hashMap3.put("result", fok.d.b);
arrayList.add(hashMap3);
}
} else if (equals) {
if (!fok.e) {
arrayList.add(fok.f());
}
} else {
result.error(fok.d.c, fok.d.a, fok.d.d);
return;
}
} else if (c13032fOm.d(fok)) {
fok.e((Object) null);
if (!fok.e) {
HashMap hashMap4 = new HashMap();
hashMap4.put("result", fok.d.b);
arrayList.add(hashMap4);
}
} else if (equals) {
if (!fok.e) {
arrayList.add(fok.f());
}
} else {
result.error(fok.d.c, fok.d.a, fok.d.d);
return;
}
}
if (b2) {
result.success(null);
} else {
result.success(arrayList);
}
}
}