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/RpcState.h b/libs/binder/RpcState.h
index 1cfa406..825fd7c 100644
--- a/libs/binder/RpcState.h
+++ b/libs/binder/RpcState.h
@@ -50,9 +50,12 @@
RpcState();
~RpcState();
+ // TODO(b/182940634): combine some special transactions into one "getServerInfo" call?
sp<IBinder> getRootObject(const base::unique_fd& fd, const sp<RpcConnection>& connection);
status_t getMaxThreads(const base::unique_fd& fd, const sp<RpcConnection>& connection,
size_t* maxThreadsOut);
+ status_t getConnectionId(const base::unique_fd& fd, const sp<RpcConnection>& connection,
+ int32_t* connectionIdOut);
[[nodiscard]] status_t transact(const base::unique_fd& fd, const RpcAddress& address,
uint32_t code, const Parcel& data,