导航菜单

页面标题

页面副标题

Handling Master v2 - t5.java 源代码

正在查看: Handling Master v2 应用的 t5.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.applovin.impl;

import android.app.Activity;
import android.content.Context;
import android.os.SystemClock;
import com.applovin.impl.mediation.MaxAdWaterfallInfoImpl;
import com.applovin.impl.mediation.MaxErrorImpl;
import com.applovin.impl.mediation.MaxNetworkResponseInfoImpl;
import com.applovin.impl.mediation.ads.a;
import com.applovin.impl.r5;
import com.applovin.impl.sdk.j;
import com.applovin.impl.sdk.utils.JsonUtils;
import com.applovin.mediation.MaxAd;
import com.applovin.mediation.MaxAdFormat;
import com.applovin.mediation.MaxAdWaterfallInfo;
import com.applovin.mediation.MaxError;
import com.applovin.mediation.MaxErrorCode;
import com.applovin.mediation.MaxNetworkResponseInfo;
import com.applovin.sdk.AppLovinSdkUtils;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.json.JSONArray;
import org.json.JSONObject;

public class t5 extends w4 {
    private static final AtomicBoolean p = new AtomicBoolean();
    private final String g;
    private final MaxAdFormat h;
    private final JSONObject i;
    private final List j;
    private final a.InterfaceC0056a k;
    private final WeakReference l;
    private final String m;
    private long n;
    private final List o;

    public static class a {
    }

    public class b extends w4 {
        private final long g;
        private final int h;
        private final q2 i;
        private final List j;

        public class a extends z2 {
            public a(a.InterfaceC0056a interfaceC0056a) {
                super(interfaceC0056a);
            }

            public void onAdLoadFailed(String str, MaxError maxError) {
                long elapsedRealtime = SystemClock.elapsedRealtime() - b.this.g;
                com.applovin.impl.sdk.n unused = ((w4) b.this).c;
                if (com.applovin.impl.sdk.n.a()) {
                    ((w4) b.this).c.a(((w4) b.this).b, "Ad failed to load in " + elapsedRealtime + " ms for " + t5.this.h.getLabel() + " ad unit " + t5.this.g + " with error: " + maxError);
                }
                b.this.b("failed to load ad: " + maxError.getCode());
                b bVar = b.this;
                bVar.a(bVar.i, MaxNetworkResponseInfo.AdLoadState.FAILED_TO_LOAD, elapsedRealtime, maxError);
                if (b.this.h >= b.this.j.size() - 1) {
                    t5.this.b((MaxError) new MaxErrorImpl(-5001, "MAX returned eligible ads from mediated networks, but all ads failed to load. Inspect getWaterfall() for more info."));
                } else {
                    b bVar2 = b.this;
                    ((w4) b.this).a.j0().a(new b(t5.this, bVar2.h + 1, b.this.j, null), r5.b.MEDIATION);
                }
            }

            public void onAdLoaded(MaxAd maxAd) {
                b.this.b("loaded ad");
                long elapsedRealtime = SystemClock.elapsedRealtime() - b.this.g;
                com.applovin.impl.sdk.n unused = ((w4) b.this).c;
                if (com.applovin.impl.sdk.n.a()) {
                    ((w4) b.this).c.a(((w4) b.this).b, "Ad loaded in " + elapsedRealtime + "ms for " + t5.this.h.getLabel() + " ad unit " + t5.this.g);
                }
                q2 q2Var = (q2) maxAd;
                b.this.a(q2Var, MaxNetworkResponseInfo.AdLoadState.AD_LOADED, elapsedRealtime, null);
                int i = b.this.h;
                while (true) {
                    i++;
                    if (i >= b.this.j.size()) {
                        t5.this.b(q2Var);
                        return;
                    } else {
                        b bVar = b.this;
                        bVar.a((q2) bVar.j.get(i), MaxNetworkResponseInfo.AdLoadState.AD_LOAD_NOT_ATTEMPTED, -1L, null);
                    }
                }
            }
        }

