导航菜单

页面标题

页面副标题

050 IP Phone v2.3.0 - e.java 源代码

正在查看: 050 IP Phone v2.3.0 应用的 e.java JAVA 源代码文件

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


package k4;

import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.net.Uri;
import android.provider.ContactsContract;
import android.text.TextUtils;
import androidx.core.content.ContextCompat;
import com.oki_access.android.ims.call.provider.a;
import java.text.Collator;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.regex.Pattern;
import k4.g;
import t4.z;

public class e {
    public static String A = null;
    public static String B = null;
    public static String C = null;
    public static String D = null;
    public static String E = null;
    public static String F = null;
    public static String G = null;
    public static String H = null;
    public static String I = null;
    public static String J = null;
    public static String K = null;
    public static String L = null;
    public static String M = null;
    public static Uri N = null;
    public static Uri O = null;
    public static Uri P = null;
    public static Uri Q = null;
    public static Uri R = null;
    public static Uri S = null;
    public static Uri T = null;
    private static final String[] U;
    public static final String[] V;
    public static final String[] W;
    private static final String[] X;
    private static final String[] Y;
    private static final String[] Z;
    public static final String[] a0;
    public static Uri b = ContactsContract.Contacts.CONTENT_URI;
    public static final String[] b0;
    public static boolean c = true;
    public static final String[] c0;
    public static String d;
    private static Context d0;
    public static String e;
    private static final char[] e0;
    public static String f;
    private static final String[] f0;
    public static String g;
    private static final char[] g0;
    public static String h;
    private static final char[] h0;
    public static String i;
    public static String j;
    public static String k;
    public static String l;
    public static String m;
    public static String n;
    public static String o;
    public static String p;
    public static String q;
    public static String r;
    public static String s;
    public static String t;
    public static String u;
    public static String v;
    public static String w;
    public static String x;
    public static String y;
    public static String z;
    private StringBuffer a;

    class a implements Comparator<Object> {
        final Collator x;

        a(Collator collator) {
            this.x = collator;
        }

        @Override
        public int compare(Object obj, Object obj2) {
            String str;
            b bVar = (b) obj;
            b bVar2 = (b) obj2;
            String str2 = bVar.b;
            if ((str2 == null || str2.length() == 0) && ((str = bVar2.b) == null || str.length() == 0)) {
                return 0;
            }
            String str3 = bVar.b;
            if (str3 == null || str3.length() == 0) {
                return 1;
            }
            String str4 = bVar2.b;
            if (str4 == null || str4.length() == 0) {
                return -1;
            }
            String substring = bVar.b.substring(0, 1);
            String substring2 = bVar2.b.substring(0, 1);
            if (Pattern.matches("[ぁ-んァ-ンヲ-ン]", substring) && Pattern.matches("[ぁ-んァ-ンヲ-ン]", substring2)) {
                return this.x.compare(bVar.b, bVar2.b);
            }
            if (Pattern.matches("[ぁ-んァ-ンヲ-ン]", substring)) {
                return -1;
            }
            if (Pattern.matches("[ぁ-んァ-ンヲ-ン]", substring2)) {
                return 1;
            }
            return this.x.compare(bVar.b, bVar2.b);
        }
    }

    static class b {
        long a;
        String b;

        b() {
        }
    }

