Merge "Remove StubVolume disks upon vold reset events"
This commit is contained in:
commit
e8d0e486a3
2 changed files with 14 additions and 3 deletions
|
@ -899,10 +899,21 @@ int VolumeManager::reset() {
|
||||||
}
|
}
|
||||||
mInternalEmulatedVolumes.clear();
|
mInternalEmulatedVolumes.clear();
|
||||||
|
|
||||||
|
// Destroy and recreate all disks except that StubVolume disks are just
|
||||||
|
// destroyed and removed from both mDisks and mPendingDisks.
|
||||||
|
// StubVolumes are managed from outside Android (e.g. from Chrome OS) and
|
||||||
|
// their disk recreation on reset events should be handled from outside by
|
||||||
|
// calling createStubVolume() again.
|
||||||
for (const auto& disk : mDisks) {
|
for (const auto& disk : mDisks) {
|
||||||
disk->destroy();
|
disk->destroy();
|
||||||
disk->create();
|
if (!disk->isStub()) {
|
||||||
|
disk->create();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
const auto isStub = [](const auto& disk) { return disk->isStub(); };
|
||||||
|
mDisks.remove_if(isStub);
|
||||||
|
mPendingDisks.remove_if(isStub);
|
||||||
|
|
||||||
updateVirtualDisk();
|
updateVirtualDisk();
|
||||||
mAddedUsers.clear();
|
mAddedUsers.clear();
|
||||||
mStartedUsers.clear();
|
mStartedUsers.clear();
|
||||||
|
|
|
@ -70,6 +70,8 @@ class Disk {
|
||||||
const std::string& getLabel() const { return mLabel; }
|
const std::string& getLabel() const { return mLabel; }
|
||||||
int getFlags() const { return mFlags; }
|
int getFlags() const { return mFlags; }
|
||||||
|
|
||||||
|
bool isStub() const { return (mFlags & kStubInvisible) || (mFlags & kStubVisible); }
|
||||||
|
|
||||||
std::shared_ptr<VolumeBase> findVolume(const std::string& id);
|
std::shared_ptr<VolumeBase> findVolume(const std::string& id);
|
||||||
|
|
||||||
void listVolumes(VolumeBase::Type type, std::list<std::string>& list) const;
|
void listVolumes(VolumeBase::Type type, std::list<std::string>& list) const;
|
||||||
|
@ -123,8 +125,6 @@ class Disk {
|
||||||
|
|
||||||
int getMaxMinors();
|
int getMaxMinors();
|
||||||
|
|
||||||
bool isStub() { return (mFlags & kStubInvisible) || (mFlags & kStubVisible); }
|
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(Disk);
|
DISALLOW_COPY_AND_ASSIGN(Disk);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue