IBase::getReferenceInfo -> getDebugInfo

getDebugInfo is a more generalized name. Also, references
are not queryed from the server process, but rather only
pids and pointers to the server stub object is returned,
so that lshal can query from /d/binder/proc/{pid}.

Bug: 34777099
Bug: 34861460

Test: lshal
Test: NFC / light / audio with and without persistent.hal.binderized;
      run lshal to reflect this.

Change-Id: I3052fe67074c856eb2f56c3948ba078a00d04c52
diff --git a/Interface.cpp b/Interface.cpp
index 0fdad27..e7ed545 100644
--- a/Interface.cpp
+++ b/Interface.cpp
@@ -265,8 +265,8 @@
     return true;
 }
 
-bool Interface::fillGetReferenceInfoMethod(Method *method) const {
-    if (method->name() != "getReferenceInfo") {
+bool Interface::fillGetDebugInfoMethod(Method *method) const {
+    if (method->name() != "getDebugInfo") {
         return false;
     }
 
@@ -275,17 +275,14 @@
         {
             {IMPL_HEADER,
                 [this](auto &out) {
-                    // getReferenceInfo returns N/A for local objects.
-                    out << "_hidl_cb({ -1 });\n"
+                    // getDebugInfo returns N/A for local objects.
+                    out << "_hidl_cb({ -1 /* pid */, 0 /* ptr */ });\n"
                         << "return ::android::hardware::Void();";
                 }
             },
             {IMPL_STUB_IMPL,
                 [this](auto &out) {
-                    // TODO(b/34777099): need a kernel debug function to get the
-                    // true strong count.
-                    // uses BHwBinder->getStrongCount()
-                    out << "_hidl_cb({ this->getStrongCount() });\n"
+                    out << "_hidl_cb({ getpid(), reinterpret_cast<uint64_t>(this) });\n"
                         << "return ::android::hardware::Void();";
                 }
             }
@@ -294,7 +291,9 @@
             const Type &refInfo = method->results().front()->type();
             out << refInfo.getJavaType(false /* forInitializer */) << " info = new "
                 << refInfo.getJavaType(true /* forInitializer */) << "();\n"
-                << "info.refCount = -1;\n"
+                // TODO(b/34777099): PID for java.
+                << "info.pid = -1;\n"
+                << "info.ptr = 0;\n"
                 << "return info;";
         } } } /* javaImpl */
     );
@@ -349,7 +348,7 @@
             || fillLinkToDeathMethod(method)
             || fillUnlinkToDeathMethod(method)
             || fillSetHALInstrumentationMethod(method)
-            || fillGetReferenceInfoMethod(method);
+            || fillGetDebugInfoMethod(method);
         if (!fillSuccess) {
             LOG(ERROR) << "ERROR: hidl-gen does not recognize a reserved method "
                        << method->name();