diff options
author | Tom Marshall <tdm.code@gmail.com> | 2019-07-24 21:12:07 +0200 |
---|---|---|
committer | Alessandro <ales.astone@gmail.com> | 2020-04-11 12:15:16 +0200 |
commit | b00c91f73342c9a0965083218bf1dd01bf87ffc8 (patch) | |
tree | 118ca5ada6baed4ec169ee6175f50cfcea078f0b /volume_manager/VolumeBase.cpp | |
parent | bead261398f56ffc87757f14c62eea3a8fa67e27 (diff) | |
download | android_bootable_recovery-b00c91f73342c9a0965083218bf1dd01bf87ffc8.tar.gz android_bootable_recovery-b00c91f73342c9a0965083218bf1dd01bf87ffc8.tar.bz2 android_bootable_recovery-b00c91f73342c9a0965083218bf1dd01bf87ffc8.zip |
recovery: Hide unmountable volumes from selection
* In volume manager, check if new volumes are mountable.
* Check volumes for mountable for inclusion into update list.
* Erase unmountable volumes from volumes vector for consistency with
the item array.
Change-Id: I89ff6cc05a93afffe5e46b24d70fc368bccaf020
Diffstat (limited to 'volume_manager/VolumeBase.cpp')
-rw-r--r-- | volume_manager/VolumeBase.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/volume_manager/VolumeBase.cpp b/volume_manager/VolumeBase.cpp index 0c8e73ba..990a486e 100644 --- a/volume_manager/VolumeBase.cpp +++ b/volume_manager/VolumeBase.cpp @@ -35,7 +35,7 @@ namespace android { namespace volmgr { VolumeBase::VolumeBase(Type type) - : mType(type), mMountFlags(0), mCreated(false), mState(State::kUnmounted), mSilent(false) {} + : mType(type), mMountFlags(0), mCreated(false), mState(State::kUnmounted), mSilent(false), mMountable(false) {} VolumeBase::~VolumeBase() { CHECK(!mCreated); @@ -131,9 +131,21 @@ status_t VolumeBase::create() { } } setState(State::kUnmounted); + + mMountable = detectMountable(); + return res; } +bool VolumeBase::detectMountable() { + bool mountable = false; + if (doMount() == OK) { + mountable = true; + doUnmount(); + } + return mountable; +} + status_t VolumeBase::doCreate() { return OK; } |