Merge "Revert "Revert "AOSP/Email - Changes for code to work with UnifiedEmail's version bump to the targetSdkVersion to 28 (maximum version). Used JobIntentservice API calls to replace context.startService for EmailBroadcastProcessorService."""
diff --git a/Android.mk b/Android.mk
index f574c16..41b04fd 100644
--- a/Android.mk
+++ b/Android.mk
@@ -45,7 +45,6 @@
     libchips \
     libphotoviewer_appcompat \
     android-opt-bitmap \
-    android-opt-datetimepicker \
     androidx.core_core \
     androidx.media_media \
     androidx.legacy_legacy-support-core-utils \
@@ -72,6 +71,8 @@
 
 LOCAL_SDK_VERSION := current
 
+LOCAL_COMPATIBILITY_SUITE := general-tests
+
 include $(BUILD_PACKAGE)
 
 # additionally, build unit tests in a separate .apk
diff --git a/TEST_MAPPING b/TEST_MAPPING
new file mode 100644
index 0000000..9d32044
--- /dev/null
+++ b/TEST_MAPPING
@@ -0,0 +1,7 @@
+{
+  "presubmit": [
+    {
+      "name": "EmailTests"
+    }
+  ]
+}
diff --git a/tests/Android.mk b/tests/Android.mk
index 5598c2e..60105f0 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -24,13 +24,14 @@
 # We only want this apk build for tests.
 LOCAL_MODULE_TAGS := tests
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 # For LOCAL_JAVA_LANGUAGE_VERSION >= 1.7, OpenJDK 9 javac generates synthetic calls to
 # Objects.requireNonNull() which was only added in Android API level 19. Thus, this must
 # stay at 1.6 as long as LOCAL_SDK_VERSION is set to a value < 19. See http://b/38495704
 LOCAL_JAVA_LANGUAGE_VERSION := 1.6
 LOCAL_SDK_VERSION := 14
+LOCAL_COMPATIBILITY_SUITE := general-tests
 LOCAL_PACKAGE_NAME := EmailTests
 LOCAL_INSTRUMENTATION_FOR := Email
 
diff --git a/tests/AndroidManifest.xml b/tests/AndroidManifest.xml
index 8169f68..81cb67e 100644
--- a/tests/AndroidManifest.xml
+++ b/tests/AndroidManifest.xml
@@ -4,9 +4,9 @@
      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.
@@ -20,7 +20,7 @@
 
     <!-- We add an application tag here just so that we can indicate that
          this package needs to link against the android.test library,
-         which is needed when building test cases. -->    
+         which is needed when building test cases. -->
     <application>
         <uses-library android:name="android.test.runner" />
     </application>
@@ -28,9 +28,9 @@
     <!--
     This declares that this app uses the instrumentation test runner targeting
     the package of com.android.email.  To run the tests use the command:
-    "adb shell am instrument -w com.android.email.tests/android.support.test.runner.AndroidJUnitRunner"
+    "adb shell am instrument -w com.android.email.tests"
     -->
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.email"
                      android:label="Tests for Email."/>
 
diff --git a/tests/AndroidTest.xml b/tests/AndroidTest.xml
new file mode 100644
index 0000000..8cced70
--- /dev/null
+++ b/tests/AndroidTest.xml
@@ -0,0 +1,28 @@
+<?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 Email Tests.">
+    <option name="test-suite-tag" value="apct" />
+    <target_preparer class="com.android.tradefed.targetprep.TestAppInstallSetup">
+        <option name="cleanup-apks" value="true" />
+        <option name="test-file-name" value="EmailTests.apk" />
+        <option name="test-file-name" value="Email.apk" />
+    </target_preparer>
+
+    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
+        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
+        <option name="package" value="com.android.email.tests" />
+    </test>
+</configuration>
diff --git a/tests/src/com/android/email/DummyFlakyTest.java b/tests/src/com/android/email/DummyFlakyTest.java
index a7278b6..99e37b4 100644
--- a/tests/src/com/android/email/DummyFlakyTest.java
+++ b/tests/src/com/android/email/DummyFlakyTest.java
@@ -16,7 +16,8 @@
 
 package com.android.email;
 
-import android.support.test.filters.FlakyTest;
+import androidx.test.filters.FlakyTest;
+
 import org.junit.Test;
 
 /**