76 lines
2.1 KiB
Java
76 lines
2.1 KiB
Java
package com.google.android.gms.internal.measurement;
|
|
|
|
import android.annotation.TargetApi;
|
|
import android.content.Context;
|
|
import android.os.Build;
|
|
import android.os.Process;
|
|
import android.os.UserManager;
|
|
import android.util.Log;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class zzrw {
|
|
private static volatile UserManager a;
|
|
private static volatile boolean b = !a();
|
|
|
|
private zzrw() {
|
|
}
|
|
|
|
public static boolean a() {
|
|
return Build.VERSION.SDK_INT >= 24;
|
|
}
|
|
|
|
@TargetApi(24)
|
|
private static boolean b(Context context) {
|
|
boolean z = b;
|
|
if (!z) {
|
|
boolean z2 = z;
|
|
for (int i = 1; i <= 2; i++) {
|
|
UserManager c = c(context);
|
|
if (c == null) {
|
|
b = true;
|
|
return true;
|
|
}
|
|
try {
|
|
if (!c.isUserUnlocked() && c.isUserRunning(Process.myUserHandle())) {
|
|
z2 = false;
|
|
b = z2;
|
|
break;
|
|
}
|
|
z2 = true;
|
|
b = z2;
|
|
break;
|
|
break;
|
|
} catch (NullPointerException e) {
|
|
Log.w("DirectBootUtils", "Failed to check if user is unlocked", e);
|
|
a = null;
|
|
}
|
|
}
|
|
z = z2;
|
|
if (z) {
|
|
a = null;
|
|
}
|
|
}
|
|
return z;
|
|
}
|
|
|
|
@TargetApi(24)
|
|
private static UserManager c(Context context) {
|
|
UserManager userManager = a;
|
|
if (userManager == null) {
|
|
synchronized (zzrw.class) {
|
|
userManager = a;
|
|
if (userManager == null) {
|
|
UserManager userManager2 = (UserManager) context.getSystemService(UserManager.class);
|
|
a = userManager2;
|
|
userManager = userManager2;
|
|
}
|
|
}
|
|
}
|
|
return userManager;
|
|
}
|
|
|
|
public static boolean a(Context context) {
|
|
return !a() || b(context);
|
|
}
|
|
}
|