summaryrefslogtreecommitdiff
path: root/libs/binder/RpcState.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/RpcState.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/RpcState.cpp')
-rw-r--r--libs/binder/RpcState.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/libs/binder/RpcState.cpp b/libs/binder/RpcState.cpp
index 9ba64f3407..09b3d68626 100644
--- a/libs/binder/RpcState.cpp
+++ b/libs/binder/RpcState.cpp
@@ -870,7 +870,9 @@ processTransactInternalTailCall:
if (server) {
switch (transaction->code) {
case RPC_SPECIAL_TRANSACT_GET_ROOT: {
- replyStatus = reply.writeStrongBinder(server->getRootObject());
+ sp<IBinder> root = session->mSessionSpecificRootObject
+ ?: server->getRootObject();
+ replyStatus = reply.writeStrongBinder(root);
break;
}
default: {