diff options
author | Risan <risan@google.com> | 2020-02-07 18:03:44 +0900 |
---|---|---|
committer | Risan <risan@google.com> | 2020-02-14 04:38:59 +0000 |
commit | 73a7a85c853368c33d0313bead59c0159adedbd1 (patch) | |
tree | 3434e9346a8d936a6c3c89e3c30c8c28f91be54a /VolumeManager.cpp | |
parent | dd85fe2e5e65b221341ccf1a8ab5024e524cbf81 (diff) | |
download | vold-73a7a85c853368c33d0313bead59c0159adedbd1.tar.gz |
Passed kUsb and kSd flags
Initially, we were thinking to pass kInternal for non usb drive/sd card
drive (for local external storage like directory shared from ChromeOS).
Fortunately, the DocumentsUI logic apparently has TYPE_LOCAL with
R.drawable.ic_root_smartphone (that is overlayable) for external storage
other than TYPE_USB and TYPE_SD.
Therefore, instead of creating a kInternal flags, we can just passed kUsb
and kSd and not passing anything for "internal external storage" - which
will render ic_root_usb, ic_root_sd, and ic_root_smartphone as icons
accordingly. And since ic_root_smartphone is already overlayable, we
could overlayed in /vendor - which effectively is what we initially
wanted when thinking of introducing kInternal flag.
Bug: 132796154
Test: Customize flags in /vendor for different devices and DocumentsUI
shows the ic_root_smartphone (which can be overlayed) when kUsb is not
passed, and USB icon when kUsb is passed.
Change-Id: I55f13e214bbb2aeed96b6950bcf391121174c354
Diffstat (limited to 'VolumeManager.cpp')
-rw-r--r-- | VolumeManager.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/VolumeManager.cpp b/VolumeManager.cpp index 0c81cb76..bb624413 100644 --- a/VolumeManager.cpp +++ b/VolumeManager.cpp @@ -899,18 +899,19 @@ int VolumeManager::destroyObb(const std::string& volId) { int VolumeManager::createStubVolume(const std::string& sourcePath, const std::string& mountPath, const std::string& fsType, const std::string& fsUuid, - const std::string& fsLabel, int32_t flags __unused, + const std::string& fsLabel, int32_t flags, std::string* outVolId) { dev_t stubId = --mNextStubId; auto vol = std::shared_ptr<android::vold::StubVolume>( new android::vold::StubVolume(stubId, sourcePath, mountPath, fsType, fsUuid, fsLabel)); - // TODO (b/132796154): Passed each supported flags explicitly here. + int32_t passedFlags = android::vold::Disk::Flags::kStub; + passedFlags |= (flags & android::vold::Disk::Flags::kUsb); + passedFlags |= (flags & android::vold::Disk::Flags::kSd); // StubDisk doesn't have device node corresponds to it. So, a fake device - // number is used. The supported flags will be infered from the - // currently-unused flags parameter. + // number is used. auto disk = std::shared_ptr<android::vold::Disk>( - new android::vold::Disk("stub", stubId, "stub", android::vold::Disk::Flags::kStub)); + new android::vold::Disk("stub", stubId, "stub", passedFlags)); disk->initializePartition(vol); handleDiskAdded(disk); *outVolId = vol->getId(); |