秦华影视 v1.0.0版本的 MD5 值为:90520322e40df4849cf4989ab6339524

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


package p.a.y.e.a.s.e.net;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ComponentName;
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.pm.Signature;
import android.database.Cursor;
import android.graphics.drawable.Drawable;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.os.ParcelFileDescriptor;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
import android.text.TextUtils;
import android.util.Base64;
import android.util.DisplayMetrics;
import androidx.core.content.ContextCompat;
import androidx.core.content.FileProvider;
import com.ehking.sdk.wepay.ui.activity.AddBankCardActivity;
import com.ehking.sdk.wepay.ui.activity.AuthenticationPhoneActivity;
import com.google.android.material.shadow.ShadowDrawableWrapper;
import com.huawei.hms.framework.common.ContainerUtils;
import com.tencent.open.utils.HttpUtils;
import com.tencent.smtt.sdk.TbsConfig;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.net.URL;
import java.net.URLDecoder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Enumeration;
import kotlin.UByte;
import org.json.JSONException;
import org.json.JSONObject;

public class dd2 {
    private static String lite_byte = "0123456789ABCDEF";
    private static String lite_do = "";
    private static String lite_for = "";
    private static String lite_if = "";
    private static String lite_int = "";
    private static int lite_new = -1;
    private static String lite_try;

    public static class a extends Thread {
        public final Context lite_static;
        public final Bundle lite_switch;

        public a(Context context, Bundle bundle) {
            this.lite_static = context;
            this.lite_switch = bundle;
        }

        @Override
        public void run() {
            try {
                HttpUtils.lite_else(this.lite_static, "http://cgi.qplus.com/report/report", hb2.G, this.lite_switch);
            } catch (Exception e) {
                StringBuilder b = r5.b("reportBernoulli has exception: ");
                b.append(e.getMessage());
                ic2.lite_case("openSDK_LOG.Util", b.toString());
            }
        }
    }

    public static class b {
        public String lite_do;
        public long lite_for;
        public long lite_if;

        public b(String str, int i) {
            this.lite_do = str;
            this.lite_if = i;
            if (str != null) {
                this.lite_for = str.length();
            }
        }
    }

    public static String a(String str) {
        if (!TextUtils.isEmpty(str)) {
            try {
                return Base64.encodeToString(str.getBytes("UTF-8"), 2);
            } catch (UnsupportedEncodingException e) {
                StringBuilder b2 = r5.b("convert2Base64String exception: ");
                b2.append(e.getMessage());
                ic2.lite_case("openSDK_LOG.Util", b2.toString());
            }
        }
        return "";
    }

    public static File b(String str) throws IOException {
        File file = new File(str);
        if (!file.exists()) {
            if (file.getParentFile() != null && !file.getParentFile().exists()) {
                if (file.getParentFile().mkdirs()) {
                    file.createNewFile();
                } else {
                    ic2.lite_try("openSDK_LOG.Util", "createFile failed" + str);
                }
            } else {
                file.createNewFile();
            }
        }
        return file;
    }

    public static boolean c(String str) {
        String lite_native = lite_native();
        return (TextUtils.isEmpty(str) || TextUtils.isEmpty(lite_native) || !str.contains(lite_native)) ? false : true;
    }

    public static boolean lite_abstract(Context context) {
        return ad2.lite_void(context, "8.1.8") >= 0;
    }

    public static boolean lite_boolean() {
        return Build.VERSION.SDK_INT < 23 || ContextCompat.checkSelfPermission(xc2.lite_do(), ou2.lite_while) == 0;
    }

    private static void lite_break(Context context, String str, String str2, String str3) {
        Intent intent = new Intent();
        intent.setComponent(new ComponentName(str, str2));
        intent.setAction("android.intent.action.VIEW");
        intent.addFlags(1073741824);
        intent.addFlags(268435456);
        intent.setData(Uri.parse(str3));
        context.startActivity(intent);
    }

    public static String lite_byte() {
        try {
            Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
            while (networkInterfaces != null && networkInterfaces.hasMoreElements()) {
                Enumeration<InetAddress> inetAddresses = networkInterfaces.nextElement().getInetAddresses();
                while (inetAddresses.hasMoreElements()) {
                    InetAddress nextElement = inetAddresses.nextElement();
                    if (!nextElement.isLoopbackAddress()) {
                        return nextElement.getHostAddress().toString();
                    }
                }
            }
            return "";
        } catch (SocketException e) {
            ic2.lite_byte("openSDK_LOG.Util", "getUserIp SocketException ", e);
            return "";
        }
    }

    public static final String lite_case(Context context) {
        CharSequence applicationLabel;
        if (context == null || (applicationLabel = context.getPackageManager().getApplicationLabel(context.getApplicationInfo())) == null) {
            return null;
        }
        return applicationLabel.toString();
    }

    public static boolean lite_catch(Context context, String str) {
        boolean z;
        try {
            z = lite_protected(context);
        } catch (Exception unused) {
            z = false;
        }
        try {
            if (z) {
                lite_break(context, TbsConfig.APP_QB, "com.tencent.mtt.MainActivity", str);
            } else {
                lite_break(context, "com.android.browser", "com.android.browser.BrowserActivity", str);
            }
            return true;
        } catch (Exception unused2) {
            if (z) {
                try {
                    try {
                        try {
                            lite_break(context, "com.android.browser", "com.android.browser.BrowserActivity", str);
                            return true;
                        } catch (Exception unused3) {
                            return false;
                        }
                    } catch (Exception unused4) {
                        lite_break(context, "com.android.chrome", "com.google.android.apps.chrome.Main", str);
                        return true;
                    }
                } catch (Exception unused5) {
                    lite_break(context, "com.google.android.browser", "com.android.browser.BrowserActivity", str);
                    return true;
                }
            }
            try {
                try {
                    lite_break(context, "com.google.android.browser", "com.android.browser.BrowserActivity", str);
                    return true;
                } catch (Exception unused6) {
                    return false;
                }
            } catch (Exception unused7) {
                lite_break(context, "com.android.chrome", "com.google.android.apps.chrome.Main", str);
                return true;
            }
        }
    }

    @SuppressLint({"NewApi"})
    public static String lite_char(Context context, Uri uri) {
        Uri uri2;
        if (uri == null) {
            return null;
        }
        if (DocumentsContract.isDocumentUri(context, uri)) {
            String authority = uri.getAuthority();
            if ("com.android.externalstorage.documents".equals(authority)) {
                String[] split = DocumentsContract.getDocumentId(uri).split(ue2.lite_extends);
                String str = split[0];
                if ("primary".equals(str)) {
                    return Environment.getExternalStorageDirectory().getAbsolutePath().concat(AuthenticationPhoneActivity.WHITE_SPACE).concat(split[1]);
                }
                return "/storage/".concat(str).concat(AuthenticationPhoneActivity.WHITE_SPACE).concat(split[1]);
            }
            if ("com.android.providers.downloads.documents".equals(authority)) {
                String documentId = DocumentsContract.getDocumentId(uri);
                if (documentId.startsWith("raw:")) {
                    return documentId.replaceFirst("raw:", "");
                }
                return lite_super(context, ContentUris.withAppendedId(Uri.parse("content://downloads/public_downloads"), Long.parseLong(documentId)));
            }
            if ("com.android.providers.media.documents".equals(authority)) {
                String[] split2 = DocumentsContract.getDocumentId(uri).split(ue2.lite_extends);
                String str2 = split2[0];
                if ("image".equals(str2)) {
                    uri2 = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
                } else if ("video".equals(str2)) {
                    uri2 = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
                } else if ("audio".equals(str2)) {
                    uri2 = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
                }
                return lite_super(context, ContentUris.withAppendedId(uri2, Long.parseLong(split2[1])));
            }
            return null;
        }
        String scheme = uri.getScheme();
        if ("content".equals(scheme)) {
            return lite_super(context, uri);
        }
        if (ot.lite_for.equals(scheme)) {
            return uri.getPath();
        }
        return null;
    }

    public static boolean lite_class(Context context, boolean z) {
        return (lite_default(context) && ad2.lite_byte(context, hb2.lite_int) != null) || ad2.lite_void(context, "4.1") >= 0 || ad2.lite_byte(context, hb2.lite_new) != null || ad2.lite_byte(context, hb2.lite_byte) != null;
    }

