Proxy Master v3.4.9版本的 MD5 值为:14d0aa2468d13530c8f6e96bcc114bf5
以下内容为反编译后的 c.java 源代码,内容仅作参考
package sg.bigo.ads.core.mraid;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Point;
import android.graphics.Rect;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.webkit.ConsoleMessage;
import android.webkit.JsResult;
import android.webkit.RenderProcessGoneDetail;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Toast;
import com.google.android.exoplayer2.text.ttml.TtmlNode;
import com.google.android.gms.common.internal.ImagesContract;
import io.appmetrica.analytics.coreutils.internal.StringUtils;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import org.json.JSONObject;
import sg.bigo.ads.core.mraid.a.a;
import sg.bigo.ads.core.mraid.h;
import sg.bigo.ads.core.mraid.q;
public final class c {
b f34265a;
o f34266b;
boolean f34267c;
public boolean f34268d;
private final n f34269e;
private final h f34270f;
private C0389c f34271g;
private final WebViewClient f34272h;
public static class AnonymousClass6 {
static final int[] f34279a;
static {
int[] iArr = new int[g.values().length];
f34279a = iArr;
try {
iArr[g.CLOSE.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
f34279a[g.RESIZE.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
f34279a[g.UNLOAD.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
f34279a[g.EXPAND.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
f34279a[g.USE_CUSTOM_CLOSE.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
f34279a[g.OPEN.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
f34279a[g.SET_ORIENTATION_PROPERTIES.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
try {
f34279a[g.PLAY_VIDEO.ordinal()] = 8;
} catch (NoSuchFieldError unused8) {
}
try {
f34279a[g.STORE_PICTURE.ordinal()] = 9;
} catch (NoSuchFieldError unused9) {
}
try {
f34279a[g.CREATE_CALENDAR_EVENT.ordinal()] = 10;
} catch (NoSuchFieldError unused10) {
}
try {
f34279a[g.UNSPECIFIED.ordinal()] = 11;
} catch (NoSuchFieldError unused11) {
}
}
}
public interface a extends b {
void a(String str, String str2);
}
public interface b {
void a();
void a(int i10, int i11, int i12, int i13, a.EnumC0388a enumC0388a, boolean z6);
void a(String str);
void a(String str, sg.bigo.ads.common.h hVar);
void a(String str, boolean z6);
void a(sg.bigo.ads.core.mraid.b bVar);
void a(boolean z6);
void a(boolean z6, i iVar);
boolean a(JsResult jsResult);
void b();
void b(boolean z6);
void c();
boolean d();
void e();
void f();
}
public static class C0389c extends sg.bigo.ads.core.g.b {
boolean f34280a;
private a f34281f;
private q f34282g;
private sg.bigo.ads.common.h f34283h;
public interface a {
void a(sg.bigo.ads.core.mraid.b bVar);
void a(boolean z6);
}
private C0389c(Context context) {
super(context);
this.f34283h = new sg.bigo.ads.common.h();
this.f34282g = new q(this);
this.f34282g.f34403d = new q.b() {
@Override
public final void a(boolean z6, sg.bigo.ads.core.mraid.b bVar) {
C0389c.this.setMraidViewable(z6);
C0389c.a(C0389c.this, bVar);
}
};
}
public C0389c(Context context, byte b6) {
this(context);
}
public static void a(C0389c c0389c, sg.bigo.ads.core.mraid.b bVar) {
a aVar = c0389c.f34281f;
if (aVar != null) {
aVar.a(bVar);
}
}
public void setMraidViewable(boolean z6) {
if (this.f34280a == z6) {
return;
}
this.f34280a = z6;
a aVar = this.f34281f;
if (aVar != null) {
aVar.a(z6);
}
}
@Override
public final void destroy() {
super.destroy();
setWebChromeClient(null);
setWebViewClient(null);
this.f34282g = null;
this.f34281f = null;
}
public final sg.bigo.ads.common.h getClickPoints() {
return this.f34283h;
}
@Override
public final boolean onTouchEvent(MotionEvent motionEvent) {
if (motionEvent.getActionMasked() == 1) {
this.f34283h.f32844b = new Point((int) motionEvent.getX(), (int) motionEvent.getY());
}
if (motionEvent.getActionMasked() == 0) {
this.f34283h.f32843a = new Point((int) motionEvent.getX(), (int) motionEvent.getY());
}
return super.onTouchEvent(motionEvent);
}
@Override
public final void onVisibilityChanged(View view, int i10) {
super.onVisibilityChanged(view, i10);
if (this.f34282g == null) {
setMraidViewable(i10 == 0);
} else if (i10 != 0) {
setMraidViewable(false);
}
}
public final void setVisibilityChangedListener(a aVar) {
this.f34281f = aVar;
}
}
public c(n nVar) {
this(nVar, new h());
}
private c(n nVar, h hVar) {
this.f34268d = false;
this.f34272h = new k() {
@Override
public final void a(RenderProcessGoneDetail renderProcessGoneDetail) {
String str;
b bVar;
boolean didCrash;
c cVar = c.this;
if (renderProcessGoneDetail != null) {
didCrash = renderProcessGoneDetail.didCrash();
if (didCrash) {
str = "Render process has crashed";
sg.bigo.ads.common.n.a.a(0, "MraidBridge", str);
cVar.a();
bVar = cVar.f34265a;
if (bVar == null) {
bVar.c();
return;
}
return;
}
}
str = "Render process is gone";
sg.bigo.ads.common.n.a.a(0, "MraidBridge", str);
cVar.a();
bVar = cVar.f34265a;
if (bVar == null) {
}
}
@Override
public final void onPageFinished(WebView webView, String str) {
super.onPageFinished(webView, str);
c cVar = c.this;
if (cVar.f34267c) {
return;
}
cVar.f34267c = true;
b bVar = cVar.f34265a;
if (bVar != null) {
bVar.a();
}
}
@Override
public final void onReceivedError(WebView webView, int i10, String str, String str2) {
sg.bigo.ads.common.n.a.a(0, "MraidBridge", "Error: ".concat(String.valueOf(str)));
super.onReceivedError(webView, i10, str, str2);
}
@Override
public final boolean shouldOverrideUrlLoading(WebView webView, String str) {
return c.this.d(str);
}
};
this.f34269e = nVar;
this.f34270f = hVar;
}
private static int a(int i10, int i11) {
if (i10 < i11 || i10 > 100000) {
throw new d("Integer parameter out of range: ".concat(String.valueOf(i10)));
}
return i10;
}
private static String a(Rect rect) {
return rect.left + StringUtils.COMMA + rect.top + StringUtils.COMMA + rect.width() + StringUtils.COMMA + rect.height();
}
private static Map<String, String> a(Uri uri) {
HashMap hashMap = new HashMap();
for (String str : uri.getQueryParameterNames()) {
hashMap.put(str, TextUtils.join(StringUtils.COMMA, uri.getQueryParameters(str)));
}
return hashMap;
}
public static C0389c a(Context context) {
try {
return new C0389c(context, (byte) 0);
} catch (Exception e10) {
sg.bigo.ads.core.c.a.a(3000, 10100, Log.getStackTraceString(e10));
return null;
}
}
private static boolean a(String str, boolean z6) {
return str == null ? z6 : g(str);
}
private static boolean a(Map<String, String> map) {
return a(map.get("shouldUseCustomClose"), false);
}
private static String b(Rect rect) {
return rect.width() + StringUtils.COMMA + rect.height();
}
private boolean d() {
o oVar = this.f34266b;
if (oVar != null) {
return this.f34268d ? oVar.f34391a.f34393a : oVar.a();
}
return false;
}
private static String e(String str) {
if (str != null) {
return str;
}
throw new d("Parameter cannot be null");
}
private static int f(String str) {
try {
return Integer.parseInt(str, 10);
} catch (NumberFormatException unused) {
throw new d("Invalid numeric parameter: ".concat(String.valueOf(str)));
}
}
private static boolean g(String str) {
if ("true".equals(str)) {
return true;
}
if ("false".equals(str)) {
return false;
}
throw new d("Invalid boolean parameter: ".concat(String.valueOf(str)));
}
public final void a() {
C0389c c0389c = this.f34271g;
if (c0389c != null) {
c0389c.setOnTouchListener(null);
this.f34271g.setVisibilityChangedListener(null);
this.f34271g.destroy();
this.f34271g = null;
}
}
public final void a(String str) {
if (this.f34271g == null) {
sg.bigo.ads.common.n.a.a(0, "MraidBridge", "MRAID bridge called setContentHtml before WebView was attached");
return;
}
this.f34267c = false;
sg.bigo.ads.common.n.a.a(0, 3, "MraidBridge", "MraidBridge setContentHtml");
this.f34271g.loadDataWithBaseURL("https://mraid.bigo.sg", str, "text/html", null, null);
}
public final void a(sg.bigo.ads.core.mraid.b bVar) {
StringBuilder sb2 = new StringBuilder("mraidbridge.notifyExposureChangeEvent(");
sb2.append(String.valueOf(bVar.f34262a) + ", " + sg.bigo.ads.core.mraid.b.a(bVar.f34263b) + ", " + sg.bigo.ads.core.mraid.b.a(bVar.f34264c));
sb2.append(");");
c(sb2.toString());
}
public final void a(C0389c c0389c) {
this.f34271g = c0389c;
c0389c.getSettings().setJavaScriptEnabled(true);
if (this.f34269e == n.INTERSTITIAL) {
c0389c.getSettings().setMediaPlaybackRequiresUserGesture(false);
}
this.f34271g.setScrollContainer(false);
this.f34271g.setVerticalScrollBarEnabled(false);
this.f34271g.setHorizontalScrollBarEnabled(false);
this.f34271g.setBackgroundColor(0);
this.f34271g.setWebViewClient(this.f34272h);
this.f34271g.setWebChromeClient(new sg.bigo.ads.core.g.c() {
@Override
public final void a(WebView webView, String str, String str2) {
super.a(webView, str, str2);
b bVar = c.this.f34265a;
if (bVar == null || !(bVar instanceof a)) {
return;
}
((a) bVar).a(str, str2);
}
@Override
public final boolean onConsoleMessage(ConsoleMessage consoleMessage) {
b bVar = c.this.f34265a;
return bVar != null ? bVar.d() : super.onConsoleMessage(consoleMessage);
}
@Override
public final boolean onJsAlert(WebView webView, String str, String str2, JsResult jsResult) {
b bVar = c.this.f34265a;
return bVar != null ? bVar.a(jsResult) : super.onJsAlert(webView, str, str2, jsResult);
}
@Override
public final void onShowCustomView(View view, WebChromeClient.CustomViewCallback customViewCallback) {
super.onShowCustomView(view, customViewCallback);
}
});
this.f34266b = new o(this.f34271g.getContext());
this.f34271g.setOnTouchListener(new View.OnTouchListener() {
@Override
public final boolean onTouch(View view, MotionEvent motionEvent) {
c.this.f34266b.onTouchEvent(motionEvent);
int action = motionEvent.getAction();
if ((action == 0 || action == 1) && !view.hasFocus()) {
view.requestFocus();
return false;
}
return false;
}
});
this.f34271g.setVisibilityChangedListener(new C0389c.a() {
@Override
public final void a(sg.bigo.ads.core.mraid.b bVar) {
b bVar2 = c.this.f34265a;
if (bVar2 != null) {
bVar2.a(bVar);
}
}
@Override
public final void a(boolean z6) {
b bVar = c.this.f34265a;
if (bVar != null) {
bVar.a(z6);
}
}
});
}
public final void a(g gVar, String str) {
c("window.mraidbridge.notifyErrorEvent(" + JSONObject.quote(gVar.f34350l) + ", " + JSONObject.quote(str) + ")");
}
public final void a(j jVar) {
String str;
StringBuilder sb2 = new StringBuilder("mraidbridge.setScreenSize(");
sb2.append(b(jVar.f34373b));
sb2.append(");mraidbridge.setMaxSize(");
sb2.append(b(jVar.f34375d));
sb2.append(");mraidbridge.setCurrentPosition(");
sb2.append(a(jVar.f34377f));
sb2.append(");mraidbridge.setDefaultPosition(");
sb2.append(a(jVar.f34379h));
sb2.append(");mraidbridge.setCurrentAppOrientation(");
C0389c c0389c = this.f34271g;
if (c0389c == null) {
str = "";
} else {
Context context = c0389c.getContext();
Activity activity = context instanceof Activity ? (Activity) context : null;
String str2 = context.getResources().getConfiguration().orientation == 2 ? "landscape" : "portrait";
boolean z6 = false;
if (activity == null) {
sg.bigo.ads.common.n.a.a(0, 3, "MraidBridge", "Context is not an Activity, set locked to false");
} else if (activity.getRequestedOrientation() != -1) {
z6 = true;
}
str = "'" + str2 + "', " + z6;
}
sb2.append(str);
sb2.append(")");
c(sb2.toString());
c("mraidbridge.notifySizeChangeEvent(" + b(jVar.f34377f) + ")");
}
public final void a(n nVar) {
c("mraidbridge.setPlacementType(" + JSONObject.quote(nVar.toString().toLowerCase(Locale.US)) + ")");
}
public final void a(p pVar) {
c("mraidbridge.setState(" + JSONObject.quote(pVar.toString().toLowerCase(Locale.US)) + ")");
}
public final void a(boolean z6) {
c("mraidbridge.setIsViewable(" + z6 + ")");
}
public final void a(boolean z6, boolean z9, boolean z10, boolean z11, boolean z12) {
c("mraidbridge.setSupports(" + z6 + StringUtils.COMMA + z9 + StringUtils.COMMA + z10 + StringUtils.COMMA + z11 + StringUtils.COMMA + z12 + ")");
}
public final void b(String str) {
C0389c c0389c = this.f34271g;
if (c0389c == null) {
sg.bigo.ads.common.n.a.a(0, "MraidBridge", "MRAID bridge called setContentHtml while WebView was not attached");
return;
}
this.f34267c = false;
c0389c.loadUrl(str);
}
public final boolean b() {
C0389c c0389c = this.f34271g;
return c0389c != null && c0389c.f34280a;
}
public final void c(String str) {
if (this.f34271g == null) {
sg.bigo.ads.common.n.a.a(0, "MraidBridge", "Attempted to inject Javascript into MRAID WebView while was not attached:\n\t".concat(String.valueOf(str)));
return;
}
sg.bigo.ads.common.n.a.a(0, 3, "MraidBridge", "Injecting Javascript into MRAID WebView:\n\t".concat(String.valueOf(str)));
this.f34271g.loadUrl("javascript:".concat(String.valueOf(str)));
}
public final boolean c() {
return this.f34271g != null;
}
public final boolean d(String str) {
Map<String, String> a8;
a.EnumC0388a enumC0388a;
a.EnumC0388a enumC0388a2;
i iVar;
b bVar;
try {
Uri parse = Uri.parse(str);
if (parse == null) {
return true;
}
String scheme = parse.getScheme();
String host = parse.getHost();
if ("mopub".equals(scheme)) {
if ("failLoad".equals(host) && this.f34269e == n.INLINE && (bVar = this.f34265a) != null) {
bVar.b();
}
return true;
}
if (d() && !"mraid".equals(scheme)) {
try {
StringBuilder sb2 = new StringBuilder("mraid://open?url=");
try {
sb2.append(URLEncoder.encode(str, "UTF-8"));
parse = Uri.parse(sb2.toString());
host = parse.getHost();
scheme = parse.getScheme();
} catch (UnsupportedEncodingException unused) {
sg.bigo.ads.common.n.a.a(0, "MraidBridge", "Invalid MRAID URL encoding: ".concat(String.valueOf(str)));
a(g.OPEN, "Non-mraid URL is invalid");
return false;
}
} catch (UnsupportedEncodingException unused2) {
}
}
if (!"mraid".equals(scheme)) {
o oVar = this.f34266b;
return oVar != null && oVar.a();
}
final g a10 = g.a(host);
try {
a8 = a(parse);
if (a10.a(this.f34269e) && !d()) {
throw new d("Cannot execute this command unless the user clicks");
}
} catch (IllegalArgumentException | d e10) {
a(a10, e10.getMessage());
}
if (this.f34265a != null) {
if (this.f34271g != null) {
switch (AnonymousClass6.f34279a[a10.ordinal()]) {
case 1:
this.f34265a.f();
break;
case 2:
int a11 = a(f(a8.get("width")), 0);
int a12 = a(f(a8.get("height")), 0);
int a13 = a(f(a8.get("offsetX")), -100000);
int a14 = a(f(a8.get("offsetY")), -100000);
String str2 = a8.get("customClosePosition");
a.EnumC0388a enumC0388a3 = a.EnumC0388a.TOP_RIGHT;
if (!TextUtils.isEmpty(str2)) {
if (str2.equals("top-left")) {
enumC0388a = a.EnumC0388a.TOP_LEFT;
} else if (!str2.equals("top-right")) {
if (str2.equals(TtmlNode.CENTER)) {
enumC0388a = a.EnumC0388a.CENTER;
} else if (str2.equals("bottom-left")) {
enumC0388a = a.EnumC0388a.BOTTOM_LEFT;
} else if (str2.equals("bottom-right")) {
enumC0388a = a.EnumC0388a.BOTTOM_RIGHT;
} else if (str2.equals("top-center")) {
enumC0388a = a.EnumC0388a.TOP_CENTER;
} else if (!str2.equals("bottom-center")) {
throw new d("Invalid close position: ".concat(str2));
} else {
enumC0388a = a.EnumC0388a.BOTTOM_CENTER;
}
}
enumC0388a2 = enumC0388a;
this.f34265a.a(a11, a12, a13, a14, enumC0388a2, a(a8.get("allowOffscreen"), true));
this.f34265a.b(false);
break;
}
enumC0388a2 = enumC0388a3;
this.f34265a.a(a11, a12, a13, a14, enumC0388a2, a(a8.get("allowOffscreen"), true));
this.f34265a.b(false);
case 3:
this.f34265a.e();
break;
case 4:
this.f34265a.a(a8.get(ImagesContract.URL), a(a8));
break;
case 5:
this.f34265a.b(a(a8));
break;
case 6:
this.f34265a.a(e(a8.get(ImagesContract.URL)), this.f34271g.getClickPoints());
break;
case 7:
boolean g10 = g(a8.get("allowOrientationChange"));
String str3 = a8.get("forceOrientation");
if ("portrait".equals(str3)) {
iVar = i.PORTRAIT;
} else if ("landscape".equals(str3)) {
iVar = i.LANDSCAPE;
} else if (!"none".equals(str3)) {
throw new d("Invalid orientation: ".concat(String.valueOf(str3)));
} else {
iVar = i.NONE;
}
this.f34265a.a(g10, iVar);
break;
case 8:
this.f34265a.a(e(a8.get("uri")));
break;
case 9:
final String e11 = e(a8.get("uri"));
final h hVar = this.f34270f;
final Context context = this.f34271g.getContext();
final h.c cVar = new h.c() {
@Override
public final void a(d dVar) {
c.this.a(a10, dVar.getMessage());
}
};
if (!h.c(context)) {
sg.bigo.ads.common.n.a.a(0, "MraidBridge", "Error downloading file - the device does not have an SD card mounted, or the Android permission is not granted.");
throw new d("Error downloading file - the device does not have an SD card mounted, or the Android permission is not granted.");
} else if (!(context instanceof Activity)) {
Toast.makeText(context, "Downloading image", 0).show();
hVar.a(context, e11, cVar);
break;
} else {
new AlertDialog.Builder(context).setTitle("Save Image").setMessage("Download image to Picture gallery?").setNegativeButton("Cancel", (DialogInterface.OnClickListener) null).setPositiveButton("Okay", new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i10) {
hVar.a(context, e11, cVar);
}
}).setCancelable(true).show();
break;
}
case 10:
h.a(this.f34271g.getContext(), a8);
break;
case 11:
throw new d("Unspecified MRAID Javascript command");
}
c("window.mraidbridge.nativeCallComplete(" + JSONObject.quote(a10.f34350l) + ")");
return true;
}
throw new d("The current WebView is being destroyed");
}
throw new d("Invalid state to execute this command");
} catch (Exception unused3) {
return true;
}
}
}