Merge "Revert "Allow proxies to be compared and identified.""
diff --git a/Interface.cpp b/Interface.cpp
index 0604dbd..5974288 100644
--- a/Interface.cpp
+++ b/Interface.cpp
@@ -700,6 +700,8 @@
             << "::android::hardware::toBinder<\n";
         out.indent(2, [&] {
             out << fqName().cppName()
+                << ", "
+                << getProxyFqName().cppName()
                 << ">("
                 << name
                 << ");\n";
diff --git a/generateCpp.cpp b/generateCpp.cpp
index 80fb87c..fa2bf25 100644
--- a/generateCpp.cpp
+++ b/generateCpp.cpp
@@ -886,7 +886,6 @@
         << " const std::string& HidlInstrumentor_package,"
         << " const std::string& HidlInstrumentor_interface);"
         << "\n\n";
-    out << "virtual ~" << klassName << "();\n\n";
     out << "::android::status_t onTransact(\n";
     out.indent();
     out.indent();
@@ -1512,11 +1511,6 @@
         out << "}\n\n";
     }
 
-    out << klassName << "::~" << klassName << "() ";
-    out.block([&]() {
-        out << "::android::hardware::details::gBnMap.erase(_hidl_mImpl.get());\n";
-    }).endl().endl();
-
     status_t err = generateMethods(out, [&](const Method *method, const Interface *) {
         if (!method->isHidlReserved() || !method->overridesCppImpl(IMPL_STUB_IMPL)) {
             return OK;
@@ -1968,7 +1962,8 @@
             out << "return ::android::hardware::details::castInterface<";
             out << iface->localName() << ", "
                 << superType->fqName().cppName() << ", "
-                << iface->getProxyName()
+                << iface->getProxyName() << ", "
+                << superType->getProxyFqName().cppName()
                 << ">(\n";
             out.indent();
             out.indent();
diff --git a/test/hidl_test_client.cpp b/test/hidl_test_client.cpp
index 497c335..8dae338 100644
--- a/test/hidl_test_client.cpp
+++ b/test/hidl_test_client.cpp
@@ -724,8 +724,6 @@
 }
 
 TEST_F(HidlTest, TestToken) {
-    using android::hardware::interfacesEqual;
-
     Return<void> ret = tokenManager->createToken(manager, [&] (const hidl_vec<uint8_t> &token) {
         Return<sp<IBase>> retService = tokenManager->get(token);
         EXPECT_OK(retService);
@@ -734,7 +732,10 @@
             EXPECT_NE(nullptr, service.get());
             sp<IServiceManager> retManager = IServiceManager::castFrom(service);
 
-            EXPECT_TRUE(interfacesEqual(manager, retManager));
+            // TODO(b/33818800): should have only one Bp per process
+            // EXPECT_EQ(manager, retManager);
+
+            EXPECT_NE(nullptr, retManager.get());
         }
 
         Return<bool> unregisterRet = tokenManager->unregister(token);
@@ -1622,7 +1623,7 @@
 
     if (mode == BINDERIZED) {
         EXPECT_TRUE(bar->isRemote());
-        binder = ::android::hardware::toBinder<IBar>(bar);
+        binder = ::android::hardware::toBinder<IBar, BpHwBar>(bar);
     } else {
         // For a local test, just wrap the implementation with a BnHwBar
         binder = new BnHwBar(bar);