    public static boolean lite_const(File file, File file2) {
        FileOutputStream fileOutputStream;
        int read;
        boolean z = false;
        FileOutputStream fileOutputStream2 = null;
        fileOutputStream2 = null;
        fileOutputStream2 = null;
        fileOutputStream2 = null;
        fileOutputStream2 = null;
        try {
            try {
                try {
                    if (file2.exists()) {
                        file2.delete();
                    }
                    if (file2.getParentFile() != null && !file2.getParentFile().exists()) {
                        file2.getParentFile().mkdirs();
                    }
                    fileOutputStream = new FileOutputStream((File) file2);
                    try {
                        file2 = new BufferedInputStream(new FileInputStream(file));
                    } catch (IOException e) {
                        e = e;
                        file2 = 0;
                    } catch (OutOfMemoryError e2) {
                        e = e2;
                        file2 = 0;
                    } catch (Throwable th) {
                        th = th;
                        file2 = 0;
                    }
                } catch (IOException e3) {
                    ic2.lite_char("openSDK_LOG.Util", "copyFile error, ", e3);
                    fileOutputStream2 = fileOutputStream2;
                    file2 = file2;
                }
            } catch (IOException e4) {
                e = e4;
                file2 = 0;
            } catch (OutOfMemoryError e5) {
                e = e5;
                file2 = 0;
            } catch (Throwable th2) {
                th = th2;
                file2 = 0;
            }
        } catch (Throwable th3) {
            th = th3;
        }
        try {
            byte[] bArr = new byte[102400];
            while (true) {
                read = file2.read(bArr);
                if (read == -1) {
                    break;
                }
                fileOutputStream.write(bArr, 0, read);
                fileOutputStream.flush();
            }
            z = true;
            try {
                fileOutputStream.close();
            } catch (IOException e6) {
                ic2.lite_char("openSDK_LOG.Util", "copyFile error, ", e6);
            }
            file2.close();
            fileOutputStream2 = read;
            file2 = file2;
        } catch (IOException e7) {
            e = e7;
            fileOutputStream2 = fileOutputStream;
            file2 = file2;
            ic2.lite_char("openSDK_LOG.Util", "copyFile error, ", e);
            if (fileOutputStream2 != null) {
                try {
                    fileOutputStream2.close();
                } catch (IOException e8) {
                    ic2.lite_char("openSDK_LOG.Util", "copyFile error, ", e8);
                }
            }
            if (file2 != 0) {
                file2.close();
                fileOutputStream2 = fileOutputStream2;
                file2 = file2;
            }
            return z;
        } catch (OutOfMemoryError e9) {
            e = e9;
            fileOutputStream2 = fileOutputStream;
            file2 = file2;
            ic2.lite_char("openSDK_LOG.Util", "copyFile error, ", e);
            if (fileOutputStream2 != null) {
                try {
                    fileOutputStream2.close();
                } catch (IOException e10) {
                    ic2.lite_char("openSDK_LOG.Util", "copyFile error, ", e10);
                }
            }
            if (file2 != 0) {
                file2.close();
                fileOutputStream2 = fileOutputStream2;
                file2 = file2;
            }
            return z;
        } catch (Throwable th4) {
            th = th4;
            fileOutputStream2 = fileOutputStream;
            if (fileOutputStream2 != null) {
                try {
                    fileOutputStream2.close();
                } catch (IOException e11) {
                    ic2.lite_char("openSDK_LOG.Util", "copyFile error, ", e11);
                }
            }
            if (file2 != 0) {
                try {
                    file2.close();
                    throw th;
                } catch (IOException e12) {
                    ic2.lite_char("openSDK_LOG.Util", "copyFile error, ", e12);
                    throw th;
                }
            }
            throw th;
        }
        return z;
    }

    public static boolean lite_continue(Context context, String str) {
        boolean z = !lite_default(context) || ad2.lite_byte(context, hb2.lite_int) == null;
        if (z && ad2.lite_byte(context, hb2.lite_new) != null) {
            z = false;
        }
        if (z && ad2.lite_byte(context, hb2.lite_byte) != null) {
            z = false;
        }
        if (z) {
            return ad2.lite_void(context, str) < 0;
        }
        return z;
    }

    public static boolean lite_default(Context context) {
        double d;
        try {
            DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
            d = Math.sqrt(Math.pow(displayMetrics.widthPixels / displayMetrics.xdpi, 2.0d) + Math.pow(displayMetrics.heightPixels / displayMetrics.ydpi, 2.0d));
        } catch (Throwable unused) {
            d = ShadowDrawableWrapper.COS_45;
        }
        return d > 6.5d;
    }

    private static char lite_do(int i) {
        int i2 = i & 15;
        return (char) (i2 < 10 ? i2 + 48 : (i2 - 10) + 97);
    }

    public static boolean lite_double(Context context) {
        ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
        if (connectivityManager == null) {
            return true;
        }
        NetworkInfo[] allNetworkInfo = connectivityManager.getAllNetworkInfo();
        if (allNetworkInfo != null) {
            for (NetworkInfo networkInfo : allNetworkInfo) {
                if (networkInfo.isConnectedOrConnecting()) {
                    return true;
                }
            }
        }
        return false;
    }

    public static final String lite_else(String str, int i, String str2, String str3) {
        if (TextUtils.isEmpty(str)) {
            return "";
        }
        if (TextUtils.isEmpty(str2)) {
            str2 = "UTF-8";
        }
        try {
            if (str.getBytes(str2).length <= i) {
                return str;
            }
            int i2 = 0;
            int i3 = 0;
            while (i2 < str.length()) {
                int i4 = i2 + 1;
                i3 += str.substring(i2, i4).getBytes(str2).length;
                if (i3 > i) {
                    String substring = str.substring(0, i2);
                    if (TextUtils.isEmpty(str3)) {
                        return substring;
                    }
                    return substring + str3;
                }
                i2 = i4;
            }
            return str;
        } catch (Exception e) {
            StringBuilder b2 = r5.b("Util.subString has exception: ");
            b2.append(e.getMessage());
            ic2.lite_case("openSDK_LOG.Util", b2.toString());
            return str;
        }
    }

