mirror of
https://github.com/awfixers-stuff/OwnDroid.git
synced 2026-03-23 11:05:59 +00:00
@@ -996,6 +996,25 @@ class MyViewModel(application: Application): AndroidViewModel(application) {
|
||||
DPM.transferOwnership(DAR, component, null)
|
||||
Privilege.updateStatus()
|
||||
}
|
||||
val userRestrictions = MutableStateFlow(emptyMap<String, Boolean>())
|
||||
@RequiresApi(24)
|
||||
fun getUserRestrictions() {
|
||||
val bundle = DPM.getUserRestrictions(DAR)
|
||||
userRestrictions.value = bundle.keySet().associateWith { bundle.getBoolean(it) }
|
||||
}
|
||||
fun setUserRestriction(name: String, state: Boolean): Boolean {
|
||||
return try {
|
||||
if (state) {
|
||||
DPM.addUserRestriction(DAR, name)
|
||||
} else {
|
||||
DPM.clearUserRestriction(DAR, name)
|
||||
}
|
||||
userRestrictions.update { it.plus(name to state) }
|
||||
true
|
||||
} catch (_: SecurityException) {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data class ThemeSettings(
|
||||
|
||||
Reference in New Issue
Block a user