OSDN Git Service

fs_mgr: check ro.* property first
authorChih-Wei Huang <cwhuang@linux.org.tw>
Tue, 12 Sep 2017 16:31:57 +0000 (00:31 +0800)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Mon, 11 Dec 2017 07:57:41 +0000 (15:57 +0800)
fs_mgr reads default fstab via ro.hardware property before Android 8.0.
However, Android 8.0 changed it to use ro.boot.hardware. This is an
incompatible change which is bad.

Android-x86 doesn't set ro.boot.hardware anymore. Let's check ro.*
properties as before.

fs_mgr/fs_mgr_boot_config.cpp

index 9c5d3f3..90a0097 100644 (file)
@@ -51,7 +51,13 @@ bool fs_mgr_get_boot_config_from_kernel_cmdline(const std::string& key, std::str
 bool fs_mgr_get_boot_config(const std::string& key, std::string* out_val) {
     FS_MGR_CHECK(out_val != nullptr);
 
-    // first check if we have "ro.boot" property already
+    // first check if we have "ro.*" property already
+    *out_val = android::base::GetProperty("ro." + key, "");
+    if (!out_val->empty()) {
+        return true;
+    }
+
+    // second check if we have "ro.boot.*" property
     *out_val = android::base::GetProperty("ro.boot." + key, "");
     if (!out_val->empty()) {
         return true;