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
This commit is contained in:
parent
dd85fe2e5e
commit
73a7a85c85
1 changed files with 6 additions and 5 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue