Telegram v1.8781993528版本的 MD5 值为:999ef25d9264c747e017a12734664332

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


package net.dinglisch.android.taskerm;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.danlew.android.joda.R;
import net.dinglisch.android.taskerm.ga;
public class bg {
    private static final String f12183b = String.valueOf('{');
    private static final String f12184c = String.valueOf('}');
    private static final String f12185d = String.valueOf('[');
    private static final String f12186e = String.valueOf(']');
    private static final String f12187f = String.valueOf('(');
    private static final String g = String.valueOf(')');
    private static final String h = f12183b + f12184c + " ()";
    public static gt f12182a = new gt();
    private static final int[] i = {R.string.ml_delete};
    private static HashMap<String, String> j = new HashMap<>();
    private static Collection<?>[] k = null;
    private static final Object l = new Object();
    private static Class<?>[] m = {String.class, View.class, Bundle.class, Integer.class, Long.class, Double.class, Float.class};

    public enum a {
        Obj,
        Cls,
        Both
    }

    public static class b {
        Class<?> f12192a;
        Object f12193b;
        Object f12194c = null;
        int f12195d;
    }

    public enum d {
        Delete
    }

    public static class c {
        String f12196a = null;
        Object f12197b = null;
        boolean f12198c = false;
        boolean f12199d = false;
        boolean f12200e = false;
        String f12201f = null;
        String g = null;
        String h = null;
        boolean i = false;

        public String toString() {
            String str;
            StringBuilder sb = new StringBuilder();
            sb.append("class: ");
            sb.append(this.f12196a == null ? "???" : this.f12196a);
            sb.append(" ");
            if (this.f12201f == null) {
                str = "";
            } else {
                str = "<" + this.f12201f + ">";
            }
            sb.append(str);
            sb.append(a() ? this.g : "");
            sb.append(" obj: ");
            sb.append(this.f12197b);
            sb.append(" partWithoutMods: ");
            sb.append(this.h);
            sb.append(" static: ");
            sb.append(this.f12198c);
            sb.append(" const ");
            sb.append(this.f12199d);
            sb.append(" casted: ");
            sb.append(this.i);
            return sb.toString();
        }

        public boolean a() {
            return this.g != null;
        }

        public Class<?> a(String str) {
            bo.b("JU", "initClass: " + toString());
            if (this.f12197b != null) {
                Class<?> cls = this.f12197b.getClass();
                bo.b("JU", "initclass: " + str + ": use object class: " + cls.getName());
                return cls;
            } else if (this.f12196a == null) {
                bo.d("JU", "initClass: " + str + ": null: " + toString());
                return null;
            } else {
                StringBuilder sb = new StringBuilder();
                sb.append(this.f12196a);
                sb.append(a() ? this.g : "");
                Class<?> a2 = bg.a(sb.toString());
                bo.b("JU", "initClass: " + str + ": init with array handling -> " + a2);
                return a2;
            }
        }

        public boolean b() {
            if (a()) {
                return bg.a(bg.j(this.g));
            }
            return false;
        }
    }

    public static Class<?> a(String str) {
        String[] i2 = i(str);
        String[] g2 = g(i2[0]);
        String b2 = b(g2[0], "initWrapper");
        Class<?> a2 = bw.a(b2);
        if (a2 == null) {
            bo.d("JU", "initClassWrapper: failed for " + b2);
            return a2;
        }
        if (i2[1] != null) {
            a2 = a(a2, i2[1]);
        }
        return g2[1] != null ? b(a2, b(g2[1], "initWrapper2")) : a2;
    }

    public static boolean a(String[] strArr) {
        for (String str : strArr) {
            if (!str.equals(f12185d + f12186e)) {
                return false;
            }
        }
        return true;
    }

    public static String[] a() {
        return new String[]{"CONTEXT", "IBUFFER"};
    }

    public static boolean b(String str) {
        return gs.a(str, a());
    }

    public static Class<?>[] b() {
        return new Class[]{Context.class, Bitmap.class};
    }

    public static gt a(String str, gt gtVar) {
        return gx.o(str) ? gtVar : f12182a;
    }

    public static String c(String str) {
        if (str == null) {
            return "http://developer.android.com/reference/";
        }
        return "http://developer.android.com/reference/" + str.replace('.', '/') + ".html";
    }

    public static String a(String str, String str2) {
        if (str == null) {
            return "http://developer.android.com/reference/";
        }
        String str3 = "http://developer.android.com/reference/" + str.replace('.', '/') + ".html";
        String[] s = s(str2);
        if (s != null) {
            String[] c2 = c(s[1], false);
            for (int i2 = 0; i2 < c2.length; i2++) {
                if (Character.isUpperCase(c2[i2].charAt(0))) {
                    c2[i2] = b(c2[i2], "makeFuncRef");
                }
            }
            return str3 + "#" + s[0] + "(" + gs.a(c2, ", ") + ")";
        }
        return str3;
    }

    public static Intent d(String str) {
        return new Intent("android.intent.action.VIEW", Uri.parse(str));
    }

    public static d a(int i2) {
        return d.values()[i2];
    }

