Use "sys.isolated_storage_snapshot" prop to check for the feature.

StorageManager.hasIsolatedStorage() has already been updated to use
this, so most callers are already using this sys prop. Now, updating
remaining callers to use it as well.

Bug: 122559151
Test: manual
Change-Id: I6982a84b737a1d329f397b8182b7b7cdc5a8897f
This commit is contained in:
Sudheer Shanka 2019-01-17 17:20:47 -08:00
parent 64918e6e4e
commit 34b437b301

View file

@ -79,6 +79,7 @@ static const char* kPathUserMount = "/mnt/user";
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() {
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 @@ int VolumeManager::onUserStarted(userid_t userId, const std::vector<std::string>
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 @@ int VolumeManager::onUserStopped(userid_t userId) {
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::UnmountTree(mntTargetDir) != 0) {
@ -897,7 +902,7 @@ int VolumeManager::addSandboxIds(const std::vector<int32_t>& appIds,
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::prepareSandboxForApp(const std::string& packageName, appid_t
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::onSecureKeyguardStateChanged(bool isShowing) {
}
int VolumeManager::onVolumeMounted(android::vold::VolumeBase* vol) {
if (!GetBoolProperty(kIsolatedStorage, false)) {
if (!hasIsolatedStorage()) {
return 0;
}
@ -1036,7 +1041,7 @@ int VolumeManager::onVolumeMounted(android::vold::VolumeBase* vol) {
}
int VolumeManager::onVolumeUnmounted(android::vold::VolumeBase* vol) {
if (!GetBoolProperty(kIsolatedStorage, false)) {
if (!hasIsolatedStorage()) {
return 0;
}
@ -1084,7 +1089,7 @@ int VolumeManager::destroySandboxesForVol(android::vold::VolumeBase* vol, userid
}
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::setPrimary(const std::shared_ptr<android::vold::VolumeBase>&
}
int VolumeManager::remountUid(uid_t uid, int32_t mountMode) {
if (!GetBoolProperty(kIsolatedStorage, false)) {
if (!hasIsolatedStorage()) {
return remountUidLegacy(uid, mountMode);
}