免 root 禁用/启用 app, 禁止 app 自启, 节省电量.
源码地址 https://github.com/zogodo/zBox
adb
命令设备管理员是 Android 企业框架下的一个功能,提供了免 root 禁用/启用任意 app 的能力.
一台手机只能设置一个管理员.
adb shell dpm set-device-owner me.zogodo.zbox/.DeviceAdminReceiver
如果看到类似如下输出, 说明设置成功了. 可以开始使用 zBox 了. 此时可以把之前删除的帐号加回来了
Success: Device owner set to package me.zogodo.zbox/.DeviceAdminReceiver
Active admin set to component me.zogodo.zbox/.DeviceAdminReceiver
问:提示 Not allowed to ... already several accounts on the device
答:第 3 步 账户没删干净. 可以使用 adb shell dumpsys account
查看仍存在的账户. 如果在 手机设置 - 账户 中没有看到命令列出的账户, 则需要使用 adb shell pm disable-user --user 0 com.example.app
命令先禁用对应的 app, 设置成功后再使用 pm adb shell enable com.example.app
启用回来
问:提示 Not allowed to ... already several users on the device
答:第 4 步 应用双开, 多用户或访客模式没删干净, 请确保关闭所有应用双开/访客模式/多用户. 可以使用 adb shell pm list users
命令查看所有用户, 使用 adb shell pm remove-user $ID
删除对应用户, 注意 user 0 不能删除!
问:提示 Trying to set the device owner, but device owner is already set.
答:手机已经设置了其他 app 为设备管理员, 如: 冰箱/炼妖壶/小黑屋等. 一台手机上只能有一个设备管理员
问:MIUI 用户提示 Neither user xxx nor current process has android.permission.MANAGE_DEVICE_ADMINS
答:MIUI 用户请关闭 [ MIUI 优化]
手机回复出厂设置, 恢复后不登录任何账户, 所有设置均选择跳过,
打开开发者选项, 打开 USB 调试,
然后执行以下命令:
adb shell dpm set-device-owner me.zogodo.zbox/.DeviceAdminReceiver
#看到如下提示才算成功
Success: Device owner set to package me.zogodo.zbox/.DeviceAdminReceiver
Active admin set to component me.zogodo.zbox/.DeviceAdminReceiver
#查看已存在的用户
adb shell pm list users
#删除用户
adb shell pm remove-user $ID
#移除设备管理员(移除后需要恢复出厂设置才能再设置其他管理员)
adb shell dpm remove-active-admin me.zogodo.zbox/.DeviceAdminReceiver
# 禁用应用
pm disable-user --user 0 com.example.app
# 启用应用
pm enable com.example.app
adb shell pm disable-user --user 0 com.tencent.qqlive
![]() |
1
lisongeee 11 天前
|
![]() |
3
avrillavigne 11 天前
HyperOS 要退出账户,没有多开多用户访客模式,会出问题吗
|
![]() |
4
zogodo OP @avrillavigne 即使错误也只是设置设备管理员失败而已, 应该不会导致数据问题. 前提是没有 root, 已经 root 了的话建议用一楼说得那个吧, 哈哈哈~
|
![]() |
5
Pters 11 天前
代价有点大,我选择卸载 APP
|
![]() |
6
alleluya 11 天前
这个能限制云控么?
|
![]() |
9
avrillavigne 11 天前
@zogodo 下发指令,夏天优化降频,调“优”
|
10
junyee 11 天前
不需要 root. hail 配合 dhizuku 使用很舒服.
|
11
volks 10 天前
感觉不如 shizuku+hail
|