Snap for 5988121 from 3d9bb7a067cade173c238d8bde19e789151a4fe7 to qt-aml-networking-release

Change-Id: I4611e52baae81efe08e847eaf7343d6b5090ab61
diff --git a/atrace/V1_0/target/AndroidTest.xml b/atrace/V1_0/target/AndroidTest.xml
index c69d27d..4084b59 100644
--- a/atrace/V1_0/target/AndroidTest.xml
+++ b/atrace/V1_0/target/AndroidTest.xml
@@ -23,7 +23,7 @@
         <option name="test-module-name" value="VtsHalAtraceV1_0Target"/>
         <option name="binary-test-source" value="_32bit::DATA/nativetest/VtsHalAtraceV1_0TargetTest/VtsHalAtraceV1_0TargetTest"/>
         <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalAtraceV1_0TargetTest/VtsHalAtraceV1_0TargetTest"/>
-        <option name="binary-test-type" value="hal_hidl_gtest"/>
+        <option name="binary-test-type" value="gtest"/>
         <option name="test-timeout" value="5m"/>
     </test>
 </configuration>
diff --git a/authsecret/V1_0/target/AndroidTest.xml b/authsecret/V1_0/target/AndroidTest.xml
index e1feae6..dcf6374 100644
--- a/authsecret/V1_0/target/AndroidTest.xml
+++ b/authsecret/V1_0/target/AndroidTest.xml
@@ -24,7 +24,7 @@
         <option name="test-module-name" value="VtsHalAuthSecretV1_0Target"/>
         <option name="binary-test-source" value="_32bit::DATA/nativetest/VtsHalAuthSecretV1_0TargetTest/VtsHalAuthSecretV1_0TargetTest"/>
         <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalAuthSecretV1_0TargetTest/VtsHalAuthSecretV1_0TargetTest"/>
-        <option name="binary-test-type" value="hal_hidl_gtest"/>
+        <option name="binary-test-type" value="gtest"/>
         <option name="binary-test-disable-framework" value="true"/>
         <option name="test-timeout" value="1m"/>
     </test>
diff --git a/biometrics/fingerprint/V2_1/target/AndroidTest.xml b/biometrics/fingerprint/V2_1/target/AndroidTest.xml
index 1208320..f3f1e6e 100644
--- a/biometrics/fingerprint/V2_1/target/AndroidTest.xml
+++ b/biometrics/fingerprint/V2_1/target/AndroidTest.xml
@@ -23,7 +23,7 @@
         <option name="test-module-name" value="VtsHalBiometricsFingerprintV2_1Target"/>
         <option name="binary-test-source" value="_32bit::DATA/nativetest/VtsHalBiometricsFingerprintV2_1TargetTest/VtsHalBiometricsFingerprintV2_1TargetTest"/>
         <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalBiometricsFingerprintV2_1TargetTest/VtsHalBiometricsFingerprintV2_1TargetTest"/>
-        <option name="binary-test-type" value="hal_hidl_gtest"/>
+        <option name="binary-test-type" value="gtest"/>
         <option name="binary-test-disable-framework" value="true"/>
         <option name="test-timeout" value="15m"/>
     </test>
diff --git a/boot/V1_0/target/AndroidTest.xml b/boot/V1_0/target/AndroidTest.xml
index 0cb987f..aeb619f 100644
--- a/boot/V1_0/target/AndroidTest.xml
+++ b/boot/V1_0/target/AndroidTest.xml
@@ -23,7 +23,7 @@
         <option name="test-module-name" value="VtsHalBootV1_0Target"/>
         <option name="binary-test-source" value="_32bit::DATA/nativetest/VtsHalBootV1_0TargetTest/VtsHalBootV1_0TargetTest"/>
         <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalBootV1_0TargetTest/VtsHalBootV1_0TargetTest"/>
-        <option name="binary-test-type" value="hal_hidl_gtest"/>
+        <option name="binary-test-type" value="gtest"/>
         <option name="binary-test-disable-framework" value="true"/>
         <option name="test-timeout" value="5m"/>
     </test>
diff --git a/configstore/V1_0/target/AndroidTest.xml b/configstore/V1_0/target/AndroidTest.xml
index c916cfc..095f5b6 100644
--- a/configstore/V1_0/target/AndroidTest.xml
+++ b/configstore/V1_0/target/AndroidTest.xml
@@ -23,7 +23,7 @@
         <option name="test-module-name" value="VtsHalConfigstoreV1_0Target"/>
         <option name="binary-test-source" value="_32bit::DATA/nativetest/VtsHalConfigstoreV1_0TargetTest/VtsHalConfigstoreV1_0TargetTest" />
         <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalConfigstoreV1_0TargetTest/VtsHalConfigstoreV1_0TargetTest" />
