Merge "Split MOUNT_FLAG_VISIBLE into MOUNT_FLAG_VISIBLE_FOR_{READ, WRITE}"
This commit is contained in:
commit
bddb449182
5 changed files with 19 additions and 9 deletions
|
@ -1002,8 +1002,8 @@ int VolumeManager::setupAppDir(const std::string& path, int32_t appUid, bool fix
|
|||
// The volume must be mounted
|
||||
return false;
|
||||
}
|
||||
if ((vol.getMountFlags() & VolumeBase::MountFlags::kVisible) == 0) {
|
||||
// and visible
|
||||
if (!vol.isVisibleForWrite()) {
|
||||
// App dirs should only be created for writable volumes.
|
||||
return false;
|
||||
}
|
||||
if (vol.getInternalPath().empty()) {
|
||||
|
@ -1077,8 +1077,8 @@ int VolumeManager::createObb(const std::string& sourcePath, const std::string& s
|
|||
// The volume must be mounted
|
||||
return false;
|
||||
}
|
||||
if ((vol.getMountFlags() & VolumeBase::MountFlags::kVisible) == 0) {
|
||||
// and visible
|
||||
if (!vol.isVisibleForWrite()) {
|
||||
// Obb volume should only be created for writable volumes.
|
||||
return false;
|
||||
}
|
||||
if (vol.getInternalPath().empty()) {
|
||||
|
|
|
@ -159,7 +159,8 @@ interface IVold {
|
|||
const int FSTRIM_FLAG_DEEP_TRIM = 1;
|
||||
|
||||
const int MOUNT_FLAG_PRIMARY = 1;
|
||||
const int MOUNT_FLAG_VISIBLE = 2;
|
||||
const int MOUNT_FLAG_VISIBLE_FOR_READ = 2;
|
||||
const int MOUNT_FLAG_VISIBLE_FOR_WRITE = 4;
|
||||
|
||||
const int PARTITION_TYPE_PUBLIC = 0;
|
||||
const int PARTITION_TYPE_PRIVATE = 1;
|
||||
|
|
|
@ -246,7 +246,7 @@ status_t EmulatedVolume::unmountSdcardFs() {
|
|||
|
||||
status_t EmulatedVolume::doMount() {
|
||||
std::string label = getLabel();
|
||||
bool isVisible = getMountFlags() & MountFlags::kVisible;
|
||||
bool isVisible = isVisibleForWrite();
|
||||
|
||||
mSdcardFsDefault = StringPrintf("/mnt/runtime/default/%s", label.c_str());
|
||||
mSdcardFsRead = StringPrintf("/mnt/runtime/read/%s", label.c_str());
|
||||
|
|
|
@ -97,7 +97,7 @@ status_t PublicVolume::doDestroy() {
|
|||
}
|
||||
|
||||
status_t PublicVolume::doMount() {
|
||||
bool isVisible = getMountFlags() & MountFlags::kVisible;
|
||||
bool isVisible = isVisibleForWrite();
|
||||
readMetadata();
|
||||
|
||||
if (mFsType == "vfat" && vfat::IsSupported()) {
|
||||
|
|
|
@ -63,8 +63,14 @@ class VolumeBase {
|
|||
enum MountFlags {
|
||||
/* Flag that volume is primary external storage */
|
||||
kPrimary = 1 << 0,
|
||||
/* Flag that volume is visible to normal apps */
|
||||
kVisible = 1 << 1,
|
||||
/*
|
||||
* Flags indicating that volume is visible to normal apps.
|
||||
* kVisibleForRead and kVisibleForWrite correspond to
|
||||
* VolumeInfo.MOUNT_FLAG_VISIBLE_FOR_READ and
|
||||
* VolumeInfo.MOUNT_FLAG_VISIBLE_FOR_WRITE, respectively.
|
||||
*/
|
||||
kVisibleForRead = 1 << 1,
|
||||
kVisibleForWrite = 1 << 2,
|
||||
};
|
||||
|
||||
enum class State {
|
||||
|
@ -103,6 +109,9 @@ class VolumeBase {
|
|||
std::shared_ptr<VolumeBase> findVolume(const std::string& id);
|
||||
|
||||
bool isEmulated() { return mType == Type::kEmulated; }
|
||||
bool isVisibleForRead() const { return (mMountFlags & MountFlags::kVisibleForRead) != 0; }
|
||||
bool isVisibleForWrite() const { return (mMountFlags & MountFlags::kVisibleForWrite) != 0; }
|
||||
bool isVisible() const { return isVisibleForRead() || isVisibleForWrite(); }
|
||||
|
||||
status_t create();
|
||||
status_t destroy();
|
||||
|
|
Loading…
Reference in a new issue