    public static String lite_extends(Context context, String str) {
        if (context == null) {
            return "";
        }
        String lite_switch = lite_switch(context, str);
        lite_for = lite_switch;
        return lite_switch;
    }

    public static boolean lite_final(String str, String str2) {
        File file = new File(str);
        if (file.exists()) {
            try {
                return lite_const(file, b(str2));
            } catch (IOException e) {
                ic2.lite_byte("openSDK_LOG.Util", r5.lite_finally("copy fail from ", str, " to ", str2, AddBankCardActivity.WHITE_SPACE), e);
            }
        }
        return false;
    }

    public static boolean lite_finally(Context context) {
        return ad2.lite_void(context, "8.1.5") >= 0;
    }

    private static byte[] lite_float(byte[] bArr, String str) {
        if (bArr != null) {
            try {
                char[] charArray = str.toCharArray();
                int length = bArr.length;
                byte[] bArr2 = new byte[length];
                for (int i = 0; i < length; i++) {
                    bArr2[i] = (byte) (bArr[i] ^ charArray[i % charArray.length]);
                }
                return bArr2;
            } catch (Throwable th) {
                ic2.lite_char("Util", "xor Exception! ", th);
            }
        }
        return bArr;
    }

    public static Bundle lite_for(String str) {
        Bundle bundle = new Bundle();
        if (str == null) {
            return bundle;
        }
        try {
            for (String str2 : str.split("&")) {
                String[] split = str2.split(ContainerUtils.KEY_VALUE_DELIMITER);
                if (split.length == 2) {
                    bundle.putString(URLDecoder.decode(split[0]), URLDecoder.decode(split[1]));
                }
            }
            return bundle;
        } catch (Exception unused) {
            return null;
        }
    }

    public static String lite_goto(String str, Activity activity, String str2) {
        String str3;
        try {
            boolean c = c(str2);
            ic2.lite_long("openSDK_LOG.Util", "doPublishMood() check file: isAppSpecificDir=" + c + ",hasSDPermission=" + lite_boolean());
            if (!c) {
                File externalFilesDir = xc2.lite_do().getExternalFilesDir("Images");
                if (externalFilesDir != null) {
                    str3 = externalFilesDir.getAbsolutePath() + File.separator + hb2.F1;
                } else {
                    File cacheDir = xc2.lite_do().getCacheDir();
                    if (cacheDir == null) {
                        ic2.lite_case("openSDK_LOG.Util", "getMediaFileUri error, cacheDir is null");
                        return null;
                    }
                    str3 = cacheDir.getAbsolutePath() + File.separator + hb2.F1;
                }
                File file = new File(str2);
                String absolutePath = file.getAbsolutePath();
                String str4 = str3 + File.separator + file.getName();
                str2 = lite_import(absolutePath, str4) ? str4 : null;
            }
            if (!TextUtils.isEmpty(str2)) {
                File file2 = new File(str2);
                String lite_byte2 = md2.lite_byte(str);
                if (TextUtils.isEmpty(lite_byte2)) {
                    ic2.lite_case("openSDK_LOG.Util", "getMediaFileUri error, authorities is null");
                    return null;
                }
                Uri uriForFile = FileProvider.getUriForFile(activity, lite_byte2, file2);
                activity.grantUriPermission("com.tencent.mobileqq", uriForFile, 3);
                return uriForFile.toString();
            }
            ic2.lite_case("openSDK_LOG.Util", "getMediaFileUri error, destAppSpecific is null");
            return null;
        } catch (Exception e) {
            ic2.lite_char("openSDK_LOG.Util", "getMediaFileUri error", e);
            return null;
        }
    }

    public static Drawable lite_if(String str, Context context) {
        InputStream inputStream;
        StringBuilder sb;
        InputStream inputStream2 = null;
        r1 = null;
        Drawable drawable = null;
        if (context == null) {
            ic2.lite_case("openSDK_LOG.Util", "context null!");
            return null;
        }
        try {
            inputStream = context.getAssets().open(str);
            try {
                try {
                    drawable = Drawable.createFromStream(inputStream, str);
                } catch (IOException e) {
                    e = e;
                    ic2.lite_case("openSDK_LOG.Util", "getDrawable exception: " + e.getMessage());
                    try {
                        inputStream.close();
                    } catch (Exception e2) {
                        e = e2;
                        sb = new StringBuilder();
                        sb.append("inputStream close exception: ");
                        sb.append(e.getMessage());
                        ic2.lite_case("openSDK_LOG.Util", sb.toString());
                        return drawable;
                    }
                    return drawable;
                }
                try {
                    inputStream.close();
                } catch (Exception e3) {
                    e = e3;
                    sb = new StringBuilder();
                    sb.append("inputStream close exception: ");
                    sb.append(e.getMessage());
                    ic2.lite_case("openSDK_LOG.Util", sb.toString());
                    return drawable;
                }
            } catch (Throwable th) {
                th = th;
                inputStream2 = inputStream;
                try {
                    inputStream2.close();
                } catch (Exception e4) {
                    StringBuilder b2 = r5.b("inputStream close exception: ");
                    b2.append(e4.getMessage());
                    ic2.lite_case("openSDK_LOG.Util", b2.toString());
                }
                throw th;
            }
        } catch (IOException e5) {
            e = e5;
            inputStream = null;
        } catch (Throwable th2) {
            th = th2;
            inputStream2.close();
            throw th;
        }
        return drawable;
    }

