Move unsolicited vold events to Binder.

Create IVoldListener and move most unsolicited vold events over to
this new interface.  The remaining events will be routed through
method-specific listeners instead of a global one.

Move to upstream DISALLOW_COPY_AND_ASSIGN macro.

Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.DirectBootHostTest
Test: cts-tradefed run commandAndExit cts-dev -m CtsAppSecurityHostTestCases -t android.appsecurity.cts.AdoptableHostTest
Test: cts-tradefed run commandAndExit cts-dev -m CtsOsTestCases -t android.os.storage.cts.StorageManagerTest
Bug: 13758960
Change-Id: Ib9293487db2d525a76b9b9c2e9ac18d98601c6cf
diff --git a/VolumeManager.h b/VolumeManager.h
index 7dc69f3..2751ad5 100644
--- a/VolumeManager.h
+++ b/VolumeManager.h
@@ -36,6 +36,8 @@
 #include <sysutils/SocketListener.h>
 #include <sysutils/NetlinkEvent.h>
 
+#include "android/os/IVoldListener.h"
+
 #include "model/Disk.h"
 #include "model/VolumeBase.h"
 
@@ -96,6 +98,9 @@
     std::mutex& getLock() { return mLock; }
     std::mutex& getCryptLock() { return mCryptLock; }
 
+    void setListener(android::sp<android::os::IVoldListener> listener) { mListener = listener; }
+    android::sp<android::os::IVoldListener> getListener() { return mListener; }
+
     int start();
     int stop();
 
@@ -221,6 +226,8 @@
     std::mutex mLock;
     std::mutex mCryptLock;
 
+    android::sp<android::os::IVoldListener> mListener;
+
     std::list<std::shared_ptr<DiskSource>> mDiskSources;
     std::list<std::shared_ptr<android::vold::Disk>> mDisks;
     std::list<std::shared_ptr<android::vold::VolumeBase>> mObbVolumes;