vold: add property hook to allow ignore voldmanaged devices

devices like raspi can boot from usb but also want other usb
devices as voldmanaged. In that case the boot devices should
be ignored

Use property sys.vendor.vold.skip_root_mnt=true
then this device will be ignored from the voldmanaged
list

Change-Id: I1980884addee1d773e9b3950ba77e043c2ee6417
diff --git a/VolumeManager.cpp b/VolumeManager.cpp
index a1ac20d..0372007 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -73,6 +73,7 @@
 #include "model/StubVolume.h"
 
 using android::OK;
+using android::base::GetProperty;
 using android::base::GetBoolProperty;
 using android::base::StartsWith;
 using android::base::StringAppendF;
@@ -210,6 +211,7 @@
 
     std::string eventPath(evt->findParam("DEVPATH") ? evt->findParam("DEVPATH") : "");
     std::string devType(evt->findParam("DEVTYPE") ? evt->findParam("DEVTYPE") : "");
+    std::string devName(evt->findParam("DEVNAME") ? evt->findParam("DEVNAME") : "");
 
     if (devType != "disk") return;
 
@@ -231,6 +233,17 @@
                         flags |= android::vold::Disk::Flags::kUsb;
                     }
 
+                    if (GetBoolProperty("sys.vendor.vold.skip_root_mnt", false)) {
+                        // dont add this device as voldmanaged
+                        std::string rootDev = GetProperty("dev.mnt.blk.root", "");
+                        if (!rootDev.empty()) {
+                            if (rootDev.find(devName) != std::string::npos) {
+                                LOG(INFO) << "VolumeManager: skip dev = " << devName << " it is the boot device";
+                                break;
+                            }
+                        }
+                    }
+
                     auto disk =
                         new android::vold::Disk(eventPath, device, source->getNickname(), flags);
                     handleDiskAdded(std::shared_ptr<android::vold::Disk>(disk));