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


package com.baidu.techain.i;

import android.content.ContentProviderClient;
import android.content.ContentResolver;
import android.content.Context;
import android.content.pm.ProviderInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Base64;

/* compiled from: ProviderAccessUtil */
public final class u {
    private static final String[] a = {"On7h9W1_KIkIa50wk9Fnl1friw1cdOsubmr_O-Hrgss=", "73Ry_SRX9WDHPoeAkGWfJbuntGR7RQ3rde1s6KyyCoo=", "iQirV45vitYDQfzxgr68ylBY1DWLBKje2Pl428sE27Q=", "czwe2zUrt14MfnaeH474T5prOCIik3agOnBud_KwFa0=", "JzLix2JtXzSSsVkQFD0Cnf37028Rco5rGb7_-t_C8Qk=", "lUApGLCwwTIqYrpC4ZaqkVItjc8DeoJ5fB_pxizrjnc=", "6PzPHS4JINi0q8yUj180JTMbpq1Q44DuQggknxVmVPA=", "fCbyLrInjq1BOByP4wH4mUGBidquiIKIy6zcJCBuKtk=", "qEeaB7chq_oSIUyWhq_EwETFQIu3w3myIFyGD80p_u8=", "UNzyljxPfmKANfePasqvdfmpLS4aJ1v0S1Aj2BGl75o="};

    public static Bundle a(Context context, String str, Bundle bundle) {
        return a(context, str, bundle, "techain");
    }

    /* JADX WARNING: Failed to process nested try/catch */
    /* JADX WARNING: Missing exception handler attribute for start block: B:3:0x0012 */
    public static Bundle a(Context context, String str, Bundle bundle, boolean z, String str2, boolean z2) {
        String str3;
        ProviderInfo[] providerInfoArr = context.getPackageManager().getPackageInfo(context.getPackageName(), 8).providers;
        try {
            c.a();
            providerInfoArr = null;
            if (providerInfoArr != null) {
                if (providerInfoArr.length > 0) {
                    boolean z3 = false;
                    for (String str4 : a) {
                        try {
                            str3 = new String(g.b("30212102dicudiab".getBytes(), Base64.decode(str4, 10)), "UTF-8");
                        } catch (Throwable unused) {
                            c.a();
                            str3 = null;
                        }
                        if (!TextUtils.isEmpty(str3)) {
                            if ("techain".equals(str3)) {
                                if (!z) {
                                    return null;
                                }
                                z3 = true;
                            }
                            StringBuilder sb = new StringBuilder("content://");
                            sb.append(context.getPackageName());
                            sb.append(".");
                            sb.append(str3);
                            sb.append(".ac.provider");
                            String sb2 = sb.toString();
                            for (ProviderInfo providerInfo : providerInfoArr) {
                                if (sb2.contains(providerInfo.authority)) {
                                    Bundle a2 = a(context, str, bundle, Uri.parse(sb.toString()));
                                    if (z2) {
                                        boolean z4 = a2.getBoolean("handle_flag");
                                        String string = a2.getString("server_version");
                                        if (z4) {
                                            if (!a(string, str2)) {
                                            }
                                        }
                                    }
                                    return a2;
                                }
                            }
                            if (z3) {
                                break;
                            }
                        }
                    }
                    return null;
                }
            }
            return null;
        } catch (Throwable unused2) {
            c.a();
        }
    }

    public static Bundle a(Context context, String str, Bundle bundle, String str2) {
        try {
            context.getApplicationContext().getContentResolver();
            return a(context, str, bundle, Uri.parse("content://" + context.getPackageName() + "." + str2 + ".ac.provider"));
        } catch (Throwable unused) {
            c.a();
            return null;
        }
    }

    /* JADX WARNING: Code restructure failed: missing block: B:19:?, code lost:
        com.baidu.techain.i.c.a();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:24:0x0035, code lost:
        r3.close();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:25:0x0038, code lost:
        return null;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:26:0x0039, code lost:
        r4 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:27:0x003a, code lost:
        if (r3 != null) goto L_0x003c;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:29:0x003e, code lost:
        if (android.os.Build.VERSION.SDK_INT < 24) goto L_0x0040;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:30:0x0040, code lost:
        r3.release();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:31:0x0044, code lost:
        r3.close();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:32:0x0047, code lost:
        throw r4;
     */
    /* JADX WARNING: Failed to process nested try/catch */
    /* JADX WARNING: Missing exception handler attribute for start block: B:18:0x0028 */
    private static Bundle a(Context context, String str, Bundle bundle, Uri uri) {
        ContentProviderClient contentProviderClient;
        try {
            ContentResolver contentResolver = context.getApplicationContext().getContentResolver();
            if (Build.VERSION.SDK_INT < 17) {
                return contentResolver.call(uri, str, (String) null, bundle);
            }
            try {
                contentProviderClient = contentResolver.acquireUnstableContentProviderClient(uri);
                Bundle call = contentProviderClient.call(str, null, bundle);
                if (contentProviderClient != null) {
                    if (Build.VERSION.SDK_INT < 24) {
                        contentProviderClient.release();
                    } else {
                        contentProviderClient.close();
                    }
                }
                return call;
            } catch (Throwable unused) {
                contentProviderClient = null;
            }
        } catch (Throwable unused2) {
            c.a();
            return null;
        }
    }

    private static boolean a(String str, String str2) {
        try {
            if (str.equals(str2)) {
                return true;
            }
            String[] split = str.split("\\.");
            String[] split2 = str2.split("\\.");
            int i = 0;
            while (i < split.length && i < split2.length) {
                int intValue = Integer.valueOf(split[i]).intValue() - Integer.valueOf(split2[i]).intValue();
                if (intValue != 0) {
                    return intValue > 0;
                }
                i++;
            }
            return split.length > split2.length;
        } catch (Throwable unused) {
        }
    }
}