Add readStrongBinder that takes an interface
We use a template function to let us pass arbitrary interfaces, all of which
can be cast to IBinder.
Change-Id: Iadf21c495cde43e8a5adb85a49e6592196f401ff
Test: unit tests
Bug: 23600713
Signed-off-by: Casey Dahlin <sadmac@google.com>
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index 48bf799..ab2cdab 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -1781,10 +1781,15 @@
return NULL;
}
+status_t Parcel::readStrongBinder(sp<IBinder>* val) const
+{
+ return unflatten_binder(ProcessState::self(), *this, val);
+}
+
sp<IBinder> Parcel::readStrongBinder() const
{
sp<IBinder> val;
- unflatten_binder(ProcessState::self(), *this, &val);
+ readStrongBinder(&val);
return val;
}