Merge "mInternalEmulated could be used after shutdown() called"
am: 9b4a443bd6
Change-Id: Ia1007988297c39f391b35ad51645556ceeaf0cc6
This commit is contained in:
commit
92052aa582
1 changed files with 8 additions and 3 deletions
|
@ -423,7 +423,10 @@ std::shared_ptr<android::vold::Disk> VolumeManager::findDisk(const std::string&
|
|||
}
|
||||
|
||||
std::shared_ptr<android::vold::VolumeBase> VolumeManager::findVolume(const std::string& id) {
|
||||
if (mInternalEmulated->getId() == id) {
|
||||
// Vold could receive "mount" after "shutdown" command in the extreme case.
|
||||
// If this happens, mInternalEmulated will equal nullptr and
|
||||
// we need to deal with it in order to avoid null pointer crash.
|
||||
if (mInternalEmulated != nullptr && mInternalEmulated->getId() == id) {
|
||||
return mInternalEmulated;
|
||||
}
|
||||
for (const auto& disk : mDisks) {
|
||||
|
@ -687,8 +690,10 @@ next:
|
|||
int VolumeManager::reset() {
|
||||
// Tear down all existing disks/volumes and start from a blank slate so
|
||||
// newly connected framework hears all events.
|
||||
if (mInternalEmulated != nullptr) {
|
||||
mInternalEmulated->destroy();
|
||||
mInternalEmulated->create();
|
||||
}
|
||||
for (const auto& disk : mDisks) {
|
||||
disk->destroy();
|
||||
disk->create();
|
||||
|
|
Loading…
Reference in a new issue