导航菜单

页面标题

页面副标题

Jurassic World v1.83.4 - wm.java 源代码

正在查看: Jurassic World v1.83.4 应用的 wm.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.sdk.utils.JsonUtils;
import com.applovin.impl.tm;
import com.applovin.impl.wm;
import com.applovin.mediation.MaxAd;
import com.applovin.mediation.MaxAdFormat;
import com.applovin.mediation.MaxError;
import com.applovin.mediation.MaxErrorCode;
import com.applovin.mediation.MaxNetworkResponseInfo;
import com.applovin.sdk.AppLovinSdkUtils;
import com.facebook.internal.security.CertificateUtil;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.json.JSONArray;
import org.json.JSONObject;

public class wm extends yl {
    private static final AtomicBoolean z = new AtomicBoolean();
    private final String h;
    private final MaxAdFormat i;
    private final JSONObject j;
    private final a.InterfaceC0014a k;
    private final WeakReference l;
    private final String m;
    private final Queue n;
    private final Object o;
    private final Queue p;
    private final Object q;
    private final int r;
    private long s;
    private final List t;
    private final AtomicBoolean u;
    private final AtomicBoolean v;
    private final AtomicBoolean w;
    private ge x;
    private go y;

    private enum c {
        BIDDING,
        TAG
    }

