libbinder_ndk: AIBinder_setInheritRt
Pipe through this option to libbinder_ndk. This was originally a HIDL
feature, enabled by default there. It was ported to libbinder, and it is
now exposed here.
Fixes: 209338827
Test: libbinder_ndk_unit_test (this test is also in VTS, so is
binderLibTest which has a function test of this API)
Change-Id: I0dde73654b37a414b9267a857a958d19de79bc9d
diff --git a/libs/binder/ndk/ibinder.cpp b/libs/binder/ndk/ibinder.cpp
index 6949c2c..28e3ff4 100644
--- a/libs/binder/ndk/ibinder.cpp
+++ b/libs/binder/ndk/ibinder.cpp
@@ -799,3 +799,12 @@
void AIBinder_setMinSchedulerPolicy(AIBinder* binder, int policy, int priority) {
binder->asABBinder()->setMinSchedulerPolicy(policy, priority);
}
+
+void AIBinder_setInheritRt(AIBinder* binder, bool inheritRt) {
+ ABBinder* localBinder = binder->asABBinder();
+ if (localBinder == nullptr) {
+ LOG(FATAL) << "AIBinder_setInheritRt must be called on a local binder";
+ }
+
+ localBinder->setInheritRt(inheritRt);
+}