68 lines
2.3 KiB
Java
68 lines
2.3 KiB
Java
package com.google.android.gms.common.util;
|
|
|
|
import android.os.Process;
|
|
import android.os.StrictMode;
|
|
import com.google.android.gms.common.internal.Preconditions;
|
|
import java.io.BufferedReader;
|
|
import java.io.FileReader;
|
|
import java.io.IOException;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class ProcessUtils {
|
|
private static String zza;
|
|
private static int zzb;
|
|
|
|
public static String getMyProcessName() {
|
|
String str;
|
|
if (zza == null) {
|
|
int i = zzb;
|
|
if (i == 0) {
|
|
i = Process.myPid();
|
|
zzb = i;
|
|
}
|
|
String str2 = null;
|
|
String str3 = null;
|
|
BufferedReader bufferedReader = null;
|
|
BufferedReader bufferedReader2 = null;
|
|
if (i > 0) {
|
|
try {
|
|
StringBuilder sb = new StringBuilder("/proc/");
|
|
sb.append(i);
|
|
sb.append("/cmdline");
|
|
String obj = sb.toString();
|
|
StrictMode.ThreadPolicy allowThreadDiskReads = StrictMode.allowThreadDiskReads();
|
|
try {
|
|
BufferedReader bufferedReader3 = new BufferedReader(new FileReader(obj));
|
|
try {
|
|
String readLine = bufferedReader3.readLine();
|
|
Preconditions.checkNotNull(readLine);
|
|
str3 = readLine.trim();
|
|
} catch (IOException unused) {
|
|
} catch (Throwable th) {
|
|
th = th;
|
|
bufferedReader2 = bufferedReader3;
|
|
IOUtils.closeQuietly(bufferedReader2);
|
|
throw th;
|
|
}
|
|
str = str3;
|
|
bufferedReader = bufferedReader3;
|
|
} finally {
|
|
StrictMode.setThreadPolicy(allowThreadDiskReads);
|
|
}
|
|
} catch (IOException unused2) {
|
|
str = null;
|
|
} catch (Throwable th2) {
|
|
th = th2;
|
|
}
|
|
IOUtils.closeQuietly(bufferedReader);
|
|
str2 = str;
|
|
}
|
|
zza = str2;
|
|
}
|
|
return zza;
|
|
}
|
|
|
|
private ProcessUtils() {
|
|
}
|
|
}
|