Update VolumeManager to use UnmountTreeWithPrefix.
Bug: 122905493
Test: manual
Change-Id: Ia6aa1d400277a76dfd2c1db87c613d7e692b0b5c
diff --git a/VolumeManager.cpp b/VolumeManager.cpp
index d113cf9..0068cb6 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -866,8 +866,8 @@
if (GetBoolProperty(kIsolatedStorage, false)) {
mUserPackages.erase(userId);
std::string mntTargetDir = StringPrintf("/mnt/user/%d", userId);
- if (android::vold::UnmountTree(mntTargetDir) != 0) {
- PLOG(ERROR) << "unmountTree on " << mntTargetDir << " failed";
+ if (android::vold::UnmountTreeWithPrefix(mntTargetDir) < 0) {
+ PLOG(ERROR) << "UnmountTreeWithPrefix on " << mntTargetDir << " failed";
return -errno;
}
if (android::vold::DeleteDirContentsAndDir(mntTargetDir) < 0) {
@@ -969,8 +969,8 @@
<< ", volLabel=" << volLabel;
std::string pkgSandboxTarget =
StringPrintf("/mnt/user/%d/package/%s", userId, packageName.c_str());
- if (android::vold::UnmountTree(pkgSandboxTarget)) {
- PLOG(ERROR) << "UnmountTree failed on " << pkgSandboxTarget;
+ if (android::vold::UnmountTreeWithPrefix(pkgSandboxTarget) < 0) {
+ PLOG(ERROR) << "UnmountTreeWithPrefix failed on " << pkgSandboxTarget;
}
std::string sandboxDir = StringPrintf("/mnt/runtime/write/%s", volLabel.c_str());
@@ -1070,8 +1070,8 @@
for (auto& packageName : packageNames) {
std::string volSandboxRoot = StringPrintf("/mnt/user/%d/package/%s/%s", userId,
packageName.c_str(), vol->getLabel().c_str());
- if (android::vold::UnmountTree(volSandboxRoot) != 0) {
- PLOG(ERROR) << "unmountTree on " << volSandboxRoot << " failed";
+ if (android::vold::UnmountTreeWithPrefix(volSandboxRoot) < 0) {
+ PLOG(ERROR) << "UnmountTreeWithPrefix on " << volSandboxRoot << " failed";
continue;
}
if (android::vold::DeleteDirContentsAndDir(volSandboxRoot) < 0) {
@@ -1283,7 +1283,7 @@
mVisibleVolumeIds.clear();
// For unmounting dirs under /mnt/user/<user-id>/package/<package-name>
- android::vold::UnmountTree("/mnt/user/");
+ android::vold::UnmountTreeWithPrefix("/mnt/user/");
return 0;
}