Use interfaceDescriptor instead of interfaceChain

wherever suits. Sementically, interfaceDescriptor
returns the first element of interfaceChain; use
interfaceDescriptor when the rest of the elements
aren't used.

Bug: 34136228

Test: hidl_test
Change-Id: Ie3332c168a792ab018d9b762f9bf6c15ddcbf998
diff --git a/Interface.cpp b/Interface.cpp
index b4a1b67..57f3ca4 100644
--- a/Interface.cpp
+++ b/Interface.cpp
@@ -669,17 +669,13 @@
         << " o) ";
 
     out.block([&] {
-        out << "std::string os;\nbool ok = false;\n";
-        // TODO b/34136228 use interfaceDescriptor instead
-        out << "auto ret = o->interfaceChain([&os, &ok] (const auto &chain) ";
+        out << "std::string os;\n";
+        out << "auto ret = o->interfaceDescriptor([&os] (const auto &name) ";
         out.block([&] {
-            out.sIf("chain.size() >= 1", [&] {
-                out << "os += chain[0].c_str();\n"
-                    << "ok = true;\n";
-            }).endl();
+            out << "os += name.c_str();\n";
         });
         out << ");\n";
-        out.sIf("!ret.isOk() || !ok", [&] {
+        out.sIf("!ret.isOk()", [&] {
             out << "os += \"[class or subclass of \";\n"
                 << "os += " << fullName() << "::descriptor;\n"
                 << "os += \"]\";\n";
diff --git a/test/main.cpp b/test/main.cpp
index 2f5bd64..6dda6b2 100644
--- a/test/main.cpp
+++ b/test/main.cpp
@@ -1281,9 +1281,8 @@
                 [&](const auto &out) {
                     EXPECT_EQ(in.size(), out.size());
 
-                    EXPECT_OK(out[0]->interfaceChain([](const auto &names) {
-                        ASSERT_GT(names.size(), 0u);
-                        ASSERT_STREQ(names[0].c_str(), ISimple::descriptor);
+                    EXPECT_OK(out[0]->interfaceDescriptor([](const auto &name) {
+                        ASSERT_STREQ(name.c_str(), ISimple::descriptor);
                     }));
                     for (size_t i = 0; i < in.size(); ++i) {
                         sp<ISimple> inSimple = ISimple::castFrom(in[i]);
@@ -1419,11 +1418,11 @@
     sp<ISimple> out = ret;
     ASSERT_NE(out.get(), nullptr);
     EXPECT_EQ(out->getCookie(), 42);
-    EXPECT_OK(out->customVecInt([&](const auto &) { }));
-    EXPECT_OK(out->customVecStr([&](const auto &) { }));
-    EXPECT_OK(out->interfaceChain([&](const auto &) { }));
-    EXPECT_OK(out->mystr([&](const auto &) { }));
-    EXPECT_OK(out->myhandle([&](const auto &) { }));
+    EXPECT_OK(out->customVecInt([](const auto &) { }));
+    EXPECT_OK(out->customVecStr([](const auto &) { }));
+    EXPECT_OK(out->ping());
+    EXPECT_OK(out->mystr([](const auto &) { }));
+    EXPECT_OK(out->myhandle([](const auto &) { }));
 }
 
 TEST_F(HidlTest, InheritRemoteGrandparentTest) {