Emulated volumes above private volumes.

When a private volume is mounted, create an emulated volume above it
hosted at the /media path on that device.  That emulated volume is
automatically torn down when unmounting the private volume.

Add "removed" state for volume, which signals to framework that
media has left the building, send when the volume is destroyed.

Bug: 19993667
Change-Id: I1f82b51de578ac5cfcc5d7b9a6fb44f6f25c775c
diff --git a/VolumeBase.cpp b/VolumeBase.cpp
index de5b072..3b49b0d 100644
--- a/VolumeBase.cpp
+++ b/VolumeBase.cpp
@@ -135,6 +135,7 @@
     mCreated = true;
     status_t res = doCreate();
     notifyEvent(ResponseCode::VolumeCreated, StringPrintf("%d", mType));
+    setState(State::kUnmounted);
     return res;
 }
 
@@ -149,6 +150,7 @@
         unmount();
     }
 
+    setState(State::kRemoved);
     notifyEvent(ResponseCode::VolumeDestroyed);
     status_t res = doDestroy();
     mCreated = false;
@@ -185,8 +187,8 @@
     setState(State::kUnmounting);
 
     for (auto vol : mVolumes) {
-        if (vol->unmount()) {
-            LOG(WARNING) << getId() << " failed to unmount " << vol->getId()
+        if (vol->destroy()) {
+            LOG(WARNING) << getId() << " failed to destroy " << vol->getId()
                     << " stacked above";
         }
     }