graphics: add gralloc tests to VTS

Test: vts-tradefed run vts -m HalGraphicsAllocatorHidlTargetTest
Test: vts-tradefed run vts -m HalGraphicsMapperHidlTargetTest
Change-Id: I35e03b42e693da1bd3cfc6beac2a64771e0b8ed9
diff --git a/graphics/Android.mk b/graphics/Android.mk
new file mode 100644
index 0000000..f9e3276
--- /dev/null
+++ b/graphics/Android.mk
@@ -0,0 +1,19 @@
+#
+# Copyright (C) 2016 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+include $(call all-subdir-makefiles)
diff --git a/graphics/allocator/2.0/Android.mk b/graphics/allocator/2.0/Android.mk
new file mode 100644
index 0000000..f9e3276
--- /dev/null
+++ b/graphics/allocator/2.0/Android.mk
@@ -0,0 +1,19 @@
+#
+# Copyright (C) 2016 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+include $(call all-subdir-makefiles)
diff --git a/graphics/allocator/2.0/vts/AllocatorClient.vts b/graphics/allocator/2.0/vts/AllocatorClient.vts
new file mode 100644
index 0000000..face060
--- /dev/null
+++ b/graphics/allocator/2.0/vts/AllocatorClient.vts
@@ -0,0 +1,169 @@
+component_class: HAL_HIDL
+component_type_version: 2.0
+component_name: "IAllocatorClient"
+
+package: "android.hardware.graphics.allocator"
+
+import: "android.hardware.graphics.allocator@2.0::types"
+import: "android.hardware.graphics.common@1.0::types"
+
+interface: {
+    attribute: {
+        name: "::android::hardware::graphics::allocator::V2_0::IAllocatorClient::BufferDescriptorInfo"
+        type: TYPE_STRUCT
+        struct_value: {
+            name: "width"
+            type: TYPE_SCALAR
+            scalar_type: "uint32_t"
+        }
+        struct_value: {
+            name: "height"
+            type: TYPE_SCALAR
+            scalar_type: "uint32_t"
+        }
+        struct_value: {
+            name: "layerCount"
+            type: TYPE_SCALAR
+            scalar_type: "uint32_t"
+        }
+        struct_value: {
+            name: "format"
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::common::V1_0::PixelFormat"
+        }
+        struct_value: {
+            name: "producerUsageMask"
+            type: TYPE_SCALAR
+            scalar_type: "uint64_t"
+        }
+        struct_value: {
+            name: "consumerUsageMask"
+            type: TYPE_SCALAR
+            scalar_type: "uint64_t"
+        }
+    }
+
+    api: {
+        name: "createDescriptor"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        return_type_hidl: {
+            type: TYPE_SCALAR
+            scalar_type: "uint64_t"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::IAllocatorClient::BufferDescriptorInfo"
+        }
+        callflow: {
+            entry: true
+        }
+        callflow: {
+            next: "*"
+        }
+    }
+
+    api: {
+        name: "destroyDescriptor"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "uint64_t"
+        }
+        callflow: {
+            exit: true
+        }
+        callflow: {
+            next: "*"
+        }
+    }
+
+    api: {
+        name: "testAllocate"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_SCALAR
+                scalar_type: "uint64_t"
+            }
+        }
+        callflow: {
+            next: "allocate"
+        }
+    }
+
+    api: {
+        name: "allocate"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        return_type_hidl: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_SCALAR
+                scalar_type: "uint64_t"
+            }
+        }
+        arg: {
+            type: TYPE_VECTOR
+            vector_value: {
+                type: TYPE_SCALAR
+                scalar_type: "uint64_t"
+            }
+        }
+        callflow: {
+            next: "exportHandle"
+        }
+    }
+
+    api: {
+        name: "free"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "uint64_t"
+        }
+        callflow: {
+            exit: true
+        }
+        callflow: {
+            next: "*"
+        }
+    }
+
+    api: {
+        name: "exportHandle"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        return_type_hidl: {
+            type: TYPE_HANDLE
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "uint64_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "uint64_t"
+        }
+        callflow: {
+            next: "free"
+        }
+    }
+
+}
diff --git a/graphics/allocator/2.0/vts/Android.mk b/graphics/allocator/2.0/vts/Android.mk
new file mode 100644
index 0000000..00fd344
--- /dev/null
+++ b/graphics/allocator/2.0/vts/Android.mk
@@ -0,0 +1,19 @@
+#
+# Copyright (C) 2016 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+include $(LOCAL_PATH)/functional/vts/testcases/hal/graphics/allocator/hidl/target/Android.mk
diff --git a/graphics/allocator/2.0/vts/functional/Android.bp b/graphics/allocator/2.0/vts/functional/Android.bp
index e1966dc..194b228 100644
--- a/graphics/allocator/2.0/vts/functional/Android.bp
+++ b/graphics/allocator/2.0/vts/functional/Android.bp
@@ -31,7 +31,11 @@
     ],
     static_libs: ["libgtest"],
     cflags: [
+        "--coverage",
         "-O0",
         "-g",
     ],
