Files
Daniel Elliott c080f0d97f Add Discord community version (64-bit only)
- 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
2026-02-18 15:48:36 -08:00

403 lines
16 KiB
Java

package com.applovin.impl.adview;
import android.content.Intent;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Bundle;
import android.view.MotionEvent;
import android.webkit.RenderProcessGoneDetail;
import android.webkit.SslErrorHandler;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import com.applovin.adview.AppLovinAdView;
import com.applovin.impl.aq;
import com.applovin.impl.dq;
import com.applovin.impl.la;
import com.applovin.impl.ma;
import com.applovin.impl.mq;
import com.applovin.impl.pi;
import com.applovin.impl.sdk.AppLovinBroadcastManager;
import com.applovin.impl.sdk.utils.CollectionUtils;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.sj;
import com.applovin.impl.tp;
import com.applovin.impl.yp;
import com.applovin.impl.z3;
import com.applovin.sdk.AppLovinAdSize;
import com.facebook.share.internal.ShareConstants;
import com.google.android.gms.measurement.AppMeasurement;
import com.ironsource.mediationsdk.utils.IronSourceConstants;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/* loaded from: classes.dex */
public class c extends pi {
private final com.applovin.impl.sdk.j a;
private final com.applovin.impl.sdk.n b;
private final a c;
public c(a aVar, com.applovin.impl.sdk.j jVar) {
this.a = jVar;
this.b = jVar.J();
this.c = aVar;
}
private void b() {
this.c.a();
}
public a c() {
return this.c;
}
@Override // android.webkit.WebViewClient
public void onLoadResource(WebView webView, String str) {
super.onLoadResource(webView, str);
if (com.applovin.impl.sdk.n.a()) {
this.b.d("AdWebView", "Loaded resource: " + str);
}
}
@Override // android.webkit.WebViewClient
public void onPageFinished(WebView webView, String str) {
super.onPageFinished(webView, str);
if (com.applovin.impl.sdk.n.a()) {
this.b.d("AdWebView", "Loaded URL: " + str);
}
a aVar = this.c;
if (aVar != null) {
aVar.a(webView, str);
}
}
@Override // android.webkit.WebViewClient
public void onReceivedError(WebView webView, WebResourceRequest webResourceRequest, WebResourceError webResourceError) {
super.onReceivedError(webView, webResourceRequest, webResourceError);
onReceivedError(webView, webResourceError.getErrorCode(), webResourceError.getDescription().toString(), webResourceRequest.getUrl().toString());
}
@Override // android.webkit.WebViewClient
public void onReceivedHttpError(WebView webView, WebResourceRequest webResourceRequest, WebResourceResponse webResourceResponse) {
super.onReceivedHttpError(webView, webResourceRequest, webResourceResponse);
a aVar = this.c;
if (aVar != null) {
com.applovin.impl.sdk.ad.b i = aVar.i();
if (com.applovin.impl.sdk.n.a()) {
this.b.b("AdWebView", "Received HTTP error: " + webResourceResponse + "for url: " + webResourceRequest.getUrl() + " and ad: " + i);
}
}
if (yp.a(webResourceRequest.getUrl().toString(), this.a)) {
this.a.E().a("adWebViewReceivedHttpError", webResourceRequest.getUrl().toString(), webResourceResponse.getStatusCode());
}
}
@Override // android.webkit.WebViewClient
public void onReceivedSslError(WebView webView, SslErrorHandler sslErrorHandler, SslError sslError) {
super.onReceivedSslError(webView, sslErrorHandler, sslError);
a aVar = this.c;
if (aVar != null) {
com.applovin.impl.sdk.ad.b i = aVar.i();
String str = "Received SSL error: " + sslError;
if (com.applovin.impl.sdk.n.a()) {
this.b.b("AdWebView", str + " for ad: " + i);
}
}
}
@Override // com.applovin.impl.pi, android.webkit.WebViewClient
public boolean onRenderProcessGone(WebView webView, RenderProcessGoneDetail renderProcessGoneDetail) {
AppLovinBroadcastManager.sendBroadcast(new Intent("com.applovin.render_process_gone"), null);
if (this.c == null) {
return true;
}
com.applovin.impl.sdk.n.h("AdWebView", "Render process gone for ad: " + this.c.i() + ". Process did crash: " + renderProcessGoneDetail.didCrash());
com.applovin.impl.sdk.ad.b i = this.c.i();
if (i != null) {
Map a = ma.a(i);
CollectionUtils.putStringIfValid("top_main_method", "onRenderProcessGone", a);
if (z3.i()) {
a.put(ShareConstants.FEED_SOURCE_PARAM, renderProcessGoneDetail.didCrash() ? AppMeasurement.CRASH_ORIGIN : "non_crash");
}
this.a.E().a(la.U, a);
}
if (((Boolean) this.a.a(sj.S5)).booleanValue()) {
if (renderProcessGoneDetail.didCrash() && ((Boolean) this.a.a(sj.V5)).booleanValue()) {
throw new RuntimeException("Render process crashed. This is likely caused by a crash in an AppLovin ad with ID: " + (i != null ? String.valueOf(i.getAdIdNumber()) : "null"));
}
if (webView != null && webView.equals(this.c.g())) {
this.c.b();
AppLovinAdSize m = this.c.m();
if (yp.a(m)) {
this.c.a(m);
this.c.H();
}
}
}
return super.onRenderProcessGone(webView, renderProcessGoneDetail);
}
@Override // android.webkit.WebViewClient
public boolean shouldOverrideUrlLoading(WebView webView, WebResourceRequest webResourceRequest) {
Uri url = webResourceRequest.getUrl();
if (url != null) {
return a(webView, url.toString());
}
if (!com.applovin.impl.sdk.n.a()) {
return false;
}
this.b.b("AdWebView", "No url found for request");
return false;
}
@Override // android.webkit.WebViewClient
public void onReceivedError(WebView webView, int i, String str, String str2) {
super.onReceivedError(webView, i, str, str2);
a aVar = this.c;
if (aVar != null) {
com.applovin.impl.sdk.ad.b i2 = aVar.i();
String str3 = "Received error with error code: " + i + " with description \\'" + str + "\\' for URL: " + str2;
if (com.applovin.impl.sdk.n.a()) {
this.b.b("AdWebView", str3 + " for ad: " + i2);
}
}
if (yp.a(str2, this.a)) {
this.a.E().a("adWebViewReceivedError", str2, i);
}
}
@Override // android.webkit.WebViewClient
public boolean shouldOverrideUrlLoading(WebView webView, String str) {
return a(webView, str);
}
private void a(aq aqVar, b bVar) {
a(aqVar, bVar, (Bundle) null);
}
private void a(aq aqVar, b bVar, Bundle bundle) {
dq j1 = aqVar.j1();
if (j1 != null) {
mq.a(j1.a(), this.c.l());
a(bVar, j1.b(), bundle);
}
}
public boolean a(WebView webView, String str) {
boolean z;
if (this.c == null) {
return true;
}
if (com.applovin.impl.sdk.n.a()) {
this.b.d("AdWebView", "Processing click on ad URL \"" + str + "\"");
}
if (str != null && (webView instanceof b)) {
Uri parse = Uri.parse(str);
b bVar = (b) webView;
String scheme = parse.getScheme();
String host = parse.getHost();
String path = parse.getPath();
com.applovin.impl.sdk.ad.b i = this.c.i();
if (i == null) {
if (com.applovin.impl.sdk.n.a()) {
this.b.b("AdWebView", "Unable to process click, ad not found!");
}
return true;
}
Iterator it = i.d0().iterator();
while (true) {
if (!it.hasNext()) {
z = true;
break;
}
String str2 = (String) it.next();
if (StringUtils.isValidString(path) && path.contains(str2)) {
z = false;
break;
}
}
boolean a = bVar.a();
boolean z2 = (!i.Y0() || a) ? z : false;
if ("applovin".equals(scheme) && "com.applovin.sdk".equals(host)) {
if ("/adservice/close_ad".equals(path)) {
String str3 = this.a.g0().getExtraParameters().get("enable_close_URL_ad_value");
if (StringUtils.isValidString(str3) && Boolean.parseBoolean(str3)) {
i.setMaxAdValue("close_url", str);
}
a();
} else if ("/adservice/expand_ad".equals(path)) {
if (i.Z0() && !a) {
if (com.applovin.impl.sdk.n.a()) {
this.b.b("AdWebView", "Skipping expand command without user interaction");
}
return true;
}
a(bVar.getLastClickEvent());
} else if ("/adservice/contract_ad".equals(path)) {
b();
} else {
if ("/adservice/no_op".equals(path)) {
return true;
}
if ("/adservice/load_url".equals(path)) {
if (a(a, i, parse)) {
if (com.applovin.impl.sdk.n.a()) {
this.b.b("AdWebView", "Skipping URL load command without user interaction");
}
return true;
}
tp.a(parse, this.c, this.a);
} else if ("/adservice/track_click_now".equals(path)) {
if (a(a, i, parse)) {
if (com.applovin.impl.sdk.n.a()) {
this.b.b("AdWebView", "Skipping click tracking command without user interaction");
}
return true;
}
if (i instanceof aq) {
a((aq) i, bVar);
} else {
a(bVar, Uri.parse("/adservice/track_click_now"));
}
} else if ("/adservice/deeplink".equals(path)) {
if (a(a, i, parse)) {
if (com.applovin.impl.sdk.n.a()) {
this.b.b("AdWebView", "Skipping deep link plus command without user interaction");
}
return true;
}
if (i instanceof aq) {
aq aqVar = (aq) i;
if (aqVar.A1()) {
a(aqVar, bVar);
}
}
a(bVar, parse);
} else if ("/adservice/postback".equals(path)) {
tp.a(parse, i, this.a);
} else if ("/ga_init".equals(path)) {
this.c.b(parse);
} else if ("/ga_event".equals(path)) {
this.c.a(parse);
} else if ("/playable_event".equals(path)) {
a(parse);
} else if ("/adservice/direct_download".equals(path)) {
Bundle a2 = tp.a(parse);
if (i instanceof aq) {
aq aqVar2 = (aq) i;
if (aqVar2.A1()) {
a(aqVar2, bVar, a2);
}
}
a(bVar, i.i(), a2);
} else if ("/template_error".equals(path)) {
tp.b(parse, i, this.a);
} else if (this.c.h() != null) {
if ("/video_began".equals(path)) {
this.c.h().b(yp.a(parse.getQueryParameter(IronSourceConstants.EVENTS_DURATION), 0.0d));
} else if ("/video_completed".equals(path)) {
this.c.h().e();
} else if ("/video_progress".equals(path)) {
this.c.h().a(yp.a(parse.getQueryParameter("percent_viewed"), 0.0d));
} else if ("/video_waiting".equals(path)) {
this.c.h().a();
} else if ("/video_resumed".equals(path)) {
this.c.h().d();
}
} else if ("/adservice/fully_watched".equals(path)) {
this.c.A();
} else {
if (com.applovin.impl.sdk.n.a()) {
this.b.k("AdWebView", "Unknown URL: " + str);
}
if (com.applovin.impl.sdk.n.a()) {
this.b.k("AdWebView", "Path: " + path);
}
}
}
} else if (z2) {
List x0 = i.x0();
List w0 = i.w0();
if ((!x0.isEmpty() && !x0.contains(scheme)) || (!w0.isEmpty() && !w0.contains(host))) {
if (com.applovin.impl.sdk.n.a()) {
this.b.b("AdWebView", "URL is not whitelisted - bypassing click");
}
} else {
if (i instanceof aq) {
aq aqVar3 = (aq) i;
if (aqVar3.A1()) {
a(aqVar3, bVar);
if (!a && i.f1()) {
this.a.E().a(la.E, a(i, parse));
}
}
}
a(bVar, parse);
if (!a) {
this.a.E().a(la.E, a(i, parse));
}
}
}
}
return true;
}
private boolean a(boolean z, com.applovin.impl.sdk.ad.b bVar, Uri uri) {
if (z) {
return false;
}
if (bVar.Z0()) {
return true;
}
if (bVar.f1()) {
this.a.E().a(la.E, a(bVar, uri));
}
return false;
}
private static Map a(com.applovin.impl.sdk.ad.b bVar, Uri uri) {
Map a = ma.a(bVar);
CollectionUtils.putStringIfValid("url", uri.toString(), a);
return a;
}
private void a() {
this.c.z();
}
private void a(MotionEvent motionEvent) {
this.c.a(motionEvent);
}
private void a(b bVar, Uri uri) {
a(bVar, uri, (Bundle) null);
}
private void a(b bVar, Uri uri, Bundle bundle) {
com.applovin.impl.sdk.ad.b currentAd = bVar.getCurrentAd();
AppLovinAdView k = this.c.k();
if (k != null && currentAd != null) {
if (currentAd instanceof aq) {
((aq) currentAd).getAdEventTracker().v();
}
this.c.a(currentAd, k, uri, bVar.getAndClearLastClickEvent(), bundle);
} else if (com.applovin.impl.sdk.n.a()) {
this.b.b("AdWebView", "Attempting to track click that is null or not an ApplovinAdView instance for clickedUri = " + uri);
}
}
private void a(Uri uri) {
String str;
boolean booleanQueryParameter = uri.getBooleanQueryParameter("success", false);
String queryParameter = uri.getQueryParameter("type");
if (booleanQueryParameter) {
str = "Tracked event: " + queryParameter;
} else {
str = "Failed to track event: " + queryParameter;
}
yp.a(str, com.applovin.impl.sdk.j.l());
}
}