导航菜单

页面标题

页面副标题

Chaupal v3.2 - Branch.java 源代码

正在查看: Chaupal v3.2 应用的 Branch.java JAVA 源代码文件

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


package io.branch.referral;

import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import io.branch.referral.BranchLogger;
import io.branch.referral.ServerRequest;
import io.branch.referral.network.BranchRemoteInterface;
import io.branch.referral.u;
import java.lang.ref.WeakReference;
import java.util.Iterator;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import okhttp3.HttpUrl;
import org.json.JSONException;
import org.json.JSONObject;

public class Branch {
    private static boolean A;
    static boolean B;
    static boolean C;
    private static Branch D;
    private static boolean E;
    static boolean F;
    private static final String[] G;
    public static String H;
    private static boolean I;
    private static String J;
    private static String K;
    private static final String u;
    private static final String v;

    static boolean f41w;
    public static String x;
    private static boolean y;
    static boolean z;
    private JSONObject a;
    final k c;
    private final j d;
    private final io.branch.referral.f e;
    private final Context f;
    private final h g;
    public final q h;
    private t m;
    WeakReference<Activity> n;
    private io.branch.referral.c r;
    private final v s;
    private f t;
    final ConcurrentHashMap<io.branch.referral.d, String> i = new ConcurrentHashMap<>();
    private INTENT_STATE j = INTENT_STATE.PENDING;
    SESSION_STATE k = SESSION_STATE.UNINITIALISED;
    public boolean l = false;
    CountDownLatch o = null;
    CountDownLatch p = null;
    private boolean q = false;
    private BranchRemoteInterface b = new io.branch.referral.network.a(this);

    enum INTENT_STATE {
        PENDING,
        READY
    }

    enum SESSION_STATE {
        INITIALISED,
        INITIALISING,
        UNINITIALISED
    }

    class a implements Runnable {
        a() {
        }

        @Override
        public void run() {
            Branch.this.i0();
        }
    }

    class b implements u.f {
        final ServerRequest a;

        b(ServerRequest serverRequest) {
            this.a = serverRequest;
        }

        @Override
        public void a() {
            this.a.A(ServerRequest.PROCESS_WAIT_LOCK.INSTALL_REFERRER_FETCH_WAIT_LOCK);
            Branch.this.h.u("onInstallReferrersFinished");
        }
    }

    class c implements u.e {
        c() {
        }

        @Override
        public void a() {
            Branch.this.h.y(ServerRequest.PROCESS_WAIT_LOCK.GAID_FETCH_WAIT_LOCK);
            Branch.this.h.u("onAdsParamsFetchFinished");
        }
    }

    public interface d {
        void a(String str, zd.b bVar);
    }

    public interface e {
        void a(JSONObject jSONObject, zd.b bVar);
    }

    public static class f {
        private e a;
        private boolean b;
        private int c;
        private Uri d;
        private Boolean e;
        private boolean f;

        f(Activity activity, a aVar) {
            this(activity);
        }

        private void a(f fVar) {
            Branch.J().t = this;
            BranchLogger.l("Session initialization deferred until plugin invokes notifyNativeToInit()\nCaching Session Builder " + Branch.J().t + "\nuri: " + Branch.J().t.d + "\ncallback: " + Branch.J().t.a + "\nisReInitializing: " + Branch.J().t.f + "\ndelay: " + Branch.J().t.c + "\nisAutoInitialization: " + Branch.J().t.b + "\nignoreIntent: " + Branch.J().t.e);
        }

