Libhidl: Add a constructor to hidl_array.
Test: Added a test to libhidl native test suite.
Change-Id: I4469200a40b4c05184f39754db6b4e732ae85ccd
Signed-off-by: Sasha Levitskiy <sanek@google.com>
diff --git a/base/include/hidl/HidlSupport.h b/base/include/hidl/HidlSupport.h
index c11d680..0da0e37 100644
--- a/base/include/hidl/HidlSupport.h
+++ b/base/include/hidl/HidlSupport.h
@@ -449,6 +449,9 @@
template<typename T, size_t SIZE1>
struct hidl_array<T, SIZE1> {
hidl_array() = default;
+ hidl_array(const T *source) {
+ memcpy(mBuffer, source, SIZE1 * sizeof(T));
+ }
T *data() { return mBuffer; }
const T *data() const { return mBuffer; }