    public static byte[] lite_implements(String str) {
        try {
            return str.getBytes("UTF-8");
        } catch (UnsupportedEncodingException unused) {
            return null;
        }
    }

    public static boolean lite_import(String str, String str2) {
        boolean lite_boolean = lite_boolean();
        boolean lite_final = lite_boolean ? lite_final(str, str2) : false;
        ic2.lite_long("openSDK_LOG.Util", "copyImageByCheckPermission() copy succes:" + lite_final + ",hasSDPermission=" + lite_boolean);
        return lite_final;
    }

    public static long lite_instanceof(String str) {
        FileInputStream fileInputStream = null;
        try {
            File file = new File(str);
            if (!file.exists()) {
                return 0L;
            }
            FileInputStream fileInputStream2 = new FileInputStream(file);
            try {
                long available = fileInputStream2.available();
                try {
                    fileInputStream2.close();
                } catch (IOException unused) {
                }
                return available;
            } catch (Exception unused2) {
                fileInputStream = fileInputStream2;
                if (fileInputStream != null) {
                    try {
                        fileInputStream.close();
                    } catch (IOException unused3) {
                    }
                }
                return 0L;
            } catch (Throwable th) {
                th = th;
                fileInputStream = fileInputStream2;
                if (fileInputStream != null) {
                    try {
                        fileInputStream.close();
                    } catch (IOException unused4) {
                    }
                }
                throw th;
            }
        } catch (Exception unused5) {
        } catch (Throwable th2) {
            th = th2;
        }
    }

    public static Bundle lite_int(String str, String str2, String str3, String str4, String str5, String str6) {
        return lite_try(str, str3, str4, str2, str5, str6, "", "", "", "", "", "");
    }

    public static final boolean lite_interface(String str) {
        if (str == null) {
            return false;
        }
        return str.startsWith("http://") || str.startsWith("https://");
    }

    public static String lite_long(byte[] bArr) {
        if (bArr == null) {
            return null;
        }
        StringBuilder sb = new StringBuilder(bArr.length * 2);
        for (byte b2 : bArr) {
            String num = Integer.toString(b2 & UByte.MAX_VALUE, 16);
            if (num.length() == 1) {
                num = r5.lite_throws("0", num);
            }
            sb.append(num);
        }
        return sb.toString();
    }

    public static String lite_native() {
        File lite_new2 = xc2.lite_new();
        if (lite_new2 == null) {
            return null;
        }
        if (!lite_new2.exists()) {
            lite_new2.mkdirs();
        }
        return lite_new2.toString();
    }

    public static Bundle lite_new(String str, String str2, String str3, String str4, String str5, String str6, String str7, String str8, String str9) {
        Bundle bundle = new Bundle();
        bundle.putString("platform", "1");
        bundle.putString("result", str);
        bundle.putString("code", str2);
        bundle.putString("tmcost", str3);
        bundle.putString("rate", str4);
        bundle.putString("cmd", str5);
        bundle.putString("uin", str6);
        bundle.putString("appid", str7);
        bundle.putString("share_type", str8);
        bundle.putString("detail", str9);
        bundle.putString("os_ver", Build.VERSION.RELEASE);
        bundle.putString("network", zb2.lite_do(xc2.lite_do()));
        bundle.putString("apn", zb2.lite_if(xc2.lite_do()));
        bundle.putString("model_name", Build.MODEL);
        bundle.putString("sdk_ver", hb2.lite_else);
        bundle.putString("packagename", xc2.lite_for());
        bundle.putString("app_ver", lite_switch(xc2.lite_do(), xc2.lite_for()));
        return bundle;
    }

    public static boolean lite_package(String str) {
        return str == null || str.length() == 0;
    }

