@@ -17,7 +17,6 @@ import androidx.compose.foundation.layout.systemBars
1717import androidx.compose.foundation.lazy.LazyColumn
1818import androidx.compose.material.icons.Icons
1919import androidx.compose.material.icons.rounded.Adb
20- import androidx.compose.material.icons.rounded.Beenhere
2120import androidx.compose.material.icons.rounded.BugReport
2221import androidx.compose.material.icons.rounded.Compress
2322import androidx.compose.material.icons.rounded.ContactPage
@@ -34,6 +33,7 @@ import androidx.compose.material.icons.rounded.Update
3433import androidx.compose.material.icons.rounded.UploadFile
3534import androidx.compose.runtime.Composable
3635import androidx.compose.runtime.getValue
36+ import androidx.compose.runtime.mutableIntStateOf
3737import androidx.compose.runtime.mutableStateOf
3838import androidx.compose.runtime.rememberCoroutineScope
3939import androidx.compose.runtime.saveable.rememberSaveable
@@ -214,10 +214,12 @@ fun SettingScreen(navigator: DestinationsNavigator) {
214214 stringResource(id = R .string.settings_mode_always_enable),
215215 )
216216 var enhancedSecurityMode by rememberSaveable {
217- mutableStateOf(
218- prefs.getInt(
219- " enhanced_security_mode" , if (Natives .isEnhancedSecurityEnabled()) 1 else 0
220- )
217+ mutableIntStateOf(
218+ run {
219+ val currentEnabled = Natives .isEnhancedSecurityEnabled()
220+ val savedPersist = prefs.getInt(" enhanced_security_mode" , 0 )
221+ if (savedPersist == 2 ) 2 else if (currentEnabled) 1 else 0
222+ }
221223 )
222224 }
223225 SuperDropdown (
@@ -246,7 +248,7 @@ fun SettingScreen(navigator: DestinationsNavigator) {
246248 1 -> if (Natives .setEnhancedSecurityEnabled(false )) {
247249 execKsud(" feature save" , true )
248250 if (Natives .setEnhancedSecurityEnabled(true )) {
249- prefs.edit { putInt(" enhanced_security_mode" , 1 ) }
251+ prefs.edit { putInt(" enhanced_security_mode" , 0 ) }
250252 enhancedSecurityMode = 1
251253 }
252254 }
@@ -262,10 +264,12 @@ fun SettingScreen(navigator: DestinationsNavigator) {
262264 )
263265
264266 var suCompatMode by rememberSaveable {
265- mutableStateOf(
266- prefs.getInt(
267- " su_compat_mode" , if (! Natives .isSuEnabled()) 1 else 0
268- )
267+ mutableIntStateOf(
268+ run {
269+ val currentEnabled = Natives .isSuEnabled()
270+ val savedPersist = prefs.getInt(" su_compat_mode" , 0 )
271+ if (savedPersist == 2 ) 2 else if (! currentEnabled) 1 else 0
272+ }
269273 )
270274 }
271275 SuperDropdown (
@@ -294,7 +298,7 @@ fun SettingScreen(navigator: DestinationsNavigator) {
294298 1 -> if (Natives .setSuEnabled(true )) {
295299 execKsud(" feature save" , true )
296300 if (Natives .setSuEnabled(false )) {
297- prefs.edit { putInt(" su_compat_mode" , 1 ) }
301+ prefs.edit { putInt(" su_compat_mode" , 0 ) }
298302 suCompatMode = 1
299303 }
300304 }
@@ -310,10 +314,12 @@ fun SettingScreen(navigator: DestinationsNavigator) {
310314 )
311315
312316 var kernelUmountMode by rememberSaveable {
313- mutableStateOf(
314- prefs.getInt(
315- " kernel_umount_mode" , if (! Natives .isKernelUmountEnabled()) 1 else 0
316- )
317+ mutableIntStateOf(
318+ run {
319+ val currentEnabled = Natives .isKernelUmountEnabled()
320+ val savedPersist = prefs.getInt(" kernel_umount_mode" , 0 )
321+ if (savedPersist == 2 ) 2 else if (! currentEnabled) 1 else 0
322+ }
317323 )
318324 }
319325 SuperDropdown (
@@ -342,7 +348,7 @@ fun SettingScreen(navigator: DestinationsNavigator) {
342348 1 -> if (Natives .setKernelUmountEnabled(true )) {
343349 execKsud(" feature save" , true )
344350 if (Natives .setKernelUmountEnabled(false )) {
345- prefs.edit { putInt(" kernel_umount_mode" , 1 ) }
351+ prefs.edit { putInt(" kernel_umount_mode" , 0 ) }
346352 kernelUmountMode = 1
347353 }
348354 }
0 commit comments