summaryrefslogtreecommitdiff
path: root/transport/HidlTransportSupport.cpp
diff options
context:
space:
mode:
authorYifan Hong <elsk@google.com>2017-11-20 11:36:51 -0800
committerYifan Hong <elsk@google.com>2017-11-20 11:53:26 -0800
commit7a4b75659088fe2fa2723bb3cddc07301b9c62bc (patch)
treee077acfa2ac91594a71900841c219ff9db46c2b7 /transport/HidlTransportSupport.cpp
parent21796bf03171bef7b2c46cd81b24cba1f7ae97e0 (diff)
downloadlibhidl-7a4b75659088fe2fa2723bb3cddc07301b9c62bc.tar.gz
HidlTransportSupport: add getPidIfSharable.
This function provides PID when it is "sharable" (i.e on debug builds). Auto-generated IBase::getDebugInfo uses this function (both in Java and C++) to provide the PID. Test: builds Test: lshal works Bug: 68430495 Bug: 68992575 Change-Id: I051e795bb01528341a5f061892902a9f305ad493
Diffstat (limited to 'transport/HidlTransportSupport.cpp')
-rw-r--r--transport/HidlTransportSupport.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/transport/HidlTransportSupport.cpp b/transport/HidlTransportSupport.cpp
index 9bb8148..1a9f195 100644
--- a/transport/HidlTransportSupport.cpp
+++ b/transport/HidlTransportSupport.cpp
@@ -53,5 +53,16 @@ bool setMinSchedulerPolicy(const sp<::android::hidl::base::V1_0::IBase>& service
return true;
}
+namespace details {
+int32_t getPidIfSharable() {
+#if LIBHIDL_TARGET_DEBUGGABLE
+ return getpid();
+#else
+ using android::hidl::manager::V1_0::IServiceManager;
+ return IServiceManager::PidConstant::NO_PID;
+#endif
+}
+} // namespace details
+
} // namespace hardware
} // namespace android