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

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


package com.com.bytedance.overseas.sdk.a;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.text.TextUtils;
import com.bytedance.sdk.component.utils.l;
import com.bytedance.sdk.openadsdk.core.model.p;
import com.bytedance.sdk.openadsdk.core.n;
import com.bytedance.sdk.openadsdk.core.z;
import com.bytedance.sdk.openadsdk.utils.aa;
import com.mbridge.msdk.MBridgeConstans;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import org.json.JSONException;
import org.json.JSONObject;

public class b implements c {
    protected static Boolean e;

    protected com.bytedance.sdk.openadsdk.core.model.c f3554a;
    protected p b;
    protected String c;
    private WeakReference<Context> g;
    protected boolean d = false;
    protected final AtomicBoolean f = new AtomicBoolean(false);
    private boolean h = false;

    public b(Context context, p pVar, String str) {
        this.g = new WeakReference<>(context);
        this.b = pVar;
        this.f3554a = pVar.Z();
        this.c = str;
        l.b("GPDownLoader", str, "====tag===" + str);
        if (n.a() == null) {
            n.a(context);
        }
    }

    @Override
    public void a(boolean z) {
        this.h = z;
    }

    public boolean a(Context context, String str, String str2) {
        return a(context, str, str2, this.c, this.b);
    }

    public static boolean a(Context context, String str, String str2, String str3, p pVar) {
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("storeOpenType", (e == null || !e.booleanValue()) ? "webview" : MBridgeConstans.DYNAMIC_VIEW_WX_APP);
        } catch (JSONException e2) {
            l.c("GPDownLoader", "gotoGooglePlayByPackageNameAndUrl json error", e2);
        }
        String replace = (TextUtils.isEmpty(str3) || !str3.contains("_landingpage")) ? str3 : str3.replace("_landingpage", "");
        if (!TextUtils.isEmpty(str) && str.contains("play.google.com/store/apps/details?id=")) {
            try {
                Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(str));
                intent.setFlags(268435456);
                context.startActivity(intent);
                l.c("GPDownLoader", "Goto Google Play");
                l.c("GPDownLoader", "download_url is : ->" + str);
                com.bytedance.sdk.openadsdk.c.c.b(pVar, replace, "store_open", jSONObject);
                l.b("GPDownLoader", replace, jSONObject.toString());
                return true;
            } catch (Throwable unused) {
            }
        }
        if (context == null || str2 == null || TextUtils.isEmpty(str2)) {
            return false;
        }
        l.c("GPDownLoader", "gotoGooglePlay :market://details?id=" + str2);
        try {
            Intent intent2 = new Intent("android.intent.action.VIEW");
            Uri parse = Uri.parse("market://details?id=" + str2);
            intent2.setData(parse);
            Iterator<ResolveInfo> it = context.getPackageManager().queryIntentActivities(intent2, 65536).iterator();
            while (it.hasNext()) {
                if (it.next().activityInfo.packageName.equals("com.android.vending") && context.getPackageManager().getLaunchIntentForPackage("com.android.vending") != null) {
                    Intent intent3 = new Intent("android.intent.action.VIEW");
                    intent3.setData(parse);
                    intent3.setPackage("com.android.vending");
                    if (!(context instanceof Activity)) {
                        intent3.setFlags(268435456);
                    }
                    context.startActivity(intent3);
                    jSONObject.put("storeOpenType", MBridgeConstans.DYNAMIC_VIEW_WX_APP);
                    com.bytedance.sdk.openadsdk.c.c.b(pVar, replace, "store_open", jSONObject);
                    return true;
                }
            }
        } catch (Throwable unused2) {
        }
        try {
            Intent intent4 = new Intent("android.intent.action.VIEW", Uri.parse("https://play.google.com/store/apps/details?id=" + str2));
            intent4.setFlags(268435456);
            context.startActivity(intent4);
            jSONObject.put("storeOpenType", "webview");
            com.bytedance.sdk.openadsdk.c.c.b(pVar, replace, "store_open", jSONObject);
            return true;
        } catch (Throwable unused3) {
            return false;
        }
    }

    public static void a(Context context) {
        Intent intent = new Intent("android.intent.action.VIEW");
        intent.setData(Uri.parse("market://details"));
        try {
            Iterator<ResolveInfo> it = context.getPackageManager().queryIntentActivities(intent, 65536).iterator();
            while (it.hasNext()) {
                if (it.next().activityInfo.packageName.equals("com.android.vending")) {
                    e = true;
                    return;
                }
            }
        } catch (Throwable unused) {
            e = false;
        }
        e = false;
    }

    public Context c() {
        WeakReference<Context> weakReference = this.g;
        return (weakReference == null || weakReference.get() == null) ? n.a() : this.g.get();
    }

    @Override
    public void d() {
        if (c() == null) {
            return;
        }
        if (b()) {
            this.f.set(true);
            this.b.c(true);
            return;
        }
        if (a()) {
            this.b.c(true);
            return;
        }
        if (e()) {
            this.b.c(true);
        } else {
            if (this.b.Z() != null || this.b.O() == null) {
                return;
            }
            z.a(c(), this.b.O(), this.b, aa.a(this.c), this.c, true);
            this.b.c(true);
        }
    }

    public boolean b() {
        if (this.b.aa() == null) {
            return false;
        }
        String a2 = this.b.aa().a();
        if (!TextUtils.isEmpty(a2)) {
            Uri parse = Uri.parse(a2);
            Intent intent = new Intent("android.intent.action.VIEW");
            intent.setData(parse);
            if (aa.a(c(), intent)) {
                if (!(c() instanceof Activity)) {
                    intent.addFlags(268435456);
                }
                try {
                    HashMap hashMap = new HashMap();
                    a(hashMap);
                    com.bytedance.sdk.openadsdk.c.c.a(this.b, this.c, "open_url_app", hashMap);
                    c().startActivity(intent);
                    com.bytedance.sdk.openadsdk.c.l.a().a(this.b, this.c);
                    return true;
                } catch (Throwable th) {
                    l.e("GPDownLoader", th.getMessage());
                }
            }
        }
        if (this.d && !this.f.get()) {
            return false;
        }
        this.d = true;
        HashMap hashMap2 = new HashMap();
        a(hashMap2);
        com.bytedance.sdk.openadsdk.c.c.a(this.b, this.c, "open_fallback_url", hashMap2);
        return false;
    }

    private void a(Map<String, Object> map) {
        p pVar = this.b;
        if (pVar == null || pVar.as()) {
            return;
        }
        p pVar2 = this.b;
        map.put("auto_click", Boolean.valueOf((pVar2 == null || pVar2.b()) ? false : true));
    }

    @Override
    public boolean e() {
        this.f.set(true);
        return this.f3554a != null && a(c(), this.f3554a.a(), this.f3554a.c());
    }

    @Override
    public boolean a() {
        Intent a2;
        if (this.f3554a == null) {
            return false;
        }
        p pVar = this.b;
        if (pVar != null && pVar.ao() == 0) {
            return false;
        }
        String c = this.f3554a.c();
        if (TextUtils.isEmpty(c) || !aa.b(c(), c) || (a2 = aa.a(c(), c)) == null) {
            return false;
        }
        a2.putExtra("START_ONLY_FOR_ANDROID", true);
        try {
            c().startActivity(a2);
            HashMap hashMap = new HashMap();
            a(hashMap);
            com.bytedance.sdk.openadsdk.c.c.a(this.b, this.c, "click_open", hashMap);
            return true;
        } catch (Throwable th) {
            l.e("GPDownLoader", th.getMessage());
            return false;
        }
    }
}