        public b(t5 t5Var, int i, List list, a aVar) {
            this(i, list);
        }

        public void b(String str) {
        }

        public void run() {
            if (com.applovin.impl.sdk.n.a()) {
                ((w4) this).c.a(((w4) this).b, "Loading ad " + (this.h + 1) + " of " + this.j.size() + " from " + this.i.c() + " for " + t5.this.h.getLabel() + " ad unit " + t5.this.g);
            }
            b("started to load ad");
            Context context = (Context) t5.this.l.get();
            Activity n0 = context instanceof Activity ? (Activity) context : ((w4) this).a.n0();
            ((w4) this).a.T().b(this.i);
            ((w4) this).a.Q().loadThirdPartyMediatedAd(t5.this.g, this.i, n0, new a(t5.this.k));
        }

        private b(int i, List list) {
            super(((w4) t5.this).b, ((w4) t5.this).a, t5.this.g);
            this.g = SystemClock.elapsedRealtime();
            this.h = i;
            this.i = (q2) list.get(i);
            this.j = list;
        }

        public void a(q2 q2Var, MaxNetworkResponseInfo.AdLoadState adLoadState, long j, MaxError maxError) {
            t5.this.o.add(new MaxNetworkResponseInfoImpl(adLoadState, l3.a(q2Var.b()), q2Var.F(), q2Var.S(), j, q2Var.C(), maxError));
        }
    }

    public t5(String str, MaxAdFormat maxAdFormat, Map map, JSONObject jSONObject, Context context, j jVar, a.InterfaceC0056a interfaceC0056a) {
        super("TaskProcessMediationWaterfall", jVar, str);
        this.g = str;
        this.h = maxAdFormat;
        this.i = jSONObject;
        this.k = interfaceC0056a;
        this.l = new WeakReference(context);
        this.m = JsonUtils.getString(jSONObject, "mcode", "");
        JSONArray jSONArray = JsonUtils.getJSONArray(jSONObject, "ads", new JSONArray());
        this.j = new ArrayList(jSONArray.length());
        for (int i = 0; i < jSONArray.length(); i++) {
            this.j.add(q2.a(map, JsonUtils.getJSONObject(jSONArray, i, (JSONObject) null), jSONObject, jVar));
        }
        this.o = new ArrayList(this.j.size());
    }

    public void run() {
        MaxErrorImpl maxErrorImpl;
        this.n = SystemClock.elapsedRealtime();
        int i = 0;
        if (this.i.optBoolean("is_testing", false) && !((w4) this).a.l0().c() && p.compareAndSet(false, true)) {
            AppLovinSdkUtils.runOnUiThread(new ILlLLIL1liI(this));
        }
        if (this.j.size() > 0) {
            if (com.applovin.impl.sdk.n.a()) {
                ((w4) this).c.a(((w4) this).b, "Starting waterfall for " + this.h.getLabel() + " ad unit " + this.g + " with " + this.j.size() + " ad(s)...");
            }
            ((w4) this).a.j0().a(new b(this, i, this.j, null));
            return;
        }
        if (com.applovin.impl.sdk.n.a()) {
            ((w4) this).c.k(((w4) this).b, "No ads were returned from the server for " + this.h.getLabel() + " ad unit " + this.g);
        }
        z6.a(this.g, this.h, this.i, ((w4) this).a);
        JSONObject jSONObject = JsonUtils.getJSONObject(this.i, "settings", new JSONObject());
        long j = JsonUtils.getLong(jSONObject, "alfdcs", 0L);
        if (l3.a(this.i, this.g, ((w4) this).a)) {
            maxErrorImpl = new MaxErrorImpl(MaxErrorCode.INVALID_AD_UNIT_ID, "Ad Unit ID " + this.g + " is invalid or disabled.\nMake sure to use an Ad Unit ID from the MAX dashboard that is enabled and configured for the current application.\nFor more information, see https://developers.applovin.com/en/getting-started#step-2-create-an-ad-unit\nNote: New ad units cannot load ads until 30-60 minutes after they are created");
            if (z6.c(((w4) this).a) && ((Boolean) ((w4) this).a.a(l4.O5)).booleanValue()) {
                j = 0;
            }
        } else {
            maxErrorImpl = new MaxErrorImpl(204, "MAX returned no eligible ads from any mediated networks for this app/device");
        }
        if (j <= 0) {
            b((MaxError) maxErrorImpl);
            return;
        }
        long millis = TimeUnit.SECONDS.toMillis(j);
        iiIIIiliii iiiiiiliii = new iiIIIiliii(this, maxErrorImpl);
        if (JsonUtils.getBoolean(jSONObject, "alfdcs_iba", Boolean.FALSE).booleanValue()) {
            c0.a(millis, ((w4) this).a, iiiiiiliii);
        } else {
            AppLovinSdkUtils.runOnUiThreadDelayed(iiiiiiliii, millis);
        }
    }