    public static String[] a(Resources resources) {
        return ct.a(resources, i);
    }

    public static boolean a(Context context) {
        String[] b2;
        synchronized (j) {
            if (j.size() == 0) {
                for (String str : b(context)) {
                    int lastIndexOf = str.lastIndexOf(36);
                    if (lastIndexOf == -1) {
                        lastIndexOf = str.lastIndexOf(46);
                    }
                    j.put(str.substring(lastIndexOf + 1, str.length()), str);
                }
                j.put(Array.class.getSimpleName(), Array.class.getName());
            }
        }
        return true;
    }

    public static String e(String str) {
        return p(f(str));
    }

    public static String f(String str) {
        if (str != null) {
            synchronized (j) {
                if (j.size() == 0) {
                    bo.d("JU", "getShortcut: class shortcuts not initialized");
                } else {
                    String[] i2 = i(str);
                    String str2 = i2[0];
                    for (Map.Entry<String, String> entry : j.entrySet()) {
                        if (entry.getValue().equals(str2)) {
                            String key = entry.getKey();
                            if (i2[1] != null) {
                                for (int i3 = 0; i3 < j(i2[1]).length; i3++) {
                                    key = key + f12185d + f12186e;
                                }
                            }
                            return key;
                        }
                    }
                }
                return str;
            }
        }
        return null;
    }

    public static synchronized String b(String str, String str2) {
        synchronized (bg.class) {
            synchronized (j) {
                if (j.size() == 0) {
                    bo.d("JU", "getAbsClass: " + str2 + ": class shortcuts not initialized");
                    return null;
                } else if (j.containsKey(str)) {
                    return j.get(str);
                } else {
                    return str;
                }
            }
        }
    }

    public static String a(String str, boolean z) {
        return a(str, "(", ")", true, false, z);
    }

    public static String[] g(String str) {
        String b2 = b(str, true);
        return b2 == null ? new String[]{str, null} : new String[]{str.replaceAll(Pattern.quote(b2), ""), b2.substring(1, b2.length() - 1)};
    }

    public static String[] h(String str) {
        String a2 = a(str, true);
        return a2 == null ? new String[]{str, null} : new String[]{str.replaceFirst(Pattern.quote(a2), "").trim(), a2.substring(1, a2.length() - 1).trim()};
    }

    public static String[] i(String str) {
        String substring;
        int indexOf = str.indexOf(91);
        String str2 = null;
        if (indexOf == -1) {
            substring = str;
        } else {
            substring = str.substring(0, indexOf);
            if (indexOf < str.length() - 1) {
                str2 = str.substring(indexOf, str.length());
            }
        }
        return new String[]{substring, str2};
    }

    public static String[] j(String str) {
        String trim = str.trim();
        LinkedList linkedList = null;
        int i2 = 0;
        while (true) {
            int indexOf = trim.indexOf(91, i2);
            if (indexOf != -1) {
                int indexOf2 = trim.indexOf(93, indexOf);
                if (indexOf2 == -1) {
                    return new String[]{trim};
                }
                if (linkedList == null) {
                    linkedList = new LinkedList();
                }
                linkedList.add(trim.substring(indexOf, indexOf2 + 1));
                i2 = indexOf2;
            } else {
                return gs.a((List<String>) linkedList);
            }
        }
    }

    public static String b(String str, boolean z) {
        return a(str, String.valueOf('<'), String.valueOf('>'), false, true, z);
    }

    public static String a(String str, String str2, String str3, boolean z, boolean z2, boolean z3) {
        String quote = Pattern.quote(str2);
        String quote2 = Pattern.quote(str3);
        StringBuilder sb = new StringBuilder();
        sb.append(z ? "^\\s*" : "");
        sb.append(quote);
        sb.append("[^");
        sb.append(quote2);
        sb.append("]+");
        sb.append(quote2);
        sb.append(z2 ? "\\s*$" : "");
        Matcher matcher = Pattern.compile(sb.toString()).matcher(str);
        if (matcher.find()) {
            String group = matcher.group();
            if (z3) {
                return matcher.group();
            }
            return group.substring(1, matcher.group().length() - 1).trim();
        }
        return null;
    }

    public static Class<?> a(Class<?> cls, String str) {
        String[] j2 = j(str);
        if (a(j2)) {
            Class<?> cls2 = cls;
            for (int i2 = 0; i2 < j2.length; i2++) {
                cls2 = Array.newInstance(cls2, 0).getClass();
            }
            return cls2;
        }
        bo.d("JU", "classToArrayClass: non-empty array indices");
        return cls;
    }

