Expose offset of private member hidl_string::mBuffer.

Bug: 30575790
Change-Id: Id8ca6cc8a82cc0133732d10aa4fdc107694f7e00
diff --git a/HidlSupport.cpp b/HidlSupport.cpp
index 71ac2b3..27daa94 100644
--- a/HidlSupport.cpp
+++ b/HidlSupport.cpp
@@ -113,6 +113,9 @@
             parentOffset + offsetof(hidl_string, mBuffer));
 }
 
+// static
+const size_t hidl_string::kOffsetOfBuffer = offsetof(hidl_string, mBuffer);
+
 }  // namespace hardware
 }  // namespace android
 
diff --git a/include/hidl/HidlSupport.h b/include/hidl/HidlSupport.h
index c36b7ec..2689ab4 100644
--- a/include/hidl/HidlSupport.h
+++ b/include/hidl/HidlSupport.h
@@ -47,6 +47,9 @@
     status_t writeEmbeddedToParcel(
             Parcel *parcel, size_t parentHandle, size_t parentOffset) const;
 
+    // offsetof(hidl_string, mBuffer) exposed since mBuffer is private.
+    static const size_t kOffsetOfBuffer;
+
 private:
     char *mBuffer;
     size_t mSize;  // NOT including the terminating '\0'.