libbinder: RPC with getInterfaceDescriptor
I need to follow up/add tests for all the built-in transactions, since
they need to call markForBinder, but this is required for making RPC
calls over NDK because this backend proactively retrieves the interface
descriptor (side note: potential optimization improvement).
Bug: 167966510
Test: binderRpcTest
Change-Id: I62ec7bf09040563d46aa43a685efb87e3add524f
diff --git a/libs/binder/BpBinder.cpp b/libs/binder/BpBinder.cpp
index 825a821..53b36ff 100644
--- a/libs/binder/BpBinder.cpp
+++ b/libs/binder/BpBinder.cpp
@@ -194,10 +194,13 @@
const String16& BpBinder::getInterfaceDescriptor() const
{
if (isDescriptorCached() == false) {
- Parcel send, reply;
+ sp<BpBinder> thiz = const_cast<BpBinder*>(this);
+
+ Parcel data;
+ data.markForBinder(thiz);
+ Parcel reply;
// do the IPC without a lock held.
- status_t err = const_cast<BpBinder*>(this)->transact(
- INTERFACE_TRANSACTION, send, &reply);
+ status_t err = thiz->transact(INTERFACE_TRANSACTION, data, &reply);
if (err == NO_ERROR) {
String16 res(reply.readString16());
Mutex::Autolock _l(mLock);