mirror of
https://github.com/awfixers-stuff/OwnDroid.git
synced 2026-03-23 19:15:58 +00:00
Add 'User Restrictions' section
This commit is contained in:
@@ -2,6 +2,7 @@ package com.binbin.androidowner
|
||||
|
||||
import android.app.admin.DevicePolicyManager
|
||||
import android.content.ComponentName
|
||||
import android.content.pm.PackageManager
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.Text
|
||||
@@ -17,6 +18,7 @@ import com.binbin.androidowner.ui.theme.AndroidOwnerTheme
|
||||
fun ApplicationManage(myDpm:DevicePolicyManager, myComponent:ComponentName){
|
||||
var pkgName by remember { mutableStateOf("com.mihoyo.yuanshen") }
|
||||
Column {
|
||||
Text("以下功能都需要DeviceOwner权限")
|
||||
TextField(value = pkgName, onValueChange = {pkgName = it}, label = { Text("包名") })
|
||||
Button(onClick = { myDpm.setApplicationHidden(myComponent,pkgName,true) }) {
|
||||
Text("隐藏")
|
||||
@@ -24,6 +26,14 @@ fun ApplicationManage(myDpm:DevicePolicyManager, myComponent:ComponentName){
|
||||
Button(onClick = { myDpm.setApplicationHidden(myComponent,pkgName,false) }) {
|
||||
Text("显示")
|
||||
}
|
||||
val isAppHidden = myDpm.isApplicationHidden(myComponent,pkgName)
|
||||
Text("应用隐藏:$isAppHidden ${if(isAppHidden==true){"(这个应用也许没有被安装)"}else{""}}")
|
||||
Button(onClick = {myDpm.setPackagesSuspended(myComponent, arrayOf(pkgName),true)}) {
|
||||
Text("停用")
|
||||
}
|
||||
Button(onClick = {myDpm.setPackagesSuspended(myComponent, arrayOf(pkgName),true)}) {
|
||||
Text("启用")
|
||||
}
|
||||
Button(onClick = { myDpm.setUninstallBlocked(myComponent, pkgName, true) }) {
|
||||
Text("禁止卸载")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user