        public void b() {
            BranchLogger.l("Beginning session initialization");
            BranchLogger.l("Session uri is " + this.d);
            BranchLogger.l("Callback is " + this.a);
            BranchLogger.l("Is auto init " + this.b);
            BranchLogger.l("Will ignore intent " + this.e);
            BranchLogger.l("Is reinitializing " + this.f);
            if (Branch.F) {
                BranchLogger.l("Session init is deferred until signaled by plugin.");
                a(this);
                return;
            }
            Branch J = Branch.J();
            if (J == null) {
                BranchLogger.e("Branch is not setup properly, make sure to call getAutoInstance in your application class or declare BranchApp in your manifest.");
                return;
            }
            Boolean bool = this.e;
            if (bool != null) {
                Branch.j(bool.booleanValue());
            }
            Activity F = J.F();
            Intent intent = F != null ? F.getIntent() : null;
            if (F != null && intent != null && androidx.core.app.b.d(F) != null) {
                k.z(F).p0(androidx.core.app.b.d(F).toString());
            }
            Uri uri = this.d;
            if (uri != null) {
                J.g0(uri, F);
            } else if (this.f && J.b0(intent)) {
                J.g0(intent != null ? intent.getData() : null, F);
            } else if (this.f) {
                e eVar = this.a;
                if (eVar != null) {
                    eVar.a(null, new zd.b(HttpUrl.FRAGMENT_ENCODE_SET, -119));
                    return;
                }
                return;
            }
            BranchLogger.l("isInstantDeepLinkPossible " + J.q);
            if (J.q) {
                J.q = false;
                e eVar2 = this.a;
                if (eVar2 != null) {
                    eVar2.a(J.K(), null);
                }
                Branch.J().h.b(Defines$Jsonkey.InstantDeepLinkSession.getKey(), "true");
                J.k();
                this.a = null;
            }
            if (this.c > 0) {
                Branch.w(true);
            }
            o I = J.I(this.a, this.b);
            BranchLogger.a("Creating " + I + " from init on thread " + Thread.currentThread().getName());
            J.U(I, this.c);
        }

        f c(boolean z) {
            this.b = z;
            return this;
        }

        public void d() {
            this.f = true;
            b();
        }

        public f e(e eVar) {
            BranchLogger.l("InitSessionBuilder setting BranchReferralInitListener withCallback with " + eVar);
            this.a = eVar;
            return this;
        }

        public f f(Uri uri) {
            BranchLogger.l("InitSessionBuilder setting withData with " + uri);
            this.d = uri;
            return this;
        }

        private f(Activity activity) {
            Branch J = Branch.J();
            if (activity != null) {
                if (J.F() == null || !J.F().getLocalClassName().equals(activity.getLocalClassName())) {
                    J.n = new WeakReference<>(activity);
                }
            }
        }
    }

    static {
        String str = "io.branch.sdk.android:library:" + P();
        u = str;
        v = "!SDK-VERSION-STRING!:" + str;
        x = HttpUrl.FRAGMENT_ENCODE_SET;
        z = false;
        A = false;
        C = false;
        E = false;
        F = false;
        G = new String[]{"extra_launch_uri", "branch_intent"};
        H = null;
        I = false;
        J = null;
        K = null;
    }

    private Branch(@NonNull Context context) {
        this.f = context;
        this.c = k.z(context);
        this.s = new v(context);
        this.d = new j(context);
        this.e = new io.branch.referral.f(context);
        this.g = new h(context);
        this.h = q.g(context);
    }

    private void A(Uri uri, Activity activity) {
        BranchLogger.l("extractExternalUriAndIntentExtras " + uri + " " + activity);
        try {
            if (Z(activity)) {
                return;
            }
            String e2 = w.d(this.f).e(uri.toString());
            this.c.n0(e2);
            if (e2.equals(uri.toString())) {
                Bundle extras = activity.getIntent().getExtras();
                Set<String> keySet = extras.keySet();
                if (keySet.isEmpty()) {
                    return;
                }
                JSONObject jSONObject = new JSONObject();
                for (String str : G) {
                    if (keySet.contains(str)) {
                        jSONObject.put(str, extras.get(str));
                    }
                }
                if (jSONObject.length() > 0) {
                    this.c.m0(jSONObject.toString());
                }
            }
        } catch (Exception e3) {
            BranchLogger.a(e3.getMessage());
        }
    }