    public static void a(Context context, c cVar, List<String> list, List<Class<?>> list2, List<List<Class<?>>> list3, List<Integer> list4, HashMap<String, String> hashMap) {
        Method[] methods;
        Class<?> a2 = cVar.a("list");
        if (cVar == null || cVar.f12196a == null || !cVar.f12198c) {
            list.add("assign");
            if (a2 == null) {
                a2 = Object.class;
            }
            list2.add(a2);
            list3.add(new ArrayList<>());
            list4.add(1);
        }
        Class<?> cls = a2;
        if (cls != null) {
            if (cVar.b() && cVar.f12198c) {
                list.add("new");
                list2.add(cls);
                ArrayList arrayList = new ArrayList();
                arrayList.add(Integer.TYPE);
                list3.add(arrayList);
                list4.add(1);
                return;
            }
            if (cVar.f12198c) {
                Constructor<?>[] constructors = cls.getConstructors();
                int i2 = 0;
                for (int length = constructors.length; i2 < length; length = length) {
                    Constructor<?> constructor = constructors[i2];
                    a(list, list2, list3, list4, constructor.getName(), cls, constructor.getParameterTypes(), constructor.getModifiers());
                    i2++;
                }
            }
            for (Method method : cls.getMethods()) {
                int modifiers = method.getModifiers();
                if (Modifier.isStatic(modifiers) == cVar.f12198c) {
                    a(list, list2, list3, list4, method.getName(), method.getReturnType(), method.getParameterTypes(), modifiers);
                }
            }
        }
    }

    public static void a(Context context, c cVar, List<String> list, List<Class<?>> list2) {
        Field[] fields;
        Class<?> a2 = cVar.a("listFields");
        if (a2 != null) {
            for (Field field : a2.getFields()) {
                if (Modifier.isStatic(field.getModifiers()) == cVar.f12198c) {
                    list.add(field.getName());
                    list2.add(field.getType());
                }
            }
            if (!a2.isArray() || cVar.f12198c) {
                return;
            }
            list.add("length");
            list2.add(Integer.TYPE);
        }
    }

    private static void a(List<String> list, List<Class<?>> list2, List<List<Class<?>>> list3, List<Integer> list4, String str, Class<?> cls, Class<?>[] clsArr, int i2) {
        if (list != null) {
            list.add(str);
        }
        if (list2 != null) {
            list2.add(cls);
        }
        if (list3 != null) {
            ArrayList arrayList = new ArrayList();
            for (Class<?> cls2 : clsArr) {
                arrayList.add(cls2);
            }
            list3.add(arrayList);
        }
        if (list4 != null) {
            list4.add(Integer.valueOf(i2));
        }
    }

    public static String a(Class<?> cls) {
        if (cls.isArray()) {
            return cls.getCanonicalName();
        }
        return cls.getName();
    }

    public static String a(Class<?> cls, List<Class<?>> list, String str) {
        StringBuilder sb = new StringBuilder();
        if (cls != null) {
            String f2 = f(a(cls));
            sb.append('{');
            if (!f2.equals("void")) {
                sb.append(f2);
                if (str != null) {
                    sb.append(l(str));
                }
            }
            sb.append('}');
            sb.append(' ');
        }
        sb.append('(');
        if (list.size() > 0) {
            for (int i2 = 0; i2 < list.size(); i2++) {
                Class<?> cls2 = list.get(i2);
                if (i2 > 0) {
                    sb.append(", ");
                }
                sb.append(f(a(cls2)));
            }
        }
        sb.append(')');
        return sb.toString();
    }

    public static String[] k(String str) {
        String[] strArr = new String[2];
        if (str.startsWith(f12187f)) {
            int indexOf = str.indexOf(41);
            if (indexOf == -1) {
                strArr[1] = str.trim();
            } else {
                strArr[0] = str.substring(1, indexOf).trim();
                if (str.length() > indexOf) {
                    strArr[1] = str.substring(indexOf + 1, str.length()).trim();
                }
            }
        } else {
            strArr[1] = str.trim();
        }
        if (strArr[0] == null) {
            strArr[0] = "";
        }
        if (strArr[1] == null) {
            strArr[1] = "";
        }
        return strArr;
    }

    private static void a(Context context, c cVar, String str, Class<?> cls, Bundle bundle, String str2) {
        String d2;
        Object a2 = a(context, str, cls, bundle);
        if (a2 != null) {
            cVar.f12197b = a2;
            cVar.f12196a = a2.getClass().getName();
            return;
        }
        String a3 = gx.a(context, str, bundle, false, str2);
        if (a3 != null) {
            a3 = gx.b(context, a3, bundle, str2);
        }
        if (a3 == null || !gx.e(context, a3, bundle) || (d2 = gx.d(context, a3, bundle)) == null || cls != Uri.class) {
            return;
        }
        cVar.f12197b = Uri.parse(d2);
        cVar.f12196a = Uri.class.getName();
        cVar.f12199d = true;
    }

