Fix unable to revoke dhizuku client permission

Add a new user restriction
This commit is contained in:
BinTianqi
2025-06-02 11:51:08 +08:00
parent 7795cc5b8c
commit ba2e4f3a38
6 changed files with 18 additions and 4 deletions

View File

@@ -506,7 +506,7 @@ fun DhizukuServerSettingsScreen(onNavigateUp: () -> Unit) {
sp.dhizukuServer = status
}
fun writeList() {
file.writeText(Json.encodeToString(clients))
file.writeText(Json.encodeToString(clients.toList()))
}
LaunchedEffect(Unit) {
if (!file.exists()) file.writeText("[]")
@@ -544,7 +544,10 @@ fun DhizukuServerSettingsScreen(onNavigateUp: () -> Unit) {
)
Text(info.loadLabel(pm).toString(), style = typography.titleLarge)
}
Switch(client.allow, { clients[index] = client.copy(allow = it) })
Switch(client.allow, {
clients[index] = client.copy(allow = it)
writeList()
})
}
}
}

View File

@@ -32,7 +32,6 @@ import android.net.Uri
import android.os.Build.VERSION
import android.os.HardwarePropertiesManager
import android.os.UserManager
import android.widget.Button
import android.widget.Toast
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts

View File

@@ -219,7 +219,8 @@ object RestrictionData {
Restriction(UserManager.DISALLOW_CONFIG_CELL_BROADCASTS, R.string.config_cell_broadcasts, R.drawable.cell_tower_fill0),
Restriction(UserManager.DISALLOW_SMS, R.string.sms, R.drawable.sms_fill0),
Restriction(UserManager.DISALLOW_OUTGOING_CALLS, R.string.outgoing_calls, R.drawable.phone_forwarded_fill0),
Restriction(UserManager.DISALLOW_SIM_GLOBALLY, R.string.download_esim, R.drawable.sim_card_download_fill0)
Restriction(UserManager.DISALLOW_SIM_GLOBALLY, R.string.download_esim, R.drawable.sim_card_download_fill0),
Restriction(UserManager.DISALLOW_THREAD_NETWORK, R.string.thread_network, R.drawable.router_fill0, 36)
)
val connectivity = listOf(
Restriction(UserManager.DISALLOW_BLUETOOTH, R.string.bluetooth, R.drawable.bluetooth_fill0, 26),