Arrays of arrays are now coalesced into a single multi-dimensional array type.

This is natively stored as a flat array of the element type.

Change-Id: I1b0eee51b496648a9c8445b835635deff1a90aab
Bug: 31438033
Test: run updated "hidl_test" and "hidl_test_java"
diff --git a/ArrayType.h b/ArrayType.h
index 3b2faf9..a14e02c 100644
--- a/ArrayType.h
+++ b/ArrayType.h
@@ -20,12 +20,21 @@
 
 #include "Type.h"
 
-#include <string>
+#include <vector>
 
 namespace android {
 
 struct ArrayType : public Type {
-    ArrayType(Type *elementType, const char *dimension);
+    // Extends existing array by adding another dimension.
+    ArrayType(ArrayType *srcArray, size_t size);
+
+    ArrayType(Type *elementType, size_t size);
+
+    static ArrayType *AddDimension(ArrayType *base, size_t size);
+
+    bool isArray() const override;
+
+    void addDimension(size_t size);
 
     std::string getCppType(StorageMode mode,
                            std::string *extra,
@@ -70,6 +79,7 @@
     void emitJavaFieldReaderWriter(
             Formatter &out,
             size_t depth,
+            const std::string &parcelName,
             const std::string &blobName,
             const std::string &fieldName,
             const std::string &offset,
@@ -83,7 +93,7 @@
 
 private:
     Type *mElementType;
-    std::string mDimension;
+    std::vector<size_t> mSizes;
 
     DISALLOW_COPY_AND_ASSIGN(ArrayType);
 };