Snap for 6439596 from 683326f42423a9301e71725cded28e2fa4e177c8 to qt-aml-tzdata-release

Change-Id: I9a7659f644de16ba10883c58d9c23bf08b1285b3
diff --git a/OWNERS b/OWNERS
new file mode 100644
index 0000000..6e7f570
--- /dev/null
+++ b/OWNERS
@@ -0,0 +1,3 @@
+# Root Owners of the MTS repo for code reviews
+chenzhu@google.com
+yuwu@google.com
diff --git a/tools/mts-tradefed/DynamicConfig.xml b/tools/mts-tradefed/DynamicConfig.xml
new file mode 100644
index 0000000..7adc138
--- /dev/null
+++ b/tools/mts-tradefed/DynamicConfig.xml
@@ -0,0 +1,55 @@
+<!-- Copyright (C) 2020 Google Inc.
+
+     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.
+-->
+
+<dynamicConfig>
+    <entry key="business_logic_device_features">
+        <value>android.hardware.type.automotive</value>
+        <value>android.hardware.type.television</value>
+        <value>android.hardware.type.watch</value>
+        <value>android.hardware.type.embedded</value>
+        <value>android.hardware.type.pc</value>
+        <value>android.software.leanback</value>
+        <value>com.google.android.feature.PIXEL_EXPERIENCE</value>
+        <value>android.hardware.telephony</value>
+        <value>android.hardware.vr.high_performance</value>
+        <value>cn.google.services</value>
+        <value>com.google.android.feature.RU</value>
+        <value>android.hardware.ram.low</value>
+        <value>com.google.android.feature.EEA_DEVICE</value>
+        <value>com.google.android.paid.chrome</value>
+        <value>com.google.android.paid.search</value>
+    </entry>
+    <entry key="business_logic_device_properties">
+        <value>ro.build.fingerprint</value>
+        <value>ro.build.version.sdk</value>
+        <value>ro.product.brand</value>
+        <value>ro.product.first_api_level</value>
+        <value>ro.product.manufacturer</value>
+        <value>ro.product.model</value>
+        <value>ro.product.name</value>
+    </entry>
+    <entry key="business_logic_device_packages">
+        <value>com.google.android.gms</value>
+        <value>com.android.vending</value>
+    </entry>
+    <entry key="business_logic_extended_device_info">
+        <!-- Name of extended device info file and a key stored in there.
+             The name must be subclass name of DeviceInfo under compatibility/common/deviceinfo
+             and key of the value stored in the subclass. See each class what keys are used.
+        -->
+        <value>MemoryDeviceInfo:total_memory</value>
+    </entry>
+</dynamicConfig>
+
diff --git a/tools/mts-tradefed/etc/mts-tradefed b/tools/mts-tradefed/etc/mts-tradefed
index e0412f4..18dc97b 100755
--- a/tools/mts-tradefed/etc/mts-tradefed
+++ b/tools/mts-tradefed/etc/mts-tradefed
@@ -35,9 +35,9 @@
 checkPath java
 
 # check java version
-JAVA_VERSION=$(java -version 2>&1 | head -n 1 | grep 'version [ "]\(1\.8\|9\|11\).*[ "]')
+JAVA_VERSION=$(java -version 2>&1 | head -n 1 | grep 'version [ "]\(1\.8\|9\).*[ "]')
 if [ "${JAVA_VERSION}" == "" ]; then
-    echo "Wrong java version. 1.8, 9, or 11 is required."
+    echo "Wrong java version. 1.8 or 9 is required."
     exit
 fi
 
@@ -105,6 +105,19 @@
     fi;
 done
 
+# check if APE_API_KEY is set in the env by user.
+if [ ! -n "${APE_API_KEY}" ]; then
+    GTS_GOOGLE_SERVICE_ACCOUNT=${ANDROID_BUILD_TOP}/vendor/xts/tools/gts-google-service-account/gts-google-service-account.json
+    # set KEY only for google if APE_API_KEY isn't set and GTS_GOOGLE_SERVICE_ACCOUNT exists in the soure tree.
+    if [ -f "$GTS_GOOGLE_SERVICE_ACCOUNT" ]; then
+        APE_API_KEY=${GTS_GOOGLE_SERVICE_ACCOUNT}
+        export APE_API_KEY
+    else
+        echo "APE_API_KEY not set, GTS tests may fail without authentication."
+    fi;
+fi;
+echo "APE_API_KEY: $APE_API_KEY"
+
 # load any shared libraries for host-side executables
 LIB_DIR=${MTS_ROOT}/android-mts/lib
 if [ "$HOST" == "Linux" ]; then
