VegeFruits v7.1版本的 MD5 值为:2ff167dfba698c783e879938fe00b9ce

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


package com.adcolony.sdk;

import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull;
import com.adcolony.sdk.ADCDownload;
import com.amazon.device.ads.WebRequest;
import com.applovin.sdk.AppLovinEventTypes;
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
import com.ironsource.mediationsdk.utils.GeneralPropertiesWorker;
import com.mopub.common.GpsHelper;
import com.tapjoy.TJAdUnitConstants;
import com.tapjoy.TapjoyConstants;
import java.io.File;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import org.json.JSONObject;

public class i implements ADCDownload.Listener {
    static final String a = "026ae9c9824b3e483fa6c71fa88f57ae27816141";
    static final String b = "7bf3a1e7bbd31e612eda3310c2cdb8075c43c6b5";
    private String C;
    private String E;
    private String F;
    private String G;
    private boolean H;
    private boolean I;
    private boolean J;
    private boolean K;
    private boolean L;
    private boolean M;
    private boolean N;
    private boolean O;
    private boolean P;
    private boolean Q;
    private int R;
    private Application.ActivityLifecycleCallbacks U;
    k c;
    aq d;
    ae e;
    boolean f;
    private j g;
    private ab h;
    private m i;
    private aj j;
    private d k;
    private l l;
    private o m;
    private ao n;
    private am o;
    private x p;
    private c q;
    private ax r;
    private AdColonyInterstitial s;
    private AdColonyRewardListener t;
    private AdColonyAppOptions v;
    private aa w;
    private boolean x;
    private aa y;
    private JSONObject z;
    private HashMap<String, AdColonyCustomMessageListener> u = new HashMap<>();
    private HashMap<String, AdColonyZone> A = new HashMap<>();
    private HashMap<Integer, aw> B = new HashMap<>();
    private String D = "https://adc3-launch.adcolony.com/v4/launch";
    private int S = 1;
    private final int T = 120;

    Activity a() {
        return a.c();
    }

    public void a(AdColonyAppOptions adColonyAppOptions, boolean z) {
        boolean z2;
        this.J = z;
        this.v = adColonyAppOptions;
        this.h = new ab();
        this.g = new j();
        this.i = new m();
        this.i.a();
        this.j = new aj();
        this.j.a();
        this.k = new d();
        this.k.a();
        this.l = new l();
        this.m = new o();
        this.m.a();
        this.p = new x();
        x xVar = this.p;
        x.a();
        this.o = new am();
        this.o.a();
        this.n = new ao();
        this.n.a();
        this.c = new k();
        this.c.d();
        this.e = new ae();
        this.C = this.e.c();
        if (!z) {
            this.M = new File(this.o.g() + a).exists();
            this.N = new File(this.o.g() + b).exists();
            if (this.M && this.N) {
                String b2 = t.b(t.c(this.o.g() + a), GeneralPropertiesWorker.SDK_VERSION);
                k kVar = this.c;
                if (b2.equals("3.1.2")) {
                    z2 = true;
                    this.L = z2;
                    e(this.L);
                    z();
                    if (new File(this.o.g() + a).exists()) {
                        this.z = t.c(this.o.g() + a);
                        b(this.z);
                    }
                }
            }
            z2 = false;
            this.L = z2;
            e(this.L);
            z();
            if (new File(this.o.g() + a).exists()) {
            }
        }
        a.a("Module.load", new ac() {
            @Override
            public void a(aa aaVar) {
                i.this.a(aaVar);
            }
        });
        a.a("Module.unload", new ac() {
            @Override
            public void a(aa aaVar) {
                i.this.f(aaVar);
            }
        });
        a.a("AdColony.on_configured", new ac() {
            @Override
            public void a(aa aaVar) {
                i.this.K = true;
                if (i.this.P) {
                    JSONObject a2 = t.a();
                    JSONObject a3 = t.a();
                    t.a(a3, TapjoyConstants.TJC_APP_VERSION_NAME, au.a());
                    t.a(a2, "app_bundle_info", a3);
                    new aa("AdColony.on_update", 1, a2).b();
                    i.this.P = false;
                }
                if (i.this.Q) {
                    new aa("AdColony.on_update", 1).b();
                }
                if (x.j != null) {
                    x.j.b(t.b(aaVar.c(), "app_session_id"));
                }
            }
        });
        a.a("AdColony.get_app_info", new ac() {
            @Override
            public void a(aa aaVar) {
                i.this.g(aaVar);
            }
        });
        a.a("AdColony.v4vc_reward", new ac() {
            @Override
            public void a(aa aaVar) {
                i.this.d(aaVar);
            }
        });
        a.a("AdColony.zone_info", new ac() {
            @Override
            public void a(aa aaVar) {
                i.this.e(aaVar);
            }
        });
        a.a("AdColony.probe_launch_server", new ac() {
            @Override
            public void a(aa aaVar) {
                i.this.a(true, true);
            }
        });
        a.a("Crypto.sha1", new ac() {
            @Override
            public void a(aa aaVar) {
                JSONObject a2 = t.a();
                t.a(a2, "sha1", au.c(t.b(aaVar.c(), "data")));
                aaVar.a(a2).b();
            }
        });
        a.a("Crypto.crc32", new ac() {
            @Override
            public void a(aa aaVar) {
                JSONObject a2 = t.a();
                t.b(a2, "crc32", au.b(t.b(aaVar.c(), "data")));
                aaVar.a(a2).b();
            }
        });
        a.a("Crypto.uuid", new ac() {
            @Override
            public void a(aa aaVar) {
                int c = t.c(aaVar.c(), "number");
                JSONObject a2 = t.a();
                t.a(a2, "uuids", au.a(c));
                aaVar.a(a2).b();
            }
        });
        a.a("Device.query_advertiser_info", new ac() {
            @Override
            public void a(final aa aaVar) {
                if (a.d()) {
                    au.b.execute(new Runnable() {
                        @Override
                        public void run() {
                            i.this.a(a.c(), aaVar);
                        }
                    });
                }
            }
        });
        a.a("AdColony.controller_version", new ac() {
            @Override
            public void a(aa aaVar) {
                i.this.c.g = t.b(aaVar.c(), "version");
                if (x.j != null) {
                    x.j.a(i.this.c.g);
                }
                v.d.b("Controller version: " + i.this.c.g);
            }
        });
        int a2 = au.a(this.o);
        this.P = a2 == 1;
        this.Q = a2 == 2;
    }

