mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2024-11-27 22:46:48 +01:00
EN: Support partial device list matches
This commit is contained in:
parent
26f2e859b8
commit
d3d04459d6
@ -24,13 +24,20 @@ val currentDeviceInfo: DeviceInfo
|
|||||||
get() {
|
get() {
|
||||||
var deviceInfo = knownDeviceInfo
|
var deviceInfo = knownDeviceInfo
|
||||||
if (deviceInfo == null) {
|
if (deviceInfo == null) {
|
||||||
|
// Note: Custom ROMs sometimes have slightly different model information, so we have some flexibility for those
|
||||||
val byOem = allDeviceInfos.filter { it.oem.equalsIgnoreCase(Build.MANUFACTURER) }
|
val byOem = allDeviceInfos.filter { it.oem.equalsIgnoreCase(Build.MANUFACTURER) }
|
||||||
|
val byDevice = allDeviceInfos.filter { it.device.equalsIgnoreCase(Build.DEVICE) }
|
||||||
|
val byModel = allDeviceInfos.filter { it.model.equalsIgnoreCase(Build.MODEL) }
|
||||||
val exactMatch = byOem.find { it.device.equalsIgnoreCase(Build.DEVICE) && it.model.equalsIgnoreCase(Build.MODEL) }
|
val exactMatch = byOem.find { it.device.equalsIgnoreCase(Build.DEVICE) && it.model.equalsIgnoreCase(Build.MODEL) }
|
||||||
deviceInfo = when {
|
deviceInfo = when {
|
||||||
exactMatch != null -> {
|
exactMatch != null -> {
|
||||||
// Exact match, use provided confidence
|
// Exact match, use provided confidence
|
||||||
exactMatch
|
exactMatch
|
||||||
}
|
}
|
||||||
|
byModel.isNotEmpty() || byDevice.isNotEmpty() -> {
|
||||||
|
// We have data from "sister devices", that's way better than taking the OEM average
|
||||||
|
averageCurrentDeviceInfo(Build.MANUFACTURER, Build.DEVICE, Build.MODEL, (byDevice + byModel).distinct(), CalibrationConfidence.MEDIUM)
|
||||||
|
}
|
||||||
byOem.isNotEmpty() -> {
|
byOem.isNotEmpty() -> {
|
||||||
// Fallback to OEM average
|
// Fallback to OEM average
|
||||||
averageCurrentDeviceInfo(Build.MANUFACTURER, Build.DEVICE, Build.MODEL, byOem, CalibrationConfidence.LOW)
|
averageCurrentDeviceInfo(Build.MANUFACTURER, Build.DEVICE, Build.MODEL, byOem, CalibrationConfidence.LOW)
|
||||||
|
Loading…
Reference in New Issue
Block a user