summaryrefslogtreecommitdiff
path: root/libs/binder/RpcSession.cpp
diff options
context:
space:
mode:
author Steven Moreland <smoreland@google.com> 2021-10-14 16:50:35 -0700
committer Steven Moreland <smoreland@google.com> 2021-10-20 17:43:00 -0700
commit51c44a96895b8c462e24984e510b09aded52297f (patch)
treed8cf40affab94bbc4091b8b3c4f65ebba2630c98 /libs/binder/RpcSession.cpp
parent269a5d6d937d9b39056aa6f416034ede0ecbafb1 (diff)
libbinder: support server-specific session
When multiple clients connect to a server, we need a way to tell these clients apart. Having a per-client root object is the easiest way to do this (the alternative, using getCalling* like is used in binder, isn't so great because it requires global/thread local place, but given that many RpcSession objects can be created, and these can also be used in conjunction with kernel binder, it is complicated figuring out exactly where to call getCalling*). Bug: 199259751 Test: binderRpcTest Change-Id: I5727db618b5ea138bfa19e75ed915f6a6991518e
Diffstat (limited to 'libs/binder/RpcSession.cpp')
-rw-r--r--libs/binder/RpcSession.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/libs/binder/RpcSession.cpp b/libs/binder/RpcSession.cpp
index 9eef3e8914..137411bc6b 100644
--- a/libs/binder/RpcSession.cpp
+++ b/libs/binder/RpcSession.cpp
@@ -700,7 +700,8 @@ status_t RpcSession::addOutgoingConnection(std::unique_ptr<RpcTransport> rpcTran
}
bool RpcSession::setForServer(const wp<RpcServer>& server, const wp<EventListener>& eventListener,
- const std::vector<uint8_t>& sessionId) {
+ const std::vector<uint8_t>& sessionId,
+ const sp<IBinder>& sessionSpecificRoot) {
LOG_ALWAYS_FATAL_IF(mForServer != nullptr);
LOG_ALWAYS_FATAL_IF(server == nullptr);
LOG_ALWAYS_FATAL_IF(mEventListener != nullptr);
@@ -713,6 +714,7 @@ bool RpcSession::setForServer(const wp<RpcServer>& server, const wp<EventListene
mId = sessionId;
mForServer = server;
mEventListener = eventListener;
+ mSessionSpecificRootObject = sessionSpecificRoot;
return true;
}