How can I prevent a factory reset triggered by hardware buttons (Power + Volume) on an Android device?

Johny
Level 2.0: Eclair

I like to prevent my device from factory rest with hardware button (Power + Volume).
I put two restriction for user not to reset device, those are not able to prevent the user from hardware reset.

private val dpm: DevicePolicyManager by lazy {
context.getSystemService(DevicePolicyManager::class.java)
}
dpm.addUserRestriction(adminComponentName, UserManager.DISALLOW_SAFE_BOOT)
dpm.addUserRestriction(adminComponentName, UserManager.DISALLOW_FACTORY_RESET)

How can I achieve this hardware reset restriction ?

4 REPLIES 4

Moombas
Level 4.1: Jelly Bean

Afaik those two options should prevent the user doing factory reset via the settings or boot the device into safe mode (if applied correctly) but you may also prevent user from wiping via hardware buttons and adb connection (as it can also be wiped that way) but be certain and ensure you leave a way open from your side (like an unrestircted admin mode) to be able to do it on your own.

Johny
Level 2.0: Eclair

This two setting is preventing the user while Enterprise application is running. But when user switch off the device and try to bring the reset option power + volume. In that situation user is able to reset device, that's means user restriction is not working after power off. 

The DISALLOW_SAFE_BOOT and DISALLOW_FACTORY_RESET settings are effective for preventing factory resets and safe boots initiated through the Android device's software interface, such as through the device settings. But this configuration is not effective for hardware buttons (Power + Volume keys).

Not: Its prevent from user interface like android settings but not from hardware. Restrictions Applied correctly

Moombas
Level 4.1: Jelly Bean

Yeah i corrected that in my post before because i mixed it when writing and you are correct but i think this is something only the manufacturer can do as providing such setting maybe via OEMconfig and into their firmware, not possible via Android itself.

emptydroid
Level 1.6: Donut

this is locked for hardware manufacturer.