Merge "vold_decrypt: Add android 9.0 support" into android-9.0
diff --git a/etc/Android.mk b/etc/Android.mk
index cda0f37..4aeb251 100644
--- a/etc/Android.mk
+++ b/etc/Android.mk
@@ -88,3 +88,18 @@
         include $(BUILD_PREBUILT)
     endif
 endif
+
+ifeq ($(TW_USE_TOOLBOX), true)
+    include $(CLEAR_VARS)
+    LOCAL_MODULE := init.recovery.mksh.rc
+    LOCAL_MODULE_TAGS := eng
+    LOCAL_MODULE_CLASS := RECOVERY_EXECUTABLES
+
+    # Cannot send to TARGET_RECOVERY_ROOT_OUT since build system wipes init*.rc
+    # during ramdisk creation and only allows init.recovery.*.rc files to be copied
+    # from TARGET_ROOT_OUT thereafter
+    LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)
+
+    LOCAL_SRC_FILES := $(LOCAL_MODULE)
+    include $(BUILD_PREBUILT)
+endif
diff --git a/etc/init.rc b/etc/init.rc
index bcd519b..348471d 100644
--- a/etc/init.rc
+++ b/etc/init.rc
@@ -1,4 +1,5 @@
 import /init.recovery.logd.rc
+import /init.recovery.mksh.rc
 import /init.recovery.usb.rc
 import /init.recovery.service.rc
 import /init.recovery.vold_decrypt.rc
diff --git a/etc/init.recovery.mksh.rc b/etc/init.recovery.mksh.rc
new file mode 100755
index 0000000..3afd946
--- /dev/null
+++ b/etc/init.recovery.mksh.rc
@@ -0,0 +1,2 @@
+on init
+    export ENV /etc/mkshrc
diff --git a/gui/theme/landscape_hdpi/ui.xml b/gui/theme/landscape_hdpi/ui.xml
index 39f626f..f1bd647 100644
--- a/gui/theme/landscape_hdpi/ui.xml
+++ b/gui/theme/landscape_hdpi/ui.xml
@@ -430,6 +430,11 @@
 				<action function="key">back</action>
 			</button>
 
+			<fill color="%background_color%">
+				<condition var1="tw_busy" var2="1"/>
+				<placement x="0" y="%navbar_y%" w="%screen_width%" h="%navbar_height%"/>
+			</fill>
+
 			<action>
 				<touch key="power"/>
 				<action function="togglebacklight"/>
diff --git a/gui/theme/landscape_mdpi/ui.xml b/gui/theme/landscape_mdpi/ui.xml
index cde1a5b..cf30d89 100644
--- a/gui/theme/landscape_mdpi/ui.xml
+++ b/gui/theme/landscape_mdpi/ui.xml
@@ -430,6 +430,11 @@
 				<action function="key">back</action>
 			</button>
 
+			<fill color="%background_color%">
+				<condition var1="tw_busy" var2="1"/>
+				<placement x="0" y="%navbar_y%" w="%screen_width%" h="%navbar_height%"/>
+			</fill>
+
 			<action>
 				<touch key="power"/>
 				<action function="togglebacklight"/>
diff --git a/gui/theme/portrait_hdpi/ui.xml b/gui/theme/portrait_hdpi/ui.xml
index 0545b3f..3f3102a 100644
--- a/gui/theme/portrait_hdpi/ui.xml
+++ b/gui/theme/portrait_hdpi/ui.xml
@@ -334,6 +334,11 @@
 				<action function="key">back</action>
 			</button>
 
+			<fill color="%background_color%">
+				<condition var1="tw_busy" var2="1"/>
+				<placement x="0" y="%navbar_y%" w="%screen_width%" h="%navbar_height%"/>
+			</fill>
+
 			<action>
 				<touch key="power"/>
 				<action function="togglebacklight"/>
