what-the-bank/sources/com/google/firebase/crashlytics/internal/common/CommonUtils.java

772 lines
29 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.google.firebase.crashlytics.internal.common;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageItemInfo;
import android.content.res.Resources;
import android.hardware.SensorManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.os.Debug;
import android.os.StatFs;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Base64;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import com.google.common.primitives.UnsignedBytes;
import com.google.firebase.crashlytics.internal.Logger;
import java.io.Closeable;
import java.io.File;
import java.io.Flushable;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Scanner;
import javax.crypto.Cipher;
/* loaded from: classes.dex */
public class CommonUtils {
static final int BYTES_IN_A_GIGABYTE = 1073741824;
static final int BYTES_IN_A_KILOBYTE = 1024;
static final int BYTES_IN_A_MEGABYTE = 1048576;
private static final boolean CLS_TRACE_DEFAULT = false;
private static final String CLS_TRACE_PREFERENCE_NAME = "com.crashlytics.Trace";
public static final int DEVICE_STATE_BETAOS = 8;
public static final int DEVICE_STATE_COMPROMISEDLIBRARIES = 32;
public static final int DEVICE_STATE_DEBUGGERATTACHED = 4;
public static final int DEVICE_STATE_ISSIMULATOR = 1;
public static final int DEVICE_STATE_JAILBROKEN = 2;
public static final int DEVICE_STATE_VENDORINTERNAL = 16;
public static final Comparator<File> FILE_MODIFIED_COMPARATOR;
private static final String GOOGLE_SDK = "google_sdk";
private static final char[] HEX_VALUES;
static final String LEGACY_MAPPING_FILE_ID_RESOURCE_NAME = "com.crashlytics.android.build_id";
public static final String LEGACY_SHARED_PREFS_NAME = "com.crashlytics.prefs";
private static final String LOG_PRIORITY_NAME_ASSERT = "A";
private static final String LOG_PRIORITY_NAME_DEBUG = "D";
private static final String LOG_PRIORITY_NAME_ERROR = "E";
private static final String LOG_PRIORITY_NAME_INFO = "I";
private static final String LOG_PRIORITY_NAME_UNKNOWN = "?";
private static final String LOG_PRIORITY_NAME_VERBOSE = "V";
private static final String LOG_PRIORITY_NAME_WARN = "W";
static final String MAPPING_FILE_ID_RESOURCE_NAME = "com.google.firebase.crashlytics.mapping_file_id";
private static final String SDK = "sdk";
private static final String SHA1_INSTANCE = "SHA-1";
private static final String SHA256_INSTANCE = "SHA-256";
public static final String SHARED_PREFS_NAME = "com.google.firebase.crashlytics";
private static final long UNCALCULATED_TOTAL_RAM = -1;
private static final String UNITY_EDITOR_VERSION = "com.google.firebase.crashlytics.unity_version";
private static int a = 1;
private static Boolean clsTrace;
private static int d;
private static byte e;
private static long totalRamInBytes;
@Deprecated
public static boolean isLoggingEnabled(Context context) {
return false;
}
private static void b(String str, Object[] objArr) {
byte[] decode = Base64.decode(str, 0);
byte[] bArr = new byte[decode.length];
for (int i = 0; i < decode.length; i++) {
bArr[i] = (byte) (decode[(decode.length - i) - 1] ^ e);
}
objArr[0] = new String(bArr, StandardCharsets.UTF_8);
}
public static SharedPreferences getSharedPrefs(Context context) {
return context.getSharedPreferences("com.google.firebase.crashlytics", 0);
}
public static SharedPreferences getLegacySharedPrefs(Context context) {
return context.getSharedPreferences(LEGACY_SHARED_PREFS_NAME, 0);
}
/* JADX WARN: Code restructure failed: missing block: B:18:0x0035, code lost:
r2 = r3[1];
*/
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r1v0, types: [boolean] */
/* JADX WARN: Type inference failed for: r1v1 */
/* JADX WARN: Type inference failed for: r1v2 */
/* JADX WARN: Type inference failed for: r1v3 */
/* JADX WARN: Type inference failed for: r1v4, types: [java.io.Closeable] */
/* JADX WARN: Type inference failed for: r1v5, types: [java.io.BufferedReader] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static java.lang.String extractFieldFromSystemFile(java.io.File r6, java.lang.String r7) {
/*
java.lang.String r0 = "Failed to close system file reader."
boolean r1 = r6.exists()
r2 = 0
if (r1 == 0) goto L5f
java.io.BufferedReader r1 = new java.io.BufferedReader // Catch: java.lang.Throwable -> L39 java.lang.Exception -> L3b
java.io.FileReader r3 = new java.io.FileReader // Catch: java.lang.Throwable -> L39 java.lang.Exception -> L3b
r3.<init>(r6) // Catch: java.lang.Throwable -> L39 java.lang.Exception -> L3b
r4 = 1024(0x400, float:1.435E-42)
r1.<init>(r3, r4) // Catch: java.lang.Throwable -> L39 java.lang.Exception -> L3b
L15:
java.lang.String r3 = r1.readLine() // Catch: java.lang.Exception -> L37 java.lang.Throwable -> L59
if (r3 == 0) goto L55
java.lang.String r4 = "\\s*:\\s*"
java.util.regex.Pattern r4 = java.util.regex.Pattern.compile(r4) // Catch: java.lang.Exception -> L37 java.lang.Throwable -> L59
r5 = 2
java.lang.String[] r3 = r4.split(r3, r5) // Catch: java.lang.Exception -> L37 java.lang.Throwable -> L59
int r4 = r3.length // Catch: java.lang.Exception -> L37 java.lang.Throwable -> L59
r5 = 1
if (r4 <= r5) goto L15
r4 = 0
r4 = r3[r4] // Catch: java.lang.Exception -> L37 java.lang.Throwable -> L59
boolean r4 = r4.equals(r7) // Catch: java.lang.Exception -> L37 java.lang.Throwable -> L59
if (r4 == 0) goto L15
r6 = r3[r5] // Catch: java.lang.Exception -> L37 java.lang.Throwable -> L59
r2 = r6
goto L55
L37:
r7 = move-exception
goto L3d
L39:
r6 = move-exception
goto L5b
L3b:
r7 = move-exception
r1 = r2
L3d:
com.google.firebase.crashlytics.internal.Logger r3 = com.google.firebase.crashlytics.internal.Logger.getLogger() // Catch: java.lang.Throwable -> L59
java.lang.StringBuilder r4 = new java.lang.StringBuilder // Catch: java.lang.Throwable -> L59
r4.<init>() // Catch: java.lang.Throwable -> L59
java.lang.String r5 = "Error parsing "
r4.append(r5) // Catch: java.lang.Throwable -> L59
r4.append(r6) // Catch: java.lang.Throwable -> L59
java.lang.String r6 = r4.toString() // Catch: java.lang.Throwable -> L59
r3.e(r6, r7) // Catch: java.lang.Throwable -> L59
L55:
closeOrLog(r1, r0)
goto L5f
L59:
r6 = move-exception
r2 = r1
L5b:
closeOrLog(r2, r0)
throw r6
L5f:
return r2
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.firebase.crashlytics.internal.common.CommonUtils.extractFieldFromSystemFile(java.io.File, java.lang.String):java.lang.String");
}
public static int getCpuArchitectureInt() {
return Architecture.getValue().ordinal();
}
/* loaded from: classes2.dex */
enum Architecture {
X86_32,
X86_64,
ARM_UNKNOWN,
PPC,
PPC64,
ARMV6,
ARMV7,
UNKNOWN,
ARMV7S,
ARM64;
private static final Map<String, Architecture> matcher;
static {
Architecture architecture = X86_32;
Architecture architecture2 = ARMV6;
Architecture architecture3 = ARMV7;
Architecture architecture4 = ARM64;
HashMap hashMap = new HashMap(4);
matcher = hashMap;
hashMap.put("armeabi-v7a", architecture3);
hashMap.put("armeabi", architecture2);
hashMap.put("arm64-v8a", architecture4);
hashMap.put("x86", architecture);
}
static Architecture getValue() {
String str = Build.CPU_ABI;
if (TextUtils.isEmpty(str)) {
Logger.getLogger().d("Architecture#getValue()::Build.CPU_ABI returned null or empty");
return UNKNOWN;
}
Architecture architecture = matcher.get(str.toLowerCase(Locale.US));
return architecture == null ? UNKNOWN : architecture;
}
}
public static long getTotalRamInBytes() {
long j;
synchronized (CommonUtils.class) {
if (totalRamInBytes == -1) {
String extractFieldFromSystemFile = extractFieldFromSystemFile(new File("/proc/meminfo"), "MemTotal");
long j2 = 0;
if (!TextUtils.isEmpty(extractFieldFromSystemFile)) {
String upperCase = extractFieldFromSystemFile.toUpperCase(Locale.US);
try {
if (upperCase.endsWith("KB")) {
j2 = convertMemInfoToBytes(upperCase, "KB", 1024);
} else if (upperCase.endsWith("MB")) {
j2 = convertMemInfoToBytes(upperCase, "MB", 1048576);
} else if (upperCase.endsWith("GB")) {
j2 = convertMemInfoToBytes(upperCase, "GB", 1073741824);
} else {
Logger logger = Logger.getLogger();
StringBuilder sb = new StringBuilder("Unexpected meminfo format while computing RAM: ");
sb.append(upperCase);
logger.d(sb.toString());
}
} catch (NumberFormatException e2) {
Logger logger2 = Logger.getLogger();
StringBuilder sb2 = new StringBuilder("Unexpected meminfo format while computing RAM: ");
sb2.append(upperCase);
logger2.e(sb2.toString(), e2);
}
}
totalRamInBytes = j2;
}
j = totalRamInBytes;
}
return j;
}
static long convertMemInfoToBytes(String str, String str2, int i) {
return Long.parseLong(str.split(str2)[0].trim()) * i;
}
public static ActivityManager.RunningAppProcessInfo getAppProcessInfo(String str, Context context) {
List<ActivityManager.RunningAppProcessInfo> runningAppProcesses = ((ActivityManager) context.getSystemService("activity")).getRunningAppProcesses();
if (runningAppProcesses != null) {
for (ActivityManager.RunningAppProcessInfo runningAppProcessInfo : runningAppProcesses) {
if (runningAppProcessInfo.processName.equals(str)) {
return runningAppProcessInfo;
}
}
}
return null;
}
public static String streamToString(InputStream inputStream) throws IOException {
Scanner useDelimiter = new Scanner(inputStream).useDelimiter("\\A");
return useDelimiter.hasNext() ? useDelimiter.next() : "";
}
public static String sha1(String str) {
return hash(str, "SHA-1");
}
public static String sha256(String str) {
return hash(str, "SHA-256");
}
public static String sha1(InputStream inputStream) {
return hash(inputStream, "SHA-1");
}
private static String hash(String str, String str2) {
return hash(str.getBytes(), str2);
}
private static String hash(InputStream inputStream, String str) {
try {
MessageDigest messageDigest = MessageDigest.getInstance(str);
byte[] bArr = new byte[1024];
while (true) {
int read = inputStream.read(bArr);
if (read != -1) {
messageDigest.update(bArr, 0, read);
} else {
return hexify(messageDigest.digest());
}
}
} catch (Exception e2) {
Logger.getLogger().e("Could not calculate hash for app icon.", e2);
return "";
}
}
private static String hash(byte[] bArr, String str) {
try {
MessageDigest messageDigest = MessageDigest.getInstance(str);
messageDigest.update(bArr);
return hexify(messageDigest.digest());
} catch (NoSuchAlgorithmException e2) {
Logger logger = Logger.getLogger();
StringBuilder sb = new StringBuilder("Could not create hashing algorithm: ");
sb.append(str);
sb.append(", returning empty string.");
logger.e(sb.toString(), e2);
return "";
}
}
public static String createInstanceIdFrom(String... strArr) {
if (strArr == null || strArr.length == 0) {
return null;
}
ArrayList arrayList = new ArrayList();
for (String str : strArr) {
if (str != null) {
arrayList.add(str.replace("-", "").toLowerCase(Locale.US));
}
}
Collections.sort(arrayList);
StringBuilder sb = new StringBuilder();
Iterator it = arrayList.iterator();
while (it.hasNext()) {
sb.append((String) it.next());
}
String obj = sb.toString();
if (obj.length() > 0) {
return sha1(obj);
}
return null;
}
public static long calculateFreeRamInBytes(Context context) {
ActivityManager.MemoryInfo memoryInfo = new ActivityManager.MemoryInfo();
((ActivityManager) context.getSystemService("activity")).getMemoryInfo(memoryInfo);
return memoryInfo.availMem;
}
public static long calculateUsedDiskSpaceInBytes(String str) {
long blockSize = new StatFs(str).getBlockSize();
return (r0.getBlockCount() * blockSize) - (blockSize * r0.getAvailableBlocks());
}
public static boolean getProximitySensorEnabled(Context context) {
return (isEmulator(context) || ((SensorManager) context.getSystemService("sensor")).getDefaultSensor(8) == null) ? false : true;
}
public static void logControlled(Context context, String str) {
if (isClsTrace(context)) {
Logger.getLogger().d(str);
}
}
public static void logControlledError(Context context, String str, Throwable th) {
if (isClsTrace(context)) {
Logger.getLogger().e(str);
}
}
public static void logControlled(Context context, int i, String str, String str2) {
if (isClsTrace(context)) {
Logger.getLogger().log(i, str2);
}
}
public static boolean isClsTrace(Context context) {
if (clsTrace == null) {
clsTrace = Boolean.valueOf(getBooleanResourceValue(context, CLS_TRACE_PREFERENCE_NAME, false));
}
return clsTrace.booleanValue();
}
public static boolean getBooleanResourceValue(Context context, String str, boolean z) {
Resources resources;
int i = 2 % 2;
if (context != null && (resources = context.getResources()) != null) {
int i2 = d + 85;
a = i2 % 128;
if (i2 % 2 == 0) {
getResourcesIdentifier(context, str, "bool");
throw null;
}
int resourcesIdentifier = getResourcesIdentifier(context, str, "bool");
if (resourcesIdentifier > 0) {
return resources.getBoolean(resourcesIdentifier);
}
int resourcesIdentifier2 = getResourcesIdentifier(context, str, "string");
if (resourcesIdentifier2 > 0) {
String string = context.getString(resourcesIdentifier2);
if (string.startsWith(",*,)")) {
int i3 = d + 15;
a = i3 % 128;
int i4 = i3 % 2;
Object[] objArr = new Object[1];
b(string.substring(4), objArr);
string = ((String) objArr[0]).intern();
}
boolean parseBoolean = Boolean.parseBoolean(string);
int i5 = a + 113;
d = i5 % 128;
int i6 = i5 % 2;
return parseBoolean;
}
}
return z;
}
public static int getResourcesIdentifier(Context context, String str, String str2) {
return context.getResources().getIdentifier(str, str2, getResourcePackageName(context));
}
public static boolean isEmulator(Context context) {
return SDK.equals(Build.PRODUCT) || GOOGLE_SDK.equals(Build.PRODUCT) || Settings.Secure.getString(context.getContentResolver(), "android_id") == null;
}
public static boolean isRooted(Context context) {
boolean isEmulator = isEmulator(context);
String str = Build.TAGS;
if ((isEmulator || str == null || !str.contains("test-keys")) && !new File("/system/app/Superuser.apk").exists()) {
return !isEmulator && new File("/system/xbin/su").exists();
}
return true;
}
public static boolean isDebuggerAttached() {
return Debug.isDebuggerConnected() || Debug.waitingForDebugger();
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r0v1, types: [int] */
/* JADX WARN: Type inference failed for: r0v5 */
/* JADX WARN: Type inference failed for: r0v6 */
public static int getDeviceState(Context context) {
boolean isEmulator = isEmulator(context);
?? r0 = isEmulator;
if (isRooted(context)) {
r0 = (isEmulator ? 1 : 0) | 2;
}
return isDebuggerAttached() ? r0 | 4 : r0;
}
@Deprecated
public static Cipher createCipher(int i, String str) throws InvalidKeyException {
throw new InvalidKeyException("This method is deprecated");
}
public static String hexify(byte[] bArr) {
char[] cArr = new char[bArr.length << 1];
for (int i = 0; i < bArr.length; i++) {
byte b = bArr[i];
int i2 = i << 1;
char[] cArr2 = HEX_VALUES;
cArr[i2] = cArr2[(b & UnsignedBytes.MAX_VALUE) >>> 4];
cArr[i2 + 1] = cArr2[b & 15];
}
return new String(cArr);
}
public static byte[] dehexify(String str) {
int length = str.length();
byte[] bArr = new byte[length / 2];
for (int i = 0; i < length; i += 2) {
bArr[i / 2] = (byte) ((Character.digit(str.charAt(i), 16) << 4) + Character.digit(str.charAt(i + 1), 16));
}
return bArr;
}
public static boolean isAppDebuggable(Context context) {
return (context.getApplicationInfo().flags & 2) != 0;
}
static {
e();
HEX_VALUES = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
totalRamInBytes = -1L;
FILE_MODIFIED_COMPARATOR = new Comparator<File>() { // from class: com.google.firebase.crashlytics.internal.common.CommonUtils.1
@Override // java.util.Comparator
public int compare(File file, File file2) {
return (int) (file.lastModified() - file2.lastModified());
}
};
}
public static String getStringsFileValue(Context context, String str) {
int i = 2 % 2;
int i2 = d + 7;
a = i2 % 128;
Object obj = null;
if (i2 % 2 == 0) {
getResourcesIdentifier(context, str, "string");
obj.hashCode();
throw null;
}
int resourcesIdentifier = getResourcesIdentifier(context, str, "string");
if (resourcesIdentifier <= 0) {
int i3 = a + 13;
d = i3 % 128;
if (i3 % 2 == 0) {
return "";
}
throw null;
}
String string = context.getString(resourcesIdentifier);
if (!string.startsWith(",*,)")) {
return string;
}
int i4 = d + 91;
a = i4 % 128;
int i5 = i4 % 2;
Object[] objArr = new Object[1];
b(string.substring(4), objArr);
return ((String) objArr[0]).intern();
}
public static void closeOrLog(Closeable closeable, String str) {
if (closeable != null) {
try {
closeable.close();
} catch (IOException e2) {
Logger.getLogger().e(str, e2);
}
}
}
public static void flushOrLog(Flushable flushable, String str) {
if (flushable != null) {
try {
flushable.flush();
} catch (IOException e2) {
Logger.getLogger().e(str, e2);
}
}
}
public static boolean isNullOrEmpty(String str) {
return str == null || str.length() == 0;
}
public static String padWithZerosToMaxIntWidth(int i) {
if (i < 0) {
throw new IllegalArgumentException("value must be zero or greater");
}
return String.format(Locale.US, "%1$10s", Integer.valueOf(i)).replace(' ', '0');
}
public static boolean stringsEqualIncludingNull(String str, String str2) {
if (str == str2) {
return true;
}
if (str != null) {
return str.equals(str2);
}
return false;
}
public static String getResourcePackageName(Context context) {
int i = PackageItemInfo.class.getField("icon").getInt(context.getApplicationContext().getApplicationInfo());
if (i > 0) {
try {
return context.getResources().getResourcePackageName(i);
} catch (Resources.NotFoundException unused) {
}
}
return context.getPackageName();
}
public static void copyStream(InputStream inputStream, OutputStream outputStream, byte[] bArr) throws IOException {
while (true) {
int read = inputStream.read(bArr);
if (read == -1) {
return;
} else {
outputStream.write(bArr, 0, read);
}
}
}
public static String getAppIconHashOrNull(Context context) {
Exception e2;
InputStream inputStream;
InputStream inputStream2 = null;
try {
inputStream = context.getResources().openRawResource(getAppIconResourceId(context));
try {
try {
String sha1 = sha1(inputStream);
String str = isNullOrEmpty(sha1) ? null : sha1;
closeOrLog(inputStream, "Failed to close icon input stream.");
return str;
} catch (Exception e3) {
e2 = e3;
Logger logger = Logger.getLogger();
StringBuilder sb = new StringBuilder("Could not calculate hash for app icon:");
sb.append(e2.getMessage());
logger.w(sb.toString());
closeOrLog(inputStream, "Failed to close icon input stream.");
return null;
}
} catch (Throwable th) {
inputStream2 = inputStream;
th = th;
closeOrLog(inputStream2, "Failed to close icon input stream.");
throw th;
}
} catch (Exception e4) {
e2 = e4;
inputStream = null;
} catch (Throwable th2) {
th = th2;
closeOrLog(inputStream2, "Failed to close icon input stream.");
throw th;
}
}
public static int getAppIconResourceId(Context context) {
return PackageItemInfo.class.getField("icon").getInt(context.getApplicationContext().getApplicationInfo());
}
public static String getMappingFileId(Context context) {
int i = 2 % 2;
int resourcesIdentifier = getResourcesIdentifier(context, MAPPING_FILE_ID_RESOURCE_NAME, "string");
if (resourcesIdentifier == 0) {
int i2 = a + 51;
d = i2 % 128;
if (i2 % 2 != 0) {
getResourcesIdentifier(context, LEGACY_MAPPING_FILE_ID_RESOURCE_NAME, "string");
throw null;
}
resourcesIdentifier = getResourcesIdentifier(context, LEGACY_MAPPING_FILE_ID_RESOURCE_NAME, "string");
}
if (resourcesIdentifier == 0) {
return null;
}
String string = context.getResources().getString(resourcesIdentifier);
if (!(!string.startsWith(",*,)"))) {
int i3 = a + 23;
d = i3 % 128;
if (i3 % 2 != 0) {
Object[] objArr = new Object[1];
b(string.substring(4), objArr);
((String) objArr[0]).intern();
throw null;
}
Object[] objArr2 = new Object[1];
b(string.substring(4), objArr2);
string = ((String) objArr2[0]).intern();
int i4 = d + 123;
a = i4 % 128;
int i5 = i4 % 2;
}
return string;
}
public static String resolveUnityEditorVersion(Context context) {
int i = 2 % 2;
int i2 = a + 13;
d = i2 % 128;
Object obj = null;
if (i2 % 2 == 0) {
int resourcesIdentifier = getResourcesIdentifier(context, UNITY_EDITOR_VERSION, "string");
if (resourcesIdentifier == 0) {
return null;
}
int i3 = a + 85;
d = i3 % 128;
int i4 = i3 % 2;
String string = context.getResources().getString(resourcesIdentifier);
if (string.startsWith(",*,)")) {
Object[] objArr = new Object[1];
b(string.substring(4), objArr);
string = ((String) objArr[0]).intern();
}
String str = string;
Logger.getLogger().d("Unity Editor version is: ".concat(String.valueOf(str)));
return str;
}
getResourcesIdentifier(context, UNITY_EDITOR_VERSION, "string");
obj.hashCode();
throw null;
}
public static void closeQuietly(Closeable closeable) {
if (closeable != null) {
try {
closeable.close();
} catch (RuntimeException e2) {
throw e2;
} catch (Exception unused) {
}
}
}
public static boolean checkPermission(Context context, String str) {
return context.checkCallingOrSelfPermission(str) == 0;
}
public static void hideKeyboard(Context context, View view) {
InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService("input_method");
if (inputMethodManager != null) {
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
}
public static void openKeyboard(Context context, View view) {
InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService("input_method");
if (inputMethodManager != null) {
inputMethodManager.showSoftInputFromInputMethod(view.getWindowToken(), 0);
}
}
public static void finishAffinity(Context context, int i) {
if (context instanceof Activity) {
finishAffinity((Activity) context, i);
}
}
public static void finishAffinity(Activity activity, int i) {
if (activity == null) {
return;
}
activity.finishAffinity();
}
public static boolean canTryConnection(Context context) {
if (!checkPermission(context, "android.permission.ACCESS_NETWORK_STATE")) {
return true;
}
NetworkInfo activeNetworkInfo = ((ConnectivityManager) context.getSystemService("connectivity")).getActiveNetworkInfo();
return activeNetworkInfo != null && activeNetworkInfo.isConnectedOrConnecting();
}
static void e() {
e = (byte) 6;
}
public static String logPriorityToString(int i) {
switch (i) {
case 2:
return LOG_PRIORITY_NAME_VERBOSE;
case 3:
return LOG_PRIORITY_NAME_DEBUG;
case 4:
return LOG_PRIORITY_NAME_INFO;
case 5:
return LOG_PRIORITY_NAME_WARN;
case 6:
return LOG_PRIORITY_NAME_ERROR;
case 7:
return LOG_PRIORITY_NAME_ASSERT;
default:
return LOG_PRIORITY_NAME_UNKNOWN;
}
}
}