How can I prevent a factory reset triggered by hardware buttons (Power + Volume) on an Android device?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2024 03:15 AM
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 ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2024 04:20 AM - edited 08-28-2024 04:27 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2024 04:29 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2024 04:53 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2024 02:35 PM
this is locked for hardware manufacturer.