Fix some crash on profile owner mode (#206)

This commit is contained in:
BinTianqi
2025-12-01 12:46:06 +08:00
parent 001d013b0c
commit c55cc2d3e1
5 changed files with 7 additions and 3 deletions

View File

@@ -681,7 +681,8 @@ class MyViewModel(application: Application): AndroidViewModel(application) {
backupServiceEnabled = if (VERSION.SDK_INT >= 26) DPM.isBackupServiceEnabled(DAR) else false,
btContactSharingDisabled = if (VERSION.SDK_INT >= 23 && privilege.work)
DPM.getBluetoothContactSharingDisabled(DAR) else false,
commonCriteriaMode = if (VERSION.SDK_INT >= 30) DPM.isCommonCriteriaModeEnabled(DAR) else false,
commonCriteriaMode = if (VERSION.SDK_INT >= 30 && privilege.run { device || org })
DPM.isCommonCriteriaModeEnabled(DAR) else false,
usbSignalEnabled = if (VERSION.SDK_INT >= 31) DPM.isUsbDataSignalingEnabled else false,
canDisableUsbSignal = if (VERSION.SDK_INT >= 31) DPM.canUsbDataSignalingBeDisabled() else false
)

View File

@@ -468,7 +468,8 @@ private fun ClearAppStorageDialog(
AlertDialog(
title = { Text(stringResource(R.string.clear_app_storage)) },
text = {
if(clearing) LinearProgressIndicator(Modifier.fillMaxWidth())
if (clearing) LinearProgressIndicator(Modifier.fillMaxWidth())
else Text(stringResource(R.string.clear_app_storage_confirmation))
},
confirmButton = {
TextButton(

View File

@@ -186,9 +186,9 @@ fun NetworkOptionsScreen(
) {
val privilege by Privilege.status.collectAsStateWithLifecycle()
var dialog by rememberSaveable { mutableIntStateOf(0) }
var lanEnabled by rememberSaveable { mutableStateOf(getLanEnabled()) }
MyScaffold(R.string.options, onNavigateUp, 0.dp) {
if(VERSION.SDK_INT >= 30 && (privilege.device || privilege.org)) {
var lanEnabled by rememberSaveable { mutableStateOf(getLanEnabled()) }
SwitchItem(R.string.lockdown_admin_configured_network, icon = R.drawable.wifi_password_fill0,
state = lanEnabled,
onCheckedChange = {