Disable getDebugInfo address leak for production builds.

On production builds debugfs won't be available, so lshal cannot
infer binder relationships anyway. The address leak on production
builds also expose a security hole for address space attacks.
Added a build-time flag to disable the address leak on user builds.
The address will still be exposed for eng and userdebug builds so
that lshal can work properly.

Bug: 34899586
Test: lshal still works
Change-Id: Id1c381fbccad7584c2932deb9212d6996eeefd75
diff --git a/base/HidlSupport.cpp b/base/HidlSupport.cpp
index 91d56e7..547f7e7 100644
--- a/base/HidlSupport.cpp
+++ b/base/HidlSupport.cpp
@@ -77,6 +77,16 @@
             vintf::VintfObject::GetDeviceHalManifest());
 }
 
+namespace details {
+bool debuggable() {
+#ifdef LIBHIDL_TARGET_DEBUGGABLE
+    return true;
+#else
+    return false;
+#endif
+}
+}  // namespace details
+
 hidl_handle::hidl_handle() {
     mHandle = nullptr;
     mOwnsHandle = false;
diff --git a/base/include/hidl/HidlSupport.h b/base/include/hidl/HidlSupport.h
index a16701b..7737011 100644
--- a/base/include/hidl/HidlSupport.h
+++ b/base/include/hidl/HidlSupport.h
@@ -63,6 +63,11 @@
 vintf::Transport getTransport(const std::string &interfaceName,
                               const std::string &instanceName);
 
+namespace details {
+// Return true on userdebug / eng builds and false on user builds.
+bool debuggable();
+} //  namespace details
+
 // hidl_death_recipient is a callback interfaced that can be used with
 // linkToDeath() / unlinkToDeath()
 struct hidl_death_recipient : public virtual RefBase {