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
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 @@
     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