    public static String lite_private(String str) {
        try {
            MessageDigest messageDigest = MessageDigest.getInstance("MD5");
            messageDigest.update(lite_implements(str));
            byte[] digest = messageDigest.digest();
            if (digest == null) {
                return str;
            }
            StringBuilder sb = new StringBuilder();
            for (byte b2 : digest) {
                sb.append(lite_do(b2 >>> 4));
                sb.append(lite_do(b2));
            }
            return sb.toString();
        } catch (NoSuchAlgorithmException e) {
            StringBuilder b3 = r5.b("encrypt has exception: ");
            b3.append(e.getMessage());
            ic2.lite_case("openSDK_LOG.Util", b3.toString());
            return str;
        }
    }

    private static boolean lite_protected(Context context) {
        Signature[] signatureArr;
        try {
            PackageInfo packageInfo = context.getPackageManager().getPackageInfo(TbsConfig.APP_QB, 64);
            String str = packageInfo.versionName;
            if (ad2.lite_if(str, "4.3") >= 0 && !str.startsWith("4.4") && (signatureArr = packageInfo.signatures) != null) {
                try {
                    MessageDigest messageDigest = MessageDigest.getInstance("MD5");
                    messageDigest.update(signatureArr[0].toByteArray());
                    String lite_long = lite_long(messageDigest.digest());
                    messageDigest.reset();
                    if (lite_long.equals("d8391a394d4a179e6fe7bdb8a301258b")) {
                        return true;
                    }
                } catch (NoSuchAlgorithmException e) {
                    ic2.lite_case("openSDK_LOG.Util", "isQQBrowerAvailable has exception: " + e.getMessage());
                }
            }
        } catch (PackageManager.NameNotFoundException unused) {
        }
        return false;
    }

    public static String lite_public(Context context) {
        Location lastKnownLocation;
        if (context == null) {
            return "";
        }
        try {
            LocationManager locationManager = (LocationManager) context.getSystemService("location");
            Criteria criteria = new Criteria();
            criteria.setCostAllowed(false);
            criteria.setAccuracy(2);
            String bestProvider = locationManager.getBestProvider(criteria, true);
            if (bestProvider == null || (lastKnownLocation = locationManager.getLastKnownLocation(bestProvider)) == null) {
                return "";
            }
            String str = lastKnownLocation.getLatitude() + "*" + lastKnownLocation.getLongitude();
            lite_try = str;
            return str;
        } catch (Exception e) {
            ic2.lite_char("openSDK_LOG.Util", "getLocation>>>", e);
        }
        return "";
    }

    public static String lite_return(Context context, String str) {
        if (context == null) {
            return "";
        }
        lite_throw(context, str);
        return lite_if;
    }

    public static Bundle lite_short(String str) {
        try {
            URL url = new URL(str.replace("auth://", "http://"));
            Bundle lite_for2 = lite_for(url.getQuery());
            lite_for2.putAll(lite_for(url.getRef()));
            return lite_for2;
        } catch (MalformedURLException unused) {
            return new Bundle();
        }
    }

    public static JSONObject lite_static(String str) {
        try {
            URL url = new URL(str.replace("auth://", "http://"));
            JSONObject lite_this = lite_this(null, url.getQuery());
            lite_this(lite_this, url.getRef());
            return lite_this;
        } catch (MalformedURLException unused) {
            return new JSONObject();
        }
    }

    public static boolean lite_strictfp(Context context) {
        return (ad2.lite_void(context, "5.9.5") < 0 && ad2.lite_byte(context, hb2.lite_new) == null && ad2.lite_byte(context, hb2.lite_byte) == null) ? false : true;
    }