diff --git a/tools/mts-tradefed/res/config/mts-exclude.xml b/tools/mts-tradefed/res/config/mts-exclude.xml
index 464f9b2..6c62dee 100644
--- a/tools/mts-tradefed/res/config/mts-exclude.xml
+++ b/tools/mts-tradefed/res/config/mts-exclude.xml
@@ -60,5 +60,51 @@
     <!-- DocumentsUITests is only used to get coverage on virtual devices. -->
     <option name="compatibility:exclude-filter" value="DocumentsUITests" />
 
+    <!-- Exclude flaky timezone data tests. b/144301036 -->
+    <option name="compatibility:exclude-filter" value="CtsIcuTestCases android.icu.dev.test.util.ICUServiceThreadTest#Test05_ConcurrentEverything" />
+
+    <!-- b/142978584: Flaky test -->
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.TrafficStatsTest#testTrafficStatsForLocalhost" />
+
+    <!-- b/144859812: Flaky test -->
+    <option name="compatibility:exclude-filter" value="DocumentsUIGoogleTests com.android.documentsui.FileCopyUiTest#testCopyDocuments_InternalStorage" />
+
+    <!-- b/144578694: the tests are not for current train -->
+    <option name="compatibility:exclude-filter" value="DocumentsUIGoogleTests com.android.documentsui.DialogFragmentTest#testCreateDialog_textInputEditText_shouldNotTruncateOnLargeDensity" />
+    <option name="compatibility:exclude-filter" value="DocumentsUIGoogleTests com.android.documentsui.DialogFragmentTest#testCreateDialog_textInputEditText_shouldNotTruncateOnLargerDensity" />
+    <option name="compatibility:exclude-filter" value="DocumentsUIGoogleTests com.android.documentsui.DialogFragmentTest#testCreateDialog_textInputEditText_shouldNotTruncateOnLargestDensity" />
+    <option name="compatibility:exclude-filter" value="DocumentsUIGoogleTests com.android.documentsui.DialogFragmentTest#testCreateDirectoryFragmentShows_textInputEditText_shouldNotTruncateOnLandscape" />
+    <option name="compatibility:exclude-filter" value="DocumentsUIGoogleTests com.android.documentsui.files.ActionHandlerTest#testDocumentPicked_Recent_ManagesApks" />
+    <option name="compatibility:exclude-filter" value="DocumentsUIGoogleTests com.android.documentsui.RecentsLoaderTests#testContentsUpdate_observable" />
+
+    <!-- b/144850069: MTS flaky test -->
+    <option name="compatibility:exclude-filter" value="CtsMediaStressTestCases android.mediastress.cts.H264R1080pAacLongPlayerTest#testPlay00" />
+
+    <!-- b/144656329: MTS flaky test -->
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.EncodeDecodeTest#testEncodeDecodeVideoFromBufferToBufferQVGA0" />
+
+    <!-- b/144590142: MTS flaky test -->
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.DecoderTest#testVP8Decode640x360" />
+
+    <!-- b/144590245: MTS flaky test -->
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogH264FlexNearMaxMax" />
+
+    <!-- b/142976793: MTS flaky test -->
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.DecoderTest#testDecodeMonoOggMp4" />
+
+    <!-- b/144798271: MTS flaky test -->
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.MediaCodecCapabilitiesTest#testAvcHigh31" />
+
+    <!-- b/144590380: MTS flaky test -->
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.NativeMediaDrmClearkeyTest#testClearKeyPlaybackCenc2" />
+
+    <!-- b/143245993: MTS flaky test -->
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.NativeMediaDrmClearkeyTest#testPssh" />
+
+    <!-- b/142965402: MTS flaky test -->
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.MediaCodecCapabilitiesTest#testGetMaxSupportedInstances" />
+
+    <!-- b/147925128: Tests for permission controller should be excluded from the full MTS test run -->
+    <option name="compatibility:exclude-filter" value="CtsRoleTestCases" />
 </configuration>
 
diff --git a/tools/mts-tradefed/res/config/mts-media.xml b/tools/mts-tradefed/res/config/mts-media.xml
index 173cd4f..25bde91 100644
--- a/tools/mts-tradefed/res/config/mts-media.xml
+++ b/tools/mts-tradefed/res/config/mts-media.xml
@@ -20,7 +20,6 @@
     <option name="plan" value="mts-media" />
 
     <option name="compatibility:include-filter" value="CtsMediaTestCases" />
