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
diff --git a/volume_manager/VolumeBase.cpp b/volume_manager/VolumeBase.cpp
index 0c8e73b..990a486 100644
--- a/volume_manager/VolumeBase.cpp
+++ b/volume_manager/VolumeBase.cpp
@@ -35,7 +35,7 @@
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 @@
}
}
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;
}