大漢易經書院.apk(点击下载) / d.java


package com.baidu.techain.core;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Pair;
import com.baidu.techain.TechainProvider;
import com.baidu.techain.TechainService;
import com.baidu.techain.ac.Callback;
import com.baidu.techain.ac.F;
import com.baidu.techain.h.a;
import com.baidu.techain.i.c;
import com.baidu.techain.i.e;
import com.baidu.techain.i.s;
import com.baidu.techain.i.t;
import com.baidu.techain.i.u;
import com.baidu.techain.i.v;
import com.baidu.techain.mutiprocess.b;
import com.huawei.updatesdk.service.otaupdate.UpdateKey;
import com.xiaomi.mipush.sdk.Constants;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

/* compiled from: MethodImpl */
public final class d {
    public static String a = "";
    private static boolean b = false;
    private static boolean c = false;
    private static boolean d = false;

    /* JADX WARNING: Code restructure failed: missing block: B:14:?, code lost:
        com.baidu.techain.i.c.a();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:16:0x002a, code lost:
        return;
     */
    /* JADX WARNING: Exception block dominator not found, dom blocks: [] */
    /* JADX WARNING: Missing exception handler attribute for start block: B:13:0x0026 */
    public static synchronized void a(final Context context, final int i, final String str, final String str2, final int... iArr) {
        synchronized (d.class) {
            if (context != null) {
                if (!b) {
                    b = true;
                    c.b = context;
                    v.a(context).b(new Runnable() {
                        /* class com.baidu.techain.core.d.AnonymousClass1 */

                        public final void run() {
                            c.j(context);
                            try {
                                s.a(context);
                                if (c.a(context, true)) {
                                    if (c.a(context) != 1) {
                                        Intent intent = new Intent("com.baidu.action.Techain.VIEW");
                                        intent.setClass(context, TechainService.class);
                                        intent.setPackage(context.getPackageName());
                                        intent.addCategory("com.baidu.category.techain");
                                        intent.addCategory("android.intent.category.DEFAULT");
                                        Bundle bundle = new Bundle();
                                        bundle.putStringArray("appkey", new String[]{str, str2});
                                        bundle.putIntArray("key", iArr);
                                        bundle.putInt("delay", i);
                                        intent.putExtra("bundle", bundle);
                                        context.startService(intent);
                                        b.b(context);
                                        return;
                                    }
                                    d.a(context);
                                    c a2 = c.a(context);
                                    e.a(context);
                                    e.b(context);
                                    if (!TextUtils.isEmpty(str) && !TextUtils.isEmpty(str2)) {
                                        String str = str;
                                        String str2 = str2;
                                        try {
                                            if (!TextUtils.isEmpty(str)) {
                                                if (!TextUtils.isEmpty(str2)) {
                                                    if (!c.e.equals(str) || !c.f.equals(str2)) {
                                                        a aVar = a2.a;
                                                        SharedPreferences.Editor editor = aVar.b;
                                                        editor.putString("svi", str + Constants.ACCEPT_TIME_SEPARATOR_SERVER + str2);
                                                        aVar.b.commit();
                                                    }
                                                }
                                            }
                                        } catch (Throwable unused) {
                                            c.a();
                                        }
                                    }
                                    try {
                                        if (i > 0) {
                                            Thread.sleep((long) (i * 1000));
                                        }
                                    } catch (Throwable unused2) {
                                        c.a();
                                    }
                                    a.a(context).a(iArr);
                                    if (!t.a(context)) {
                                        boolean unused3 = d.c = true;
                                        return;
                                    }
                                    c.a(1);
                                    a2.b();
                                }
                            } catch (Throwable unused4) {
                                c.a();
                            }
                        }
                    });
                }
            }
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:12:?, code lost:
        com.baidu.techain.i.c.a();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:14:0x0020, code lost:
        return;
     */
    /* JADX WARNING: Exception block dominator not found, dom blocks: [] */
    /* JADX WARNING: Missing exception handler attribute for start block: B:11:0x001c */
    private static synchronized void b(final Context context) {
        synchronized (d.class) {
            if (context != null) {
                if (c) {
                    c = false;
                    v.a(context).b(new Runnable() {
                        /* class com.baidu.techain.core.d.AnonymousClass2 */

                        public final void run() {
                            try {
                                c a2 = c.a(context);
                                if (a2 != null) {
                                    c.a(1);
                                    a2.b();
                                }
                            } catch (Throwable unused) {
                                c.a();
                            }
                        }
                    });
                }
            }
        }
    }

    public static Pair<Integer, Object> a(int i, String str, Class<?>[] clsArr, Object... objArr) {
        try {
            Context context = c.b;
            if (context == null) {
                return new Pair<>(4, null);
            }
            if (!t.a(c.b)) {
                return new Pair<>(12, null);
            }
            if (!c.a(c.b, false)) {
                return new Pair<>(11, null);
            }
            String b2 = c.b(c.b);
            if (TextUtils.isEmpty(b2)) {
                if (c.b(c.b.getPackageName())) {
                    return new Pair<>(5, null);
                }
                return c.a(context).a(i, str, clsArr, objArr);
            } else if (c.b(b2)) {
                return b(c.b, i, str, clsArr, objArr);
            } else {
                return c.a(context).a(i, str, clsArr, objArr);
            }
        } catch (Throwable unused) {
            c.a();
            return new Pair<>(3, null);
        }
    }

    private static Pair<Integer, Object> a(String str, Class<?>[] clsArr, Object... objArr) {
        if (TextUtils.isEmpty(str)) {
            return new Pair<>(1, null);
        }
        try {
            f a2 = f.a();
            if (a2 == null) {
                return new Pair<>(3, null);
            }
            ApkInfo d2 = a2.d("com.baidu.techain.x0");
            if (d2 != null) {
                Class<?> a3 = ((e) d2.classLoader).a("com.baidu.techain.engine.EngineImpl");
                return new Pair<>(0, c.a(a3.getDeclaredMethod("getInstance", Context.class).invoke(a3, c.b), str, clsArr, objArr));
            }
            return new Pair<>(3, null);
        } catch (Throwable unused) {
            c.a();
        }
    }

    public static boolean a(final int i, final String str, final Callback callback, final Class<?>[] clsArr, final Object... objArr) {
        try {
            if (v.a(c.b).a(new Runnable() {
                /* class com.baidu.techain.core.d.AnonymousClass3 */

                public final void run() {
                    try {
                        Context context = c.b;
                        if (context == null) {
                            for (int i = 0; i < 20; i++) {
                                try {
                                    Thread.sleep(50);
                                } catch (InterruptedException unused) {
                                    c.a();
                                }
                                context = c.b;
                                if (context != null) {
                                    break;
                                }
                            }
                            if (context == null) {
                                if (callback != null) {
                                    callback.onError(4);
                                    return;
                                }
                                return;
                            }
                        }
                        if (!t.a(c.b)) {
                            callback.onError(12);
                        } else if (c.a(c.b, false)) {
                            String b2 = c.b(c.b);
                            if (TextUtils.isEmpty(b2)) {
                                if (!c.b(c.b.getPackageName())) {
                                    c a2 = c.a();
                                    if (a2 == null) {
                                        for (int i2 = 0; i2 < 20; i2++) {
                                            try {
                                                Thread.sleep(50);
                                            } catch (InterruptedException unused2) {
                                                c.a();
                                            }
                                            a2 = c.a();
                                            if (a2 != null) {
                                                break;
                                            }
                                        }
                                        if (a2 == null) {
                                            if (callback != null) {
                                                callback.onError(11);
                                                return;
                                            }
                                            return;
                                        }
                                    }
                                    a2.a(i, str, callback, clsArr, objArr);
                                } else if (callback != null) {
                                    callback.onError(5);
                                }
                            } else if (c.b(b2)) {
                                d.a(c.b, i, str, callback, clsArr, objArr);
                            } else {
                                c a3 = c.a();
                                if (a3 == null) {
                                    for (int i3 = 0; i3 < 20; i3++) {
                                        try {
                                            Thread.sleep(50);
                                        } catch (InterruptedException unused3) {
                                            c.a();
                                        }
                                        a3 = c.a();
                                        if (a3 != null) {
                                            break;
                                        }
                                    }
                                    if (a3 == null) {
                                        if (callback != null) {
                                            callback.onError(11);
                                            return;
                                        }
                                        return;
                                    }
                                }
                                a3.a(i, str, callback, clsArr, objArr);
                            }
                        } else if (callback != null) {
                            callback.onError(11);
                        }
                    } catch (Throwable unused4) {
                        c.a();
                    }
                }
            }) == 1) {
                return true;
            }
            return false;
        } catch (Throwable unused) {
            c.a();
            return false;
        }
    }

    public static String a(Context context, String str, int i, String str2) {
        if (context == null) {
            return "";
        }
        try {
            if (!t.a(context)) {
                return c(context);
            }
            if (!TextUtils.isEmpty(a)) {
                if (i != 0) {
                    if (TextUtils.isEmpty(str2)) {
                        a(1, "ice", (Callback) null, new Class[]{String.class, Integer.TYPE}, str, Integer.valueOf(i));
                    } else {
                        a(1, "ice", (Callback) null, new Class[]{String.class, Integer.TYPE, String.class}, str, Integer.valueOf(i), str2);
                    }
                }
                return a;
            } else if (!c.a(context, false)) {
                return "";
            } else {
                String b2 = c.b(context);
                if (TextUtils.isEmpty(b2)) {
                    if (c.b(context.getPackageName())) {
                        return "";
                    }
                    return b(context, str, i, str2);
                } else if (!c.b(b2)) {
                    return b(context, str, i, str2);
                } else {
                    Pair<Integer, Object> b3 = b(context, 0, "gzfi", null, str, Integer.valueOf(i), str2);
                    if (b3 == null || ((Integer) b3.first).intValue() != 0) {
                        return "";
                    }
                    return (String) b3.second;
                }
            }
        } catch (Throwable unused) {
            c.a();
        }
        return "";
    }

    private static String b(Context context, String str, int i, String str2) {
        if (context == null) {
            return "";
        }
        try {
            if (!t.a(context)) {
                return "";
            }
        } catch (Throwable unused) {
            c.a();
        }
        if (i != 0) {
            if (TextUtils.isEmpty(str2)) {
                a(1, "ice", (Callback) null, new Class[]{String.class, Integer.TYPE}, str, Integer.valueOf(i));
            } else {
                a(1, "ice", (Callback) null, new Class[]{String.class, Integer.TYPE, String.class}, str, Integer.valueOf(i), str2);
            }
        }
        return d(context);
    }

    private static String c(Context context) {
        String str;
        String[] split;
        try {
            a a2 = a.a(context);
            String E = a2.E();
            if (!TextUtils.isEmpty(E)) {
                return E;
            }
            String F = a2.F();
            if (!TextUtils.isEmpty(F)) {
                return F;
            }
            if (c.a(context) == 0) {
                str = e.c(context);
            } else {
                str = e.b(context);
            }
            if (!TextUtils.isEmpty(str) && (split = str.split("\\|")) != null && split.length == 2 && !TextUtils.isEmpty(split[0])) {
                if (!TextUtils.isEmpty(split[1])) {
                    byte[] re = F.getInstance().re(split[1].getBytes(), split[0].getBytes());
                    if (re != null) {
                        String str2 = split[0] + c.a(re);
                        a2.f(str2);
                        return str2;
                    }
                    return "74FFB5E615AA72E0B057EE43E3D5A23A8BA34AAC1672FC9B56A7106C57BA03";
                }
            }
            return "74FFB5E615AA72E0B057EE43E3D5A23A8BA34AAC1672FC9B56A7106C57BA03";
        } catch (Throwable unused) {
            c.a();
        }
    }

    private static String d(Context context) {
        try {
            a a2 = a.a(context);
            String E = a2.E();
            if (!TextUtils.isEmpty(E)) {
                a = E;
                return E;
            }
            String F = a2.F();
            if (!TextUtils.isEmpty(F)) {
                a = F;
                return F;
            }
            String b2 = e.b(context);
            if (!TextUtils.isEmpty(b2)) {
                String[] split = b2.split("\\|");
                if (split != null && split.length == 2 && !TextUtils.isEmpty(split[0])) {
                    if (!TextUtils.isEmpty(split[1])) {
                        byte[] re = F.getInstance().re(split[1].getBytes(), split[0].getBytes());
                        if (re != null) {
                            String str = split[0] + c.a(re);
                            a2.f(str);
                            a = str;
                            return str;
                        }
                    }
                }
                a = "74FFB5E615AA72E0B057EE43E3D5A23A8BA34AAC1672FC9B56A7106C57BA03";
                return "74FFB5E615AA72E0B057EE43E3D5A23A8BA34AAC1672FC9B56A7106C57BA03";
            }
            a = "74FFB5E615AA72E0B057EE43E3D5A23A8BA34AAC1672FC9B56A7106C57BA03";
            return "74FFB5E615AA72E0B057EE43E3D5A23A8BA34AAC1672FC9B56A7106C57BA03";
        } catch (Throwable unused) {
            c.a();
        }
    }

    public static String a(Context context) {
        try {
            if (!TextUtils.isEmpty(a)) {
                return a;
            }
            if (context == null) {
                return "";
            }
            if (!t.a(context)) {
                return c(context);
            }
            if (!c.a(context, false)) {
                return "";
            }
            String b2 = c.b(context);
            if (TextUtils.isEmpty(b2)) {
                if (c.b(context.getPackageName())) {
                    return "";
                }
                return d(context);
            } else if (!c.b(b2)) {
                return d(context);
            } else {
                Pair<Integer, Object> b3 = b(context, 0, "gz", null, new Object[0]);
                if (b3 != null) {
                    if (((Integer) b3.first).intValue() == 0) {
                        return (String) b3.second;
                    }
                    return "";
                }
                a = "74FFB5E615AA72E0B057EE43E3D5A23A8BA34AAC1672FC9B56A7106C57BA03";
                return "74FFB5E615AA72E0B057EE43E3D5A23A8BA34AAC1672FC9B56A7106C57BA03";
            }
        } catch (Throwable unused) {
            c.a();
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:19:0x0075 A[Catch:{ all -> 0x0094 }] */
    /* JADX WARNING: Removed duplicated region for block: B:20:0x0077 A[Catch:{ all -> 0x0094 }] */
    /* JADX WARNING: Removed duplicated region for block: B:23:0x0087 A[Catch:{ all -> 0x0094 }] */
    /* JADX WARNING: Removed duplicated region for block: B:24:0x008b A[Catch:{ all -> 0x0094 }] */
    public static Bundle a(Context context, String str, Bundle bundle) {
        Pair<Integer, Object> pair;
        String str2;
        Integer num;
        int i;
        String b2;
        final Bundle bundle2 = new Bundle();
        try {
            Class[] clsArr = null;
            String str3 = null;
            if ("gzfi".equals(str)) {
                bundle2.putBoolean("handle_flag", true);
                if (bundle != null) {
                    CallArgs callArgs = new CallArgs();
                    try {
                        bundle.setClassLoader(TechainProvider.class.getClassLoader());
                        CallArgs callArgs2 = (CallArgs) bundle.getParcelable("args");
                        if (callArgs2 != null) {
                            if (callArgs2.e.length == 2) {
                                num = (Integer) callArgs2.e[1];
                                str3 = (String) callArgs2.e[0];
                                str2 = null;
                            } else if (callArgs2.e.length == 3) {
                                str3 = (String) callArgs2.e[0];
                                Integer num2 = (Integer) callArgs2.e[1];
                                str2 = (String) callArgs2.e[2];
                                num = num2;
                            }
                            if (num != null) {
                                i = 0;
                            } else {
                                i = num.intValue();
                            }
                            b2 = b(context, str3, i, str2);
                            if (!TextUtils.isEmpty(b2)) {
                                bundle2.putInt(UpdateKey.STATUS, 8);
                            } else {
                                callArgs.f = b2;
                                bundle2.putParcelable("result", callArgs);
                                bundle2.putInt(UpdateKey.STATUS, 0);
                            }
                            return bundle2;
                        }
                        num = null;
                        str2 = null;
                        if (num != null) {
                        }
                        b2 = b(context, str3, i, str2);
                        if (!TextUtils.isEmpty(b2)) {
                        }
                        return bundle2;
                    } catch (Throwable unused) {
                        c.a();
                        bundle2.putInt(UpdateKey.STATUS, 7);
                        return bundle2;
                    }
                }
            } else if ("invokeMethod".equals(str)) {
                bundle2.putBoolean("handle_flag", true);
                if (bundle != null) {
                    final CallArgs callArgs3 = new CallArgs();
                    try {
                        bundle.setClassLoader(TechainProvider.class.getClassLoader());
                        CallArgs callArgs4 = (CallArgs) bundle.getParcelable("args");
                        int i2 = callArgs4.a;
                        int i3 = callArgs4.b;
                        final String str4 = callArgs4.c;
                        Object[] objArr = callArgs4.d;
                        if (objArr != null) {
                            clsArr = new Class[objArr.length];
                            for (int i4 = 0; i4 < objArr.length; i4++) {
                                String str5 = (String) objArr[i4];
                                if (TextUtils.isEmpty(str5) || !str5.contains("@@")) {
                                    clsArr[i4] = Class.forName((String) objArr[i4]);
                                } else {
                                    Class<?> a2 = c.a(str5);
                                    if (a2 != null) {
                                        clsArr[i4] = a2;
                                    }
                                }
                            }
                        }
                        Object[] objArr2 = callArgs4.e;
                        if (i3 == 1) {
                            if (i2 != 1 || !"xgz".equals(str4)) {
                                pair = a(i2, str4, clsArr, objArr2);
                            } else {
                                pair = a(str4, clsArr, objArr2);
                            }
                            bundle2.putInt(UpdateKey.STATUS, ((Integer) pair.first).intValue());
                            if (((Integer) pair.first).intValue() == 0) {
                                callArgs3.f = pair.second;
                            }
                        } else if (i3 == 0) {
                            final CountDownLatch countDownLatch = new CountDownLatch(1);
                            a(i2, str4, new Callback() {
                                /* class com.baidu.techain.core.d.AnonymousClass4 */

                                /* JADX WARNING: Can't wrap try/catch for region: R(6:0|1|2|3|4|5) */
                                /* JADX WARNING: Code restructure failed: missing block: B:6:0x0019, code lost:
                                    r4 = move-exception;
                                 */
                                /* JADX WARNING: Code restructure failed: missing block: B:7:0x001a, code lost:
                                    r6.countDown();
                                 */
                                /* JADX WARNING: Code restructure failed: missing block: B:8:0x001f, code lost:
                                    throw r4;
                                 */
                                /* JADX WARNING: Failed to process nested try/catch */
                                /* JADX WARNING: Missing exception handler attribute for start block: B:2:0x000f */
                                @Override // com.baidu.techain.ac.Callback
                                public final Object onEnd(Object... objArr) {
                                    bundle2.putInt(UpdateKey.STATUS, 0);
                                    callArgs3.f = objArr[0];
                                    c.a();
                                    countDownLatch.countDown();
                                    return null;
                                }

                                /* JADX WARNING: Failed to process nested try/catch */
                                /* JADX WARNING: Missing exception handler attribute for start block: B:2:0x0011 */
                                @Override // com.baidu.techain.ac.Callback
                                public final Object onError(Object... objArr) {
                                    bundle2.putInt(UpdateKey.STATUS, ((Integer) objArr[0]).intValue());
                                    try {
                                        c.a();
                                        countDownLatch.countDown();
                                        return null;
                                    } catch (Throwable th) {
                                        countDownLatch.countDown();
                                        throw th;
                                    }
                                }
                            }, clsArr, objArr2);
                            try {
                                countDownLatch.await(180000, TimeUnit.MILLISECONDS);
                            } catch (Throwable unused2) {
                                bundle2.putInt(UpdateKey.STATUS, 3);
                                c.a();
                            }
                        }
                        bundle2.putParcelable("result", callArgs3);
                        return bundle2;
                    } catch (Throwable unused3) {
                        c.a();
                        bundle2.putParcelable("result", callArgs3);
                        bundle2.putInt(UpdateKey.STATUS, 7);
                        return bundle2;
                    }
                }
            } else if ("gz".equals(str)) {
                bundle2.putBoolean("handle_flag", true);
                String d2 = d(context);
                if (TextUtils.isEmpty(d2)) {
                    bundle2.putInt(UpdateKey.STATUS, 8);
                } else {
                    CallArgs callArgs5 = new CallArgs();
                    callArgs5.f = d2;
                    bundle2.putParcelable("result", callArgs5);
                    bundle2.putInt(UpdateKey.STATUS, 0);
                }
                return bundle2;
            } else {
                bundle2.putInt(UpdateKey.STATUS, 2);
                return bundle2;
            }
        } catch (Throwable unused4) {
            c.a();
        }
        bundle2.putInt(UpdateKey.STATUS, 10);
        return bundle2;
    }

    /* access modifiers changed from: private */
    /* JADX WARNING: Removed duplicated region for block: B:15:0x0034 A[Catch:{ all -> 0x00b5 }] */
    /* JADX WARNING: Removed duplicated region for block: B:28:0x0082 A[Catch:{ all -> 0x00b5 }] */
    /* JADX WARNING: Removed duplicated region for block: B:30:0x008b A[Catch:{ all -> 0x00b5 }] */
    public static Pair<Integer, Object> a(Context context, int i, int i2, String str, Class<?>[] clsArr, Object... objArr) {
        String str2;
        Bundle a2;
        try {
            if (TextUtils.isEmpty(str)) {
                return Pair.create(1, null);
            }
            if (!"gzfi".equals(str)) {
                if (!"gz".equals(str)) {
                    str2 = "invokeMethod";
                    CallArgs callArgs = new CallArgs();
                    callArgs.a = i;
                    callArgs.c = str;
                    callArgs.b = i2;
                    if (clsArr != null) {
                        Object[] objArr2 = new Object[clsArr.length];
                        for (int i3 = 0; i3 < clsArr.length; i3++) {
                            if (clsArr[i3].isPrimitive()) {
                                String a3 = c.a(clsArr[i3]);
                                if (!TextUtils.isEmpty(a3)) {
                                    objArr2[i3] = a3 + "@@";
                                }
                            } else {
                                objArr2[i3] = clsArr[i3].getName();
                            }
                        }
                        callArgs.d = objArr2;
                    }
                    callArgs.e = objArr;
                    Bundle bundle = new Bundle();
                    bundle.putParcelable("args", callArgs);
                    a2 = u.a(context, str2, bundle);
                    if (a2 != null) {
                        return Pair.create(3, null);
                    }
                    a2.setClassLoader(CallArgs.class.getClassLoader());
                    int i4 = a2.getInt(UpdateKey.STATUS);
                    CallArgs callArgs2 = i4 == 0 ? (CallArgs) a2.getParcelable("result") : null;
                    return Pair.create(Integer.valueOf(i4), callArgs2 == null ? null : callArgs2.f);
                }
            }
            str2 = str;
            CallArgs callArgs3 = new CallArgs();
            callArgs3.a = i;
            callArgs3.c = str;
            callArgs3.b = i2;
            if (clsArr != null) {
            }
            callArgs3.e = objArr;
            Bundle bundle2 = new Bundle();
            bundle2.putParcelable("args", callArgs3);
            a2 = u.a(context, str2, bundle2);
            if (a2 != null) {
            }
        } catch (Throwable unused) {
            c.a();
            return Pair.create(3, null);
        }
    }

    private static Pair<Integer, Object> b(Context context, int i, String str, Class<?>[] clsArr, Object... objArr) {
        return a(context, i, 1, str, clsArr, objArr);
    }

    /* JADX WARNING: Code restructure failed: missing block: B:31:?, code lost:
        com.baidu.techain.i.c.a();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:33:0x005c, code lost:
        return;
     */
    /* JADX WARNING: Exception block dominator not found, dom blocks: [] */
    /* JADX WARNING: Missing exception handler attribute for start block: B:30:0x0058 */
    public static synchronized void a(Context context, boolean z) {
        synchronized (d.class) {
            if (context != null) {
                int a2 = c.a(context);
                if (a2 == 0) {
                    Bundle bundle = new Bundle();
                    bundle.putBoolean("_agree_policy", z);
                    u.a(context, "setAgreePolicy", bundle);
                    return;
                }
                if (a2 == 1) {
                    if (context != null) {
                        c.a(context, ".ffnpp", z ? 0 : 1);
                        if (context != null) {
                            a a3 = a.a(context);
                            a3.d.putBoolean("s_a_pl", z);
                            if (Build.VERSION.SDK_INT >= 9) {
                                a3.d.apply();
                            } else {
                                a3.d.commit();
                            }
                        }
                    }
                    if (z && !d) {
                        d = true;
                        b(context);
                    }
                }
            }
        }
    }

    public static void a(Context context, String str) {
        if (context != null) {
            try {
                if (t.a(context)) {
                    a a2 = a.a(context);
                    a2.d.putString("s_h_d_id", str);
                    if (Build.VERSION.SDK_INT >= 9) {
                        a2.d.apply();
                    } else {
                        a2.d.commit();
                    }
                }
            } catch (Throwable unused) {
                c.a();
            }
        }
    }

    static /* synthetic */ void a(final Context context, final int i, final String str, final Callback callback, final Class[] clsArr, final Object[] objArr) {
        try {
            if (!TextUtils.isEmpty(str)) {
                v.a(context).a(new Runnable() {
                    /* class com.baidu.techain.core.d.AnonymousClass5 */

                    /*  JADX ERROR: IndexOutOfBoundsException in pass: MethodInvokeVisitor
                        java.lang.IndexOutOfBoundsException: Index: 5, Size: 5
                        	at java.util.ArrayList.rangeCheck(ArrayList.java:659)
                        	at java.util.ArrayList.get(ArrayList.java:435)
                        	at jadx.core.dex.visitors.MethodInvokeVisitor.searchCastTypes(MethodInvokeVisitor.java:267)
                        	at jadx.core.dex.visitors.MethodInvokeVisitor.processOverloaded(MethodInvokeVisitor.java:127)
                        	at jadx.core.dex.visitors.MethodInvokeVisitor.processInvoke(MethodInvokeVisitor.java:102)
                        	at jadx.core.dex.visitors.MethodInvokeVisitor.processInsn(MethodInvokeVisitor.java:73)
                        	at jadx.core.dex.visitors.MethodInvokeVisitor.visit(MethodInvokeVisitor.java:66)
                        */
                    public final void run() {
                        /*
                            r6 = this;
                            com.baidu.techain.ac.Callback r0 = r15
                            r1 = 0
                            if (r0 == 0) goto L_0x000a
                            java.lang.Object[] r2 = new java.lang.Object[r1]
                            r0.onBegin(r2)
                        L_0x000a:
                            android.content.Context r0 = r12
                            int r2 = r13
                            java.lang.String r3 = r14
                            java.lang.Class[] r4 = r16
                            java.lang.Object[] r5 = r17
                            android.util.Pair r0 = com.baidu.techain.core.d.a(r0, r2, r3, r4, r5)
                            com.baidu.techain.ac.Callback r2 = r15
                            if (r2 == 0) goto L_0x003e
                            java.lang.Object r2 = r0.first
                            java.lang.Integer r2 = (java.lang.Integer) r2
                            int r2 = r2.intValue()
                            r3 = 1
                            if (r2 == 0) goto L_0x0033
                            com.baidu.techain.ac.Callback r2 = r15
                            java.lang.Object[] r3 = new java.lang.Object[r3]
                            java.lang.Object r0 = r0.first
                            r3[r1] = r0
                            r2.onError(r3)
                            return
                        L_0x0033:
                            com.baidu.techain.ac.Callback r2 = r15
                            java.lang.Object[] r3 = new java.lang.Object[r3]
                            java.lang.Object r0 = r0.second
                            r3[r1] = r0
                            r2.onEnd(r3)
                        L_0x003e:
                            return
                        */
                        throw new UnsupportedOperationException("Method not decompiled: com.baidu.techain.core.d.AnonymousClass5.run():void");
                    }
                });
                return;
            } else if (callback != null) {
                callback.onError(1);
                return;
            } else {
                return;
            }
        } catch (Throwable unused) {
        }
        c.a();
    }
}