    static {
        if (b()) {
            c = true;
            d = "_id";
            e = "phone_id";
            f = "display_name";
            g = "photo_id";
            h = "contact_id";
            i = "data1";
            j = "data1";
            k = "data1";
            l = "data1";
            m = "data2";
            n = "data2";
            o = "data3";
            p = "data3";
            q = "data4";
            r = "data4";
            s = "data5";
            t = "data5";
            u = "data7";
            v = "data7";
            w = "data8";
            x = "data9";
            y = "data9";
            z = "data15";
            A = "_id";
            C = "starred";
            D = "vnd.android.cursor.item/contact";
            E = "phone";
            H = "android.provider.Contacts.SEARCH_SUGGESTION_CLICKED";
            I = "android.provider.Contacts.SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED";
            J = "android.provider.Contacts.SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED";
            K = "photo_id";
            L = "custom_ringtone";
            M = "times_contacted";
            if (a()) {
                F = "com.android.contacts.action.FILTER_CONTACTS";
                G = "phonetic_name";
                S = Uri.parse("content://com.android.contacts/contacts/lookup");
                B = "sort_key";
            } else {
                F = "android.intent.action.VIEW";
                G = "display_name";
                S = Uri.parse("content://com.android.contacts/contacts");
                B = "display_name COLLATE LOCALIZED ASC";
            }
            N = Uri.parse("content://com.android.contacts/contacts");
            O = Uri.parse("content://com.android.contacts/data");
            P = Uri.parse("content://com.android.contacts/data");
            Q = Uri.parse("content://com.android.contacts/data/phones");
            R = Uri.parse("content://com.android.contacts/phone_lookup");
            T = Uri.parse("content://com.android.contacts/contacts/strequent");
        } else {
            c = false;
            d = "_id";
            e = "phone_id";
            f = "display_name";
            g = "person";
            h = "person";
            i = "number";
            j = "company";
            k = "address";
            l = "formatted_address";
            m = "type";
            n = "given_name";
            o = "label";
            p = "family_name";
            q = "title";
            r = "street";
            s = "department";
            t = "pobox";
            u = "city";
            v = "phonetic_given_name";
            w = "region";
            x = "postcode";
            y = "phonetic_family_name";
            z = "data";
            A = "person";
            B = "display_name COLLATE LOCALIZED ASC";
            C = "starred";
            D = "vnd.android.cursor.item/person";
            E = "phone";
            F = "android.intent.action.VIEW";
            G = "phonetic_name";
            H = "android.provider.Contacts.SEARCH_SUGGESTION_CLICKED";
            I = "android.provider.Contacts.SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED";
            J = "android.provider.Contacts.SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED";
            K = "_id";
            L = "custom_ringtone";
            M = "times_contacted";
            N = Uri.parse("content://contacts/people");
            O = Uri.parse("content://contacts/photos");
            P = Uri.parse("content://contacts/phones");
            Q = Uri.parse("content://contacts/phones");
            R = Uri.parse("content://contacts/phones/filter");
            S = Uri.parse("content://contacts/people");
            T = Uri.parse("content://contacts/people/strequent");
        }
        String str = h;
        String str2 = i;
        String str3 = m;
        String str4 = o;
        String str5 = g;
        String str6 = f;
        String str7 = C;
        String str8 = G;
        U = new String[]{str, str2, str3, str4, str5, str6, str7, str8};
        String str9 = d;
        String str10 = K;
        V = new String[]{str9, str6, str8, str7, str10};
        W = new String[]{str, str6, str8, str7, str10};
        X = new String[]{str, str2, str3, str4};
        Y = new String[]{str9, str, str6, str2, str3, str4, str5};
        Z = new String[]{str9, str3, str4, q};
        a0 = new String[]{"_id", "name", "number", "typestring", "photoid"};
        b0 = new String[]{"_id", "name", "typestring", "photoid", "starred"};
        c0 = new String[]{"_id", "number", "type", "label"};
        e0 = new char[]{12449, 12450, 12451, 12452, 12453, 12454, 12455, 12456, 12457, 12458, 12459, 12460, 12461, 12462, 12463, 12464, 12465, 12466, 12467, 12468, 12469, 12470, 12471, 12472, 12473, 12474, 12475, 12476, 12477, 12478, 12479, 12480, 12481, 12482, 12483, 12484, 12485, 12486, 12487, 12488, 12489, 12490, 12491, 12492, 12493, 12494, 12495, 12496, 12497, 12498, 12499, 12500, 12501, 12502, 12503, 12504, 12505, 12506, 12507, 12508, 12509, 12510, 12511, 12512, 12513, 12514, 12515, 12516, 12517, 12518, 12519, 12520, 12521, 12522, 12523, 12524, 12525, 12526, 12527, 12528, 12529, 12530, 12531, 12532, 12533, 12534};
        f0 = new String[]{"ァ", "ア", "ィ", "イ", "ゥ", "ウ", "ェ", "エ", "ォ", "オ", "カ", "ガ", "キ", "ギ", "ク", "グ", "ケ", "ゲ", "コ", "ゴ", "サ", "ザ", "シ", "ジ", "ス", "ズ", "セ", "ゼ", "ソ", "ゾ", "タ", "ダ", "チ", "ヂ", "ッ", "ツ", "ヅ", "テ", "デ", "ト", "ド", "ナ", "ニ", "ヌ", "ネ", "ノ", "ハ", "バ", "パ", "ヒ", "ビ", "ピ", "フ", "ブ", "プ", "ヘ", "ベ", "ペ", "ホ", "ボ", "ポ", "マ", "ミ", "ム", "メ", "モ", "ャ", "ヤ", "ュ", "ユ", "ョ", "ヨ", "ラ", "リ", "ル", "レ", "ロ", "ワ", "ワ", "イ", "エ", "ヲ", "ン", "ヴ", "カ", "ケ"};
        g0 = new char[]{12530, 12449, 12451, 12453, 12455, 12457, 12515, 12517, 12519, 12483, 12540, 12450, 12452, 12454, 12456, 12458, 12459, 12461, 12463, 12465, 12467, 12469, 12471, 12473, 12475, 12477, 12479, 12481, 12484, 12486, 12488, 12490, 12491, 12492, 12493, 12494, 12495, 12498, 12501, 12504, 12507, 12510, 12511, 12512, 12513, 12514, 12516, 12518, 12520, 12521, 12522, 12523, 12524, 12525, 12527, 12531, 12443, 12444};
        h0 = new char[]{65382, 65383, 65384, 65385, 65386, 65387, 65388, 65389, 65390, 65391, 65392, 65393, 65394, 65395, 65396, 65397, 65398, 65399, 65400, 65401, 65402, 65403, 65404, 65405, 65406, 65407, 65408, 65409, 65410, 65411, 65412, 65413, 65414, 65415, 65416, 65417, 65418, 65419, 65420, 65421, 65422, 65423, 65424, 65425, 65426, 65427, 65428, 65429, 65430, 65431, 65432, 65433, 65434, 65435, 65436, 65437, 65438, 65439};
    }

    public e(Context context) {
        d0 = context;
    }

    public static android.database.Cursor A(android.database.Cursor r13) {
        throw new UnsupportedOperationException("Method not decompiled: k4.e.A(android.database.Cursor):android.database.Cursor");
    }

    private static boolean a() {
        return true;
    }

    private static boolean b() {
        return true;
    }

    public static List<Object> e(Context context, String str) {
        Cursor cursor;
        if (u(context)) {
            cursor = context.getContentResolver().query(Q, new String[]{f, d}, i + "=? OR REPLACE(REPLACE(REPLACE(REPLACE(" + i + ",'-',''),' ',''),'(',''),')','')=?", new String[]{m.g(context, str), str}, "display_name COLLATE LOCALIZED ASC");
        } else {
            cursor = null;
        }
        ArrayList arrayList = new ArrayList();
        if (cursor != null) {
            while (cursor.moveToNext()) {
                int columnIndex = cursor.getColumnIndex(f);
                int columnIndex2 = cursor.getColumnIndex(d);
                arrayList.add(cursor.getString(columnIndex));
                arrayList.add(Long.valueOf(cursor.getLong(columnIndex2)));
            }
            cursor.close();
        }
        return arrayList;
    }