    private void B(Uri uri, Activity activity) {
        if (activity == null || activity.getIntent() == null) {
            return;
        }
        Intent intent = activity.getIntent();
        if (uri != null) {
            try {
                if (!Z(activity)) {
                    Defines$IntentKeys defines$IntentKeys = Defines$IntentKeys.BranchData;
                    if (!TextUtils.isEmpty(intent.getStringExtra(defines$IntentKeys.getKey()))) {
                        String stringExtra = intent.getStringExtra(defines$IntentKeys.getKey());
                        if (stringExtra != null) {
                            JSONObject jSONObject = new JSONObject(stringExtra);
                            jSONObject.put(Defines$Jsonkey.Clicked_Branch_Link.getKey(), true);
                            this.c.E0(jSONObject.toString());
                            this.q = true;
                        }
                        intent.removeExtra(defines$IntentKeys.getKey());
                        activity.setIntent(intent);
                        return;
                    }
                    if (uri.isHierarchical() && Boolean.valueOf(uri.getQueryParameter(Defines$Jsonkey.Instant.getKey())).booleanValue()) {
                        JSONObject jSONObject2 = new JSONObject();
                        for (String str : uri.getQueryParameterNames()) {
                            jSONObject2.put(str, uri.getQueryParameter(str));
                        }
                        jSONObject2.put(Defines$Jsonkey.Clicked_Branch_Link.getKey(), true);
                        this.c.E0(jSONObject2.toString());
                        this.q = true;
                        return;
                    }
                    return;
                }
            } catch (JSONException e2) {
                BranchLogger.a(e2.getMessage());
                return;
            }
        }
        if (this.c.y().equals("bnc_no_value")) {
            return;
        }
        JSONObject jSONObject3 = new JSONObject();
        jSONObject3.put(Defines$Jsonkey.IsFirstSession.getKey(), false);
        this.c.E0(jSONObject3.toString());
        this.q = true;
    }

    public static synchronized Branch D(@NonNull Context context) {
        Branch branch;
        synchronized (Branch.class) {
            if (D == null) {
                if (i.c(context)) {
                    t();
                }
                s(i.b(context));
                i.g(context);
                i.h(i.a(context));
                Branch S = S(context, i.e(context));
                D = S;
                g.c(S, context);
            }
            branch = D;
        }
        return branch;
    }

    public static synchronized Branch J() {
        Branch branch;
        synchronized (Branch.class) {
            if (D == null) {
                BranchLogger.l("Branch instance is not created yet. Make sure you call getAutoInstance(Context).");
            }
            branch = D;
        }
        return branch;
    }

    static String M() {
        return K;
    }

    public static String N() {
        return J;
    }

    public static String P() {
        return "5.12.0";
    }

    private static synchronized Branch S(@NonNull Context context, String str) {
        synchronized (Branch.class) {
            if (D != null) {
                BranchLogger.m("Warning, attempted to reinitialize Branch SDK singleton!");
                return D;
            }
            D = new Branch(context.getApplicationContext());
            if (TextUtils.isEmpty(str)) {
                BranchLogger.m("Warning: Please enter your branch_key in your project's Manifest file!");
                D.c.l0("bnc_no_value");
            } else {
                D.c.l0(str);
            }
            if (context instanceof Application) {
                D.l0((Application) context);
            }
            return D;
        }
    }

    private void T(ServerRequest serverRequest, boolean z2) {
        BranchLogger.l("initTasks " + serverRequest + " ignoreWaitLocks " + z2);
        if (!z2) {
            if (this.j != INTENT_STATE.READY && d0()) {
                BranchLogger.l("Adding INTENT_PENDING_WAIT_LOCK");
                serverRequest.b(ServerRequest.PROCESS_WAIT_LOCK.INTENT_PENDING_WAIT_LOCK);
            }
            serverRequest.b(ServerRequest.PROCESS_WAIT_LOCK.GAID_FETCH_WAIT_LOCK);
            if (serverRequest instanceof r) {
                serverRequest.b(ServerRequest.PROCESS_WAIT_LOCK.INSTALL_REFERRER_FETCH_WAIT_LOCK);
                this.d.f().d(this.f, new b(serverRequest));
            }
        }
        this.d.f().a(this.f, new c());
    }