    public static String lite_super(Context context, Uri uri) {
        Cursor cursor;
        Throwable th;
        FileOutputStream fileOutputStream;
        ParcelFileDescriptor parcelFileDescriptor;
        Exception e;
        FileInputStream fileInputStream;
        FileInputStream fileInputStream2 = null;
        try {
            cursor = context.getContentResolver().query(uri, new String[]{"_data"}, null, null, null);
            if (cursor != null) {
                try {
                    if (cursor.moveToFirst()) {
                        return cursor.getString(cursor.getColumnIndexOrThrow("_data"));
                    }
                } catch (Exception e2) {
                    e = e2;
                    StringBuilder b2 = r5.b("queryAbsolutePath error : ");
                    b2.append(e.getMessage());
                    ic2.lite_case("openSDK_LOG.Util", b2.toString());
                    if (cursor != null) {
                        cursor.close();
                    }
                    try {
                        parcelFileDescriptor = context.getContentResolver().openFileDescriptor(uri, "r");
                        try {
                            fileInputStream = new FileInputStream(parcelFileDescriptor.getFileDescriptor());
                            try {
                                File externalFilesDir = context.getExternalFilesDir("Images");
                                if (!externalFilesDir.exists()) {
                                    externalFilesDir.mkdirs();
                                }
                                File file = new File(externalFilesDir, uri.getLastPathSegment());
                                if (!file.exists()) {
                                    file.createNewFile();
                                }
                                fileOutputStream = new FileOutputStream(file);
                                try {
                                    try {
                                        byte[] bArr = new byte[2048];
                                        while (true) {
                                            int read = fileInputStream.read(bArr);
                                            if (read == -1) {
                                                break;
                                            }
                                            fileOutputStream.write(bArr, 0, read);
                                        }
                                        fileOutputStream.flush();
                                        String absolutePath = file.getAbsolutePath();
                                        try {
                                            fileInputStream.close();
                                        } catch (IOException e3) {
                                            StringBuilder b3 = r5.b("close fileIuputStream error");
                                            b3.append(e3.getMessage());
                                            ic2.lite_case("openSDK_LOG.Util", b3.toString());
                                        }
                                        try {
                                            fileOutputStream.close();
                                        } catch (IOException e4) {
                                            StringBuilder b4 = r5.b("close fileOutputStream error");
                                            b4.append(e4.getMessage());
                                            ic2.lite_case("openSDK_LOG.Util", b4.toString());
                                        }
                                        try {
                                            parcelFileDescriptor.close();
                                        } catch (IOException e5) {
                                            StringBuilder b5 = r5.b("close ParcelFileDescriptor error");
                                            b5.append(e5.getMessage());
                                            ic2.lite_case("openSDK_LOG.Util", b5.toString());
                                        }
                                        return absolutePath;
                                    } catch (Exception e6) {
                                        e = e6;
                                        ic2.lite_case("openSDK_LOG.Util", "copy file from uri error : " + e.getMessage());
                                        if (fileInputStream != null) {
                                            try {
                                                fileInputStream.close();
                                            } catch (IOException e7) {
                                                StringBuilder b6 = r5.b("close fileIuputStream error");
                                                b6.append(e7.getMessage());
                                                ic2.lite_case("openSDK_LOG.Util", b6.toString());
                                            }
                                        }
                                        if (fileOutputStream != null) {
                                            try {
                                                fileOutputStream.close();
                                            } catch (IOException e8) {
                                                StringBuilder b7 = r5.b("close fileOutputStream error");
                                                b7.append(e8.getMessage());
                                                ic2.lite_case("openSDK_LOG.Util", b7.toString());
                                            }
                                        }
                                        if (parcelFileDescriptor != null) {
                                            try {
                                                parcelFileDescriptor.close();
                                            } catch (IOException e9) {
                                                StringBuilder b8 = r5.b("close ParcelFileDescriptor error");
                                                b8.append(e9.getMessage());
                                                ic2.lite_case("openSDK_LOG.Util", b8.toString());
                                            }
                                        }
                                        return null;
                                    }
                                } catch (Throwable th2) {
                                    th = th2;
                                    fileInputStream2 = fileInputStream;
                                    if (fileInputStream2 != null) {
                                        try {
                                            fileInputStream2.close();
                                        } catch (IOException e10) {
                                            StringBuilder b9 = r5.b("close fileIuputStream error");
                                            b9.append(e10.getMessage());
                                            ic2.lite_case("openSDK_LOG.Util", b9.toString());
                                        }
                                    }
                                    if (fileOutputStream != null) {
                                        try {
                                            fileOutputStream.close();
                                        } catch (IOException e11) {
                                            StringBuilder b10 = r5.b("close fileOutputStream error");
                                            b10.append(e11.getMessage());
                                            ic2.lite_case("openSDK_LOG.Util", b10.toString());
                                        }
                                    }
                                    if (parcelFileDescriptor != null) {
                                        try {
                                            parcelFileDescriptor.close();
                                            throw th;
                                        } catch (IOException e12) {
                                            StringBuilder b11 = r5.b("close ParcelFileDescriptor error");
                                            b11.append(e12.getMessage());
                                            ic2.lite_case("openSDK_LOG.Util", b11.toString());
                                            throw th;
                                        }
                                    }
                                    throw th;
                                }
                            } catch (Exception e13) {
                                e = e13;
                                fileOutputStream = null;
                            } catch (Throwable th3) {
                                th = th3;
                                fileOutputStream = null;
                                fileInputStream2 = fileInputStream;
                                if (fileInputStream2 != null) {
                                }
                                if (fileOutputStream != null) {
                                }
                                if (parcelFileDescriptor != null) {
                                }
                            }
                        } catch (Exception e14) {
                            e = e14;
                            fileOutputStream = null;
                            fileInputStream = null;
                        } catch (Throwable th4) {
                            th = th4;
                            fileOutputStream = null;
                            if (fileInputStream2 != null) {
                            }
                            if (fileOutputStream != null) {
                            }
                            if (parcelFileDescriptor != null) {
                            }
                        }
                    } catch (Exception e15) {
                        e = e15;
                        fileOutputStream = null;
                        parcelFileDescriptor = null;
                        fileInputStream = null;
                    } catch (Throwable th5) {
                        th = th5;
                        fileOutputStream = null;
                        parcelFileDescriptor = null;
                    }
                }
            }
            return null;
        } catch (Exception e16) {
            e = e16;
            cursor = null;
        }
    }