    public static String f(Context context, String str) {
        Cursor cursor;
        String str2 = null;
        if (u(context)) {
            cursor = context.getContentResolver().query(Q, new String[]{f}, i + "=? OR REPLACE(REPLACE(REPLACE(REPLACE(" + i + ",'-',''),' ',''),'(',''),')','')=?", new String[]{m.g(context, str), str}, "display_name COLLATE LOCALIZED ASC");
        } else {
            cursor = null;
        }
        if (cursor != null) {
            while (cursor.moveToNext()) {
                str2 = cursor.getString(cursor.getColumnIndex(f));
            }
            cursor.close();
        }
        return str2;
    }

    public static Object[] k(Context context, String str) {
        String str2;
        int i8;
        Cursor query = context.getContentResolver().query(Q, new String[]{f, m, o}, i + "=? OR REPLACE(REPLACE(REPLACE(REPLACE(" + i + ",'-',''),' ',''),'(',''),')','')=?", new String[]{m.g(context, str), str}, "display_name COLLATE LOCALIZED ASC");
        String str3 = null;
        int i9 = -1;
        if (query != null) {
            if (query.moveToFirst()) {
                int columnIndex = query.getColumnIndex(f);
                int columnIndex2 = query.getColumnIndex(m);
                int columnIndex3 = query.getColumnIndex(o);
                str3 = query.getString(columnIndex);
                i9 = query.getInt(columnIndex2);
                str2 = query.getString(columnIndex3);
                if (str2 == null || str2.length() == 0) {
                    str2 = d0.getString(ContactsContract.CommonDataKinds.Phone.getTypeLabelResource(7));
                }
                i8 = query.getCount();
            } else {
                str2 = null;
                i8 = -1;
            }
            query.close();
        } else {
            str2 = null;
            i8 = -1;
        }
        return new Object[]{str3, Integer.valueOf(i9), str2, Integer.valueOf(i8)};
    }

    private Cursor l(String str) {
        return d0.getContentResolver().query(Q, Y, i + "=? OR REPLACE(REPLACE(REPLACE(REPLACE(" + i + ",'-',''),' ',''),'(',''),')','')=?", new String[]{m.g(d0, str), str}, "display_name COLLATE LOCALIZED ASC");
    }