    public static c a(Context context, String str, a aVar, gt gtVar, Bundle bundle, Class<?> cls, HashMap<String, String> hashMap, String str2) {
        boolean z;
        boolean z2;
        String str3;
        c cVar;
        c cVar2;
        String str4;
        Object obj;
        Class<?> cls2;
        Object obj2;
        Class<?> cls3;
        Class<?> cls4;
        int i2;
        String str5;
        String str6;
        Field field;
        Object obj3;
        Class<?> a2;
        Context context2 = context;
        String str7 = str;
        Class<?> cls5 = cls;
        try {
            if (aVar != a.Obj && aVar != a.Both) {
                z = false;
                if (aVar != a.Cls && aVar != a.Both) {
                    z2 = false;
                    bo.b("JU", "analyse: " + str2 + ": " + str7 + " expected: " + cls5);
                    c cVar3 = new c();
                    if (str7 != null) {
                        return cVar3;
                    }
                    String str8 = new String(str7);
                    if (str7.equals("null")) {
                        return cVar3;
                    }
                    String[] h2 = h(str);
                    if (h2[1] != null) {
                        str3 = str8;
                        c a3 = a(context, h2[1], a.Cls, gtVar, bundle, (Class<?>) null, hashMap, str2 + "/cast");
                        if (a3 != null && a3.f12196a != null) {
                            String str9 = h2[0];
                            if (cls5 == null) {
                                Class<?> a4 = a3.a("analyse");
                                bo.b("JU", "overrid expected class to " + a4);
                                cVar2 = a3;
                                str7 = str9;
                                cls5 = a4;
                            } else {
                                cVar2 = a3;
                                str7 = str9;
                            }
                            cVar = cVar3;
                        }
                        bo.b("JU", str2 + ": failed to analyse cast class " + h2[1] + " in " + str7);
                        return cVar3;
                    }
                    str3 = str8;
                    cVar = cVar3;
                    cVar2 = null;
                    if (context2 != null) {
                        if (cls5 != null && gx.h(str7)) {
                            a(context, cVar, str7, cls5, bundle, str2);
                        }
                        if (cVar.f12196a == null) {
                            str7 = gx.a(context2, str7, false, bundle);
                        }
                    }
                    if (z2) {
                        String[] i3 = i(str7);
                        if (i3[1] != null && a(j(i3[1]))) {
                            str7 = i3[0];
                            cVar.g = i3[1];
                        }
                        String b2 = b(str7, false);
                        if (b2 != null) {
                            cVar.f12201f = b2;
                            str7 = str7.replaceAll(l(b2), "");
                        }
                        String b3 = b(str7, str2 + ": analyse");
                        if (b3 != null) {
                            str7 = b3;
                        }
                        if (cVar.f12196a == null && (a2 = bw.a(str7)) != null) {
                            cVar.f12196a = a2.getName();
                            cVar.f12198c = true;
                        }
                    }
                    if (z && cVar.f12196a == null && str7.matches("^\\S+$")) {
                        String[] split = str7.split("\\.");
                        String[] i4 = i(gs.a((Object[]) split) ? str7 : split[0].trim());
                        String str10 = i4[0];
                        String str11 = i4[1];
                        gt a5 = a(str10, gtVar);
                        if (str10.equals("CONTEXT")) {
                            boolean z3 = context2 instanceof Activity;
                            obj3 = context2;
                            if (!z3) {
                                obj3 = context.getApplicationContext();
                            }
                        } else if (str10.equals("IBUFFER")) {
                            obj3 = ExecuteService.a(false);
                        } else if (a5 != null && a5.b(str10)) {
                            Object c2 = a5.c(str10);
                            cVar.f12200e = true;
                            obj3 = c2;
                        } else {
                            if (hashMap == null || !hashMap.containsKey(str10)) {
                                obj = null;
                                cls2 = null;
                            } else {
                                cls2 = a(hashMap.get(str10));
                                obj = null;
                            }
                            if (obj != null) {
                                cls2 = obj.getClass();
                            }
                            if (cls2 != null || str11 == null) {
                                Class<?> cls6 = cls2;
                                obj2 = obj;
                                cls3 = cls6;
                            } else {
                                b a6 = a(obj, cls2, str11);
                                obj2 = a6.f12193b;
                                cls3 = a6.f12192a;
                            }
                            Object obj4 = obj2;
                            cls4 = cls3;
                            for (i2 = 1; i2 < split.length && cls4 != null; i2++) {
                                str5 = split[i2];
                                if (!cls4.isArray() && str5.equals("length")) {
                                    cls4 = Integer.TYPE;
                                    if (obj4 != null) {
                                        obj4 = Integer.valueOf(Array.getLength(obj4));
                                    }
                                } else {
                                    String[] i5 = i(str5);
                                    str6 = i5[0];
                                    String str12 = i5[1];
                                    try {
                                        field = cls4.getField(str6);
                                        field.setAccessible(true);
                                        if (field != null) {
                                            continue;
                                        } else {
                                            if (obj4 != null) {
                                                try {
                                                    obj4 = field.get(obj4);
                                                } catch (IllegalAccessException unused) {
                                                    bo.b("JU", "analyse class: field " + str6 + ": illegal access exception");
                                                    obj4 = null;
                                                }
                                            }
                                            cls4 = field.getType();
                                            if (str12 != null) {
                                                b a7 = a(obj4, cls4, str11);
                                                Class<?> cls7 = a7.f12192a;
                                                obj4 = a7.f12193b;
                                                cls4 = cls7;
                                            }
                                        }
                                    } catch (NoSuchFieldException unused2) {
                                        bo.b("JU", "analyse class: object class " + cls4 + ": no field '" + str6 + "'");
                                        cls4 = null;
                                        obj4 = null;
                                    }
                                }
                            }
                            cVar.f12197b = obj4;
                            if (cls4 != null) {
                                cVar.f12196a = cls4.getName();
                            }
                        }
                        cls2 = null;
                        obj = obj3;
                        if (obj != null) {
                        }
                        if (cls2 != null) {
                        }
                        Class<?> cls62 = cls2;
                        obj2 = obj;
                        cls3 = cls62;
                        Object obj42 = obj2;
                        cls4 = cls3;
                        while (i2 < split.length) {
                            str5 = split[i2];
                            if (!cls4.isArray()) {
                            }
                            String[] i52 = i(str5);
                            str6 = i52[0];
                            String str122 = i52[1];
                            field = cls4.getField(str6);
                            field.setAccessible(true);
                            if (field != null) {
                            }
                        }
                        cVar.f12197b = obj42;
                        if (cls4 != null) {
                        }
                    }
                    if (z && cVar.f12196a == null) {
                        a(str7, cls5, cVar);
                    }
                    a(cVar2, cVar);
                    if (cVar.f12201f != null) {
                        cVar.f12201f = b(cVar.f12201f, str2 + ": analyseTemplate");
                    }
                    if (String.class == cls5 && cVar.f12196a == null && cVar.f12197b == null) {
                        str4 = str3;
                        a(cVar, str4);
                    } else {
                        str4 = str3;
                    }
                    bo.b("JU", str2 + ": analyse done: " + str4 + ": " + cVar.toString());
                    cVar.h = str7;
                    return cVar;
                }
                z2 = true;
                bo.b("JU", "analyse: " + str2 + ": " + str7 + " expected: " + cls5);
                c cVar32 = new c();
                if (str7 != null) {
                }
            }
            z = true;
            if (aVar != a.Cls) {
                z2 = false;
                bo.b("JU", "analyse: " + str2 + ": " + str7 + " expected: " + cls5);
                c cVar322 = new c();
                if (str7 != null) {
                }
            }
            z2 = true;
            bo.b("JU", "analyse: " + str2 + ": " + str7 + " expected: " + cls5);
            c cVar3222 = new c();
            if (str7 != null) {
            }
        } catch (Exception e2) {
            bo.b("JU", "analyse", e2);
            return new c();
        }
    }

    private static void a(c cVar, c cVar2) {
        if (cVar != null) {
            cVar2.f12196a = cVar.f12196a;
            cVar2.f12201f = cVar.f12201f;
            cVar2.g = cVar.g;
            cVar2.i = true;
        }
    }

    private static b a(Object obj, Class<?> cls, String str) {
        int parseInt;
        Object obj2;
        String[] j2 = j(str);
        int i2 = 0;
        Object obj3 = null;
        int i3 = -1;
        while (i2 < j2.length) {
            String str2 = j2[i2];
            if (obj != null) {
                try {
                    parseInt = Integer.parseInt(str2.substring(1, str2.length() - 1));
                    obj2 = obj;
                    obj = Array.get(obj, parseInt);
                } catch (Exception unused) {
                    obj = null;
                }
                cls = cls.getComponentType();
                obj3 = obj2;
                i2++;
                i3 = parseInt;
            }
            parseInt = i3;
            obj2 = obj;
            cls = cls.getComponentType();
            obj3 = obj2;
            i2++;
            i3 = parseInt;
        }
        b bVar = new b();
        bVar.f12192a = cls;
        bVar.f12193b = obj;
        bVar.f12194c = obj3;
        bVar.f12195d = i3;
        return bVar;
    }

    public static String[] b(Context context) {
        String[] strArr;
        BufferedReader bufferedReader;
        BufferedReader bufferedReader2 = 0;
        try {
            try {
                bufferedReader = new BufferedReader(new InputStreamReader(context.getResources().getAssets().open("classes.txt")), 8192);
            } catch (Throwable th) {
                th = th;
            }
        } catch (IOException e2) {
            e = e2;
            strArr = null;
        }
        try {
            try {
                int parseInt = Integer.parseInt(bufferedReader.readLine());
                strArr = new String[parseInt];
                int i2 = 0;
                while (i2 < parseInt) {
                    try {
                        strArr[i2] = bufferedReader.readLine();
                        i2++;
                    } catch (IOException e3) {
                        bufferedReader2 = bufferedReader;
                        e = e3;
                        bo.b("JU", "getClassList", e);
                        gs.a((Reader) bufferedReader2);
                        bufferedReader2 = bufferedReader2;
                        return strArr;
                    }
                }
                gs.a((Reader) bufferedReader);
                bufferedReader2 = i2;
            } catch (IOException e4) {
                strArr = null;
                bufferedReader2 = bufferedReader;
                e = e4;
            }
            return strArr;
        } catch (Throwable th2) {
            bufferedReader2 = bufferedReader;
            th = th2;
            gs.a((Reader) bufferedReader2);
            throw th;
        }
    }

    public static String l(String str) {
        return String.valueOf('<') + str + '>';
    }

    public static String m(String str) {
        return String.valueOf('(') + str + ')';
    }