    public void U(o oVar, int i) {
        BranchLogger.l("initializeSession " + oVar + " delay " + i);
        if (this.c.n() == null || this.c.n().equalsIgnoreCase("bnc_no_value")) {
            m0(SESSION_STATE.UNINITIALISED);
            e eVar = oVar.k;
            if (eVar != null) {
                eVar.a(null, new zd.b("Trouble initializing Branch.", -114));
            }
            BranchLogger.m("Warning: Please enter your branch_key in your project's manifest");
            return;
        }
        if (i.d()) {
            BranchLogger.m("Warning: You are using your test app's Branch Key. Remember to change it to live Branch Key during deployment.");
        }
        if (i > 0) {
            oVar.b(ServerRequest.PROCESS_WAIT_LOCK.USER_SET_WAIT_LOCK);
            new Handler().postDelayed(new a(), i);
        }
        Intent intent = F() != null ? F().getIntent() : null;
        boolean b0 = b0(intent);
        SESSION_STATE H2 = H();
        BranchLogger.l("Intent: " + intent + " forceBranchSession: " + b0 + " initState: " + H2);
        if (H2 == SESSION_STATE.UNINITIALISED || b0) {
            if (b0 && intent != null) {
                intent.removeExtra(Defines$IntentKeys.ForceNewBranchSession.getKey());
            }
            h0(oVar, false, b0);
            return;
        }
        e eVar2 = oVar.k;
        if (eVar2 != null) {
            eVar2.a(null, new zd.b("Warning.", -118));
        }
    }

    private boolean V(Activity activity) {
        return (activity == null || activity.getIntent() == null || (activity.getIntent().getFlags() & 1048576) == 0) ? false : true;
    }

    public static boolean W() {
        return y;
    }

    private boolean Z(Activity activity) {
        boolean z2 = false;
        if (activity != null && activity.getIntent() != null && activity.getIntent().getBooleanExtra(Defines$IntentKeys.BranchLinkUsed.getKey(), false)) {
            z2 = true;
        }
        BranchLogger.l("isIntentParamsAlreadyConsumed " + z2);
        return z2;
    }

    public static boolean a0() {
        return C;
    }

    public static boolean d0() {
        return !z;
    }

    private boolean f0(String str, String str2) {
        String[] split = str.split("\\?")[0].split("/");
        String[] split2 = str2.split("\\?")[0].split("/");
        if (split.length != split2.length) {
            return false;
        }
        for (int i = 0; i < split.length && i < split2.length; i++) {
            String str3 = split[i];
            if (!str3.equals(split2[i]) && !str3.contains("*")) {
                return false;
            }
        }
        return true;
    }

    public void g0(Uri uri, Activity activity) {
        BranchLogger.l("Read params uri: " + uri + " bypassCurrentActivityIntentState: " + A + " intent state: " + this.j);
        if (I) {
            boolean z2 = this.j == INTENT_STATE.READY || !this.r.a();
            boolean z3 = !b0(activity != null ? activity.getIntent() : null);
            if (z2 && z3) {
                B(uri, activity);
            }
        }
        if (A) {
            this.j = INTENT_STATE.READY;
        }
        if (this.j == INTENT_STATE.READY) {
            A(uri, activity);
            if (y(activity) || V(activity) || z(uri, activity)) {
                return;
            }
            x(uri, activity);
        }
    }

    private JSONObject h(JSONObject jSONObject) {
        if (jSONObject != null) {
            try {
                JSONObject jSONObject2 = this.a;
                if (jSONObject2 != null) {
                    if (jSONObject2.length() > 0) {
                        BranchLogger.l("You're currently in deep link debug mode. Please comment out 'setDeepLinkDebugMode' to receive the deep link parameters from a real Branch link");
                    }
                    Iterator<String> keys = this.a.keys();
                    while (keys.hasNext()) {
                        String next = keys.next();
                        jSONObject.put(next, this.a.get(next));
                    }
                }
            } catch (Exception e2) {
                BranchLogger.a(e2.getMessage());
            }
        }
        return jSONObject;
    }

    public static boolean i() {
        return A;
    }

    public static void j(boolean z2) {
        z = z2;
    }

    public static f j0(Activity activity) {
        return new f(activity, null);
    }

    public static void k0(String str) {
        if (TextUtils.isEmpty(str)) {
            BranchLogger.m("setAPIUrl: URL cannot be empty or null");
            return;
        }
        if (!str.endsWith("/")) {
            str = str + "/";
        }
        k.e0(str);
        BranchLogger.l("setAPIUrl: Branch API URL was set to " + str);
    }