    public boolean w() {
        if (this.J || !this.c.c().contains("arm") || ADCNative.nativeNeonSupported()) {
            return true;
        }
        v.g.b("ARM architechture without NEON support. Disabling AdColony.");
        a(true);
        return false;
    }

    private boolean e(boolean z) {
        return a(z, false);
    }

    public boolean a(boolean z, boolean z2) {
        if (!a.d()) {
            return false;
        }
        au.e(a.c().getFilesDir().getAbsolutePath() + "/../");
        v.b.a(">").b(a.c().getFilesDir().getAbsolutePath() + "/../");
        this.c.d = new File(this.o.c() + "/../lib/libImmEndpointWarpJ.so").exists();
        this.O = z2;
        this.L = z;
        if (z && !z2) {
            try {
                System.loadLibrary("js");
                System.loadLibrary("adcolony");
                this.h.a();
                w();
            } catch (UnsatisfiedLinkError e) {
                v.g.b("Expecting libadcolony.so in libs directory but it was not found.");
                a(true);
                return false;
            }
        }
        x();
        return true;
    }

    public void x() {
        new Thread(new Runnable() {
            @Override
            public void run() {
                JSONObject a2 = t.a();
                t.a(a2, "url", i.this.D);
                t.a(a2, "content_type", WebRequest.CONTENT_TYPE_JSON);
                t.a(a2, AppLovinEventTypes.USER_VIEWED_CONTENT, i.this.c.a(i.this.c).toString());
                v.b.b("Launch: " + i.this.c.a(i.this.c).toString());
                v.d.a("Saving Launch to ").a(i.this.o.g()).b(i.a);
                new ADCDownload(new aa("WebServices.post", 0, a2), i.this);
            }
        }).start();
    }

    private boolean a(JSONObject jSONObject) {
        if (!this.L) {
            v.f.b("Non-standard launch. Downloading new controller.");
            return true;
        }
        if (this.z != null && t.b(t.f(this.z, "controller"), "sha1").equals(t.b(t.f(jSONObject, "controller"), "sha1"))) {
            return false;
        }
        v.f.b("Controller sha1 does not match, downloading new controller.");
        return true;
    }

    public void f(aa aaVar) {
        a(t.c(aaVar.c(), "id"));
    }

    public void a(boolean z) {
        this.J = z;
    }

