Skip to main content

Device Ownership

What is Device Owner?

Device Owner is an advanced Android management mode. When Chastify is set as Device Owner, Android gives the app stronger policy controls than normal Device Admin. In Chastify, this is used with Device Control to make selected controls much harder to remove, for users who specifically want their phone to stay fully restricted during a control session.

In Chastify this is optional. Most users should not need it.

Safety recommendation

Device Owner is an advanced Android administration mode that you enable yourself through ADB. Only use it on a phone where you understand the setup, the possible OEM side effects, and how to recover or reset the device if something goes wrong. Chastify provides the tools to apply and clear its own restrictions where Android allows it, but you are responsible for choosing to enable Device Owner on your device. For most users, standard Device Control plus Device Admin and optional Secure Settings recovery is enough.

Testing status

Device Owner support is still being tested. It has been tested in Android emulators, but not broadly on real phones outside emulator testing. Unexpected Android or OEM-specific behavior may still appear. If you want to try this feature, test it in an Android emulator or on a spare phone first.

Device Owner can allow Chastify to:

  • Block safe mode on supported Android versions
  • Block ADB/debugging features when explicitly enabled
  • Prevent factory reset from Android Settings
  • Prevent uninstalling Chastify
  • Re-enable Android backups if the device disabled them during provisioning
  • Clear these restrictions again from Chastify when recovery is allowed

Important limitations

Device Owner is designed for managed phones, kiosks, and enterprise devices. It is not a normal app permission.

Possible side effects include:

  • Some OEM services may stop working while Chastify is Device Owner.
  • Android Studio or ADB workflows may become harder if debugging restrictions are enabled.
  • App reinstall/redeploy behavior can be different from normal app updates.
  • Removing accounts or factory resetting may be required before Android allows Device Owner setup.
  • Some restrictions may require a reboot before Android fully reflects the change.
Samsung notes

Samsung devices can be especially sensitive to Device Owner mode. Depending on Android and One UI version, some Samsung services may not work normally while a third-party app is Device Owner, including:

  • Secure Folder
  • Samsung Pass
  • Smart Switch restore flows
  • Samsung Kids
  • Quick Share on some older Android versions

This is an Android/OEM behavior, not a Chastify-specific lock. If these features matter to you, test Device Owner on a spare device first.

Before you begin

You need:

  • The Chastify Android app installed
  • A computer with ADB
  • USB debugging enabled
  • The same Chastify package that will remain installed: net.chastify.app

You may also need to:

  • Remove Google/Samsung/OEM accounts before setup
  • Remove lock screen security before setup
  • Use a fresh device or emulator
  • Factory reset if Android refuses to assign Device Owner

Check accounts before setup

Android often refuses Device Owner setup if accounts already exist on the device.

List accounts with:

adb shell dumpsys account | grep "Account {" | grep -v "Session"

On Windows PowerShell or Command Prompt, use a Windows-compatible filter such as:

adb shell dumpsys account

Then inspect the output for remaining accounts.

Set Chastify as Device Owner

Run:

adb shell dpm set-device-owner net.chastify.app/.AdminReceiver

On macOS with the default Android SDK path:

~/Library/Android/sdk/platform-tools/adb shell dpm set-device-owner net.chastify.app/.AdminReceiver

ADB command reference

Set Chastify as Device Owner:

adb shell dpm set-device-owner net.chastify.app/.AdminReceiver

List Device Owner and Profile Owner state:

adb shell dpm list-owners

Remove Chastify as an active Device Admin in debug/test builds:

adb shell dpm remove-active-admin net.chastify.app/.AdminReceiver

On some Android versions, include the user:

adb shell dpm remove-active-admin --user 0 net.chastify.app/.AdminReceiver
warning

remove-active-admin is mainly useful for emulator/debug builds where the app is marked testOnly. Production Android builds may reject this command, especially if Chastify is Device Owner. In production, use Chastify's Clear Device Owner recovery flow first.

Verify Device Owner

Use:

adb shell dpm list-owners

If your Android build does not support that command, inspect device policy state:

adb shell dumpsys device_policy

Look for net.chastify.app/.AdminReceiver as Device Owner. If it only appears under Enabled Device Admins, then Chastify is Device Admin but not Device Owner.

Configure restrictions in Chastify

After Device Owner is set:

  1. Open Chastify.
  2. Go to Device Control.
  3. Open Device Owner setup.
  4. Enable only the restrictions you actually want.

Chastify currently exposes these as separate options:

  • Block safe mode
  • Block ADB/debugging
  • Block factory reset from Settings
  • Block uninstalling Chastify
  • Enable Android backups
Keep ADB available while testing

Leave Block ADB/debugging off while testing. If you enable it and later need to debug the device, you may have to remove the restriction from inside Chastify. After the restriction is removed, Android may still require you to manually turn USB debugging on again in Developer options before ADB works.

Clearing Device Owner

When no Device Control session is active, Chastify can clear Device Owner from the Device Owner setup page.

The cleanup sequence attempts to:

  1. Remove the debugging restriction
  2. Restore ADB if Secure Settings was granted
  3. Remove the safe mode restriction
  4. Remove the factory reset restriction
  5. Remove the uninstall block
  6. Clear Chastify as Device Owner

The page is locked while a keyholder Device Control session or self-control session is active.

Xiaomi, Redmi, and MIUI notes

Some MIUI devices require additional developer options before ADB management commands work. You may need to enable:

  • USB debugging
  • USB debugging (Security settings)
  • Install via USB

Some MIUI versions also require signing into a Mi account before these toggles can be enabled. If Device Owner setup fails, remove accounts again before retrying.

If setup fails

Common reasons:

  • Existing accounts are still on the device
  • The app was already installed under a different signing key
  • The admin component is already active but not Device Owner
  • Multiple users/profiles exist on the device
  • ADB is targeting the wrong emulator or device
  • OEM security settings block ADB policy commands

Use:

adb devices -l
adb shell dpm list-owners
adb shell dumpsys device_policy

If Android still refuses setup, a factory reset and setup before adding accounts may be required.