- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
212 lines
5.8 KiB
Java
212 lines
5.8 KiB
Java
package com.mbridge.msdk.foundation.tools;
|
|
|
|
import android.text.TextUtils;
|
|
import com.mbridge.msdk.MBridgeConstans;
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public final class ah {
|
|
public volatile JSONObject a;
|
|
private final Object b;
|
|
private final Object c;
|
|
private final Object d;
|
|
private final Object e;
|
|
private String f;
|
|
private volatile ConcurrentHashMap<String, Boolean> g;
|
|
private volatile ConcurrentHashMap<String, Integer> h;
|
|
private volatile com.mbridge.msdk.c.g i;
|
|
|
|
public static final class a {
|
|
private static final ah a = new ah();
|
|
}
|
|
|
|
private ah() {
|
|
this.b = new Object();
|
|
this.c = new Object();
|
|
this.d = new Object();
|
|
this.e = new Object();
|
|
}
|
|
|
|
public static ah a() {
|
|
return a.a;
|
|
}
|
|
|
|
private static Integer a(String str, ConcurrentHashMap<String, Integer> concurrentHashMap) {
|
|
try {
|
|
return concurrentHashMap.get(str);
|
|
} catch (Exception unused) {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
private int b(String str, String str2, int i) {
|
|
if (a(true)) {
|
|
return i;
|
|
}
|
|
try {
|
|
String optString = this.a.optString(str, "");
|
|
if (TextUtils.isEmpty(optString)) {
|
|
return i;
|
|
}
|
|
String a2 = z.a(optString);
|
|
return TextUtils.isEmpty(a2) ? i : new JSONObject(a2).optInt(str2, i);
|
|
} catch (Exception unused) {
|
|
return i;
|
|
}
|
|
}
|
|
|
|
private int b(String str, int i) {
|
|
if (a(true)) {
|
|
return i;
|
|
}
|
|
try {
|
|
return this.a.optInt(str, i);
|
|
} catch (Exception unused) {
|
|
return i;
|
|
}
|
|
}
|
|
|
|
public final int a(String str, int i) {
|
|
Integer valueOf;
|
|
try {
|
|
if (TextUtils.isEmpty(str)) {
|
|
return i;
|
|
}
|
|
ConcurrentHashMap<String, Integer> b = b();
|
|
Integer a2 = a(str, b);
|
|
if (a2 != null) {
|
|
return a2.intValue();
|
|
}
|
|
try {
|
|
valueOf = Integer.valueOf(b(str, i));
|
|
} catch (Exception unused) {
|
|
valueOf = Integer.valueOf(i);
|
|
}
|
|
b.put(str, valueOf);
|
|
return valueOf.intValue();
|
|
} catch (Exception unused2) {
|
|
return i;
|
|
}
|
|
}
|
|
|
|
public final int a(String str, String str2, int i) {
|
|
Integer valueOf;
|
|
try {
|
|
if (!TextUtils.isEmpty(str) && !TextUtils.isEmpty(str2)) {
|
|
String str3 = str + "_" + str2;
|
|
ConcurrentHashMap<String, Integer> b = b();
|
|
Integer a2 = a(str3, b);
|
|
if (a2 != null) {
|
|
return a2.intValue();
|
|
}
|
|
try {
|
|
valueOf = Integer.valueOf(b(str, str2, i));
|
|
} catch (Exception unused) {
|
|
valueOf = Integer.valueOf(i);
|
|
}
|
|
b.put(str3, valueOf);
|
|
return valueOf.intValue();
|
|
}
|
|
return a(str2, i);
|
|
} catch (Exception unused2) {
|
|
return i;
|
|
}
|
|
}
|
|
|
|
private ConcurrentHashMap<String, Integer> b() {
|
|
synchronized (this.b) {
|
|
try {
|
|
if (this.h == null) {
|
|
this.h = new ConcurrentHashMap<>();
|
|
}
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
return this.h;
|
|
}
|
|
|
|
public final boolean a(String str, boolean z) {
|
|
try {
|
|
return a(str, z, true);
|
|
} catch (Exception unused) {
|
|
return z;
|
|
}
|
|
}
|
|
|
|
public final boolean a(String str, boolean z, boolean z2) {
|
|
Boolean valueOf;
|
|
Boolean b;
|
|
try {
|
|
if (TextUtils.isEmpty(str)) {
|
|
return z;
|
|
}
|
|
ConcurrentHashMap<String, Boolean> c = c();
|
|
if (z2 && (b = b(str, c)) != null) {
|
|
return b.booleanValue();
|
|
}
|
|
try {
|
|
valueOf = Boolean.valueOf(b(str, z, z2));
|
|
} catch (Exception unused) {
|
|
valueOf = Boolean.valueOf(z);
|
|
}
|
|
c.put(str, valueOf);
|
|
return valueOf.booleanValue();
|
|
} catch (Exception unused2) {
|
|
return z;
|
|
}
|
|
}
|
|
|
|
private ConcurrentHashMap<String, Boolean> c() {
|
|
synchronized (this.d) {
|
|
try {
|
|
if (this.g == null) {
|
|
this.g = new ConcurrentHashMap<>();
|
|
}
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
return this.g;
|
|
}
|
|
|
|
private static Boolean b(String str, ConcurrentHashMap<String, Boolean> concurrentHashMap) {
|
|
try {
|
|
return concurrentHashMap.get(str);
|
|
} catch (Exception unused) {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
private boolean b(String str, boolean z, boolean z2) {
|
|
if (a(z2)) {
|
|
return z;
|
|
}
|
|
try {
|
|
return this.a.optInt(str, z ? 1 : 0) != 0;
|
|
} catch (Exception unused) {
|
|
return z;
|
|
}
|
|
}
|
|
|
|
private boolean a(boolean z) {
|
|
synchronized (this.e) {
|
|
if (this.i == null || this.i.K() == 1 || !z) {
|
|
try {
|
|
if (TextUtils.isEmpty(this.f)) {
|
|
this.f = com.mbridge.msdk.foundation.a.a.a.a().a(MBridgeConstans.SDK_APP_ID);
|
|
}
|
|
this.i = com.mbridge.msdk.c.h.a().a(this.f);
|
|
} catch (Exception unused) {
|
|
this.i = null;
|
|
}
|
|
}
|
|
if (this.i != null) {
|
|
this.a = this.i.am();
|
|
}
|
|
}
|
|
return this.i == null || this.a == null;
|
|
}
|
|
}
|