Initial commit
This commit is contained in:
65
sources/com/google/android/gms/common/util/ProcessUtils.java
Normal file
65
sources/com/google/android/gms/common/util/ProcessUtils.java
Normal file
@@ -0,0 +1,65 @@
|
||||
package com.google.android.gms.common.util;
|
||||
|
||||
import android.os.Process;
|
||||
import android.os.StrictMode;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ProcessUtils {
|
||||
private static String a;
|
||||
private static int b;
|
||||
|
||||
public static String a() {
|
||||
if (a == null) {
|
||||
if (b == 0) {
|
||||
b = Process.myPid();
|
||||
}
|
||||
a = a(b);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
private static String a(int i) {
|
||||
BufferedReader bufferedReader;
|
||||
BufferedReader bufferedReader2 = null;
|
||||
String str = null;
|
||||
if (i <= 0) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
StringBuilder sb = new StringBuilder(25);
|
||||
sb.append("/proc/");
|
||||
sb.append(i);
|
||||
sb.append("/cmdline");
|
||||
bufferedReader = a(sb.toString());
|
||||
try {
|
||||
str = bufferedReader.readLine().trim();
|
||||
IOUtils.a(bufferedReader);
|
||||
} catch (IOException unused) {
|
||||
IOUtils.a(bufferedReader);
|
||||
return str;
|
||||
} catch (Throwable th) {
|
||||
bufferedReader2 = bufferedReader;
|
||||
th = th;
|
||||
IOUtils.a(bufferedReader2);
|
||||
throw th;
|
||||
}
|
||||
} catch (IOException unused2) {
|
||||
bufferedReader = null;
|
||||
} catch (Throwable th2) {
|
||||
th = th2;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
private static BufferedReader a(String str) throws IOException {
|
||||
StrictMode.ThreadPolicy allowThreadDiskReads = StrictMode.allowThreadDiskReads();
|
||||
try {
|
||||
return new BufferedReader(new FileReader(str));
|
||||
} finally {
|
||||
StrictMode.setThreadPolicy(allowThreadDiskReads);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user