-        <option name="binary-test-type" value="hal_hidl_gtest"/>
+        <option name="binary-test-type" value="gtest"/>
         <option name="binary-test-disable-framework" value="true"/>
         <option name="test-timeout" value="5m"/>
     </test>
diff --git a/dumpstate/V1_0/target/AndroidTest.xml b/dumpstate/V1_0/target/AndroidTest.xml
index f239957..e9f5938 100644
--- a/dumpstate/V1_0/target/AndroidTest.xml
+++ b/dumpstate/V1_0/target/AndroidTest.xml
@@ -23,7 +23,7 @@
         <option name="test-module-name" value="VtsHalDumpstateV1_0Target"/>
         <option name="binary-test-source" value="_32bit::DATA/nativetest/VtsHalDumpstateV1_0TargetTest/VtsHalDumpstateV1_0TargetTest"/>
         <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalDumpstateV1_0TargetTest/VtsHalDumpstateV1_0TargetTest"/>
-        <option name="binary-test-type" value="hal_hidl_gtest"/>
+        <option name="binary-test-type" value="gtest"/>
         <option name="binary-test-disable-framework" value="true"/>
         <option name="test-timeout" value="5m"/>
     </test>
diff --git a/health/V1_0/target/AndroidTest.xml b/health/V1_0/target/AndroidTest.xml
index 55d29e8..baf4dac 100644
--- a/health/V1_0/target/AndroidTest.xml
+++ b/health/V1_0/target/AndroidTest.xml
@@ -23,7 +23,7 @@
         <option name="test-module-name" value="VtsHalHealthV1_0Target"/>
         <option name="binary-test-source" value="_32bit::DATA/nativetest/VtsHalHealthV1_0TargetTest/VtsHalHealthV1_0TargetTest"/>
         <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalHealthV1_0TargetTest/VtsHalHealthV1_0TargetTest"/>
-        <option name="binary-test-type" value="hal_hidl_gtest"/>
+        <option name="binary-test-type" value="gtest"/>
         <option name="binary-test-disable-framework" value="true"/>
         <option name="test-timeout" value="5m"/>
     </test>
diff --git a/ir/V1_0/target/AndroidTest.xml b/ir/V1_0/target/AndroidTest.xml
index a10bcb3..ad1a1ab 100644
--- a/ir/V1_0/target/AndroidTest.xml
+++ b/ir/V1_0/target/AndroidTest.xml
@@ -23,7 +23,7 @@
         <option name="test-module-name" value="VtsHalIrV1_0Target"/>
         <option name="binary-test-source" value="_32bit::DATA/nativetest/VtsHalIrV1_0TargetTest/VtsHalIrV1_0TargetTest"/>
         <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalIrV1_0TargetTest/VtsHalIrV1_0TargetTest"/>
-        <option name="binary-test-type" value="hal_hidl_gtest"/>
+        <option name="binary-test-type" value="gtest"/>
         <option name="binary-test-disable-framework" value="true"/>
         <option name="test-timeout" value="5m"/>
     </test>
diff --git a/memtrack/V1_0/target/AndroidTest.xml b/memtrack/V1_0/target/AndroidTest.xml
index 195b53b..d775ab6 100644
--- a/memtrack/V1_0/target/AndroidTest.xml
+++ b/memtrack/V1_0/target/AndroidTest.xml
@@ -23,7 +23,7 @@
         <option name="test-module-name" value="VtsHalMemtrackV1_0Target"/>
         <option name="binary-test-source" value="_32bit::DATA/nativetest/VtsHalMemtrackV1_0TargetTest/VtsHalMemtrackV1_0TargetTest"/>
         <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalMemtrackV1_0TargetTest/VtsHalMemtrackV1_0TargetTest"/>
-        <option name="binary-test-type" value="hal_hidl_gtest"/>
+        <option name="binary-test-type" value="gtest"/>
         <option name="binary-test-disable-framework" value="true"/>
         <option name="test-timeout" value="15m"/>
     </test>
