Idle Tower v2.48版本的 MD5 值为:56f20496f6a85726b376356ed2ecee23

以下内容为反编译后的 a.java 源代码,内容仅作参考


package com.applovin.impl.adview.activity.b;

import android.app.Activity;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import com.applovin.adview.AppLovinAdView;
import com.applovin.adview.AppLovinFullscreenActivity;
import com.applovin.impl.adview.j;
import com.applovin.impl.adview.n;
import com.applovin.impl.adview.p;
import com.applovin.impl.adview.q;
import com.applovin.impl.adview.v;
import com.applovin.impl.sdk.AppLovinBroadcastManager;
import com.applovin.impl.sdk.b.b;
import com.applovin.impl.sdk.e.ac;
import com.applovin.impl.sdk.e.r;
import com.applovin.impl.sdk.e.y;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.k;
import com.applovin.impl.sdk.o;
import com.applovin.impl.sdk.s;
import com.applovin.impl.sdk.utils.CollectionUtils;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.sdk.utils.Utils;
import com.applovin.impl.sdk.utils.s;
import com.applovin.impl.sdk.x;
import com.applovin.sdk.AppLovinAd;
import com.applovin.sdk.AppLovinAdClickListener;
import com.applovin.sdk.AppLovinAdDisplayListener;
import com.applovin.sdk.AppLovinAdSize;
import com.applovin.sdk.AppLovinAdType;
import com.applovin.sdk.AppLovinAdVideoPlaybackListener;
import com.applovin.sdk.AppLovinSdkUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;

public abstract class a implements AppLovinBroadcastManager.Receiver, b.a {
    private long C;
    private boolean D;
    private final k G;

    protected final com.applovin.impl.sdk.ad.e f913a;
    protected final o b;
    protected final x c;
    protected final com.applovin.impl.sdk.d.d d;
    protected Activity e;
    protected AppLovinAdView f;
    protected v g;
    protected final n h;
    protected final n i;
    protected boolean l;
    protected int m;
    protected boolean n;
    protected boolean r;
    protected AppLovinAdClickListener s;
    protected AppLovinAdDisplayListener t;
    protected AppLovinAdVideoPlaybackListener u;
    protected final com.applovin.impl.sdk.b.b v;
    protected s w;
    private final com.applovin.impl.sdk.utils.a y;
    private final j.a z;
    private final Handler x = new Handler(Looper.getMainLooper());
    protected final long j = SystemClock.elapsedRealtime();
    private final AtomicBoolean A = new AtomicBoolean();
    private final AtomicBoolean B = new AtomicBoolean();
    protected long k = -1;
    private int E = 0;
    private final ArrayList<Long> F = new ArrayList<>();
    protected int o = 0;
    protected int p = 0;
    protected int q = j.f1527a;
    private boolean H = false;

    public interface InterfaceC0053a {
        void a(a aVar);

        void a(String str, Throwable th);
    }

    public abstract void a(long j);

    public abstract void a(ViewGroup viewGroup);

    public abstract void d();

    public abstract void e();

    protected abstract void n();

    protected abstract boolean s();

    protected abstract boolean t();

    protected abstract void v();

    static int b(a aVar) {
        int i = aVar.E;
        aVar.E = i + 1;
        return i;
    }

