Detect programmatically if an Android device is able to do storage encryption
Asked Answered
I

1

6

I am developing an Android App that starts the process of encrypting data on the device.

I am detecting the encryption status with this code :

int encrypted = 0;
device_policy_manager = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
encrypted = device_policy_manager.getStorageEncryptionStatus();
Log.d("TAG", "encryption status : " + encrypted);
}

On some devices, the encryption process starts and fails. Usually those devices don't have the "Encryption" option available in the Settings>Security menu (Android 3.x and Android 4.x).

Is there a way to detect programmatically if a device is able to do storage encryption ?

Thanks in adavance.

Impetuosity answered 30/6, 2016 at 3:41 Comment(0)
U
1

Devices which do not support encryption should return ENCRYPTION_STATUS_UNSUPPORTED when calling getStorageEncryptionStatus().

Hope this helps.

Unsaddle answered 5/7, 2016 at 18:41 Comment(1)
Thanks for your answer, but unfortunately some devices who don't support encryption are returning the wrong value. I am having troubles with some Fujitsu devices on Android 4.X and some Sharp devices also running android 4.X. With those devices, encryption starts and fails. After that, a factory reset is mandatory.Impetuosity

© 2022 - 2024 — McMap. All rights reserved.