-
Notifications
You must be signed in to change notification settings - Fork 10
Encryption auto detection
- Check if FDE encrypted
-> if yes, dynamically set flags for FDE
-> if no, proceed with 2.
- Check if FBE encrypted
-> if yes, dynamically set flags for FBE
-> if no:
-> check if /data/media exists
-> if it does not exist, check if /data/decrypt exists: -> if it does, proceed with 3.
-> if not, enable encryption
-> if it does exist, proceed with 3..
- Assume device is decrypted, remove all encryption flags
This means your users no longer need to flash noverity zips, force decrypt, whatever. If you want to ENABLE File Based Encryption and ARE OKAY WITH LOSING ALL YOUR DATA IN THE PROCESS (including internal storage), boot into fastboot and do this:
fastboot --wipe-and-use-fbe
This won't work if your OS does not support it, I know that it works on Linux. If you have trouble, flash your stock ROM or any other build that has FBE enabled by default without autodetect_crypt and then you can wipe (not format) in TWRP and boot the autodetect_crypt ROM.
https://github.com/halogenOS/android_system_core/commit/301f4659bf83063a186249742dda8e9ae44eeb00
https://github.com/halogenOS/android_system_core/commit/604da74a79aa95c43525203024da56e80ad35207
https://github.com/halogenOS/android_system_core/commit/0ff53949b0f384909727427e28ce9dd24708cee2
Do this in your device tree:
https://github.com/halogenOS/android_device_oneplus_msm8998-common/commit/9ebd98f2d6627281f0a074d1d27e7652e2c11dde
Basically this adds autodetect_crypt
and make sure you keep the FBE and FDE configs for your device, e. g. fileencryption=ice,encryptable=footer,length=-16384
Have fun