Update encryption detection for determining default flags

This commit is contained in:
topjohnwu 2018-10-20 17:10:35 -04:00
parent 41b01003fd
commit d7d80d3fc1
2 changed files with 6 additions and 4 deletions

View File

@ -47,6 +47,7 @@ mount_partitions
find_boot_image
find_dtbo_image
check_data
get_flags
[ -z $BOOTIMAGE ] && abort "! Unable to detect target image"
@ -72,8 +73,6 @@ remove_system_su
ui_print "- Constructing environment"
check_data
if $DATA; then
MAGISKBIN=/data/magisk
$DATA_DE && MAGISKBIN=/data/adb/magisk

View File

@ -94,7 +94,7 @@ mount_partitions() {
mount -t ext4 -o ro $SYSTEMBLOCK /system
fi
[ -f /system/build.prop ] || is_mounted /system || abort "! Cannot mount /system"
cat /proc/mounts | grep -E '/dev/root|/system_root' >/dev/null && SYSTEM_ROOT=true || SYSTEM_ROOT=false
grep -qE '/dev/root|/system_root' /proc/mounts && SYSTEM_ROOT=true || SYSTEM_ROOT=false
if [ -f /system/init ]; then
SYSTEM_ROOT=true
mkdir /system_root 2>/dev/null
@ -125,7 +125,10 @@ get_flags() {
fi
fi
if [ -z $KEEPFORCEENCRYPT ]; then
if [ "`getprop ro.crypto.state`" = "encrypted" ]; then
grep ' /data ' /proc/mounts | grep -q 'dm-' && FDE=true || FDE=false
[ -d /data/unencrypted ] && FBE=true || FBE=false
# No data access means unable to decrypt in recovery
if $FDE || $FBE || ! $DATA; then
KEEPFORCEENCRYPT=true
ui_print "- Encrypted data detected, keep forceencrypt"
else