    private Object[] p(String str) {
        String valueOf;
        String valueOf2;
        String valueOf3;
        String str2 = "((display_name LIKE ? OR " + G + " LIKE ?";
        ArrayList arrayList = new ArrayList();
        arrayList.add("%" + str + "%");
        arrayList.add("%" + str + "%");
        StringBuffer stringBuffer = new StringBuffer();
        if (str != null && str.length() != 0) {
            char c8 = 0;
            if (Pattern.matches("[ぁ-ん]", str.substring(0, 1))) {
                stringBuffer.delete(0, stringBuffer.length());
                stringBuffer.append(str);
                int i8 = 0;
                while (i8 < str.length()) {
                    char charAt = stringBuffer.charAt(i8);
                    int i9 = i8 + 1;
                    if (Pattern.matches("[ぁ-ん]", stringBuffer.subSequence(i8, i9))) {
                        stringBuffer.setCharAt(i8, (char) (charAt + '`'));
                    }
                    i8 = i9;
                }
                String str3 = str2 + " OR " + G + " LIKE ? OR display_name LIKE ?";
                arrayList.add("%" + stringBuffer.toString() + "%");
                arrayList.add("%" + stringBuffer.toString() + "%");
                int i10 = 0;
                String str4 = null;
                while (i10 < stringBuffer.length()) {
                    char charAt2 = stringBuffer.charAt(i10);
                    char[] cArr = e0;
                    char c9 = cArr[c8];
                    if (charAt2 < c9 || charAt2 > cArr[cArr.length - 1]) {
                        valueOf3 = str4 != null ? str4 + charAt2 : String.valueOf(charAt2);
                    } else if (str4 != null) {
                        valueOf3 = str4 + f0[charAt2 - cArr[0]];
                    } else {
                        valueOf3 = f0[charAt2 - c9];
                    }
                    str4 = valueOf3;
                    i10++;
                    c8 = 0;
                }
                str2 = str3 + " OR " + G + " LIKE ? OR display_name LIKE ?";
                arrayList.add("%" + str4 + "%");
                arrayList.add("%" + str4 + "%");
            } else if (Pattern.matches("[ァ-ン]", str.substring(0, 1)) || str.substring(0, 1).equals("ヵ") || str.substring(0, 1).equals("ヶ") || str.substring(0, 1).equals("ヴ")) {
                int i11 = 0;
                stringBuffer.delete(0, stringBuffer.length());
                stringBuffer.append(str);
                String str5 = null;
                for (int i12 = 0; i12 < stringBuffer.length(); i12++) {
                    char charAt3 = stringBuffer.charAt(i12);
                    char[] cArr2 = e0;
                    char c10 = cArr2[i11];
                    if (charAt3 >= c10) {
                        if (charAt3 <= cArr2[cArr2.length - 1]) {
                            if (str5 != null) {
                                StringBuilder sb = new StringBuilder();
                                sb.append(str5);
                                i11 = 0;
                                sb.append(f0[charAt3 - cArr2[0]]);
                                valueOf = sb.toString();
                            } else {
                                i11 = 0;
                                valueOf = f0[charAt3 - c10];
                            }
                            str5 = valueOf;
                        } else {
                            i11 = 0;
                        }
                    }
                    valueOf = str5 != null ? str5 + charAt3 : String.valueOf(charAt3);
                    str5 = valueOf;
                }
                String str6 = str2 + " OR " + G + " LIKE ? OR display_name LIKE ?";
                arrayList.add("%" + str5 + "%");
                arrayList.add("%" + str5 + "%");
                int i13 = i11;
                while (i13 < stringBuffer.length()) {
                    char charAt4 = stringBuffer.charAt(i13);
                    int i14 = i13 + 1;
                    if (Pattern.matches("[ァ-ン]", stringBuffer.substring(i13, i14))) {
                        stringBuffer.setCharAt(i13, (char) (charAt4 - '`'));
                    } else if (charAt4 == 12533) {
                        stringBuffer.setCharAt(i13, (char) 12363);
                    } else {
                        if (charAt4 == 12534) {
                            stringBuffer.setCharAt(i13, (char) 12369);
                        } else if (charAt4 == 12532) {
                            stringBuffer.setCharAt(i13, (char) 12358);
                            stringBuffer.insert(i14, (char) 12443);
                            i13 = i14;
                            i13++;
                        }
                        i13++;
                    }
                    i13++;
                }
                str2 = str6 + " OR " + G + " LIKE ? OR display_name LIKE ?";
                arrayList.add("%" + stringBuffer.toString() + "%");
                arrayList.add("%" + stringBuffer.toString() + "%");
            } else if (Pattern.matches("[ヲ-ン]", str.substring(0, 1))) {
                stringBuffer.delete(0, stringBuffer.length());
                stringBuffer.append(str);
                int i15 = 0;
                String str7 = null;
                while (i15 < stringBuffer.length()) {
                    char charAt5 = stringBuffer.charAt(i15);
                    char[] cArr3 = h0;
                    if (charAt5 < cArr3[c8] || charAt5 > cArr3[cArr3.length - 1]) {
                        valueOf2 = str7 != null ? str7 + charAt5 : String.valueOf(charAt5);
                    } else if (str7 != null) {
                        str7 = str7 + g0[charAt5 - cArr3[c8]];
                        i15++;
                        c8 = 0;
                    } else {
                        valueOf2 = "" + g0[charAt5 - cArr3[c8]];
                    }
                    str7 = valueOf2;
                    i15++;
                    c8 = 0;
                }
                String str8 = str2 + " OR " + G + " LIKE ? OR display_name LIKE ?";
                arrayList.add("%" + str7 + "%");
                arrayList.add("%" + str7 + "%");
                stringBuffer.delete(0, stringBuffer.length());
                stringBuffer.append(str7);
                int i16 = 0;
                while (i16 < stringBuffer.length()) {
                    char charAt6 = stringBuffer.charAt(i16);
                    int i17 = i16 + 1;
                    if (Pattern.matches("[ァ-ン]", stringBuffer.substring(i16, i17))) {
                        stringBuffer.setCharAt(i16, (char) (charAt6 - '`'));
                    } else if (charAt6 == 12533) {
                        stringBuffer.setCharAt(i16, (char) 12363);
                    } else if (charAt6 == 12534) {
                        stringBuffer.setCharAt(i16, (char) 12369);
                    } else if (charAt6 == 12532) {
                        stringBuffer.setCharAt(i16, (char) 12358);
                        stringBuffer.insert(i17, (char) 12443);
                        i16 = i17;
                    }
                    i16++;
                }
                str2 = str8 + " OR " + G + " LIKE ? OR display_name LIKE ?";
                arrayList.add("%" + stringBuffer.toString() + "%");
                arrayList.add("%" + stringBuffer.toString() + "%");
            } else if (Pattern.matches("[A-Za-z]", str.substring(0, 1))) {
                stringBuffer.delete(0, stringBuffer.length());
                stringBuffer.append(str);
                int i18 = 0;
                while (i18 < stringBuffer.length()) {
                    char charAt7 = stringBuffer.charAt(i18);
                    int i19 = i18 + 1;
                    if (Pattern.matches("[a-z]", str.substring(i18, i19))) {
                        stringBuffer.setCharAt(i18, (char) (charAt7 - 288));
                    } else if (Pattern.matches("[A-Z]", str.substring(i18, i19))) {
                        stringBuffer.setCharAt(i18, (char) (charAt7 - 288));
                    }
                    i18 = i19;
                }
                str2 = str2 + " OR " + G + " LIKE ? OR display_name LIKE ?";
                arrayList.add("%" + stringBuffer.toString() + "%");
                arrayList.add("%" + stringBuffer.toString() + "%");
            } else if (Pattern.matches("[A-Za-z]", str.substring(0, 1))) {
                stringBuffer.delete(0, stringBuffer.length());
                stringBuffer.append(str);
                int i20 = 0;
                while (i20 < stringBuffer.length()) {
                    char charAt8 = stringBuffer.charAt(i20);
                    int i21 = i20 + 1;
                    if (Pattern.matches("[a-z]", str.substring(i20, i21))) {
                        stringBuffer.setCharAt(i20, (char) (charAt8 - 65248));
                    } else if (Pattern.matches("[A-Z]", str.substring(i20, i21))) {
                        stringBuffer.setCharAt(i20, (char) (charAt8 - 65248));
                    }
                    i20 = i21;
                }
                str2 = str2 + " OR " + G + " LIKE ? OR display_name LIKE ?";
                arrayList.add("%" + stringBuffer.toString() + "%");
                arrayList.add("%" + stringBuffer.toString() + "%");
            }
        }
        arrayList.add("vnd.android.cursor.item/name");
        String str9 = (str2 + ") AND mimetype = ?)") + " OR (data1 LIKE ?";
        arrayList.add("%" + str + "%");
        if (str != null && str.length() != 0) {
            arrayList.add("%" + m.g(d0, str) + "%");
            StringBuilder sb2 = new StringBuilder();
            sb2.append(str9 + " OR data1 LIKE ?");
            sb2.append(" OR data1 LIKE ?");
            str9 = sb2.toString();
            arrayList.add("%" + m.h(str) + "%");
        }
        String str10 = str9 + " AND mimetype = ?)";
        arrayList.add("vnd.android.cursor.item/phone_v2");
        z.h("ContactDataStore", "selection = " + str10 + " args = " + arrayList.toString());
        return new Object[]{str10, arrayList};
    }

