Fix getService should retry on DEAD_OBJECT

If getService sees DEAD_OBJECT or nullptr when calling
interfaceChain on the retrieved service, it should
retry. Otherwise (e.g. TRANSACTION_FAILED for selinux
denials), it should bail out.

This retry doesn't happen for tryGetService.

Test: calling Debug.getMemoryInfo from apps does not hang
Test: kill system_server, audio_server restarts exactly once
      (tested 10/10 times)
Test: taking screenshots / using camera / using maps
Test: adb push
$OUT/data/nativetest/VtsHalNfcV1_0TargetTest/VtsHalNfcV1_0TargetTest
/data/local/tmp && adb shell
/data/local/tmp/VtsHalNfcV1_0TargetTest
Test: hidl_test

Bug: 36153684
Bug: 36611652
Change-Id: Ibc0de0953dffea52acb366faf09f397176554502
diff --git a/generateCpp.cpp b/generateCpp.cpp
index d3ddf43..ef26d35 100644
--- a/generateCpp.cpp
+++ b/generateCpp.cpp
@@ -240,7 +240,8 @@
                 // race condition. hwservicemanager drops the service
                 // from waitForHwService to here
                 out << "ALOGW(\"getService: found null hwbinder interface\");\n"
-                    << "break;\n";
+                    << (isTry ? "break" : "continue")
+                    << ";\n";
             }).endl();
             out << "::android::hardware::Return<::android::sp<" << interfaceName
                 << ">> castRet = " << interfaceName << "::castFrom(base, true /* emitError */);\n";
@@ -248,7 +249,8 @@
                 out.sIf("castRet.isDeadObject()", [&] {
                     // service is dead (castFrom cannot call interfaceChain)
                     out << "ALOGW(\"getService: found dead hwbinder service\");\n"
-                        << "break;\n";
+                        << (isTry ? "break" : "continue")
+                        << ";\n";
                 }).sElse([&] {
                     out << "ALOGW(\"getService: cannot call into hwbinder service: %s"
                         << "; No permission? Check for selinux denials.\", "