From 9acc6d4398bc9270e09804183fa07cdc77c964c0 Mon Sep 17 00:00:00 2001 From: Sudheer Shanka Date: Sat, 6 Oct 2018 19:03:02 -0700 Subject: [PATCH] Check isolated_storage is enabled before cleaning up sandboxes. Also, clear packages state stored for the user being stopped. Bug: 117329171 Bug: 111890351 Test: manual Change-Id: Ida48fcec851830dbb756e329c20c322c631ad264 --- VolumeManager.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/VolumeManager.cpp b/VolumeManager.cpp index ec18694..9fb213f 100644 --- a/VolumeManager.cpp +++ b/VolumeManager.cpp @@ -805,16 +805,19 @@ int VolumeManager::onUserStopped(userid_t userId) { LOG(VERBOSE) << "onUserStopped: " << userId; mStartedUsers.erase(userId); - std::string mntTargetDir = StringPrintf("/mnt/user/%d", userId); - if (android::vold::UnmountTree(mntTargetDir) != 0) { - PLOG(ERROR) << "unmountTree on " << mntTargetDir << " failed"; - return -errno; - } - if (android::vold::DeleteDirContentsAndDir(mntTargetDir) < 0) { - PLOG(ERROR) << "DeleteDirContentsAndDir failed on " << mntTargetDir; - return -errno; + 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"; + return -errno; + } + if (android::vold::DeleteDirContentsAndDir(mntTargetDir) < 0) { + PLOG(ERROR) << "DeleteDirContentsAndDir failed on " << mntTargetDir; + return -errno; + } + LOG(VERBOSE) << "Success: DeleteDirContentsAndDir on " << mntTargetDir; } - LOG(VERBOSE) << "Success: DeleteDirContentsAndDir on " << mntTargetDir; return 0; }