APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:Caller ID
版本号:1.8.3
包名称:com.callerid.block

MD5 校验值:5ef3f775189f42f146cf0788a99eebd7

反编译源代码说明

r1.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package y3;

import android.R;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.LocaleList;
import android.provider.Contacts;
import android.provider.ContactsContract;
import android.provider.Settings;
import android.telecom.TelecomManager;
import android.telephony.TelephonyManager;
import android.text.Spannable;
import android.text.TextUtils;
import android.text.style.URLSpan;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.android.internal.telephony.ITelephony;
import com.callerid.block.bean.EZBlackList;
import com.callerid.block.main.EZCallApplication;
import com.callerid.block.util.URLSpanNoUnderline;
import com.rey.material.app.Dialog;
import java.lang.reflect.Method;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Enumeration;
import java.util.Locale;
import java.util.UUID;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;

public class r1 {

    public static boolean f34805a = false;

    public static boolean f34806b = false;

    public static boolean f34807c;

    public static boolean f34808d;

    public static int A() {
        return Build.VERSION.SDK_INT >= 31 ? 201326592 : 134217728;
    }

    public static String B() {
        return Build.MODEL;
    }

    public static Context C(Context context, String str) {
        String str2;
        Configuration configuration;
        Context context2;
        Configuration configuration2;
        Locale locale;
        Resources resources = context.getResources();
        Configuration configuration3 = resources.getConfiguration();
        resources.getDisplayMetrics();
        str.hashCode();
        String str3 = "hi";
        String str4 = "gu";
        String str5 = "fr";
        String str6 = "es";
        String str7 = "de";
        String str8 = "cs";
        String str9 = "bn";
        switch (str.hashCode()) {
            case 3116:
                str2 = "ar";
                if (str.equals("am")) {
                    r25 = 0;
                    break;
                }
                break;
            case 3121:
                str2 = "ar";
                if (str.equals(str2)) {
                    r25 = 1;
                    break;
                }
                break;
            case 3148:
                r25 = str.equals(str9) ? (char) 2 : (char) 65535;
                str9 = str9;
                str2 = "ar";
                break;
            case 3184:
                r25 = str.equals(str8) ? (char) 3 : (char) 65535;
                str8 = str8;
                str2 = "ar";
                break;
            case 3201:
                r25 = str.equals(str7) ? (char) 4 : (char) 65535;
                str7 = str7;
                str2 = "ar";
                break;
            case 3241:
                if (str.equals("en")) {
                    r25 = 5;
                }
                str2 = "ar";
                break;
            case 3246:
                r25 = str.equals(str6) ? (char) 6 : (char) 65535;
                str6 = str6;
                str2 = "ar";
                break;
            case 3276:
                r25 = str.equals(str5) ? (char) 7 : (char) 65535;
                str5 = str5;
                str2 = "ar";
                break;
            case 3310:
                r25 = str.equals(str4) ? '\b' : (char) 65535;
                str4 = str4;
                str2 = "ar";
                break;
            case 3329:
                r25 = str.equals(str3) ? '\t' : (char) 65535;
                str3 = str3;
                str2 = "ar";
                break;
            case 3365:
                if (str.equals("in")) {
                    r25 = '\n';
                }
                str2 = "ar";
                break;
            case 3371:
                if (str.equals("it")) {
                    r25 = 11;
                }
                str2 = "ar";
                break;
            case 3374:
                if (str.equals("iw")) {
                    r25 = '\f';
                }
                str2 = "ar";
                break;
            case 3427:
                if (str.equals("kn")) {
                    r25 = '\r';
                }
                str2 = "ar";
                break;
            case 3487:
                if (str.equals("ml")) {
                    r25 = 14;
                }
                str2 = "ar";
                break;
            case 3493:
                if (str.equals("mr")) {
                    r25 = 15;
                }
                str2 = "ar";
                break;
            case 3494:
                if (str.equals("ms")) {
                    r25 = 16;
                }
                str2 = "ar";
                break;
            case 3569:
                if (str.equals("pa")) {
                    r25 = 17;
                }
                str2 = "ar";
                break;
            case 3588:
                if (str.equals("pt")) {
                    r25 = 18;
                }
                str2 = "ar";
                break;
            case 3651:
                if (str.equals("ru")) {
                    r25 = 19;
                }
                str2 = "ar";
                break;
            case 3693:
                if (str.equals("ta")) {
                    r25 = 20;
                }
                str2 = "ar";
                break;
            case 3697:
                if (str.equals("te")) {
                    r25 = 21;
                }
                str2 = "ar";
                break;
            case 3700:
                if (str.equals("th")) {
                    r25 = 22;
                }
                str2 = "ar";
                break;
            case 3710:
                if (str.equals("tr")) {
                    r25 = 23;
                }
                str2 = "ar";
                break;
            case 3741:
                if (str.equals("ur")) {
                    r25 = 24;
                }
                str2 = "ar";
                break;
            case 3763:
                if (str.equals("vi")) {
                    r25 = 25;
                }
                str2 = "ar";
                break;
            default:
                str2 = "ar";
                break;
        }
        switch (r25) {
            case 0:
                configuration = configuration3;
                configuration.setLocale(new Locale("am"));
                context2 = context;
                break;
            case 1:
                configuration2 = configuration3;
                locale = new Locale(str2);
                configuration2.setLocale(locale);
                context2 = context;
                configuration = configuration2;
                break;
            case 2:
                configuration2 = configuration3;
                locale = new Locale(str9);
                configuration2.setLocale(locale);
                context2 = context;
                configuration = configuration2;
                break;
            case 3:
                configuration2 = configuration3;
                locale = new Locale(str8);
                configuration2.setLocale(locale);
                context2 = context;
                configuration = configuration2;
                break;
            case 4:
                configuration2 = configuration3;
                locale = new Locale(str7);
                configuration2.setLocale(locale);
                context2 = context;
                configuration = configuration2;
                break;
            case 5:
                configuration2 = configuration3;
                locale = Locale.US;
                configuration2.setLocale(locale);
                context2 = context;
                configuration = configuration2;
                break;
            case 6:
                configuration2 = configuration3;
                locale = new Locale(str6);
                configuration2.setLocale(locale);
                context2 = context;
                configuration = configuration2;
                break;
            case 7:
                configuration2 = configuration3;
                locale = new Locale(str5);
                configuration2.setLocale(locale);
                context2 = context;
                configuration = configuration2;
                break;
            case '\b':
                configuration2 = configuration3;
                locale = new Locale(str4);
                configuration2.setLocale(locale);
                context2 = context;
                configuration = configuration2;
                break;
            case '\t':
                configuration2 = configuration3;
                locale = new Locale(str3);
                configuration2.setLocale(locale);
                context2 = context;
                configuration = configuration2;
                break;
            case '\n':
                configuration2 = configuration3;
                locale = new Locale("in");
                configuration2.setLocale(locale);
                context2 = context;
                configuration = configuration2;
                break;
            case 11:
                configuration2 = configuration3;
                locale = new Locale("it");
                configuration2.setLocale(locale);
                context2 = context;
                configuration = configuration2;
                break;
            case '\f':
                configuration2 = configuration3;
                locale = new Locale("iw");
                configuration2.setLocale(locale);
                context2 = context;
                configuration = configuration2;
                break;
            case '\r':
                configuration2 = configuration3;
                locale = new Locale("kn");
                configuration2.setLocale(locale);
                context2 = context;
                configuration = configuration2;
                break;
            case 14:
                configuration2 = configuration3;
                locale = new Locale("ml");
                configuration2.setLocale(locale);
                context2 = context;
                configuration = configuration2;
                break;
            case 15:
                configuration2 = configuration3;
                locale = new Locale("mr");
                configuration2.setLocale(locale);
                context2 = context;
                configuration = configuration2;
                break;
            case 16:
                configuration2 = configuration3;
                locale = new Locale("ms");
                configuration2.setLocale(locale);
                context2 = context;
                configuration = configuration2;
                break;
            case 17:
                configuration2 = configuration3;
                locale = new Locale("pa");
                configuration2.setLocale(locale);
                context2 = context;
                configuration = configuration2;
                break;
            case 18:
                configuration2 = configuration3;
                locale = new Locale("pt");
                configuration2.setLocale(locale);
                context2 = context;
                configuration = configuration2;
                break;
            case 19:
                configuration2 = configuration3;
                locale = new Locale("ru");
                configuration2.setLocale(locale);
                context2 = context;
                configuration = configuration2;
                break;
            case 20:
                configuration2 = configuration3;
                locale = new Locale("ta");
                configuration2.setLocale(locale);
                context2 = context;
                configuration = configuration2;
                break;
            case 21:
                configuration2 = configuration3;
                locale = new Locale("te");
                configuration2.setLocale(locale);
                context2 = context;
                configuration = configuration2;
                break;
            case 22:
                configuration2 = configuration3;
                locale = new Locale("th");
                configuration2.setLocale(locale);
                context2 = context;
                configuration = configuration2;
                break;
            case 23:
                configuration2 = configuration3;
                locale = new Locale("tr");
                configuration2.setLocale(locale);
                context2 = context;
                configuration = configuration2;
                break;
            case 24:
                configuration2 = configuration3;
                locale = new Locale("ur");
                configuration2.setLocale(locale);
                context2 = context;
                configuration = configuration2;
                break;
            case 25:
                locale = new Locale("vi");
                configuration2 = configuration3;
                configuration2.setLocale(locale);
                context2 = context;
                configuration = configuration2;
                break;
            default:
                context2 = context;
                configuration = configuration3;
                break;
        }
        return context2.createConfigurationContext(configuration);
    }

    public static String D(Context context, String str) {
        try {
            return com.android.boom.w.s(context, String.valueOf((System.currentTimeMillis() / 1000) - c1.J(context)), str);
        } catch (Throwable th) {
            th.printStackTrace();
            return "";
        }
    }

    public static String E(Context context) {
        try {
            return com.android.boom.w.s(context, String.valueOf((System.currentTimeMillis() / 1000) - c1.J(context)), H(context));
        } catch (Throwable th) {
            th.printStackTrace();
            return "";
        }
    }

    public static String F() {
        return Build.VERSION.RELEASE;
    }

    public static boolean G(String str) {
        return (str == null || "".equals(str) || Integer.parseInt(J(EZCallApplication.d()).replaceAll("\\.", "")) >= Integer.parseInt(str.replaceAll("\\.", ""))) ? false : true;
    }

    public static String H(Context context) {
        String str;
        String str2;
        String uuid;
        String str3 = "";
        try {
            int i10 = Build.VERSION.SDK_INT;
            if (i10 >= 31) {
                String I = I();
                String string = Settings.Secure.getString(context.getContentResolver(), "android_id");
                uuid = I + ("".equals(string) ? "uniqueId" : string);
            } else if (i10 >= 29) {
                String I2 = I();
                String o10 = o(context);
                String str4 = "" + Settings.Secure.getString(context.getContentResolver(), "android_id");
                if (Y(context)) {
                    o10 = str4;
                }
                uuid = I2 + o10;
            } else {
                if (!a4.d.d(context, "android.permission.READ_PHONE_STATE")) {
                    return "";
                }
                TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService("phone");
                if (telephonyManager != null) {
                    str = "" + telephonyManager.getDeviceId();
                    str2 = "" + telephonyManager.getSimSerialNumber();
                } else {
                    str = null;
                    str2 = null;
                }
                String str5 = "" + Settings.Secure.getString(context.getContentResolver(), "android_id");
                if (str == null) {
                    return "";
                }
                uuid = new UUID(str5.hashCode(), str2.hashCode() | (str.hashCode() << 32)).toString();
            }
            str3 = b0.b(uuid);
            return str3;
        } catch (Exception e10) {
            if (a0.f34733a) {
                a0.a("tony", "Exception:" + e10.getMessage());
            }
            e10.printStackTrace();
            return str3;
        }
    }

