Add kVisible flag to vold::Disk
The new flag is used to indicate that a stub volume (external storage volume shared with Chrome OS) is visible to Android apps. Bug: 123377807 Bug: 142684760 Bug: 132796154 Test: Check logcat logs for StorageManagerService.mount() when the Test: visibility setting of a removable device is toggled in Chrome OS. Test: Confirm that the visibility setting is properly set. Test: (Tested in R) Change-Id: Ica69110d5667837a72a5c8693ff3bccc0f09a82d
This commit is contained in:
parent
6836a8bda7
commit
defc0454a2
2 changed files with 13 additions and 5 deletions
|
@ -1145,9 +1145,14 @@ int VolumeManager::createStubVolume(const std::string& sourcePath, const std::st
|
||||||
auto vol = std::shared_ptr<android::vold::StubVolume>(
|
auto vol = std::shared_ptr<android::vold::StubVolume>(
|
||||||
new android::vold::StubVolume(stubId, sourcePath, mountPath, fsType, fsUuid, fsLabel));
|
new android::vold::StubVolume(stubId, sourcePath, mountPath, fsType, fsUuid, fsLabel));
|
||||||
|
|
||||||
int32_t passedFlags = android::vold::Disk::Flags::kStub;
|
int32_t passedFlags = 0;
|
||||||
passedFlags |= (flags & android::vold::Disk::Flags::kUsb);
|
passedFlags |= (flags & android::vold::Disk::Flags::kUsb);
|
||||||
passedFlags |= (flags & android::vold::Disk::Flags::kSd);
|
passedFlags |= (flags & android::vold::Disk::Flags::kSd);
|
||||||
|
if (flags & android::vold::Disk::Flags::kStubVisible) {
|
||||||
|
passedFlags |= (flags & android::vold::Disk::Flags::kStubVisible);
|
||||||
|
} else {
|
||||||
|
passedFlags |= (flags & android::vold::Disk::Flags::kStubInvisible);
|
||||||
|
}
|
||||||
// StubDisk doesn't have device node corresponds to it. So, a fake device
|
// StubDisk doesn't have device node corresponds to it. So, a fake device
|
||||||
// number is used.
|
// number is used.
|
||||||
auto disk = std::shared_ptr<android::vold::Disk>(
|
auto disk = std::shared_ptr<android::vold::Disk>(
|
||||||
|
|
11
model/Disk.h
11
model/Disk.h
|
@ -53,9 +53,12 @@ class Disk {
|
||||||
kUsb = 1 << 3,
|
kUsb = 1 << 3,
|
||||||
/* Flag that disk is EMMC internal */
|
/* Flag that disk is EMMC internal */
|
||||||
kEmmc = 1 << 4,
|
kEmmc = 1 << 4,
|
||||||
/* Flag that disk is Stub disk, i.e., disk that is managed from outside
|
/* Flag that disk is an invisible Stub disk, i.e., disk that is managed from outside
|
||||||
* Android (e.g., ARC++). */
|
* Android (e.g., ARC++) and invisible to apps. */
|
||||||
kStub = 1 << 5,
|
kStubInvisible = 1 << 5,
|
||||||
|
/* Flag that disk is a visible Stub disk, i.e., disk that is managed from outside
|
||||||
|
* Android (e.g., ARC++) and visible to apps. */
|
||||||
|
kStubVisible = 1 << 6,
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::string& getId() const { return mId; }
|
const std::string& getId() const { return mId; }
|
||||||
|
@ -120,7 +123,7 @@ class Disk {
|
||||||
|
|
||||||
int getMaxMinors();
|
int getMaxMinors();
|
||||||
|
|
||||||
bool isStub() { return mFlags & kStub; }
|
bool isStub() { return (mFlags & kStubInvisible) || (mFlags & kStubVisible); }
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(Disk);
|
DISALLOW_COPY_AND_ASSIGN(Disk);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue