Merge "minuitwrp: Remove unused variables" into android-9.0
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/toybox/Android.mk b/toybox/Android.mk
index 5b2f32f..c88f360 100644
--- a/toybox/Android.mk
+++ b/toybox/Android.mk
@@ -532,7 +532,7 @@
     vconfig \
     watch \
     xxd
-ifeq ($(shell test $(PLATFORM_SDK_VERSION) -lt 27; echo $$?),0)
+ifeq ($(shell test $(PLATFORM_SDK_VERSION) -le 27; echo $$?),0)
 ALL_TOOLS += \
     getprop \
     xzcat
diff --git a/updater/install.cpp b/updater/install.cpp
index 741d970..2266127 100644
--- a/updater/install.cpp
+++ b/updater/install.cpp
@@ -97,6 +97,34 @@
   LOG(INFO) << buffer;
 }
 
+static bool is_dir(const std::string& dirpath) {
+  struct stat st;
+  return stat(dirpath.c_str(), &st) == 0 && S_ISDIR(st.st_mode);
+}
+
+// Create all parent directories of name, if necessary.
+static bool make_parents(const std::string& name) {
+  size_t prev_end = 0;
+  while (prev_end < name.size()) {
+    size_t next_end = name.find('/', prev_end + 1);
+    if (next_end == std::string::npos) {
+      break;
+    }
+    std::string dir_path = name.substr(0, next_end);
+    if (!is_dir(dir_path)) {
+      int result = mkdir(dir_path.c_str(), 0700);
+      if (result != 0) {
+        PLOG(ERROR) << "failed to mkdir " << dir_path << " when make parents for " << name;
+        return false;
+      }
+
+      LOG(INFO) << "created [" << dir_path << "]";
+    }
+    prev_end = next_end;
+  }
+  return true;
+}
+
 void uiPrintf(State* _Nonnull state, const char* _Nonnull format, ...) {
   std::string error_msg;