Commit d7d80d3f authored by topjohnwu's avatar topjohnwu

Update encryption detection for determining default flags

parent 41b01003
...@@ -47,6 +47,7 @@ mount_partitions ...@@ -47,6 +47,7 @@ mount_partitions
find_boot_image find_boot_image
find_dtbo_image find_dtbo_image
check_data
get_flags get_flags
[ -z $BOOTIMAGE ] && abort "! Unable to detect target image" [ -z $BOOTIMAGE ] && abort "! Unable to detect target image"
...@@ -72,8 +73,6 @@ remove_system_su ...@@ -72,8 +73,6 @@ remove_system_su
ui_print "- Constructing environment" ui_print "- Constructing environment"
check_data
if $DATA; then if $DATA; then
MAGISKBIN=/data/magisk MAGISKBIN=/data/magisk
$DATA_DE && MAGISKBIN=/data/adb/magisk $DATA_DE && MAGISKBIN=/data/adb/magisk
......
...@@ -94,7 +94,7 @@ mount_partitions() { ...@@ -94,7 +94,7 @@ mount_partitions() {
mount -t ext4 -o ro $SYSTEMBLOCK /system mount -t ext4 -o ro $SYSTEMBLOCK /system
fi fi
[ -f /system/build.prop ] || is_mounted /system || abort "! Cannot mount /system" [ -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 if [ -f /system/init ]; then
SYSTEM_ROOT=true SYSTEM_ROOT=true
mkdir /system_root 2>/dev/null mkdir /system_root 2>/dev/null
...@@ -125,7 +125,10 @@ get_flags() { ...@@ -125,7 +125,10 @@ get_flags() {
fi fi
fi fi
if [ -z $KEEPFORCEENCRYPT ]; then 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 KEEPFORCEENCRYPT=true
ui_print "- Encrypted data detected, keep forceencrypt" ui_print "- Encrypted data detected, keep forceencrypt"
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment