Merge "Add global definition of hidl_enum_iterator."
diff --git a/transport/HidlTransportSupport.cpp b/transport/HidlTransportSupport.cpp
index 9bb8148..1df6c38 100644
--- a/transport/HidlTransportSupport.cpp
+++ b/transport/HidlTransportSupport.cpp
@@ -16,6 +16,8 @@
 #include <hidl/HidlTransportSupport.h>
 #include <hidl/HidlBinderSupport.h>
 
+#include <android/hidl/manager/1.0/IServiceManager.h>
+
 namespace android {
 namespace hardware {
 
@@ -53,5 +55,16 @@
     return true;
 }
 
+namespace details {
+int32_t getPidIfSharable() {
+#if LIBHIDL_TARGET_DEBUGGABLE
+    return getpid();
+#else
+    using android::hidl::manager::V1_0::IServiceManager;
+    return static_cast<int32_t>(IServiceManager::PidConstant::NO_PID);
+#endif
+}
+}  // namespace details
+
 }  // namespace hardware
 }  // namespace android
diff --git a/transport/include/hidl/HidlTransportSupport.h b/transport/include/hidl/HidlTransportSupport.h
index 730727c..9123d6f 100644
--- a/transport/include/hidl/HidlTransportSupport.h
+++ b/transport/include/hidl/HidlTransportSupport.h
@@ -78,6 +78,9 @@
 
 namespace details {
 
+// Return PID on userdebug / eng builds and IServiceManager::PidConstant::NO_PID on user builds.
+int32_t getPidIfSharable();
+
 // cast the interface IParent to IChild.
 // Return nonnull if cast successful.
 // Return nullptr if: