Merge "Use "sys.isolated_storage_snapshot" prop to check for the feature."
diff --git a/VolumeManager.cpp b/VolumeManager.cpp
index 0068cb6..547c7ef 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -79,6 +79,7 @@
static const char* kPathVirtualDisk = "/data/misc/vold/virtual_disk";
static const char* kIsolatedStorage = "persist.sys.isolated_storage";
+static const char* kIsolatedStorageSnapshot = "sys.isolated_storage_snapshot";
static const char* kPropVirtualDisk = "persist.sys.virtual_disk";
static const std::string kEmptyString("");
@@ -108,6 +109,10 @@
VolumeManager::~VolumeManager() {}
+static bool hasIsolatedStorage() {
+ return GetBoolProperty(kIsolatedStorageSnapshot, GetBoolProperty(kIsolatedStorage, false));
+}
+
int VolumeManager::updateVirtualDisk() {
ATRACE_NAME("VolumeManager::updateVirtualDisk");
if (GetBoolProperty(kPropVirtualDisk, false)) {
@@ -843,7 +848,7 @@
if (mPrimary) {
linkPrimary(userId);
}
- if (GetBoolProperty(kIsolatedStorage, false)) {
+ if (hasIsolatedStorage()) {
std::vector<std::string> visibleVolLabels;
for (auto& volId : mVisibleVolumeIds) {
auto vol = findVolume(volId);
@@ -863,7 +868,7 @@
LOG(VERBOSE) << "onUserStopped: " << userId;
mStartedUsers.erase(userId);
- if (GetBoolProperty(kIsolatedStorage, false)) {
+ if (hasIsolatedStorage()) {
mUserPackages.erase(userId);
std::string mntTargetDir = StringPrintf("/mnt/user/%d", userId);
if (android::vold::UnmountTreeWithPrefix(mntTargetDir) < 0) {
@@ -897,7 +902,7 @@
int VolumeManager::prepareSandboxForApp(const std::string& packageName, appid_t appId,
const std::string& sandboxId, userid_t userId) {
- if (!GetBoolProperty(kIsolatedStorage, false)) {
+ if (!hasIsolatedStorage()) {
return 0;
} else if (mStartedUsers.find(userId) == mStartedUsers.end()) {
// User not started, no need to do anything now. Required bind mounts for the package will
@@ -923,7 +928,7 @@
int VolumeManager::destroySandboxForApp(const std::string& packageName,
const std::string& sandboxId, userid_t userId) {
- if (!GetBoolProperty(kIsolatedStorage, false)) {
+ if (!hasIsolatedStorage()) {
return 0;
}
LOG(VERBOSE) << "destroySandboxForApp: " << packageName << ", sandboxId=" << sandboxId
@@ -1001,7 +1006,7 @@
}
int VolumeManager::onVolumeMounted(android::vold::VolumeBase* vol) {
- if (!GetBoolProperty(kIsolatedStorage, false)) {
+ if (!hasIsolatedStorage()) {
return 0;
}
@@ -1036,7 +1041,7 @@
}
int VolumeManager::onVolumeUnmounted(android::vold::VolumeBase* vol) {
- if (!GetBoolProperty(kIsolatedStorage, false)) {
+ if (!hasIsolatedStorage()) {
return 0;
}
@@ -1084,7 +1089,7 @@
}
int VolumeManager::setPrimary(const std::shared_ptr<android::vold::VolumeBase>& vol) {
- if (GetBoolProperty(kIsolatedStorage, false)) {
+ if (hasIsolatedStorage()) {
return 0;
}
mPrimary = vol;
@@ -1095,7 +1100,7 @@
}
int VolumeManager::remountUid(uid_t uid, int32_t mountMode) {
- if (!GetBoolProperty(kIsolatedStorage, false)) {
+ if (!hasIsolatedStorage()) {
return remountUidLegacy(uid, mountMode);
}