android – Using Google EMM how to block the user from formatting the device-ThrowExceptions

Exception or error:

We want to block the user from formatting the device. So we have created a custom policy with following options.

"factoryResetDisabled": true,
"safeBootDisabled": true,

This does not work when Policy is enrolled, as when we went to boot-loader menu we were able to successfully format the device. Also the custom policy were removed from the device.
Is there any approach via which the factory reset is blocked from Boot loader as well?

How to solve:

Is your DPC running on device owner mode? If not, it won’t work. You cannot forbid factory reset if your app is not the owner.


There is no method that allows a DPC to block/disable fastboot and/or recovery modes on an Android device.

In scenarios where your DPC is running in a Device Owner capacity, you should be able to configure the Factory Reset Protection. While this does not prevent the user from factory resetting a device from fastboot/recovery, it does place restrictions on provisioning within the setup wizard after the factory reset has occurred.

Leave a Reply

Your email address will not be published. Required fields are marked *