Destroy vold socket interface completely.

Long live Binder.

Test: yes
Bug: 13758960
Change-Id: If6be379b5a873f1b0c66dd1522b87413ad10fc46
diff --git a/model/Disk.cpp b/model/Disk.cpp
index 151937f..f9799ad 100644
--- a/model/Disk.cpp
+++ b/model/Disk.cpp
@@ -20,7 +20,6 @@
 #include "Utils.h"
 #include "VolumeBase.h"
 #include "VolumeManager.h"
-#include "ResponseCode.h"
 #include "Ext4Crypt.h"
 
 #include <android-base/file.h>
@@ -151,12 +150,10 @@
 status_t Disk::create() {
     CHECK(!mCreated);
     mCreated = true;
-#if ENABLE_BINDER
+
     auto listener = VolumeManager::Instance()->getListener();
     if (listener) listener->onDiskCreated(getId(), mFlags);
-#else
-    notifyEvent(ResponseCode::DiskCreated, StringPrintf("%d", mFlags));
-#endif
+
     readMetadata();
     readPartitions();
     return OK;
@@ -166,12 +163,10 @@
     CHECK(mCreated);
     destroyAllVolumes();
     mCreated = false;
-#if ENABLE_BINDER
+
     auto listener = VolumeManager::Instance()->getListener();
     if (listener) listener->onDiskDestroyed(getId());
-#else
-    notifyEvent(ResponseCode::DiskDestroyed);
-#endif
+
     return OK;
 }
 
@@ -291,15 +286,10 @@
     }
     }
 
-#if ENABLE_BINDER
     auto listener = VolumeManager::Instance()->getListener();
     if (listener) listener->onDiskMetadataChanged(getId(),
             mSize, mLabel, mSysPath);
-#else
-    notifyEvent(ResponseCode::DiskSizeChanged, StringPrintf("%" PRIu64, mSize));
-    notifyEvent(ResponseCode::DiskLabelChanged, mLabel);
-    notifyEvent(ResponseCode::DiskSysPathChanged, mSysPath);
-#endif
+
     return OK;
 }
 
@@ -322,12 +312,10 @@
     status_t res = ForkExecvp(cmd, output);
     if (res != OK) {
         LOG(WARNING) << "sgdisk failed to scan " << mDevPath;
-#if ENABLE_BINDER
+
         auto listener = VolumeManager::Instance()->getListener();
         if (listener) listener->onDiskScanned(getId());
-#else
-        notifyEvent(ResponseCode::DiskScanned);
-#endif
+
         mJustPartitioned = false;
         return res;
     }
@@ -393,12 +381,9 @@
         }
     }
 
-#if ENABLE_BINDER
     auto listener = VolumeManager::Instance()->getListener();
     if (listener) listener->onDiskScanned(getId());
-#else
-    notifyEvent(ResponseCode::DiskScanned);
-#endif
+
     mJustPartitioned = false;
     return OK;
 }
@@ -560,16 +545,6 @@
     return OK;
 }
 