diff --git a/neuralnetworks/V1_3/__init__.py b/neuralnetworks/V1_3/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/neuralnetworks/V1_3/__init__.py
diff --git a/neuralnetworks/V1_3/adapter/Android.bp b/neuralnetworks/V1_3/adapter/Android.bp
new file mode 100644
index 0000000..af20d16
--- /dev/null
+++ b/neuralnetworks/V1_3/adapter/Android.bp
@@ -0,0 +1,18 @@
+// Copyright (C) 2019 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.
+//
+
+vts_config {
+    name: "VtsHalNeuralnetworksV1_3Adapter",
+}
diff --git a/neuralnetworks/V1_3/adapter/AndroidTest.xml b/neuralnetworks/V1_3/adapter/AndroidTest.xml
new file mode 100644
index 0000000..7a849a4
--- /dev/null
+++ b/neuralnetworks/V1_3/adapter/AndroidTest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 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 VtsHalNeuralnetworksV1_3Adapter test cases">
+    <option key="plan" name="config-descriptor:metadata" value="vts-hal-adapter"/>
+    <object class="com.android.tradefed.module.VtsHalAdapterModuleController" type="module_controller">
+        <option name="hal-package-name" value="android.hardware.neuralnetworks@1.3"/>
+    </object>
+    <target_preparer class="com.android.tradefed.targetprep.VtsHalAdapterPreparer">
+        <option name="adapter-binary-name" value="android.hardware.neuralnetworks@1.2-adapter"/>
+        <option name="hal-package-name" value="android.hardware.neuralnetworks@1.3"/>
+    </target_preparer>
+    <test class="com.android.tradefed.testtype.AndroidJUnitTest">
+        <option name="package" value="com.android.devicehealth.tests"/>
+        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner"/>
+    </test>
+    <include name="CtsNNAPITestCases.config"/>
+</configuration>
diff --git a/neuralnetworks/V1_3/benchmark/Android.bp b/neuralnetworks/V1_3/benchmark/Android.bp
new file mode 100644
index 0000000..8641ba4
--- /dev/null
+++ b/neuralnetworks/V1_3/benchmark/Android.bp
@@ -0,0 +1,19 @@
+//
+// Copyright (C) 2019 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.
+//
+
+vts_config {
+    name: "VtsHalNeuralnetworksV1_3Benchmark",
+}
diff --git a/neuralnetworks/V1_3/benchmark/AndroidTest.xml b/neuralnetworks/V1_3/benchmark/AndroidTest.xml
new file mode 100644
index 0000000..9ae16b4
--- /dev/null
+++ b/neuralnetworks/V1_3/benchmark/AndroidTest.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 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 VtsHalNeuralnetworksV1_3Benchmark test cases">
+    <option name="config-descriptor:metadata" key="plan" value="vts-hal" />
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
+        <option name="push-group" value="HostDrivenTest.push" />
+        <option name="push-group" value="HalHidlTargetTest.push"/>
+    </target_preparer>
+    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+        <option name="cleanup-apks" value="true" />
+        <option name="test-file-name" value="VtsHalNeuralnetworksV1_3BenchmarkTestCases.apk" />
+    </target_preparer>
+    <test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
+        <option name="test-module-name" value="VtsHalNeuralnetworksV1_3Benchmark"/>
+        <option name="test-case-path" value="vts/testcases/hal/neuralnetworks/V1_3/benchmark/VtsHalNeuralnetworksV1_3Benchmark" />
+        <option name="test-timeout" value="1h"/>
+    </test>
+</configuration>
diff --git a/neuralnetworks/V1_3/benchmark/VtsHalNeuralnetworksV1_3Benchmark.py b/neuralnetworks/V1_3/benchmark/VtsHalNeuralnetworksV1_3Benchmark.py
new file mode 100644
index 0000000..f80d4f2
--- /dev/null
+++ b/neuralnetworks/V1_3/benchmark/VtsHalNeuralnetworksV1_3Benchmark.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2019 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.
+#
+
+import logging
+import re
+
+from time import sleep
+from vts.runners.host import asserts
+from vts.runners.host import const
+from vts.runners.host import test_runner
+from vts.testcases.template.hal_hidl_host_test import hal_hidl_host_test
+
+
+class VtsHalNeuralnetworksV1_3Benchmark(hal_hidl_host_test.HalHidlHostTest):
+    """A test case that runs the accuracy benchmark for every NN device driver."""
+
+    TEST_HAL_SERVICES = {"android.hardware.neuralnetworks@1.3::IDevice"}
+
+    def testAccuracy(self):
+        """Test that the driver meets accuracy requirements."""
+        hal_service_instance = self.cur_param[0]
+        command = (
+            "am instrument -e halServiceInstance '{}' " +
+            "-w com.android.nn.benchmark.vts.v1_3/androidx.test.runner.AndroidJUnitRunner"
+        ).format(hal_service_instance)
+        logging.info("Executing command: %s", command)
+        logging.info("Check logcat for more information")
+        results = self.shell.Execute([command])
+        stdout = results[const.STDOUT][0]
+        stderr = results[const.STDERR][0]
+        exit_code = results[const.EXIT_CODE][0]
+        if stdout:
+          logging.info("stdout: %s", stdout)
+        if stderr:
+          logging.error("stderr: %s", stderr)
+        if exit_code:
+          logging.error("exit_code: %s", exit_code)
+        # The "am instrument" command exits with 0 even when there are failed tests.
+        asserts.assertTrue(re.search(r"^OK \([0-9]+ tests?\)$", stdout, re.M),
+                           "Benchmark failed")
+
+
+if __name__ == "__main__":
+    test_runner.main()
diff --git a/neuralnetworks/V1_3/benchmark/__init__.py b/neuralnetworks/V1_3/benchmark/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/neuralnetworks/V1_3/benchmark/__init__.py
diff --git a/neuralnetworks/V1_3/benchmark/java/Android.mk b/neuralnetworks/V1_3/benchmark/java/Android.mk
new file mode 100644
index 0000000..64ec555
--- /dev/null
+++ b/neuralnetworks/V1_3/benchmark/java/Android.mk
@@ -0,0 +1,42 @@
+# Copyright (C) 2019 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 $(CLEAR_VARS)
+
+LOCAL_PACKAGE_NAME := VtsHalNeuralnetworksV1_3BenchmarkTestCases
+
+# Don't include this package in any target
+LOCAL_MODULE_TAGS := optional
+# And when built explicitly put it in the data partition
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+
+# Include both the 32 and 64 bit versions
+LOCAL_MULTILIB := both
+
+# TODO: This is from the CTS app. Figure out the proper way to do this in VTS.
+# Tag this module as a cts test artifact
+LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
+
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules \
+    compatibility-device-util-axt ctstestrunner-axt junit NeuralNetworksApiBenchmark_Lib
+LOCAL_JNI_SHARED_LIBRARIES := libnnbenchmark_jni
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+LOCAL_ASSET_DIR := test/mlts/models/assets
+
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_CTS_PACKAGE)
diff --git a/neuralnetworks/V1_3/benchmark/java/AndroidManifest.xml b/neuralnetworks/V1_3/benchmark/java/AndroidManifest.xml
new file mode 100644
index 0000000..58dbd1a
--- /dev/null
+++ b/neuralnetworks/V1_3/benchmark/java/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 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.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+        package="com.android.nn.benchmark.vts.v1_3">
+
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+    <uses-sdk android:minSdkVersion="30"/>
+
+    <application android:name=".NNAccuracyApplication">
+        <activity android:name=".NNAccuracyActivity">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN"/>
+            </intent-filter>
+        </activity>
+    </application>
+
+    <instrumentation
+            android:name="androidx.test.runner.AndroidJUnitRunner"
+            android:targetPackage="com.android.nn.benchmark.vts.v1_3"
+            android:label="NNAPI 1.3 accuracy VTS benchmark"/>
+</manifest>
diff --git a/neuralnetworks/V1_3/benchmark/java/src/com/android/nn/benchmark/vts/v1_3/NNAccuracyActivity.java b/neuralnetworks/V1_3/benchmark/java/src/com/android/nn/benchmark/vts/v1_3/NNAccuracyActivity.java
new file mode 100644
index 0000000..8b85fce
--- /dev/null
+++ b/neuralnetworks/V1_3/benchmark/java/src/com/android/nn/benchmark/vts/v1_3/NNAccuracyActivity.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+
+package com.android.nn.benchmark.vts.v1_3;
+
+import android.app.Activity;
+
+public class NNAccuracyActivity extends Activity {}
diff --git a/neuralnetworks/V1_3/benchmark/java/src/com/android/nn/benchmark/vts/v1_3/NNAccuracyApplication.java b/neuralnetworks/V1_3/benchmark/java/src/com/android/nn/benchmark/vts/v1_3/NNAccuracyApplication.java
new file mode 100644
index 0000000..5a0f5c9
--- /dev/null
+++ b/neuralnetworks/V1_3/benchmark/java/src/com/android/nn/benchmark/vts/v1_3/NNAccuracyApplication.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+
+package com.android.nn.benchmark.vts.v1_3;
+
+import android.app.Application;
+import com.android.nn.benchmark.core.TestModelsListLoader;
+import java.io.IOException;
+
+/** Application class for NNAccuracyTest. */
+public class NNAccuracyApplication extends Application {
+    @Override
+    public void onCreate() {
+        super.onCreate();
+        try {
+            TestModelsListLoader.parseFromAssets(getAssets());
+        } catch (IOException e) {
+            throw new IllegalStateException("Failed to load test models json", e);
+        }
+    }
+}
diff --git a/neuralnetworks/V1_3/benchmark/java/src/com/android/nn/benchmark/vts/v1_3/NNAccuracyTest.java b/neuralnetworks/V1_3/benchmark/java/src/com/android/nn/benchmark/vts/v1_3/NNAccuracyTest.java
new file mode 100644
index 0000000..561d0fd
--- /dev/null
+++ b/neuralnetworks/V1_3/benchmark/java/src/com/android/nn/benchmark/vts/v1_3/NNAccuracyTest.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+
+package com.android.nn.benchmark.vts.v1_3;
+
+import static junit.framework.TestCase.assertFalse;
+import static junit.framework.TestCase.assertTrue;
+
+import android.app.Activity;
+import android.util.Pair;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import com.android.nn.benchmark.core.BenchmarkException;
+import com.android.nn.benchmark.core.BenchmarkResult;
+import com.android.nn.benchmark.core.InferenceInOutSequence;
+import com.android.nn.benchmark.core.InferenceResult;
+import com.android.nn.benchmark.core.NNTestBase;
+import com.android.nn.benchmark.core.TestModels;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import org.junit.AssumptionViolatedException;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * Tests the accuracy of the model outputs.
+ */
+@RunWith(Parameterized.class)
+public class NNAccuracyTest {
+    private static final String ARG_HAL_SERVICE_INSTANCE = "halServiceInstance";
+    private static final String HAL_SERVICE_INSTANCE_PREFIX =
+            "android.hardware.neuralnetworks@1.3::IDevice/";
+
+    @Rule
+    public ActivityTestRule<NNAccuracyActivity> mActivityRule =
+            new ActivityTestRule<>(NNAccuracyActivity.class);
+
+    @Parameterized.Parameter(0) public TestModels.TestModelEntry mModel;
+
+    private Activity mActivity;
+
+    private String mHalServiceInstance;
+    private String mDeviceName;
+
+    // TODO(vddang): Add mobilenet_v1_0.25_128_quant_topk_aosp
+    private static final String[] MODEL_NAMES = new String[] {
+            "tts_float",
+            "asr_float",
+            "mobilenet_v1_1.0_224_quant_topk_aosp",
+            "mobilenet_v1_1.0_224_topk_aosp",
+            "mobilenet_v1_0.75_192_quant_topk_aosp",
+            "mobilenet_v1_0.75_192_topk_aosp",
+            "mobilenet_v1_0.5_160_quant_topk_aosp",
+            "mobilenet_v1_0.5_160_topk_aosp",
+            "mobilenet_v1_0.25_128_topk_aosp",
+            "mobilenet_v2_0.35_128_topk_aosp",
+            "mobilenet_v2_0.5_160_topk_aosp",
+            "mobilenet_v2_0.75_192_topk_aosp",
+            "mobilenet_v2_1.0_224_quant_topk_aosp",
+            "mobilenet_v2_1.0_224_topk_aosp",
+    };
+
+    @Parameters(name = "{0}")
+    public static List<TestModels.TestModelEntry> modelsList() {
+        List<TestModels.TestModelEntry> models = new ArrayList<>();
+        for (String modelName : MODEL_NAMES) {
+            models.add(TestModels.getModelByName(modelName));
+        }
+        return Collections.unmodifiableList(models);
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        mActivity = mActivityRule.getActivity();
+        mHalServiceInstance =
+                InstrumentationRegistry.getArguments().getString(ARG_HAL_SERVICE_INSTANCE);
+        assertTrue(mHalServiceInstance.startsWith(HAL_SERVICE_INSTANCE_PREFIX));
+        mDeviceName = mHalServiceInstance.substring(HAL_SERVICE_INSTANCE_PREFIX.length());
+    }
+
+    @Test
+    @LargeTest
+    public void testDriver() throws BenchmarkException, IOException {
+        NNTestBase test = mModel.createNNTestBase();
+        test.useNNApi();
+        test.setNNApiDeviceName(mDeviceName);
+        if (!test.setupModel(mActivity)) {
+            throw new AssumptionViolatedException("The driver rejected the model.");
+        }
+        Pair<List<InferenceInOutSequence>, List<InferenceResult>> inferenceResults =
+                test.runBenchmarkCompleteInputSet(/*setRepeat=*/1, /*timeoutSec=*/3600);
+        BenchmarkResult benchmarkResult = BenchmarkResult.fromInferenceResults(mModel.mModelName,
+                BenchmarkResult.BACKEND_TFLITE_NNAPI, inferenceResults.first,
+                inferenceResults.second, test.getEvaluator());
+        assertFalse(benchmarkResult.hasValidationErrors());
+    }
+}
diff --git a/neuralnetworks/V1_3/target/Android.bp b/neuralnetworks/V1_3/target/Android.bp
new file mode 100644
index 0000000..0cd5694
--- /dev/null
+++ b/neuralnetworks/V1_3/target/Android.bp
@@ -0,0 +1,18 @@
+// Copyright (C) 2019 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.
+//
+
+vts_config {
+    name: "VtsHalNeuralnetworksV1_3Target",
+}
diff --git a/neuralnetworks/V1_3/target/AndroidTest.xml b/neuralnetworks/V1_3/target/AndroidTest.xml
new file mode 100644
index 0000000..7abda32
--- /dev/null
+++ b/neuralnetworks/V1_3/target/AndroidTest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 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 VtsHalNeuralnetworksV1_3Target test cases">
+    <option name="config-descriptor:metadata" key="plan" value="vts-hal" />
+    <option name="test-suite-tag" value="vts-core" />
+    <option name="config-descriptor:metadata" key="plan" value="vts-core" />
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
+        <option name="abort-on-push-failure" value="false"/>
+        <option name="push-group" value="HalHidlTargetTest.push"/>
+        <option name="push" value="DATA/nativetest/VtsHalNeuralnetworksV1_3TargetTest/VtsHalNeuralnetworksV1_3TargetTest->/data/nativetest/VtsHalNeuralnetworksV1_3TargetTest/VtsHalNeuralnetworksV1_3TargetTest"/>
+        <option name="push" value="DATA/nativetest64/VtsHalNeuralnetworksV1_3TargetTest/VtsHalNeuralnetworksV1_3TargetTest->/data/nativetest64/VtsHalNeuralnetworksV1_3TargetTest/VtsHalNeuralnetworksV1_3TargetTest"/>
+    </target_preparer>
+    <test class="com.android.tradefed.testtype.GTest">
+        <option name="module-name" value="VtsHalNeuralnetworksV1_3TargetTest"/>
+        <option name="native-test-timeout" value="10h"/>
+    </test>
+</configuration>
diff --git a/radio/config/V1_0/target/radio/config/AndroidTest.xml b/radio/config/V1_0/target/radio/config/AndroidTest.xml
index dc6d636..8336c38 100644
--- a/radio/config/V1_0/target/radio/config/AndroidTest.xml
+++ b/radio/config/V1_0/target/radio/config/AndroidTest.xml
@@ -27,7 +27,7 @@
         <option name="test-module-name" value="VtsHalRadioConfigV1_0Target"/>
         <option name="binary-test-source" value="_32bit::DATA/nativetest/VtsHalRadioConfigV1_0TargetTest/VtsHalRadioConfigV1_0TargetTest"/>
         <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalRadioConfigV1_0TargetTest/VtsHalRadioConfigV1_0TargetTest"/>
-        <option name="binary-test-type" value="hal_hidl_gtest"/>
+        <option name="binary-test-type" value="gtest"/>
         <option name="binary-test-disable-framework" value="true"/>
         <option name="test-timeout" value="15m"/>
     </test>
diff --git a/radio/config/V1_1/target/radio/config/AndroidTest.xml b/radio/config/V1_1/target/radio/config/AndroidTest.xml
index 7f1f09c..d2ca018 100644
--- a/radio/config/V1_1/target/radio/config/AndroidTest.xml
+++ b/radio/config/V1_1/target/radio/config/AndroidTest.xml
@@ -27,7 +27,7 @@
         <option name="test-module-name" value="VtsHalRadioConfigV1_1Target"/>
         <option name="binary-test-source" value="_32bit::DATA/nativetest/VtsHalRadioConfigV1_1TargetTest/VtsHalRadioConfigV1_1TargetTest"/>
         <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalRadioConfigV1_1TargetTest/VtsHalRadioConfigV1_1TargetTest"/>
-        <option name="binary-test-type" value="hal_hidl_gtest"/>
+        <option name="binary-test-type" value="gtest"/>
         <option name="binary-test-disable-framework" value="true"/>
         <option name="test-timeout" value="15m"/>
     </test>
diff --git a/radio/config/V1_2/target/radio/config/AndroidTest.xml b/radio/config/V1_2/target/radio/config/AndroidTest.xml
index a0b3a8b..dc7f580 100644
--- a/radio/config/V1_2/target/radio/config/AndroidTest.xml
+++ b/radio/config/V1_2/target/radio/config/AndroidTest.xml
@@ -27,7 +27,7 @@
         <option name="test-module-name" value="VtsHalRadioConfigV1_2Target"/>
         <option name="binary-test-source" value="_32bit::DATA/nativetest/VtsHalRadioConfigV1_2TargetTest/VtsHalRadioConfigV1_2TargetTest"/>
         <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalRadioConfigV1_2TargetTest/VtsHalRadioConfigV1_2TargetTest"/>
-        <option name="binary-test-type" value="hal_hidl_gtest"/>
+        <option name="binary-test-type" value="gtest"/>
         <option name="binary-test-disable-framework" value="true"/>
         <option name="test-timeout" value="15m"/>
     </test>
diff --git a/treble/vintf/SingleManifestTest.cpp b/treble/vintf/SingleManifestTest.cpp
index 6a701ba..32cad70 100644
--- a/treble/vintf/SingleManifestTest.cpp
+++ b/treble/vintf/SingleManifestTest.cpp
@@ -444,7 +444,8 @@
         FailureHashMissing(fq_iface_name);
       }
 
-      if (IsAndroidPlatformInterface(fq_iface_name)) {
+      if (IsAndroidPlatformInterface(fq_iface_name) &&
+          !IsVehiclHalInterfaceInAutomotiveDevice(fq_iface_name)) {
         set<string> released_hashes = ReleasedHashes(fq_iface_name);
         EXPECT_NE(released_hashes.find(hash), released_hashes.end())
             << "Hash not found. This interface was not released." << endl
diff --git a/treble/vintf/utils.cpp b/treble/vintf/utils.cpp
index d1d53b3..1718f74 100644
--- a/treble/vintf/utils.cpp
+++ b/treble/vintf/utils.cpp
@@ -35,6 +35,12 @@
 // Name of file containing HAL hashes.
 const string kHashFileName = "current.txt";
 
+// Name of automotive device flag.
+const string kAutomotive = "automotive";
+
+// Name of Vehicl HAL interface.
+const string kVehicleHAL = "android.hardware.automotive.vehicle@2.0::IVehicle";
+
 // Map from package name to package root.
 const map<string, string> kPackageRoot = {
     {"android.frameworks", "frameworks/hardware/interfaces/"},
@@ -105,6 +111,13 @@
   return !PackageRoot(fq_iface_name).empty();
 }
 
+// Returns true iff HAL interface is Vehicle HAL and the device is
+// a automotive device.
+bool IsVehiclHalInterfaceInAutomotiveDevice(const FQName &fq_iface_name) {
+  return fq_iface_name.string() == kVehicleHAL &&
+         android::base::GetProperty("ro.hardware.type", "") == kAutomotive;
+}
+
 // Returns the set of released hashes for a given HAL interface.
 set<string> ReleasedHashes(const FQName &fq_iface_name) {
   set<string> released_hashes{};
diff --git a/treble/vintf/utils.h b/treble/vintf/utils.h
index 155f970..03a3d85 100644
--- a/treble/vintf/utils.h
+++ b/treble/vintf/utils.h
@@ -95,6 +95,10 @@
 // Returns true iff HAL interface is Android platform.
 bool IsAndroidPlatformInterface(const FQName& fq_iface_name);
 
+// Returns true iff HAL interface is Vehicle HAL and the device is
+// a automotive device.
+bool IsVehiclHalInterfaceInAutomotiveDevice(const FQName& fq_iface_name);
+
 // Returns the set of released hashes for a given HAL interface.
 set<string> ReleasedHashes(const FQName& fq_iface_name);
 
diff --git a/vibrator/V1_0/target/AndroidTest.xml b/vibrator/V1_0/target/AndroidTest.xml
index db207c3..999918e 100644
--- a/vibrator/V1_0/target/AndroidTest.xml
+++ b/vibrator/V1_0/target/AndroidTest.xml
@@ -23,7 +23,7 @@
         <option name="test-module-name" value="VtsHalVibratorV1_0Target"/>
         <option name="binary-test-source" value="_32bit::DATA/nativetest/VtsHalVibratorV1_0TargetTest/VtsHalVibratorV1_0TargetTest"/>
         <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalVibratorV1_0TargetTest/VtsHalVibratorV1_0TargetTest"/>
-        <option name="binary-test-type" value="hal_hidl_gtest"/>
+        <option name="binary-test-type" value="gtest"/>
         <option name="binary-test-disable-framework" value="true"/>
         <option name="test-timeout" value="5m"/>
     </test>
diff --git a/vibrator/V1_1/target/AndroidTest.xml b/vibrator/V1_1/target/AndroidTest.xml
index cd7c2bb..26a1ac6 100644
--- a/vibrator/V1_1/target/AndroidTest.xml
+++ b/vibrator/V1_1/target/AndroidTest.xml
@@ -23,7 +23,7 @@
         <option name="test-module-name" value="VtsHalVibratorV1_1Target"/>
         <option name="binary-test-source" value="_32bit::DATA/nativetest/VtsHalVibratorV1_1TargetTest/VtsHalVibratorV1_1TargetTest"/>
         <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalVibratorV1_1TargetTest/VtsHalVibratorV1_1TargetTest"/>
-        <option name="binary-test-type" value="hal_hidl_gtest"/>
+        <option name="binary-test-type" value="gtest"/>
         <option name="binary-test-disable-framework" value="true"/>
         <option name="test-timeout" value="5m"/>
     </test>
diff --git a/vibrator/V1_2/target/AndroidTest.xml b/vibrator/V1_2/target/AndroidTest.xml
index dbcfa57..ca771f5 100644
--- a/vibrator/V1_2/target/AndroidTest.xml
+++ b/vibrator/V1_2/target/AndroidTest.xml
@@ -24,7 +24,7 @@
         <option name="test-module-name" value="VtsHalVibratorV1_2Target"/>
         <option name="binary-test-source" value="_32bit::DATA/nativetest/VtsHalVibratorV1_2TargetTest/VtsHalVibratorV1_2TargetTest"/>
         <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalVibratorV1_2TargetTest/VtsHalVibratorV1_2TargetTest"/>
-        <option name="binary-test-type" value="hal_hidl_gtest"/>
+        <option name="binary-test-type" value="gtest"/>
         <option name="binary-test-disable-framework" value="true"/>
         <option name="test-timeout" value="5m"/>
     </test>
diff --git a/vibrator/V1_3/target/AndroidTest.xml b/vibrator/V1_3/target/AndroidTest.xml
index e42f459..21baa5b 100644
--- a/vibrator/V1_3/target/AndroidTest.xml
+++ b/vibrator/V1_3/target/AndroidTest.xml
@@ -24,7 +24,7 @@
         <option name="test-module-name" value="VtsHalVibratorV1_3Target"/>
         <option name="binary-test-source" value="_32bit::DATA/nativetest/VtsHalVibratorV1_3TargetTest/VtsHalVibratorV1_3TargetTest"/>
         <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalVibratorV1_3TargetTest/VtsHalVibratorV1_3TargetTest"/>
-        <option name="binary-test-type" value="hal_hidl_gtest"/>
+        <option name="binary-test-type" value="gtest"/>
         <option name="binary-test-disable-framework" value="true"/>
         <option name="test-timeout" value="5m"/>
     </test>
diff --git a/vr/V1_0/target/AndroidTest.xml b/vr/V1_0/target/AndroidTest.xml
index 0970f04..1620d4a 100644
--- a/vr/V1_0/target/AndroidTest.xml
+++ b/vr/V1_0/target/AndroidTest.xml
@@ -23,7 +23,7 @@
         <option name="test-module-name" value="VtsHalVrV1_0Target"/>
         <option name="binary-test-source" value="_32bit::DATA/nativetest/VtsHalVrV1_0TargetTest/VtsHalVrV1_0TargetTest"/>
         <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalVrV1_0TargetTest/VtsHalVrV1_0TargetTest"/>
-        <option name="binary-test-type" value="hal_hidl_gtest"/>
+        <option name="binary-test-type" value="gtest"/>
         <option name="binary-test-disable-framework" value="true"/>
         <option name="test-timeout" value="5m"/>
     </test>
diff --git a/weaver/V1_0/target/AndroidTest.xml b/weaver/V1_0/target/AndroidTest.xml
index 1f387aa..9631d85 100644
--- a/weaver/V1_0/target/AndroidTest.xml
+++ b/weaver/V1_0/target/AndroidTest.xml
@@ -23,7 +23,7 @@
         <option name="test-module-name" value="VtsHalWeaverV1_0Target"/>
         <option name="binary-test-source" value="_32bit::DATA/nativetest/VtsHalWeaverV1_0TargetTest/VtsHalWeaverV1_0TargetTest"/>
         <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalWeaverV1_0TargetTest/VtsHalWeaverV1_0TargetTest"/>
-        <option name="binary-test-type" value="hal_hidl_gtest"/>
+        <option name="binary-test-type" value="gtest"/>
         <option name="binary-test-disable-framework" value="true"/>
         <option name="test-timeout" value="5m"/>
     </test>
diff --git a/wifi/offload/V1_0/target/AndroidTest.xml b/wifi/offload/V1_0/target/AndroidTest.xml
index a82cfa8..af316d4 100644
--- a/wifi/offload/V1_0/target/AndroidTest.xml
+++ b/wifi/offload/V1_0/target/AndroidTest.xml
@@ -23,7 +23,7 @@
         <option name="test-module-name" value="VtsHalWifiOffloadV1_0Target"/>
         <option name="binary-test-source" value="_32bit::DATA/nativetest/VtsHalWifiOffloadV1_0TargetTest/VtsHalWifiOffloadV1_0TargetTest"/>
         <option name="binary-test-source" value="_64bit::DATA/nativetest64/VtsHalWifiOffloadV1_0TargetTest/VtsHalWifiOffloadV1_0TargetTest"/>
-        <option name="binary-test-type" value="hal_hidl_gtest"/>
+        <option name="binary-test-type" value="gtest"/>
         <option name="binary-test-disable-framework" value="true"/>
         <option name="test-timeout" value="1m"/>
     </test>