diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt
index d14dc9d8e..2c98a4190 100644
--- a/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt
+++ b/app/src/main/java/com/topjohnwu/magisk/ui/home/HomeViewModel.kt
@@ -41,6 +41,7 @@ class HomeViewModel(
val isForceEncryption = KObservableField(Info.keepEnc)
val isKeepVerity = KObservableField(Info.keepVerity)
+ val isRecovery = KObservableField(Info.recovery)
private val _magiskState = KObservableField(MagiskState.LOADING)
val magiskState = Observer(_magiskState, isConnected) {
@@ -112,6 +113,9 @@ class HomeViewModel(
isKeepVerity.addOnPropertyChangedCallback {
Info.keepVerity = it ?: return@addOnPropertyChangedCallback
}
+ isRecovery.addOnPropertyChangedCallback {
+ Info.recovery = it ?: return@addOnPropertyChangedCallback
+ }
isConnected.addOnPropertyChangedCallback {
if (it == true) refresh()
}
diff --git a/app/src/main/res/layout/fragment_magisk.xml b/app/src/main/res/layout/fragment_magisk.xml
index 763f2aaea..e72cecda2 100644
--- a/app/src/main/res/layout/fragment_magisk.xml
+++ b/app/src/main/res/layout/fragment_magisk.xml
@@ -185,6 +185,18 @@
app:layout_constraintWidth_default="wrap"
app:layout_constraintWidth_min="300dp" />
+
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 08e22d74d..87ba28157 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -24,6 +24,7 @@
Advanced Settings
Preserve force encryption
Preserve AVB 2.0/dm-verity
+ Recovery Mode
Installed: %1$s
Latest: %1$s
Uninstall
diff --git a/scripts/boot_patch.sh b/scripts/boot_patch.sh
index 2129f852e..4f4510771 100644
--- a/scripts/boot_patch.sh
+++ b/scripts/boot_patch.sh
@@ -7,7 +7,7 @@
# Usage: boot_patch.sh
#
# The following flags can be set in environment variables:
-# KEEPVERITY, KEEPFORCEENCRYPT
+# KEEPVERITY, KEEPFORCEENCRYPT, RECOVERYMODE
#
# This script should be placed in a directory with the following files:
#
@@ -84,6 +84,8 @@ case $? in
;;
esac
+[ -f recovery_dtbo ] && RECOVERYMODE=true
+
##########################################################################################
# Ramdisk restores
##########################################################################################
@@ -101,7 +103,7 @@ case $((STATUS & 3)) in
0 ) # Stock boot
ui_print "- Stock boot image detected"
ui_print "- Backing up stock boot image"
- SHA1=`./magiskboot --sha1 "$BOOTIMAGE" 2>/dev/null`
+ SHA1=`./magiskboot sha1 "$BOOTIMAGE" 2>/dev/null`
STOCKDUMP=stock_boot_${SHA1}.img.gz
./magiskboot compress "$BOOTIMAGE" $STOCKDUMP
cp -af ramdisk.cpio ramdisk.cpio.orig 2>/dev/null
@@ -133,8 +135,8 @@ ui_print "- Patching ramdisk"
echo "KEEPVERITY=$KEEPVERITY" > config
echo "KEEPFORCEENCRYPT=$KEEPFORCEENCRYPT" >> config
+echo "RECOVERYMODE=$RECOVERYMODE" >> config
[ ! -z $SHA1 ] && echo "SHA1=$SHA1" >> config
-[ -f recovery_dtbo ] && echo "RECOVERYMODE=true" >> config
./magiskboot cpio ramdisk.cpio \
"add 750 init magiskinit" \