-    <option name="compatibility:include-filter" value="GtsMediaTestCases" />
     <option name="compatibility:include-filter" value="CtsMediaStressTestCases" />
 
     <!--b/138964734-->
@@ -36,4 +35,8 @@
 
     <!-- Exclude tests that are not related to media mainlines -->
     <option name="compatibility:module-arg" value="CtsMediaTestCases:exclude-annotation:android.media.cts.NonMediaMainlineTest" />
+    <option name="compatibility:module-arg" value="CtsMediaStressTestCases:exclude-annotation:android.mediastress.cts.NonMediaMainlineTest" />
+
+    <!-- Advertise the test suite to media cts. -->
+    <option name="compatibility:module-arg" value="CtsMediaTestCases:instrumentation-arg:mts-media:=true" />
 </configuration>
diff --git a/tools/mts-tradefed/res/config/mts-neuralnetworks.xml b/tools/mts-tradefed/res/config/mts-neuralnetworks.xml
deleted file mode 100644
index 4929cd5..0000000
--- a/tools/mts-tradefed/res/config/mts-neuralnetworks.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?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="Runs MTS-neuralnetworks from a pre-existing MTS installation">
-
-    <include name="mts" />
-
-    <option name="plan" value="mts-neuralnetworks" />
-    <option name="compatibility:include-filter" value="CtsNNAPITestCases" />
-    <option name="compatibility:include-filter" value="CtsNNAPIBenchmarkTestCases" />
-</configuration>
diff --git a/tools/mts-tradefed/res/config/mts-permission.xml b/tools/mts-tradefed/res/config/mts-permission.xml
new file mode 100644
index 0000000..a75dd84
--- /dev/null
+++ b/tools/mts-tradefed/res/config/mts-permission.xml
@@ -0,0 +1,25 @@
+<?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="Runs MTS-Permission from a pre-existing MTS installation">
+
+    <include name="mts" />
+
+    <option name="plan" value="mts-permission" />
+
+    <option name="compatibility:include-filter" value="CtsAppSecurityHostTestCases android.appsecurity.cts.PermissionsHostTest" />
+    <option name="compatibility:include-filter" value="CtsRoleTestCases" />
+</configuration>
diff --git a/tools/mts-tradefed/res/config/mts-preconditions.xml b/tools/mts-tradefed/res/config/mts-preconditions.xml
index 1420d86..e35cea8 100644
--- a/tools/mts-tradefed/res/config/mts-preconditions.xml
+++ b/tools/mts-tradefed/res/config/mts-preconditions.xml
@@ -17,6 +17,16 @@
 
     <option name="plan" value="mts-preconditions" />
 
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.DynamicConfigPusher">
+        <option name="target" value="host" />
+        <!-- the name under which to find the configuration -->
+        <option name="config-filename" value="mts"/>
+        <option name="extract-from-resource" value="true" />
+        <!-- the name of the resource inside the jar -->
+        <option name="dynamic-resource-name" value="mts-tradefed" />
+    </target_preparer>
+
+
     <target_preparer class="com.android.compatibility.common.tradefed.targetprep.StayAwakePreparer" />
 
     <target_preparer class="com.android.compatibility.common.tradefed.targetprep.SettingsPreparer">
diff --git a/tools/mts-tradefed/res/config/mts.xml b/tools/mts-tradefed/res/config/mts.xml
index 2e55f72..663df2a 100644
--- a/tools/mts-tradefed/res/config/mts.xml
+++ b/tools/mts-tradefed/res/config/mts.xml
@@ -29,6 +29,12 @@
         <option name="teardown-command" value="settings put global package_verifier_enable 1"/>
     </target_preparer>
 
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.BusinessLogicPreparer">
+        <option name="business-logic-url" value="https://androidpartner.googleapis.com/v1/xtsBusinessLogic/suites/gts:select" />
+        <option name="business-logic-api-key" value="AIzaSyCZNccVFX50XFhVUbh_vEUxG0C8z8As6wk" />
+        <option name="business-logic-api-scope" value="https://www.googleapis.com/auth/androidPartner" />
+    </target_preparer>
+
     <target_preparer class="com.android.compatibility.common.tradefed.targetprep.PropertyCheck">
         <option name="property-name" value="ro.build.type" />
         <option name="expected-value" value="user"/> <!-- Device should have user build -->
@@ -42,5 +48,8 @@
     </target_preparer>
 
     <template-include name="reporters" default="basic-reporters" />
+
+    <!-- Advertise the test suite to media cts. -->
+    <option name="compatibility:module-arg" value="CtsMediaTestCases:instrumentation-arg:mts-media:=true" />
 </configuration>