manager: fix where the option displays "Temporary enable" after device reboot
Co-authored-by: YuKongA <70465933+YuKongA@users.noreply.github.com>
This commit is contained in:
@@ -10,8 +10,6 @@ import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.compose.animation.*
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.interaction.MutableInteractionSource
|
||||
import androidx.compose.foundation.interaction.collectIsPressedAsState
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
@@ -143,9 +141,11 @@ fun SettingScreen(navigator: DestinationsNavigator) {
|
||||
)
|
||||
var enhancedSecurityMode by rememberSaveable {
|
||||
mutableIntStateOf(
|
||||
prefs.getInt(
|
||||
"enhanced_security_mode", if (Natives.isEnhancedSecurityEnabled()) 1 else 0
|
||||
)
|
||||
run {
|
||||
val currentEnabled = Natives.isEnhancedSecurityEnabled()
|
||||
val savedPersist = prefs.getInt("enhanced_security_mode", 0)
|
||||
if (savedPersist == 2) 2 else if (currentEnabled) 1 else 0
|
||||
}
|
||||
)
|
||||
}
|
||||
SettingDropdown(
|
||||
@@ -167,7 +167,7 @@ fun SettingScreen(navigator: DestinationsNavigator) {
|
||||
1 -> if (Natives.setEnhancedSecurityEnabled(false)) {
|
||||
execKsud("feature save", true)
|
||||
if (Natives.setEnhancedSecurityEnabled(true)) {
|
||||
prefs.edit { putInt("enhanced_security_mode", 1) }
|
||||
prefs.edit { putInt("enhanced_security_mode", 0) }
|
||||
enhancedSecurityMode = 1
|
||||
}
|
||||
}
|
||||
@@ -184,9 +184,11 @@ fun SettingScreen(navigator: DestinationsNavigator) {
|
||||
|
||||
var suCompatMode by rememberSaveable {
|
||||
mutableIntStateOf(
|
||||
prefs.getInt(
|
||||
"su_compat_mode", if (!Natives.isSuEnabled()) 1 else 0
|
||||
)
|
||||
run {
|
||||
val currentEnabled = Natives.isSuEnabled()
|
||||
val savedPersist = prefs.getInt("su_compat_mode", 0)
|
||||
if (savedPersist == 2) 2 else if (!currentEnabled) 1 else 0
|
||||
}
|
||||
)
|
||||
}
|
||||
SettingDropdown(
|
||||
@@ -208,7 +210,7 @@ fun SettingScreen(navigator: DestinationsNavigator) {
|
||||
1 -> if (Natives.setSuEnabled(true)) {
|
||||
execKsud("feature save", true)
|
||||
if (Natives.setSuEnabled(false)) {
|
||||
prefs.edit { putInt("su_compat_mode", 1) }
|
||||
prefs.edit { putInt("su_compat_mode", 0) }
|
||||
suCompatMode = 1
|
||||
}
|
||||
}
|
||||
@@ -225,9 +227,11 @@ fun SettingScreen(navigator: DestinationsNavigator) {
|
||||
|
||||
var kernelUmountMode by rememberSaveable {
|
||||
mutableIntStateOf(
|
||||
prefs.getInt(
|
||||
"kernel_umount_mode", if (!Natives.isKernelUmountEnabled()) 1 else 0
|
||||
)
|
||||
run {
|
||||
val currentEnabled = Natives.isKernelUmountEnabled()
|
||||
val savedPersist = prefs.getInt("kernel_umount_mode", 0)
|
||||
if (savedPersist == 2) 2 else if (!currentEnabled) 1 else 0
|
||||
}
|
||||
)
|
||||
}
|
||||
SettingDropdown(
|
||||
@@ -249,7 +253,7 @@ fun SettingScreen(navigator: DestinationsNavigator) {
|
||||
1 -> if (Natives.setKernelUmountEnabled(true)) {
|
||||
execKsud("feature save", true)
|
||||
if (Natives.setKernelUmountEnabled(false)) {
|
||||
prefs.edit { putInt("kernel_umount_mode", 1) }
|
||||
prefs.edit { putInt("kernel_umount_mode", 0) }
|
||||
kernelUmountMode = 1
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user