Add name "default" as default to register service

the getService() and registerAsService() methods of interface objects
now have default parameters of "default" for the service name. HALs
will not have to use any service name unless they want to register
more than one service.

Test: make hidl_test; adb sync; adb shell;
data/native_test64/hidl_test64
Modify Nfc HAL to use default name
Run VTS test from go/vtsrun on Sensors, Vr, Nfc
Verify NFC HAL works (turn NFC on and off in Settings)

In support of b/33844934

Change-Id: I0e6af6694dc48a6216dbacaa2b3af42445b8372a
diff --git a/generateCpp.cpp b/generateCpp.cpp
index adde77d..eb5325b 100644
--- a/generateCpp.cpp
+++ b/generateCpp.cpp
@@ -127,8 +127,19 @@
 
 static void declareServiceManagerInteractions(Formatter &out, const std::string &interfaceName) {
     out << "static ::android::sp<" << interfaceName << "> getService("
-        << "const std::string &serviceName, bool getStub=false);\n";
-    out << "::android::status_t registerAsService(const std::string &serviceName);\n";
+        << "const std::string &serviceName=\"default\", bool getStub=false);\n";
+    out << "static ::android::sp<" << interfaceName << "> getService("
+        << "const char serviceName[], bool getStub=false)"
+        << "  { std::string str(serviceName ? serviceName : \"\");"
+        << "      return getService(str, getStub); }\n";
+    out << "static ::android::sp<" << interfaceName << "> getService("
+        << "const ::android::hardware::hidl_string& serviceName, bool getStub=false)"
+        // without c_str the std::string constructor is ambiguous
+        << "  { std::string str(serviceName.c_str());"
+        << "      return getService(str, getStub); }\n";
+    out << "static ::android::sp<" << interfaceName << "> getService("
+        << "bool getStub) { return getService(\"default\", getStub); }\n";
+    out << "::android::status_t registerAsService(const std::string &serviceName=\"default\");\n";
     out << "static bool registerForNotifications(\n";
     out.indent(2, [&] {
         out << "const std::string &serviceName,\n"
@@ -1999,4 +2010,3 @@
 }
 
 }  // namespace android
-