    public static String lite_switch(Context context, String str) {
        if (context == null) {
            return "";
        }
        lite_throw(context, str);
        return lite_do;
    }

    public static String lite_synchronized(String str) {
        if (str == null) {
            return null;
        }
        return Base64.encodeToString(lite_float(str.getBytes(), "JCPTZXEZ"), 3);
    }

    public static JSONObject lite_this(JSONObject jSONObject, String str) {
        if (jSONObject == null) {
            jSONObject = new JSONObject();
        }
        if (str != null) {
            for (String str2 : str.split("&")) {
                String[] split = str2.split(ContainerUtils.KEY_VALUE_DELIMITER);
                if (split.length == 2) {
                    try {
                        split[0] = URLDecoder.decode(split[0]);
                        split[1] = URLDecoder.decode(split[1]);
                    } catch (Exception unused) {
                    }
                    try {
                        jSONObject.put(split[0], split[1]);
                    } catch (JSONException e) {
                        StringBuilder b2 = r5.b("decodeUrlToJson has exception: ");
                        b2.append(e.getMessage());
                        ic2.lite_case("openSDK_LOG.Util", b2.toString());
                    }
                }
            }
        }
        return jSONObject;
    }

    public static void lite_throw(Context context, String str) {
        if (context == null) {
            return;
        }
        try {
            PackageInfo packageInfo = context.getPackageManager().getPackageInfo(str, 0);
            String str2 = packageInfo.versionName;
            lite_if = str2;
            lite_do = str2.substring(0, str2.lastIndexOf(46));
            String str3 = lite_if;
            lite_int = str3.substring(str3.lastIndexOf(46) + 1, lite_if.length());
            lite_new = packageInfo.versionCode;
        } catch (PackageManager.NameNotFoundException e) {
            StringBuilder b2 = r5.b("getPackageInfo has exception: ");
            b2.append(e.getMessage());
            ic2.lite_case("openSDK_LOG.Util", b2.toString());
        } catch (Exception e2) {
            StringBuilder b3 = r5.b("getPackageInfo has exception: ");
            b3.append(e2.getMessage());
            ic2.lite_case("openSDK_LOG.Util", b3.toString());
        }
    }

    public static JSONObject lite_throws(String str) throws JSONException {
        if (str.equals(vw1.f1550a)) {
            str = "{value : false}";
        }
        if (str.equals(vw1.lite_synchronized)) {
            str = "{value : true}";
        }
        if (str.contains("allback(")) {
            str = str.replaceFirst("[\\s\\S]*allback\\(([\\s\\S]*)\\);[^\\)]*\\z", "$1").trim();
        }
        if (str.contains("online[0]=")) {
            StringBuilder b2 = r5.b("{online:");
            b2.append(str.charAt(str.length() - 2));
            b2.append(e4.lite_int);
            str = b2.toString();
        }
        return new JSONObject(str);
    }

    public static boolean lite_transient(String str) {
        return str != null && new File(str).exists();
    }

    public static Bundle lite_try(String str, String str2, String str3, String str4, String str5, String str6, String str7, String str8, String str9, String str10, String str11, String str12) {
        Bundle bundle = new Bundle();
        bundle.putString("openid", str);
        bundle.putString("report_type", str2);
        bundle.putString("act_type", str3);
        bundle.putString("via", str4);
        bundle.putString("app_id", str5);
        bundle.putString("result", str6);
        bundle.putString("type", str7);
        bundle.putString("login_status", str8);
        bundle.putString("need_user_auth", str9);
        bundle.putString("to_uin", str10);
        bundle.putString("call_source", str11);
        bundle.putString("to_type", str12);
        return bundle;
    }

    public static void lite_void(Context context, String str, long j, String str2) {
        Bundle bundle = new Bundle();
        bundle.putString("appid_for_getting_config", str2);
        bundle.putString("strValue", str2);
        bundle.putString("nValue", str);
        bundle.putString("qver", hb2.lite_else);
        if (j != 0) {
            bundle.putLong("elt", j);
        }
        new a(context, bundle).start();
    }

    public static boolean lite_volatile(Context context, String str) {
        boolean z = !lite_default(context) || ad2.lite_byte(context, hb2.lite_int) == null;
        if (z && ad2.lite_byte(context, hb2.lite_new) != null) {
            z = false;
        }
        if (z && ad2.lite_byte(context, hb2.lite_byte) != null) {
            z = false;
        }
        if (z) {
            return ad2.lite_void(context, str) < 0;
        }
        return z;
    }

    public static boolean lite_while() {
        return (Environment.getExternalStorageState().equals("mounted") ? Environment.getExternalStorageDirectory() : null) != null;
    }
}