    public void g(aa aaVar) {
        JSONObject jSONObject = this.v.d;
        t.a(jSONObject, TapjoyConstants.TJC_APP_ID, this.v.a);
        t.a(jSONObject, "zone_ids", this.v.c);
        JSONObject a2 = t.a();
        t.a(a2, "options", jSONObject);
        aaVar.a(a2).b();
    }

    boolean a(final aa aaVar) {
        if (!a.d()) {
            return false;
        }
        try {
            final int c = aaVar.c().has("id") ? t.c(aaVar.c(), "id") : 0;
            if (c <= 0) {
                c = this.h.d();
            }
            a(c);
            boolean d = t.d(aaVar.c(), "is_webview");
            final boolean d2 = t.d(aaVar.c(), "is_display_module");
            if (d) {
                au.a(new Runnable() {
                    @Override
                    public void run() {
                        aw awVar = new aw(a.c().getApplicationContext(), i.this.h.d(), d2);
                        awVar.a(true, aaVar);
                        i.this.B.put(Integer.valueOf(awVar.a()), awVar);
                    }
                });
            } else {
                final ExecutorService newSingleThreadExecutor = Executors.newSingleThreadExecutor();
                newSingleThreadExecutor.submit(new Runnable() {
                    @Override
                    public void run() {
                        JSONObject f = t.f(aaVar.c(), TJAdUnitConstants.String.VIDEO_INFO);
                        i a2 = a.a();
                        if (c == 1 && a2.b() != null) {
                            t.a(f, "options", a2.b().d());
                        }
                        i.this.h.a(new ADCVMModule(a.c(), c, t.b(aaVar.c(), "filepath"), f, newSingleThreadExecutor));
                    }
                });
                JSONObject a2 = t.a();
                t.a(a2, "success", true);
                t.b(a2, "id", c);
                aaVar.a(a2).b();
            }
            return true;
        } catch (RuntimeException e) {
            v.h.b("Failed to create AdUnit file://" + t.b(aaVar.c(), "filepath"));
            v.h.b(e.toString());
            e.printStackTrace();
            return false;
        }
    }

    public void b(aa aaVar) {
        this.w = aaVar;
    }

    public void c(aa aaVar) {
        this.y = aaVar;
    }

