- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
405 lines
14 KiB
Java
405 lines
14 KiB
Java
package com.mbridge.msdk.click;
|
|
|
|
import android.annotation.SuppressLint;
|
|
import android.content.Context;
|
|
import android.graphics.Bitmap;
|
|
import android.net.http.SslError;
|
|
import android.os.Handler;
|
|
import android.os.Looper;
|
|
import android.text.TextUtils;
|
|
import android.webkit.JsPromptResult;
|
|
import android.webkit.JsResult;
|
|
import android.webkit.RenderProcessGoneDetail;
|
|
import android.webkit.SslErrorHandler;
|
|
import android.webkit.WebChromeClient;
|
|
import android.webkit.WebView;
|
|
import android.webkit.WebViewClient;
|
|
import com.ironsource.nb;
|
|
import com.mbridge.msdk.MBridgeConstans;
|
|
import com.mbridge.msdk.foundation.tools.af;
|
|
import com.mbridge.msdk.mbbid.common.BidResponsedEx;
|
|
import com.mbridge.msdk.playercommon.exoplayer2.DefaultLoadControl;
|
|
import java.util.HashMap;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public class m {
|
|
public static long a = 0;
|
|
private static final String d = "m";
|
|
boolean b;
|
|
boolean c;
|
|
private int e;
|
|
private int f;
|
|
private com.mbridge.msdk.c.g h;
|
|
private a i;
|
|
private String j;
|
|
private String k;
|
|
private WebView l;
|
|
private boolean m;
|
|
private String n;
|
|
private int o;
|
|
private boolean q;
|
|
private boolean p = false;
|
|
private final Runnable r = new Runnable() { // from class: com.mbridge.msdk.click.m.4
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
m.this.p = true;
|
|
m.this.o = 1;
|
|
m.m(m.this);
|
|
}
|
|
};
|
|
private final Runnable s = new Runnable() { // from class: com.mbridge.msdk.click.m.5
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
m.this.p = true;
|
|
m.this.o = 2;
|
|
m.m(m.this);
|
|
}
|
|
};
|
|
private Handler g = new Handler(Looper.getMainLooper());
|
|
|
|
public interface a {
|
|
void a(int i, String str, String str2, String str3);
|
|
|
|
void a(String str, boolean z, String str2);
|
|
|
|
boolean a(String str);
|
|
|
|
boolean b(String str);
|
|
|
|
boolean c(String str);
|
|
}
|
|
|
|
public m() {
|
|
this.e = DefaultLoadControl.DEFAULT_MIN_BUFFER_MS;
|
|
this.f = 3000;
|
|
com.mbridge.msdk.c.g b = com.mbridge.msdk.c.h.a().b(com.mbridge.msdk.foundation.controller.c.m().k());
|
|
this.h = b;
|
|
if (b == null) {
|
|
com.mbridge.msdk.c.h.a();
|
|
this.h = com.mbridge.msdk.c.i.a();
|
|
}
|
|
this.m = this.h.aJ();
|
|
this.e = (int) this.h.ar();
|
|
this.f = (int) this.h.ar();
|
|
}
|
|
|
|
public final void a(String str, String str2, Context context, String str3, String str4, a aVar) {
|
|
if (aVar == null) {
|
|
throw new NullPointerException("OverrideUrlLoadingListener can not be null");
|
|
}
|
|
this.k = str4;
|
|
this.j = str3;
|
|
this.i = aVar;
|
|
a(str, str2, context);
|
|
}
|
|
|
|
public final void a(String str, String str2, Context context, String str3, a aVar) {
|
|
if (aVar == null) {
|
|
throw new NullPointerException("OverrideUrlLoadingListener can not be null");
|
|
}
|
|
this.j = str3;
|
|
this.i = aVar;
|
|
a(str, str2, context);
|
|
}
|
|
|
|
private void a(final String str, final String str2, final Context context) {
|
|
if (Thread.currentThread() == Looper.getMainLooper().getThread()) {
|
|
a(str, str2, context, this.j);
|
|
} else {
|
|
this.g.post(new Runnable() { // from class: com.mbridge.msdk.click.m.1
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
m mVar = m.this;
|
|
mVar.a(str, str2, context, mVar.j);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void a(String str, String str2, Context context, String str3) {
|
|
try {
|
|
a(context, str, str2);
|
|
if (!TextUtils.isEmpty(this.k)) {
|
|
this.l.getSettings().setDefaultTextEncodingName(nb.N);
|
|
this.f = 2000;
|
|
this.e = 2000;
|
|
af.c(d, this.k);
|
|
this.l.loadDataWithBaseURL(str3, this.k, "*/*", nb.N, str3);
|
|
return;
|
|
}
|
|
if (this.m) {
|
|
HashMap hashMap = new HashMap();
|
|
if (this.l.getUrl() != null) {
|
|
hashMap.put("Referer", this.l.getUrl());
|
|
}
|
|
this.l.loadUrl(str3, hashMap);
|
|
return;
|
|
}
|
|
this.l.loadUrl(str3);
|
|
} catch (Throwable th) {
|
|
try {
|
|
a aVar = this.i;
|
|
if (aVar != null) {
|
|
aVar.a(0, this.j, th.getMessage(), this.n);
|
|
}
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
|
|
@SuppressLint({"SetJavaScriptEnabled"})
|
|
private void a(final Context context, final String str, final String str2) {
|
|
WebView webView = new WebView(context);
|
|
this.l = webView;
|
|
webView.getSettings().setJavaScriptEnabled(true);
|
|
this.l.getSettings().setCacheMode(2);
|
|
this.l.getSettings().setLoadsImagesAutomatically(false);
|
|
this.l.setWebViewClient(new WebViewClient() { // from class: com.mbridge.msdk.click.m.2
|
|
@Override // android.webkit.WebViewClient
|
|
public final void onPageStarted(WebView webView2, String str3, Bitmap bitmap) {
|
|
try {
|
|
webView2.loadUrl("javascript:window.navigator.vibrate([]);");
|
|
if (m.this.q) {
|
|
m.this.o = 0;
|
|
m.c(m.this);
|
|
return;
|
|
}
|
|
m.this.c = false;
|
|
if (webView2.getTag() == null) {
|
|
webView2.setTag("has_first_started");
|
|
} else {
|
|
m.this.b = true;
|
|
}
|
|
synchronized (m.d) {
|
|
try {
|
|
m.this.j = str3;
|
|
if (m.this.i != null && m.this.i.a(str3)) {
|
|
m.this.q = true;
|
|
m.c(m.this);
|
|
} else {
|
|
m.e(m.this);
|
|
}
|
|
} finally {
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
@Override // android.webkit.WebViewClient
|
|
public final boolean shouldOverrideUrlLoading(WebView webView2, String str3) {
|
|
synchronized (m.d) {
|
|
try {
|
|
m mVar = m.this;
|
|
mVar.c = true;
|
|
mVar.d();
|
|
if (m.this.q) {
|
|
m.this.c();
|
|
m.c(m.this);
|
|
return true;
|
|
}
|
|
m.this.j = str3;
|
|
if (m.this.i == null || !m.this.i.b(str3)) {
|
|
if (!m.this.m) {
|
|
m.this.l.loadUrl(str3);
|
|
} else {
|
|
HashMap hashMap = new HashMap();
|
|
if (m.this.l.getUrl() != null) {
|
|
hashMap.put("Referer", m.this.l.getUrl());
|
|
}
|
|
m.this.l.loadUrl(str3, hashMap);
|
|
}
|
|
return true;
|
|
}
|
|
m.this.q = true;
|
|
m.this.c();
|
|
m.c(m.this);
|
|
return true;
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // android.webkit.WebViewClient
|
|
public final void onReceivedError(WebView webView2, int i, String str3, String str4) {
|
|
synchronized (m.d) {
|
|
m.this.q = true;
|
|
m.this.b();
|
|
m.c(m.this);
|
|
}
|
|
if (m.this.i != null) {
|
|
m.this.i.a(i, webView2.getUrl(), str3, m.this.n);
|
|
}
|
|
}
|
|
|
|
@Override // android.webkit.WebViewClient
|
|
public final void onReceivedSslError(WebView webView2, SslErrorHandler sslErrorHandler, SslError sslError) {
|
|
try {
|
|
if (MBridgeConstans.IS_SP_CBT_CF && sslErrorHandler != null) {
|
|
sslErrorHandler.cancel();
|
|
}
|
|
if (TextUtils.isEmpty(str2) || TextUtils.isEmpty(str)) {
|
|
return;
|
|
}
|
|
new com.mbridge.msdk.foundation.same.report.h(context);
|
|
String str3 = str;
|
|
String str4 = str2;
|
|
String url = webView2.getUrl();
|
|
try {
|
|
JSONObject jSONObject = new JSONObject();
|
|
jSONObject.put("click_type", "1");
|
|
jSONObject.put(BidResponsedEx.KEY_CID, str3);
|
|
jSONObject.put(MBridgeConstans.PROPERTIES_UNIT_ID, str4);
|
|
jSONObject.put("key", "2000027");
|
|
jSONObject.put("http_url", url);
|
|
com.mbridge.msdk.foundation.same.report.d.d.a().a(jSONObject);
|
|
} catch (Exception e) {
|
|
af.b(com.mbridge.msdk.foundation.same.report.h.a, e.getMessage());
|
|
}
|
|
} catch (Exception e2) {
|
|
e2.printStackTrace();
|
|
}
|
|
}
|
|
|
|
@Override // android.webkit.WebViewClient
|
|
public final void onPageFinished(WebView webView2, String str3) {
|
|
super.onPageFinished(webView2, str3);
|
|
try {
|
|
webView2.loadUrl("javascript:window.navigator.vibrate([]);");
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
@Override // android.webkit.WebViewClient
|
|
public final boolean onRenderProcessGone(WebView webView2, RenderProcessGoneDetail renderProcessGoneDetail) {
|
|
try {
|
|
synchronized (m.d) {
|
|
m.this.q = true;
|
|
m.this.b();
|
|
m.c(m.this);
|
|
}
|
|
if (m.this.i != null) {
|
|
m.this.i.a(-1, webView2.getUrl(), "WebView render process crash.", m.this.n);
|
|
}
|
|
if (webView2 != null) {
|
|
webView2.destroy();
|
|
}
|
|
return true;
|
|
} catch (Throwable th) {
|
|
af.b(m.d, th.getMessage());
|
|
return true;
|
|
}
|
|
}
|
|
});
|
|
this.l.setWebChromeClient(new WebChromeClient() { // from class: com.mbridge.msdk.click.m.3
|
|
@Override // android.webkit.WebChromeClient
|
|
public final boolean onJsAlert(WebView webView2, String str3, String str4, JsResult jsResult) {
|
|
return true;
|
|
}
|
|
|
|
@Override // android.webkit.WebChromeClient
|
|
public final boolean onJsConfirm(WebView webView2, String str3, String str4, JsResult jsResult) {
|
|
return true;
|
|
}
|
|
|
|
@Override // android.webkit.WebChromeClient
|
|
public final boolean onJsPrompt(WebView webView2, String str3, String str4, String str5, JsPromptResult jsPromptResult) {
|
|
return true;
|
|
}
|
|
|
|
@Override // android.webkit.WebChromeClient
|
|
public final void onProgressChanged(WebView webView2, int i) {
|
|
if (i == 100) {
|
|
try {
|
|
webView2.loadUrl("javascript:window.navigator.vibrate([]);");
|
|
if (!m.this.q) {
|
|
m mVar = m.this;
|
|
if (!mVar.c) {
|
|
m.l(mVar);
|
|
}
|
|
}
|
|
if (m.this.i != null) {
|
|
m.this.i.c(webView2.getUrl());
|
|
}
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void b() {
|
|
d();
|
|
c();
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void c() {
|
|
this.g.removeCallbacks(this.s);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void d() {
|
|
this.g.removeCallbacks(this.r);
|
|
}
|
|
|
|
public static /* synthetic */ void c(m mVar) {
|
|
synchronized (d) {
|
|
try {
|
|
try {
|
|
try {
|
|
mVar.b();
|
|
a aVar = mVar.i;
|
|
if (aVar != null) {
|
|
aVar.a(mVar.j, mVar.p, mVar.n);
|
|
}
|
|
} finally {
|
|
}
|
|
} catch (Exception e) {
|
|
af.b(d, e.getMessage());
|
|
}
|
|
} catch (Throwable th) {
|
|
}
|
|
}
|
|
}
|
|
|
|
public static /* synthetic */ void e(m mVar) {
|
|
mVar.c();
|
|
mVar.g.postDelayed(mVar.s, mVar.e);
|
|
}
|
|
|
|
public static /* synthetic */ void l(m mVar) {
|
|
mVar.d();
|
|
mVar.g.postDelayed(mVar.r, mVar.f);
|
|
}
|
|
|
|
public static /* synthetic */ void m(m mVar) {
|
|
synchronized (d) {
|
|
try {
|
|
try {
|
|
mVar.b();
|
|
mVar.l.destroy();
|
|
a aVar = mVar.i;
|
|
if (aVar != null) {
|
|
aVar.a(mVar.j, mVar.p, mVar.n);
|
|
}
|
|
} catch (Exception e) {
|
|
af.b(d, e.getMessage());
|
|
} catch (Throwable th) {
|
|
af.b(d, th.getMessage());
|
|
}
|
|
} catch (Throwable th2) {
|
|
throw th2;
|
|
}
|
|
}
|
|
}
|
|
}
|