atsameip v0.1版本的 MD5 值为:28547cf98b0a2d02acb37969dcfb83e9

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


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

import android.app.Activity;
import android.content.Context;
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.i;
import com.applovin.impl.adview.m;
import com.applovin.impl.sdk.AppLovinBroadcastManager;
import com.applovin.impl.sdk.b.b;
import com.applovin.impl.sdk.e.o;
import com.applovin.impl.sdk.e.v;
import com.applovin.impl.sdk.e.z;
import com.applovin.impl.sdk.i;
import com.applovin.impl.sdk.n;
import com.applovin.impl.sdk.utils.AppKilledService;
import com.applovin.impl.sdk.utils.StringUtils;
import com.applovin.impl.sdk.utils.Utils;
import com.applovin.impl.sdk.utils.j;
import com.applovin.impl.sdk.utils.p;
import com.applovin.impl.sdk.w;
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 b.a {
    protected final com.applovin.impl.sdk.ad.e a;
    protected final n b;
    protected final w c;
    protected final com.applovin.impl.sdk.d.d d;
    protected Activity e;
    protected AppLovinAdView f;
    protected final m g;
    protected boolean m;
    protected AppLovinAdClickListener n;
    protected AppLovinAdDisplayListener o;
    protected AppLovinAdVideoPlaybackListener p;
    protected final com.applovin.impl.sdk.b.b q;
    protected com.applovin.impl.sdk.utils.n r;
    protected com.applovin.impl.sdk.utils.n s;
    private final com.applovin.impl.sdk.utils.a u;
    private final AppLovinBroadcastManager.Receiver v;
    private final i.a w;
    private long z;
    private final Handler t = new Handler(Looper.getMainLooper());
    protected final long h = SystemClock.elapsedRealtime();
    private final AtomicBoolean x = new AtomicBoolean();
    private final AtomicBoolean y = new AtomicBoolean();
    protected long i = -1;
    private int A = 0;
    private final ArrayList<Long> B = new ArrayList<>();
    protected int j = 0;
    protected int k = 0;
    protected int l = i.a;

    public class AnonymousClass7 implements Runnable {
        final m a;
        final Runnable b;

        AnonymousClass7(m mVar, Runnable runnable) {
            this.a = mVar;
            this.b = runnable;
        }

        @Override
        public void run() {
            AppLovinSdkUtils.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    p.a(AnonymousClass7.this.a, 400L, new Runnable() {
                        @Override
                        public void run() {
                            AnonymousClass7.this.a.bringToFront();
                            AnonymousClass7.this.b.run();
                        }
                    });
                }
            });
        }
    }

    public interface InterfaceC0018a {
        void a(a aVar);

        void a(String str, Throwable th);
    }

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

        @Override
        public void adClicked(AppLovinAd appLovinAd) {
            if (w.a()) {
                a.this.c.b("AppLovinFullscreenActivity", "Clicking through graphic");
            }
            j.a(a.this.n, appLovinAd);
            a.this.d.b();
            a.this.k++;
        }

        @Override
        public void onClick(View view) {
            if (view != a.this.g || !((Boolean) a.this.b.a(com.applovin.impl.sdk.c.b.co)).booleanValue()) {
                if (w.a()) {
                    w wVar = a.this.c;
                    wVar.e("AppLovinFullscreenActivity", "Unhandled click on widget: " + view);
                    return;
                }
                return;
            }
            a.c(a.this);
            if (a.this.a.S()) {
                a aVar = a.this;
                aVar.b("javascript:al_onCloseButtonTapped(" + a.this.A + "," + a.this.j + "," + a.this.k + ");");
            }
            List<Integer> t = a.this.a.t();
            if (w.a()) {
                w wVar2 = a.this.c;
                wVar2.b("AppLovinFullscreenActivity", "Handling close button tap " + a.this.A + " with multi close delay: " + t);
            }
            if (t == null || t.size() <= a.this.A) {
                a.this.h();
                return;
            }
            a.this.B.add(Long.valueOf(SystemClock.elapsedRealtime() - a.this.i));
            List<i.a> v = a.this.a.v();
            if (v != null && v.size() > a.this.A) {
                a.this.g.a(v.get(a.this.A));
            }
            if (w.a()) {
                w wVar3 = a.this.c;
                wVar3.b("AppLovinFullscreenActivity", "Scheduling next close button with delay: " + t.get(a.this.A));
            }
            a.this.g.setVisibility(8);
            a aVar2 = a.this;
            aVar2.a(aVar2.g, t.get(a.this.A).intValue(), new Runnable() {
                @Override
                public void run() {
                    a.this.i = SystemClock.elapsedRealtime();
                }
            });
        }
    }

    public a(final com.applovin.impl.sdk.ad.e eVar, Activity activity, final n nVar, AppLovinAdClickListener appLovinAdClickListener, AppLovinAdDisplayListener appLovinAdDisplayListener, AppLovinAdVideoPlaybackListener appLovinAdVideoPlaybackListener) {
        this.a = eVar;
        this.b = nVar;
        this.c = nVar.A();
        this.e = activity;
        this.n = appLovinAdClickListener;
        this.o = appLovinAdDisplayListener;
        this.p = appLovinAdVideoPlaybackListener;
        com.applovin.impl.sdk.b.b bVar = new com.applovin.impl.sdk.b.b(activity, nVar);
        this.q = bVar;
        bVar.a(this);
        this.d = new com.applovin.impl.sdk.d.d(eVar, nVar);
        b bVar2 = new b();
        com.applovin.impl.adview.n nVar2 = new com.applovin.impl.adview.n(nVar.Y(), AppLovinAdSize.INTERSTITIAL, activity);
        this.f = nVar2;
        nVar2.setAdClickListener(bVar2);
        this.f.setAdDisplayListener(new AppLovinAdDisplayListener() {
            @Override
            public void adDisplayed(AppLovinAd appLovinAd) {
                if (w.a()) {
                    a.this.c.b("AppLovinFullscreenActivity", "Web content rendered");
                }
            }

            @Override
            public void adHidden(AppLovinAd appLovinAd) {
                if (w.a()) {
                    a.this.c.b("AppLovinFullscreenActivity", "Closing from WebView");
                }
                a.this.h();
            }
        });
        com.applovin.impl.adview.b controller = this.f.getController();
        controller.a(this.d);
        controller.s().setIsShownOutOfContext(eVar.aj());
        nVar.u().trackImpression(eVar);
        List<Integer> t = eVar.t();
        if (eVar.s() >= 0 || t != null) {
            m mVar = new m(eVar.u(), activity);
            this.g = mVar;
            mVar.setVisibility(8);
            this.g.setOnClickListener(bVar2);
        } else {
            this.g = null;
        }
        if (((Boolean) nVar.a(com.applovin.impl.sdk.c.b.cq)).booleanValue()) {
            this.v = new AppLovinBroadcastManager.Receiver() {
                @Override
                public void onReceive(Context context, Intent intent, Map<String, Object> map) {
                    nVar.u().trackAppKilled(eVar);
                    nVar.aj().unregisterReceiver(this);
                }
            };
            nVar.aj().registerReceiver(this.v, new IntentFilter(AppKilledService.ACTION_APP_KILLED));
        } else {
            this.v = null;
        }
        if (eVar.ai()) {
            this.w = new i.a() {
                @Override
                public void a(int i) {
                    String str;
                    if (a.this.l != com.applovin.impl.sdk.i.a) {
                        a.this.m = true;
                    }
                    com.applovin.impl.adview.d s = a.this.f.getController().s();
                    if (!com.applovin.impl.sdk.i.a(i) || com.applovin.impl.sdk.i.a(a.this.l)) {
                        str = i == 2 ? "javascript:al_muteSwitchOff();" : "javascript:al_muteSwitchOff();";
                        a.this.l = i;
                    }
                    str = "javascript:al_muteSwitchOn();";
                    s.a(str);
                    a.this.l = i;
                }
            };
            nVar.ai().a(this.w);
        } else {
            this.w = null;
        }
        if (!((Boolean) nVar.a(com.applovin.impl.sdk.c.b.eD)).booleanValue()) {
            this.u = null;
            return;
        }
        this.u = new com.applovin.impl.sdk.utils.a() {
            @Override
            public void onActivityCreated(Activity activity2, Bundle bundle) {
                if (a.this.y.get()) {
                    return;
                }
                if (activity2.getClass().getName().equals(Utils.retrieveLauncherActivityFullyQualifiedName(activity2.getApplicationContext()))) {
                    AppLovinSdkUtils.runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            w.i("AppLovinFullscreenActivity", "Dismissing on-screen ad due to app relaunched via launcher.");
                            try {
                                a.this.h();
                            } catch (Throwable th) {
                                w.c("AppLovinFullscreenActivity", "Failed to dismiss ad.", th);
                                try {
                                    a.this.m();
                                } catch (Throwable unused) {
                                }
                            }
                        }
                    });
                }
            }
        };
        nVar.af().a(this.u);
    }

    public static void a(com.applovin.impl.sdk.ad.e eVar, AppLovinAdClickListener appLovinAdClickListener, AppLovinAdDisplayListener appLovinAdDisplayListener, AppLovinAdVideoPlaybackListener appLovinAdVideoPlaybackListener, n nVar, Activity activity, InterfaceC0018a interfaceC0018a) {
        StringBuilder sb;
        String str;
        a bVar;
        boolean z = false;
        if (eVar.aF() && Utils.checkExoPlayerEligibility(nVar)) {
            z = true;
        }
        if (eVar instanceof com.applovin.impl.a.a) {
            if (!z) {
                try {
                    bVar = new d(eVar, activity, nVar, appLovinAdClickListener, appLovinAdDisplayListener, appLovinAdVideoPlaybackListener);
                    interfaceC0018a.a(bVar);
                    return;
                } catch (Throwable th) {
                    th = th;
                    sb = new StringBuilder();
                    sb.append("Failed to create FullscreenVastVideoAdPresenter with sdk: ");
                    sb.append(nVar);
                    sb.append(" and throwable: ");
                    sb.append(th.getMessage());
                    interfaceC0018a.a(sb.toString(), th);
                }
            }
            try {
                bVar = new c(eVar, activity, nVar, appLovinAdClickListener, appLovinAdDisplayListener, appLovinAdVideoPlaybackListener);
            } catch (Throwable th2) {
                if (w.a()) {
                    nVar.A().a("AppLovinFullscreenActivity", "Failed to create ExoPlayer presenter to show the ad. Falling back to using native media player presenter.", th2);
                }
                Utils.isExoPlayerEligible = false;
                try {
                    bVar = new d(eVar, activity, nVar, appLovinAdClickListener, appLovinAdDisplayListener, appLovinAdVideoPlaybackListener);
                } catch (Throwable th3) {
                    th = th3;
                    sb = new StringBuilder();
                    sb.append("Failed to create FullscreenVastVideoAdPresenter with sdk: ");
                    sb.append(nVar);
                    sb.append(" and throwable: ");
                    sb.append(th.getMessage());
                    interfaceC0018a.a(sb.toString(), th);
                }
            }
            interfaceC0018a.a(bVar);
            return;
        } else if (!eVar.hasVideoUrl()) {
            try {
                bVar = new com.applovin.impl.adview.activity.b.b(eVar, activity, nVar, appLovinAdClickListener, appLovinAdDisplayListener, appLovinAdVideoPlaybackListener);
                interfaceC0018a.a(bVar);
                return;
            } catch (Throwable th4) {
                th = th4;
                sb = new StringBuilder();
                str = "Failed to create FullscreenGraphicAdPresenter with sdk: ";
                sb.append(str);
                sb.append(nVar);
                sb.append(" and throwable: ");
                sb.append(th.getMessage());
                interfaceC0018a.a(sb.toString(), th);
            }
        } else if (eVar.aJ()) {
            try {
                bVar = new g(eVar, activity, nVar, appLovinAdClickListener, appLovinAdDisplayListener, appLovinAdVideoPlaybackListener);
                interfaceC0018a.a(bVar);
                return;
            } catch (Throwable th5) {
                th = th5;
                sb = new StringBuilder();
                str = "Failed to create FullscreenWebVideoAdPresenter with sdk: ";
                sb.append(str);
                sb.append(nVar);
                sb.append(" and throwable: ");
                sb.append(th.getMessage());
                interfaceC0018a.a(sb.toString(), th);
            }
        } else if (!z) {
            try {
                bVar = new f(eVar, activity, nVar, appLovinAdClickListener, appLovinAdDisplayListener, appLovinAdVideoPlaybackListener);
                interfaceC0018a.a(bVar);
                return;
            } catch (Throwable th6) {
                th = th6;
                sb = new StringBuilder();
                str = "Failed to create FullscreenVideoAdPresenter with sdk: ";
                sb.append(str);
                sb.append(nVar);
                sb.append(" and throwable: ");
                sb.append(th.getMessage());
                interfaceC0018a.a(sb.toString(), th);
            }
        } else {
            try {
                bVar = new e(eVar, activity, nVar, appLovinAdClickListener, appLovinAdDisplayListener, appLovinAdVideoPlaybackListener);
            } catch (Throwable th7) {
                if (w.a()) {
                    nVar.A().a("AppLovinFullscreenActivity", "Failed to create ExoPlayer presenter to show the ad. Falling back to using native media player presenter.", th7);
                }
                Utils.isExoPlayerEligible = false;
                try {
                    bVar = new f(eVar, activity, nVar, appLovinAdClickListener, appLovinAdDisplayListener, appLovinAdVideoPlaybackListener);
                } catch (Throwable th8) {
                    th = th8;
                    sb = new StringBuilder();
                    str = "Failed to create FullscreenVideoAdExoPlayerPresenter with sdk: ";
                    sb.append(str);
                    sb.append(nVar);
                    sb.append(" and throwable: ");
                    sb.append(th.getMessage());
                    interfaceC0018a.a(sb.toString(), th);
                }
            }
            interfaceC0018a.a(bVar);
            return;
        }
        sb.append(nVar);
        sb.append(" and throwable: ");
        sb.append(th.getMessage());
        interfaceC0018a.a(sb.toString(), th);
    }

    static int c(a aVar) {
        int i = aVar.A;
        aVar.A = i + 1;
        return i;
    }

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

    public void a(int i, boolean z, boolean z2, long j) {
        if (this.x.compareAndSet(false, true)) {
            if (this.a.hasVideoUrl() || s()) {
                j.a(this.p, this.a, i, z2);
            }
            if (this.a.hasVideoUrl()) {
                this.d.c(i);
            }
            long elapsedRealtime = SystemClock.elapsedRealtime() - this.h;
            this.b.u().trackVideoEnd(this.a, TimeUnit.MILLISECONDS.toSeconds(elapsedRealtime), i, z);
            long elapsedRealtime2 = this.i != -1 ? SystemClock.elapsedRealtime() - this.i : -1L;
            this.b.u().trackFullScreenAdClosed(this.a, elapsedRealtime2, this.B, j, this.m, this.l);
            if (w.a()) {
                w wVar = this.c;
                wVar.b("AppLovinFullscreenActivity", "Video ad ended at percent: " + i + "%, elapsedTime: " + elapsedRealtime + "ms, skipTimeMillis: " + j + "ms, closeTimeMillis: " + elapsedRealtime2 + "ms");
            }
        }
    }

    public abstract void a(long j);

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

    public abstract void a(ViewGroup viewGroup);

    public void a(m mVar, long j, Runnable runnable) {
        if (j >= ((Long) this.b.a(com.applovin.impl.sdk.c.b.cn)).longValue()) {
            return;
        }
        AnonymousClass7 anonymousClass7 = new AnonymousClass7(mVar, runnable);
        if (((Boolean) this.b.a(com.applovin.impl.sdk.c.b.cG)).booleanValue()) {
            this.s = com.applovin.impl.sdk.utils.n.a(TimeUnit.SECONDS.toMillis(j), this.b, anonymousClass7);
        } else {
            this.b.S().a(new z(this.b, anonymousClass7), o.a.MAIN, TimeUnit.SECONDS.toMillis(j), true);
        }
    }

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

    protected void a(String str) {
        if (this.a.T()) {
            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(boolean z) {
        List<Uri> checkCachedResourcesExist = Utils.checkCachedResourcesExist(z, this.a, this.b, this.e);
        if (checkCachedResourcesExist.isEmpty()) {
            return;
        }
        if (!((Boolean) this.b.a(com.applovin.impl.sdk.c.b.eH)).booleanValue()) {
            this.a.a();
            return;
        }
        throw new IllegalStateException("Missing cached resource(s): " + checkCachedResourcesExist);
    }

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

    public void b(long j) {
        if (w.a()) {
            w wVar = this.c;
            wVar.b("AppLovinFullscreenActivity", "Scheduling report reward in " + TimeUnit.MILLISECONDS.toSeconds(j) + " seconds...");
        }
        this.r = com.applovin.impl.sdk.utils.n.a(j, this.b, new Runnable() {
            @Override
            public void run() {
                if (a.this.a.ad().getAndSet(true)) {
                    return;
                }
                a.this.b.S().a(new v(a.this.a, a.this.b), o.a.REWARD);
            }
        });
    }

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

    public void b(boolean z) {
        a(z, ((Long) this.b.a(com.applovin.impl.sdk.c.b.cD)).longValue());
        j.a(this.o, this.a);
        this.b.ae().a(this.a);
        this.b.ak().a(this.a);
        if (this.a.hasVideoUrl() || s()) {
            j.a(this.p, this.a);
        }
        new com.applovin.impl.adview.activity.b(this.e).a(this.a);
        this.d.a();
        this.a.setHasShown(true);
    }

    public void c(boolean z) {
        if (w.a()) {
            w wVar = this.c;
            wVar.c("AppLovinFullscreenActivity", "onWindowFocusChanged(boolean) - " + z);
        }
        a("javascript:al_onWindowFocusChanged( " + z + " );");
        com.applovin.impl.sdk.utils.n nVar = this.s;
        if (nVar != null) {
            if (z) {
                nVar.c();
            } else {
                nVar.b();
            }
        }
    }

    public abstract void d();

    public abstract void e();

    public void f() {
        if (w.a()) {
            this.c.c("AppLovinFullscreenActivity", "onResume()");
        }
        this.d.d(SystemClock.elapsedRealtime() - this.z);
        a("javascript:al_onAppResumed();");
        p();
        if (this.q.c()) {
            this.q.a();
        }
    }

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

    public void h() {
        if (w.a()) {
            this.c.c("AppLovinFullscreenActivity", "dismiss()");
        }
        this.t.removeCallbacksAndMessages(null);
        a("javascript:al_onPoststitialDismiss();", this.a.Q());
        m();
        this.d.c();
        if (this.v != null) {
            com.applovin.impl.sdk.utils.n.a(TimeUnit.SECONDS.toMillis(2L), this.b, new Runnable() {
                @Override
                public void run() {
                    a.this.e.stopService(new Intent(a.this.e.getApplicationContext(), AppKilledService.class));
                    a.this.b.aj().unregisterReceiver(a.this.v);
                }
            });
        }
        if (this.w != null) {
            this.b.ai().b(this.w);
        }
        if (this.u != null) {
            this.b.af().b(this.u);
        }
        if (n()) {
            this.e.finish();
            return;
        }
        if (w.a()) {
            this.b.A().b("AppLovinFullscreenActivity", "Fullscreen ad shown in container view dismissed, destroying the presenter.");
        }
        j();
    }

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

    public void j() {
        AppLovinAdView appLovinAdView = this.f;
        if (appLovinAdView != null) {
            ViewParent parent = appLovinAdView.getParent();
            this.f.destroy();
            this.f = null;
            if ((parent instanceof ViewGroup) && n()) {
                ((ViewGroup) parent).removeAllViews();
            }
        }
        l();
        m();
        this.n = null;
        this.o = null;
        this.p = null;
        this.e = null;
    }

    public void k() {
        if (w.a()) {
            this.c.c("AppLovinFullscreenActivity", "onBackPressed()");
        }
        if (this.a.S()) {
            b("javascript:onBackPressed();");
        }
    }

    protected abstract void l();

    protected void m() {
        if (this.y.compareAndSet(false, true)) {
            j.b(this.o, this.a);
            this.b.ae().b(this.a);
            this.b.ak().a();
        }
    }

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

    public void o() {
        com.applovin.impl.sdk.utils.n nVar = this.r;
        if (nVar != null) {
            nVar.b();
        }
    }

    protected void p() {
        com.applovin.impl.sdk.utils.n nVar = this.r;
        if (nVar != null) {
            nVar.c();
        }
    }

    protected abstract boolean q();

    protected abstract boolean r();

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

    protected abstract void t();
}