diff --git a/gui/theme/portrait_mdpi/ui.xml b/gui/theme/portrait_mdpi/ui.xml
index 061d46b..f41ff79 100644
--- a/gui/theme/portrait_mdpi/ui.xml
+++ b/gui/theme/portrait_mdpi/ui.xml
@@ -334,6 +334,11 @@
 				<action function="key">back</action>
 			</button>
 
+			<fill color="%background_color%">
+				<condition var1="tw_busy" var2="1"/>
+				<placement x="0" y="%navbar_y%" w="%screen_width%" h="%navbar_height%"/>
+			</fill>
+
 			<action>
 				<touch key="power"/>
 				<action function="togglebacklight"/>
diff --git a/minuitwrp/graphics_overlay.cpp b/minuitwrp/graphics_overlay.cpp
index e4fc419..b4efae4 100644
--- a/minuitwrp/graphics_overlay.cpp
+++ b/minuitwrp/graphics_overlay.cpp
@@ -50,7 +50,6 @@
 
 static GRSurface gr_framebuffer;
 static GRSurface* gr_draw = NULL;
-static int displayed_buffer;
 
 static fb_var_screeninfo vi;
 static int fb_fd = -1;
@@ -100,7 +99,6 @@
 
 bool target_has_overlay(char *version)
 {
-    int ret;
     int mdp_version;
     bool overlay_supported = false;
 
diff --git a/partition.cpp b/partition.cpp
index acf382a..8e30c33 100644
--- a/partition.cpp
+++ b/partition.cpp
@@ -1027,6 +1027,7 @@
 		File_System == "yaffs2" ||
 		File_System == "exfat" ||
 		File_System == "f2fs" ||
+		File_System == "squashfs" ||
 		File_System == "auto")
 		return true;
 	else
diff --git a/prebuilt/Android.mk b/prebuilt/Android.mk
index 27bcd5f..5dc110e 100644
--- a/prebuilt/Android.mk
+++ b/prebuilt/Android.mk
@@ -491,6 +491,18 @@
 	include $(BUILD_PREBUILT)
 endif
 
+ifeq ($(TW_USE_TOOLBOX), true)
+    include $(CLEAR_VARS)
+    LOCAL_MODULE := mkshrc_twrp
+    LOCAL_MODULE_TAGS := eng
+    LOCAL_MODULE_CLASS := ETC
+    LOCAL_MODULE_PATH := $(TARGET_RECOVERY_ROOT_OUT)/etc
+    LOCAL_SRC_FILES := $(LOCAL_MODULE)
+    LOCAL_POST_INSTALL_CMD := \
+        $(hide) mv $(TARGET_RECOVERY_ROOT_OUT)/etc/mkshrc_twrp $(TARGET_RECOVERY_ROOT_OUT)/etc/mkshrc
+    include $(BUILD_PREBUILT)
+endif
+
 #TWRP App "placeholder"
 include $(CLEAR_VARS)
 LOCAL_MODULE := me.twrp.twrpapp.apk
diff --git a/prebuilt/mkshrc_twrp b/prebuilt/mkshrc_twrp
new file mode 100755
index 0000000..c103d6c
--- /dev/null
+++ b/prebuilt/mkshrc_twrp
@@ -0,0 +1,21 @@
+# Copyright (c) 2010, 2012, 2013, 2014
+#	Thorsten Glaser <tg@mirbsd.org>
+# This file is provided under the same terms as mksh.
+#-
+# Minimal /system/etc/mkshrc for Android
+#
+# Support: https://launchpad.net/mksh
+
+: ${HOSTNAME:=$(getprop ro.product.device)}
+: ${HOSTNAME:=android}
+: ${TMPDIR:=/tmp}
+export HOSTNAME TMPDIR
+
+if (( USER_ID )); then PS1='$'; else PS1='#'; fi
+PS4='[$EPOCHREALTIME] '; PS1='${|
+	local e=$?
+
+	(( e )) && REPLY+="$e|"
+
+	return $e
+}$HOSTNAME:${PWD:-?} '"$PS1 "