+    ldflags: [
+        "--coverage",
+    ],
 }
diff --git a/graphics/allocator/2.0/vts/functional/vts/testcases/hal/graphics/allocator/hidl/target/Android.mk b/graphics/allocator/2.0/vts/functional/vts/testcases/hal/graphics/allocator/hidl/target/Android.mk
new file mode 100644
index 0000000..2c1617f
--- /dev/null
+++ b/graphics/allocator/2.0/vts/functional/vts/testcases/hal/graphics/allocator/hidl/target/Android.mk
@@ -0,0 +1,25 @@
+#
+# Copyright (C) 2016 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+include $(call all-subdir-makefiles)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := HalGraphicsAllocatorHidlTargetTest
+VTS_CONFIG_SRC_DIR := testcases/hal/graphics/allocator/hidl/target
+include test/vts/tools/build/Android.host_config.mk
diff --git a/graphics/allocator/2.0/vts/functional/vts/testcases/hal/graphics/allocator/hidl/target/AndroidTest.xml b/graphics/allocator/2.0/vts/functional/vts/testcases/hal/graphics/allocator/hidl/target/AndroidTest.xml
new file mode 100644
index 0000000..4ef2e95
--- /dev/null
+++ b/graphics/allocator/2.0/vts/functional/vts/testcases/hal/graphics/allocator/hidl/target/AndroidTest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<configuration description="Config for VTS Graphics Allocator HIDL HAL's basic target-side test cases">
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
+        <option name="push-group" value="HidlHalTest.push" />
+    </target_preparer>
+    <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer" />
+    <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
+        <option name="test-module-name" value="HalGraphicsAllocatorHidlTargetTest" />
+        <option name="binary-test-sources" value="
+            _32bit::DATA/nativetest/graphics_allocator_hidl_hal_test/graphics_allocator_hidl_hal_test,
+            _64bit::DATA/nativetest64/graphics_allocator_hidl_hal_test/graphics_allocator_hidl_hal_test,
+	    " />
+        <option name="binary-test-type" value="gtest" />
+        <option name="test-timeout" value="1m" />
+    </test>
+</configuration>
diff --git a/graphics/allocator/Android.mk b/graphics/allocator/Android.mk
new file mode 100644
index 0000000..f9e3276
--- /dev/null
+++ b/graphics/allocator/Android.mk
@@ -0,0 +1,19 @@
+#
+# Copyright (C) 2016 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+include $(call all-subdir-makefiles)
diff --git a/graphics/mapper/2.0/Android.mk b/graphics/mapper/2.0/Android.mk
new file mode 100644
index 0000000..f9e3276
--- /dev/null
+++ b/graphics/mapper/2.0/Android.mk
@@ -0,0 +1,19 @@
+#
+# Copyright (C) 2016 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+include $(call all-subdir-makefiles)
diff --git a/graphics/mapper/2.0/vts/Android.mk b/graphics/mapper/2.0/vts/Android.mk
new file mode 100644
index 0000000..6185ddc
--- /dev/null
+++ b/graphics/mapper/2.0/vts/Android.mk
@@ -0,0 +1,19 @@
+#
+# Copyright (C) 2016 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+include $(LOCAL_PATH)/functional/vts/testcases/hal/graphics/mapper/hidl/target/Android.mk
diff --git a/graphics/mapper/2.0/vts/Mapper.vts b/graphics/mapper/2.0/vts/Mapper.vts
new file mode 100644
index 0000000..26e049f
--- /dev/null
+++ b/graphics/mapper/2.0/vts/Mapper.vts
@@ -0,0 +1,280 @@
+component_class: HAL_HIDL
+component_type_version: 2.0
+component_name: "IMapper"
+
+package: "android.hardware.graphics.mapper"
+
+import: "android.hardware.graphics.allocator@2.0::types"
+import: "android.hardware.graphics.common@1.0::types"
+import: "android.hardware.graphics.mapper@2.0::types"
+
+interface: {
+    attribute: {
+        name: "::android::hardware::graphics::mapper::V2_0::IMapper::Rect"
+        type: TYPE_STRUCT
+        struct_value: {
+            name: "left"
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        struct_value: {
+            name: "top"
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        struct_value: {
+            name: "width"
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+        struct_value: {
+            name: "height"
+            type: TYPE_SCALAR
+            scalar_type: "int32_t"
+        }
+    }
+
+    api: {
+        name: "retain"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        arg: {
+            type: TYPE_HANDLE
+        }
+        callflow: {
+            entry: true
+        }
+        callflow: {
+            next: "*"
+        }
+    }
+
+    api: {
+        name: "release"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        arg: {
+            type: TYPE_HANDLE
+        }
+        callflow: {
+            exit: true
+        }
+    }
+
+    api: {
+        name: "getDimensions"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        return_type_hidl: {
+            type: TYPE_SCALAR
+            scalar_type: "uint32_t"
+        }
+        return_type_hidl: {
+            type: TYPE_SCALAR
+            scalar_type: "uint32_t"
+        }
+        arg: {
+            type: TYPE_HANDLE
+        }
+        callflow: {
+            next: "*"
+        }
+    }
+
+    api: {
+        name: "getFormat"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::common::V1_0::PixelFormat"
+        }
+        arg: {
+            type: TYPE_HANDLE
+        }
+        callflow: {
+            next: "*"
+        }
+    }
+
+    api: {
+        name: "getLayerCount"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        return_type_hidl: {
+            type: TYPE_SCALAR
+            scalar_type: "uint32_t"
+        }
+        arg: {
+            type: TYPE_HANDLE
+        }
+        callflow: {
+            next: "*"
+        }
+    }
+
+    api: {
+        name: "getProducerUsageMask"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        return_type_hidl: {
+            type: TYPE_SCALAR
+            scalar_type: "uint64_t"
+        }
+        arg: {
+            type: TYPE_HANDLE
+        }
+        callflow: {
+            next: "*"
+        }
+    }
+
+    api: {
+        name: "getConsumerUsageMask"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        return_type_hidl: {
+            type: TYPE_SCALAR
+            scalar_type: "uint64_t"
+        }
+        arg: {
+            type: TYPE_HANDLE
+        }
+        callflow: {
+            next: "*"
+        }
+    }
+
+    api: {
+        name: "getBackingStore"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        return_type_hidl: {
+            type: TYPE_SCALAR
+            scalar_type: "uint64_t"
+        }
+        arg: {
+            type: TYPE_HANDLE
+        }
+        callflow: {
+            next: "*"
+        }
+    }
+
+    api: {
+        name: "getStride"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        return_type_hidl: {
+            type: TYPE_SCALAR
+            scalar_type: "uint32_t"
+        }
+        arg: {
+            type: TYPE_HANDLE
+        }
+        callflow: {
+            next: "*"
+        }
+    }
+
+    api: {
+        name: "lock"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        return_type_hidl: {
+            type: TYPE_POINTER
+        }
+        arg: {
+            type: TYPE_HANDLE
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "uint64_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "uint64_t"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::graphics::mapper::V2_0::IMapper::Rect"
+        }
+        arg: {
+            type: TYPE_HANDLE
+        }
+        callflow: {
+            next: "unlock"
+        }
+    }
+
+    api: {
+        name: "lockFlex"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        return_type_hidl: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::graphics::mapper::V2_0::FlexLayout"
+        }
+        arg: {
+            type: TYPE_HANDLE
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "uint64_t"
+        }
+        arg: {
+            type: TYPE_SCALAR
+            scalar_type: "uint64_t"
+        }
+        arg: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::graphics::mapper::V2_0::IMapper::Rect"
+        }
+        arg: {
+            type: TYPE_HANDLE
+        }
+        callflow: {
+            next: "unlock"
+        }
+    }
+
+    api: {
+        name: "unlock"
+        return_type_hidl: {
+            type: TYPE_ENUM
+            predefined_type: "::android::hardware::graphics::allocator::V2_0::Error"
+        }
+        return_type_hidl: {
+            type: TYPE_HANDLE
+        }
+        arg: {
+            type: TYPE_HANDLE
+        }
+        callflow: {
+            next: "*"
+        }
+    }
+
+}
diff --git a/graphics/mapper/2.0/vts/functional/Android.bp b/graphics/mapper/2.0/vts/functional/Android.bp
index e324322..53e6d16 100644
--- a/graphics/mapper/2.0/vts/functional/Android.bp
+++ b/graphics/mapper/2.0/vts/functional/Android.bp
@@ -33,7 +33,11 @@
     ],
     static_libs: ["libgtest"],
     cflags: [
+        "--coverage",
         "-O0",
         "-g",
     ],
+    ldflags: [
+        "--coverage",
+    ],
 }
diff --git a/graphics/mapper/2.0/vts/functional/vts/testcases/hal/graphics/mapper/hidl/target/Android.mk b/graphics/mapper/2.0/vts/functional/vts/testcases/hal/graphics/mapper/hidl/target/Android.mk
new file mode 100644
index 0000000..5f7fae8
--- /dev/null
+++ b/graphics/mapper/2.0/vts/functional/vts/testcases/hal/graphics/mapper/hidl/target/Android.mk
@@ -0,0 +1,25 @@
+#
+# Copyright (C) 2016 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+include $(call all-subdir-makefiles)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := HalGraphicsMapperHidlTargetTest
+VTS_CONFIG_SRC_DIR := testcases/hal/graphics/mapper/hidl/target
+include test/vts/tools/build/Android.host_config.mk
diff --git a/graphics/mapper/2.0/vts/functional/vts/testcases/hal/graphics/mapper/hidl/target/AndroidTest.xml b/graphics/mapper/2.0/vts/functional/vts/testcases/hal/graphics/mapper/hidl/target/AndroidTest.xml
new file mode 100644
index 0000000..b602ec4
--- /dev/null
+++ b/graphics/mapper/2.0/vts/functional/vts/testcases/hal/graphics/mapper/hidl/target/AndroidTest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2016 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<configuration description="Config for VTS Graphics Mapper HIDL HAL's basic target-side test cases">
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
+        <option name="push-group" value="HidlHalTest.push" />
+    </target_preparer>
+    <target_preparer class="com.android.tradefed.targetprep.VtsPythonVirtualenvPreparer" />
+    <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
+        <option name="test-module-name" value="HalGraphicsMapperHidlTargetTest" />
+        <option name="binary-test-sources" value="
+            _32bit::DATA/nativetest/graphics_mapper_hidl_hal_test/graphics_mapper_hidl_hal_test,
+            _64bit::DATA/nativetest64/graphics_mapper_hidl_hal_test/graphics_mapper_hidl_hal_test,
+	    " />
+        <option name="binary-test-type" value="gtest" />
+        <option name="test-timeout" value="1m" />
+    </test>
+</configuration>
diff --git a/graphics/mapper/2.0/vts/types.vts b/graphics/mapper/2.0/vts/types.vts
new file mode 100644
index 0000000..fee8535
--- /dev/null
+++ b/graphics/mapper/2.0/vts/types.vts
@@ -0,0 +1,139 @@
+component_class: HAL_HIDL
+component_type_version: 2.0
+component_name: "types"
+
+package: "android.hardware.graphics.mapper"
+
+
+attribute: {
+    name: "::android::hardware::graphics::mapper::V2_0::FlexComponent"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "Y"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "CB"
+        scalar_value: {
+            int32_t: 2
+        }
+        enumerator: "CR"
+        scalar_value: {
+            int32_t: 4
+        }
+        enumerator: "R"
+        scalar_value: {
+            int32_t: 1024
+        }
+        enumerator: "G"
+        scalar_value: {
+            int32_t: 2048
+        }
+        enumerator: "B"
+        scalar_value: {
+            int32_t: 4096
+        }
+        enumerator: "A"
+        scalar_value: {
+            int32_t: 1073741824
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::graphics::mapper::V2_0::FlexFormat"
+    type: TYPE_ENUM
+    enum_value: {
+        scalar_type: "int32_t"
+
+        enumerator: "INVALID"
+        scalar_value: {
+            int32_t: 0
+        }
+        enumerator: "Y"
+        scalar_value: {
+            int32_t: 1
+        }
+        enumerator: "YCBCR"
+        scalar_value: {
+            int32_t: 7
+        }
+        enumerator: "YCBCRA"
+        scalar_value: {
+            int32_t: 1073741831
+        }
+        enumerator: "RGB"
+        scalar_value: {
+            int32_t: 7168
+        }
+        enumerator: "RGBA"
+        scalar_value: {
+            int32_t: 1073748992
+        }
+    }
+}
+
+attribute: {
+    name: "::android::hardware::graphics::mapper::V2_0::FlexPlane"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "topLeft"
+        type: TYPE_POINTER
+    }
+    struct_value: {
+        name: "component"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::graphics::mapper::V2_0::FlexComponent"
+    }
+    struct_value: {
+        name: "bitsPerComponent"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "bitsUsed"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "hIncrement"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "vIncrement"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "hSubsampling"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+    struct_value: {
+        name: "vSubsampling"
+        type: TYPE_SCALAR
+        scalar_type: "int32_t"
+    }
+}
+
+attribute: {
+    name: "::android::hardware::graphics::mapper::V2_0::FlexLayout"
+    type: TYPE_STRUCT
+    struct_value: {
+        name: "format"
+        type: TYPE_ENUM
+        predefined_type: "::android::hardware::graphics::mapper::V2_0::FlexFormat"
+    }
+    struct_value: {
+        name: "planes"
+        type: TYPE_VECTOR
+        vector_value: {
+            type: TYPE_STRUCT
+            predefined_type: "::android::hardware::graphics::mapper::V2_0::FlexPlane"
+        }
+    }
+}
+
diff --git a/graphics/mapper/Android.mk b/graphics/mapper/Android.mk
new file mode 100644
index 0000000..f9e3276
--- /dev/null
+++ b/graphics/mapper/Android.mk
@@ -0,0 +1,19 @@
+#
+# Copyright (C) 2016 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+LOCAL_PATH := $(call my-dir)
+
+include $(call all-subdir-makefiles)