    public static boolean n(String str) {
        if (str == null || str.length() == 0) {
            return false;
        }
        boolean z = false;
        for (int i2 = 0; i2 < str.length(); i2++) {
            char charAt = str.charAt(i2);
            boolean isUpperCase = Character.isUpperCase(charAt);
            boolean isDigit = Character.isDigit(charAt);
            if (!isUpperCase && !Character.isLowerCase(charAt) && !isDigit && charAt != '_') {
                return false;
            }
            if (!z) {
                if (isUpperCase || isDigit) {
                    return false;
                }
                z = true;
            }
        }
        return true;
    }

    public static String a(String str, gt gtVar, Bundle bundle) {
        boolean n;
        c a2;
        int indexOf = str.indexOf(91);
        if (indexOf == -1) {
            n = n(str);
        } else {
            n = n(str.substring(0, indexOf));
        }
        return (!n || (a2 = a((Context) null, str, a.Obj, gtVar, bundle, (Class<?>) null, (HashMap<String, String>) null, "objectSpecToString")) == null || (a2.f12197b == null && !a2.f12200e) || a2.f12199d || a2.f12198c) ? str : a(a2.f12197b);
    }

    public static String a(Object obj) {
        if (obj == null) {
            return "null";
        }
        String[] b2 = b(obj);
        if (b2 == null) {
            return obj.toString();
        }
        return gs.a(b2, ",");
    }

    public static String[] b(Object obj) {
        int i2 = 0;
        if (obj.getClass().isArray()) {
            int length = Array.getLength(obj);
            String[] strArr = new String[length];
            while (i2 < length) {
                Object obj2 = Array.get(obj, i2);
                if (obj2 == null) {
                    strArr[i2] = null;
                } else {
                    strArr[i2] = obj2.toString();
                }
                i2++;
            }
            return strArr;
        } else if (b(obj.getClass()) != null) {
            Collection collection = (Collection) obj;
            String[] strArr2 = new String[collection.size()];
            for (Object obj3 : collection) {
                if (obj3 == null) {
                    strArr2[i2] = null;
                } else {
                    strArr2[i2] = obj3.toString();
                }
                i2++;
            }
            return strArr2;
        } else {
            return null;
        }
    }

    public static boolean a(Context context, String str, Class<?> cls, Object obj, gt gtVar, Bundle bundle, ft ftVar) {
        if (cls != Void.class && !TextUtils.isEmpty(str)) {
            StringBuilder sb = new StringBuilder();
            sb.append("storeJavaObject: in: ");
            sb.append(str);
            sb.append(" storeObjectNull: ");
            sb.append(obj == null);
            bo.b("JU", sb.toString());
            if (str.startsWith("%")) {
                String str2 = null;
                if (obj == null) {
                    bo.b("JU", "storeJavaObject: " + str + ": object is null, delete key");
                    gx.a(context, str, false, false, bundle);
                } else {
                    Class<?> cls2 = obj.getClass();
                    if (cls2.isArray()) {
                        gx.k(context, str, bundle);
                        gx.a("JU/getReturnedVars: ", str, obj, bundle);
                    } else if (b(cls2) != null) {
                        gx.k(context, str, bundle);
                        gx.a("JU/getReturnedVars: ", str, (Collection<?>) ((ArrayList) obj), bundle);
                    } else if (cls2 == Bundle.class) {
                        ((Bundle) obj).size();
                    } else if (cls2 == Class.class) {
                        str2 = ((Class) obj).getName();
                    } else {
                        str2 = obj.toString();
                    }
                }
                String str3 = str2;
                if (str3 != null) {
                    gx.a(context, str, str3, true, bundle, "storeJavaObject", Integer.valueOf(ftVar.ay()), new Integer[]{Integer.valueOf(ftVar.w())}, Integer.valueOf(ftVar.G()));
                }
            } else {
                String a2 = gx.a(context, str, false, false, true, false, (ga.a) null, bundle);
                if (TextUtils.isEmpty(a2)) {
                    return false;
                }
                String[] i2 = i(h(a2)[0]);
                String str4 = i2[0];
                String str5 = i2[1];
                if (n(str4)) {
                    gt a3 = a(str4, gtVar);
                    if (TextUtils.isEmpty(str5)) {
                        a3.a(str4, obj);
                    } else if (a3.b(str4)) {
                        Object c2 = a3.c(str4);
                        if (c2.getClass().isArray()) {
                            b a4 = a(c2, c2.getClass(), str5);
                            try {
                                Array.set(a4.f12194c, a4.f12195d, obj);
                            } catch (IllegalArgumentException unused) {
                                bo.b("JU", "illegal argument, try storing as string, return class: " + cls);
                                if (cls != String.class) {
                                    return false;
                                }
                                Array.set(a4.f12194c, a4.f12195d, String.valueOf(obj));
                            } catch (Exception e2) {
                                bo.a("JU", "storeJavaObject: " + str4 + " index " + a4.f12195d, e2);
                                return false;
                            }
                        } else {
                            bo.d("JU", "storeJavaObject: " + str4 + "[" + str5 + "], existing object isn't array, it's a " + c2.getClass().getName());
                            return false;
                        }
                    } else {
                        bo.d("JU", "storeJavaObject: " + str4 + "[" + str5 + "], object doesn't exist");
                        return false;
                    }
                } else {
                    bo.d("JU", "storeJavaObject: bad object name: " + str4);
                    return false;
                }
            }
        }
        return true;
    }