    private String r(String str, String str2, MatrixCursor matrixCursor, String str3, String str4) {
        String str5;
        if (str != null && str.length() != 0 && !str.equals(str2)) {
            str5 = str.substring(0, 1);
            if (Pattern.matches("[a-z]", str5)) {
                str5 = str5.toUpperCase();
            } else if (Pattern.matches("[ぁ-んァ-ンヲ-ン]", str5)) {
                StringBuffer stringBuffer = this.a;
                stringBuffer.delete(0, stringBuffer.length());
                if (Pattern.matches("[ぁ-おァ-オァ-オ]", str5)) {
                    this.a.append("あ");
                } else if (Pattern.matches("[か-ごカ-ゴカ-コ]", str5)) {
                    this.a.append("か");
                } else if (Pattern.matches("[さ-ぞサ-ゾサ-ソ]", str5)) {
                    this.a.append("さ");
                } else if (Pattern.matches("[た-どタ-ドタ-ト]", str5)) {
                    this.a.append("た");
                } else if (Pattern.matches("[な-のナ-ノナ-ノ]", str5)) {
                    this.a.append("な");
                } else if (Pattern.matches("[は-ぽハ-ポハ-ホ]", str5)) {
                    this.a.append("は");
                } else if (Pattern.matches("[ま-もマ-モマ-モ]", str5)) {
                    this.a.append("ま");
                } else if (Pattern.matches("[ゃ-よャ-ヨャ-ヨ]", str5)) {
                    this.a.append("や");
                } else if (Pattern.matches("[ら-ろラ-ロラ-ロ]", str5)) {
                    this.a.append("ら");
                } else {
                    this.a.append("わ");
                }
                str5 = this.a.substring(0);
            }
            if (!str5.equals(str4)) {
                matrixCursor.addRow(new Object[]{-1, str5, null, -1, -1});
            }
        } else if (str2 == null || str2.length() == 0) {
            str5 = "Unknown";
            if (!"Unknown".equals(str4)) {
                matrixCursor.addRow(new Object[]{-1, "Unknown", null, -1, -1});
            }
        } else if (Pattern.matches("[A-Za-zぁ-んァ-ンヲ-ン]", str2.substring(0, 1))) {
            String substring = str2.substring(0, 1);
            if (Pattern.matches("[a-z]", substring)) {
                str5 = substring.toUpperCase();
            } else if (Pattern.matches("[ぁ-んァ-ンヲ-ン]", substring)) {
                StringBuffer stringBuffer2 = this.a;
                stringBuffer2.delete(0, stringBuffer2.length());
                if (Pattern.matches("[ぁ-おァ-オァ-オ]", substring)) {
                    this.a.append("あ");
                } else if (Pattern.matches("[か-ごカ-ゴカ-コ]", substring)) {
                    this.a.append("か");
                } else if (Pattern.matches("[さ-ぞサ-ゾサ-ソ]", substring)) {
                    this.a.append("さ");
                } else if (Pattern.matches("[た-どタ-ドタ-ト]", substring)) {
                    this.a.append("た");
                } else if (Pattern.matches("[な-のナ-ノナ-ノ]", substring)) {
                    this.a.append("な");
                } else if (Pattern.matches("[は-ぽハ-ポハ-ホ]", substring)) {
                    this.a.append("は");
                } else if (Pattern.matches("[ま-もマ-モマ-モ]", substring)) {
                    this.a.append("ま");
                } else if (Pattern.matches("[ゃ-よャ-ヨャ-ヨ]", substring)) {
                    this.a.append("や");
                } else if (Pattern.matches("[ら-ろラ-ロラ-ロ]", substring)) {
                    this.a.append("ら");
                } else {
                    this.a.append("わ");
                }
                str5 = this.a.substring(0);
            } else {
                str5 = substring;
            }
            if (!str5.equals(str4)) {
                matrixCursor.addRow(new Object[]{-1, str5, null, -1, -1});
            }
        } else if (Pattern.matches("[0-90-9]", str2.substring(0, 1))) {
            str5 = "Number";
            if (!"Number".equals(str4)) {
                matrixCursor.addRow(new Object[]{-1, "Number", null, -1, -1});
            }
        } else {
            str5 = "Other";
            if (!"Other".equals(str4)) {
                matrixCursor.addRow(new Object[]{-1, "Other", null, -1, -1});
            }
        }
        return str5;
    }

    private static boolean u(Context context) {
        return ContextCompat.checkSelfPermission(context, "android.permission.READ_CONTACTS") == 0;
    }

    private Cursor z(Cursor cursor, String str) {
        MatrixCursor matrixCursor = new MatrixCursor(V);
        ContentResolver contentResolver = d0.getContentResolver();
        Uri uri = P;
        Cursor query = contentResolver.query(uri, null, "mimetype='vnd.android.cursor.item/name' AND (data1 LIKE '" + str + "%' OR data9 LIKE '" + str + "%')", null, h + " ASC");
        if (cursor != null && query != null) {
            Iterator<g.b> it = new g(cursor, new String[]{d}, query, new String[]{h}).iterator();
            while (it.hasNext()) {
                try {
                    if (it.next() == g.b.BOTH) {
                        matrixCursor.addRow(new Object[]{Long.valueOf(cursor.getLong(cursor.getColumnIndex(d))), cursor.getString(cursor.getColumnIndex(f)), cursor.getString(cursor.getColumnIndex(G)), Integer.valueOf(cursor.getInt(cursor.getColumnIndex(C))), Long.valueOf(cursor.getLong(cursor.getColumnIndex(K)))});
                    }
                } catch (Exception unused) {
                }
            }
        }
        if (query != null) {
            query.close();
        }
        if (cursor != null) {
            cursor.close();
        }
        return matrixCursor;
    }

