73 lines
2.8 KiB
Java
73 lines
2.8 KiB
Java
package c.i.a.f.e;
|
|
|
|
import android.annotation.TargetApi;
|
|
import android.content.Context;
|
|
import android.content.pm.ApplicationInfo;
|
|
import android.content.pm.PackageInfo;
|
|
import android.content.pm.PackageInstaller;
|
|
import android.content.pm.PackageManager;
|
|
import android.os.Build;
|
|
import android.os.Bundle;
|
|
import android.os.UserManager;
|
|
import android.util.Log;
|
|
import androidx.annotation.RecentlyNonNull;
|
|
import c.i.a.f.e.p.b;
|
|
import java.util.Objects;
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
/* compiled from: com.google.android.gms:play-services-basement@@17.4.0 */
|
|
public class e {
|
|
public static boolean a = false;
|
|
public static boolean b = false;
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public static final AtomicBoolean f1030c = new AtomicBoolean();
|
|
public static final AtomicBoolean d = new AtomicBoolean();
|
|
|
|
@RecentlyNonNull
|
|
public static boolean a(@RecentlyNonNull Context context) {
|
|
boolean z2 = true;
|
|
if (!b) {
|
|
try {
|
|
PackageInfo packageInfo = b.a(context).a.getPackageManager().getPackageInfo("com.google.android.gms", 64);
|
|
f.a(context);
|
|
if (packageInfo == null || f.d(packageInfo, false) || !f.d(packageInfo, true)) {
|
|
a = false;
|
|
} else {
|
|
a = true;
|
|
}
|
|
} catch (PackageManager.NameNotFoundException e) {
|
|
Log.w("GooglePlayServicesUtil", "Cannot find Google Play services package name.", e);
|
|
} finally {
|
|
b = z2;
|
|
}
|
|
}
|
|
return a || !"user".equals(Build.TYPE);
|
|
}
|
|
|
|
@TargetApi(21)
|
|
public static boolean b(Context context, String str) {
|
|
boolean equals = str.equals("com.google.android.gms");
|
|
try {
|
|
for (PackageInstaller.SessionInfo sessionInfo : context.getPackageManager().getPackageInstaller().getAllSessions()) {
|
|
if (str.equals(sessionInfo.getAppPackageName())) {
|
|
return true;
|
|
}
|
|
}
|
|
ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(str, 8192);
|
|
if (equals) {
|
|
return applicationInfo.enabled;
|
|
}
|
|
if (applicationInfo.enabled) {
|
|
Object systemService = context.getSystemService("user");
|
|
Objects.requireNonNull(systemService, "null reference");
|
|
Bundle applicationRestrictions = ((UserManager) systemService).getApplicationRestrictions(context.getPackageName());
|
|
if (!(applicationRestrictions != null && "true".equals(applicationRestrictions.getString("restricted_profile")))) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
} catch (Exception unused) {
|
|
}
|
|
}
|
|
}
|