    private void y() {
        if (a.a().h().g()) {
            this.R++;
            this.S = this.S * this.R <= 120 ? this.S * this.R : 120;
            au.a(new Runnable() {
                @Override
                public void run() {
                    new Handler().postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            if (a.a().h().g()) {
                                i.this.x();
                            }
                        }
                    }, i.this.S * 1000);
                }
            });
            return;
        }
        v.f.b("Max launch server download attempts hit, or AdColony is no longer active.");
    }

    @Override
    public void onDownloadFinished(ADCDownload download, aa message, Map<String, List<String>> headers) {
        if (download.a.equals(this.D)) {
            if (download.e) {
                v.b.b("Launch: " + download.b);
                JSONObject a2 = t.a(download.b);
                k kVar = this.c;
                t.a(a2, GeneralPropertiesWorker.SDK_VERSION, "3.1.2");
                if (a2 != null) {
                    t.h(a2, this.o.g() + a);
                    if (!c(a2)) {
                        if (!this.L) {
                            v.g.b("Incomplete or disabled launch server response. Disabling AdColony until next launch.");
                            a(true);
                            return;
                        }
                        return;
                    }
                    if (a(a2)) {
                        v.d.b("Controller missing or out of date. Downloading new controller.");
                        JSONObject a3 = t.a();
                        t.a(a3, "url", this.E);
                        t.a(a3, "filepath", this.o.g() + b);
                        new ADCDownload(new aa("WebServices.download", 0, a3), this);
                    }
                    this.z = a2;
                    return;
                }
                return;
            }
            y();
            return;
        }
        if (download.a.equals(this.E)) {
            if (!c(this.F)) {
                v.e.b("Downloaded controller sha1 does not match expected value, retrying.");
                y();
            } else if (!this.L && !this.O) {
                au.a(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            System.loadLibrary("js");
                            System.loadLibrary("adcolony");
                        } catch (UnsatisfiedLinkError e) {
                            i.this.a(true);
                            v.g.b("Expecting libadcolony.so in libs folder but it was not found. Disabling AdColony until next launch.");
                        }
                        i.this.h.a();
                        i.this.w();
                    }
                });
            }
        }
    }

    private boolean c(String str) {
        if (a.d()) {
            File file = new File(a.c().getFilesDir().getAbsolutePath() + "/adc3/" + b);
            if (file.exists()) {
                return au.a(str, file);
            }
        }
        return false;
    }

    public boolean a(Context context, aa aaVar) {
        if (context == null) {
            return false;
        }
        AdvertisingIdClient.Info info = null;
        try {
            info = AdvertisingIdClient.getAdvertisingIdInfo(context);
        } catch (Exception e) {
            e.printStackTrace();
            if (Build.MANUFACTURER.equals("Amazon")) {
                return false;
            }
            v.e.b("Advertising ID is not available. Collecting Android ID instead of Advertising ID.");
            return false;
        } catch (NoClassDefFoundError e2) {
            v.e.b("Google Play Services ads dependencies are missing. Collecting Android ID instead of Advertising ID.");
            return false;
        } catch (NoSuchMethodError e3) {
            v.e.b("Google Play Services is out of date, please update to GPS 4.0+. Collecting Android ID instead of Advertising ID.");
        }
        if (info == null) {
            return false;
        }
        this.c.a = info.getId();
        x.j.e.put(GpsHelper.ADVERTISING_ID_KEY, this.c.a);
        this.c.c = info.isLimitAdTrackingEnabled();
        this.c.b = true;
        if (aaVar != null) {
            JSONObject a2 = t.a();
            t.a(a2, "advertiser_id", this.c.b());
            t.a(a2, "limit_ad_tracking", this.c.f());
            aaVar.a(a2).b();
        }
        return true;
    }

    public void a(AdColonyAppOptions adColonyAppOptions) {
        synchronized (this.k.c()) {
            Iterator<Map.Entry<String, AdColonyInterstitial>> it = this.k.c().entrySet().iterator();
            while (it.hasNext()) {
                AdColonyInterstitial value = it.next().getValue();
                value.a(true);
                value.getListener().onExpiring(value);
            }
            this.k.c().clear();
        }
        this.K = false;
        a(1);
        this.A.clear();
        this.v = adColonyAppOptions;
        this.h.a();
        a(true, true);
    }

    public boolean a(int i) {
        if (this.h.a(i) == null) {
            return false;
        }
        if (this.B.containsKey(Integer.valueOf(i))) {
            aw awVar = this.B.get(Integer.valueOf(i));
            if (awVar.g()) {
                awVar.loadUrl("about:blank");
                awVar.clearCache(true);
                awVar.removeAllViews();
                awVar.a(true);
            }
            this.B.remove(Integer.valueOf(i));
        }
        if (this.y != null) {
            this.y.b();
            this.y = null;
            this.x = false;
        }
        v.d.a("Destroying module with id = ").b(i);
        return true;
    }

    private void b(JSONObject jSONObject) {
        boolean z = true;
        if (!ADCVMModule.a) {
            JSONObject f = t.f(jSONObject, "logging");
            x.i = t.a(f, "send_level", 1);
            if (!x.a && !t.d(f, "log_private")) {
                z = false;
            }
            x.a = z;
            x.h = t.a(f, "print_level", 3);
        }
    }

    private boolean c(JSONObject jSONObject) {
        if (jSONObject == null) {
            v.d.b("Launch response verification failed - response is null or unknown");
            return false;
        }
        try {
            JSONObject f = t.f(jSONObject, "controller");
            this.E = t.b(f, "url");
            this.F = t.b(f, "sha1");
            this.G = t.b(jSONObject, "status");
            b(jSONObject);
        } catch (Exception e) {
            try {
                new File(this.o.g() + a).delete();
            } catch (Exception e2) {
            }
        }
        if (this.G.equals("disable")) {
            try {
                new File(this.o.g() + b).delete();
            } catch (Exception e3) {
            }
            v.f.b("Launch server response with disabled status. Disabling AdColony until next launch.");
            a(true);
            return false;
        }
        if (!this.E.equals("") && !this.G.equals("")) {
            return true;
        }
        v.g.b("Missing controller status or URL. Disabling AdColony until next launch.");
        return false;
    }

    boolean d(final aa aaVar) {
        if (this.t == null) {
            return false;
        }
        au.a(new Runnable() {
            @Override
            public void run() {
                i.this.t.onReward(new AdColonyReward(aaVar));
            }
        });
        return true;
    }

    void e(aa aaVar) {
        AdColonyZone adColonyZone;
        if (this.J) {
            v.f.b("AdColony is disabled. Ignoring zone_info message.");
            return;
        }
        String b2 = t.b(aaVar.c(), "zone_id");
        if (this.A.containsKey(b2)) {
            adColonyZone = this.A.get(b2);
        } else {
            adColonyZone = new AdColonyZone(b2);
            this.A.put(b2, adColonyZone);
        }
        adColonyZone.a(aaVar);
    }

    private void z() {
        if (a.d() && this.U == null) {
            this.U = new Application.ActivityLifecycleCallbacks() {
                @Override
                public void onActivityResumed(Activity activity) {
                    a.b = true;
                    a.a(activity);
                    if (a.d() && i.this.j.e() && (a.c() instanceof b) && !((b) a.c()).g) {
                        v.d.b("Ignoring onActivityResumed");
                        return;
                    }
                    v.d.b("onActivityResumed() Activity Lifecycle Callback");
                    a.a(activity);
                    if (i.this.w != null) {
                        i.this.w.a(i.this.w.c()).b();
                        i.this.w = null;
                    }
                    i.this.I = false;
                    i.this.j.b(true);
                    i.this.j.c(true);
                    i.this.j.d(false);
                    if (i.this.f && !i.this.j.g()) {
                        i.this.j.a(true);
                    }
                    i.this.l.a();
                    if (x.j == null || x.j.c == null || x.j.c.isShutdown()) {
                        AdColony.a(activity, a.a().v);
                    } else {
                        x.j.a(5L, TimeUnit.SECONDS);
                    }
                }

                @Override
                public void onActivityPaused(Activity activity) {
                    a.b = false;
                    i.this.j.b(false);
                    i.this.j.c(true);
                    a.a().c.y();
                }

                @Override
                public void onActivityDestroyed(Activity activity) {
                }

                @Override
                public void onActivityStarted(Activity activity) {
                }

                @Override
                public void onActivityStopped(Activity activity) {
                }

                @Override
                public void onActivityCreated(Activity activity, Bundle bundle) {
                    if (!i.this.j.g()) {
                        i.this.j.a(true);
                    }
                    a.a(activity);
                }

                @Override
                public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
                }
            };
            a.c().getApplication().registerActivityLifecycleCallbacks(this.U);
        }
    }

    public AdColonyAppOptions b() {
        if (this.v == null) {
            this.v = new AdColonyAppOptions();
        }
        return this.v;
    }

    public void b(@NonNull AdColonyAppOptions adColonyAppOptions) {
        this.v = adColonyAppOptions;
    }

    public HashMap<String, AdColonyZone> c() {
        return this.A;
    }

    public void b(boolean z) {
        this.I = z;
    }

    public boolean d() {
        return this.I;
    }

    public boolean e() {
        return this.J;
    }

    public AdColonyRewardListener f() {
        return this.t;
    }

    public void a(AdColonyRewardListener adColonyRewardListener) {
        this.t = adColonyRewardListener;
    }

    public o g() {
        if (this.m == null) {
            this.m = new o();
            this.m.a();
        }
        return this.m;
    }

    public aj h() {
        if (this.j == null) {
            this.j = new aj();
            this.j.a();
        }
        return this.j;
    }

    public d i() {
        if (this.k == null) {
            this.k = new d();
            this.k.a();
        }
        return this.k;
    }

    public k j() {
        if (this.c == null) {
            this.c = new k();
            this.c.d();
        }
        return this.c;
    }

    public am k() {
        if (this.o == null) {
            this.o = new am();
            this.o.a();
        }
        return this.o;
    }

    public ab l() {
        if (this.h == null) {
            this.h = new ab();
            this.h.a();
        }
        return this.h;
    }

    public l m() {
        if (this.l == null) {
            this.l = new l();
        }
        return this.l;
    }

    public c n() {
        return this.q;
    }

    public void a(c cVar) {
        this.q = cVar;
    }

    public ax o() {
        return this.r;
    }

    public void a(ax axVar) {
        this.r = axVar;
    }

    public AdColonyInterstitial p() {
        return this.s;
    }

    public void a(AdColonyInterstitial adColonyInterstitial) {
        this.s = adColonyInterstitial;
    }

    public String q() {
        return this.C;
    }

    public void a(String str) {
        this.C = str;
    }

    public boolean r() {
        return this.H;
    }

    public void c(boolean z) {
        this.H = z;
    }

    public HashMap<Integer, aw> s() {
        return this.B;
    }

    public boolean t() {
        return this.x;
    }

    public void d(boolean z) {
        this.x = z;
    }

    public void b(@NonNull String str) {
        this.D = str;
    }

    public HashMap<String, AdColonyCustomMessageListener> u() {
        return this.u;
    }

    public boolean v() {
        return this.K;
    }
}