    public Cursor B(String str) {
        String string;
        Cursor query = d0.getContentResolver().query(Q, new String[]{d, i, m, o}, h + "=?", new String[]{str}, null);
        MatrixCursor matrixCursor = new MatrixCursor(new String[]{"_id", "number", "typestring"});
        if (query != null && query.moveToFirst()) {
            do {
                String replace = query.getString(query.getColumnIndex(i)).replace("-", "");
                int columnIndex = query.getColumnIndex(m);
                int columnIndex2 = query.getColumnIndex(o);
                int i8 = query.getInt(columnIndex);
                if (i8 != 0) {
                    string = t(i8);
                } else {
                    string = query.getString(columnIndex2);
                    if (string == null || string.length() == 0) {
                        string = t(7);
                    }
                }
                matrixCursor.addRow(new Object[]{Long.valueOf(query.getLong(query.getColumnIndex(d))), w.a(replace), string});
            } while (query.moveToNext());
        }
        if (query != null) {
            query.close();
        }
        return matrixCursor;
    }

    public void C(long j8, long j9) {
        if (j8 == -1 || j9 == -1) {
            return;
        }
        ContentValues contentValues = new ContentValues();
        contentValues.put("phone_id", Long.valueOf(j9));
        d0.getContentResolver().update(a.d.x, contentValues, "phone_id=?", new String[]{String.valueOf(j8)});
    }

    public void D(long j8, String str) {
        if (j8 == -1) {
            return;
        }
        ContentValues contentValues = new ContentValues();
        contentValues.put("phone_num", str);
        d0.getContentResolver().update(a.d.x, contentValues, "phone_id=?", new String[]{String.valueOf(j8)});
    }

    public Cursor c(long j8) {
        String string;
        String string2;
        String string3;
        MatrixCursor matrixCursor = new MatrixCursor(new String[]{d, "item_type", "phone_id", i, m, C, x, w, u, r});
        Cursor query = d0.getContentResolver().query(Q, new String[]{d, h, i, m, o}, h + "=?", new String[]{String.valueOf(j8)}, null);
        int i8 = 0;
        if (query != null && query.moveToFirst()) {
            int i9 = 0;
            do {
                long j9 = query.getLong(query.getColumnIndex(d));
                String string4 = query.getString(query.getColumnIndex(i));
                int i10 = query.getInt(query.getColumnIndex(m));
                if (i10 != 0) {
                    string3 = t(i10);
                } else {
                    string3 = query.getString(query.getColumnIndex(o));
                    if (string3 == null || string3.length() == 0) {
                        string3 = t(7);
                    }
                }
                String str = string3;
                Cursor query2 = d0.getContentResolver().query(a.d.x, new String[]{"phone_id"}, "phone_id=?", new String[]{String.valueOf(j9)}, null);
                int i11 = (query2 == null || !query2.moveToFirst()) ? 0 : 1;
                if (query2 != null) {
                    query2.close();
                }
                matrixCursor.addRow(new Object[]{Integer.valueOf(i9), 1, Long.valueOf(j9), string4, str, Integer.valueOf(i11), null, null, null, null});
                i9++;
            } while (query.moveToNext());
            i8 = i9;
        }
        if (query != null) {
            query.close();
        }
        Cursor query3 = d0.getContentResolver().query(P, new String[]{d, h, k, m, o}, h + "=? AND mimetype='vnd.android.cursor.item/email_v2'", new String[]{String.valueOf(j8)}, null);
        if (query3 != null && query3.moveToFirst()) {
            do {
                long j10 = query3.getLong(query3.getColumnIndex(d));
                String string5 = query3.getString(query3.getColumnIndex(k));
                int i12 = query3.getInt(query3.getColumnIndex(m));
                if (i12 != 0) {
                    string2 = g(i12);
                } else {
                    string2 = query3.getString(query3.getColumnIndex(o));
                    if (string2 == null || string2.length() == 0) {
                        string2 = d0.getString(ContactsContract.CommonDataKinds.Email.getTypeLabelResource(3));
                    }
                }
                matrixCursor.addRow(new Object[]{Integer.valueOf(i8), 2, Long.valueOf(j10), string5, string2, -1, null, null, null, null});
                i8++;
            } while (query3.moveToNext());
        }
        if (query3 != null) {
            query3.close();
        }
        Cursor query4 = d0.getContentResolver().query(P, null, h + "=? AND mimetype='vnd.android.cursor.item/postal-address_v2'", new String[]{String.valueOf(j8)}, null);
        if (query4 != null && query4.moveToFirst()) {
            do {
                long j11 = query4.getLong(query4.getColumnIndex(d));
                StringBuilder sb = new StringBuilder();
                String string6 = query4.getString(query4.getColumnIndex(x));
                if (string6 != null) {
                    sb.append(string6);
                    if (sb.length() > 3) {
                        sb.insert(3, '-');
                    }
                }
                String string7 = query4.getString(query4.getColumnIndex(w));
                String string8 = query4.getString(query4.getColumnIndex(u));
                String string9 = query4.getString(query4.getColumnIndex(r));
                int i13 = query4.getInt(query4.getColumnIndex(m));
                if (i13 != 0) {
                    string = n(i13);
                } else {
                    string = query4.getString(query4.getColumnIndex(o));
                    if (string == null || string.length() == 0) {
                        string = d0.getString(ContactsContract.CommonDataKinds.StructuredPostal.getTypeLabelResource(3));
                    }
                }
                matrixCursor.addRow(new Object[]{Integer.valueOf(i8), 3, Long.valueOf(j11), null, string, -1, sb.toString(), string7, string8, string9});
                i8++;
            } while (query4.moveToNext());
        }
        if (query4 != null) {
            query4.close();
        }
        return matrixCursor;
    }

