// Sets a default ACL on the directory.
int SetDefaultAcl(const std::string& path, mode_t mode, uid_t uid, gid_t gid) {
- if (IsFilesystemSupported("sdcardfs")) {
+ if (IsSdcardfsUsed()) {
// sdcardfs magically takes care of this
return OK;
}
return ret;
}
- if (!IsFilesystemSupported("sdcardfs")) {
+ if (!IsSdcardfsUsed()) {
ret = SetQuotaProjectId(path, projectId);
}
return ret;
}
- if (!IsFilesystemSupported("sdcardfs")) {
+ if (!IsSdcardfsUsed()) {
ret = SetQuotaProjectId(itEntry.path(), projectId);
if (ret != 0) {
return ret;
long projectId;
size_t pos;
int ret = 0;
+ bool sdcardfsSupport = IsSdcardfsUsed();
// Make sure the Android/ directories exist and are setup correctly
ret = PrepareAndroidDirs(root);
// Check that the next part matches one of the allowed Android/ dirs
if (StartsWith(pathFromRoot, kAppDataDir)) {
appDir = kAppDataDir;
- if (!IsFilesystemSupported("sdcardfs")) {
+ if (!sdcardfsSupport) {
gid = AID_EXT_DATA_RW;
}
} else if (StartsWith(pathFromRoot, kAppMediaDir)) {
appDir = kAppMediaDir;
- if (!IsFilesystemSupported("sdcardfs")) {
+ if (!sdcardfsSupport) {
gid = AID_MEDIA_RW;
}
} else if (StartsWith(pathFromRoot, kAppObbDir)) {
appDir = kAppObbDir;
- if (!IsFilesystemSupported("sdcardfs")) {
+ if (!sdcardfsSupport) {
gid = AID_EXT_OBB_RW;
}
} else {
return ret;
}
- if (!IsFilesystemSupported("sdcardfs")) {
+ if (!sdcardfsSupport) {
// Set project ID inheritance, so that future subdirectories inherit the
// same project ID
ret = SetQuotaInherit(pathToCreate);
return supported.find(fsType + "\n") != std::string::npos;
}
+bool IsSdcardfsUsed() {
+ return IsFilesystemSupported("sdcardfs") &&
+ base::GetBoolProperty(kExternalStorageSdcardfs, true);
+}
+
status_t WipeBlockDevice(const std::string& path) {
status_t res = -1;
const char* c_path = path.c_str();
return -errno;
}
- if (IsFilesystemSupported("sdcardfs")) {
+ if (IsSdcardfsUsed()) {
std::string sdcardfs_path(
StringPrintf("/mnt/runtime/full/%s", relative_upper_path.c_str()));
std::string androidObbDir = volumeRoot + kAppObbDir;
std::string androidMediaDir = volumeRoot + kAppMediaDir;
- bool useSdcardFs = IsFilesystemSupported("sdcardfs");
+ bool useSdcardFs = IsSdcardfsUsed();
// mode 0771 + sticky bit for inheriting GIDs
mode_t mode = S_IRWXU | S_IRWXG | S_IXOTH | S_ISGID;
static const char* kPropFuse = "persist.sys.fuse";
static const char* kVoldAppDataIsolationEnabled = "persist.sys.vold_app_data_isolation_enabled";
+static const char* kExternalStorageSdcardfs = "external_storage.sdcardfs.enabled";
/* SELinux contexts used depending on the block device type */
extern security_context_t sBlkidContext;
uint64_t GetTreeBytes(const std::string& path);
bool IsFilesystemSupported(const std::string& fsType);
+bool IsSdcardfsUsed();
bool IsFuseDaemon(const pid_t pid);
/* Wipes contents of block device at given path */
using android::vold::DeleteDirContentsAndDir;
using android::vold::EnsureDirExists;
using android::vold::IsFilesystemSupported;
+using android::vold::IsSdcardfsUsed;
using android::vold::IsVirtioBlkDevice;
using android::vold::PrepareAndroidDirs;
using android::vold::PrepareAppDirFromRoot;
static std::string getStorageDirSrc(userid_t userId, const std::string& dirName,
const std::string& packageName) {
- if (IsFilesystemSupported("sdcardfs")) {
+ if (IsSdcardfsUsed()) {
return StringPrintf("/mnt/runtime/default/emulated/%d/%s/%s",
userId, dirName.c_str(), packageName.c_str());
} else {
}
int VolumeManager::fixupAppDir(const std::string& path, int32_t appUid) {
- if (IsFilesystemSupported("sdcardfs")) {
+ if (IsSdcardfsUsed()) {
//sdcardfs magically does this for us
return OK;
}