    private boolean l(JSONObject jSONObject, ActivityInfo activityInfo) {
        if (activityInfo.metaData.getString("io.branch.sdk.auto_link_keys") != null) {
            for (String str : activityInfo.metaData.getString("io.branch.sdk.auto_link_keys").split(",")) {
                if (jSONObject.has(str)) {
                    return true;
                }
            }
        }
        return false;
    }

    private void l0(Application application) {
        try {
            io.branch.referral.c cVar = new io.branch.referral.c();
            this.r = cVar;
            application.unregisterActivityLifecycleCallbacks(cVar);
            application.registerActivityLifecycleCallbacks(this.r);
            E = true;
        } catch (NoClassDefFoundError | NoSuchMethodError unused) {
            E = false;
            BranchLogger.l(new zd.b(HttpUrl.FRAGMENT_ENCODE_SET, -108).a());
        }
    }

    private boolean m(org.json.JSONObject r5, android.content.pm.ActivityInfo r6) {
        throw new UnsupportedOperationException("Method not decompiled: io.branch.referral.Branch.m(org.json.JSONObject, android.content.pm.ActivityInfo):boolean");
    }

    private boolean n(Intent intent) {
        if (intent != null) {
            return intent.getBooleanExtra(Defines$IntentKeys.ForceNewBranchSession.getKey(), false);
        }
        return false;
    }

    private boolean o(Intent intent) {
        if (intent != null) {
            return (intent.getStringExtra(Defines$IntentKeys.BranchURI.getKey()) != null) && (intent.getBooleanExtra(Defines$IntentKeys.BranchLinkUsed.getKey(), false) ^ true);
        }
        return false;
    }

    private JSONObject r(String str) {
        if (str.equals("bnc_no_value")) {
            return new JSONObject();
        }
        try {
            return new JSONObject(str);
        } catch (JSONException unused) {
            try {
                return new JSONObject(new String(io.branch.referral.b.a(str.getBytes(), 2)));
            } catch (JSONException e2) {
                e2.printStackTrace();
                return new JSONObject();
            }
        }
    }

    static void s(boolean z2) {
        BranchLogger.l("deferInitForPluginRuntime " + z2);
        F = z2;
        if (z2) {
            w(z2);
        }
    }

    public static void t() {
        u(null, BranchLogger.BranchLogLevel.DEBUG);
    }

    private static void u(yd.a aVar, BranchLogger.BranchLogLevel branchLogLevel) {
        BranchLogger.f(aVar);
        BranchLogger.h(branchLogLevel);
        BranchLogger.g(true);
        BranchLogger.e(v);
    }

    private void v() {
        SESSION_STATE session_state = this.k;
        SESSION_STATE session_state2 = SESSION_STATE.UNINITIALISED;
        if (session_state != session_state2) {
            m0(session_state2);
        }
    }

    public static void w(boolean z2) {
        B = z2;
    }

    private void x(Uri uri, Activity activity) {
        if (uri == null || activity == null) {
            return;
        }
        String scheme = uri.getScheme();
        Intent intent = activity.getIntent();
        if (scheme == null || intent == null) {
            return;
        }
        if ((!scheme.equalsIgnoreCase("http") && !scheme.equalsIgnoreCase("https")) || TextUtils.isEmpty(uri.getHost()) || Z(activity)) {
            return;
        }
        if (uri.toString().equalsIgnoreCase(w.d(this.f).e(uri.toString()))) {
            this.c.g0(uri.toString());
        }
        intent.putExtra(Defines$IntentKeys.BranchLinkUsed.getKey(), true);
        activity.setIntent(intent);
    }

    private boolean y(Activity activity) {
        BranchLogger.l("extractBranchLinkFromIntentExtra " + activity);
        if (activity == null) {
            return false;
        }
        try {
            if (activity.getIntent() == null || activity.getIntent().getExtras() == null || Z(activity)) {
                return false;
            }
            Object obj = activity.getIntent().getExtras().get(Defines$IntentKeys.BranchURI.getKey());
            String str = null;
            if (obj instanceof String) {
                str = (String) obj;
            } else if (obj instanceof Uri) {
                str = ((Uri) obj).toString();
            }
            if (TextUtils.isEmpty(str)) {
                return false;
            }
            this.c.x0(str);
            Intent intent = activity.getIntent();
            intent.putExtra(Defines$IntentKeys.BranchLinkUsed.getKey(), true);
            activity.setIntent(intent);
            return true;
        } catch (Exception e2) {
            BranchLogger.a(e2.getMessage());
            return false;
        }
    }

