Implicit const char* cast removed, operator<< added to hidl_string.

hidl_string no longer will provide an implicit cast to const char* as it
interfers with other expected behaviors of the class.  It now emulated
std::string in requiring a call to .c_str() to get the same behavior.

Bug:  36532780
Test:  Build the tree for marlin, bullhead, bat

(cherry picked from commit 0c84ab4192f9b0b03b9840b85fc430afa17f55f1)

Merged-In: I6ba76522ef65aa211bc156144990ad8b7495b051
Change-Id: I6ba76522ef65aa211bc156144990ad8b7495b051
diff --git a/base/HidlSupport.cpp b/base/HidlSupport.cpp
index 5789d04..7cc8ef5 100644
--- a/base/HidlSupport.cpp
+++ b/base/HidlSupport.cpp
@@ -208,8 +208,9 @@
     return std::string(mBuffer, mSize);
 }
 
-hidl_string::operator const char *() const {
-    return mBuffer;
+std::ostream& operator<<(std::ostream& os, const hidl_string& str) {
+    os << str.c_str();
+    return os;
 }
 
 void hidl_string::copyFrom(const char *data, size_t size) {
diff --git a/base/include/hidl/HidlSupport.h b/base/include/hidl/HidlSupport.h
index da9a1af..d7c3b83 100644
--- a/base/include/hidl/HidlSupport.h
+++ b/base/include/hidl/HidlSupport.h
@@ -149,9 +149,6 @@
     hidl_string &operator=(hidl_string &&other);
     // cast to std::string.
     operator std::string() const;
-    // cast to C-style string. Caller is responsible
-    // to maintain this hidl_string alive.
-    operator const char *() const;
 
     void clear();
 
@@ -195,6 +192,10 @@
 
 #undef HIDL_STRING_OPERATOR
 
+// Send our content to the output stream
+std::ostream& operator<<(std::ostream& os, const hidl_string& str);
+
+
 // hidl_memory is a structure that can be used to transfer
 // pieces of shared memory between processes. The assumption
 // of this object is that the memory remains accessible as