180 lines
6.0 KiB
Java
180 lines
6.0 KiB
Java
package com.google.android.gms.common.util;
|
|
|
|
import android.content.Context;
|
|
import android.content.pm.PackageManager;
|
|
import android.content.res.Configuration;
|
|
import android.content.res.Resources;
|
|
import android.os.Build;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class DeviceProperties {
|
|
private static Boolean zza;
|
|
private static Boolean zzb;
|
|
private static Boolean zzc;
|
|
private static Boolean zzd;
|
|
private static Boolean zze;
|
|
private static Boolean zzf;
|
|
private static Boolean zzg;
|
|
private static Boolean zzh;
|
|
private static Boolean zzi;
|
|
private static Boolean zzj;
|
|
private static Boolean zzk;
|
|
private static Boolean zzl;
|
|
|
|
public static boolean isAuto(Context context) {
|
|
PackageManager packageManager = context.getPackageManager();
|
|
if (zzi == null) {
|
|
boolean z = false;
|
|
if (PlatformVersion.isAtLeastO() && packageManager.hasSystemFeature("android.hardware.type.automotive")) {
|
|
z = true;
|
|
}
|
|
zzi = Boolean.valueOf(z);
|
|
}
|
|
return zzi.booleanValue();
|
|
}
|
|
|
|
public static boolean isBstar(Context context) {
|
|
if (zzl == null) {
|
|
boolean z = false;
|
|
if (PlatformVersion.isAtLeastR() && context.getPackageManager().hasSystemFeature("com.google.android.play.feature.HPE_EXPERIENCE")) {
|
|
z = true;
|
|
}
|
|
zzl = Boolean.valueOf(z);
|
|
}
|
|
return zzl.booleanValue();
|
|
}
|
|
|
|
public static boolean isLatchsky(Context context) {
|
|
if (zzf == null) {
|
|
PackageManager packageManager = context.getPackageManager();
|
|
boolean z = false;
|
|
if (packageManager.hasSystemFeature("com.google.android.feature.services_updater") && packageManager.hasSystemFeature("cn.google.services")) {
|
|
z = true;
|
|
}
|
|
zzf = Boolean.valueOf(z);
|
|
}
|
|
return zzf.booleanValue();
|
|
}
|
|
|
|
public static boolean isPhone(Context context) {
|
|
if (zza == null) {
|
|
boolean z = false;
|
|
if (!isTablet(context) && !isWearable(context) && !zzb(context)) {
|
|
if (zzh == null) {
|
|
zzh = Boolean.valueOf(context.getPackageManager().hasSystemFeature("org.chromium.arc"));
|
|
}
|
|
if (!zzh.booleanValue() && !isAuto(context) && !isTv(context)) {
|
|
if (zzk == null) {
|
|
zzk = Boolean.valueOf(context.getPackageManager().hasSystemFeature("com.google.android.feature.AMATI_EXPERIENCE"));
|
|
}
|
|
if (!zzk.booleanValue() && !isBstar(context)) {
|
|
z = true;
|
|
}
|
|
}
|
|
}
|
|
zza = Boolean.valueOf(z);
|
|
}
|
|
return zza.booleanValue();
|
|
}
|
|
|
|
public static boolean isSevenInchTablet(Context context) {
|
|
return zzc(context.getResources());
|
|
}
|
|
|
|
public static boolean isSidewinder(Context context) {
|
|
return zza(context);
|
|
}
|
|
|
|
public static boolean isTablet(Context context) {
|
|
return isTablet(context.getResources());
|
|
}
|
|
|
|
public static boolean isTv(Context context) {
|
|
PackageManager packageManager = context.getPackageManager();
|
|
if (zzj == null) {
|
|
boolean z = true;
|
|
if (!packageManager.hasSystemFeature("com.google.android.tv") && !packageManager.hasSystemFeature("android.hardware.type.television") && !packageManager.hasSystemFeature("android.software.leanback")) {
|
|
z = false;
|
|
}
|
|
zzj = Boolean.valueOf(z);
|
|
}
|
|
return zzj.booleanValue();
|
|
}
|
|
|
|
public static boolean isUserBuild() {
|
|
return "user".equals(Build.TYPE);
|
|
}
|
|
|
|
public static boolean isWearable(Context context) {
|
|
PackageManager packageManager = context.getPackageManager();
|
|
if (zzd == null) {
|
|
boolean z = false;
|
|
if (PlatformVersion.isAtLeastKitKatWatch() && packageManager.hasSystemFeature("android.hardware.type.watch")) {
|
|
z = true;
|
|
}
|
|
zzd = Boolean.valueOf(z);
|
|
}
|
|
return zzd.booleanValue();
|
|
}
|
|
|
|
public static boolean isWearableWithoutPlayStore(Context context) {
|
|
if (isWearable(context) && !PlatformVersion.isAtLeastN()) {
|
|
return true;
|
|
}
|
|
if (zza(context)) {
|
|
return !PlatformVersion.isAtLeastO() || PlatformVersion.isAtLeastR();
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public static boolean zza(Context context) {
|
|
if (zze == null) {
|
|
boolean z = false;
|
|
if (PlatformVersion.isAtLeastLollipop() && context.getPackageManager().hasSystemFeature("cn.google")) {
|
|
z = true;
|
|
}
|
|
zze = Boolean.valueOf(z);
|
|
}
|
|
return zze.booleanValue();
|
|
}
|
|
|
|
public static boolean zzb(Context context) {
|
|
if (zzg == null) {
|
|
boolean z = true;
|
|
if (!context.getPackageManager().hasSystemFeature("android.hardware.type.iot") && !context.getPackageManager().hasSystemFeature("android.hardware.type.embedded")) {
|
|
z = false;
|
|
}
|
|
zzg = Boolean.valueOf(z);
|
|
}
|
|
return zzg.booleanValue();
|
|
}
|
|
|
|
public static boolean zzc(Resources resources) {
|
|
boolean z = false;
|
|
if (resources == null) {
|
|
return false;
|
|
}
|
|
if (zzc == null) {
|
|
Configuration configuration = resources.getConfiguration();
|
|
if ((configuration.screenLayout & 15) <= 3 && configuration.smallestScreenWidthDp >= 600) {
|
|
z = true;
|
|
}
|
|
zzc = Boolean.valueOf(z);
|
|
}
|
|
return zzc.booleanValue();
|
|
}
|
|
|
|
public static boolean isTablet(Resources resources) {
|
|
if (resources == null) {
|
|
return false;
|
|
}
|
|
if (zzb == null) {
|
|
zzb = Boolean.valueOf((resources.getConfiguration().screenLayout & 15) > 3 || zzc(resources));
|
|
}
|
|
return zzb.booleanValue();
|
|
}
|
|
|
|
private DeviceProperties() {
|
|
}
|
|
}
|