    public static void a(com.applovin.impl.sdk.ad.e eVar, AppLovinAdClickListener appLovinAdClickListener, AppLovinAdDisplayListener appLovinAdDisplayListener, AppLovinAdVideoPlaybackListener appLovinAdVideoPlaybackListener, Map<String, Object> map, o oVar, Activity activity, InterfaceC0053a interfaceC0053a) {
        a bVar;
        boolean aM = eVar.aM();
        if (eVar instanceof com.applovin.impl.c.a) {
            if (aM) {
                try {
                    bVar = new c(eVar, activity, map, oVar, appLovinAdClickListener, appLovinAdDisplayListener, appLovinAdVideoPlaybackListener);
                } catch (Throwable th) {
                    oVar.M();
                    if (x.a()) {
                        oVar.M().a("AppLovinFullscreenActivity", "Failed to create ExoPlayer presenter to show the ad. Falling back to using native media player presenter.", th);
                    }
                    try {
                        bVar = new d(eVar, activity, map, oVar, appLovinAdClickListener, appLovinAdDisplayListener, appLovinAdVideoPlaybackListener);
                    } catch (Throwable th2) {
                        interfaceC0053a.a("Failed to create FullscreenVastVideoAdPresenter with sdk: " + oVar + " and throwable: " + th2.getMessage(), th2);
                        return;
                    }
                }
            } else {
                try {
                    bVar = new d(eVar, activity, map, oVar, appLovinAdClickListener, appLovinAdDisplayListener, appLovinAdVideoPlaybackListener);
                } catch (Throwable th3) {
                    interfaceC0053a.a("Failed to create FullscreenVastVideoAdPresenter with sdk: " + oVar + " and throwable: " + th3.getMessage(), th3);
                    return;
                }
            }
        } else if (eVar.hasVideoUrl()) {
            if (eVar.aP()) {
                try {
                    bVar = new g(eVar, activity, map, oVar, appLovinAdClickListener, appLovinAdDisplayListener, appLovinAdVideoPlaybackListener);
                } catch (Throwable th4) {
                    interfaceC0053a.a("Failed to create FullscreenWebVideoAdPresenter with sdk: " + oVar + " and throwable: " + th4.getMessage(), th4);
                    return;
                }
            } else if (aM) {
                try {
                    bVar = new e(eVar, activity, map, oVar, appLovinAdClickListener, appLovinAdDisplayListener, appLovinAdVideoPlaybackListener);
                } catch (Throwable th5) {
                    oVar.M();
                    if (x.a()) {
                        oVar.M().a("AppLovinFullscreenActivity", "Failed to create ExoPlayer presenter to show the ad. Falling back to using native media player presenter.", th5);
                    }
                    try {
                        bVar = new f(eVar, activity, map, oVar, appLovinAdClickListener, appLovinAdDisplayListener, appLovinAdVideoPlaybackListener);
                    } catch (Throwable th6) {
                        interfaceC0053a.a("Failed to create FullscreenVideoAdExoPlayerPresenter with sdk: " + oVar + " and throwable: " + th6.getMessage(), th6);
                        return;
                    }
                }
            } else {
                try {
                    bVar = new f(eVar, activity, map, oVar, appLovinAdClickListener, appLovinAdDisplayListener, appLovinAdVideoPlaybackListener);
                } catch (Throwable th7) {
                    interfaceC0053a.a("Failed to create FullscreenVideoAdPresenter with sdk: " + oVar + " and throwable: " + th7.getMessage(), th7);
                    return;
                }
            }
        } else {
            try {
                bVar = new com.applovin.impl.adview.activity.b.b(eVar, activity, map, oVar, appLovinAdClickListener, appLovinAdDisplayListener, appLovinAdVideoPlaybackListener);
            } catch (Throwable th8) {
                interfaceC0053a.a("Failed to create FullscreenGraphicAdPresenter with sdk: " + oVar + " and throwable: " + th8.getMessage(), th8);
                return;
            }
        }
        bVar.c();
        interfaceC0053a.a(bVar);
    }

