Merge AOSP android-9.0.0_r3

Fix conflicts and make it build in 5.1, 6.0, 7.1, 8.1, and 9.0

Change-Id: Ida0a64c29ff27d339b7f42a18d820930964ac6e4
diff --git a/common.h b/common.h
index b0901f4..e9585c1 100644
--- a/common.h
+++ b/common.h
@@ -40,6 +40,10 @@
 #define STRINGIFY(x) #x
 #define EXPAND(x) STRINGIFY(x)
 
+// Not using the command-line defined macro here because this header could be included by
+// device-specific recovery libraries. We static assert the value consistency in recovery.cpp.
+//static constexpr int kRecoveryApiVersion = 3;
+
 class RecoveryUI;
 
 extern RecoveryUI* ui;
@@ -57,7 +61,7 @@
 
 void ui_print(const char* format, ...);
 
-static bool is_ro_debuggable();
+//static bool is_ro_debuggable();
 
 #ifdef __cplusplus
 }