- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
98 lines
2.4 KiB
Java
98 lines
2.4 KiB
Java
package com.google.android.gms.internal.measurement;
|
|
|
|
import android.annotation.TargetApi;
|
|
import android.content.Context;
|
|
import android.os.Process;
|
|
import android.os.UserManager;
|
|
import android.util.Log;
|
|
import androidx.annotation.ChecksSdkIntAtLeast;
|
|
import androidx.annotation.GuardedBy;
|
|
import androidx.annotation.Nullable;
|
|
import androidx.annotation.RequiresApi;
|
|
|
|
/* loaded from: classes3.dex */
|
|
public class zzgf {
|
|
|
|
@Nullable
|
|
@GuardedBy("DirectBootUtils.class")
|
|
private static UserManager zza;
|
|
private static volatile boolean zzb = !zza();
|
|
|
|
private zzgf() {
|
|
}
|
|
|
|
@ChecksSdkIntAtLeast(api = 24)
|
|
public static boolean zza() {
|
|
return true;
|
|
}
|
|
|
|
@RequiresApi(24)
|
|
@TargetApi(24)
|
|
private static boolean zzc(Context context) {
|
|
if (zzb) {
|
|
return true;
|
|
}
|
|
synchronized (zzgf.class) {
|
|
try {
|
|
if (zzb) {
|
|
return true;
|
|
}
|
|
boolean zzd = zzd(context);
|
|
if (zzd) {
|
|
zzb = zzd;
|
|
}
|
|
return zzd;
|
|
} catch (Throwable th) {
|
|
throw th;
|
|
}
|
|
}
|
|
}
|
|
|
|
@RequiresApi(24)
|
|
@TargetApi(24)
|
|
@GuardedBy("DirectBootUtils.class")
|
|
private static boolean zzd(Context context) {
|
|
boolean z;
|
|
boolean z2 = true;
|
|
int i = 1;
|
|
while (true) {
|
|
z = false;
|
|
if (i > 2) {
|
|
break;
|
|
}
|
|
if (zza == null) {
|
|
zza = (UserManager) context.getSystemService(UserManager.class);
|
|
}
|
|
UserManager userManager = zza;
|
|
if (userManager == null) {
|
|
return true;
|
|
}
|
|
try {
|
|
if (userManager.isUserUnlocked()) {
|
|
break;
|
|
}
|
|
if (userManager.isUserRunning(Process.myUserHandle())) {
|
|
z2 = false;
|
|
}
|
|
} catch (NullPointerException e) {
|
|
Log.w("DirectBootUtils", "Failed to check if user is unlocked.", e);
|
|
zza = null;
|
|
i++;
|
|
}
|
|
}
|
|
z = z2;
|
|
if (z) {
|
|
zza = null;
|
|
}
|
|
return z;
|
|
}
|
|
|
|
public static boolean zza(Context context) {
|
|
return zza() && !zzc(context);
|
|
}
|
|
|
|
public static boolean zzb(Context context) {
|
|
return !zza() || zzc(context);
|
|
}
|
|
}
|