    private boolean z(Uri uri, Activity activity) {
        String queryParameter;
        String str;
        if (uri != null) {
            try {
                if (!uri.isHierarchical() || (queryParameter = uri.getQueryParameter(Defines$Jsonkey.LinkClickID.getKey())) == null) {
                    return false;
                }
                this.c.v0(queryParameter);
                String str2 = "link_click_id=" + queryParameter;
                String uri2 = uri.toString();
                if (str2.equals(uri.getQuery())) {
                    str = "\\?" + str2;
                } else if (uri2.length() - str2.length() == uri2.indexOf(str2)) {
                    str = "&" + str2;
                } else {
                    str = str2 + "&";
                }
                activity.getIntent().setData(Uri.parse(uri2.replaceFirst(str, HttpUrl.FRAGMENT_ENCODE_SET)));
                activity.getIntent().putExtra(Defines$IntentKeys.BranchLinkUsed.getKey(), true);
                return true;
            } catch (Exception e2) {
                BranchLogger.a(e2.getMessage());
            }
        }
        return false;
    }

    public Context C() {
        return this.f;
    }

    public BranchRemoteInterface E() {
        return this.b;
    }

    Activity F() {
        WeakReference<Activity> weakReference = this.n;
        if (weakReference == null) {
            return null;
        }
        return weakReference.get();
    }

    public j G() {
        return this.d;
    }

    SESSION_STATE H() {
        return this.k;
    }

    o I(e eVar, boolean z2) {
        return this.h.l() ? new s(this.f, eVar, z2) : new r(this.f, eVar, z2);
    }

    public JSONObject K() {
        return h(r(this.c.S()));
    }

    public JSONObject L() {
        CountDownLatch countDownLatch = new CountDownLatch(1);
        this.p = countDownLatch;
        try {
            if (this.k != SESSION_STATE.INITIALISED) {
                countDownLatch.await(2500L, TimeUnit.MILLISECONDS);
            }
        } catch (InterruptedException unused) {
        }
        JSONObject h = h(r(this.c.S()));
        this.p = null;
        return h;
    }

    k O() {
        return this.c;
    }

    t Q() {
        return this.m;
    }

    public v R() {
        return this.s;
    }

    boolean X() {
        return Boolean.parseBoolean(J().h.f.get(Defines$Jsonkey.InstantDeepLinkSession.getKey()));
    }

    public boolean Y() {
        return this.q;
    }

    boolean b0(Intent intent) {
        return n(intent) || o(intent);
    }

    public boolean c0() {
        return this.s.a();
    }

    void e0(@NonNull Activity activity) {
        BranchLogger.l("onIntentReady " + activity + " removing INTENT_PENDING_WAIT_LOCK");
        o0(INTENT_STATE.READY);
        this.h.y(ServerRequest.PROCESS_WAIT_LOCK.INTENT_PENDING_WAIT_LOCK);
        if ((activity.getIntent() == null || H() == SESSION_STATE.INITIALISED) ? false : true) {
            g0(activity.getIntent().getData(), activity);
        }
        this.h.u("onIntentReady");
    }

    public Branch g(@NonNull String str, @NonNull String str2) {
        this.c.a(str, str2);
        return this;
    }

    void h0(@NonNull o oVar, boolean z2, boolean z3) {
        BranchLogger.l("registerAppInit " + oVar);
        m0(SESSION_STATE.INITIALISING);
        o h = this.h.h();
        BranchLogger.l("Ordering init calls");
        this.h.t();
        if (h == null || z3) {
            BranchLogger.l("Moving " + oVar + "  to front of the queue or behind network-in-progress request");
            this.h.n(oVar);
        } else {
            BranchLogger.l("Retrieved " + h + " with callback " + h.k + " in queue currently");
            h.k = oVar.k;
            StringBuilder sb = new StringBuilder();
            sb.append(h);
            sb.append(" now has callback ");
            sb.append(oVar.k);
            BranchLogger.l(sb.toString());
        }
        BranchLogger.l("Finished ordering init calls");
        this.h.t();
        T(oVar, z2);
        this.h.u("registerAppInit");
    }

