Merge "vold uses health filesystem HAL" am: fa96af82f3
am: def8ce02b6

Change-Id: I74bcb1519d1bc2d62bdf018a9ed7068c6dfdfbfe
diff --git a/IdleMaint.cpp b/IdleMaint.cpp
index b4b7746..459b3b8 100644
--- a/IdleMaint.cpp
+++ b/IdleMaint.cpp
@@ -15,6 +15,7 @@
  */
 
 #include "IdleMaint.h"
+#include "FileDeviceUtils.h"
 #include "Utils.h"
 #include "VolumeManager.h"
 #include "model/PrivateVolume.h"
@@ -92,8 +93,8 @@
             } else if (path_type == PathTypes::kBlkDevice) {
                 std::string gc_path;
                 const std::string& fs_type = vol->getFsType();
-                if (fs_type == "f2fs" &&
-                    Realpath(vol->getRawDevPath(), &gc_path)) {
+                if (fs_type == "f2fs" && (Realpath(vol->getRawDmDevPath(), &gc_path) ||
+                                          Realpath(vol->getRawDevPath(), &gc_path))) {
                     paths->push_back(std::string("/sys/fs/") + fs_type +
                                      "/" + Basename(gc_path));
                 }
@@ -137,7 +138,8 @@
         } else if (path_type == PathTypes::kBlkDevice) {
             std::string gc_path;
             if (std::string(fstab->recs[i].fs_type) == "f2fs" &&
-                Realpath(fstab->recs[i].blk_device, &gc_path)) {
+                Realpath(android::vold::BlockDeviceForPath(
+                    std::string(fstab->recs[i].mount_point) + "/"), &gc_path)) {
                 paths->push_back(std::string("/sys/fs/") + fstab->recs[i].fs_type +
                                  "/" + Basename(gc_path));
             }
diff --git a/model/PrivateVolume.h b/model/PrivateVolume.h
index 9508671..9a61f8d 100644
--- a/model/PrivateVolume.h
+++ b/model/PrivateVolume.h
@@ -41,6 +41,7 @@
     virtual ~PrivateVolume();
     const std::string& getFsType() { return mFsType; };
     const std::string& getRawDevPath() { return mRawDevPath; };
+    const std::string& getRawDmDevPath() { return mDmDevPath; };
 
 protected:
     status_t doCreate() override;