136 lines
4.3 KiB
Java
136 lines
4.3 KiB
Java
package com.discord.utilities.device;
|
|
|
|
import android.content.Context;
|
|
import android.content.res.Resources;
|
|
import android.os.Build;
|
|
import android.provider.Settings;
|
|
import d0.g0.w;
|
|
import d0.t.m0;
|
|
import d0.z.d.m;
|
|
import java.util.Iterator;
|
|
import java.util.Set;
|
|
/* compiled from: DeviceUtils.kt */
|
|
public final class DeviceUtils {
|
|
public static final DeviceUtils INSTANCE = new DeviceUtils();
|
|
|
|
private DeviceUtils() {
|
|
}
|
|
|
|
public static /* synthetic */ boolean isDevice$default(DeviceUtils deviceUtils, String str, Integer num, String str2, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
str = null;
|
|
}
|
|
if ((i & 2) != 0) {
|
|
num = null;
|
|
}
|
|
if ((i & 4) != 0) {
|
|
str2 = null;
|
|
}
|
|
return deviceUtils.isDevice(str, num, str2);
|
|
}
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r1v0, resolved type: com.discord.utilities.device.DeviceUtils */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public static /* synthetic */ boolean isDevice$default(DeviceUtils deviceUtils, Set set, Set set2, Set set3, int i, Object obj) {
|
|
if ((i & 1) != 0) {
|
|
set = null;
|
|
}
|
|
if ((i & 2) != 0) {
|
|
set2 = null;
|
|
}
|
|
if ((i & 4) != 0) {
|
|
set3 = null;
|
|
}
|
|
return deviceUtils.isDevice(set, set2, set3);
|
|
}
|
|
|
|
public final boolean canDrawOverlays(Context context) {
|
|
m.checkNotNullParameter(context, "context");
|
|
return Build.VERSION.SDK_INT <= 22 || Settings.canDrawOverlays(context);
|
|
}
|
|
|
|
public final boolean isDevice(String str, Integer num, String str2) {
|
|
Set<String> set = null;
|
|
Set<String> of = str != null ? m0.setOf(str) : null;
|
|
Set<Integer> of2 = num != null ? m0.setOf(Integer.valueOf(num.intValue())) : null;
|
|
if (str2 != null) {
|
|
set = m0.setOf(str2);
|
|
}
|
|
return isDevice(of, of2, set);
|
|
}
|
|
|
|
public final boolean isDevice(Set<String> set, Set<Integer> set2, Set<String> set3) {
|
|
boolean z2;
|
|
boolean z3;
|
|
boolean z4;
|
|
boolean z5;
|
|
if (set == null) {
|
|
z2 = true;
|
|
} else {
|
|
if (!set.isEmpty()) {
|
|
Iterator<T> it = set.iterator();
|
|
while (true) {
|
|
if (!it.hasNext()) {
|
|
break;
|
|
}
|
|
String str = Build.MANUFACTURER;
|
|
m.checkNotNullExpressionValue(str, "Build.MANUFACTURER");
|
|
if (w.contains((CharSequence) str, (CharSequence) ((String) it.next()), true)) {
|
|
break;
|
|
}
|
|
}
|
|
z2 = true;
|
|
}
|
|
z2 = false;
|
|
}
|
|
if (set2 == null) {
|
|
z3 = true;
|
|
} else {
|
|
if (!set2.isEmpty()) {
|
|
Iterator<T> it2 = set2.iterator();
|
|
while (true) {
|
|
if (!it2.hasNext()) {
|
|
break;
|
|
}
|
|
if (Build.VERSION.SDK_INT == ((Number) it2.next()).intValue()) {
|
|
z5 = true;
|
|
continue;
|
|
} else {
|
|
z5 = false;
|
|
continue;
|
|
}
|
|
if (z5) {
|
|
break;
|
|
}
|
|
}
|
|
z3 = true;
|
|
}
|
|
z3 = false;
|
|
}
|
|
if (set3 == null) {
|
|
z4 = true;
|
|
} else {
|
|
if (!set3.isEmpty()) {
|
|
Iterator<T> it3 = set3.iterator();
|
|
while (true) {
|
|
if (!it3.hasNext()) {
|
|
break;
|
|
}
|
|
String str2 = Build.MODEL;
|
|
m.checkNotNullExpressionValue(str2, "Build.MODEL");
|
|
if (w.contains((CharSequence) str2, (CharSequence) ((String) it3.next()), true)) {
|
|
break;
|
|
}
|
|
}
|
|
z4 = true;
|
|
}
|
|
z4 = false;
|
|
}
|
|
return z2 && z3 && z4;
|
|
}
|
|
|
|
public final boolean isTablet(Resources resources) {
|
|
m.checkNotNullParameter(resources, "resources");
|
|
return (resources.getConfiguration().screenLayout & 15) >= 3;
|
|
}
|
|
}
|