- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
93 lines
2.7 KiB
Java
93 lines
2.7 KiB
Java
package com.mbridge.msdk.mbsignalcommon.webEnvCheck;
|
|
|
|
import android.content.Context;
|
|
import android.os.Handler;
|
|
import android.os.Looper;
|
|
import android.webkit.WebView;
|
|
import com.mbridge.msdk.MBridgeConstans;
|
|
import com.mbridge.msdk.c.g;
|
|
import com.mbridge.msdk.c.h;
|
|
import com.mbridge.msdk.foundation.controller.c;
|
|
import com.mbridge.msdk.foundation.tools.af;
|
|
import com.mbridge.msdk.mbsignalcommon.base.b;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public final class a {
|
|
private static volatile Boolean a;
|
|
private static volatile Handler b;
|
|
private static Boolean c;
|
|
|
|
public static boolean a(final Context context) {
|
|
g gVar;
|
|
try {
|
|
gVar = h.a().a(c.m().k());
|
|
} catch (Exception unused) {
|
|
gVar = null;
|
|
}
|
|
if (gVar != null) {
|
|
c = Boolean.valueOf(gVar.aF());
|
|
} else {
|
|
c = Boolean.FALSE;
|
|
}
|
|
Boolean bool = c;
|
|
if (bool == null || !bool.booleanValue()) {
|
|
return true;
|
|
}
|
|
if (Looper.getMainLooper() == Looper.myLooper()) {
|
|
if (a == null) {
|
|
try {
|
|
a = Boolean.valueOf(b(context));
|
|
} catch (Exception unused2) {
|
|
a = Boolean.FALSE;
|
|
}
|
|
}
|
|
if (a == null) {
|
|
a = new Boolean(false);
|
|
}
|
|
return a.booleanValue();
|
|
}
|
|
if (a == null && b == null) {
|
|
b = new Handler(Looper.getMainLooper());
|
|
b.post(new Runnable() { // from class: com.mbridge.msdk.mbsignalcommon.webEnvCheck.a.1
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
if (a.a == null) {
|
|
try {
|
|
Boolean unused3 = a.a = Boolean.valueOf(a.b(context));
|
|
} catch (Exception unused4) {
|
|
Boolean unused5 = a.a = Boolean.FALSE;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
if (a == null) {
|
|
return true;
|
|
}
|
|
return a.booleanValue();
|
|
}
|
|
|
|
public static boolean b(Context context) {
|
|
WebView webView;
|
|
try {
|
|
webView = new WebView(context);
|
|
webView.setWebViewClient(new b());
|
|
} catch (Exception unused) {
|
|
webView = null;
|
|
}
|
|
if (webView == null) {
|
|
return false;
|
|
}
|
|
try {
|
|
webView.destroy();
|
|
return true;
|
|
} catch (Exception e) {
|
|
if (!MBridgeConstans.DEBUG) {
|
|
return true;
|
|
}
|
|
af.b("MBWebViewChecker", "destroy webview error", e);
|
|
return true;
|
|
}
|
|
}
|
|
}
|