add toString() for hidl types.

They are defined in ::android::hardware::details::toString().

Test: hidl_test and look at the output of logcat

Bug: 33459772

Change-Id: Idf849114a623331ebf43e160c5901170c7c8925e
diff --git a/base/include/hidl/MQDescriptor.h b/base/include/hidl/MQDescriptor.h
index 8cdbd4c..ec063f4 100644
--- a/base/include/hidl/MQDescriptor.h
+++ b/base/include/hidl/MQDescriptor.h
@@ -259,6 +259,26 @@
    */
   return NativeHandle::create(mHandle, false /* ownsHandle */);
 }
+
+namespace details {
+template<typename T, MQFlavor flavor>
+std::string toString(const MQDescriptor<T, flavor> &q) {
+    std::string os;
+    if (flavor & kSynchronizedReadWrite) {
+        os += "fmq_sync";
+    }
+    if (flavor & kUnsynchronizedWrite) {
+        os += "fmq_unsync";
+    }
+    os += " {"
+       + toString(q.getGrantors().size()) + " grantor(s), "
+       + "size = " + toString(q.getSize())
+       + ", .handle = " + toString(q.getNativeHandle().get())
+       + ", .quantum = " + toString(q.getQuantum()) + "}";
+    return os;
+}
+}  // namespace details
+
 }  // namespace hardware
 }  // namespace android