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);