-void Disk::notifyEvent(int event) {
-    VolumeManager::Instance()->getBroadcaster()->sendBroadcast(event,
-            getId().c_str(), false);
-}
-
-void Disk::notifyEvent(int event, const std::string& value) {
-    VolumeManager::Instance()->getBroadcaster()->sendBroadcast(event,
-            StringPrintf("%s %s", getId().c_str(), value.c_str()).c_str(), false);
-}
-
 int Disk::getMaxMinors() {
     // Figure out maximum partition devices supported
     unsigned int majorId = major(mDevice);
diff --git a/model/Disk.h b/model/Disk.h
index 77ec7df..63acf6a 100644
--- a/model/Disk.h
+++ b/model/Disk.h
@@ -79,9 +79,6 @@
     status_t partitionPrivate();
     status_t partitionMixed(int8_t ratio);
 
-    void notifyEvent(int msg);
-    void notifyEvent(int msg, const std::string& value);
-
 private:
     /* ID that uniquely references this disk */
     std::string mId;
diff --git a/model/PrivateVolume.cpp b/model/PrivateVolume.cpp
index 9a96082..3152313 100644
--- a/model/PrivateVolume.cpp
+++ b/model/PrivateVolume.cpp
@@ -20,7 +20,6 @@
 #include "EmulatedVolume.h"
 #include "Utils.h"
 #include "VolumeManager.h"
-#include "ResponseCode.h"
 #include "cryptfs.h"
 
 #include <android-base/stringprintf.h>
@@ -55,14 +54,10 @@
 
 status_t PrivateVolume::readMetadata() {
     status_t res = ReadMetadata(mDmDevPath, mFsType, mFsUuid, mFsLabel);
-#if ENABLE_BINDER
+
     auto listener = getListener();
     if (listener) listener->onVolumeMetadataChanged(getId(), mFsType, mFsUuid, mFsLabel);
-#else
-    notifyEvent(ResponseCode::VolumeFsTypeChanged, mFsType);
-    notifyEvent(ResponseCode::VolumeFsUuidChanged, mFsUuid);
-    notifyEvent(ResponseCode::VolumeFsLabelChanged, mFsLabel);
-#endif
+
     return res;
 }
 
diff --git a/model/PublicVolume.cpp b/model/PublicVolume.cpp
index 04bafed..569203c 100644
--- a/model/PublicVolume.cpp
+++ b/model/PublicVolume.cpp
@@ -18,7 +18,6 @@
 #include "PublicVolume.h"
 #include "Utils.h"
 #include "VolumeManager.h"
-#include "ResponseCode.h"
 
 #include <android-base/stringprintf.h>
 #include <android-base/logging.h>
@@ -53,14 +52,10 @@
 
 status_t PublicVolume::readMetadata() {
     status_t res = ReadMetadataUntrusted(mDevPath, mFsType, mFsUuid, mFsLabel);
-#if ENABLE_BINDER
+
     auto listener = getListener();
     if (listener) listener->onVolumeMetadataChanged(getId(), mFsType, mFsUuid, mFsLabel);
-#else
-    notifyEvent(ResponseCode::VolumeFsTypeChanged, mFsType);
-    notifyEvent(ResponseCode::VolumeFsUuidChanged, mFsUuid);
-    notifyEvent(ResponseCode::VolumeFsLabelChanged, mFsLabel);
-#endif
+
     return res;
 }
 
diff --git a/model/VolumeBase.cpp b/model/VolumeBase.cpp
index b2eff3b..429f134 100644
--- a/model/VolumeBase.cpp
+++ b/model/VolumeBase.cpp
@@ -17,7 +17,6 @@
 #include "Utils.h"
 #include "VolumeBase.h"
 #include "VolumeManager.h"
-#include "ResponseCode.h"
 
 #include <android-base/stringprintf.h>
 #include <android-base/logging.h>
@@ -44,12 +43,9 @@
 
 void VolumeBase::setState(State state) {
     mState = state;
-#if ENABLE_BINDER
+
     auto listener = getListener();
     if (listener) listener->onVolumeStateChanged(getId(), static_cast<int32_t>(mState));
-#else
-    notifyEvent(ResponseCode::VolumeStateChanged, StringPrintf("%d", mState));
-#endif
 }
 
 status_t VolumeBase::setDiskId(const std::string& diskId) {
@@ -119,12 +115,10 @@
     }
 
     mPath = path;
-#if ENABLE_BINDER
+
     auto listener = getListener();
     if (listener) listener->onVolumePathChanged(getId(), mPath);
-#else
-    notifyEvent(ResponseCode::VolumePathChanged, mPath);
-#endif
+
     return OK;
 }
 
@@ -135,27 +129,13 @@
     }
 
     mInternalPath = internalPath;
-#if ENABLE_BINDER
+
     auto listener = getListener();
     if (listener) listener->onVolumeInternalPathChanged(getId(), mInternalPath);
-#else
-    notifyEvent(ResponseCode::VolumeInternalPathChanged, mInternalPath);
-#endif
+
     return OK;
 }
 
-void VolumeBase::notifyEvent(int event) {
-    if (mSilent) return;
-    VolumeManager::Instance()->getBroadcaster()->sendBroadcast(event,
-            getId().c_str(), false);
-}
-
-void VolumeBase::notifyEvent(int event, const std::string& value) {
-    if (mSilent) return;
-    VolumeManager::Instance()->getBroadcaster()->sendBroadcast(event,
-            StringPrintf("%s %s", getId().c_str(), value.c_str()).c_str(), false);
-}
-
 android::sp<android::os::IVoldListener> VolumeBase::getListener() {
     if (mSilent) {
         return nullptr;
@@ -186,14 +166,11 @@
 
     mCreated = true;
     status_t res = doCreate();
-#if ENABLE_BINDER
+
     auto listener = getListener();
     if (listener) listener->onVolumeCreated(getId(),
             static_cast<int32_t>(mType), mDiskId, mPartGuid);
-#else
-    notifyEvent(ResponseCode::VolumeCreated,
-            StringPrintf("%d \"%s\" \"%s\"", mType, mDiskId.c_str(), mPartGuid.c_str()));
-#endif
+
     setState(State::kUnmounted);
     return res;
 }
@@ -212,12 +189,10 @@
         setState(State::kRemoved);
     }
 
-#if ENABLE_BINDER
+
     auto listener = getListener();
     if (listener) listener->onVolumeDestroyed(getId());
-#else
-    notifyEvent(ResponseCode::VolumeDestroyed);
-#endif
+
     status_t res = doDestroy();
     mCreated = false;
     return res;
diff --git a/model/VolumeBase.h b/model/VolumeBase.h
index ac111c2..4aa8b02 100644
--- a/model/VolumeBase.h
+++ b/model/VolumeBase.h
@@ -115,9 +115,6 @@
     status_t setPath(const std::string& path);
     status_t setInternalPath(const std::string& internalPath);
 
-    void notifyEvent(int msg);
-    void notifyEvent(int msg, const std::string& value);
-
     android::sp<android::os::IVoldListener> getListener();
 
 private: