Encryption MUST use AES with a key of 128-bits (or greater) and a mode designed for storage (for
example, AES-XTS, AES-CBC-ESSIV). The encryption key MUST NOT be written to storage at any
time without being encrypted. Other than when in active use, the encryption key SHOULD be AES
encrypted with the lockscreen passcode stretched using a slow stretching algorithm (e.g. PBKDF2 or
scrypt). If the user has not specified a lockscreen passcode or has disabled use of the passcode for
encryption, the system SHOULD use a default passcode to wrap the encryption key. If the device
provides a hardware-backed keystore, the password stretching algorithm MUST be cryptographically
bound to that keystore. The encryption key MUST NOT be sent off the device (even when wrapped
with the user passcode and/or hardware bound key). The upstream Android Open Source project
provides a preferred implementation of this feature based on the Linux kernel feature dm-crypt.