flxapps / DetoxDroid

Use your phone rather than letting your phone use you.
GNU General Public License v3.0
297 stars 16 forks source link

Granting permission to block apps fails #95

Open kaduvert opened 9 months ago

kaduvert commented 9 months ago

So in Disable Apps > Operation Mode > Deactivate > Go it tells me to enter some adb command or click the button to give the app root permission. Clicking the button and granting root permissions makes my phone show a warning about the app not responding when selecting Deactivate. Executing the adb command doesn't work either:

sargo:/ $ dpm set-device-owner com.flx_apps.digitaldetox/.system_integration.DetoxDroidDeviceAdminReceiver

Exception occurred while executing 'set-device-owner':
java.lang.IllegalStateException: Not allowed to set the device owner because there are already some accounts on the device.
    at com.android.server.devicepolicy.DevicePolicyManagerService.enforceCanSetDeviceOwnerLocked(DevicePolicyManagerService.java:9606)
    at com.android.server.devicepolicy.DevicePolicyManagerService.setDeviceOwner(DevicePolicyManagerService.java:8437)
    at com.android.server.devicepolicy.DevicePolicyManagerServiceShellCommand.runSetDeviceOwner(DevicePolicyManagerServiceShellCommand.java:259)
    at com.android.server.devicepolicy.DevicePolicyManagerServiceShellCommand.onCommand(DevicePolicyManagerServiceShellCommand.java:89)
    at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
    at android.os.ShellCommand.exec(ShellCommand.java:38)
    at com.android.server.devicepolicy.DevicePolicyManagerService.onShellCommand(DevicePolicyManagerService.java:9950)
    at android.os.Binder.shellCommand(Binder.java:1049)
    at android.os.Binder.onTransact(Binder.java:877)
    at android.app.admin.IDevicePolicyManager$Stub.onTransact(IDevicePolicyManager.java:6063)
    at android.os.Binder.execTransactInternal(Binder.java:1285)
    at android.os.Binder.execTransact(Binder.java:1244)

I'm using the MicroG fork of LineageOS 20 with Magisk

flxapps commented 9 months ago

Yes, it is supposedly impossible to add DetoxDroid as device owner app if there is already another app as device owner in place (unless you uninstall that one first). The documentation should be more straightforward though.

senz commented 4 months ago

Its possible:

 Just remove all the accounts from your device (In Settings->Accounts).

https://stackoverflow.com/a/44194210