    private static String I() {
        return "35" + (Build.BOARD.length() % 10) + (Build.BRAND.length() % 10) + (Build.CPU_ABI.length() % 10) + (Build.DEVICE.length() % 10) + (Build.DISPLAY.length() % 10) + (Build.HOST.length() % 10) + (Build.ID.length() % 10) + (Build.MANUFACTURER.length() % 10) + (Build.MODEL.length() % 10) + (Build.PRODUCT.length() % 10) + (Build.TAGS.length() % 10) + (Build.TYPE.length() % 10) + (Build.USER.length() % 10);
    }

    public static String J(Context context) {
        try {
            return context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName;
        } catch (Exception e10) {
            e10.printStackTrace();
            return null;
        }
    }

    public static boolean K(Context context, String str) {
        Cursor cursor;
        boolean z10 = false;
        try {
            if (a4.d.d(context, "android.permission.READ_CONTACTS")) {
                ContentResolver contentResolver = context.getContentResolver();
                String[] strArr = {EZBlackList.ID, "display_name"};
                try {
                    cursor = contentResolver.query(Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(str)), strArr, null, null, null);
                } catch (Exception e10) {
                    e10.printStackTrace();
                    try {
                        cursor = contentResolver.query(Uri.withAppendedPath(Contacts.Phones.CONTENT_FILTER_URL, Uri.encode(str)), strArr, null, null, null);
                    } catch (Exception e11) {
                        e11.printStackTrace();
                        cursor = null;
                    }
                }
                if (cursor != null && cursor.getCount() > 0 && cursor.moveToFirst()) {
                    z10 = true;
                }
                if (cursor != null) {
                    cursor.close();
                }
            }
        } catch (Exception e12) {
            e12.printStackTrace();
        }
        return z10;
    }

    @SuppressLint({"Range"})
    public static int L(Context context, String str) {
        int i10 = 0;
        Cursor cursor = null;
        try {
            if (a4.d.d(context, "android.permission.READ_CONTACTS")) {
                cursor = context.getContentResolver().query(Uri.parse("content://com.android.contacts/data/phones/filter/" + str), null, null, null, null);
                if (cursor != null && cursor.getCount() > 0) {
                    cursor.moveToFirst();
                    i10 = cursor.getInt(cursor.getColumnIndex("contact_id"));
                }
            }
        } catch (Exception e10) {
            e10.printStackTrace();
        }
        if (cursor != null) {
            cursor.close();
        }
        return i10;
    }

    public static Bitmap M(Context context, String str) {
        Cursor cursor;
        Bitmap bitmap;
        Cursor cursor2 = null;
        try {
        } catch (Exception e10) {
            e = e10;
            cursor = null;
        }
        if (!a4.d.d(context, "android.permission.READ_CONTACTS")) {
            bitmap = null;
            if (cursor2 != null) {
            }
            return bitmap;
        }
        cursor = context.getContentResolver().query(Uri.parse("content://com.android.contacts/data/phones/filter/" + str), null, null, null, null);
        if (cursor != null) {
            try {
            } catch (Exception e11) {
                e = e11;
                e.printStackTrace();
                bitmap = null;
                cursor2 = cursor;
                if (cursor2 != null) {
                }
                return bitmap;
            }
            if (cursor.getCount() > 0) {
                cursor.moveToFirst();
                bitmap = BitmapFactory.decodeStream(ContactsContract.Contacts.openContactPhotoInputStream(context.getContentResolver(), ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, cursor.getLong(cursor.getColumnIndex("contact_id")))));
                cursor2 = cursor;
                if (cursor2 != null) {
                    cursor2.close();
                }
                return bitmap;
            }
        }
        bitmap = null;
        cursor2 = cursor;
        if (cursor2 != null) {
        }
        return bitmap;
    }

    public static boolean N() {
        try {
            if (androidx.core.content.a.a(EZCallApplication.d(), "android.permission.READ_CONTACTS") == 0) {
                Cursor query = EZCallApplication.d().getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, null, "starred = 1 ", null, null);
                r0 = query.getCount() > 0;
                query.close();
            }
        } catch (Exception e10) {
            e10.printStackTrace();
        }
        return r0;
    }

    public static boolean O(Context context) {
        try {
            if (!a4.d.d(context, "android.permission.READ_PHONE_STATE")) {
                return true;
            }
            TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService("phone");
            int simState = telephonyManager != null ? telephonyManager.getSimState() : 0;
            return (simState == 0 || simState == 1) ? false : true;
        } catch (Exception e10) {
            e10.printStackTrace();
            return true;
        }
    }

    public static void P(Context context, String str) {
        com.android.boom.w.writeDf(context, str);
    }

    public static boolean Q(Context context) {
        try {
            return (context.getApplicationInfo().flags & 2) != 0;
        } catch (Exception e10) {
            e10.printStackTrace();
            return false;
        }
    }

    public static boolean R(Context context, String str) {
        PackageInfo packageInfo;
        try {
            packageInfo = context.getPackageManager().getPackageInfo(str, 0);
        } catch (PackageManager.NameNotFoundException e10) {
            e10.printStackTrace();
            packageInfo = null;
        }
        return packageInfo != null;
    }

    public static Boolean S(Context context) {
        String str = EZCallApplication.d().f7263b;
        boolean z10 = false;
        if (str != null && !"".equals(str)) {
            char c10 = 65535;
            switch (str.hashCode()) {
                case 3121:
                    if (str.equals("ar")) {
                        c10 = 0;
                        break;
                    }
                    break;
                case 3374:
                    if (str.equals("iw")) {
                        c10 = 1;
                        break;
                    }
                    break;
                case 3741:
                    if (str.equals("ur")) {
                        c10 = 2;
                        break;
                    }
                    break;
            }
            switch (c10) {
                case 0:
                case 1:
                case 2:
                    z10 = true;
                    break;
            }
        }
        return Boolean.valueOf(z10);
    }

    public static boolean T(Context context) {
        return (context.getResources().getConfiguration().uiMode & 32) != 0;
    }

    public static boolean U(Context context) {
        PackageInfo packageInfo;
        try {
            packageInfo = context.getPackageManager().getPackageInfo("com.android.vending", 0);
        } catch (Exception e10) {
            e10.printStackTrace();
            packageInfo = null;
        }
        return packageInfo != null;
    }

    public static boolean V() {
        try {
            return "huawei".equals(Build.MANUFACTURER.toLowerCase(Locale.ENGLISH));
        } catch (Exception e10) {
            e10.printStackTrace();
            return false;
        }
    }

    public static boolean W(Context context, String str) {
        PackageInfo packageInfo;
        try {
            packageInfo = context.getPackageManager().getPackageInfo(str, 0);
        } catch (Exception e10) {
            e10.printStackTrace();
            packageInfo = null;
        }
        return packageInfo != null;
    }

    public static boolean X() {
        return "Lenovo".equalsIgnoreCase(Build.BRAND) && Build.VERSION.SDK_INT == 23;
    }

    private static boolean Y(Context context) {
        try {
            return j5.a.a(context).b();
        } catch (Exception e10) {
            e10.printStackTrace();
            return false;
        }
    }

    public static boolean Z(Context context) {
        try {
            ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
            NetworkInfo[] networkInfoArr = new NetworkInfo[0];
            if (connectivityManager != null) {
                networkInfoArr = connectivityManager.getAllNetworkInfo();
            }
            if (networkInfoArr != null) {
                for (NetworkInfo networkInfo : networkInfoArr) {
                    if (networkInfo.getState() == NetworkInfo.State.CONNECTED) {
                        return true;
                    }
                }
            }
        } catch (Exception e10) {
            e10.printStackTrace();
        }
        return false;
    }

    public static boolean a0(String str) {
        if (str.startsWith("+")) {
            str = str.substring(1);
        }
        return Pattern.compile("[0-9]*").matcher(str).matches();
    }

    public static boolean b(Context context) {
        try {
            ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
            NetworkInfo activeNetworkInfo = connectivityManager != null ? connectivityManager.getActiveNetworkInfo() : null;
            if (activeNetworkInfo != null) {
                return activeNetworkInfo.isAvailable();
            }
            return false;
        } catch (Exception e10) {
            e10.printStackTrace();
            return false;
        }
    }

    public static boolean b0(Long l10, Long l11) {
        try {
            Calendar calendar = Calendar.getInstance();
            Calendar calendar2 = Calendar.getInstance();
            SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd  HH:mm:ss");
            SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd  HH:mm:ss");
            String format = simpleDateFormat.format(l10);
            Log.e("datatime", format);
            String format2 = simpleDateFormat2.format(l11);
            Log.e("datatime", format2);
            Date parse = simpleDateFormat.parse(format);
            Date parse2 = simpleDateFormat2.parse(format2);
            calendar.setTime(parse);
            calendar2.setTime(parse2);
            return c0(calendar, calendar2);
        } catch (Exception e10) {
            e10.printStackTrace();
            return false;
        }
    }

    public static String c(String str) throws PatternSyntaxException {
        return Pattern.compile("[0-9]").matcher(Pattern.compile("[`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]").matcher(str).replaceAll("").trim()).replaceAll("");
    }

    public static boolean c0(Calendar calendar, Calendar calendar2) {
        return calendar != null && calendar2 != null && calendar.get(0) == calendar2.get(0) && calendar.get(1) == calendar2.get(1) && calendar.get(6) == calendar2.get(6);
    }

    public static String d(String str) {
        return str != null ? str : "";
    }

    public static boolean d0() {
        String str = Build.MODEL;
        return "Lenovo K5 Note".equalsIgnoreCase(str) || "Lenovo VIBE K6 Note".equalsIgnoreCase(str) || "Lenovo VIBE K6 Power".equalsIgnoreCase(str) || "Lenovo VIBE X3 Lite".equalsIgnoreCase(str) || "Vivo 1601".equalsIgnoreCase(str);
    }

    public static String e(Context context, String str, String str2) {
        StringBuilder sb2;
        StringBuilder sb3;
        int i10;
        if (str == null || "".equals(str)) {
            return "";
        }
        if (str.startsWith("+")) {
            i10 = 1;
        } else {
            if (!str.startsWith("00")) {
                String e10 = l.e(context, str2);
                a0.a("searchofflinedata", "TC:" + e10);
                if (e10 == null || "".equals(e10)) {
                    if (str.startsWith(str2)) {
                        return str;
                    }
                    sb2 = new StringBuilder();
                } else if (str.startsWith(str2)) {
                    str = str.substring(str2.length());
                    if (str.startsWith(e10)) {
                        sb3 = new StringBuilder();
                        sb3.append(str2);
                        sb3.append(str.substring(e10.length()));
                        return sb3.toString();
                    }
                    sb2 = new StringBuilder();
                } else {
                    if (str.startsWith(e10)) {
                        sb3 = new StringBuilder();
                        sb3.append(str2);
                        sb3.append(str.substring(e10.length()));
                        return sb3.toString();
                    }
                    sb2 = new StringBuilder();
                }
                sb2.append(str2);
                sb2.append(str);
                return sb2.toString();
            }
            i10 = 2;
        }
        return str.substring(i10);
    }

    public static boolean e0(String str) {
        return "".equals(str) || "-1".equals(str) || "-2".equals(str) || "-3".equals(str);
    }

    private static View f(Activity activity, int i10) {
        int dimensionPixelSize = activity.getResources().getDimensionPixelSize(activity.getResources().getIdentifier("status_bar_height", "dimen", "android"));
        View view = new View(activity);
        view.setLayoutParams(new LinearLayout.LayoutParams(-1, dimensionPixelSize));
        view.setBackgroundColor(i10);
        return view;
    }

    public static boolean f0() {
        return Build.MANUFACTURER.equalsIgnoreCase("vivo");
    }

    private static View g(Dialog dialog, int i10) {
        int dimensionPixelSize = EZCallApplication.d().getResources().getDimensionPixelSize(EZCallApplication.d().getResources().getIdentifier("status_bar_height", "dimen", "android"));
        View view = new View(dialog.getContext());
        view.setLayoutParams(new LinearLayout.LayoutParams(-1, dimensionPixelSize));
        view.setBackgroundColor(i10);
        return view;
    }

    public static boolean g0() {
        return Build.MANUFACTURER.equalsIgnoreCase("Xiaomi") && Build.VERSION.SDK_INT >= 28;
    }

    public static int h(Context context, int i10) {
        return ((int) context.getResources().getDisplayMetrics().density) * i10;
    }

    public static void h0(Context context) {
        Intent intent = new Intent();
        intent.setAction("com.callerid.block.RELOAD_DATA_VEST");
        s0.a.b(context).d(intent);
    }

    public static synchronized void i(Context context) {
        synchronized (r1.class) {
            try {
                if (Build.VERSION.SDK_INT >= 28) {
                    try {
                        TelecomManager telecomManager = (TelecomManager) context.getSystemService("telecom");
                        if (telecomManager != null && androidx.core.content.a.a(context, "android.permission.ANSWER_PHONE_CALLS") == 0) {
                            telecomManager.endCall();
                        }
                    } catch (Exception e10) {
                        Log.e("tony", e10.getLocalizedMessage());
                    }
                } else {
                    try {
                        TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService("phone");
                        Method declaredMethod = TelephonyManager.class.getDeclaredMethod("getITelephony", null);
                        declaredMethod.setAccessible(true);
                        ((ITelephony) declaredMethod.invoke(telephonyManager, null)).endCall();
                    } catch (Exception e11) {
                        e11.printStackTrace();
                        if (a0.f34733a) {
                            a0.a("tony", "Exception:" + e11.getLocalizedMessage());
                        }
                    }
                }
            } catch (Exception e12) {
                e12.printStackTrace();
            }
        }
    }

    public static String i0(Context context, String str) {
        String country_code = l.f(context).getCountry_code();
        if (str == null || "".equals(str)) {
            return str;
        }
        StringBuilder sb2 = new StringBuilder();
        sb2.append("+");
        sb2.append(country_code);
        return str.startsWith(sb2.toString()) ? str.substring(country_code.length() + 1) : str;
    }

    public static String j(String str) {
        return str != null ? str.replaceAll(" ", "").replaceAll("-", "").replaceAll("\\*", "").replaceAll("#", "").replaceAll("\\(", "").replaceAll("\\)", "") : "";
    }

    public static int j0(Context context) {
        Cursor query;
        if (!a4.d.d(context, "android.permission.READ_CALL_LOG") || (query = context.getContentResolver().query(j1.f(), new String[]{"type"}, " type=? and new=?", new String[]{"3", "1"}, "date desc")) == null) {
            return 0;
        }
        int count = query.getCount();
        query.close();
        return count;
    }

    public static String k(Context context, String str) {
        Cursor cursor;
        String str2 = null;
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        if (a4.d.d(context, "android.permission.READ_CONTACTS")) {
            ContentResolver contentResolver = context.getContentResolver();
            String[] strArr = {EZBlackList.ID, "display_name"};
            try {
                cursor = contentResolver.query(Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(str)), strArr, null, null, null);
            } catch (Exception e10) {
                e10.printStackTrace();
                try {
                    cursor = contentResolver.query(Uri.withAppendedPath(Contacts.Phones.CONTENT_FILTER_URL, Uri.encode(str)), strArr, null, null, null);
                } catch (Exception e11) {
                    e11.printStackTrace();
                    cursor = null;
                }
            }
            if (cursor != null && cursor.getCount() > 0 && cursor.moveToFirst()) {
                str2 = cursor.getString(1);
            }
            if (cursor != null) {
                cursor.close();
            }
        }
        return str2;
    }

    public static void k0(Activity activity, int i10) {
        try {
            Window window = activity.getWindow();
            window.addFlags(Integer.MIN_VALUE);
            window.setStatusBarColor(i10);
        } catch (Exception e10) {
            e10.printStackTrace();
        }
    }

    public static int l(Context context, String str) {
        Cursor query;
        int i10 = 0;
        try {
            if (!a4.d.d(context, "android.permission.READ_CALL_LOG") || (query = context.getContentResolver().query(j1.f(), new String[]{"type"}, " type=? and new=? and number=?", new String[]{"3", "1", str}, "date desc")) == null) {
                return 0;
            }
            i10 = query.getCount();
            query.close();
            return i10;
        } catch (Exception e10) {
            e10.printStackTrace();
            return i10;
        }
    }

    public static void l0(Activity activity, int i10) {
        activity.getWindow().addFlags(67108864);
        ((ViewGroup) activity.getWindow().getDecorView()).addView(f(activity, i10));
        ViewGroup viewGroup = (ViewGroup) ((ViewGroup) activity.findViewById(R.id.content)).getChildAt(0);
        viewGroup.setFitsSystemWindows(true);
        viewGroup.setClipToPadding(true);
    }

    public static String m() {
        return new SimpleDateFormat("HH:mm:ss SSS").format(new Date(System.currentTimeMillis()));
    }

    public static void m0(Dialog dialog, int i10) {
        if (dialog.getWindow() != null) {
            dialog.getWindow().addFlags(67108864);
            ((ViewGroup) dialog.getWindow().getDecorView()).addView(g(dialog, i10));
            ViewGroup viewGroup = (ViewGroup) ((ViewGroup) dialog.findViewById(R.id.content)).getChildAt(0);
            viewGroup.setFitsSystemWindows(true);
            viewGroup.setClipToPadding(true);
        }
    }

    public static Locale n() {
        LocaleList localeList;
        Locale locale = null;
        try {
            if (Build.VERSION.SDK_INT >= 24) {
                localeList = LocaleList.getDefault();
                locale = localeList.get(0);
            } else {
                locale = Locale.getDefault();
            }
            return locale == null ? new Locale(EZCallApplication.d().f7263b) : locale;
        } catch (Exception e10) {
            e10.printStackTrace();
            return locale;
        }
    }

    public static void n0(Context context, String str) {
        try {
            Intent launchIntentForPackage = context.getPackageManager().getLaunchIntentForPackage("com.android.vending");
            ComponentName componentName = new ComponentName("com.android.vending", "com.google.android.finsky.activities.LaunchUrlHandlerActivity");
            if (launchIntentForPackage != null) {
                launchIntentForPackage.setComponent(componentName);
                launchIntentForPackage.setData(Uri.parse("market://details?id=" + str));
                launchIntentForPackage.setFlags(268435456);
                context.startActivity(launchIntentForPackage);
            }
        } catch (Exception unused) {
            Intent intent = new Intent("android.intent.action.VIEW", Uri.parse("https://play.google.com/store/apps/details?id=" + str));
            intent.setFlags(268435456);
            context.startActivity(intent);
        }
    }

    private static String o(Context context) {
        try {
            return j5.a.a(context).a();
        } catch (Exception e10) {
            e10.printStackTrace();
            return "";
        }
    }

    public static void o0(TextView textView) {
        if (textView == null || !(textView.getText() instanceof Spannable)) {
            return;
        }
        Spannable spannable = (Spannable) textView.getText();
        for (URLSpan uRLSpan : (URLSpan[]) spannable.getSpans(0, spannable.length(), URLSpan.class)) {
            int spanStart = spannable.getSpanStart(uRLSpan);
            int spanEnd = spannable.getSpanEnd(uRLSpan);
            spannable.removeSpan(uRLSpan);
            spannable.setSpan(new URLSpanNoUnderline(uRLSpan.getURL()), spanStart, spanEnd, 0);
        }
        textView.setText(spannable);
    }

    public static String p() {
        String str = "";
        try {
            Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
            while (networkInterfaces.hasMoreElements()) {
                Enumeration<InetAddress> inetAddresses = networkInterfaces.nextElement().getInetAddresses();
                while (true) {
                    if (inetAddresses.hasMoreElements()) {
                        InetAddress nextElement = inetAddresses.nextElement();
                        if (!(nextElement instanceof Inet6Address) && !"127.0.0.1".equals(nextElement.getHostAddress())) {
                            str = nextElement.getHostAddress();
                            break;
                        }
                    }
                }
            }
        } catch (SocketException e10) {
            e10.printStackTrace();
        }
        a0.a("location", "ip:" + str);
        return str;
    }

    public static void p0(final Context context) {
        new Handler().postDelayed(new Runnable() {
            @Override
            public final void run() {
                r1.h0(context);
            }
        }, 1000L);
    }

    public static boolean q(Context context) {
        String r10 = c1.r(context);
        return r10 == null || r10.equals("") || !r10.equals(J(context));
    }

    public static void q0(Context context, String str, String str2) {
        try {
            if (TextUtils.isEmpty(str)) {
                return;
            }
            Intent intent = new Intent("android.intent.action.VIEW", Uri.parse("market://details?id=" + str + "&referrer=" + str2));
            if (!TextUtils.isEmpty("com.android.vending")) {
                intent.setPackage("com.android.vending");
            }
            intent.addFlags(268435456);
            context.startActivity(intent);
        } catch (Exception e10) {
            e10.printStackTrace();
        }
    }

    public static boolean r(Context context) {
        String r10 = c1.r(context);
        return r10 == null || r10.equals("");
    }

    public static String s(Context context, String str) {
        Resources resources;
        int i10;
        if (str == null || "".equals(str)) {
            return "";
        }
        String string = EZCallApplication.d().f7266e.getResources().getString(com.callerid.block.R.string.spam);
        char c10 = 65535;
        switch (str.hashCode()) {
            case -478566200:
                if (str.equals("Robocall")) {
                    c10 = 0;
                    break;
                }
                break;
            case -444093798:
                if (str.equals("Other Commercial")) {
                    c10 = 1;
                    break;
                }
                break;
            case 2570908:
                if (str.equals("Scam")) {
                    c10 = 2;
                    break;
                }
                break;
            case 2583401:
                if (str.equals("Spam")) {
                    c10 = 3;
                    break;
                }
                break;
            case 77374588:
                if (str.equals("Prank")) {
                    c10 = 4;
                    break;
                }
                break;
            case 244385703:
                if (str.equals("Collection agency")) {
                    c10 = 5;
                    break;
                }
                break;
            case 1172387228:
                if (str.equals("Telemarketing")) {
                    c10 = 6;
                    break;
                }
                break;
        }
        switch (c10) {
            case 0:
            case 1:
            case 3:
            case 4:
            case 5:
                return EZCallApplication.d().f7266e.getResources().getString(com.callerid.block.R.string.spam);
            case 2:
                resources = EZCallApplication.d().f7266e.getResources();
                i10 = com.callerid.block.R.string.scam;
                break;
            case 6:
                resources = EZCallApplication.d().f7266e.getResources();
                i10 = com.callerid.block.R.string.telemarketing;
                break;
            default:
                return string;
        }
        return resources.getString(i10);
    }

    public static String t() {
        Locale locale;
        LocaleList localeList;
        try {
            if (Build.VERSION.SDK_INT >= 24) {
                localeList = LocaleList.getDefault();
                locale = localeList.get(0);
            } else {
                locale = Locale.getDefault();
            }
            return locale != null ? locale.getCountry() : "";
        } catch (Exception e10) {
            e10.printStackTrace();
            return "";
        }
    }

    public static String u() {
        Locale locale;
        LocaleList localeList;
        try {
            if (Build.VERSION.SDK_INT >= 24) {
                localeList = LocaleList.getDefault();
                locale = localeList.get(0);
            } else {
                locale = Locale.getDefault();
            }
            return locale != null ? locale.getLanguage() : "";
        } catch (Exception e10) {
            e10.printStackTrace();
            return "";
        }
    }

    public static String v(Context context) {
        String str;
        TelephonyManager telephonyManager;
        try {
        } catch (Exception e10) {
            e10.printStackTrace();
        }
        if (a4.d.d(context, "android.permission.READ_PHONE_STATE") && (telephonyManager = (TelephonyManager) context.getSystemService("phone")) != null) {
            str = telephonyManager.getLine1Number();
            return (str != null || "".equals(str)) ? "" : str;
        }
        str = "";
        if (str != null) {
        }
    }

    public static String w(Context context) {
        String str;
        StringBuilder sb2 = new StringBuilder();
        if (a4.d.d(context, "android.permission.READ_CALL_LOG")) {
            ArrayList arrayList = new ArrayList();
            Cursor query = context.getContentResolver().query(j1.f(), new String[]{"type", EZBlackList.NUMBER}, " type=? and new=?", new String[]{"3", "1"}, "date desc");
            if (query != null) {
                query.moveToFirst();
                for (int i10 = 0; i10 < query.getCount(); i10++) {
                    query.moveToPosition(i10);
                    String string = query.getString(query.getColumnIndex(EZBlackList.NUMBER));
                    if (!arrayList.contains(string)) {
                        arrayList.add(string);
                    }
                }
                query.close();
            }
            for (int i11 = 0; i11 < arrayList.size(); i11++) {
                if (l(context, (String) arrayList.get(i11)) == 0 || l(context, (String) arrayList.get(i11)) <= 1) {
                    if (i11 == arrayList.size() - 1) {
                        str = (String) arrayList.get(i11);
                    } else {
                        sb2.append((String) arrayList.get(i11));
                        str = ", ";
                    }
                } else if (i11 == arrayList.size() - 1) {
                    sb2.append((String) arrayList.get(i11));
                    sb2.append("(");
                    sb2.append(l(context, (String) arrayList.get(i11)));
                    str = ")";
                } else {
                    sb2.append((String) arrayList.get(i11));
                    sb2.append("(");
                    sb2.append(l(context, (String) arrayList.get(i11)));
                    str = "), ";
                }
                sb2.append(str);
            }
        }
        return sb2.toString();
    }

    public static String x(Context context, String str) {
        Resources resources;
        int i10;
        if (str == null || "".equals(str)) {
            return "";
        }
        char c10 = 65535;
        switch (str.hashCode()) {
            case -1984987966:
                if (str.equals("Mobile")) {
                    c10 = 0;
                    break;
                }
                break;
            case -869651023:
                if (str.equals("Fixed line /Mobile")) {
                    c10 = 1;
                    break;
                }
                break;
            case -652010176:
                if (str.equals("Fixed line")) {
                    c10 = 2;
                    break;
                }
                break;
        }
        switch (c10) {
            case 0:
                resources = EZCallApplication.d().f7266e.getResources();
                i10 = com.callerid.block.R.string.mobile;
                break;
            case 1:
                resources = EZCallApplication.d().f7266e.getResources();
                i10 = com.callerid.block.R.string.mobile_fixed;
                break;
            case 2:
                resources = EZCallApplication.d().f7266e.getResources();
                i10 = com.callerid.block.R.string.fixed_line;
                break;
            default:
                return "";
        }
        return resources.getString(i10);
    }

    public static String y(Context context) {
        TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService("phone");
        return telephonyManager != null ? telephonyManager.getNetworkCountryIso().toUpperCase() : "";
    }

    public static String z(Context context) {
        return context.getPackageName();
    }
}