    public void e() {
        z6.a("MAX SDK Not Initialized In Test Mode", "Test ads may not load. Please force close and restart the app if you experience issues.", ((w4) this).a.n0());
    }

    public void b(q2 q2Var) {
        ((w4) this).a.T().c(q2Var);
        long elapsedRealtime = SystemClock.elapsedRealtime() - this.n;
        if (com.applovin.impl.sdk.n.a()) {
            ((w4) this).c.d(((w4) this).b, "Waterfall loaded in " + elapsedRealtime + "ms from " + q2Var.c() + " for " + this.h.getLabel() + " ad unit " + this.g);
        }
        q2Var.a((MaxAdWaterfallInfo) new MaxAdWaterfallInfoImpl(q2Var, elapsedRealtime, this.o, this.m));
        l2.f(this.k, q2Var);
    }

    public void b(MaxError maxError) {
        if (maxError.getCode() == 204) {
            ((w4) this).a.E().c(v1.u);
        } else if (maxError.getCode() == -5001) {
            ((w4) this).a.E().c(v1.v);
        } else {
            ((w4) this).a.E().c(v1.w);
        }
        ArrayList arrayList = new ArrayList(this.o.size());
        for (MaxNetworkResponseInfo maxNetworkResponseInfo : this.o) {
            if (maxNetworkResponseInfo.getAdLoadState() == MaxNetworkResponseInfo.AdLoadState.FAILED_TO_LOAD) {
                arrayList.add(maxNetworkResponseInfo);
            }
        }
        if (arrayList.size() > 0) {
            StringBuilder sb = new StringBuilder("======FAILED AD LOADS======");
            sb.append("\n");
            int i = 0;
            while (i < arrayList.size()) {
                MaxNetworkResponseInfo maxNetworkResponseInfo2 = (MaxNetworkResponseInfo) arrayList.get(i);
                i++;
                sb.append(i);
                sb.append(") ");
                sb.append(maxNetworkResponseInfo2.getMediatedNetwork().getName());
                sb.append("\n");
                sb.append("..code: ");
                sb.append(maxNetworkResponseInfo2.getError().getCode());
                sb.append("\n");
                sb.append("..message: ");
                sb.append(maxNetworkResponseInfo2.getError().getMessage());
                sb.append("\n");
            }
            ((MaxErrorImpl) maxError).setAdLoadFailureInfo(sb.toString());
        }
        long elapsedRealtime = SystemClock.elapsedRealtime() - this.n;
        if (com.applovin.impl.sdk.n.a()) {
            ((w4) this).c.d(((w4) this).b, "Waterfall failed in " + elapsedRealtime + "ms for " + this.h.getLabel() + " ad unit " + this.g + " with error: " + maxError);
        }
        ((MaxErrorImpl) maxError).setWaterfall(new MaxAdWaterfallInfoImpl((q2) null, JsonUtils.getString(this.i, "waterfall_name", ""), JsonUtils.getString(this.i, "waterfall_test_name", ""), elapsedRealtime, this.o, JsonUtils.optList(JsonUtils.getJSONArray(this.i, "mwf_info_urls", null), Collections.EMPTY_LIST), this.m));
        l2.a(this.k, this.g, maxError);
    }
}