DevicePolicyManager.SetStorageEncryption(ComponentName, Boolean) Method

Definition

This member is deprecated.

[Android.Runtime.Register("setStorageEncryption", "(Landroid/content/ComponentName;Z)I", "GetSetStorageEncryption_Landroid_content_ComponentName_ZHandler")]
public virtual Android.App.Admin.EncryptionStatus SetStorageEncryption (Android.Content.ComponentName admin, bool encrypt);
[<Android.Runtime.Register("setStorageEncryption", "(Landroid/content/ComponentName;Z)I", "GetSetStorageEncryption_Landroid_content_ComponentName_ZHandler")>]
abstract member SetStorageEncryption : Android.Content.ComponentName * bool -> Android.App.Admin.EncryptionStatus
override this.SetStorageEncryption : Android.Content.ComponentName * bool -> Android.App.Admin.EncryptionStatus

Parameters

admin
ComponentName

Which DeviceAdminReceiver this request is associated with.

encrypt
Boolean

true to request encryption, false to release any previous request

Returns

the new total request status (for all active admins), or DevicePolicyManager#ENCRYPTION_STATUS_UNSUPPORTED if called for a non-system user. Will be one of #ENCRYPTION_STATUS_UNSUPPORTED, #ENCRYPTION_STATUS_INACTIVE, or #ENCRYPTION_STATUS_ACTIVE. This is the value of the requests; use #getStorageEncryptionStatus() to query the actual device state.

Attributes

Remarks

This member is deprecated. This method does not actually modify the storage encryption of the device. It has never affected the encryption status of a device.

Called by an application that is administering the device to request that the storage system be encrypted. Does nothing if the caller is on a secondary user or a managed profile. <p> When multiple device administrators attempt to control device encryption, the most secure, supported setting will always be used. If any device administrator requests device encryption, it will be enabled; Conversely, if a device administrator attempts to disable device encryption while another device administrator has enabled it, the call to disable will fail (most commonly returning #ENCRYPTION_STATUS_ACTIVE). <p> This policy controls encryption of the secure (application data) storage area. Data written to other storage areas may or may not be encrypted, and this policy does not require or control the encryption of any other storage areas. There is one exception: If android.os.Environment#isExternalStorageEmulated() is true, then the directory returned by android.os.Environment#getExternalStorageDirectory() must be written to disk within the encrypted storage area. <p> Important Note: On some devices, it is possible to encrypt storage without requiring the user to create a device PIN or Password. In this case, the storage is encrypted, but the encryption key may not be fully secured. For maximum security, the administrator should also require (and check for) a pattern, PIN, or password.

Java documentation for android.app.admin.DevicePolicyManager.setStorageEncryption(android.content.ComponentName, boolean).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to