- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
479 lines
18 KiB
Java
479 lines
18 KiB
Java
package com.applovin.impl;
|
|
|
|
import android.R;
|
|
import android.app.Activity;
|
|
import android.content.ActivityNotFoundException;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.graphics.Color;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.graphics.drawable.GradientDrawable;
|
|
import android.graphics.drawable.StateListDrawable;
|
|
import android.net.Uri;
|
|
import android.os.Build;
|
|
import android.os.Bundle;
|
|
import android.os.SystemClock;
|
|
import android.view.MotionEvent;
|
|
import android.view.View;
|
|
import android.view.ViewTreeObserver;
|
|
import android.view.animation.AlphaAnimation;
|
|
import android.widget.Button;
|
|
import android.widget.FrameLayout;
|
|
import android.widget.ImageButton;
|
|
import android.widget.ImageView;
|
|
import androidx.core.net.MailTo;
|
|
import com.applovin.creative.MaxCreativeDebuggerActivity;
|
|
import com.applovin.creative.MaxCreativeDebuggerDisplayedAdActivity;
|
|
import com.applovin.impl.r;
|
|
import com.applovin.impl.s6;
|
|
import com.applovin.impl.sdk.utils.BundleUtils;
|
|
import com.applovin.impl.sdk.utils.StringUtils;
|
|
import com.applovin.mediation.MaxAdFormat;
|
|
import com.applovin.sdk.AppLovinSdk;
|
|
import com.applovin.sdk.AppLovinSdkUtils;
|
|
import com.unity3d.ads.core.domain.InitializeAndroidBoldSDK;
|
|
import java.lang.ref.WeakReference;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class y4 implements s6.a {
|
|
private static WeakReference m;
|
|
private static final AtomicBoolean n = new AtomicBoolean();
|
|
private final com.applovin.impl.sdk.j a;
|
|
private final Context b;
|
|
private final x4 e;
|
|
private s6 g;
|
|
private go h;
|
|
private int i;
|
|
private boolean j;
|
|
private long k;
|
|
private boolean l;
|
|
private final List c = new ArrayList(10);
|
|
private final Object d = new Object();
|
|
private WeakReference f = new WeakReference(null);
|
|
|
|
private Drawable f() {
|
|
GradientDrawable gradientDrawable = new GradientDrawable();
|
|
gradientDrawable.setShape(1);
|
|
gradientDrawable.setColor(Color.rgb(5, 131, 170));
|
|
GradientDrawable gradientDrawable2 = new GradientDrawable();
|
|
gradientDrawable2.setShape(1);
|
|
gradientDrawable2.setColor(Color.rgb(2, 98, 127));
|
|
StateListDrawable stateListDrawable = new StateListDrawable();
|
|
stateListDrawable.addState(new int[]{R.attr.state_pressed}, gradientDrawable2);
|
|
stateListDrawable.addState(new int[0], gradientDrawable);
|
|
return stateListDrawable;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public boolean h() {
|
|
WeakReference weakReference = m;
|
|
return (weakReference == null || weakReference.get() == null) ? false : true;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void j() {
|
|
this.i = 0;
|
|
}
|
|
|
|
public y4(com.applovin.impl.sdk.j jVar) {
|
|
this.a = jVar;
|
|
Context l = com.applovin.impl.sdk.j.l();
|
|
this.b = l;
|
|
this.e = new x4(l);
|
|
}
|
|
|
|
public void l() {
|
|
if (g()) {
|
|
this.j = ((Boolean) this.a.a(sj.G1)).booleanValue();
|
|
if (this.g == null) {
|
|
this.g = new s6(this.a, this);
|
|
}
|
|
this.g.a();
|
|
}
|
|
}
|
|
|
|
public void k() {
|
|
s6 s6Var = this.g;
|
|
if (s6Var != null) {
|
|
s6Var.b();
|
|
}
|
|
}
|
|
|
|
public void d(Object obj) {
|
|
if (g() && obj != null) {
|
|
if (!af.a(obj) || c(obj)) {
|
|
if (af.b(obj) && c(obj)) {
|
|
return;
|
|
}
|
|
synchronized (this.d) {
|
|
try {
|
|
this.c.add(0, new w6(obj, System.currentTimeMillis()));
|
|
if (this.c.size() > 10) {
|
|
this.c.remove(r6.size() - 1);
|
|
}
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public void n() {
|
|
ArrayList arrayList;
|
|
if (!h() && n.compareAndSet(false, true)) {
|
|
Object a2 = this.a.C().a();
|
|
if (a2 != null) {
|
|
e(a2);
|
|
return;
|
|
}
|
|
synchronized (this.d) {
|
|
arrayList = new ArrayList(this.c);
|
|
}
|
|
this.e.a(arrayList, this.a);
|
|
if (!this.l) {
|
|
m();
|
|
this.l = true;
|
|
}
|
|
com.applovin.impl.sdk.n.g("AppLovinSdk", "Starting Creative Debugger...");
|
|
r.a(this.b, MaxCreativeDebuggerActivity.class);
|
|
return;
|
|
}
|
|
com.applovin.impl.sdk.n.h("AppLovinSdk", "Creative Debugger is already showing");
|
|
}
|
|
|
|
public boolean g() {
|
|
return ((Boolean) this.a.a(sj.F1)).booleanValue() && this.a.g0().isCreativeDebuggerEnabled();
|
|
}
|
|
|
|
public class a extends p {
|
|
public a() {
|
|
}
|
|
|
|
@Override // com.applovin.impl.p, android.app.Application.ActivityLifecycleCallbacks
|
|
public void onActivityCreated(Activity activity, Bundle bundle) {
|
|
if (activity instanceof MaxCreativeDebuggerActivity) {
|
|
com.applovin.impl.sdk.n.g("AppLovinSdk", "Started Creative Debugger");
|
|
if (!y4.this.h() || y4.m.get() != activity) {
|
|
MaxCreativeDebuggerActivity maxCreativeDebuggerActivity = (MaxCreativeDebuggerActivity) activity;
|
|
WeakReference unused = y4.m = new WeakReference(maxCreativeDebuggerActivity);
|
|
maxCreativeDebuggerActivity.a(y4.this.e, y4.this.a.e());
|
|
}
|
|
y4.n.set(false);
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.impl.p, android.app.Application.ActivityLifecycleCallbacks
|
|
public void onActivityDestroyed(Activity activity) {
|
|
if (activity instanceof MaxCreativeDebuggerActivity) {
|
|
com.applovin.impl.sdk.n.g("AppLovinSdk", "Creative Debugger destroyed");
|
|
WeakReference unused = y4.m = null;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void m() {
|
|
this.a.e().a(new a());
|
|
}
|
|
|
|
public class b implements r.b {
|
|
final /* synthetic */ Object a;
|
|
|
|
public b(Object obj) {
|
|
this.a = obj;
|
|
}
|
|
|
|
@Override // com.applovin.impl.r.b
|
|
public void a(MaxCreativeDebuggerDisplayedAdActivity maxCreativeDebuggerDisplayedAdActivity) {
|
|
maxCreativeDebuggerDisplayedAdActivity.a(new w6(this.a, y4.this.a.C().b()), y4.this.a);
|
|
y4.n.set(false);
|
|
}
|
|
}
|
|
|
|
private boolean c(Object obj) {
|
|
MaxAdFormat format;
|
|
if (obj instanceof com.applovin.impl.sdk.ad.b) {
|
|
format = ((com.applovin.impl.sdk.ad.b) obj).getAdZone().d();
|
|
} else {
|
|
format = obj instanceof ge ? ((ge) obj).getFormat() : null;
|
|
}
|
|
return format != null && format.isFullscreenAd();
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public void e() {
|
|
if (g() && this.f.get() == null && !h()) {
|
|
Activity b2 = this.a.e().b();
|
|
if (b2 == null) {
|
|
this.a.J();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.a.J().b("AppLovinSdk", "Failed to display Creative Debugger button");
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
View findViewById = b2.findViewById(R.id.content);
|
|
if (findViewById instanceof FrameLayout) {
|
|
final FrameLayout frameLayout = (FrameLayout) findViewById;
|
|
final View a2 = a(frameLayout, b2);
|
|
frameLayout.addView(a2);
|
|
AlphaAnimation alphaAnimation = new AlphaAnimation(0.0f, 1.0f);
|
|
alphaAnimation.setDuration(150L);
|
|
a2.startAnimation(alphaAnimation);
|
|
final ViewTreeObserver viewTreeObserver = findViewById.getViewTreeObserver();
|
|
final ViewTreeObserver.OnGlobalLayoutListener onGlobalLayoutListener = new ViewTreeObserver.OnGlobalLayoutListener() { // from class: com.applovin.impl.y4$$ExternalSyntheticLambda3
|
|
@Override // android.view.ViewTreeObserver.OnGlobalLayoutListener
|
|
public final void onGlobalLayout() {
|
|
y4.this.a(a2, frameLayout);
|
|
}
|
|
};
|
|
viewTreeObserver.addOnGlobalLayoutListener(onGlobalLayoutListener);
|
|
AppLovinSdkUtils.runOnUiThreadDelayed(new Runnable() { // from class: com.applovin.impl.y4$$ExternalSyntheticLambda4
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
y4.this.a(a2, frameLayout, viewTreeObserver, onGlobalLayoutListener);
|
|
}
|
|
}, TimeUnit.SECONDS.toMillis(5L));
|
|
this.f = new WeakReference(a2);
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void i() {
|
|
long seconds = TimeUnit.MILLISECONDS.toSeconds(SystemClock.elapsedRealtime() - this.k);
|
|
if (this.k == 0 || seconds < 10) {
|
|
return;
|
|
}
|
|
this.a.E().a(la.d, "showingMediationDebuggerFromHoldingCreativeDebuggerButton");
|
|
this.a.U0();
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
/* JADX WARN: Type inference failed for: r0v4, types: [android.view.View, android.widget.ImageButton, android.widget.ImageView] */
|
|
private View a(final FrameLayout frameLayout, Activity activity) {
|
|
Button button;
|
|
int dpToPx = AppLovinSdkUtils.dpToPx(activity, 40);
|
|
int i = dpToPx / 10;
|
|
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(dpToPx, dpToPx, 8388629);
|
|
layoutParams.setMargins(i, i, i, i);
|
|
try {
|
|
?? imageButton = new ImageButton(activity);
|
|
imageButton.setImageDrawable(activity.getResources().getDrawable(com.applovin.sdk.R.drawable.applovin_ic_white_small));
|
|
imageButton.setScaleType(ImageView.ScaleType.FIT_CENTER);
|
|
imageButton.setPadding(i, i, i, i * 2);
|
|
button = imageButton;
|
|
} catch (Throwable unused) {
|
|
Button button2 = new Button(activity);
|
|
button2.setText("ⓘ");
|
|
button2.setTextColor(-1);
|
|
button2.setAllCaps(false);
|
|
button2.setTextSize(2, 20.0f);
|
|
button2.setPadding(0, 0, 0, 0);
|
|
button = button2;
|
|
}
|
|
button.setLayoutParams(layoutParams);
|
|
button.setBackground(f());
|
|
if (this.j) {
|
|
button.setOnTouchListener(new View.OnTouchListener() { // from class: com.applovin.impl.y4$$ExternalSyntheticLambda1
|
|
@Override // android.view.View.OnTouchListener
|
|
public final boolean onTouch(View view, MotionEvent motionEvent) {
|
|
boolean a2;
|
|
a2 = y4.this.a(frameLayout, view, motionEvent);
|
|
return a2;
|
|
}
|
|
});
|
|
} else {
|
|
button.setOnClickListener(new View.OnClickListener() { // from class: com.applovin.impl.y4$$ExternalSyntheticLambda2
|
|
@Override // android.view.View.OnClickListener
|
|
public final void onClick(View view) {
|
|
y4.this.a(view);
|
|
}
|
|
});
|
|
}
|
|
if (z3.f()) {
|
|
button.setElevation(AppLovinSdkUtils.dpToPx(activity, 5));
|
|
}
|
|
return button;
|
|
}
|
|
|
|
public String b(Object obj) {
|
|
JSONObject a2;
|
|
if (obj instanceof com.applovin.impl.sdk.ad.b) {
|
|
return ((com.applovin.impl.sdk.ad.b) obj).getOriginalFullResponse().toString();
|
|
}
|
|
if (!(obj instanceof ge)) {
|
|
return null;
|
|
}
|
|
String D = ((ge) obj).D();
|
|
return (!af.b(obj) || (a2 = new w(D, this.a).a()) == null) ? D : a2.toString();
|
|
}
|
|
|
|
private void e(Object obj) {
|
|
com.applovin.impl.sdk.n.g("AppLovinSdk", "Starting Creative Debugger for current fullscreen ad...");
|
|
r.a(this.b, MaxCreativeDebuggerDisplayedAdActivity.class, this.a.e(), new b(obj));
|
|
}
|
|
|
|
@Override // com.applovin.impl.s6.a
|
|
public void b() {
|
|
if (this.i == 0) {
|
|
this.h = go.a(TimeUnit.SECONDS.toMillis(3L), this.a, new Runnable() { // from class: com.applovin.impl.y4$$ExternalSyntheticLambda5
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
y4.this.j();
|
|
}
|
|
});
|
|
}
|
|
int i = this.i;
|
|
if (i % 2 == 0) {
|
|
this.i = i + 1;
|
|
}
|
|
}
|
|
|
|
public void a(w6 w6Var, Context context, boolean z) {
|
|
Object a2 = w6Var.a();
|
|
String a3 = a(w6Var);
|
|
qc qcVar = new qc();
|
|
if (z) {
|
|
qcVar.b("Please describe the issue you had with this ad:\n\n\n\n");
|
|
}
|
|
qcVar.b(a3);
|
|
String b2 = this.a.w().b(a2);
|
|
if (b2 != null) {
|
|
qcVar.a("\nBid Response:\n");
|
|
qcVar.a(b2);
|
|
}
|
|
Intent createChooser = Intent.createChooser(new Intent("android.intent.action.SEND").setType("text/plain").putExtra("android.intent.extra.SUBJECT", a2 instanceof com.applovin.impl.sdk.ad.b ? "AppLovin Ad Report" : "MAX Ad Report").putExtra("android.intent.extra.TEXT", qcVar.toString()).setPackage(null), "Share Ad Report");
|
|
if (z) {
|
|
try {
|
|
context.startActivity(new Intent("android.intent.action.SENDTO", Uri.parse(MailTo.MAILTO_SCHEME)).putExtra("android.intent.extra.SUBJECT", a2 instanceof com.applovin.impl.sdk.ad.b ? "AppLovin Ad Report" : "MAX Ad Report").putExtra("android.intent.extra.TEXT", qcVar.toString()).setPackage("com.google.android.gm"));
|
|
return;
|
|
} catch (ActivityNotFoundException unused) {
|
|
context.startActivity(createChooser);
|
|
return;
|
|
}
|
|
}
|
|
context.startActivity(createChooser);
|
|
}
|
|
|
|
private void b(View view, FrameLayout frameLayout) {
|
|
if (this.j) {
|
|
view.setOnTouchListener(null);
|
|
this.k = 0L;
|
|
}
|
|
frameLayout.removeView(view);
|
|
this.f = new WeakReference(null);
|
|
}
|
|
|
|
public String a(w6 w6Var) {
|
|
Object a2 = w6Var.a();
|
|
qc qcVar = new qc();
|
|
qcVar.b("Ad Info:\n");
|
|
if (a2 instanceof com.applovin.impl.sdk.ad.b) {
|
|
com.applovin.impl.sdk.ad.b bVar = (com.applovin.impl.sdk.ad.b) a2;
|
|
qcVar.a(InitializeAndroidBoldSDK.MSG_NETWORK, "APPLOVIN").a(bVar).b(bVar);
|
|
} else if (a2 instanceof ge) {
|
|
qcVar.a((ge) a2);
|
|
}
|
|
qcVar.a(this.a);
|
|
qcVar.a("Epoch Timestamp (ms)", Long.valueOf(w6Var.b()));
|
|
qcVar.a("\nDebug Info:\n").a("Platform", "fireos".equals(this.a.y().v()) ? "Fire OS" : com.ironsource.v8.d).a("AppLovin SDK Version", AppLovinSdk.VERSION).a("Plugin Version", this.a.a(sj.a4)).a("App Package Name", this.b.getPackageName()).a("Device", String.format("%s %s (%s)", Build.BRAND, Build.MODEL, Build.DEVICE)).a("OS Version", Build.VERSION.RELEASE).a("AppLovin Random Token", this.a.a0()).a("Ad Review Version", v.b()).a(a(a2)).a("User ID", this.a.q0().c() != null ? this.a.q0().c() : "None").a("MD", this.a.a(sj.v));
|
|
return qcVar.toString();
|
|
}
|
|
|
|
private Bundle a(Object obj) {
|
|
this.a.J();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.a.J().a("CreativeDebuggerService", "Retrieving Ad Review info for ad: " + obj);
|
|
}
|
|
String a2 = yp.a(obj);
|
|
Bundle a3 = this.a.h().a(a2);
|
|
this.a.J();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.a.J().a("CreativeDebuggerService", "Serve id: " + a2);
|
|
}
|
|
this.a.J();
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
this.a.J().a("CreativeDebuggerService", "Public data: " + a3);
|
|
}
|
|
if (a3 == null) {
|
|
return null;
|
|
}
|
|
for (String str : a3.keySet()) {
|
|
Object obj2 = a3.get(str);
|
|
a3.remove(str);
|
|
BundleUtils.put(StringUtils.toHumanReadableString(str), obj2, a3);
|
|
}
|
|
return a3;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void a(View view, FrameLayout frameLayout) {
|
|
if (view.getParent() != null || this.f.get() == null) {
|
|
return;
|
|
}
|
|
frameLayout.addView(view);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void a(View view, FrameLayout frameLayout, ViewTreeObserver viewTreeObserver, ViewTreeObserver.OnGlobalLayoutListener onGlobalLayoutListener) {
|
|
if (this.k > 0 && this.j) {
|
|
view.setVisibility(4);
|
|
} else {
|
|
b(view, frameLayout);
|
|
}
|
|
if (viewTreeObserver.isAlive()) {
|
|
viewTreeObserver.removeOnGlobalLayoutListener(onGlobalLayoutListener);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ boolean a(FrameLayout frameLayout, View view, MotionEvent motionEvent) {
|
|
if (motionEvent.getAction() == 0) {
|
|
this.k = SystemClock.elapsedRealtime();
|
|
AppLovinSdkUtils.runOnUiThreadDelayed(new Runnable() { // from class: com.applovin.impl.y4$$ExternalSyntheticLambda6
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
y4.this.i();
|
|
}
|
|
}, TimeUnit.SECONDS.toMillis(10L));
|
|
} else if (motionEvent.getAction() == 1 || motionEvent.getAction() == 3) {
|
|
if (view.getVisibility() == 0) {
|
|
this.k = 0L;
|
|
n();
|
|
} else {
|
|
b(view, frameLayout);
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void a(View view) {
|
|
n();
|
|
}
|
|
|
|
@Override // com.applovin.impl.s6.a
|
|
public void a() {
|
|
int i = this.i;
|
|
if (i % 2 == 1) {
|
|
this.i = i + 1;
|
|
}
|
|
if (this.i / 2 == 2) {
|
|
AppLovinSdkUtils.runOnUiThread(new Runnable() { // from class: com.applovin.impl.y4$$ExternalSyntheticLambda0
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
y4.this.e();
|
|
}
|
|
});
|
|
this.i = 0;
|
|
this.h.a();
|
|
}
|
|
}
|
|
}
|