Device owner mode
Set it up once from a computer and clear_data wipes app data directly, without opening Settings. How to turn it on, check it, turn it off, and what it costs.
A normal app cannot wipe another app's data, so without this mode clear_data answers NO_PERMISSION with the permission device_owner. You can still clear data by pressing the buttons in Android's Settings app with the clear data recipe, but that takes a few seconds, shows Settings on screen, and depends on your phone's labels.
Making Droidline the phone's device owner removes that limit: Android lets the device owner app wipe other apps' data. clear_data then clears the app directly without touching the screen.
The mode is optional. Everything else in Droidline works the same without it.
What changes
| Default | Device owner mode | |
|---|---|---|
clear_data | Answers NO_PERMISSION (device_owner); use the Settings recipe instead | Wipes directly, no screen |
| Accessibility service | Needed by the Settings recipe | Not needed for clear_data |
| Apps with a Manage space screen, such as Chrome | The Settings recipe cannot clear them | Cleared |
| Uninstalling Droidline | Works as usual | Blocked until you turn the mode off |
No other command changes. Droidline does not use any other device owner powers, such as policies or install restrictions.
When it helps
- You clear app data often on a shelf of test phones.
- Even a brief flash of the Settings app gets in the way.
- The Settings recipe does not match your phone maker's Settings app.
On a personal phone there is little reason to turn it on; the conditions below make the setup a chore.
Before you start
- Android 9 or later.
- The Droidline app installed on the phone.
adbon your computer. It comes with Android SDK Platform-Tools. You need it once, for setup.- No accounts on the phone. That means every account listed under Settings → Accounts, not only Google: Telegram, Samsung and so on. Android sets this rule. You can add the accounts back once setup is done.
- A single user. Remove guests, extra users and any work profile first.
If removing accounts is awkward, the simplest route is to factory reset the phone and set this up before adding any account.
Turn it on
1. Turn on USB debugging. Tap Build number in Settings → About phone seven times to unlock Developer options, then turn on USB debugging there.
2. Connect the phone over USB and tap Allow in the prompt on the phone. Check that it is connected:
adb devices
3. Make Droidline the device owner.
adb shell dpm set-device-owner dev.droidline.agent/.admin.DroidAdminReceiver
On success it prints:
Success: Device owner set to package dev.droidline.agent/.admin.DroidAdminReceiver
Active admin set to component dev.droidline.agent/.admin.DroidAdminReceiver
4. Tidy up. You can turn USB debugging off now. Add back any accounts you removed.
Check it
Open the Droidline app on the phone and look at the bottom of the Status tab: a Device owner mode section is there. It only shows while the mode is on.
You can also call clear_data on an app you do not mind resetting. It returns how long it took instead of NO_PERMISSION:
print(d.clear_data("com.android.chrome"))
# {'ms': 915}console.log(await d.clearData("com.android.chrome"));
// { ms: 915 }Console.WriteLine(await d.ClearDataAsync("com.android.chrome"));
// {"ms":915}droidline --json clear_data com.android.chromems varies by phone. Droidline cannot clear its own data this way, because that would also erase the pairing; the call answers BAD_ARGS.
If step 3 fails
| The message says | Meaning | Fix |
|---|---|---|
already some accounts on the device | An account is still on the phone | Remove every account in Settings → Accounts and run it again |
already several users on the device | Another user or a work profile exists | Remove extra users and the work profile, then run it again |
device owner is already set | Another app already owns the device | A company-managed phone cannot use this mode; otherwise release it in that app |
Unknown admin | The app is missing, or an older version without this feature | Install the latest Droidline app |
Turn it off
In the Droidline app on the phone, open the Status tab, find Device owner mode, tap Turn off and confirm. clear_data then answers NO_PERMISSION again, and the app can be uninstalled as usual. To turn it back on, repeat Turn it on from the start.
A factory reset also turns the mode off.