    public Cursor d(Uri uri) {
        return d0.getContentResolver().query(uri, null, null, null, null);
    }

    public String g(int i8) {
        return d0.getString(ContactsContract.CommonDataKinds.Email.getTypeLabelResource(i8));
    }

    public Cursor h() {
        return d0.getContentResolver().query(a.d.x, null, null, null, "_id ASC");
    }

    public Cursor i() {
        return d0.getContentResolver().query(Q, Y, "mimetype='vnd.android.cursor.item/phone_v2'", null, null);
    }

    public synchronized Cursor j() {
        MatrixCursor matrixCursor;
        Cursor cursor;
        ArrayList arrayList;
        long j8;
        String str;
        String str2;
        String str3;
        int i8;
        try {
            matrixCursor = new MatrixCursor(Y);
            ArrayList arrayList2 = new ArrayList();
            ArrayList arrayList3 = new ArrayList();
            Cursor h8 = h();
            if (h8 == null || !h8.moveToFirst()) {
                cursor = h8;
            } else {
                do {
                    arrayList2.add(Long.valueOf(h8.getLong(h8.getColumnIndex("phone_id"))));
                    arrayList3.add(h8.getString(h8.getColumnIndex("phone_num")));
                } while (h8.moveToNext());
                Cursor i9 = i();
                ArrayList arrayList4 = new ArrayList();
                arrayList4.addAll(arrayList2);
                int size = arrayList2.size();
                Object[][] objArr = new Object[size][];
                if (i9 == null || !i9.moveToFirst()) {
                    cursor = h8;
                } else {
                    while (true) {
                        long j9 = i9.getLong(i9.getColumnIndex(d));
                        int i10 = 0;
                        while (true) {
                            if (i10 >= arrayList4.size()) {
                                cursor = h8;
                                break;
                            }
                            if (((Long) arrayList4.get(i10)).longValue() == j9) {
                                long j10 = i9.getLong(i9.getColumnIndex(h));
                                String string = i9.getString(i9.getColumnIndex(f));
                                String string2 = i9.getString(i9.getColumnIndex(i));
                                int i11 = i9.getInt(i9.getColumnIndex(m));
                                cursor = h8;
                                String string3 = i9.getString(i9.getColumnIndex(o));
                                objArr[i10] = new Object[]{Long.valueOf(j9), Long.valueOf(j10), string, string2, Integer.valueOf(i11), (string3 == null || string3.length() == 0) ? t(7) : string3, i9.getString(i9.getColumnIndex(g))};
                                int indexOf = arrayList2.indexOf(Long.valueOf(j9));
                                if (!string2.equals(arrayList3.get(indexOf))) {
                                    D(j9, string2);
                                }
                                arrayList2.remove(indexOf);
                                arrayList3.remove(indexOf);
                            } else {
                                i10++;
                            }
                        }
                        if (!i9.moveToNext()) {
                            break;
                        }
                        h8 = cursor;
                    }
                }
                Iterator it = arrayList2.iterator();
                while (it.hasNext()) {
                    Long l8 = (Long) it.next();
                    long longValue = l8.longValue();
                    int indexOf2 = arrayList2.indexOf(l8);
                    int indexOf3 = arrayList4.indexOf(l8);
                    String str4 = (String) arrayList3.get(indexOf2);
                    String str5 = (String) arrayList3.get(indexOf2);
                    Cursor l9 = l(str5);
                    if (l9 == null || !l9.moveToFirst()) {
                        arrayList = arrayList2;
                        j8 = -1;
                        str = null;
                        str2 = str4;
                        str3 = "0";
                        i8 = 0;
                    } else {
                        long j11 = l9.getLong(l9.getColumnIndex(d));
                        arrayList = arrayList2;
                        j8 = l9.getLong(l9.getColumnIndex(h));
                        str2 = l9.getString(l9.getColumnIndex(f));
                        int i12 = l9.getInt(l9.getColumnIndex(m));
                        String string4 = l9.getString(l9.getColumnIndex(o));
                        String t7 = (string4 == null || string4.length() == 0) ? t(7) : string4;
                        String string5 = l9.getString(l9.getColumnIndex(g));
                        if (j11 != longValue) {
                            C(longValue, j11);
                        }
                        str3 = string5;
                        longValue = j11;
                        i8 = i12;
                        str = t7;
                    }
                    objArr[indexOf3] = new Object[]{Long.valueOf(longValue), Long.valueOf(j8), str2, str5, Integer.valueOf(i8), str, str3};
                    arrayList2 = arrayList;
                }
                for (int i13 = 0; i13 < size; i13++) {
                    Object[] objArr2 = objArr[i13];
                    if (objArr2 != null) {
                        matrixCursor.addRow(objArr2);
                    }
                }
                if (i9 != null) {
                    i9.close();
                }
            }
            if (cursor != null) {
                cursor.close();
            }
        } catch (Throwable th) {
            throw th;
        }
        return matrixCursor;
    }

    public Cursor m(long j8) {
        return d0.getContentResolver().query(P, null, "mimetype='vnd.android.cursor.item/organization' AND " + h + "=?", new String[]{String.valueOf(j8)}, null);
    }

    public String n(int i8) {
        return d0.getString(ContactsContract.CommonDataKinds.StructuredPostal.getTypeLabelResource(i8));
    }

    public Cursor o(long j8) {
        return d0.getContentResolver().query(ContactsContract.RawContacts.CONTENT_URI, null, "contact_id=?", new String[]{String.valueOf(j8)}, null);
    }

    public Cursor q(long j8) {
        return d0.getContentResolver().query(P, null, "mimetype='vnd.android.cursor.item/name' AND " + h + "=?", new String[]{String.valueOf(j8)}, null);
    }

