- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
229 lines
9.0 KiB
Java
229 lines
9.0 KiB
Java
package csdk.glucentralservices.devicetiers;
|
|
|
|
import android.content.Context;
|
|
import android.graphics.Point;
|
|
import android.text.TextUtils;
|
|
import csdk.glucentralservices.devicetiers.DeviceUtil;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public class DeviceTiers {
|
|
public static DeviceTier getDeviceTier(Context context) {
|
|
Point screenSize = DeviceUtil.getScreenSize(context);
|
|
return getDeviceTier(DeviceUtil.getCpuCount(), screenSize.x, screenSize.y);
|
|
}
|
|
|
|
public static DeviceTier getDeviceTier(int i, int i2, int i3) {
|
|
return detectQualitySetting(i, new Point(i2, i3));
|
|
}
|
|
|
|
public static DeviceTier detectQualitySetting(int i, Point point) {
|
|
DeviceUtil.GlesData glesData = DeviceUtil.getGlesData();
|
|
if (glesData == null) {
|
|
return fallback(1);
|
|
}
|
|
if (isGpuModel("PowerVR", glesData.gpuVendor, glesData.gpuRenderer)) {
|
|
return detectPowerVRQualitySetting(glesData.gpuRenderer, i, point, glesData.highestEsVersion);
|
|
}
|
|
if (isGpuModel("Adreno", glesData.gpuVendor, glesData.gpuRenderer)) {
|
|
return detectAdrenoQualitySetting(glesData.gpuRenderer, i, point, glesData.highestEsVersion);
|
|
}
|
|
if (isGpuModel("Mali", glesData.gpuVendor, glesData.gpuRenderer)) {
|
|
return detectMaliQualitySetting(glesData.gpuRenderer, i, point, glesData.highestEsVersion);
|
|
}
|
|
if (isGpuModel("NVIDIA Tegra", glesData.gpuVendor, glesData.gpuRenderer) || isGpuModel("ULP GeForce", glesData.gpuVendor, glesData.gpuRenderer)) {
|
|
return detectNvidiaQualitySetting(glesData.gpuRenderer, i, point, glesData.highestEsVersion);
|
|
}
|
|
if (isGpuModel("Vivante", glesData.gpuVendor, glesData.gpuRenderer)) {
|
|
return detectVivanteQualitySettings(glesData.gpuRenderer, i, point, glesData.highestEsVersion);
|
|
}
|
|
if (isGpuModel("VideoCore", glesData.gpuVendor, glesData.gpuRenderer)) {
|
|
return detectVideoCoreQualitySettings(glesData.gpuRenderer, i, point, glesData.highestEsVersion);
|
|
}
|
|
return fallback(1);
|
|
}
|
|
|
|
private static DeviceTier detectPowerVRQualitySetting(String str, int i, Point point, int i2) {
|
|
if (i == 1) {
|
|
return tier(0);
|
|
}
|
|
if (str.contains("540") || str.contains("544") || str.contains("531")) {
|
|
return i >= 4 ? maxDim(point) > 1800 ? tier(4) : tier(3) : maxDim(point) > 1024 ? tier(3) : tier(2);
|
|
}
|
|
if (str.contains("Rogue Han")) {
|
|
return estimateTierByCores(i, 4, tier(3));
|
|
}
|
|
if (str.contains("Rogue Hood")) {
|
|
return estimateTierByCores(i, 4, tier(3));
|
|
}
|
|
if (str.contains("6250")) {
|
|
return estimateTierByCores(i, 4, tier(4));
|
|
}
|
|
if (str.contains("G6200")) {
|
|
return estimateTierByCores(i, 4, tier(3), 8, tier(5));
|
|
}
|
|
if (str.contains("G6430")) {
|
|
if (minDim(point) > 1080 && minDim(point) <= 1200) {
|
|
return estimateTierByCores(i, 4, tier(3));
|
|
}
|
|
return estimateTierByCores(i, 4, tier(5));
|
|
}
|
|
if (str.contains("GM9446") || str.contains("GXA6850")) {
|
|
return estimateTierByCores(i, 8, tier(6));
|
|
}
|
|
return calculateBestFallback(str, i, point, i2);
|
|
}
|
|
|
|
private static DeviceTier detectAdrenoQualitySetting(String str, int i, Point point, int i2) {
|
|
if (i == 1) {
|
|
return tier(1);
|
|
}
|
|
if (str.contains("225") || str.contains("220") || str.contains("305")) {
|
|
return estimateTierByCores(i, 2, tier(2), 4, tier(2));
|
|
}
|
|
if (str.contains("320")) {
|
|
return estimateTierByCores(i, 2, tier(2), 4, tier(4));
|
|
}
|
|
if (str.contains("308") || str.contains("330") || str.contains("405") || str.contains("418") || str.contains("420") || str.contains("430") || str.contains("505") || str.contains("510") || str.contains("610")) {
|
|
return estimateTierByCores(i, 4, tier(5), 6, tier(5), 8, tier(5));
|
|
}
|
|
if (str.contains("506") || str.contains("530") || str.contains("616") || str.contains("618") || str.contains("630")) {
|
|
return estimateTierByCores(i, 4, tier(6), 8, tier(6));
|
|
}
|
|
if (str.contains("306")) {
|
|
return estimateTierByCores(i, 4, tier(3));
|
|
}
|
|
if (str.contains("304")) {
|
|
return estimateTierByCores(i, 4, tier(3));
|
|
}
|
|
if (str.contains("203")) {
|
|
return estimateTierByCores(i, 4, tier(1));
|
|
}
|
|
if (str.contains("540")) {
|
|
return estimateTierByCores(i, 8, tier(6));
|
|
}
|
|
if (str.contains("640") || str.contains("642") || str.contains("650") || str.contains("660")) {
|
|
return estimateTierByCores(i, 8, tier(7));
|
|
}
|
|
return calculateBestFallback(str, i, point, i2);
|
|
}
|
|
|
|
private static DeviceTier detectMaliQualitySetting(String str, int i, Point point, int i2) {
|
|
if (str.contains("400")) {
|
|
return estimateTierByCores(i, 2, tier(2), 4, tier(4));
|
|
}
|
|
if (str.contains("604")) {
|
|
return estimateTierByCores(i, 2, tier(4));
|
|
}
|
|
if (str.contains("628")) {
|
|
return estimateTierByCores(i, 4, tier(4), 8, tier(5));
|
|
}
|
|
if (str.contains("760") || str.contains("860")) {
|
|
return estimateTierByCores(i, 8, tier(5));
|
|
}
|
|
if (str.contains("880")) {
|
|
return estimateTierByCores(i, 4, tier(5), 8, tier(6));
|
|
}
|
|
if (str.contains("624")) {
|
|
return estimateTierByCores(i, 6, tier(4));
|
|
}
|
|
if (str.contains("450")) {
|
|
return estimateTierByCores(i, 4, tier(3), 8, tier(3));
|
|
}
|
|
if (str.contains("720")) {
|
|
return estimateTierByCores(i, 4, tier(2), 8, tier(4));
|
|
}
|
|
if (str.contains("830")) {
|
|
return estimateTierByCores(i, 8, tier(4));
|
|
}
|
|
if (str.contains("G71") || str.contains("G72") || str.contains("G76") || str.contains("G77")) {
|
|
return estimateTierByCores(i, 8, tier(6));
|
|
}
|
|
if (str.contains("G78")) {
|
|
return estimateTierByCores(i, 8, tier(7));
|
|
}
|
|
return calculateBestFallback(str, i, point, i2);
|
|
}
|
|
|
|
private static DeviceTier detectNvidiaQualitySetting(String str, int i, Point point, int i2) {
|
|
if (!str.contains("K1-64") && !str.contains("X1")) {
|
|
if (str.contains("K1") || i2 >= 3) {
|
|
return estimateTierByCores(i, 2, tier(5), 4, tier(6));
|
|
}
|
|
if (i >= 2) {
|
|
return estimateTierByCores(i, 2, maxDim(point) > 1024 ? tier(1) : tier(2), 4, tier(4));
|
|
}
|
|
return calculateBestFallback(str, i, point, i2);
|
|
}
|
|
return estimateTierByCores(i, 2, tier(6));
|
|
}
|
|
|
|
private static DeviceTier detectVivanteQualitySettings(String str, int i, Point point, int i2) {
|
|
if (!str.contains("GC1000") && !str.contains("GC2000")) {
|
|
if (str.contains("GC7000UL")) {
|
|
return estimateTierByCores(i, 4, tier(2));
|
|
}
|
|
return fallback(1);
|
|
}
|
|
return estimateTierByCores(i, 2, tier(1), 4, tier(1));
|
|
}
|
|
|
|
private static DeviceTier detectVideoCoreQualitySettings(String str, int i, Point point, int i2) {
|
|
if (str.contains("IV HW")) {
|
|
return estimateTierByCores(i, 2, tier(2));
|
|
}
|
|
return fallback(1);
|
|
}
|
|
|
|
private static DeviceTier tier(int i) {
|
|
return new DeviceTier(i);
|
|
}
|
|
|
|
private static DeviceTier calculateBestFallback(String str, int i, Point point, int i2) {
|
|
if (i >= 4) {
|
|
return fallback(i > 4 ? i2 + 2 : i2 + 1);
|
|
}
|
|
return fallback(i2);
|
|
}
|
|
|
|
private static DeviceTier fallback(int i) {
|
|
return new DeviceTier(i, true);
|
|
}
|
|
|
|
private static int maxDim(Point point) {
|
|
return Math.max(point.x, point.y);
|
|
}
|
|
|
|
private static int minDim(Point point) {
|
|
return Math.min(point.x, point.y);
|
|
}
|
|
|
|
private static boolean isGpuModel(String str, String str2, String str3) {
|
|
return (!TextUtils.isEmpty(str2) && str2.contains(str)) || (!TextUtils.isEmpty(str3) && str3.contains(str));
|
|
}
|
|
|
|
private static DeviceTier estimateTierByCores(int i, Object... objArr) {
|
|
DeviceTier deviceTier = null;
|
|
int i2 = 0;
|
|
while (true) {
|
|
if (i2 >= objArr.length) {
|
|
return fallback(deviceTier != null ? deviceTier.tier : 1);
|
|
}
|
|
int intValue = ((Integer) objArr[i2]).intValue();
|
|
DeviceTier deviceTier2 = (DeviceTier) objArr[i2 + 1];
|
|
if (i <= intValue) {
|
|
if (i == intValue) {
|
|
return deviceTier2;
|
|
}
|
|
if (deviceTier == null) {
|
|
return fallback(Math.max(1, deviceTier2.tier - 1));
|
|
}
|
|
int i3 = deviceTier.tier;
|
|
int i4 = deviceTier2.tier;
|
|
return i3 == i4 ? deviceTier2 : fallback(Math.min(i3, i4));
|
|
}
|
|
i2 += 2;
|
|
deviceTier = deviceTier2;
|
|
}
|
|
}
|
|
}
|