    public void i0() {
        this.h.y(ServerRequest.PROCESS_WAIT_LOCK.USER_SET_WAIT_LOCK);
        this.h.u("removeSessionInitializationDelay");
    }

    void k() {
        Bundle bundle;
        JSONObject K2 = K();
        String str = null;
        try {
            Defines$Jsonkey defines$Jsonkey = Defines$Jsonkey.Clicked_Branch_Link;
            if (K2.has(defines$Jsonkey.getKey()) && K2.getBoolean(defines$Jsonkey.getKey())) {
                if (K2.length() > 0) {
                    Bundle bundle2 = this.f.getPackageManager().getApplicationInfo(this.f.getPackageName(), 128).metaData;
                    if (bundle2 == null || !bundle2.getBoolean("io.branch.sdk.auto_link_disable", false)) {
                        ActivityInfo[] activityInfoArr = this.f.getPackageManager().getPackageInfo(this.f.getPackageName(), 129).activities;
                        int i = 1501;
                        if (activityInfoArr != null) {
                            for (ActivityInfo activityInfo : activityInfoArr) {
                                if (activityInfo != null && (bundle = activityInfo.metaData) != null && ((bundle.getString("io.branch.sdk.auto_link_keys") != null || activityInfo.metaData.getString("io.branch.sdk.auto_link_path") != null) && (l(K2, activityInfo) || m(K2, activityInfo)))) {
                                    str = activityInfo.name;
                                    i = activityInfo.metaData.getInt("io.branch.sdk.auto_link_request_code", 1501);
                                    break;
                                }
                            }
                        }
                        if (str == null || F() == null) {
                            BranchLogger.l("No activity reference to launch deep linked activity");
                            return;
                        }
                        BranchLogger.l("deepLinkActivity " + str + " getCurrentActivity " + F());
                        Activity F2 = F();
                        Intent intent = new Intent(F2, Class.forName(str));
                        intent.putExtra(Defines$IntentKeys.AutoDeepLinked.getKey(), "true");
                        intent.putExtra(Defines$Jsonkey.ReferringData.getKey(), K2.toString());
                        Iterator<String> keys = K2.keys();
                        while (keys.hasNext()) {
                            String next = keys.next();
                            intent.putExtra(next, K2.getString(next));
                        }
                        F2.startActivityForResult(intent, i);
                        return;
                    }
                    return;
                }
                return;
            }
            BranchLogger.l("Does not have Clicked_Branch_Link or Clicked_Branch_Link is false, returning");
        } catch (PackageManager.NameNotFoundException unused) {
            BranchLogger.m("Warning: Please make sure Activity names set for auto deep link are correct!");
        } catch (ClassNotFoundException unused2) {
            BranchLogger.m("Warning: Please make sure Activity names set for auto deep link are correct! Error while looking for activity " + ((String) null));
        } catch (Exception unused3) {
        }
    }

    void m0(SESSION_STATE session_state) {
        this.k = session_state;
    }

    public void n0(boolean z2) {
        this.q = z2;
    }

    void o0(INTENT_STATE intent_state) {
        this.j = intent_state;
    }

    public void p() {
        this.c.f.b();
    }

    public Branch p0(@NonNull String str) {
        g(Defines$PreinstallKey.campaign.getKey(), str);
        return this;
    }

    void q() {
        p();
        v();
        this.c.E0("bnc_no_value");
        this.c.n0(null);
        this.s.b(this.f);
    }

    public Branch q0(@NonNull String str) {
        g(Defines$PreinstallKey.partner.getKey(), str);
        return this;
    }

    public void r0(@NonNull String str, @NonNull String str2) {
        this.c.C0(str, str2);
    }

    void s0() {
        q qVar = this.h;
        if (qVar == null) {
            return;
        }
        qVar.s();
        this.h.y(ServerRequest.PROCESS_WAIT_LOCK.SDK_INIT_WAIT_LOCK);
        this.h.u("unlockSDKInitWaitLock");
    }

    void t0() {
        w.d(this.f).c(this.f);
    }
}