libbinder: RpcConnection: add ID
In preparation to have the server be able to distinguish clients and
clients to be able to dynamically create threads that are assigned to
them.
Future considerations:
- make ID impossible to guess (right now, one client might be able to
get ahold of a thread from a server). We may implement something here
or go for something existing like TLS.
- combine getting max threads and this? will wait until dynamic threads
are actually implemented and we know we need this ID and we're looking
at performance. For now this is a placeholder to enable dynamic client
APIs.
Bug: 185167543
Test: binderRpcTest
Change-Id: If8563c69930c23b9ca91090b4f59ef1f51073f24
diff --git a/libs/binder/RpcServer.cpp b/libs/binder/RpcServer.cpp
index 0753b54..5f024ca 100644
--- a/libs/binder/RpcServer.cpp
+++ b/libs/binder/RpcServer.cpp
@@ -128,7 +128,7 @@
LOG_ALWAYS_FATAL_IF(mServer.get() == -1, "RpcServer must be setup to join.");
// TODO(b/185167543): support more than one client at once
mConnection = RpcConnection::make();
- mConnection->setForServer(sp<RpcServer>::fromExisting(this));
+ mConnection->setForServer(sp<RpcServer>::fromExisting(this), 42 /*placeholder id*/);
mStarted = true;
for (size_t i = 0; i < mMaxThreads; i++) {