    @Override
    public void run() {
        final MaxErrorImpl maxErrorImpl;
        this.s = SystemClock.elapsedRealtime();
        if (this.j.optBoolean("is_testing", false) && !this.a.l0().c() && z.compareAndSet(false, true)) {
            AppLovinSdkUtils.runOnUiThread(new Runnable() {
                @Override
                public final void run() {
                    wm.this.e();
                }
            });
        }
        if (this.r != 0) {
            if (com.applovin.impl.sdk.n.a()) {
                this.c.a(this.b, "Starting waterfall for " + this.i.getLabel() + " ad unit " + this.h + " with " + this.r + " ad(s)...");
            }
            d(c.TAG);
            d(c.BIDDING);
            return;
        }
        if (com.applovin.impl.sdk.n.a()) {
            this.c.k(this.b, "No ads were returned from the server for " + this.i.getLabel() + " ad unit " + this.h);
        }
        yp.a(this.h, this.i, this.j, this.a);
        JSONObject jSONObject = JsonUtils.getJSONObject(this.j, "settings", new JSONObject());
        long j = JsonUtils.getLong(jSONObject, "alfdcs", 0L);
        if (af.a(this.j, this.h, this.a)) {
            maxErrorImpl = new MaxErrorImpl(MaxErrorCode.INVALID_AD_UNIT_ID, "Ad Unit ID " + this.h + " 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 (yp.c(this.a) && ((Boolean) this.a.a(sj.l6)).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(maxErrorImpl);
            return;
        }
        long millis = TimeUnit.SECONDS.toMillis(j);
        Runnable runnable = new Runnable() {
            @Override
            public final void run() {
                wm.this.b(maxErrorImpl);
            }
        };
        if (JsonUtils.getBoolean(jSONObject, "alfdcs_iba", Boolean.FALSE).booleanValue()) {
            x1.a(millis, this.a, runnable);
        } else {
            AppLovinSdkUtils.runOnUiThreadDelayed(runnable, millis);
        }
    }

    public wm(String str, MaxAdFormat maxAdFormat, Map map, JSONObject jSONObject, Context context, com.applovin.impl.sdk.j jVar, a.InterfaceC0014a interfaceC0014a) {
        super("TaskProcessMediationWaterfallV2", jVar, str);
        this.n = new LinkedList();
        this.o = new Object();
        this.p = new LinkedList();
        this.q = new Object();
        this.u = new AtomicBoolean();
        this.v = new AtomicBoolean();
        this.w = new AtomicBoolean();
        this.h = str;
        this.i = maxAdFormat;
        this.j = jSONObject;
        this.k = interfaceC0014a;
        this.l = new WeakReference(context);
        this.m = JsonUtils.getString(jSONObject, "mCode", "");
        JSONArray jSONArray = JsonUtils.getJSONArray(jSONObject, "ads", new JSONArray());
        for (int i = 0; i < jSONArray.length(); i++) {
            ge a2 = ge.a(i, map, JsonUtils.getJSONObject(jSONArray, i, (JSONObject) null), jSONObject, jVar);
            if (a2.a0()) {
                this.p.add(a2);
            } else {
                this.n.add(a2);
            }
        }
        int size = this.n.size() + this.p.size();
        this.r = size;
        this.t = new ArrayList(size);
    }

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

    public boolean d(c cVar) {
        ge a2 = a(cVar);
        if (a2 == null) {
            b(cVar);
            return false;
        }
        this.a.j0().a((yl) new b(a2, cVar), tm.b.MEDIATION);
        return true;
    }

    public ge c(c cVar) {
        return a(cVar, true);
    }

    class b extends yl {
        private final String h;
        private final long i;
        private final ge j;
        private final c k;
        private final int l;
        private boolean m;
        private int n;

        public void b(String str) {
        }

        @Override
        public void run() {
            if (com.applovin.impl.sdk.n.a()) {
                this.c.a(this.h, (this.m ? "Retrying loading" : "Loading") + " ad " + this.l + " of " + wm.this.r + " from " + this.j.c() + " for " + wm.this.i + " ad unit " + wm.this.h);
            }
            b("started to load ad");
            Context context = (Context) wm.this.l.get();
            Activity n0 = context instanceof Activity ? (Activity) context : this.a.n0();
            this.a.T().b(this.j);
            this.a.Q().loadThirdPartyMediatedAd(wm.this.h, this.j, this.m, n0, new a(wm.this.k));
        }

        static int l(b bVar) {
            int i = bVar.n;
            bVar.n = i - 1;
            return i;
        }

        private b(ge geVar, c cVar) {
            super(wm.this.b, wm.this.a, wm.this.h);
            this.h = this.b + CertificateUtil.DELIMITER + cVar;
            this.i = SystemClock.elapsedRealtime();
            this.j = geVar;
            this.k = cVar;
            this.l = geVar.K() + 1;
            this.n = geVar.O();
        }

        class a extends oe {
            @Override
            public void onAdLoadFailed(String str, MaxError maxError) {
                long elapsedRealtime = SystemClock.elapsedRealtime() - b.this.i;
                com.applovin.impl.sdk.n unused = b.this.c;
                if (com.applovin.impl.sdk.n.a()) {
                    b.this.c.a(b.this.h, "Ad (" + b.this.l + ") failed to load in " + elapsedRealtime + "ms for " + wm.this.i + " ad unit " + str + " with error: " + maxError);
                }
                b.this.b("failed to load ad: " + maxError.getCode());
                if (!b.this.m) {
                    b bVar = b.this;
                    wm.this.a(bVar.j, MaxNetworkResponseInfo.AdLoadState.FAILED_TO_LOAD, elapsedRealtime, maxError);
                }
                if (wm.this.w.get()) {
                    return;
                }
                if (wm.this.x != null) {
                    b bVar2 = b.this;
                    if (b.this.b(wm.this.c(bVar2.k))) {
                        wm wmVar = wm.this;
                        wmVar.b(wmVar.x);
                        return;
                    }
                }
                if (b.this.n > 0) {
                    if (!b.this.a.a(ve.B7, String.valueOf(maxError.getCode()))) {
                        b.l(b.this);
                        b.this.m = true;
                        b.this.a.j0().a(b.this, tm.b.MEDIATION, b.this.j.W());
                        return;
                    }
                    com.applovin.impl.sdk.n unused2 = b.this.c;
                    if (com.applovin.impl.sdk.n.a()) {
                        b.this.c.a(b.this.b, "Ignoring failed ad load retry for error code " + maxError.getCode());
                    }
                }
                b bVar3 = b.this;
                if ((!wm.this.d(bVar3.k)) && wm.this.v.get() && wm.this.u.get()) {
                    wm.this.b(new MaxErrorImpl(-5001, "MAX returned eligible ads from mediated networks, but all ads failed to load. Inspect getWaterfall() for more info."));
                }
            }

            a(a.InterfaceC0014a interfaceC0014a) {
                super(interfaceC0014a);
            }

            @Override
            public void onAdLoaded(MaxAd maxAd) {
                boolean z;
                long F;
                ge geVar;
                b.this.b("loaded ad");
                ge geVar2 = (ge) maxAd;
                long elapsedRealtime = SystemClock.elapsedRealtime() - b.this.i;
                com.applovin.impl.sdk.n unused = b.this.c;
                if (com.applovin.impl.sdk.n.a()) {
                    b.this.c.a(b.this.h, "Ad (" + b.this.l + ") loaded in " + elapsedRealtime + "ms for " + wm.this.i + " ad unit " + wm.this.h);
                }
                wm.this.a(geVar2, MaxNetworkResponseInfo.AdLoadState.AD_LOADED, elapsedRealtime, null);
                b bVar = b.this;
                wm.this.b(bVar.k);
                if (c.BIDDING == b.this.k) {
                    z = wm.this.v.get();
                    F = geVar2.U();
                } else {
                    z = wm.this.u.get();
                    F = geVar2.F();
                }
                if (!z && F != 0) {
                    wm.this.x = geVar2;
                    if (F < 0) {
                        return;
                    }
                    b bVar2 = b.this;
                    wm.this.y = go.a(F, bVar2.a, new Runnable() {
                        @Override
                        public final void run() {
                            wm.b.a.this.a();
                        }
                    });
                    return;
                }
                if (b.this.b(geVar2)) {
                    geVar = geVar2;
                    geVar2 = wm.this.x;
                } else {
                    geVar = wm.this.x;
                }
                wm.this.a(geVar2, geVar);
            }

            public void a() {
                wm wmVar = wm.this;
                wmVar.b(wmVar.x);
            }
        }

        public boolean b(ge geVar) {
            if (wm.this.x == null) {
                return false;
            }
            if (geVar == null) {
                return true;
            }
            double P = wm.this.x.P();
            double P2 = geVar.P();
            return (P < 0.0d || P2 < 0.0d) ? wm.this.x.K() < geVar.K() : P > P2;
        }
    }

    private void g() {
        a(this.n);
        a(this.p);
    }

    private void f() {
        go goVar = this.y;
        if (goVar == null) {
            return;
        }
        goVar.a();
        this.y = null;
    }

    public void b(ge geVar) {
        a(geVar, (ge) null);
    }

    public void b(c cVar) {
        if (c.BIDDING == cVar) {
            this.u.compareAndSet(false, true);
        } else if (c.TAG == cVar) {
            this.v.compareAndSet(false, true);
        }
    }

    private ge a(c cVar) {
        return a(cVar, false);
    }

    private ge a(c cVar, boolean z2) {
        Object poll;
        ge geVar;
        Object poll2;
        ge geVar2;
        if (cVar == c.BIDDING) {
            synchronized (this.q) {
                if (z2) {
                    poll2 = this.p.peek();
                } else {
                    poll2 = this.p.poll();
                }
                geVar2 = (ge) poll2;
            }
            return geVar2;
        }
        synchronized (this.o) {
            if (z2) {
                poll = this.n.peek();
            } else {
                poll = this.n.poll();
            }
            geVar = (ge) poll;
        }
        return geVar;
    }

    public void a(ge geVar, ge geVar2) {
        if (this.w.compareAndSet(false, true)) {
            f();
            g();
            this.a.T().a(geVar, geVar2);
            long elapsedRealtime = SystemClock.elapsedRealtime() - this.s;
            if (com.applovin.impl.sdk.n.a()) {
                this.c.d(this.b, "Waterfall loaded in " + elapsedRealtime + "ms from " + geVar.c() + " for " + this.i + " ad unit " + this.h);
            }
            geVar.a(new MaxAdWaterfallInfoImpl(geVar, elapsedRealtime, this.t, this.m));
            gc.f(this.k, geVar);
        }
    }

    public void b(MaxError maxError) {
        int i = 0;
        if (this.w.compareAndSet(false, true)) {
            if (maxError.getCode() == 204) {
                this.a.D().c(ca.u);
            } else if (maxError.getCode() == -5001) {
                this.a.D().c(ca.v);
            } else {
                this.a.D().c(ca.w);
            }
            ArrayList arrayList = new ArrayList(this.t.size());
            for (MaxNetworkResponseInfo maxNetworkResponseInfo : this.t) {
                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");
                while (i < arrayList.size()) {
                    MaxNetworkResponseInfo maxNetworkResponseInfo2 = (MaxNetworkResponseInfo) arrayList.get(i);
                    i++;
                    sb.append(i).append(") ").append(maxNetworkResponseInfo2.getMediatedNetwork().getName()).append("\n").append("..code: ").append(maxNetworkResponseInfo2.getError().getCode()).append("\n").append("..message: ").append(maxNetworkResponseInfo2.getError().getMessage()).append("\n");
                }
                ((MaxErrorImpl) maxError).setAdLoadFailureInfo(sb.toString());
            }
            long elapsedRealtime = SystemClock.elapsedRealtime() - this.s;
            if (com.applovin.impl.sdk.n.a()) {
                this.c.d(this.b, "Waterfall failed in " + elapsedRealtime + "ms for " + this.i + " ad unit " + this.h + " with error: " + maxError);
            }
            ((MaxErrorImpl) maxError).setWaterfall(new MaxAdWaterfallInfoImpl(null, JsonUtils.getString(this.j, "waterfall_name", ""), JsonUtils.getString(this.j, "waterfall_test_name", ""), elapsedRealtime, this.t, JsonUtils.optList(JsonUtils.getJSONArray(this.j, "mwf_info_urls", null), Collections.EMPTY_LIST), this.m));
            gc.a(this.k, this.h, maxError);
        }
    }

    public void a(ge geVar, MaxNetworkResponseInfo.AdLoadState adLoadState, long j, MaxError maxError) {
        this.t.add(new MaxNetworkResponseInfoImpl(adLoadState, af.a(geVar.b()), geVar.G(), geVar.a0(), j, geVar.C(), maxError));
    }

    private void a(Queue queue) {
        Iterator it = queue.iterator();
        while (it.hasNext()) {
            a((ge) it.next(), MaxNetworkResponseInfo.AdLoadState.AD_LOAD_NOT_ATTEMPTED, -1L, null);
        }
    }
}