    public a(com.applovin.impl.sdk.ad.e eVar, Activity activity, Map<String, Object> map, o oVar, AppLovinAdClickListener appLovinAdClickListener, AppLovinAdDisplayListener appLovinAdDisplayListener, AppLovinAdVideoPlaybackListener appLovinAdVideoPlaybackListener) {
        this.f913a = eVar;
        this.b = oVar;
        this.c = oVar.M();
        this.e = activity;
        this.s = appLovinAdClickListener;
        this.t = appLovinAdDisplayListener;
        this.u = appLovinAdVideoPlaybackListener;
        com.applovin.impl.sdk.b.b bVar = new com.applovin.impl.sdk.b.b(activity, oVar);
        this.v = bVar;
        bVar.a(this);
        this.d = new com.applovin.impl.sdk.d.d(eVar, oVar);
        this.G = new k(oVar);
        b bVar2 = new b();
        if (((Boolean) oVar.a(com.applovin.impl.sdk.c.b.cZ)).booleanValue()) {
            AppLovinBroadcastManager.registerReceiver(this, new IntentFilter("com.applovin.render_process_gone"));
        }
        com.applovin.impl.adview.o oVar2 = new com.applovin.impl.adview.o(oVar.L(), AppLovinAdSize.INTERSTITIAL, activity);
        this.f = oVar2;
        oVar2.setAdClickListener(bVar2);
        this.f.setAdDisplayListener(new AppLovinAdDisplayListener() {
            @Override
            public void adDisplayed(AppLovinAd appLovinAd) {
                x xVar = a.this.c;
                if (x.a()) {
                    a.this.c.b("AppLovinFullscreenActivity", "Web content rendered");
                }
            }

            @Override
            public void adHidden(AppLovinAd appLovinAd) {
                x xVar = a.this.c;
                if (x.a()) {
                    a.this.c.b("AppLovinFullscreenActivity", "Closing from WebView");
                }
                a.this.h();
            }
        });
        this.f.getController().a(this.d);
        if (((Boolean) oVar.a(com.applovin.impl.sdk.c.b.ax)).booleanValue()) {
            this.g = new v(new p(map, oVar), activity);
        }
        oVar.F().trackImpression(eVar);
        List<Integer> u = eVar.u();
        if (eVar.t() >= 0 || u != null) {
            n nVar = new n(eVar.v(), activity);
            this.h = nVar;
            nVar.setVisibility(8);
            this.h.setOnClickListener(bVar2);
        } else {
            this.h = null;
        }
        n nVar2 = new n(j.a.WHITE_ON_TRANSPARENT, activity);
        this.i = nVar2;
        nVar2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                a.this.h();
            }
        });
        if (eVar.ao()) {
            this.z = new j.a() {
                @Override
                public void a(int i) {
                    if (a.this.q != com.applovin.impl.sdk.j.f1527a) {
                        a.this.r = true;
                    }
                    com.applovin.impl.adview.d s = a.this.f.getController().s();
                    if (com.applovin.impl.sdk.j.a(i) && !com.applovin.impl.sdk.j.a(a.this.q)) {
                        s.a("javascript:al_muteSwitchOn();");
                    } else if (i == 2) {
                        s.a("javascript:al_muteSwitchOff();");
                    }
                    a.this.q = i;
                }
            };
        } else {
            this.z = null;
        }
        if (((Boolean) oVar.a(com.applovin.impl.sdk.c.b.fQ)).booleanValue()) {
            this.y = new com.applovin.impl.sdk.utils.a() {
                @Override
                public void onActivityCreated(Activity activity2, Bundle bundle) {
                    if (a.this.B.get()) {
                        return;
                    }
                    if (activity2.getClass().getName().equals(Utils.retrieveLauncherActivityFullyQualifiedName(activity2.getApplicationContext()))) {
                        AppLovinSdkUtils.runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                x.j("AppLovinFullscreenActivity", "Dismissing on-screen ad due to app relaunched via launcher.");
                                try {
                                    a.this.h();
                                } catch (Throwable th) {
                                    x.c("AppLovinFullscreenActivity", "Failed to dismiss ad.", th);
                                    try {
                                        a.this.o();
                                    } catch (Throwable unused) {
                                    }
                                }
                            }
                        });
                    }
                }
            };
        } else {
            this.y = null;
        }
    }

    private void c() {
        if (this.z != null) {
            this.b.ae().a(this.z);
        }
        if (this.y != null) {
            this.b.x().a(this.y);
        }
    }

    public void a(boolean z) {
        List<Uri> checkCachedResourcesExist = Utils.checkCachedResourcesExist(z, this.f913a, this.b, this.e);
        if (checkCachedResourcesExist.isEmpty()) {
            return;
        }
        if (((Boolean) this.b.a(com.applovin.impl.sdk.c.b.fV)).booleanValue()) {
            if (x.a()) {
                this.c.e("AppLovinFullscreenActivity", "Dismissing ad due to missing resources: " + checkCachedResourcesExist);
            }
            q.a(this.f913a, this.t, "Missing ad resources", null, null);
            h();
            return;
        }
        if (x.a()) {
            this.c.e("AppLovinFullscreenActivity", "Streaming ad due to missing ad resources: " + checkCachedResourcesExist);
        }
        this.f913a.a();
    }

    public void b(boolean z) {
        a(z, ((Long) this.b.a(com.applovin.impl.sdk.c.b.cW)).longValue());
        com.applovin.impl.sdk.utils.n.a(this.t, this.f913a);
        this.b.aa().a(this.f913a);
        if (this.f913a.hasVideoUrl() || u()) {
            com.applovin.impl.sdk.utils.n.a(this.u, this.f913a);
        }
        new com.applovin.impl.adview.activity.b(this.e).a(this.f913a);
        this.d.a();
        this.f913a.setHasShown(true);
    }

    public void f() {
        if (x.a()) {
            this.c.c("AppLovinFullscreenActivity", "onResume()");
        }
        this.d.d(SystemClock.elapsedRealtime() - this.C);
        a("javascript:al_onAppResumed();");
        r();
        if (this.v.c()) {
            this.v.a();
        }
    }

    public void c(boolean z) {
        if (x.a()) {
            this.c.c("AppLovinFullscreenActivity", "onWindowFocusChanged(boolean) - " + z);
        }
        a("javascript:al_onWindowFocusChanged( " + z + " );");
    }

    public void g() {
        if (x.a()) {
            this.c.c("AppLovinFullscreenActivity", "onPause()");
        }
        this.C = SystemClock.elapsedRealtime();
        a("javascript:al_onAppPaused();");
        if (this.v.c()) {
            this.v.a();
        }
        q();
    }

    public void h() {
        this.D = true;
        if (x.a()) {
            this.c.c("AppLovinFullscreenActivity", "dismiss()");
        }
        com.applovin.impl.sdk.ad.e eVar = this.f913a;
        if (eVar != null) {
            eVar.o().e();
        }
        this.x.removeCallbacksAndMessages(null);
        a("javascript:al_onPoststitialDismiss();", this.f913a.W());
        o();
        this.d.c();
        this.G.a();
        if (this.z != null) {
            this.b.ae().b(this.z);
        }
        if (this.y != null) {
            this.b.x().b(this.y);
        }
        if (p()) {
            this.e.finish();
            return;
        }
        this.b.M();
        if (x.a()) {
            this.b.M().b("AppLovinFullscreenActivity", "Fullscreen ad shown in container view dismissed, destroying the presenter.");
        }
        k();
    }

    public boolean i() {
        return this.D;
    }

    public void j() {
        if (x.a()) {
            this.c.c("AppLovinFullscreenActivity", "onStop()");
        }
    }

    public void k() {
        AppLovinAdView appLovinAdView = this.f;
        if (appLovinAdView != null) {
            ViewParent parent = appLovinAdView.getParent();
            this.f.destroy();
            this.f = null;
            if ((parent instanceof ViewGroup) && p()) {
                ((ViewGroup) parent).removeAllViews();
            }
        }
        n();
        o();
        this.s = null;
        this.t = null;
        this.u = null;
        this.e = null;
        AppLovinBroadcastManager.unregisterReceiver(this);
    }

    public void a(Configuration configuration) {
        if (x.a()) {
            this.c.c("AppLovinFullscreenActivity", "onConfigurationChanged(Configuration) -  " + configuration);
        }
    }

    public void a(int i, KeyEvent keyEvent) {
        if (this.c == null || !x.a()) {
            return;
        }
        this.c.c("AppLovinFullscreenActivity", "onKeyDown(int, KeyEvent) -  " + i + ", " + keyEvent);
    }

    public void l() {
        if (x.a()) {
            this.c.c("AppLovinFullscreenActivity", "onBackPressed()");
        }
        if (this.H) {
            h();
        }
        if (this.f913a.Y()) {
            b("javascript:onBackPressed();");
        }
    }

    protected void a(String str) {
        if (this.f913a.Z()) {
            a(str, 0L);
        }
    }

    public void b(String str) {
        a(str, 0L);
    }

    public void a(final String str, long j) {
        if (j >= 0) {
            a(new Runnable() {
                @Override
                public void run() {
                    com.applovin.impl.adview.d s;
                    if (!StringUtils.isValidString(str) || a.this.f == null || (s = a.this.f.getController().s()) == null) {
                        return;
                    }
                    s.a(str);
                }
            }, j);
        }
    }

    public void a(n nVar, long j, Runnable runnable) {
        if (j >= ((Long) this.b.a(com.applovin.impl.sdk.c.b.cG)).longValue()) {
            return;
        }
        this.b.N().a(new ac(this.b, new AnonymousClass6(nVar, runnable)), r.b.MAIN, TimeUnit.SECONDS.toMillis(j), true);
    }

    public class AnonymousClass6 implements Runnable {

        final n f920a;
        final Runnable b;

        AnonymousClass6(n nVar, Runnable runnable) {
            this.f920a = nVar;
            this.b = runnable;
        }

        @Override
        public void run() {
            AppLovinSdkUtils.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    com.applovin.impl.sdk.utils.v.a(AnonymousClass6.this.f920a, 400L, new Runnable() {
                        @Override
                        public void run() {
                            AnonymousClass6.this.f920a.bringToFront();
                            AnonymousClass6.this.b.run();
                        }
                    });
                }
            });
        }
    }

    public int m() {
        int H = this.f913a.H();
        return (H <= 0 && ((Boolean) this.b.a(com.applovin.impl.sdk.c.b.cV)).booleanValue()) ? this.m + 1 : H;
    }

    public void a(int i, boolean z, boolean z2, long j) {
        if (this.A.compareAndSet(false, true)) {
            if (this.f913a.hasVideoUrl() || u()) {
                com.applovin.impl.sdk.utils.n.a(this.u, this.f913a, i, z2);
            }
            if (this.f913a.hasVideoUrl()) {
                this.d.c(i);
            }
            long elapsedRealtime = SystemClock.elapsedRealtime() - this.j;
            this.b.F().trackVideoEnd(this.f913a, TimeUnit.MILLISECONDS.toSeconds(elapsedRealtime), i, z);
            long elapsedRealtime2 = this.k != -1 ? SystemClock.elapsedRealtime() - this.k : -1L;
            this.b.F().trackFullScreenAdClosed(this.f913a, elapsedRealtime2, this.F, j, this.r, this.q);
            if (x.a()) {
                this.c.b("AppLovinFullscreenActivity", "Video ad ended at percent: " + i + "%, elapsedTime: " + elapsedRealtime + "ms, skipTimeMillis: " + j + "ms, closeTimeMillis: " + elapsedRealtime2 + "ms");
            }
        }
    }

    protected void o() {
        if (this.B.compareAndSet(false, true)) {
            com.applovin.impl.sdk.utils.n.b(this.t, this.f913a);
            this.b.aa().b(this.f913a);
        }
    }

    protected boolean p() {
        return this.e instanceof AppLovinFullscreenActivity;
    }

    public void q() {
        s sVar = this.w;
        if (sVar != null) {
            sVar.b();
        }
    }

    protected void r() {
        s sVar = this.w;
        if (sVar != null) {
            sVar.c();
        }
    }

    public boolean u() {
        return AppLovinAdType.INCENTIVIZED == this.f913a.getType() || AppLovinAdType.AUTO_INCENTIVIZED == this.f913a.getType();
    }

    public void b(long j) {
        if (x.a()) {
            this.c.b("AppLovinFullscreenActivity", "Scheduling report reward in " + TimeUnit.MILLISECONDS.toSeconds(j) + " seconds...");
        }
        this.w = s.a(j, this.b, new Runnable() {
            @Override
            public void run() {
                if (a.this.f913a.aj().getAndSet(true)) {
                    return;
                }
                a.this.b.N().a(new y(a.this.f913a, a.this.b), r.b.REWARD);
            }
        });
    }

    public void a(boolean z, long j) {
        if (this.f913a.X()) {
            a(z ? "javascript:al_mute();" : "javascript:al_unmute();", j);
        }
    }

    public void w() {
        com.applovin.impl.adview.d s;
        if (this.f == null || !this.f913a.G() || (s = this.f.getController().s()) == null) {
            return;
        }
        this.G.a(s, new k.a() {
            @Override
            public void a(View view) {
                a.this.b.ak().a(s.a.BLACK_VIEW, CollectionUtils.map("clcode", a.this.f913a.getClCode()));
                if (((Boolean) a.this.b.a(com.applovin.impl.sdk.c.b.gn)).booleanValue()) {
                    a.this.h();
                    return;
                }
                a aVar = a.this;
                aVar.H = ((Boolean) aVar.b.a(com.applovin.impl.sdk.c.b.go)).booleanValue();
                if (!((Boolean) a.this.b.a(com.applovin.impl.sdk.c.b.gp)).booleanValue() || a.this.h == null) {
                    return;
                }
                a.this.h.setVisibility(0);
            }
        });
    }

    public void x() {
        if (x.a()) {
            this.c.c("AppLovinFullscreenActivity", "Handling render process crash");
        }
        this.l = true;
    }

    @Override
    public void onReceive(Intent intent, Map<String, Object> map) {
        if (!"com.applovin.render_process_gone".equals(intent.getAction()) || this.l) {
            return;
        }
        x();
    }

    public void a(Runnable runnable, long j) {
        AppLovinSdkUtils.runOnUiThreadDelayed(runnable, j, this.x);
    }

    private class b implements View.OnClickListener, AppLovinAdClickListener {
        private b() {
        }

        @Override
        public void adClicked(AppLovinAd appLovinAd) {
            x xVar = a.this.c;
            if (x.a()) {
                a.this.c.b("AppLovinFullscreenActivity", "Clicking through graphic");
            }
            com.applovin.impl.sdk.utils.n.a(a.this.s, appLovinAd);
            a.this.d.b();
            a.this.p++;
        }

        @Override
        public void onClick(View view) {
            if (view == a.this.h && ((Boolean) a.this.b.a(com.applovin.impl.sdk.c.b.cH)).booleanValue()) {
                a.b(a.this);
                if (a.this.f913a.Y()) {
                    a.this.b("javascript:al_onCloseButtonTapped(" + a.this.E + "," + a.this.o + "," + a.this.p + ");");
                }
                List<Integer> u = a.this.f913a.u();
                x xVar = a.this.c;
                if (x.a()) {
                    a.this.c.b("AppLovinFullscreenActivity", "Handling close button tap " + a.this.E + " with multi close delay: " + u);
                }
                if (u != null && u.size() > a.this.E) {
                    a.this.F.add(Long.valueOf(SystemClock.elapsedRealtime() - a.this.k));
                    List<j.a> w = a.this.f913a.w();
                    if (w != null && w.size() > a.this.E) {
                        a.this.h.a(w.get(a.this.E));
                    }
                    x xVar2 = a.this.c;
                    if (x.a()) {
                        a.this.c.b("AppLovinFullscreenActivity", "Scheduling next close button with delay: " + u.get(a.this.E));
                    }
                    a.this.h.setVisibility(8);
                    a aVar = a.this;
                    aVar.a(aVar.h, u.get(a.this.E).intValue(), new Runnable() {
                        @Override
                        public void run() {
                            a.this.k = SystemClock.elapsedRealtime();
                        }
                    });
                    return;
                }
                a.this.h();
                return;
            }
            x xVar3 = a.this.c;
            if (x.a()) {
                a.this.c.e("AppLovinFullscreenActivity", "Unhandled click on widget: " + view);
            }
        }
    }
}