    public static Class<?>[] o(String str) {
        String[] c2 = c(str, true);
        if (c2 != null) {
            Class<?>[] clsArr = new Class[c2.length];
            for (int i2 = 0; i2 < c2.length; i2++) {
                clsArr[i2] = a(c2[i2]);
                if (clsArr[i2] == null) {
                    bo.d("JU", "failed to init param class " + c2[i2]);
                    return null;
                }
            }
            return clsArr;
        }
        return null;
    }

    public static String[] c(String str, boolean z) {
        String trim = str.trim();
        int indexOf = trim.indexOf(40);
        if (indexOf == -1) {
            return new String[0];
        }
        if (indexOf == trim.length()) {
            bo.d("JU", "fspc: opening bracket at end");
        } else {
            int indexOf2 = trim.indexOf(41);
            if (indexOf2 != -1 && indexOf2 >= indexOf) {
                String trim2 = trim.substring(indexOf + 1, indexOf2).trim();
                if (trim2.length() == 0) {
                    return new String[0];
                }
                String[] split = trim2.split("[\\s,]+");
                if (split == null) {
                    split = new String[]{trim2};
                }
                String[] strArr = split;
                if (z) {
                    for (int i2 = 0; i2 < strArr.length; i2++) {
                        strArr[i2] = b(strArr[i2], "funcSigToParam");
                    }
                    return strArr;
                }
                return strArr;
            }
            bo.d("JU", "bad sig endIndex in " + trim);
        }
        return null;
    }

    public static String p(String str) {
        return '(' + str + ')';
    }

    public static String q(String str) {
        return '{' + str + '}';
    }

    public static String d(String str, boolean z) {
        String trim = str.trim();
        if (trim.startsWith(f12183b)) {
            int indexOf = trim.indexOf(125);
            if (indexOf == -1) {
                bo.d("JU", "bad sig in " + trim);
            } else {
                String trim2 = trim.substring(1, indexOf).trim();
                if (trim2.length() > 0) {
                    return z ? b(trim2, "funcSigToRet") : trim2;
                }
                return Void.class.getName();
            }
        }
        return null;
    }

    public static String[] r(String str) {
        String[] s = s(str);
        if (s != null) {
            return c(s[1], false);
        }
        return null;
    }

    public static String[] s(String str) {
        String str2;
        String str3;
        String trim = str.trim();
        int indexOf = trim.indexOf(10);
        if (indexOf == -1) {
            indexOf = trim.indexOf(9);
        }
        if (indexOf == -1) {
            indexOf = trim.indexOf(32);
        }
        if (indexOf != -1) {
            str3 = trim.substring(0, indexOf).trim();
            str2 = indexOf <= trim.length() ? trim.substring(indexOf + 1, trim.length()).trim() : null;
        } else {
            str2 = null;
            str3 = null;
        }
        if (str3 != null) {
            if (TextUtils.isEmpty(str2)) {
                str2 = h;
            }
            return new String[]{str3, str2};
        }
        return null;
    }

    public static boolean t(String str) {
        return (TextUtils.isEmpty(str) || str.equals(Void.class.getName())) ? false : true;
    }

    public static HashMap<String, String> b(String[] strArr) {
        if (strArr != null) {
            HashMap<String, String> hashMap = new HashMap<>();
            for (String str : strArr) {
                String[] split = str.split("\n");
                hashMap.put(split[0].trim(), split[1]);
            }
            return hashMap;
        }
        return null;
    }

    public static String[] a(HashMap<String, String> hashMap) {
        String[] strArr = new String[hashMap.size()];
        int i2 = 0;
        for (Map.Entry<String, String> entry : hashMap.entrySet()) {
            String value = entry.getValue();
            int i3 = i2 + 1;
            StringBuilder sb = new StringBuilder();
            sb.append(entry.getKey());
            sb.append("\n");
            if (value == null || value.equals(Void.class.getName())) {
                value = "?";
            }
            sb.append(value);
            strArr[i2] = sb.toString();
            i2 = i3;
        }
        return strArr;
    }

    private static void c() {
        k = null;
    }

    private static void d() {
        if (k == null) {
            k = new Collection[]{new ArrayList(), new ArrayList(), new ArrayList(), new ArrayList(), new ArrayList(), new ArrayList(), new ArrayList()};
        }
    }

    public static Class<?> b(Class<?> cls) {
        synchronized (l) {
            d();
            for (int i2 = 0; i2 < k.length; i2++) {
                if (k[i2].getClass() == cls) {
                    return m[i2];
                }
            }
            return null;
        }
    }

    public static Object c(Class<?> cls) {
        Collection<?>[] collectionArr;
        synchronized (l) {
            d();
            for (Collection<?> collection : k) {
                if (collection.getClass() == cls) {
                    c();
                    return collection;
                }
            }
            return null;
        }
    }