    public String s(long j8) {
        String string;
        Cursor query = d0.getContentResolver().query(Q, U, h + "=?", new String[]{String.valueOf(j8)}, null);
        String str = null;
        if (query != null) {
            if (query.moveToFirst()) {
                boolean z7 = false;
                do {
                    int columnIndex = query.getColumnIndex(m);
                    int columnIndex2 = query.getColumnIndex(o);
                    int i8 = query.getInt(columnIndex);
                    if (!z7) {
                        if (i8 != 0) {
                            str = t(i8);
                        } else {
                            str = query.getString(columnIndex2);
                            if (str == null || str.length() == 0) {
                                str = t(7);
                            }
                        }
                        z7 = true;
                    } else {
                        if (i8 != 0) {
                            string = t(i8);
                        } else {
                            string = query.getString(columnIndex2);
                            if (string == null || string.length() == 0) {
                                string = t(7);
                            }
                        }
                        str = str + ", " + string;
                    }
                } while (query.moveToNext());
            }
            query.close();
        }
        return str;
    }

    public String t(int i8) {
        return d0.getString(ContactsContract.CommonDataKinds.Phone.getTypeLabelResource(i8));
    }

    public Cursor v(Cursor cursor, boolean z7) {
        this.a = new StringBuffer();
        MatrixCursor matrixCursor = null;
        if (cursor == null) {
            return null;
        }
        if (cursor.moveToFirst()) {
            MatrixCursor matrixCursor2 = new MatrixCursor(b0);
            String str = null;
            String str2 = null;
            do {
                long j8 = cursor.getLong(0);
                String string = cursor.getString(1);
                long j9 = cursor.getLong(4);
                String string2 = cursor.getString(2);
                int i8 = cursor.getInt(3);
                if (!z7) {
                    if (i8 == 0) {
                        break;
                    }
                } else {
                    str = r(string2, string, matrixCursor2, str, str2);
                    str2 = str;
                }
                matrixCursor2.addRow(new Object[]{Long.valueOf(j8), string, null, Long.valueOf(j9), Integer.valueOf(i8)});
            } while (cursor.moveToNext());
            matrixCursor = matrixCursor2;
        }
        cursor.close();
        return matrixCursor;
    }

    public Cursor w(ArrayList<Long> arrayList) {
        return x(arrayList, null);
    }

    public Cursor x(ArrayList<Long> arrayList, String str) {
        String str2;
        String[] strArr;
        MatrixCursor matrixCursor = new MatrixCursor(W);
        Object[] p8 = TextUtils.isEmpty(str) ? null : p(str);
        if (p8 != null) {
            String str3 = (String) p8[0];
            List list = (List) p8[1];
            String[] strArr2 = new String[list.size()];
            for (int i8 = 0; i8 < list.size(); i8++) {
                strArr2[i8] = (String) list.get(i8);
            }
            str2 = str3;
            strArr = strArr2;
        } else {
            str2 = null;
            strArr = null;
        }
        Cursor query = a() ? d0.getContentResolver().query(ContactsContract.Data.CONTENT_URI, W, str2, strArr, B) : d0.getContentResolver().query(N, V, null, null, d + " ASC");
        if (arrayList == null) {
            return query;
        }
        if (query != null) {
            if (query.moveToFirst()) {
                do {
                    long j8 = query.getLong(query.getColumnIndex("contact_id"));
                    int i9 = 0;
                    while (true) {
                        if (i9 >= arrayList.size()) {
                            break;
                        }
                        if (arrayList.get(i9).longValue() == j8) {
                            matrixCursor.addRow(new Object[]{Long.valueOf(j8), query.getString(query.getColumnIndex(f)), query.getString(query.getColumnIndex(G)), Integer.valueOf(query.getInt(query.getColumnIndex(C))), Long.valueOf(query.getLong(query.getColumnIndex(K)))});
                            break;
                        }
                        i9++;
                    }
                } while (query.moveToNext());
            }
            query.close();
        }
        return matrixCursor;
    }

    public Cursor y(Uri uri, String str) {
        String str2;
        String[] strArr;
        if (uri == null) {
            uri = ContactsContract.Data.CONTENT_URI;
        }
        Uri uri2 = uri;
        Object[] p8 = TextUtils.isEmpty(str) ? null : p(str);
        if (p8 != null) {
            String str3 = (String) p8[0];
            List list = (List) p8[1];
            String[] strArr2 = new String[list.size()];
            for (int i8 = 0; i8 < list.size(); i8++) {
                strArr2[i8] = (String) list.get(i8);
            }
            strArr = strArr2;
            str2 = str3;
        } else {
            str2 = null;
            strArr = null;
        }
        if (b()) {
            if (!a()) {
                if (str == null) {
                    return A(d0.getContentResolver().query(uri2, V, null, null, d + " ASC"));
                }
                return A(z(d0.getContentResolver().query(uri2, V, null, null, d + " ASC"), str));
            }
        } else if (Locale.getDefault().equals(Locale.JAPAN)) {
            B = "GET_PHONETICALLY_SORTABLE_STRING(CASE WHEN (phonetic_name IS NOT NULL AND phonetic_name != '') THEN phonetic_name ELSE (CASE WHEN (name is NOT NULL AND name != '')THEN name ELSE (CASE WHEN primary_email IS NOT NULL THEN (SELECT data FROM contact_methods WHERE contact_methods._id = primary_email) ELSE (CASE WHEN primary_phone IS NOT NULL THEN (SELECT number FROM phones WHERE phones._id = primary_phone) ELSE null END) END) END) END) ASC";
        } else {
            B = "display_name COLLATE LOCALIZED ASC";
        }
        return d0.getContentResolver().query(uri2, W, str2, strArr, B);
    }
}