使用安卓Device owner特权管理你的设备。Use Android Device owner privilege to manage your device.
See the codeUse Android's DevicePolicyManager API to manage your device.
[!NOTE] ColorOS users should download testkey version from releases on GitHub
Device owner (recommended)
Activating methods:
dpm set-device-owner com.bintianqi.owndroid/.ReceiverWork profile
java.lang.IllegalStateException: Not allowed to set the device owner because there are already some accounts on the device
Solutions: freeze the accounts' holder apps, or delete those accounts.
java.lang.IllegalStateException: Not allowed to set the device owner because there are already several users on the device
Solution: Delete secondary users, including work profile, private space and app cloning.
java.lang.IllegalStateException: Trying to set the device owner (com.bintianqi.owndroid/.Receiver), but device owner (xxx) is already set.
Only one device owner can exist on a device. Please deactivate the existing device owner first.
java.lang.SecurityException: Neither user 2000 nor current process has android.permission.MANAGE_DEVICE_ADMINS.
Solutions:
USB debugging (Security setting) in developer options.java.lang.IllegalStateException: Unexpected @ProvisioningPreCondition
Solution: Use OwnDroid testkey version
The testkey and signed versions differ only in their signatures. There is no functional difference between them.
user limit reached
Samsung restricts Android's multiple users feature. There is currently no solution.
On most devices, creating work profile is not allowed by the system when the device owner exist.
Because the system add no_add_managed_profile user restriction when a device owner is set.
Device owner can't modify user restrictions set by the system, but if your device is rooted, you can disable this restriction by executing the following commands in adb shell.
Note: the device owner and the work profile owner can't be the same app, or the device owner will lose its privilege during reboot.
pm set-user-restriction no_add_user 0
pm set-user-restriction no_add_managed_profile 0
pm set-user-restriction no_add_private_profile 0
pm set-user-restriction no_add_clone_profile 0
You should bypass the restrictions at your own risk. It may cause unexpected behavior, for example, the system may delete the user you created silently during reboot.
Some systems disable the feature of adding users in Android settings once a device owner is set. You have to create users in OwnDroid. Or if you have root, run the above command in adb shell to remove that restriction.
OwnDroid provides an Intent-based API. You need to set the API key in settings and enable the API. The numbers in brackets represent the minimum Android version required.
# An example of hiding app in ADB shell
am broadcast -a com.bintianqi.owndroid.action.HIDE -n com.bintianqi.owndroid/.ApiReceiver --es key abcdefg --es package com.example.app
// An example of hiding app in Kotlin
val intent = Intent("com.bintianqi.owndroid.action.HIDE")
.setComponent(ComponentName("com.bintianqi.owndroid", "com.bintianqi.owndroid.ApiReceiver"))
.putExtra("key", "abcdefg")
.putExtra("package", "com.example.app")
context.sendBroadcast(intent)
You can use Gradle in command line to build OwnDroid.
# Use testkey for signing (default)
./gradlew build
# Use your custom .jks key for signing
./gradlew build -PStoreFile="/path/to/your/jks/file" -PStorePassword="YOUR_KEYSTORE_PASSWORD" -PKeyPassword="YOUR_KEY_PASSWORD" -PKeyAlias="YOUR_KEY_ALIAS"
(Use ./gradlew.bat instead on Windows)
Contributions are welcome!
dev branch)Copyright (C) 2026 BinTianqi
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
82 followers · starred Apr 2024
42 followers · starred May 2024
72 followers · starred Sep 2025
54 followers · starred May 2024
使用安卓Device owner特权管理你的设备。Use Android Device owner privilege to manage your device.
See the codeUse Android's DevicePolicyManager API to manage your device.
[!NOTE] ColorOS users should download testkey version from releases on GitHub
Device owner (recommended)
Activating methods:
dpm set-device-owner com.bintianqi.owndroid/.ReceiverWork profile
java.lang.IllegalStateException: Not allowed to set the device owner because there are already some accounts on the device
Solutions: freeze the accounts' holder apps, or delete those accounts.
java.lang.IllegalStateException: Not allowed to set the device owner because there are already several users on the device
Solution: Delete secondary users, including work profile, private space and app cloning.
java.lang.IllegalStateException: Trying to set the device owner (com.bintianqi.owndroid/.Receiver), but device owner (xxx) is already set.
Only one device owner can exist on a device. Please deactivate the existing device owner first.
java.lang.SecurityException: Neither user 2000 nor current process has android.permission.MANAGE_DEVICE_ADMINS.
Solutions:
USB debugging (Security setting) in developer options.java.lang.IllegalStateException: Unexpected @ProvisioningPreCondition
Solution: Use OwnDroid testkey version
The testkey and signed versions differ only in their signatures. There is no functional difference between them.
user limit reached
Samsung restricts Android's multiple users feature. There is currently no solution.
On most devices, creating work profile is not allowed by the system when the device owner exist.
Because the system add no_add_managed_profile user restriction when a device owner is set.
Device owner can't modify user restrictions set by the system, but if your device is rooted, you can disable this restriction by executing the following commands in adb shell.
Note: the device owner and the work profile owner can't be the same app, or the device owner will lose its privilege during reboot.
pm set-user-restriction no_add_user 0
pm set-user-restriction no_add_managed_profile 0
pm set-user-restriction no_add_private_profile 0
pm set-user-restriction no_add_clone_profile 0
You should bypass the restrictions at your own risk. It may cause unexpected behavior, for example, the system may delete the user you created silently during reboot.
Some systems disable the feature of adding users in Android settings once a device owner is set. You have to create users in OwnDroid. Or if you have root, run the above command in adb shell to remove that restriction.
OwnDroid provides an Intent-based API. You need to set the API key in settings and enable the API. The numbers in brackets represent the minimum Android version required.
# An example of hiding app in ADB shell
am broadcast -a com.bintianqi.owndroid.action.HIDE -n com.bintianqi.owndroid/.ApiReceiver --es key abcdefg --es package com.example.app
// An example of hiding app in Kotlin
val intent = Intent("com.bintianqi.owndroid.action.HIDE")
.setComponent(ComponentName("com.bintianqi.owndroid", "com.bintianqi.owndroid.ApiReceiver"))
.putExtra("key", "abcdefg")
.putExtra("package", "com.example.app")
context.sendBroadcast(intent)
You can use Gradle in command line to build OwnDroid.
# Use testkey for signing (default)
./gradlew build
# Use your custom .jks key for signing
./gradlew build -PStoreFile="/path/to/your/jks/file" -PStorePassword="YOUR_KEYSTORE_PASSWORD" -PKeyPassword="YOUR_KEY_PASSWORD" -PKeyAlias="YOUR_KEY_ALIAS"
(Use ./gradlew.bat instead on Windows)
Contributions are welcome!
dev branch)Copyright (C) 2026 BinTianqi
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
82 followers · starred Apr 2024
42 followers · starred May 2024
72 followers · starred Sep 2025
54 followers · starred May 2024