    public static Class<?> b(Class<?> cls, String str) {
        Class<?> cls2;
        synchronized (l) {
            d();
            if (str != null) {
                bo.b("JU", "classToTemplate: base: " + cls + " templateClass: " + str);
                for (int i2 = 0; i2 < k.length; i2++) {
                    if (str.equals(m[i2].getName())) {
                        cls2 = k[i2].getClass();
                        break;
                    }
                }
            }
            cls2 = null;
        }
        return cls2;
    }

    public static Object a(String str, Class<?> cls, c cVar) {
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        if (cVar == null) {
            cVar = new c();
        }
        int i2 = 0;
        if (Boolean.class == cls || Boolean.TYPE == cls || str.equals(String.valueOf(Boolean.FALSE.booleanValue())) || str.equals(String.valueOf(Boolean.TRUE.booleanValue()))) {
            cVar.f12196a = Boolean.TYPE.getName();
            cVar.f12197b = Boolean.valueOf(Boolean.parseBoolean(str));
            cVar.f12199d = true;
        } else if (Long.class == cls || Long.TYPE == cls || str.endsWith("L")) {
            Long e2 = gs.e(str.endsWith("L") ? str.substring(0, str.length() - 1) : str);
            if (e2 != null) {
                cVar.f12196a = Long.TYPE.getName();
                cVar.f12197b = e2;
                cVar.f12199d = true;
            }
        } else if (Double.class == cls || Double.TYPE == cls || str.endsWith("D")) {
            Double g2 = gs.g(str.endsWith("D") ? str.substring(0, str.length() - 1) : str);
            if (g2 != null) {
                cVar.f12196a = Double.TYPE.getName();
                cVar.f12197b = g2;
                cVar.f12199d = true;
            }
        } else if (Float.class == cls || Float.TYPE == cls || str.endsWith("F")) {
            Float f2 = gs.f(str.endsWith("F") ? str.substring(0, str.length() - 1) : str);
            if (f2 != null) {
                cVar.f12196a = Float.TYPE.getName();
                cVar.f12197b = f2;
                cVar.f12199d = true;
            }
        }
        if (cVar.f12196a == null) {
            Integer c2 = gs.c(str);
            if (c2 != null) {
                cVar.f12196a = Integer.TYPE.getName();
                cVar.f12197b = c2;
                cVar.f12199d = true;
            } else {
                Long e3 = gs.e(str);
                if (e3 != null) {
                    cVar.f12196a = Long.TYPE.getName();
                    cVar.f12197b = e3;
                    cVar.f12199d = true;
                } else {
                    Float f3 = gs.f(str);
                    if (f3 != null) {
                        cVar.f12196a = Float.TYPE.getName();
                        cVar.f12197b = f3;
                        cVar.f12199d = true;
                    } else {
                        Double g3 = gs.g(str);
                        if (g3 != null) {
                            cVar.f12196a = Double.TYPE.getName();
                            cVar.f12197b = g3;
                            cVar.f12199d = true;
                        }
                    }
                }
            }
        }
        boolean z = str.startsWith("\"") && str.endsWith("\"");
        if (String.class == cls || z) {
            if (z) {
                str = str.substring(1, str.length() - 1);
            }
            a(cVar, str);
        } else {
            if (str.length() == 3 && str.charAt(0) == '\'' && str.charAt(2) == '\'') {
                i2 = 1;
            }
            if ((Character.class == cls && str.length() == 1) || i2 != 0) {
                cVar.f12196a = Character.class.getName();
                cVar.f12197b = new Character(str.charAt(i2));
                cVar.f12199d = true;
            }
        }
        return cVar.f12197b;
    }

    public static Object a(Context context, String str, Class<?> cls, Bundle bundle) {
        if (cls.isArray()) {
            Class<?> componentType = cls.getComponentType();
            List<String> a2 = a(context, str, bundle);
            Object newInstance = Array.newInstance(componentType, a2.size());
            int i2 = 0;
            for (String str2 : a2) {
                Array.set(newInstance, i2, a(str2, componentType, (c) null));
                i2++;
            }
            return newInstance;
        } else if (b(cls) != null) {
            List<String> a3 = a(context, str, bundle);
            Object c2 = c(cls);
            ((Collection) c2).addAll(a3);
            return c2;
        } else {
            return null;
        }
    }

    private static List<String> a(Context context, String str, Bundle bundle) {
        List<String> i2 = gx.i(context, str, bundle);
        if (i2.size() == 0 && gx.e(context, str, bundle)) {
            i2.add(gx.d(context, str, bundle));
        }
        return i2;
    }

    private static void a(c cVar, String str) {
        cVar.f12196a = String.class.getName();
        cVar.f12197b = new String(str);
        cVar.f12199d = true;
    }

    public static boolean u(String str) {
        String[] s = s(str);
        if (s != null) {
            String[] c2 = c(s[1], false);
            String d2 = d(s[1], false);
            if (c2 != null && d2 != null) {
                return true;
            }
        }
        return false;
    }
}