hidl_string: allow null cstr

Automatically converting nullptr to empty string rather than erroring.
This gets rid of null values at the hal layer (rather than passing them
to the server) and simplifies code that would have to check for nulls.

Test: libhidl_test
Fixes: 35421240
Change-Id: Iada25da5407c3eccdd28704d993ffdee8b15c5fe
diff --git a/test_main.cpp b/test_main.cpp
index d663391..6bd7f83 100644
--- a/test_main.cpp
+++ b/test_main.cpp
@@ -59,6 +59,8 @@
     EXPECT_STREQ(s1.c_str(), "s1");
     hidl_string s2("s2"); // copy constructor from cstr
     EXPECT_STREQ(s2.c_str(), "s2");
+    hidl_string s2a(nullptr); // copy constructor from null cstr
+    EXPECT_STREQ("", s2a);
     hidl_string s3 = hidl_string("s3"); // move =
     EXPECT_STREQ(s3.c_str(), "s3");
     hidl_string s4 = hidl_string("12345", 3); // copy constructor from cstr w/ length