Allow registering multiple event listeners from the same process
Rather than store the listener in a map keyed by the pid of thecaller,
we simply store them in a set keyed by the unique address of the binder
interface itself.
Test: system/netd/tests/runtests.sh
Change-Id: I811ff356653334df9fb4afa8501cd9375f1bdd68
diff --git a/server/NetdNativeService.cpp b/server/NetdNativeService.cpp
index c7ea539..ce2dd23 100644
--- a/server/NetdNativeService.cpp
+++ b/server/NetdNativeService.cpp
@@ -1518,10 +1518,8 @@
binder::Status NetdNativeService::registerUnsolicitedEventListener(
const android::sp<android::net::INetdUnsolicitedEventListener>& listener) {
ENFORCE_PERMISSION(NETWORK_STACK);
- pid_t pid = IPCThreadState::self()->getCallingPid();
- auto entry = gLog.newEntry().prettyFunction(__PRETTY_FUNCTION__).arg(pid);
-
- gCtls->eventReporter.registerUnsolEventListener(pid, listener);
+ auto entry = gLog.newEntry().prettyFunction(__PRETTY_FUNCTION__);
+ gCtls->eventReporter.registerUnsolEventListener(listener);
gLog.log(entry.withAutomaticDuration());
return binder::Status::ok();
}