Merge "Support for instant apps in Signed Config CTS test."
diff --git a/apps/CameraITS/tests/scene2b/scene2b.pdf b/apps/CameraITS/tests/scene2b/scene2b.pdf
new file mode 100644
index 0000000..9e9f960
--- /dev/null
+++ b/apps/CameraITS/tests/scene2b/scene2b.pdf
Binary files differ
diff --git a/apps/CameraITS/tests/scene2b/scene2b_0.5_scaled.pdf b/apps/CameraITS/tests/scene2b/scene2b_0.5_scaled.pdf
new file mode 100644
index 0000000..3a5bd85
--- /dev/null
+++ b/apps/CameraITS/tests/scene2b/scene2b_0.5_scaled.pdf
Binary files differ
diff --git a/apps/CameraITS/tests/scene2b/scene2b_0.67_scaled.pdf b/apps/CameraITS/tests/scene2b/scene2b_0.67_scaled.pdf
new file mode 100644
index 0000000..706140a
--- /dev/null
+++ b/apps/CameraITS/tests/scene2b/scene2b_0.67_scaled.pdf
Binary files differ
diff --git a/apps/CameraITS/tests/scene2b/test_num_faces.py b/apps/CameraITS/tests/scene2b/test_num_faces.py
new file mode 100644
index 0000000..044c154
--- /dev/null
+++ b/apps/CameraITS/tests/scene2b/test_num_faces.py
@@ -0,0 +1,100 @@
+# 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.
+
+import os.path
+import cv2
+import its.caps
+import its.device
+import its.image
+import its.objects
+
+NAME = os.path.basename(__file__).split('.')[0]
+NUM_TEST_FRAMES = 20
+NUM_FACES = 3
+FD_MODE_OFF = 0
+FD_MODE_SIMPLE = 1
+FD_MODE_FULL = 2
+W, H = 640, 480
+
+
+def main():
+ """Test face detection."""
+ with its.device.ItsSession() as cam:
+ props = cam.get_camera_properties()
+ its.caps.skip_unless(its.caps.face_detect(props))
+ mono_camera = its.caps.mono_camera(props)
+ fd_modes = props['android.statistics.info.availableFaceDetectModes']
+ a = props['android.sensor.info.activeArraySize']
+ aw, ah = a['right'] - a['left'], a['bottom'] - a['top']
+
+ if its.caps.read_3a(props):
+ _, _, _, _, _ = cam.do_3a(get_results=True,
+ mono_camera=mono_camera)
+
+ for fd_mode in fd_modes:
+ assert FD_MODE_OFF <= fd_mode <= FD_MODE_FULL
+ req = its.objects.auto_capture_request()
+ req['android.statistics.faceDetectMode'] = fd_mode
+ fmt = {'format': 'yuv', 'width': W, 'height': H}
+ caps = cam.do_capture([req]*NUM_TEST_FRAMES, fmt)
+ for i, cap in enumerate(caps):
+ md = cap['metadata']
+ assert md['android.statistics.faceDetectMode'] == fd_mode
+ faces = md['android.statistics.faces']
+
+ # 0 faces should be returned for OFF mode
+ if fd_mode == FD_MODE_OFF:
+ assert not faces
+ continue
+ # Face detection could take several frames to warm up,
+ # but should detect the correct number of faces in last frame
+ if i == NUM_TEST_FRAMES - 1:
+ img = its.image.convert_capture_to_rgb_image(cap,
+ props=props)
+ fnd_faces = len(faces)
+ print 'Found %d face(s), expected %d.' % (fnd_faces,
+ NUM_FACES)
+ # draw boxes around faces
+ for rect in [face['bounds'] for face in faces]:
+ top_left = (int(round(rect['left']*W/aw)),
+ int(round(rect['top']*H/ah)))
+ bot_rght = (int(round(rect['right']*W/aw)),
+ int(round(rect['bottom']*H/ah)))
+ cv2.rectangle(img, top_left, bot_rght, (0, 1, 0), 2)
+ img_name = '%s_fd_mode_%s.jpg' % (NAME, fd_mode)
+ its.image.write_image(img, img_name)
+ assert fnd_faces == NUM_FACES
+ if not faces:
+ continue
+
+ print 'Frame %d face metadata:' % i
+ print ' Faces:', faces
+ print ''
+
+ # Reasonable scores for faces
+ face_scores = [face['score'] for face in faces]
+ for score in face_scores:
+ assert score >= 1 and score <= 100
+ # Face bounds should be within active array
+ face_rectangles = [face['bounds'] for face in faces]
+ for rect in face_rectangles:
+ assert rect['top'] < rect['bottom']
+ assert rect['left'] < rect['right']
+ assert 0 <= rect['top'] <= ah
+ assert 0 <= rect['bottom'] <= ah
+ assert 0 <= rect['left'] <= aw
+ assert 0 <= rect['right'] <= aw
+
+if __name__ == '__main__':
+ main()
diff --git a/apps/CameraITS/tests/scene2c/scene2c.pdf b/apps/CameraITS/tests/scene2c/scene2c.pdf
new file mode 100644
index 0000000..d11a02d
--- /dev/null
+++ b/apps/CameraITS/tests/scene2c/scene2c.pdf
Binary files differ
diff --git a/apps/CameraITS/tests/scene2c/scene2c_0.5_scaled.pdf b/apps/CameraITS/tests/scene2c/scene2c_0.5_scaled.pdf
new file mode 100644
index 0000000..9ac02a1
--- /dev/null
+++ b/apps/CameraITS/tests/scene2c/scene2c_0.5_scaled.pdf
Binary files differ
diff --git a/apps/CameraITS/tests/scene2c/scene2c_0.67_scaled.pdf b/apps/CameraITS/tests/scene2c/scene2c_0.67_scaled.pdf
new file mode 100644
index 0000000..4a8bb09
--- /dev/null
+++ b/apps/CameraITS/tests/scene2c/scene2c_0.67_scaled.pdf
Binary files differ
diff --git a/apps/CameraITS/tests/scene2c/test_num_faces.py b/apps/CameraITS/tests/scene2c/test_num_faces.py
new file mode 100644
index 0000000..044c154
--- /dev/null
+++ b/apps/CameraITS/tests/scene2c/test_num_faces.py
@@ -0,0 +1,100 @@
+# 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.
+
+import os.path
+import cv2
+import its.caps
+import its.device
+import its.image
+import its.objects
+
+NAME = os.path.basename(__file__).split('.')[0]
+NUM_TEST_FRAMES = 20
+NUM_FACES = 3
+FD_MODE_OFF = 0
+FD_MODE_SIMPLE = 1
+FD_MODE_FULL = 2
+W, H = 640, 480
+
+
+def main():
+ """Test face detection."""
+ with its.device.ItsSession() as cam:
+ props = cam.get_camera_properties()
+ its.caps.skip_unless(its.caps.face_detect(props))
+ mono_camera = its.caps.mono_camera(props)
+ fd_modes = props['android.statistics.info.availableFaceDetectModes']
+ a = props['android.sensor.info.activeArraySize']
+ aw, ah = a['right'] - a['left'], a['bottom'] - a['top']
+
+ if its.caps.read_3a(props):
+ _, _, _, _, _ = cam.do_3a(get_results=True,
+ mono_camera=mono_camera)
+
+ for fd_mode in fd_modes:
+ assert FD_MODE_OFF <= fd_mode <= FD_MODE_FULL
+ req = its.objects.auto_capture_request()
+ req['android.statistics.faceDetectMode'] = fd_mode
+ fmt = {'format': 'yuv', 'width': W, 'height': H}
+ caps = cam.do_capture([req]*NUM_TEST_FRAMES, fmt)
+ for i, cap in enumerate(caps):
+ md = cap['metadata']
+ assert md['android.statistics.faceDetectMode'] == fd_mode
+ faces = md['android.statistics.faces']
+
+ # 0 faces should be returned for OFF mode
+ if fd_mode == FD_MODE_OFF:
+ assert not faces
+ continue
+ # Face detection could take several frames to warm up,
+ # but should detect the correct number of faces in last frame
+ if i == NUM_TEST_FRAMES - 1:
+ img = its.image.convert_capture_to_rgb_image(cap,
+ props=props)
+ fnd_faces = len(faces)
+ print 'Found %d face(s), expected %d.' % (fnd_faces,
+ NUM_FACES)
+ # draw boxes around faces
+ for rect in [face['bounds'] for face in faces]:
+ top_left = (int(round(rect['left']*W/aw)),
+ int(round(rect['top']*H/ah)))
+ bot_rght = (int(round(rect['right']*W/aw)),
+ int(round(rect['bottom']*H/ah)))
+ cv2.rectangle(img, top_left, bot_rght, (0, 1, 0), 2)
+ img_name = '%s_fd_mode_%s.jpg' % (NAME, fd_mode)
+ its.image.write_image(img, img_name)
+ assert fnd_faces == NUM_FACES
+ if not faces:
+ continue
+
+ print 'Frame %d face metadata:' % i
+ print ' Faces:', faces
+ print ''
+
+ # Reasonable scores for faces
+ face_scores = [face['score'] for face in faces]
+ for score in face_scores:
+ assert score >= 1 and score <= 100
+ # Face bounds should be within active array
+ face_rectangles = [face['bounds'] for face in faces]
+ for rect in face_rectangles:
+ assert rect['top'] < rect['bottom']
+ assert rect['left'] < rect['right']
+ assert 0 <= rect['top'] <= ah
+ assert 0 <= rect['bottom'] <= ah
+ assert 0 <= rect['left'] <= aw
+ assert 0 <= rect['right'] <= aw
+
+if __name__ == '__main__':
+ main()
diff --git a/apps/CameraITS/tools/run_all_tests.py b/apps/CameraITS/tools/run_all_tests.py
index 8fd2d5b..35b954a 100644
--- a/apps/CameraITS/tools/run_all_tests.py
+++ b/apps/CameraITS/tools/run_all_tests.py
@@ -176,15 +176,17 @@
dist: [Experimental] chart distance in cm.
"""
- all_scenes = ["scene0", "scene1", "scene2", "scene3", "scene4", "scene5",
+ all_scenes = ["scene0", "scene1", "scene2", "scene2b", "scene2c", "scene3", "scene4", "scene5",
"sensor_fusion"]
- auto_scenes = ["scene0", "scene1", "scene2", "scene3", "scene4"]
+ auto_scenes = ["scene0", "scene1", "scene2", "scene2b", "scene2c", "scene3", "scene4"]
scene_req = {
"scene0": None,
"scene1": "A grey card covering at least the middle 30% of the scene",
"scene2": "A picture containing human faces",
+ "scene2b": "A picture containing human faces",
+ "scene2c": "A picture containing human faces",
"scene3": "The ISO 12233 chart",
"scene4": "A specific test page of a circle covering at least the "
"middle 50% of the scene. See CameraITS.pdf section 2.3.4 "
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index 8b389c5..27faca0 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -2244,6 +2244,27 @@
android:value="android.hardware.type.watch:android.software.leanback:android.hardware.type.automotive" />
</activity>
+ <activity android:name=".qstiles.TileServiceVerifierActivity"
+ android:label="@string/tiles_test">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.cts.intent.category.MANUAL_TEST" />
+ </intent-filter>
+ <meta-data android:name="test_category" android:value="@string/test_category_tiles" />
+ <meta-data android:name="test_excluded_features"
+ android:value="android.hardware.type.television:android.software.leanback:android.hardware.type.watch" />
+ </activity>
+
+ <service android:name=".qstiles.MockTileService"
+ android:icon="@android:drawable/ic_dialog_alert"
+ android:label="@string/tile_service_name"
+ android:enabled="false"
+ android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
+ <intent-filter>
+ <action android:name="android.service.quicksettings.action.QS_TILE" />
+ </intent-filter>
+ </service>
+
<activity android:name=".vr.VrListenerVerifierActivity"
android:configChanges="uiMode"
android:label="@string/vr_tests">
@@ -2556,6 +2577,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/res/layout/tiles_item.xml b/apps/CtsVerifier/res/layout/tiles_item.xml
new file mode 100644
index 0000000..f2adaa4
--- /dev/null
+++ b/apps/CtsVerifier/res/layout/tiles_item.xml
@@ -0,0 +1,73 @@
+<?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.
+-->
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" >
+
+ <ImageView
+ android:id="@+id/tiles_status"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentLeft="true"
+ android:layout_alignParentTop="true"
+ android:layout_marginTop="10dip"
+ android:contentDescription="@string/pass_button_text"
+ android:padding="10dip"
+ android:src="@drawable/fs_indeterminate" />
+
+ <TextView
+ android:id="@+id/tiles_instructions"
+ style="@style/InstructionsSmallFont"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentRight="true"
+ android:layout_alignParentTop="true"
+ android:layout_toRightOf="@id/tiles_status"/>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_below="@id/tiles_instructions"
+ android:layout_toRightOf="@id/tiles_status"
+ android:layout_alignParentRight="true">
+
+ <Button
+ android:id="@+id/tiles_action_pass"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:layout_marginLeft="20dip"
+ android:layout_marginRight="10dip"
+ android:onClick="actionPressed"
+ android:clickable="false"
+ android:enabled="false"
+ android:text="Pass"/>
+
+ <Button
+ android:id="@+id/tiles_action_fail"
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:layout_marginLeft="10dip"
+ android:layout_marginRight="20dip"
+ android:clickable="false"
+ android:enabled="false"
+ android:text="Fail"
+ android:onClick="actionPressed" />
+ </LinearLayout>
+
+</RelativeLayout>
\ No newline at end of file
diff --git a/apps/CtsVerifier/res/layout/tiles_main.xml b/apps/CtsVerifier/res/layout/tiles_main.xml
new file mode 100644
index 0000000..f523b4a
--- /dev/null
+++ b/apps/CtsVerifier/res/layout/tiles_main.xml
@@ -0,0 +1,44 @@
+<?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 xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ style="@style/RootLayoutPadding">
+
+ <ScrollView
+ android:id="@+id/tiles_test_scroller"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="1"
+ android:orientation="vertical">
+
+ <LinearLayout
+ android:id="@+id/tiles_test_items"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical" >
+ </LinearLayout>
+ </ScrollView>
+
+ <include
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="0"
+ layout="@layout/pass_fail_buttons" />
+
+</LinearLayout>
\ No newline at end of file
diff --git a/apps/CtsVerifier/res/values/strings.xml b/apps/CtsVerifier/res/values/strings.xml
index f15a675..6f43536 100755
--- a/apps/CtsVerifier/res/values/strings.xml
+++ b/apps/CtsVerifier/res/values/strings.xml
@@ -1101,6 +1101,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>
@@ -1437,7 +1440,9 @@
<string name="wifi_test">Wi-Fi Test</string>
<string name="wifi_test_info">
The Wi-Fi tests requires an open (no security) access point in the environment along with the DUT.
- The DUT should also not have any saved wifi networks that are visible in the environment.
+ \nPlease perform a network settings reset between each test to reset platform\'s internal state which
+ might interfere with the test flow.\nNavigate to \"Settings -> System -> Reset Options -> Reset Wi-Fi,
+ mobile & Bluetooth\" to perform a network settings reset.
</string>
<string name="wifi_location_not_enabled">Wi-Fi / Location Mode is not enabled</string>
<string name="wifi_location_not_enabled_message">These tests require Wi-Fi and Location Mode to be enabled.
@@ -1792,6 +1797,7 @@
itself according to the current rotation of the device.</string>
<string name="test_category_notifications">Notifications</string>
+ <string name="test_category_tiles">Tiles</string>
<string name="package_priority_test">Notification Package Priority Test</string>
<string name="package_priority_info">This test checks that the NotificationManagerService respects
user preferences about relative package priorities.
@@ -1868,6 +1874,18 @@
dismiss them.
</string>
<string name="msg_extras_preserved">Check that Message extras Bundle was preserved.</string>
+ <string name="tile_service_name">Tile Service for CTS Verifier</string>
+ <string name="tiles_test">Tile Service Test</string>
+ <string name="tiles_info">This test checks that a Tile Service added by a third party
+ application is not immediately added to the current Quick Settings tiles but can be added
+ by the user.
+ </string>
+ <string name="tiles_adding_tile">Check that Tile Service is enabled</string>
+ <string name="tiles_not_added">Open Quick Settings and check that the Tile Service for CTS
+ Verifier is not visible in any page</string>
+ <string name="tiles_in_customizer">Open Quick Settings and click the button to customize Quick
+ Settings. Check that the Tile Service for CTS Verifier is available to be added</string>
+ <string name="tiles_removing_tile">Check that Tile Service is disabled</string>
<string name="vr_tests">VR Tests</string>
<string name="test_category_vr">VR</string>
<string name="vr_test_title">VR Listener Test</string>
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/qstiles/InteractiveVerifierActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/qstiles/InteractiveVerifierActivity.java
new file mode 100644
index 0000000..5de1d8d
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/qstiles/InteractiveVerifierActivity.java
@@ -0,0 +1,396 @@
+/*
+ * 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.verifier.qstiles;
+
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.android.cts.verifier.PassFailButtons;
+import com.android.cts.verifier.R;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+// This class is based on the same class from notifications
+public abstract class InteractiveVerifierActivity extends PassFailButtons.Activity
+ implements Runnable {
+ private static final String TAG = "InteractiveVerifier";
+ private static final String STATE = "state";
+ private static final String STATUS = "status";
+ protected static final String TILE_PATH = "com.android.cts.verifier/" +
+ "com.android.cts.verifier.qstiles.MockTileService";
+ protected static final ComponentName TILE_NAME = ComponentName.unflattenFromString(TILE_PATH);
+ protected static final int SETUP = 0;
+ protected static final int READY = 1;
+ protected static final int RETEST = 2;
+ protected static final int PASS = 3;
+ protected static final int FAIL = 4;
+ protected static final int WAIT_FOR_USER = 5;
+ protected static final int RETEST_AFTER_LONG_DELAY = 6;
+ protected static final int READY_AFTER_LONG_DELAY = 7;
+
+ protected InteractiveTestCase mCurrentTest;
+ protected PackageManager mPackageManager;
+ protected Context mContext;
+ protected Runnable mRunner;
+ protected View mHandler;
+
+ private LayoutInflater mInflater;
+ private ViewGroup mItemList;
+ private List<InteractiveTestCase> mTestList;
+ private Iterator<InteractiveTestCase> mTestOrder;
+
+ protected boolean setTileState(boolean enabled) {
+ int state = enabled ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
+ : PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
+ mPackageManager.setComponentEnabledSetting(TILE_NAME, state, PackageManager.DONT_KILL_APP);
+ return mPackageManager.getComponentEnabledSetting(TILE_NAME) == state;
+ }
+
+ protected abstract class InteractiveTestCase {
+ protected boolean mUserVerified;
+ protected int status;
+ private View view;
+ protected long delayTime = 3000;
+
+ protected abstract View inflate(ViewGroup parent);
+
+ View getView(ViewGroup parent) {
+ if (view == null) {
+ view = inflate(parent);
+ }
+ return view;
+ }
+
+ /** @return true if the test should re-run when the test activity starts. */
+ boolean autoStart() {
+ return false;
+ }
+
+ /** Set status to {@link #READY} to proceed, or {@link #SETUP} to try again. */
+ protected void setUp() {
+ status = READY;
+ next();
+ }
+
+ /** Set status to {@link #PASS} or @{link #FAIL} to proceed, or {@link #READY} to retry. */
+ protected void test() {
+ status = FAIL;
+ next();
+ }
+
+ /** Do not modify status. */
+ protected void tearDown() {
+ next();
+ }
+
+ protected void setFailed() {
+ status = FAIL;
+ logFail();
+ }
+
+ protected void setFailed(String message) {
+ status = FAIL;
+ logFail(message);
+ }
+
+ protected void logFail() {
+ logFail(null);
+ }
+
+ protected void logFail(String message) {
+ logWithStack("failed " + this.getClass().getSimpleName() +
+ ((message == null) ? "" : ": " + message));
+ }
+
+ protected void logFail(String message, Throwable e) {
+ Log.e(TAG, "failed " + this.getClass().getSimpleName() +
+ ((message == null) ? "" : ": " + message), e);
+ }
+
+ }
+
+ protected abstract int getTitleResource();
+
+ protected abstract int getInstructionsResource();
+
+ protected void onCreate(Bundle savedState) {
+ super.onCreate(savedState);
+ int savedStateIndex = (savedState == null) ? 0 : savedState.getInt(STATE, 0);
+ int savedStatus = (savedState == null) ? SETUP : savedState.getInt(STATUS, SETUP);
+ Log.i(TAG, "restored state(" + savedStateIndex + "}, status(" + savedStatus + ")");
+ mContext = this;
+ mRunner = this;
+ mPackageManager = getPackageManager();
+ mInflater = getLayoutInflater();
+ View view = mInflater.inflate(R.layout.tiles_main, null);
+ mItemList = (ViewGroup) view.findViewById(R.id.tiles_test_items);
+ mHandler = mItemList;
+ mTestList = new ArrayList<>();
+ mTestList.addAll(createTestItems());
+ for (InteractiveTestCase test : mTestList) {
+ mItemList.addView(test.getView(mItemList));
+ }
+ mTestOrder = mTestList.iterator();
+ for (int i = 0; i < savedStateIndex; i++) {
+ mCurrentTest = mTestOrder.next();
+ mCurrentTest.status = PASS;
+ }
+ mCurrentTest = mTestOrder.next();
+ mCurrentTest.status = savedStatus;
+
+ setContentView(view);
+ setPassFailButtonClickListeners();
+ getPassButton().setEnabled(false);
+
+ setInfoResources(getTitleResource(), getInstructionsResource(), -1);
+ }
+
+ @Override
+ protected void onSaveInstanceState(Bundle outState) {
+ final int stateIndex = mTestList.indexOf(mCurrentTest);
+ outState.putInt(STATE, stateIndex);
+ final int status = mCurrentTest == null ? SETUP : mCurrentTest.status;
+ outState.putInt(STATUS, status);
+ Log.i(TAG, "saved state(" + stateIndex + "}, status(" + status + ")");
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ //To avoid NPE during onResume,before start to iterate next test order
+ if (mCurrentTest != null && mCurrentTest.autoStart()) {
+ mCurrentTest.status = READY;
+ }
+ // Makes sure that the tile is there on resume
+ setTileState(true);
+ next();
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ // Makes sure that the tile is removed when test is not running
+ setTileState(false);
+ }
+
+ // Interface Utilities
+
+ protected void markItem(InteractiveTestCase test) {
+ if (test == null) {
+ return;
+ }
+ View item = test.view;
+ ImageView status = (ImageView) item.findViewById(R.id.tiles_status);
+ View buttonPass = item.findViewById(R.id.tiles_action_pass);
+ View buttonFail = item.findViewById(R.id.tiles_action_fail);
+ switch (test.status) {
+ case WAIT_FOR_USER:
+ status.setImageResource(R.drawable.fs_warning);
+ break;
+
+ case SETUP:
+ case READY:
+ case RETEST:
+ status.setImageResource(R.drawable.fs_clock);
+ buttonPass.setEnabled(true);
+ buttonPass.setClickable(true);
+ buttonFail.setEnabled(true);
+ buttonFail.setClickable(true);
+ break;
+
+ case FAIL:
+ status.setImageResource(R.drawable.fs_error);
+ buttonFail.setClickable(false);
+ buttonFail.setEnabled(false);
+ buttonPass.setClickable(false);
+ buttonPass.setEnabled(false);
+ break;
+
+ case PASS:
+ status.setImageResource(R.drawable.fs_good);
+ buttonFail.setClickable(false);
+ buttonFail.setEnabled(false);
+ buttonPass.setClickable(false);
+ buttonPass.setEnabled(false);
+ break;
+
+ }
+ status.invalidate();
+ }
+
+
+ protected View createUserPassFail(ViewGroup parent, int messageId,
+ Object... messageFormatArgs) {
+ View item = mInflater.inflate(R.layout.tiles_item, parent, false);
+ TextView instructions = (TextView) item.findViewById(R.id.tiles_instructions);
+ instructions.setText(getString(messageId, messageFormatArgs));
+ return item;
+ }
+
+ protected View createAutoItem(ViewGroup parent, int stringId) {
+ View item = mInflater.inflate(R.layout.tiles_item, parent, false);
+ TextView instructions = (TextView) item.findViewById(R.id.tiles_instructions);
+ instructions.setText(stringId);
+ View buttonPass = item.findViewById(R.id.tiles_action_pass);
+ View buttonFail = item.findViewById(R.id.tiles_action_fail);
+ buttonPass.setVisibility(View.GONE);
+ buttonFail.setVisibility(View.GONE);
+ return item;
+ }
+
+ // Test management
+
+ abstract protected List<InteractiveTestCase> createTestItems();
+
+ public void run() {
+ if (mCurrentTest == null) {
+ return;
+ }
+ markItem(mCurrentTest);
+ switch (mCurrentTest.status) {
+ case SETUP:
+ Log.i(TAG, "running setup for: " + mCurrentTest.getClass().getSimpleName());
+ mCurrentTest.setUp();
+ if (mCurrentTest.status == READY_AFTER_LONG_DELAY) {
+ delay(mCurrentTest.delayTime);
+ } else {
+ delay();
+ }
+ break;
+
+ case WAIT_FOR_USER:
+ Log.i(TAG, "waiting for user: " + mCurrentTest.getClass().getSimpleName());
+ break;
+
+ case READY_AFTER_LONG_DELAY:
+ case RETEST_AFTER_LONG_DELAY:
+ case READY:
+ case RETEST:
+ Log.i(TAG, "running test for: " + mCurrentTest.getClass().getSimpleName());
+ try {
+ mCurrentTest.test();
+ if (mCurrentTest.status == RETEST_AFTER_LONG_DELAY) {
+ delay(mCurrentTest.delayTime);
+ } else {
+ delay();
+ }
+ } catch (Throwable t) {
+ mCurrentTest.status = FAIL;
+ markItem(mCurrentTest);
+ Log.e(TAG, "FAIL: " + mCurrentTest.getClass().getSimpleName(), t);
+ mCurrentTest.tearDown();
+ mCurrentTest = null;
+ delay();
+ }
+
+ break;
+
+ case FAIL:
+ Log.i(TAG, "FAIL: " + mCurrentTest.getClass().getSimpleName());
+ mCurrentTest.tearDown();
+ mCurrentTest = null;
+ delay();
+ break;
+
+ case PASS:
+ Log.i(TAG, "pass for: " + mCurrentTest.getClass().getSimpleName());
+ mCurrentTest.tearDown();
+ if (mTestOrder.hasNext()) {
+ mCurrentTest = mTestOrder.next();
+ Log.i(TAG, "next test is: " + mCurrentTest.getClass().getSimpleName());
+ next();
+ } else {
+ Log.i(TAG, "no more tests");
+ mCurrentTest = null;
+ getPassButton().setEnabled(true);
+ }
+ break;
+ }
+ markItem(mCurrentTest);
+ }
+
+ /**
+ * Return to the state machine to progress through the tests.
+ */
+ protected void next() {
+ mHandler.removeCallbacks(mRunner);
+ mHandler.post(mRunner);
+ }
+
+ /**
+ * Wait for things to settle before returning to the state machine.
+ */
+ protected void delay() {
+ delay(3000);
+ }
+
+ protected void sleep(long time) {
+ try {
+ Thread.sleep(time);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Wait for some time.
+ */
+ protected void delay(long waitTime) {
+ mHandler.removeCallbacks(mRunner);
+ mHandler.postDelayed(mRunner, waitTime);
+ }
+
+ // UI callbacks
+
+ public void actionPressed(View v) {
+ if (mCurrentTest != null) {
+ switch (v.getId()) {
+ case R.id.tiles_action_pass:
+ mCurrentTest.status = PASS;
+ mCurrentTest.mUserVerified = true;
+ next();
+ break;
+ case R.id.tiles_action_fail:
+ mCurrentTest.status = FAIL;
+ mCurrentTest.mUserVerified = true;
+ next();
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ // Utilities
+
+ protected void logWithStack(String message) {
+ Throwable stackTrace = new Throwable();
+ stackTrace.fillInStackTrace();
+ Log.e(TAG, message, stackTrace);
+ }
+
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/qstiles/MockTileService.java b/apps/CtsVerifier/src/com/android/cts/verifier/qstiles/MockTileService.java
new file mode 100644
index 0000000..639c42b
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/qstiles/MockTileService.java
@@ -0,0 +1,26 @@
+/*
+ * 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.verifier.qstiles;
+
+import android.service.quicksettings.TileService;
+
+/**
+ * A test tile for the CTS verifier
+ */
+public class MockTileService extends TileService {
+ protected final String TAG = getClass().getSimpleName();
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/qstiles/TileServiceVerifierActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/qstiles/TileServiceVerifierActivity.java
new file mode 100644
index 0000000..a65156c
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/qstiles/TileServiceVerifierActivity.java
@@ -0,0 +1,114 @@
+/*
+ * 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.verifier.qstiles;
+
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.android.cts.verifier.R;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class TileServiceVerifierActivity extends InteractiveVerifierActivity implements Runnable {
+
+ @Override
+ protected int getTitleResource() {
+ return R.string.tiles_test;
+ }
+
+ @Override
+ protected int getInstructionsResource() {
+ return R.string.tiles_info;
+ }
+
+ @Override
+ protected List<InteractiveTestCase> createTestItems() {
+ ArrayList<InteractiveTestCase> list = new ArrayList<>();
+ list.add(new SettingUpTile());
+ list.add(new TileNotAvailable());
+ list.add(new TileInCustomizer());
+ list.add(new TearingDownTile());
+ return list;
+ }
+
+ private class SettingUpTile extends InteractiveTestCase {
+
+ @Override
+ protected View inflate(ViewGroup parent) {
+ return createAutoItem(parent, R.string.tiles_adding_tile);
+ }
+
+ @Override
+ protected void test() {
+ boolean result = setTileState(true);
+ if (result) {
+ status = PASS;
+ } else {
+ setFailed("Tile Service failed to enable");
+ }
+ }
+ }
+
+ // Tests
+ private class TileNotAvailable extends InteractiveTestCase {
+ @Override
+ protected View inflate(ViewGroup parent) {
+ return createUserPassFail(parent, R.string.tiles_not_added);
+
+ }
+
+ @Override
+ protected void test() {
+ status = WAIT_FOR_USER;
+ next();
+ }
+ }
+
+ // Tests
+ private class TileInCustomizer extends InteractiveTestCase {
+ @Override
+ protected View inflate(ViewGroup parent) {
+ return createUserPassFail(parent, R.string.tiles_in_customizer);
+
+ }
+
+ @Override
+ protected void test() {
+ status = WAIT_FOR_USER;
+ next();
+ }
+ }
+
+ private class TearingDownTile extends InteractiveTestCase {
+
+ @Override
+ protected View inflate(ViewGroup parent) {
+ return createAutoItem(parent, R.string.tiles_removing_tile);
+ }
+
+ @Override
+ protected void test() {
+ boolean result = setTileState(false);
+ if (result) {
+ status = PASS;
+ } else {
+ setFailed("Tile Service failed to disable");
+ }
+ }
+ }
+}
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/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
index 0e19e76..13b9b86 100644
--- 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
@@ -50,7 +50,6 @@
@Before
public void handleBusinessLogic() {
loadBusinessLogic();
- ensureAuthenticated();
executeBusinessLogic();
}
@@ -79,27 +78,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-axt/src/com/android/compatibility/common/util/DeviceConfigStateManager.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/DeviceConfigStateManager.java
index 104bd18..d97604d 100644
--- a/common/device-side/util-axt/src/com/android/compatibility/common/util/DeviceConfigStateManager.java
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/DeviceConfigStateManager.java
@@ -60,14 +60,16 @@
@Override
public void set(@Nullable String value) {
debug("set", value);
+ runWithShellPermissionIdentity(() -> setWithPermissionsGranted(value),
+ "android.permission.READ_DEVICE_CONFIG", "android.permission.WRITE_DEVICE_CONFIG");
+ }
+ private void setWithPermissionsGranted(@Nullable String value) {
final OneTimeDeviceConfigListener listener = new OneTimeDeviceConfigListener(mNamespace,
mKey);
DeviceConfig.addOnPropertyChangedListener(mNamespace, mContext.getMainExecutor(), listener);
- runWithShellPermissionIdentity(() -> DeviceConfig.setProperty(
- mNamespace, mKey, value, /* makeDefault= */ false),
- "android.permission.WRITE_DEVICE_CONFIG");
+ DeviceConfig.setProperty(mNamespace, mKey, value, /* makeDefault= */ false);
listener.assertCalled();
}
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
index e7ee499..d620219 100644
--- 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
@@ -16,17 +16,29 @@
package com.android.compatibility.common.util;
+import android.content.ContentResolver;
+import android.content.Context;
+import android.net.Uri;
import android.os.Environment;
+import android.os.ParcelFileDescriptor;
+import android.util.Log;
+
+import androidx.test.InstrumentationRegistry;
import org.xmlpull.v1.XmlPullParserException;
import java.io.File;
import java.io.IOException;
+import java.io.FileNotFoundException;
/**
* Load dynamic config for device side test cases
*/
public class DynamicConfigDeviceSide extends DynamicConfig {
+
+ public static final String CONTENT_PROVIDER =
+ String.format("%s://android.tradefed.contentprovider", ContentResolver.SCHEME_CONTENT);
+
public DynamicConfigDeviceSide(String moduleName) throws XmlPullParserException, IOException {
this(moduleName, new File(CONFIG_FOLDER_ON_DEVICE));
}
@@ -36,6 +48,21 @@
if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
throw new IOException("External storage is not mounted");
}
+ // Use the content provider to get the config:
+ String uriPath = String.format("%s/%s/%s.dynamic", CONTENT_PROVIDER, configFolder.getAbsolutePath(), moduleName);
+ Uri sdcardUri = Uri.parse(uriPath);
+ Context appContext = InstrumentationRegistry.getTargetContext();
+ try {
+ ContentResolver resolver = appContext.getContentResolver();
+ ParcelFileDescriptor descriptor = resolver.openFileDescriptor(sdcardUri,"r");
+
+ initializeConfig(new ParcelFileDescriptor.AutoCloseInputStream(descriptor));
+ return;
+ } catch (FileNotFoundException e) {
+ // Log the error and use the fallback too
+ Log.e("DynamicConfigDeviceSide", "Error while using content provider for config", e);
+ }
+ // Fallback to the direct search
File configFile = getConfigFile(configFolder, moduleName);
initializeConfig(configFile);
}
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
index 3ea6b63..16c42b2 100644
--- 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
@@ -709,6 +709,17 @@
format.setInteger(MediaFormat.KEY_BIT_RATE, bitrate);
}
+ public static boolean hasHardwareCodec(String mime, boolean encode) {
+ for (MediaCodecInfo info : sMCL.getCodecInfos()) {
+ if (info.isEncoder() == encode &&
+ info.isHardwareAccelerated() &&
+ info.getCapabilitiesForType(mime) != null) {
+ return true;
+ }
+ }
+ return false;
+ }
+
/*
* ------------------ HELPER METHODS FOR STATISTICS AND REPORTING ------------------
*/
diff --git a/common/device-side/util/src/com/android/compatibility/common/util/DeviceConfigStateManager.java b/common/device-side/util/src/com/android/compatibility/common/util/DeviceConfigStateManager.java
index 104bd18..d97604d 100644
--- a/common/device-side/util/src/com/android/compatibility/common/util/DeviceConfigStateManager.java
+++ b/common/device-side/util/src/com/android/compatibility/common/util/DeviceConfigStateManager.java
@@ -60,14 +60,16 @@
@Override
public void set(@Nullable String value) {
debug("set", value);
+ runWithShellPermissionIdentity(() -> setWithPermissionsGranted(value),
+ "android.permission.READ_DEVICE_CONFIG", "android.permission.WRITE_DEVICE_CONFIG");
+ }
+ private void setWithPermissionsGranted(@Nullable String value) {
final OneTimeDeviceConfigListener listener = new OneTimeDeviceConfigListener(mNamespace,
mKey);
DeviceConfig.addOnPropertyChangedListener(mNamespace, mContext.getMainExecutor(), listener);
- runWithShellPermissionIdentity(() -> DeviceConfig.setProperty(
- mNamespace, mKey, value, /* makeDefault= */ false),
- "android.permission.WRITE_DEVICE_CONFIG");
+ DeviceConfig.setProperty(mNamespace, mKey, value, /* makeDefault= */ false);
listener.assertCalled();
}
diff --git a/common/device-side/util/src/com/android/compatibility/common/util/DynamicConfigDeviceSide.java b/common/device-side/util/src/com/android/compatibility/common/util/DynamicConfigDeviceSide.java
index e7ee499..0e443fb 100644
--- a/common/device-side/util/src/com/android/compatibility/common/util/DynamicConfigDeviceSide.java
+++ b/common/device-side/util/src/com/android/compatibility/common/util/DynamicConfigDeviceSide.java
@@ -16,17 +16,29 @@
package com.android.compatibility.common.util;
+import android.content.ContentResolver;
+import android.content.Context;
+import android.net.Uri;
import android.os.Environment;
+import android.os.ParcelFileDescriptor;
+import android.util.Log;
+
+import android.support.test.InstrumentationRegistry;
import org.xmlpull.v1.XmlPullParserException;
import java.io.File;
import java.io.IOException;
+import java.io.FileNotFoundException;
/**
* Load dynamic config for device side test cases
*/
public class DynamicConfigDeviceSide extends DynamicConfig {
+
+ public static final String CONTENT_PROVIDER =
+ String.format("%s://android.tradefed.contentprovider", ContentResolver.SCHEME_CONTENT);
+
public DynamicConfigDeviceSide(String moduleName) throws XmlPullParserException, IOException {
this(moduleName, new File(CONFIG_FOLDER_ON_DEVICE));
}
@@ -36,6 +48,21 @@
if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
throw new IOException("External storage is not mounted");
}
+ // Use the content provider to get the config:
+ String uriPath = String.format("%s/%s/%s.dynamic", CONTENT_PROVIDER, configFolder.getAbsolutePath(), moduleName);
+ Uri sdcardUri = Uri.parse(uriPath);
+ Context appContext = InstrumentationRegistry.getTargetContext();
+ try {
+ ContentResolver resolver = appContext.getContentResolver();
+ ParcelFileDescriptor descriptor = resolver.openFileDescriptor(sdcardUri,"r");
+
+ initializeConfig(new ParcelFileDescriptor.AutoCloseInputStream(descriptor));
+ return;
+ } catch (FileNotFoundException e) {
+ // Log the error and use the fallback too
+ Log.e("DynamicConfigDeviceSide", "Error while using content provider for config", e);
+ }
+ // Fallback to the direct search
File configFile = getConfigFile(configFolder, moduleName);
initializeConfig(configFile);
}
diff --git a/hostsidetests/appsecurity/certs/Android.bp b/hostsidetests/appsecurity/certs/Android.bp
new file mode 100644
index 0000000..f856c5e
--- /dev/null
+++ b/hostsidetests/appsecurity/certs/Android.bp
@@ -0,0 +1,9 @@
+android_app_certificate {
+ name: "cts-testkey1",
+ certificate: "cts-testkey1",
+}
+
+android_app_certificate {
+ name: "cts-testkey2",
+ certificate: "cts-testkey2",
+}
diff --git a/hostsidetests/appsecurity/certs/keysets/Android.bp b/hostsidetests/appsecurity/certs/keysets/Android.bp
new file mode 100644
index 0000000..ad30099
--- /dev/null
+++ b/hostsidetests/appsecurity/certs/keysets/Android.bp
@@ -0,0 +1,19 @@
+android_app_certificate {
+ name: "cts-keyset-test-a",
+ certificate: "cts-keyset-test-a",
+}
+
+android_app_certificate {
+ name: "cts-keyset-test-b",
+ certificate: "cts-keyset-test-b",
+}
+
+android_app_certificate {
+ name: "cts-keyset-test-c",
+ certificate: "cts-keyset-test-c",
+}
+
+android_app_certificate {
+ name: "cts-keyset-test-ec-a",
+ certificate: "cts-keyset-test-ec-a",
+}
diff --git a/hostsidetests/appsecurity/test-apps/AccessSerialLegacy/Android.bp b/hostsidetests/appsecurity/test-apps/AccessSerialLegacy/Android.bp
new file mode 100644
index 0000000..806fb92
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/AccessSerialLegacy/Android.bp
@@ -0,0 +1,35 @@
+//
+// 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.
+//
+
+android_test {
+ name: "CtsAccessSerialLegacy",
+ defaults: ["cts_support_defaults"],
+ static_libs: ["androidx.test.rules"],
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+ min_sdk_version: "27",
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ optimize: {
+ enabled: false,
+ },
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/AccessSerialLegacy/Android.mk b/hostsidetests/appsecurity/test-apps/AccessSerialLegacy/Android.mk
deleted file mode 100644
index 1d46a1b..0000000
--- a/hostsidetests/appsecurity/test-apps/AccessSerialLegacy/Android.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_STATIC_JAVA_LIBRARIES := \
- androidx.test.rules \
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsAccessSerialLegacy
-LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 27
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/AccessSerialModern/Android.bp b/hostsidetests/appsecurity/test-apps/AccessSerialModern/Android.bp
new file mode 100644
index 0000000..1fc4ec4
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/AccessSerialModern/Android.bp
@@ -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.
+//
+
+android_test {
+ name: "CtsAccessSerialModern",
+ defaults: ["cts_support_defaults"],
+ static_libs: [
+ "compatibility-device-util-axt",
+ "androidx.test.rules",
+ ],
+ srcs: ["src/**/*.java"],
+ sdk_version: "test_current",
+ min_sdk_version: "27",
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ optimize: {
+ enabled: false,
+ },
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/AccessSerialModern/Android.mk b/hostsidetests/appsecurity/test-apps/AccessSerialModern/Android.mk
deleted file mode 100644
index ab52773..0000000
--- a/hostsidetests/appsecurity/test-apps/AccessSerialModern/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util-axt \
- androidx.test.rules \
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsAccessSerialModern
-LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 27
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/AppAccessData/Android.bp b/hostsidetests/appsecurity/test-apps/AppAccessData/Android.bp
new file mode 100644
index 0000000..734376b
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/AppAccessData/Android.bp
@@ -0,0 +1,33 @@
+// 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.
+
+android_test {
+ name: "CtsAppAccessData",
+ defaults: ["cts_support_defaults"],
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ libs: ["android.test.base.stubs"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ // although not strictly necessary, sign this app with different cert than CtsAppWithData
+ certificate: ":cts-testkey2",
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/AppAccessData/Android.mk b/hostsidetests/appsecurity/test-apps/AppAccessData/Android.mk
deleted file mode 100644
index b55656e..0000000
--- a/hostsidetests/appsecurity/test-apps/AppAccessData/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-# 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)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_PACKAGE_NAME := CtsAppAccessData
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-# although not strictly necessary, sign this app with different cert than CtsAppWithData
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey2
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/AppWithData/Android.bp b/hostsidetests/appsecurity/test-apps/AppWithData/Android.bp
new file mode 100644
index 0000000..7527463
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/AppWithData/Android.bp
@@ -0,0 +1,32 @@
+// 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.
+
+android_test {
+ name: "CtsAppWithData",
+ defaults: ["cts_support_defaults"],
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ libs: ["android.test.base.stubs"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ certificate: ":cts-testkey1",
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/AppWithData/Android.mk b/hostsidetests/appsecurity/test-apps/AppWithData/Android.mk
deleted file mode 100644
index 2966c48..0000000
--- a/hostsidetests/appsecurity/test-apps/AppWithData/Android.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_PACKAGE_NAME := CtsAppWithData
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/Android.bp b/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/Android.bp
new file mode 100644
index 0000000..14572b7
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/Android.bp
@@ -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.
+
+android_test {
+ name: "CtsApplicationVisibilityCrossUserApp",
+ defaults: ["cts_defaults"],
+ static_libs: ["androidx.test.rules"],
+ srcs: ["src/**/*.java"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ sdk_version: "test_current",
+}
diff --git a/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/Android.mk b/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/Android.mk
deleted file mode 100644
index d70de42..0000000
--- a/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/Android.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-# 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)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- androidx.test.rules
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsApplicationVisibilityCrossUserApp
-
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/DeclareNotRuntimePermissions/Android.bp b/hostsidetests/appsecurity/test-apps/DeclareNotRuntimePermissions/Android.bp
new file mode 100644
index 0000000..3426f22
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/DeclareNotRuntimePermissions/Android.bp
@@ -0,0 +1,29 @@
+//
+// 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.
+//
+
+android_test {
+ name: "CtsDeclareNonRuntimePermissions",
+ defaults: ["cts_support_defaults"],
+ sdk_version: "current",
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/DeclareNotRuntimePermissions/Android.mk b/hostsidetests/appsecurity/test-apps/DeclareNotRuntimePermissions/Android.mk
deleted file mode 100644
index 6af9e72..0000000
--- a/hostsidetests/appsecurity/test-apps/DeclareNotRuntimePermissions/Android.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_PACKAGE_NAME := CtsDeclareNonRuntimePermissions
-LOCAL_SDK_VERSION := current
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/DocumentClient/Android.bp b/hostsidetests/appsecurity/test-apps/DocumentClient/Android.bp
new file mode 100644
index 0000000..fcee875
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/DocumentClient/Android.bp
@@ -0,0 +1,45 @@
+//
+// 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.
+//
+
+android_test {
+ name: "CtsDocumentClient",
+ defaults: ["cts_support_defaults"],
+ sdk_version: "test_current",
+ static_libs: [
+ "androidx.test.rules",
+ "compatibility-device-util-axt",
+ "ctstestrunner-axt",
+ "ub-uiautomator",
+ ],
+ libs: [
+ "android.test.runner.stubs",
+ "android.test.base.stubs",
+ ],
+ srcs: ["src/**/*.java"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ certificate: ":cts-testkey2",
+ optimize: {
+ enabled: false,
+ },
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/DocumentClient/Android.mk b/hostsidetests/appsecurity/test-apps/DocumentClient/Android.mk
deleted file mode 100644
index 04e1870..0000000
--- a/hostsidetests/appsecurity/test-apps/DocumentClient/Android.mk
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# 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_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-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
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsDocumentClient
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey2
-
-LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/DocumentProvider/Android.bp b/hostsidetests/appsecurity/test-apps/DocumentProvider/Android.bp
new file mode 100644
index 0000000..eb4dbd3
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/DocumentProvider/Android.bp
@@ -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.
+//
+
+android_test {
+ name: "CtsDocumentProvider",
+ defaults: ["cts_support_defaults"],
+ sdk_version: "test_current",
+ static_libs: [
+ "androidx.test.rules",
+ "compatibility-device-util-axt",
+ "ctstestrunner-axt",
+ "ub-uiautomator",
+ ],
+ srcs: ["src/**/*.java"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ certificate: ":cts-testkey1",
+ optimize: {
+ enabled: false,
+ },
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/DocumentProvider/Android.mk b/hostsidetests/appsecurity/test-apps/DocumentProvider/Android.mk
deleted file mode 100644
index a4454666..0000000
--- a/hostsidetests/appsecurity/test-apps/DocumentProvider/Android.mk
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# 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_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := \
- androidx.test.rules \
- compatibility-device-util-axt \
- ctstestrunner-axt \
- ub-uiautomator \
-
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsDocumentProvider
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
-
-LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/Android.mk
deleted file mode 100644
index 2721a12..0000000
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/Android.mk
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-# Build the test APKs using their own makefiles
-include $(call all-makefiles-under,$(LOCAL_PATH))
-
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/Android.bp b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/Android.bp
new file mode 100644
index 0000000..c3feef4
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/Android.bp
@@ -0,0 +1,46 @@
+//
+// 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.
+//
+
+android_test {
+ name: "CtsEphemeralTestsEphemeralApp1",
+ defaults: ["cts_support_defaults"],
+ libs: [
+ "android.test.runner.stubs",
+ "android.test.base.stubs",
+ ],
+ static_libs: [
+ "cts-aia-util",
+ "androidx.test.rules",
+ "ctsdeviceutillegacy-axt",
+ "ctstestrunner-axt",
+ ],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ srcs: ["src/**/*.java"],
+ resource_dirs: ["res"],
+ platform_apis: true,
+ optimize: {
+ enabled: false,
+ },
+ dex_preopt: {
+ enabled: false,
+ },
+ min_sdk_version: "25",
+}
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/Android.mk
deleted file mode 100644
index 21b2c54..0000000
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/Android.mk
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-LOCAL_MODULE_TAGS := tests
-LOCAL_STATIC_JAVA_LIBRARIES := \
- cts-aia-util \
- androidx.test.rules \
- ctsdeviceutillegacy-axt \
- ctstestrunner-axt
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-
-LOCAL_PACKAGE_NAME := CtsEphemeralTestsEphemeralApp1
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_DEX_PREOPT := false
-
-LOCAL_MIN_SDK_VERSION := 25
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp2/Android.bp b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp2/Android.bp
new file mode 100644
index 0000000..7cae048
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp2/Android.bp
@@ -0,0 +1,46 @@
+//
+// 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.
+//
+
+android_test {
+ name: "CtsEphemeralTestsEphemeralApp2",
+ defaults: ["cts_support_defaults"],
+ libs: [
+ "android.test.runner.stubs",
+ "android.test.base.stubs",
+ ],
+ static_libs: [
+ "cts-aia-util",
+ "androidx.test.rules",
+ "ctsdeviceutillegacy-axt",
+ "ctstestrunner-axt",
+ ],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ srcs: ["src/**/*.java"],
+ resource_dirs: ["res"],
+ sdk_version: "test_current",
+ min_sdk_version: "24",
+ optimize: {
+ enabled: false,
+ },
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp2/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp2/Android.mk
deleted file mode 100644
index fc31f57..0000000
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp2/Android.mk
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-LOCAL_MODULE_TAGS := tests
-LOCAL_STATIC_JAVA_LIBRARIES := \
- cts-aia-util \
- androidx.test.rules \
- ctsdeviceutillegacy-axt \
- ctstestrunner-axt
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-
-LOCAL_PACKAGE_NAME := CtsEphemeralTestsEphemeralApp2
-LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 24
-
-LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
-
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/ImplicitlyExposedApp/Android.bp b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/ImplicitlyExposedApp/Android.bp
new file mode 100644
index 0000000..919473b
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/ImplicitlyExposedApp/Android.bp
@@ -0,0 +1,40 @@
+//
+// 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.
+//
+
+android_test {
+ name: "CtsEphemeralTestsImplicitApp",
+ defaults: ["cts_support_defaults"],
+ static_libs: [
+ "cts-aia-util",
+ "androidx.test.rules",
+ ],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ srcs: ["src/**/*.java"],
+ resource_dirs: ["res"],
+ sdk_version: "current",
+ min_sdk_version: "24",
+ optimize: {
+ enabled: false,
+ },
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/ImplicitlyExposedApp/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/ImplicitlyExposedApp/Android.mk
deleted file mode 100644
index b939ff7..0000000
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/ImplicitlyExposedApp/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_STATIC_JAVA_LIBRARIES := \
- cts-aia-util \
- androidx.test.rules
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-
-LOCAL_PACKAGE_NAME := CtsEphemeralTestsImplicitApp
-LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 24
-
-LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/Android.bp b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/Android.bp
new file mode 100644
index 0000000..21a435d
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/Android.bp
@@ -0,0 +1,41 @@
+//
+// 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.
+//
+
+android_test {
+ name: "CtsEphemeralTestsNormalApp",
+ defaults: ["cts_support_defaults"],
+ static_libs: [
+ "cts-aia-util",
+ "androidx.test.rules",
+ ],
+ libs: ["android.test.base.stubs"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ srcs: ["src/**/*.java"],
+ resource_dirs: ["res"],
+ sdk_version: "system_current",
+ min_sdk_version: "24",
+ optimize: {
+ enabled: false,
+ },
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/Android.mk
deleted file mode 100644
index 6a699b7..0000000
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/Android.mk
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_STATIC_JAVA_LIBRARIES := \
- cts-aia-util \
- androidx.test.rules
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-
-LOCAL_PACKAGE_NAME := CtsEphemeralTestsNormalApp
-LOCAL_SDK_VERSION := system_current
-LOCAL_MIN_SDK_VERSION := 24
-
-LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UnexposedApp/Android.bp b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UnexposedApp/Android.bp
new file mode 100644
index 0000000..b87b89f
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UnexposedApp/Android.bp
@@ -0,0 +1,35 @@
+//
+// 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.
+//
+
+android_test {
+ name: "CtsEphemeralTestsUnexposedApp",
+ defaults: ["cts_support_defaults"],
+ static_libs: ["androidx.test.rules"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ resource_dirs: ["res"],
+ sdk_version: "current",
+ optimize: {
+ enabled: false,
+ },
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UnexposedApp/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UnexposedApp/Android.mk
deleted file mode 100644
index d8e9234..0000000
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UnexposedApp/Android.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-#
-# 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-
-LOCAL_PACKAGE_NAME := CtsEphemeralTestsUnexposedApp
-LOCAL_SDK_VERSION := current
-
-LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
-
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserApp/Android.bp b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserApp/Android.bp
new file mode 100644
index 0000000..ff376bc
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserApp/Android.bp
@@ -0,0 +1,39 @@
+//
+// 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.
+//
+
+android_test {
+ name: "CtsEphemeralTestsUserApp",
+ defaults: ["cts_support_defaults"],
+ static_libs: [
+ "cts-aia-util",
+ "androidx.test.rules",
+ ],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ srcs: ["src/**/*.java"],
+ resource_dirs: ["res"],
+ sdk_version: "current",
+ optimize: {
+ enabled: false,
+ },
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserApp/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserApp/Android.mk
deleted file mode 100644
index 6d58891..0000000
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserApp/Android.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_STATIC_JAVA_LIBRARIES := \
- cts-aia-util \
- androidx.test.rules
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-
-LOCAL_PACKAGE_NAME := CtsEphemeralTestsUserApp
-LOCAL_SDK_VERSION := current
-
-LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/Android.bp b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/Android.bp
new file mode 100644
index 0000000..4159be8
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/Android.bp
@@ -0,0 +1,36 @@
+//
+// 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.
+//
+
+android_test {
+ name: "CtsEphemeralTestsUserAppTest",
+ defaults: ["cts_support_defaults"],
+ static_libs: ["androidx.test.rules"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ srcs: ["src/**/*.java"],
+ resource_dirs: ["res"],
+ sdk_version: "current",
+ optimize: {
+ enabled: false,
+ },
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/Android.mk
deleted file mode 100644
index afb016c..0000000
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/Android.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_STATIC_JAVA_LIBRARIES := \
- androidx.test.rules
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-
-LOCAL_PACKAGE_NAME := CtsEphemeralTestsUserAppTest
-LOCAL_SDK_VERSION := current
-
-LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/util/Android.bp b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/util/Android.bp
new file mode 100644
index 0000000..0bba5ef
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/util/Android.bp
@@ -0,0 +1,19 @@
+// 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.
+
+java_test {
+ name: "cts-aia-util",
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+}
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/util/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/util/Android.mk
deleted file mode 100644
index df29c03..0000000
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/util/Android.mk
+++ /dev/null
@@ -1,29 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := \
- $(call all-java-files-under, src)
-
-LOCAL_MODULE := cts-aia-util
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
diff --git a/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/Android.bp b/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/Android.bp
new file mode 100644
index 0000000..355fe26
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/Android.bp
@@ -0,0 +1,34 @@
+//
+// 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.
+//
+
+android_test {
+ name: "CtsEscalateToRuntimePermissions",
+ defaults: ["cts_support_defaults"],
+ static_libs: ["androidx.test.rules"],
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ optimize: {
+ enabled: false,
+ },
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/Android.mk b/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/Android.mk
deleted file mode 100644
index c82648c..0000000
--- a/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/Android.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsEscalateToRuntimePermissions
-LOCAL_SDK_VERSION := current
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/ExternalStorageApp/Android.bp b/hostsidetests/appsecurity/test-apps/ExternalStorageApp/Android.bp
new file mode 100644
index 0000000..e214221
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/ExternalStorageApp/Android.bp
@@ -0,0 +1,43 @@
+// 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.
+
+android_test {
+ name: "CtsExternalStorageApp",
+ defaults: ["cts_support_defaults"],
+ sdk_version: "current",
+ static_libs: [
+ "androidx.test.rules",
+ "CtsExternalStorageTestLib",
+ ],
+ libs: ["android.test.base.stubs"],
+ srcs: ["src/**/*.java"],
+ exclude_srcs: ["src/com/android/cts/externalstorageapp/CommonExternalStorageTest.java"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ dex_preopt: {
+ enabled: false,
+ },
+}
+
+java_library {
+ name: "CtsExternalStorageTestLib",
+ srcs: ["src/com/android/cts/externalstorageapp/CommonExternalStorageTest.java"],
+ defaults: ["cts_support_defaults"],
+ sdk_version: "current",
+ libs: ["android.test.base.stubs"],
+}
diff --git a/hostsidetests/appsecurity/test-apps/ExternalStorageApp/Android.mk b/hostsidetests/appsecurity/test-apps/ExternalStorageApp/Android.mk
deleted file mode 100644
index 0b232fb..0000000
--- a/hostsidetests/appsecurity/test-apps/ExternalStorageApp/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_PACKAGE_NAME := CtsExternalStorageApp
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/InstantCookieApp/Android.bp b/hostsidetests/appsecurity/test-apps/InstantCookieApp/Android.bp
new file mode 100644
index 0000000..88f4bb7
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/InstantCookieApp/Android.bp
@@ -0,0 +1,35 @@
+//
+// 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.
+//
+
+android_test {
+ name: "CtsInstantCookieApp",
+ defaults: ["cts_support_defaults"],
+ srcs: ["src/**/*.java"],
+ static_libs: ["androidx.test.rules"],
+ sdk_version: "current",
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ certificate: ":cts-keyset-test-a",
+ optimize: {
+ enabled: false,
+ },
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/InstantCookieApp/Android.mk b/hostsidetests/appsecurity/test-apps/InstantCookieApp/Android.mk
deleted file mode 100644
index b113f8f..0000000
--- a/hostsidetests/appsecurity/test-apps/InstantCookieApp/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-#
-# 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_PACKAGE_NAME := CtsInstantCookieApp
-LOCAL_SDK_VERSION := current
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/InstantCookieApp2/Android.bp b/hostsidetests/appsecurity/test-apps/InstantCookieApp2/Android.bp
new file mode 100644
index 0000000..8010dff
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/InstantCookieApp2/Android.bp
@@ -0,0 +1,36 @@
+//
+// 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.
+//
+
+android_test {
+ name: "CtsInstantCookieApp2",
+ defaults: ["cts_support_defaults"],
+ srcs: ["src/**/*.java"],
+ static_libs: ["androidx.test.rules"],
+ sdk_version: "current",
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ certificate: ":cts-keyset-test-b",
+ additional_certificates: [":cts-keyset-test-a"],
+ optimize: {
+ enabled: false,
+ },
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/InstantCookieApp2/Android.mk b/hostsidetests/appsecurity/test-apps/InstantCookieApp2/Android.mk
deleted file mode 100644
index 7c1d7095..0000000
--- a/hostsidetests/appsecurity/test-apps/InstantCookieApp2/Android.mk
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_PACKAGE_NAME := CtsInstantCookieApp2
-LOCAL_SDK_VERSION := current
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
-
-LOCAL_ADDITIONAL_CERTIFICATES := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/Android.bp b/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/Android.bp
new file mode 100644
index 0000000..677b990
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/Android.bp
@@ -0,0 +1,45 @@
+//
+// 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.
+//
+
+android_test {
+ name: "CtsInstantUpgradeApp",
+ defaults: ["cts_support_defaults"],
+ libs: [
+ "android.test.runner.stubs",
+ "android.test.base.stubs",
+ ],
+ static_libs: [
+ "cts-aia-util",
+ "androidx.test.rules",
+ "ctsdeviceutillegacy-axt",
+ "ctstestrunner-axt",
+ ],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ srcs: ["src/**/*.java"],
+ platform_apis: true,
+ optimize: {
+ enabled: false,
+ },
+ dex_preopt: {
+ enabled: false,
+ },
+ min_sdk_version: "25",
+}
diff --git a/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/Android.mk b/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/Android.mk
deleted file mode 100644
index 646e7bb..0000000
--- a/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/Android.mk
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-# 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_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-LOCAL_MODULE_TAGS := tests
-LOCAL_STATIC_JAVA_LIBRARIES := \
- cts-aia-util \
- androidx.test.rules \
- ctsdeviceutillegacy-axt \
- ctstestrunner-axt
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsInstantUpgradeApp
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_DEX_PREOPT := false
-
-LOCAL_MIN_SDK_VERSION := 25
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/InstrumentationAppDiffCert/Android.bp b/hostsidetests/appsecurity/test-apps/InstrumentationAppDiffCert/Android.bp
new file mode 100644
index 0000000..2a8b244
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/InstrumentationAppDiffCert/Android.bp
@@ -0,0 +1,33 @@
+// 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.
+
+android_test {
+ name: "CtsInstrumentationAppDiffCert",
+ defaults: ["cts_support_defaults"],
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ libs: ["android.test.base.stubs"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ // sign this app with different cert than CtsTargetInstrumentationApp
+ certificate: ":cts-testkey2",
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/InstrumentationAppDiffCert/Android.mk b/hostsidetests/appsecurity/test-apps/InstrumentationAppDiffCert/Android.mk
deleted file mode 100644
index a977416..0000000
--- a/hostsidetests/appsecurity/test-apps/InstrumentationAppDiffCert/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-# 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)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_PACKAGE_NAME := CtsInstrumentationAppDiffCert
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-# sign this app with different cert than CtsTargetInstrumentationApp
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey2
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Android.mk b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Android.mk
deleted file mode 100644
index 6047ca5..0000000
--- a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Android.mk
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-include $(call first-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000000000ffff/Android.bp b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000000000ffff/Android.bp
new file mode 100644
index 0000000..10d6066
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000000000ffff/Android.bp
@@ -0,0 +1,35 @@
+// 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.
+
+android_test {
+ name: "CtsMajorVersion000000000000ffff",
+ defaults: ["cts_support_defaults"],
+ srcs: [
+ "src/**/*.java",
+ ":CtsMajorVersionCommon",
+ ],
+ static_libs: ["androidx.test.rules"],
+ sdk_version: "current",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ // sign this app with a different cert than CtsSimpleAppInstallDiffCert
+ certificate: ":cts-testkey1",
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000000000ffff/Android.mk b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000000000ffff/Android.mk
deleted file mode 100644
index a064696..0000000
--- a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000000000ffff/Android.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src-common) $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := CtsMajorVersion000000000000ffff
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-# sign this app with a different cert than CtsSimpleAppInstallDiffCert
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version00000000ffffffff/Android.bp b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version00000000ffffffff/Android.bp
new file mode 100644
index 0000000..088a757
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version00000000ffffffff/Android.bp
@@ -0,0 +1,35 @@
+// 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.
+
+android_test {
+ name: "CtsMajorVersion00000000ffffffff",
+ defaults: ["cts_support_defaults"],
+ srcs: [
+ "src/**/*.java",
+ ":CtsMajorVersionCommon",
+ ],
+ static_libs: ["androidx.test.rules"],
+ sdk_version: "current",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ // sign this app with a different cert than CtsSimpleAppInstallDiffCert
+ certificate: ":cts-testkey1",
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version00000000ffffffff/Android.mk b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version00000000ffffffff/Android.mk
deleted file mode 100644
index b5e5ceb..0000000
--- a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version00000000ffffffff/Android.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src-common) $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := CtsMajorVersion00000000ffffffff
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-# sign this app with a different cert than CtsSimpleAppInstallDiffCert
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ff00000000/Android.bp b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ff00000000/Android.bp
new file mode 100644
index 0000000..3df84e4
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ff00000000/Android.bp
@@ -0,0 +1,35 @@
+// 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.
+
+android_test {
+ name: "CtsMajorVersion000000ff00000000",
+ defaults: ["cts_support_defaults"],
+ srcs: [
+ "src/**/*.java",
+ ":CtsMajorVersionCommon",
+ ],
+ static_libs: ["androidx.test.rules"],
+ sdk_version: "current",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ // sign this app with a different cert than CtsSimpleAppInstallDiffCert
+ certificate: ":cts-testkey1",
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ff00000000/Android.mk b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ff00000000/Android.mk
deleted file mode 100644
index d6117a9..0000000
--- a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ff00000000/Android.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src-common) $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := CtsMajorVersion000000ff00000000
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-# sign this app with a different cert than CtsSimpleAppInstallDiffCert
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ffffffffff/Android.bp b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ffffffffff/Android.bp
new file mode 100644
index 0000000..7ba4d73
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ffffffffff/Android.bp
@@ -0,0 +1,35 @@
+// 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.
+
+android_test {
+ name: "CtsMajorVersion000000ffffffffff",
+ defaults: ["cts_support_defaults"],
+ srcs: [
+ "src/**/*.java",
+ ":CtsMajorVersionCommon",
+ ],
+ static_libs: ["androidx.test.rules"],
+ sdk_version: "current",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ // sign this app with a different cert than CtsSimpleAppInstallDiffCert
+ certificate: ":cts-testkey1",
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ffffffffff/Android.mk b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ffffffffff/Android.mk
deleted file mode 100644
index 0f80843..0000000
--- a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ffffffffff/Android.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src-common) $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_PACKAGE_NAME := CtsMajorVersion000000ffffffffff
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-# sign this app with a different cert than CtsSimpleAppInstallDiffCert
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/MajorVersionApp/src-common/Android.bp b/hostsidetests/appsecurity/test-apps/MajorVersionApp/src-common/Android.bp
new file mode 100644
index 0000000..fa94e20
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/MajorVersionApp/src-common/Android.bp
@@ -0,0 +1,4 @@
+filegroup {
+ name: "CtsMajorVersionCommon",
+ srcs: ["**/*.java"],
+}
diff --git a/hostsidetests/appsecurity/test-apps/MultiUserStorageApp/Android.bp b/hostsidetests/appsecurity/test-apps/MultiUserStorageApp/Android.bp
new file mode 100644
index 0000000..7dfd802
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/MultiUserStorageApp/Android.bp
@@ -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.
+
+android_test {
+ name: "CtsMultiUserStorageApp",
+ defaults: ["cts_support_defaults"],
+ sdk_version: "current",
+ static_libs: [
+ "androidx.test.rules",
+ "CtsExternalStorageTestLib",
+ ],
+ libs: ["android.test.base.stubs"],
+ srcs: [
+ "src/**/*.java",
+ ],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/MultiUserStorageApp/Android.mk b/hostsidetests/appsecurity/test-apps/MultiUserStorageApp/Android.mk
deleted file mode 100644
index a5807f0..0000000
--- a/hostsidetests/appsecurity/test-apps/MultiUserStorageApp/Android.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
- ../ExternalStorageApp/src/com/android/cts/externalstorageapp/CommonExternalStorageTest.java
-
-LOCAL_PACKAGE_NAME := CtsMultiUserStorageApp
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/OrderedActivityApp/Android.bp b/hostsidetests/appsecurity/test-apps/OrderedActivityApp/Android.bp
new file mode 100644
index 0000000..92b45ec
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/OrderedActivityApp/Android.bp
@@ -0,0 +1,33 @@
+// 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.
+
+android_test {
+ name: "CtsOrderedActivityApp",
+ defaults: ["cts_support_defaults"],
+ static_libs: ["androidx.test.rules"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+ optimize: {
+ enabled: false,
+ },
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/OrderedActivityApp/Android.mk b/hostsidetests/appsecurity/test-apps/OrderedActivityApp/Android.mk
deleted file mode 100644
index dbe224b..0000000
--- a/hostsidetests/appsecurity/test-apps/OrderedActivityApp/Android.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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_STATIC_JAVA_LIBRARIES := androidx.test.rules
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_SDK_VERSION := current
-LOCAL_PACKAGE_NAME := CtsOrderedActivityApp
-LOCAL_PROGUARD_ENABLED := disabled
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/OverlayApp/Android.bp b/hostsidetests/appsecurity/test-apps/OverlayApp/Android.bp
new file mode 100644
index 0000000..20203bf
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/OverlayApp/Android.bp
@@ -0,0 +1,26 @@
+//
+// 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.
+//
+
+android_test {
+ name: "CtsOverlayApp",
+ defaults: ["cts_support_defaults"],
+ sdk_version: "current",
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
diff --git a/hostsidetests/appsecurity/test-apps/OverlayApp/Android.mk b/hostsidetests/appsecurity/test-apps/OverlayApp/Android.mk
deleted file mode 100644
index 21366a5..0000000
--- a/hostsidetests/appsecurity/test-apps/OverlayApp/Android.mk
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-LOCAL_PACKAGE_NAME := CtsOverlayApp
-
-# Tag this module as a cts test artifact
-include $(BUILD_CTS_SUPPORT_PACKAGE)
-
diff --git a/hostsidetests/appsecurity/test-apps/PackageAccessApp/Android.bp b/hostsidetests/appsecurity/test-apps/PackageAccessApp/Android.bp
new file mode 100644
index 0000000..01c36f3
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/PackageAccessApp/Android.bp
@@ -0,0 +1,30 @@
+// 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.
+
+android_test {
+ name: "CtsPkgAccessApp",
+ defaults: ["cts_defaults"],
+ static_libs: [
+ "androidx.test.rules",
+ "ub-uiautomator",
+ ],
+ srcs: ["src/**/*.java"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ sdk_version: "test_current",
+}
diff --git a/hostsidetests/appsecurity/test-apps/PackageAccessApp/Android.mk b/hostsidetests/appsecurity/test-apps/PackageAccessApp/Android.mk
deleted file mode 100644
index e2f9e12..0000000
--- a/hostsidetests/appsecurity/test-apps/PackageAccessApp/Android.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- androidx.test.rules \
- ub-uiautomator
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsPkgAccessApp
-
-LOCAL_SDK_VERSION := test_current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/PermissionDeclareApp/Android.bp b/hostsidetests/appsecurity/test-apps/PermissionDeclareApp/Android.bp
new file mode 100644
index 0000000..b52a0b0
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/PermissionDeclareApp/Android.bp
@@ -0,0 +1,32 @@
+// 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.
+
+android_test {
+ name: "CtsPermissionDeclareApp",
+ defaults: ["cts_support_defaults"],
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ // sign this app with a different cert than CtsUsePermissionDiffCert
+ certificate: ":cts-testkey1",
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/PermissionDeclareApp/Android.mk b/hostsidetests/appsecurity/test-apps/PermissionDeclareApp/Android.mk
deleted file mode 100644
index 8521093..0000000
--- a/hostsidetests/appsecurity/test-apps/PermissionDeclareApp/Android.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-# 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)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_PACKAGE_NAME := CtsPermissionDeclareApp
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-# sign this app with a different cert than CtsUsePermissionDiffCert
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/PermissionDeclareAppCompat/Android.bp b/hostsidetests/appsecurity/test-apps/PermissionDeclareAppCompat/Android.bp
new file mode 100644
index 0000000..2a86949
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/PermissionDeclareAppCompat/Android.bp
@@ -0,0 +1,32 @@
+// 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.
+
+android_test {
+ name: "CtsPermissionDeclareAppCompat",
+ defaults: ["cts_support_defaults"],
+ srcs: ["src/**/*.java"],
+ sdk_version: "16",
+ static_libs: ["androidx.test.rules"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ // sign this app with a different cert than CtsUsePermissionDiffCert
+ certificate: ":cts-testkey1",
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/PermissionDeclareAppCompat/Android.mk b/hostsidetests/appsecurity/test-apps/PermissionDeclareAppCompat/Android.mk
deleted file mode 100644
index 5f48099..0000000
--- a/hostsidetests/appsecurity/test-apps/PermissionDeclareAppCompat/Android.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := 16
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_PACKAGE_NAME := CtsPermissionDeclareAppCompat
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-# sign this app with a different cert than CtsUsePermissionDiffCert
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/PermissionPolicy25/Android.bp b/hostsidetests/appsecurity/test-apps/PermissionPolicy25/Android.bp
new file mode 100644
index 0000000..d2cfed1
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/PermissionPolicy25/Android.bp
@@ -0,0 +1,39 @@
+//
+// 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.
+//
+
+android_test {
+ name: "CtsPermissionPolicyTest25",
+ defaults: ["cts_support_defaults"],
+ static_libs: [
+ "androidx.test.rules",
+ "compatibility-device-util-axt",
+ "ctstestrunner-axt",
+ ],
+ srcs: ["src/**/*.java"],
+ sdk_version: "test_current",
+ min_sdk_version: "25",
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ optimize: {
+ enabled: false,
+ },
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/PermissionPolicy25/Android.mk b/hostsidetests/appsecurity/test-apps/PermissionPolicy25/Android.mk
deleted file mode 100644
index a0c6e33..0000000
--- a/hostsidetests/appsecurity/test-apps/PermissionPolicy25/Android.mk
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# 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.
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- androidx.test.rules \
- compatibility-device-util-axt \
- ctstestrunner-axt \
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsPermissionPolicyTest25
-LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 25
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/Android.bp b/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/Android.bp
new file mode 100644
index 0000000..bec00bd
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/Android.bp
@@ -0,0 +1,39 @@
+// 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.
+
+android_test {
+ name: "CtsReadExternalStorageApp",
+ defaults: ["cts_support_defaults"],
+ sdk_version: "current",
+ static_libs: [
+ "androidx.test.rules",
+ "CtsExternalStorageTestLib",
+ ],
+ libs: [
+ "android.test.runner.stubs",
+ "android.test.base.stubs",
+ ],
+ srcs: [
+ "src/**/*.java",
+ ],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/Android.mk b/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/Android.mk
deleted file mode 100644
index 1ecc5a4..0000000
--- a/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/Android.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
- ../ExternalStorageApp/src/com/android/cts/externalstorageapp/CommonExternalStorageTest.java
-
-LOCAL_PACKAGE_NAME := CtsReadExternalStorageApp
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/SharedUidInstall/Android.bp b/hostsidetests/appsecurity/test-apps/SharedUidInstall/Android.bp
new file mode 100644
index 0000000..12c97ad
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/SharedUidInstall/Android.bp
@@ -0,0 +1,35 @@
+// 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.
+
+android_test {
+ name: "CtsSharedUidInstall",
+ defaults: ["cts_support_defaults"],
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ // sign this app with a different cert than CtsSharedUidInstallDiffCert
+ certificate: ":cts-testkey1",
+ optimize: {
+ enabled: false,
+ },
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/SharedUidInstall/Android.mk b/hostsidetests/appsecurity/test-apps/SharedUidInstall/Android.mk
deleted file mode 100644
index 331dc2e..0000000
--- a/hostsidetests/appsecurity/test-apps/SharedUidInstall/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-# 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)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_PACKAGE_NAME := CtsSharedUidInstall
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-# sign this app with a different cert than CtsSharedUidInstallDiffCert
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/SharedUidInstallDiffCert/Android.bp b/hostsidetests/appsecurity/test-apps/SharedUidInstallDiffCert/Android.bp
new file mode 100644
index 0000000..ad3fa30
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/SharedUidInstallDiffCert/Android.bp
@@ -0,0 +1,32 @@
+// 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.
+
+android_test {
+ name: "CtsSharedUidInstallDiffCert",
+ defaults: ["cts_support_defaults"],
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ // sign this app with a different cert than CtsSharedUidInstall
+ certificate: ":cts-testkey2",
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/SharedUidInstallDiffCert/Android.mk b/hostsidetests/appsecurity/test-apps/SharedUidInstallDiffCert/Android.mk
deleted file mode 100644
index 9dc335e..0000000
--- a/hostsidetests/appsecurity/test-apps/SharedUidInstallDiffCert/Android.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-# 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)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_PACKAGE_NAME := CtsSharedUidInstallDiffCert
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-# sign this app with a different cert than CtsSharedUidInstall
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey2
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/SimpleAppInstall/Android.bp b/hostsidetests/appsecurity/test-apps/SimpleAppInstall/Android.bp
new file mode 100644
index 0000000..ff13923
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/SimpleAppInstall/Android.bp
@@ -0,0 +1,32 @@
+// 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.
+
+android_test {
+ name: "CtsSimpleAppInstall",
+ defaults: ["cts_support_defaults"],
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ // sign this app with a different cert than CtsSimpleAppInstallDiffCert
+ certificate: ":cts-testkey1",
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/SimpleAppInstall/Android.mk b/hostsidetests/appsecurity/test-apps/SimpleAppInstall/Android.mk
deleted file mode 100644
index 13a0b63..0000000
--- a/hostsidetests/appsecurity/test-apps/SimpleAppInstall/Android.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-# 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)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_PACKAGE_NAME := CtsSimpleAppInstall
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-# sign this app with a different cert than CtsSimpleAppInstallDiffCert
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/SimpleAppInstallDiffCert/Android.bp b/hostsidetests/appsecurity/test-apps/SimpleAppInstallDiffCert/Android.bp
new file mode 100644
index 0000000..a427def
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/SimpleAppInstallDiffCert/Android.bp
@@ -0,0 +1,32 @@
+// 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.
+
+android_test {
+ name: "CtsSimpleAppInstallDiffCert",
+ defaults: ["cts_support_defaults"],
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ // sign this app with a different cert than CtsSimpleAppInstall
+ certificate: ":cts-testkey2",
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/SimpleAppInstallDiffCert/Android.mk b/hostsidetests/appsecurity/test-apps/SimpleAppInstallDiffCert/Android.mk
deleted file mode 100644
index 21e83c2..0000000
--- a/hostsidetests/appsecurity/test-apps/SimpleAppInstallDiffCert/Android.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-# 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)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_PACKAGE_NAME := CtsSimpleAppInstallDiffCert
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-# sign this app with a different cert than CtsSimpleAppInstall
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey2
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/StorageApp/Android.bp b/hostsidetests/appsecurity/test-apps/StorageApp/Android.bp
new file mode 100644
index 0000000..2d916f2
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/StorageApp/Android.bp
@@ -0,0 +1,10 @@
+java_library {
+ name: "CtsStorageAppLib",
+ srcs: ["src/**/*.java"],
+ defaults: ["cts_support_defaults"],
+ sdk_version: "test_current",
+ libs: [
+ "android.test.base.stubs",
+ "ub-uiautomator",
+ ],
+}
diff --git a/hostsidetests/appsecurity/test-apps/StorageStatsApp/Android.bp b/hostsidetests/appsecurity/test-apps/StorageStatsApp/Android.bp
new file mode 100644
index 0000000..8414a8d
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/StorageStatsApp/Android.bp
@@ -0,0 +1,36 @@
+// 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.
+
+android_test {
+ name: "CtsStorageStatsApp",
+ defaults: ["cts_support_defaults"],
+ sdk_version: "test_current",
+ static_libs: [
+ "androidx.test.rules",
+ "ub-uiautomator",
+ "CtsStorageAppLib",
+ ],
+ libs: ["android.test.base.stubs"],
+ srcs: [
+ "src/**/*.java",
+ ],
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/StorageStatsApp/Android.mk b/hostsidetests/appsecurity/test-apps/StorageStatsApp/Android.mk
deleted file mode 100644
index 2e9f00e..0000000
--- a/hostsidetests/appsecurity/test-apps/StorageStatsApp/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := test_current
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules ub-uiautomator
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
- $(call all-java-files-under, ../StorageApp/src)
-
-LOCAL_PACKAGE_NAME := CtsStorageStatsApp
-
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/TargetInstrumentationApp/Android.bp b/hostsidetests/appsecurity/test-apps/TargetInstrumentationApp/Android.bp
new file mode 100644
index 0000000..42f7d09
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/TargetInstrumentationApp/Android.bp
@@ -0,0 +1,32 @@
+// 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.
+
+android_test {
+ name: "CtsTargetInstrumentationApp",
+ defaults: ["cts_support_defaults"],
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ // sign this app with different cert than CtsInstrumentationAppDiffCert
+ certificate: ":cts-testkey1",
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/TargetInstrumentationApp/Android.mk b/hostsidetests/appsecurity/test-apps/TargetInstrumentationApp/Android.mk
deleted file mode 100644
index 49bb31a..0000000
--- a/hostsidetests/appsecurity/test-apps/TargetInstrumentationApp/Android.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-# 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)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_PACKAGE_NAME := CtsTargetInstrumentationApp
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-# sign this app with different cert than CtsInstrumentationAppDiffCert
-LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/cts-testkey1
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/V3SigningSchemeRotation/Android.bp b/hostsidetests/appsecurity/test-apps/V3SigningSchemeRotation/Android.bp
new file mode 100644
index 0000000..f2e6872
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/V3SigningSchemeRotation/Android.bp
@@ -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.
+
+android_test {
+ name: "CtsV3SigningSchemeRotationTest",
+ defaults: ["cts_support_defaults"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ libs: ["android.test.base.stubs"],
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/V3SigningSchemeRotation/Android.mk b/hostsidetests/appsecurity/test-apps/V3SigningSchemeRotation/Android.mk
deleted file mode 100644
index 356f296..0000000
--- a/hostsidetests/appsecurity/test-apps/V3SigningSchemeRotation/Android.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-LOCAL_PACKAGE_NAME := CtsV3SigningSchemeRotationTest
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/keysets/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/Android.mk
deleted file mode 100644
index 397b49a..0000000
--- a/hostsidetests/appsecurity/test-apps/keysets/Android.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-# 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)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-# Build the test APKs using their own makefiles
-include $(call all-makefiles-under,$(LOCAL_PATH))
-
diff --git a/hostsidetests/appsecurity/test-apps/keysets/malBadKey/Android.bp b/hostsidetests/appsecurity/test-apps/keysets/malBadKey/Android.bp
new file mode 100644
index 0000000..46398f7
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/keysets/malBadKey/Android.bp
@@ -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.
+
+//apks signed cts-keyset-test-a
+android_test {
+ name: "CtsKeySetSigningABadUpgradeB",
+ defaults: ["cts_support_defaults"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ certificate: ":cts-keyset-test-a",
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/keysets/malBadKey/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/malBadKey/Android.mk
deleted file mode 100644
index 8e05b63..0000000
--- a/hostsidetests/appsecurity/test-apps/keysets/malBadKey/Android.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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)
-
-#apks signed cts-keyset-test-a
-include $(CLEAR_VARS)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-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
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/keysets/malNoDef/Android.bp b/hostsidetests/appsecurity/test-apps/keysets/malNoDef/Android.bp
new file mode 100644
index 0000000..7c1bfc2
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/keysets/malNoDef/Android.bp
@@ -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.
+
+//apks signed cts-keyset-test-a
+android_test {
+ name: "CtsKeySetSigningANoDefUpgradeB",
+ defaults: ["cts_support_defaults"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ certificate: ":cts-keyset-test-a",
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/keysets/malNoDef/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/malNoDef/Android.mk
deleted file mode 100644
index a5db503..0000000
--- a/hostsidetests/appsecurity/test-apps/keysets/malNoDef/Android.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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)
-
-#apks signed cts-keyset-test-a
-include $(CLEAR_VARS)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-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
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/keysets/malOneDef/Android.bp b/hostsidetests/appsecurity/test-apps/keysets/malOneDef/Android.bp
new file mode 100644
index 0000000..955ba35
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/keysets/malOneDef/Android.bp
@@ -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.
+
+//apks signed cts-keyset-test-a
+android_test {
+ name: "CtsKeySetSigningCBadAUpgradeAB",
+ defaults: ["cts_support_defaults"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ certificate: ":cts-keyset-test-c",
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/keysets/malOneDef/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/malOneDef/Android.mk
deleted file mode 100644
index 4e4ee5c..0000000
--- a/hostsidetests/appsecurity/test-apps/keysets/malOneDef/Android.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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)
-
-#apks signed cts-keyset-test-a
-include $(CLEAR_VARS)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-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
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/keysets/permDef/Android.bp b/hostsidetests/appsecurity/test-apps/keysets/permDef/Android.bp
new file mode 100644
index 0000000..baf93fc
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/keysets/permDef/Android.bp
@@ -0,0 +1,49 @@
+// 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.
+
+//apks signed cts-keyset-test-a
+android_test {
+ name: "CtsKeySetPermDefSigningA",
+ defaults: ["cts_support_defaults"],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ certificate: ":cts-keyset-test-a",
+ dex_preopt: {
+ enabled: false,
+ },
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
+
+//apks signed cts-keyset-test-b
+android_test {
+ name: "CtsKeySetPermDefSigningB",
+ defaults: ["cts_support_defaults"],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ certificate: ":cts-keyset-test-b",
+ dex_preopt: {
+ enabled: false,
+ },
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
diff --git a/hostsidetests/appsecurity/test-apps/keysets/permDef/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/permDef/Android.mk
deleted file mode 100644
index 76ca560..0000000
--- a/hostsidetests/appsecurity/test-apps/keysets/permDef/Android.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-# 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)
-
-#apks signed cts-keyset-test-a
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-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
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
-
-#apks signed cts-keyset-test-b
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-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
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/keysets/permUse/Android.bp b/hostsidetests/appsecurity/test-apps/keysets/permUse/Android.bp
new file mode 100644
index 0000000..74268ef
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/keysets/permUse/Android.bp
@@ -0,0 +1,49 @@
+// 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.
+
+//apks signed cts-keyset-test-a
+android_test {
+ name: "CtsKeySetPermUseSigningA",
+ defaults: ["cts_support_defaults"],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ certificate: ":cts-keyset-test-a",
+ dex_preopt: {
+ enabled: false,
+ },
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
+
+//apks signed cts-keyset-test-b
+android_test {
+ name: "CtsKeySetPermUseSigningB",
+ defaults: ["cts_support_defaults"],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ certificate: ":cts-keyset-test-b",
+ dex_preopt: {
+ enabled: false,
+ },
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
diff --git a/hostsidetests/appsecurity/test-apps/keysets/permUse/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/permUse/Android.mk
deleted file mode 100644
index 19dba61..0000000
--- a/hostsidetests/appsecurity/test-apps/keysets/permUse/Android.mk
+++ /dev/null
@@ -1,45 +0,0 @@
-# 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)
-
-#apks signed cts-keyset-test-a
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-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
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
-
-#apks signed cts-keyset-test-b
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-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
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/keysets/testApp/Android.bp b/hostsidetests/appsecurity/test-apps/keysets/testApp/Android.bp
new file mode 100644
index 0000000..5ae5945
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/keysets/testApp/Android.bp
@@ -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.
+
+android_test {
+ name: "CtsKeySetTestApp",
+ defaults: ["cts_support_defaults"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ libs: ["android.test.base.stubs"],
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/keysets/testApp/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/testApp/Android.mk
deleted file mode 100644
index fe22777..0000000
--- a/hostsidetests/appsecurity/test-apps/keysets/testApp/Android.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-LOCAL_PACKAGE_NAME := CtsKeySetTestApp
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uA/Android.bp b/hostsidetests/appsecurity/test-apps/keysets/uA/Android.bp
new file mode 100644
index 0000000..bd38994
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/keysets/uA/Android.bp
@@ -0,0 +1,86 @@
+// 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.
+
+//apks signed by cts-keyset-test-a
+android_test {
+ name: "CtsKeySetSigningAUpgradeA",
+ defaults: ["cts_support_defaults"],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ certificate: ":cts-keyset-test-a",
+ dex_preopt: {
+ enabled: false,
+ },
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
+
+//apks signed by cts-keyset-test-b
+android_test {
+ name: "CtsKeySetSigningBUpgradeA",
+ defaults: ["cts_support_defaults"],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ certificate: ":cts-keyset-test-b",
+ dex_preopt: {
+ enabled: false,
+ },
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
+
+//apks signed by cts-keyset-test-ec-a
+android_test {
+ name: "CtsKeySetSigningEcAUpgradeA",
+ defaults: ["cts_support_defaults"],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ certificate: ":cts-keyset-test-ec-a",
+ dex_preopt: {
+ enabled: false,
+ },
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
+
+//apks signed by cts-keyset-test-a and cts-keyset-test-b
+android_test {
+ name: "CtsKeySetSigningAAndBUpgradeA",
+ defaults: ["cts_support_defaults"],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ certificate: ":cts-keyset-test-a",
+ additional_certificates: [":cts-keyset-test-b"],
+ dex_preopt: {
+ enabled: false,
+ },
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uA/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/uA/Android.mk
deleted file mode 100644
index cb08b44..0000000
--- a/hostsidetests/appsecurity/test-apps/keysets/uA/Android.mk
+++ /dev/null
@@ -1,68 +0,0 @@
-# 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)
-
-#apks signed by cts-keyset-test-a
-include $(CLEAR_VARS)
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-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
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
-
-#apks signed by cts-keyset-test-b
-include $(CLEAR_VARS)
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-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
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
-
-#apks signed by cts-keyset-test-ec-a
-include $(CLEAR_VARS)
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-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
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
-
-#apks signed by cts-keyset-test-a and cts-keyset-test-b
-include $(CLEAR_VARS)
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-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
-LOCAL_DEX_PREOPT := false
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uAB/Android.bp b/hostsidetests/appsecurity/test-apps/keysets/uAB/Android.bp
new file mode 100644
index 0000000..c6f9bed
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/keysets/uAB/Android.bp
@@ -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.
+
+//apks signed cts-keyset-test-a
+android_test {
+ name: "CtsKeySetSigningAUpgradeAAndB",
+ defaults: ["cts_support_defaults"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ certificate: ":cts-keyset-test-a",
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uAB/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/uAB/Android.mk
deleted file mode 100644
index 3dd4747..0000000
--- a/hostsidetests/appsecurity/test-apps/keysets/uAB/Android.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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)
-
-#apks signed cts-keyset-test-a
-include $(CLEAR_VARS)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-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
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uAuB/Android.bp b/hostsidetests/appsecurity/test-apps/keysets/uAuB/Android.bp
new file mode 100644
index 0000000..1e31c12
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/keysets/uAuB/Android.bp
@@ -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.
+
+//apks signed cts-keyset-test-a
+android_test {
+ name: "CtsKeySetSigningAUpgradeAOrB",
+ defaults: ["cts_support_defaults"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ certificate: ":cts-keyset-test-a",
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uAuB/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/uAuB/Android.mk
deleted file mode 100644
index 7598c5b..0000000
--- a/hostsidetests/appsecurity/test-apps/keysets/uAuB/Android.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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)
-
-#apks signed cts-keyset-test-a
-include $(CLEAR_VARS)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-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
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uB/Android.bp b/hostsidetests/appsecurity/test-apps/keysets/uB/Android.bp
new file mode 100644
index 0000000..6b71f43
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/keysets/uB/Android.bp
@@ -0,0 +1,68 @@
+// 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.
+
+//apks signed cts-keyset-test-a
+android_test {
+ name: "CtsKeySetSigningAUpgradeB",
+ defaults: ["cts_support_defaults"],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ certificate: ":cts-keyset-test-a",
+ dex_preopt: {
+ enabled: false,
+ },
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
+
+//apks signed cts-keyset-test-b
+android_test {
+ name: "CtsKeySetSigningBUpgradeB",
+ defaults: ["cts_support_defaults"],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ certificate: ":cts-keyset-test-b",
+ dex_preopt: {
+ enabled: false,
+ },
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
+
+//apks signed by cts-keyset-test-a and cts-keyset-test-c
+android_test {
+ name: "CtsKeySetSigningAAndCUpgradeB",
+ defaults: ["cts_support_defaults"],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ certificate: ":cts-keyset-test-a",
+ additional_certificates: [":cts-keyset-test-c"],
+ dex_preopt: {
+ enabled: false,
+ },
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uB/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/uB/Android.mk
deleted file mode 100644
index 82efc2c..0000000
--- a/hostsidetests/appsecurity/test-apps/keysets/uB/Android.mk
+++ /dev/null
@@ -1,61 +0,0 @@
-# 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)
-
-#apks signed cts-keyset-test-a
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-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
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
-
-#apks signed cts-keyset-test-b
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-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
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
-
-#apks signed by cts-keyset-test-a and cts-keyset-test-c
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-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
-LOCAL_DEX_PREOPT := false
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uBsharedUser/Android.bp b/hostsidetests/appsecurity/test-apps/keysets/uBsharedUser/Android.bp
new file mode 100644
index 0000000..722597d
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/keysets/uBsharedUser/Android.bp
@@ -0,0 +1,49 @@
+// 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.
+
+//apks signed cts-keyset-test-a
+android_test {
+ name: "CtsKeySetSharedUserSigningAUpgradeB",
+ defaults: ["cts_support_defaults"],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ certificate: ":cts-keyset-test-a",
+ dex_preopt: {
+ enabled: false,
+ },
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
+
+//apks signed cts-keyset-test-b
+android_test {
+ name: "CtsKeySetSharedUserSigningBUpgradeB",
+ defaults: ["cts_support_defaults"],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ certificate: ":cts-keyset-test-b",
+ dex_preopt: {
+ enabled: false,
+ },
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uBsharedUser/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/uBsharedUser/Android.mk
deleted file mode 100644
index c65637f..0000000
--- a/hostsidetests/appsecurity/test-apps/keysets/uBsharedUser/Android.mk
+++ /dev/null
@@ -1,45 +0,0 @@
-# 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)
-
-#apks signed cts-keyset-test-a
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-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
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
-
-#apks signed cts-keyset-test-b
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-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
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uEcA/Android.bp b/hostsidetests/appsecurity/test-apps/keysets/uEcA/Android.bp
new file mode 100644
index 0000000..2592ec3
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/keysets/uEcA/Android.bp
@@ -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.
+
+//apks signed by cts-keyset-test-a
+android_test {
+ name: "CtsKeySetSigningAUpgradeEcA",
+ defaults: ["cts_support_defaults"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ certificate: ":cts-keyset-test-a",
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uEcA/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/uEcA/Android.mk
deleted file mode 100644
index e7c9b6d..0000000
--- a/hostsidetests/appsecurity/test-apps/keysets/uEcA/Android.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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)
-
-#apks signed by cts-keyset-test-a
-include $(CLEAR_VARS)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-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
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uNone/Android.bp b/hostsidetests/appsecurity/test-apps/keysets/uNone/Android.bp
new file mode 100644
index 0000000..f337911
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/keysets/uNone/Android.bp
@@ -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.
+
+//apks signed cts-keyset-test-a
+android_test {
+ name: "CtsKeySetSigningAUpgradeNone",
+ defaults: ["cts_support_defaults"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ sdk_version: "current",
+ static_libs: ["androidx.test.rules"],
+ certificate: ":cts-keyset-test-a",
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uNone/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/uNone/Android.mk
deleted file mode 100644
index e6c830b..0000000
--- a/hostsidetests/appsecurity/test-apps/keysets/uNone/Android.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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)
-
-#apks signed cts-keyset-test-a
-include $(CLEAR_VARS)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SDK_VERSION := current
-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
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/appsecurity/test-apps/tinyapp/Android.bp b/hostsidetests/appsecurity/test-apps/tinyapp/Android.bp
new file mode 100644
index 0000000..e1a0cb3
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/tinyapp/Android.bp
@@ -0,0 +1,29 @@
+// 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.
+
+android_test {
+ name: "CtsPkgInstallTinyApp",
+ defaults: ["cts_support_defaults"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+ dex_preopt: {
+ enabled: false,
+ },
+}
diff --git a/hostsidetests/appsecurity/test-apps/tinyapp/Android.mk b/hostsidetests/appsecurity/test-apps/tinyapp/Android.mk
deleted file mode 100644
index da5eba3..0000000
--- a/hostsidetests/appsecurity/test-apps/tinyapp/Android.mk
+++ /dev/null
@@ -1,28 +0,0 @@
-# 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)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_MODULE_TAGS := tests
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_SDK_VERSION := current
-LOCAL_PACKAGE_NAME := CtsPkgInstallTinyApp
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/hostsidetests/classloaders/useslibrary/AndroidTest.xml b/hostsidetests/classloaders/useslibrary/AndroidTest.xml
index 7146f92..815f138 100644
--- a/hostsidetests/classloaders/useslibrary/AndroidTest.xml
+++ b/hostsidetests/classloaders/useslibrary/AndroidTest.xml
@@ -17,6 +17,7 @@
<option name="test-suite-tag" value="cts" />
<option name="config-descriptor:metadata" key="component" value="framework" />
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
<test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
<option name="jar" value="CtsUsesLibraryHostTestCases.jar" />
<option name="runtime-hint" value="1m" />
diff --git a/hostsidetests/devicepolicy/Android.mk b/hostsidetests/devicepolicy/Android.mk
index b493775..307bb31 100644
--- a/hostsidetests/devicepolicy/Android.mk
+++ b/hostsidetests/devicepolicy/Android.mk
@@ -38,11 +38,7 @@
LOCAL_COMPATIBILITY_SUITE := cts arcts vts general-tests
# Need the dependency to build/run the module solely by atest.
-ifndef ENABLE_DEFAULT_TEST_LOCATION
-LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_TESTCASES)/cts-current-api/current.api
-else
LOCAL_TARGET_REQUIRED_MODULES := cts-current-api
-endif
include $(BUILD_CTS_HOST_JAVA_LIBRARY)
diff --git a/hostsidetests/devicepolicy/app/AccountCheck/Android.bp b/hostsidetests/devicepolicy/app/AccountCheck/Android.bp
new file mode 100644
index 0000000..743ae6a
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/AccountCheck/Android.bp
@@ -0,0 +1,76 @@
+// 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.
+
+android_test {
+ name: "CtsAccountCheckTestOnlyOwnerApp",
+ defaults: ["cts_defaults"],
+ // Tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ srcs: ["src-owner/**/*.java"],
+ resource_dirs: ["TestOnlyOwner/res"],
+ static_libs: [
+ "androidx.legacy_legacy-support-v4",
+ "ctstestrunner-axt",
+ "ub-uiautomator",
+ "androidx.test.rules",
+ ],
+ sdk_version: "current",
+ manifest: "TestOnlyOwner/AndroidManifest.xml",
+}
+
+android_test {
+ name: "CtsAccountCheckNonTestOnlyOwnerApp",
+ defaults: ["cts_defaults"],
+ // Tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ srcs: ["src-owner/**/*.java"],
+ resource_dirs: ["NonTestOnlyOwner/res"],
+ static_libs: [
+ "androidx.legacy_legacy-support-v4",
+ "ctstestrunner-axt",
+ "ub-uiautomator",
+ "androidx.test.rules",
+ ],
+ sdk_version: "current",
+ manifest: "NonTestOnlyOwner/AndroidManifest.xml",
+}
+
+android_test {
+ name: "CtsAccountCheckTestOnlyOwnerUpdateApp",
+ defaults: ["cts_defaults"],
+ // Tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ srcs: ["src-owner/**/*.java"],
+ resource_dirs: ["TestOnlyOwnerUpdate/res"],
+ static_libs: [
+ "androidx.legacy_legacy-support-v4",
+ "ctstestrunner-axt",
+ "ub-uiautomator",
+ "androidx.test.rules",
+ ],
+ sdk_version: "current",
+ manifest: "TestOnlyOwnerUpdate/AndroidManifest.xml",
+}
diff --git a/hostsidetests/devicepolicy/app/AccountCheck/Android.mk b/hostsidetests/devicepolicy/app/AccountCheck/Android.mk
deleted file mode 100644
index 41a41d0..0000000
--- a/hostsidetests/devicepolicy/app/AccountCheck/Android.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# 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.
-#
-
-include $(call all-subdir-makefiles)
diff --git a/hostsidetests/devicepolicy/app/AccountCheck/Auth/Android.bp b/hostsidetests/devicepolicy/app/AccountCheck/Auth/Android.bp
new file mode 100644
index 0000000..c90f84c
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/AccountCheck/Auth/Android.bp
@@ -0,0 +1,34 @@
+// 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.
+
+android_test {
+ name: "CtsAccountCheckAuthApp",
+ defaults: ["cts_defaults"],
+ // Tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ srcs: ["src/**/*.java"],
+ static_libs: [
+ "androidx.legacy_legacy-support-v4",
+ "ctstestrunner-axt",
+ "ub-uiautomator",
+ "androidx.test.rules",
+ ],
+ libs: ["android.test.base.stubs"],
+ sdk_version: "test_current",
+ min_sdk_version: "25",
+}
diff --git a/hostsidetests/devicepolicy/app/AccountCheck/Auth/Android.mk b/hostsidetests/devicepolicy/app/AccountCheck/Auth/Android.mk
deleted file mode 100644
index 0b4b514..0000000
--- a/hostsidetests/devicepolicy/app/AccountCheck/Auth/Android.mk
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsAccountCheckAuthApp
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- androidx.legacy_legacy-support-v4 \
- ctstestrunner-axt \
- ub-uiautomator \
- androidx.test.rules
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := test_current
-LOCAL_MIN_SDK_VERSION := 25
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/AccountCheck/NonTestOnlyOwner/Android.mk b/hostsidetests/devicepolicy/app/AccountCheck/NonTestOnlyOwner/Android.mk
deleted file mode 100644
index 00658e1..0000000
--- a/hostsidetests/devicepolicy/app/AccountCheck/NonTestOnlyOwner/Android.mk
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsAccountCheckNonTestOnlyOwnerApp
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src-owner)
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.legacy_legacy-support-v4 ctstestrunner-axt ub-uiautomator androidx.test.rules
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwner/Android.mk b/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwner/Android.mk
deleted file mode 100644
index 0cc8deb..0000000
--- a/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwner/Android.mk
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsAccountCheckTestOnlyOwnerApp
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src-owner)
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.legacy_legacy-support-v4 ctstestrunner-axt ub-uiautomator androidx.test.rules
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwnerUpdate/Android.mk b/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwnerUpdate/Android.mk
deleted file mode 100644
index fd40498..0000000
--- a/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwnerUpdate/Android.mk
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsAccountCheckTestOnlyOwnerUpdateApp
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src-owner)
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.legacy_legacy-support-v4 ctstestrunner-axt ub-uiautomator androidx.test.rules
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/AccountCheck/Tester/Android.bp b/hostsidetests/devicepolicy/app/AccountCheck/Tester/Android.bp
new file mode 100644
index 0000000..284c783
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/AccountCheck/Tester/Android.bp
@@ -0,0 +1,33 @@
+// 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.
+
+android_test {
+ name: "CtsAccountCheckAuthAppTester",
+ defaults: ["cts_defaults"],
+ // Tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ srcs: ["src/**/*.java"],
+ static_libs: [
+ "androidx.legacy_legacy-support-v4",
+ "ctstestrunner-axt",
+ "ub-uiautomator",
+ "androidx.test.rules",
+ ],
+ sdk_version: "test_current",
+ min_sdk_version: "25",
+}
diff --git a/hostsidetests/devicepolicy/app/AccountCheck/Tester/Android.mk b/hostsidetests/devicepolicy/app/AccountCheck/Tester/Android.mk
deleted file mode 100644
index 31e3807..0000000
--- a/hostsidetests/devicepolicy/app/AccountCheck/Tester/Android.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsAccountCheckAuthAppTester
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.legacy_legacy-support-v4 ctstestrunner-axt ub-uiautomator androidx.test.rules
-
-LOCAL_SDK_VERSION := test_current
-LOCAL_MIN_SDK_VERSION := 25
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/AccountManagement/Android.bp b/hostsidetests/devicepolicy/app/AccountManagement/Android.bp
new file mode 100644
index 0000000..bbaf9f5
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/AccountManagement/Android.bp
@@ -0,0 +1,34 @@
+// 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.
+
+android_test {
+ name: "CtsAccountManagementDevicePolicyApp",
+ defaults: ["cts_defaults"],
+ // Tag this module as a cts test artifact
+ test_suites: [
+ "arcts",
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ srcs: ["src/**/*.java"],
+ static_libs: [
+ "androidx.legacy_legacy-support-v4",
+ "ctstestrunner-axt",
+ "ub-uiautomator",
+ "androidx.test.rules",
+ ],
+ libs: ["android.test.base.stubs"],
+ sdk_version: "current",
+}
diff --git a/hostsidetests/devicepolicy/app/AccountManagement/Android.mk b/hostsidetests/devicepolicy/app/AccountManagement/Android.mk
deleted file mode 100644
index 2ce6c5d..0000000
--- a/hostsidetests/devicepolicy/app/AccountManagement/Android.mk
+++ /dev/null
@@ -1,40 +0,0 @@
-# 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)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := arcts cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsAccountManagementDevicePolicyApp
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- androidx.legacy_legacy-support-v4 \
- ctstestrunner-axt \
- ub-uiautomator \
- androidx.test.rules
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/AppRestrictionsTargetApp/Android.bp b/hostsidetests/devicepolicy/app/AppRestrictionsTargetApp/Android.bp
new file mode 100644
index 0000000..3ff8f85
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/AppRestrictionsTargetApp/Android.bp
@@ -0,0 +1,28 @@
+// 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.
+
+android_test {
+ name: "CtsAppRestrictionsTargetApp",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+ min_sdk_version: "24",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "arcts",
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
diff --git a/hostsidetests/devicepolicy/app/AppRestrictionsTargetApp/Android.mk b/hostsidetests/devicepolicy/app/AppRestrictionsTargetApp/Android.mk
deleted file mode 100644
index 3aed12d..0000000
--- a/hostsidetests/devicepolicy/app/AppRestrictionsTargetApp/Android.mk
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsAppRestrictionsTargetApp
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 24
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := arcts cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/Assistant/Android.bp b/hostsidetests/devicepolicy/app/Assistant/Android.bp
new file mode 100644
index 0000000..15f45a4
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/Assistant/Android.bp
@@ -0,0 +1,34 @@
+// 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.
+
+android_test {
+ name: "CtsDevicePolicyAssistApp",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ // Tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ static_libs: [
+ "androidx.legacy_legacy-support-v4",
+ "compatibility-device-util-axt",
+ "androidx.test.rules",
+ ],
+ sdk_version: "test_current",
+}
diff --git a/hostsidetests/devicepolicy/app/Assistant/Android.mk b/hostsidetests/devicepolicy/app/Assistant/Android.mk
deleted file mode 100644
index 6b16d40..0000000
--- a/hostsidetests/devicepolicy/app/Assistant/Android.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := optional
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsDevicePolicyAssistApp
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- androidx.legacy_legacy-support-v4 \
- compatibility-device-util-axt \
- androidx.test.rules \
-
-
-LOCAL_SDK_VERSION := current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/AutofillApp/Android.bp b/hostsidetests/devicepolicy/app/AutofillApp/Android.bp
new file mode 100644
index 0000000..00037f1
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/AutofillApp/Android.bp
@@ -0,0 +1,27 @@
+// 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.
+
+android_test {
+ name: "CtsDevicePolicyAutofillApp",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ // Tag this module as a cts test artifact
+ test_suites: [
+ "arcts",
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ sdk_version: "current",
+}
diff --git a/hostsidetests/devicepolicy/app/AutofillApp/Android.mk b/hostsidetests/devicepolicy/app/AutofillApp/Android.mk
deleted file mode 100644
index 80a8b60..0000000
--- a/hostsidetests/devicepolicy/app/AutofillApp/Android.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := optional
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsDevicePolicyAutofillApp
-
-LOCAL_SDK_VERSION := current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := arcts cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/CertInstaller/Android.bp b/hostsidetests/devicepolicy/app/CertInstaller/Android.bp
new file mode 100644
index 0000000..7fd3778
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/CertInstaller/Android.bp
@@ -0,0 +1,38 @@
+// 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.
+
+android_test {
+ name: "CtsCertInstallerApp",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ libs: [
+ "android.test.runner.stubs",
+ "android.test.base.stubs",
+ ],
+ platform_apis: true,
+ min_sdk_version: "22",
+ static_libs: [
+ "compatibility-device-util-axt",
+ "ctstestrunner-axt",
+ "truth-prebuilt",
+ "testng",
+ "cts-security-test-support-library",
+ ],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
diff --git a/hostsidetests/devicepolicy/app/CertInstaller/Android.mk b/hostsidetests/devicepolicy/app/CertInstaller/Android.mk
deleted file mode 100644
index ecf45c5..0000000
--- a/hostsidetests/devicepolicy/app/CertInstaller/Android.mk
+++ /dev/null
@@ -1,44 +0,0 @@
-# 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_PACKAGE_NAME := CtsCertInstallerApp
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs \
- android.test.base.stubs \
-
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_MIN_SDK_VERSION := 22
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util-axt \
- ctstestrunner-axt \
- truth-prebuilt \
- testng \
- cts-security-test-support-library
-
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/ContactDirectoryProvider/Android.bp b/hostsidetests/devicepolicy/app/ContactDirectoryProvider/Android.bp
new file mode 100644
index 0000000..0c1913b
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/ContactDirectoryProvider/Android.bp
@@ -0,0 +1,26 @@
+// 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.
+
+android_test {
+ name: "CtsContactDirectoryProvider",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ // Tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ sdk_version: "current",
+}
diff --git a/hostsidetests/devicepolicy/app/ContactDirectoryProvider/Android.mk b/hostsidetests/devicepolicy/app/ContactDirectoryProvider/Android.mk
deleted file mode 100644
index eec2e12..0000000
--- a/hostsidetests/devicepolicy/app/ContactDirectoryProvider/Android.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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)
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := optional
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsContactDirectoryProvider
-
-LOCAL_SDK_VERSION := current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/ContentCaptureApp/Android.bp b/hostsidetests/devicepolicy/app/ContentCaptureApp/Android.bp
new file mode 100644
index 0000000..021db61
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/ContentCaptureApp/Android.bp
@@ -0,0 +1,27 @@
+// 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.
+
+android_test {
+ name: "CtsDevicePolicyContentCaptureApp",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ // Tag this module as a cts test artifact
+ test_suites: [
+ "arcts",
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ sdk_version: "system_current",
+}
diff --git a/hostsidetests/devicepolicy/app/CorpOwnedManagedProfile/Android.bp b/hostsidetests/devicepolicy/app/CorpOwnedManagedProfile/Android.bp
new file mode 100644
index 0000000..8b164ce
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/CorpOwnedManagedProfile/Android.bp
@@ -0,0 +1,82 @@
+// 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.
+
+// IMPORTANT: We build two apps from the same source but with different package name.
+// This allow us to have different device owner and profile owner, some APIs may behave differently
+// in this situation.
+
+// === App 1 ===
+
+android_test {
+ name: "CtsCorpOwnedManagedProfile",
+ defaults: ["cts_defaults"],
+ srcs: [
+ "src/**/*.java",
+ "src/**/I*.aidl",
+ ],
+ aidl: {
+ local_include_dirs: ["src"],
+ },
+ libs: [
+ "android.test.runner.stubs",
+ "junit",
+ "android.test.base.stubs",
+ ],
+ static_libs: [
+ "ctstestrunner-axt",
+ "compatibility-device-util-axt",
+ ],
+ sdk_version: "test_current",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
+
+// === App 2 ===
+android_test {
+ name: "CtsCorpOwnedManagedProfile2",
+ defaults: ["cts_defaults"],
+ srcs: [
+ "src/**/*.java",
+ "src/**/I*.aidl",
+ ],
+ aidl: {
+ local_include_dirs: ["src"],
+ },
+ libs: [
+ "android.test.runner.stubs",
+ "junit",
+ "android.test.base.stubs",
+ ],
+ static_libs: [
+ "ctstestrunner-axt",
+ "compatibility-device-util-axt",
+ ],
+ sdk_version: "test_current",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ aaptflags: [
+ "--rename-manifest-package",
+ "com.android.cts.comp2",
+ "--rename-instrumentation-target-package",
+ "com.android.cts.comp2",
+ ],
+}
diff --git a/hostsidetests/devicepolicy/app/CorpOwnedManagedProfile/Android.mk b/hostsidetests/devicepolicy/app/CorpOwnedManagedProfile/Android.mk
deleted file mode 100644
index 3144231..0000000
--- a/hostsidetests/devicepolicy/app/CorpOwnedManagedProfile/Android.mk
+++ /dev/null
@@ -1,71 +0,0 @@
-# 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.
-
-# IMPORTANT: We build two apps from the same source but with different package name.
-# This allow us to have different device owner and profile owner, some APIs may behave differently
-# in this situation.
-
-# === App 1 ===
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsCorpOwnedManagedProfile
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
- $(call all-Iaidl-files-under, src)
-
-LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/src
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs junit android.test.base.stubs
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
-
-LOCAL_SDK_VERSION := test_current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
-
-# === App 2 ===
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsCorpOwnedManagedProfile2
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
- $(call all-Iaidl-files-under, src)
-
-LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/src
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs junit android.test.base.stubs
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
-
-LOCAL_SDK_VERSION := test_current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-LOCAL_AAPT_FLAGS += --rename-manifest-package com.android.cts.comp2 \
- --rename-instrumentation-target-package com.android.cts.comp2
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/CrossProfileAppsTest/Android.bp b/hostsidetests/devicepolicy/app/CrossProfileAppsTest/Android.bp
new file mode 100644
index 0000000..527f132
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/CrossProfileAppsTest/Android.bp
@@ -0,0 +1,35 @@
+// 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.
+
+android_test {
+ name: "CtsCrossProfileAppsTests",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ libs: ["junit"],
+ static_libs: [
+ "androidx.legacy_legacy-support-v4",
+ "ctstestrunner-axt",
+ "androidx.test.rules",
+ "truth-prebuilt",
+ "ub-uiautomator",
+ ],
+ sdk_version: "current",
+ min_sdk_version: "21",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
diff --git a/hostsidetests/devicepolicy/app/CrossProfileAppsTest/Android.mk b/hostsidetests/devicepolicy/app/CrossProfileAppsTest/Android.mk
deleted file mode 100644
index 4848a6f..0000000
--- a/hostsidetests/devicepolicy/app/CrossProfileAppsTest/Android.mk
+++ /dev/null
@@ -1,42 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsCrossProfileAppsTests
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := junit
-
-LOCAL_STATIC_JAVA_LIBRARIES = \
- androidx.legacy_legacy-support-v4 \
- ctstestrunner-axt \
- androidx.test.rules \
- truth-prebuilt \
- ub-uiautomator
-
-LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 21
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/CustomizationApp/Android.bp b/hostsidetests/devicepolicy/app/CustomizationApp/Android.bp
new file mode 100644
index 0000000..8306272
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/CustomizationApp/Android.bp
@@ -0,0 +1,32 @@
+// 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.
+
+android_test {
+ name: "CtsCustomizationApp",
+ defaults: ["cts_defaults"],
+ test_suites: [
+ "arcts",
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ srcs: ["src/**/*.java"],
+ static_libs: [
+ "androidx.test.rules",
+ "compatibility-device-util-axt",
+ ],
+ libs: ["android.test.base.stubs"],
+ sdk_version: "test_current",
+ min_sdk_version: "24",
+}
diff --git a/hostsidetests/devicepolicy/app/CustomizationApp/Android.mk b/hostsidetests/devicepolicy/app/CustomizationApp/Android.mk
deleted file mode 100644
index c82c1d8..0000000
--- a/hostsidetests/devicepolicy/app/CustomizationApp/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_COMPATIBILITY_SUITE := arcts cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsCustomizationApp
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- androidx.test.rules \
- compatibility-device-util-axt \
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 24
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/DelegateApp/Android.bp b/hostsidetests/devicepolicy/app/DelegateApp/Android.bp
new file mode 100644
index 0000000..91d53dc
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/DelegateApp/Android.bp
@@ -0,0 +1,39 @@
+// 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.
+
+android_test {
+ name: "CtsDelegateApp",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ libs: [
+ "android.test.runner.stubs",
+ "junit",
+ "android.test.base.stubs",
+ ],
+ static_libs: [
+ "androidx.legacy_legacy-support-v4",
+ "ctstestrunner-axt",
+ "androidx.test.rules",
+ "ub-uiautomator",
+ "truth-prebuilt",
+ ],
+ sdk_version: "current",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "arcts",
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
diff --git a/hostsidetests/devicepolicy/app/DelegateApp/Android.mk b/hostsidetests/devicepolicy/app/DelegateApp/Android.mk
deleted file mode 100644
index c7a3d9c..0000000
--- a/hostsidetests/devicepolicy/app/DelegateApp/Android.mk
+++ /dev/null
@@ -1,41 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsDelegateApp
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs junit android.test.base.stubs
-
-LOCAL_STATIC_JAVA_LIBRARIES = \
- androidx.legacy_legacy-support-v4 \
- ctstestrunner-axt \
- androidx.test.rules \
- ub-uiautomator \
- truth-prebuilt
-
-LOCAL_SDK_VERSION := current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := arcts cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/DeviceAdmin/Android.bp b/hostsidetests/devicepolicy/app/DeviceAdmin/Android.bp
new file mode 100644
index 0000000..550fe71
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/DeviceAdmin/Android.bp
@@ -0,0 +1,87 @@
+// 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.
+
+android_test {
+ name: "CtsDeviceAdminApp23",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ resource_dirs: ["res"],
+ static_libs: [
+ "ctstestrunner-axt",
+ "compatibility-device-util-axt",
+ ],
+ libs: [
+ "android.test.runner.stubs",
+ "android.test.base.stubs",
+ ],
+ sdk_version: "test_current",
+ min_sdk_version: "23",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ manifest: "api23/AndroidManifest.xml",
+}
+
+android_test {
+ name: "CtsDeviceAdminApp24",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ resource_dirs: ["res"],
+ static_libs: [
+ "ctstestrunner-axt",
+ "compatibility-device-util-axt",
+ ],
+ libs: [
+ "android.test.runner.stubs",
+ "android.test.base.stubs",
+ ],
+ sdk_version: "test_current",
+ // TODO: should it be "24":
+ min_sdk_version: "23",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "arcts",
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ manifest: "api24/AndroidManifest.xml",
+}
+
+android_test {
+ name: "CtsDeviceAdminApp29",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ resource_dirs: ["res"],
+ static_libs: [
+ "ctstestrunner-axt",
+ "compatibility-device-util-axt",
+ ],
+ libs: [
+ "android.test.runner.stubs",
+ "android.test.base.stubs",
+ ],
+ sdk_version: "test_current",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "arcts",
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ manifest: "api29/AndroidManifest.xml",
+}
diff --git a/hostsidetests/devicepolicy/app/DeviceAdmin/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdmin/Android.mk
deleted file mode 100644
index 31e193d..0000000
--- a/hostsidetests/devicepolicy/app/DeviceAdmin/Android.mk
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-# Build the test APKs using their own makefiles
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/devicepolicy/app/DeviceAdmin/api23/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdmin/api23/Android.mk
deleted file mode 100644
index 3d90925..0000000
--- a/hostsidetests/devicepolicy/app/DeviceAdmin/api23/Android.mk
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsDeviceAdminApp23
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
-
-LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/../res
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner-axt \
- compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 23
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/DeviceAdmin/api24/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdmin/api24/Android.mk
deleted file mode 100644
index 69624d7..0000000
--- a/hostsidetests/devicepolicy/app/DeviceAdmin/api24/Android.mk
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsDeviceAdminApp24
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
-
-LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/../res
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner-axt \
- compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 23
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := arcts cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/DeviceAdmin/api29/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdmin/api29/Android.mk
deleted file mode 100644
index 0d7e97f..0000000
--- a/hostsidetests/devicepolicy/app/DeviceAdmin/api29/Android.mk
+++ /dev/null
@@ -1,40 +0,0 @@
-# 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_PACKAGE_NAME := CtsDeviceAdminApp29
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
-
-LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/../res
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner-axt \
- compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_SDK_VERSION := current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := arcts cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/Android.bp b/hostsidetests/devicepolicy/app/DeviceAdminService/Android.bp
new file mode 100644
index 0000000..c9cc66e
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/DeviceAdminService/Android.bp
@@ -0,0 +1,113 @@
+// 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.
+
+android_test {
+ name: "CtsDeviceAdminService1",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ resource_dirs: ["res"],
+ static_libs: [
+ "ctstestrunner-axt",
+ "compatibility-device-util-axt",
+ ],
+ libs: ["android.test.base.stubs"],
+ sdk_version: "test_current",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ manifest: "package1/AndroidManifest.xml",
+}
+
+android_test {
+ name: "CtsDeviceAdminService2",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ resource_dirs: ["res"],
+ static_libs: [
+ "ctstestrunner-axt",
+ "compatibility-device-util-axt",
+ ],
+ libs: ["android.test.base.stubs"],
+ sdk_version: "test_current",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ manifest: "package2/AndroidManifest.xml",
+}
+
+android_test {
+ name: "CtsDeviceAdminService3",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ resource_dirs: ["res"],
+ static_libs: [
+ "ctstestrunner-axt",
+ "compatibility-device-util-axt",
+ ],
+ libs: ["android.test.base.stubs"],
+ sdk_version: "test_current",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ manifest: "package3/AndroidManifest.xml",
+}
+
+android_test {
+ name: "CtsDeviceAdminService4",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ resource_dirs: ["res"],
+ static_libs: [
+ "ctstestrunner-axt",
+ "compatibility-device-util-axt",
+ ],
+ libs: ["android.test.base.stubs"],
+ sdk_version: "test_current",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ manifest: "package4/AndroidManifest.xml",
+}
+
+android_test {
+ name: "CtsDeviceAdminServiceB",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ resource_dirs: ["res"],
+ static_libs: [
+ "ctstestrunner-axt",
+ "compatibility-device-util-axt",
+ ],
+ libs: ["android.test.base.stubs"],
+ sdk_version: "test_current",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ manifest: "packageb/AndroidManifest.xml",
+}
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdminService/Android.mk
deleted file mode 100644
index 4a74e80..0000000
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/Android.mk
+++ /dev/null
@@ -1,20 +0,0 @@
-# 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.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-# Build the test APKs using their own makefiles
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/package1/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdminService/package1/Android.mk
deleted file mode 100644
index 2689607..0000000
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/package1/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsDeviceAdminService1
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
-
-LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/../res
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/package2/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdminService/package2/Android.mk
deleted file mode 100644
index 4726b8d..0000000
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/package2/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsDeviceAdminService2
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
-
-LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/../res
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/package3/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdminService/package3/Android.mk
deleted file mode 100644
index 8ac6307..0000000
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/package3/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsDeviceAdminService3
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
-
-LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/../res
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/package4/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdminService/package4/Android.mk
deleted file mode 100644
index 32c061a..0000000
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/package4/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsDeviceAdminService4
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
-
-LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/../res
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/packageb/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdminService/packageb/Android.mk
deleted file mode 100644
index 54493f2..0000000
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/packageb/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsDeviceAdminServiceB
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
-
-LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/../res
-
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-
-LOCAL_SDK_VERSION := current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/Android.bp b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/Android.bp
new file mode 100644
index 0000000..4272590
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/Android.bp
@@ -0,0 +1,98 @@
+// 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.
+
+android_test {
+ name: "CtsDeviceAndProfileOwnerApp23",
+ defaults: ["cts_defaults"],
+ platform_apis: true,
+ srcs: ["src/**/*.java"],
+ libs: [
+ "android.test.runner.stubs",
+ "android.test.base.stubs",
+ ],
+ static_libs: [
+ "compatibility-device-util-axt",
+ "ctstestrunner-axt",
+ "ub-uiautomator",
+ "cts-security-test-support-library",
+ "androidx.legacy_legacy-support-v4",
+ ],
+ resource_dirs: ["res"],
+ asset_dirs: ["assets"],
+ min_sdk_version: "23",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ manifest: "api23/AndroidManifest.xml",
+}
+
+android_test {
+ name: "CtsDeviceAndProfileOwnerApp25",
+ defaults: ["cts_defaults"],
+ platform_apis: true,
+ srcs: ["src/**/*.java"],
+ libs: [
+ "android.test.runner.stubs",
+ "android.test.base.stubs",
+ ],
+ static_libs: [
+ "compatibility-device-util-axt",
+ "ctstestrunner-axt",
+ "ub-uiautomator",
+ "cts-security-test-support-library",
+ "androidx.legacy_legacy-support-v4",
+ ],
+ resource_dirs: ["res"],
+ asset_dirs: ["assets"],
+ min_sdk_version: "23",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ manifest: "api25/AndroidManifest.xml",
+}
+
+android_test {
+ name: "CtsDeviceAndProfileOwnerApp",
+ defaults: ["cts_defaults"],
+ platform_apis: true,
+ srcs: ["src/**/*.java"],
+ libs: [
+ "android.test.runner.stubs",
+ "android.test.base.stubs",
+ ],
+ static_libs: [
+ "compatibility-device-util-axt",
+ "ctstestrunner-axt",
+ "ub-uiautomator",
+ "cts-security-test-support-library",
+ "androidx.legacy_legacy-support-v4",
+ ],
+ resource_dirs: ["res"],
+ asset_dirs: ["assets"],
+ min_sdk_version: "23",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "arcts",
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ manifest: "latest/AndroidManifest.xml",
+}
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/Android.mk b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/Android.mk
deleted file mode 100644
index 3c2b52b..0000000
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/Android.mk
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := truth-prebuilt
-
-# Build the test APKs using their own makefiles
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api23/Android.mk b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api23/Android.mk
deleted file mode 100644
index 5527f6b..0000000
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api23/Android.mk
+++ /dev/null
@@ -1,53 +0,0 @@
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsDeviceAndProfileOwnerApp23
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
-
-LOCAL_JAVA_LIBRARIES := \
- android.test.runner.stubs \
- android.test.base.stubs \
-
-LOCAL_USE_AAPT2 := true
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util-axt \
- ctstestrunner-axt \
- ub-uiautomator \
- cts-security-test-support-library \
- truth-prebuilt
-
-LOCAL_STATIC_ANDROID_LIBRARIES := \
- androidx.legacy_legacy-support-v4
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/../res
-
-LOCAL_ASSET_DIR := $(LOCAL_PATH)/../assets
-
-LOCAL_MIN_SDK_VERSION := 23
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api25/Android.mk b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api25/Android.mk
deleted file mode 100644
index d161a90..0000000
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api25/Android.mk
+++ /dev/null
@@ -1,53 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsDeviceAndProfileOwnerApp25
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
-
-LOCAL_JAVA_LIBRARIES := \
- android.test.runner.stubs \
- android.test.base.stubs \
-
-LOCAL_USE_AAPT2 := true
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util-axt \
- ctstestrunner-axt \
- ub-uiautomator \
- cts-security-test-support-library \
- truth-prebuilt
-
-LOCAL_STATIC_ANDROID_LIBRARIES := \
- androidx.legacy_legacy-support-v4
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/../res
-
-LOCAL_ASSET_DIR := $(LOCAL_PATH)/../assets
-
-LOCAL_MIN_SDK_VERSION := 23
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/latest/Android.mk b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/latest/Android.mk
deleted file mode 100644
index 3f761f2..0000000
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/latest/Android.mk
+++ /dev/null
@@ -1,53 +0,0 @@
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsDeviceAndProfileOwnerApp
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
-
-LOCAL_JAVA_LIBRARIES := \
- android.test.runner.stubs \
- android.test.base.stubs \
-
-LOCAL_USE_AAPT2 := true
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- compatibility-device-util-axt \
- ctstestrunner-axt \
- ub-uiautomator \
- cts-security-test-support-library \
- truth-prebuilt
-
-LOCAL_STATIC_ANDROID_LIBRARIES := \
- androidx.legacy_legacy-support-v4
-
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/../res
-
-LOCAL_ASSET_DIR := $(LOCAL_PATH)/../assets
-
-LOCAL_MIN_SDK_VERSION := 23
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := arcts cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/Android.bp b/hostsidetests/devicepolicy/app/DeviceOwner/Android.bp
new file mode 100644
index 0000000..1ceedb2
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/Android.bp
@@ -0,0 +1,49 @@
+// 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.
+
+android_test {
+ name: "CtsDeviceOwnerApp",
+ defaults: ["cts_defaults"],
+ platform_apis: true,
+ srcs: [
+ "src/**/*.java",
+ "src/**/I*.aidl",
+ ],
+ aidl: {
+ local_include_dirs: ["src"],
+ },
+ libs: [
+ "android.test.runner.stubs",
+ "junit",
+ "android.test.base.stubs",
+ "bouncycastle-unbundled",
+ ],
+ static_libs: [
+ "ctstestrunner-axt",
+ "compatibility-device-util-axt",
+ "androidx.test.rules",
+ "cts-security-test-support-library",
+ "testng",
+ "truth-prebuilt",
+ "androidx.legacy_legacy-support-v4",
+ ],
+ min_sdk_version: "21",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "arcts",
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/Android.mk b/hostsidetests/devicepolicy/app/DeviceOwner/Android.mk
deleted file mode 100644
index 69bb7b2..0000000
--- a/hostsidetests/devicepolicy/app/DeviceOwner/Android.mk
+++ /dev/null
@@ -1,60 +0,0 @@
-# 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_PACKAGE_NAME := CtsDeviceOwnerApp
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) \
- $(call all-Iaidl-files-under, src)
-
-LOCAL_AIDL_INCLUDES := $(LOCAL_PATH)/src
-
-LOCAL_JAVA_LIBRARIES := \
- android.test.runner.stubs \
- junit \
- android.test.base.stubs \
- bouncycastle-unbundled
-
-LOCAL_USE_AAPT2 := true
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner-axt \
- compatibility-device-util-axt \
- androidx.test.rules \
- cts-security-test-support-library \
- testng \
- truth-prebuilt
-
-LOCAL_STATIC_ANDROID_LIBRARIES := \
- androidx.legacy_legacy-support-v4
-
-LOCAL_MIN_SDK_VERSION := 21
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := arcts cts vts general-tests
-
-# Code coverage puts us over the dex limit, so enable multi-dex for coverage-enabled builds
-ifeq (true,$(EMMA_INSTRUMENT))
-LOCAL_DX_FLAGS := --multi-dex
-endif # EMMA_INSTRUMENT
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/IntentReceiver/Android.bp b/hostsidetests/devicepolicy/app/IntentReceiver/Android.bp
new file mode 100644
index 0000000..42a73623
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/IntentReceiver/Android.bp
@@ -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.
+
+android_test {
+ name: "CtsIntentReceiverApp",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ libs: [
+ "android.test.runner.stubs",
+ "android.test.base.stubs",
+ ],
+ static_libs: [
+ "androidx.legacy_legacy-support-v4",
+ "ctstestrunner-axt",
+ ],
+ sdk_version: "current",
+ min_sdk_version: "19",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "arcts",
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
diff --git a/hostsidetests/devicepolicy/app/IntentReceiver/Android.mk b/hostsidetests/devicepolicy/app/IntentReceiver/Android.mk
deleted file mode 100644
index 9017fb1..0000000
--- a/hostsidetests/devicepolicy/app/IntentReceiver/Android.mk
+++ /dev/null
@@ -1,39 +0,0 @@
-# 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_PACKAGE_NAME := CtsIntentReceiverApp
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- androidx.legacy_legacy-support-v4 \
- ctstestrunner-axt
-
-LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 19
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := arcts cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/IntentSender/Android.bp b/hostsidetests/devicepolicy/app/IntentSender/Android.bp
new file mode 100644
index 0000000..2e385c6
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/IntentSender/Android.bp
@@ -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.
+
+android_test {
+ name: "CtsIntentSenderApp",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ libs: [
+ "android.test.runner.stubs",
+ "android.test.base.stubs",
+ ],
+ static_libs: [
+ "ctstestrunner-axt",
+ "ub-uiautomator",
+ "androidx.legacy_legacy-support-v4",
+ ],
+ sdk_version: "current",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "arcts",
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
diff --git a/hostsidetests/devicepolicy/app/IntentSender/Android.mk b/hostsidetests/devicepolicy/app/IntentSender/Android.mk
deleted file mode 100644
index 196e192..0000000
--- a/hostsidetests/devicepolicy/app/IntentSender/Android.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-# 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_PACKAGE_NAME := CtsIntentSenderApp
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_USE_AAPT2 := true
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner-axt \
- ub-uiautomator
-
-LOCAL_STATIC_ANDROID_LIBRARIES := \
- androidx.legacy_legacy-support-v4
-
-LOCAL_SDK_VERSION := current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := arcts cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
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 cfd83af..45032a4 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
@@ -55,6 +55,10 @@
public static final String SIMPLE_APP_PACKAGE = "com.android.cts.launcherapps.simpleapp";
private static final String NO_LAUNCHABLE_ACTIVITY_APP_PACKAGE =
"com.android.cts.nolaunchableactivityapp";
+ private static final String NO_COMPONENT_APP_PACKAGE =
+ "com.android.cts.nocomponentapp";
+ private static final String NO_PERMISSION_APP_PACKAGE =
+ "com.android.cts.nopermissionapp";
private static final String SYNTHETIC_APP_DETAILS_ACTIVITY = "android.app.AppDetailsActivity";
@@ -258,35 +262,22 @@
assertActivityInjected(MANAGED_PROFILE_PKG);
}
- private void assertActivityInjected(String targetPackage) {
- List<LauncherActivityInfo> activities = mLauncherApps.getActivityList(null, mUser);
- boolean noLaunchableActivityAppFound = false;
- for (LauncherActivityInfo activity : activities) {
- if (!activity.getUser().equals(mUser)) {
- continue;
- }
- ComponentName compName = activity.getComponentName();
- if (compName.getPackageName().equals(targetPackage)) {
- noLaunchableActivityAppFound = true;
- // make sure it points to the synthetic app details activity
- assertEquals(activity.getName(), SYNTHETIC_APP_DETAILS_ACTIVITY);
- // make sure it's both exported and enabled
- try {
- PackageManager pm = mInstrumentation.getContext().getPackageManager();
- ActivityInfo ai = pm.getActivityInfo(compName, /*flags=*/ 0);
- assertTrue("Component " + compName + " is not enabled", ai.enabled);
- assertTrue("Component " + compName + " is not exported", ai.exported);
- } catch (NameNotFoundException e) {
- fail("Package " + compName.getPackageName() + " not found.");
- }
- }
- }
- assertTrue(noLaunchableActivityAppFound);
+ public void testNoComponentAppNotInjected() throws Exception {
+ // NoComponentApp is installed for duration of this test - make sure
+ // it's NOT present on the activity list
+ assertInjectedActivityNotFound(NO_COMPONENT_APP_PACKAGE);
}
- public void testNoTestAppInjectedActivityFound() throws Exception {
- // NoLaunchableActivityApp is installed for duration of this test - make sure
+ public void testNoPermissionAppNotInjected() throws Exception {
+ // NoPermissionApp is installed for duration of this test - make sure
// it's NOT present on the activity list
+ assertInjectedActivityNotFound(NO_PERMISSION_APP_PACKAGE);
+ }
+
+ public void testDoPoNoTestAppInjectedActivityFound() throws Exception {
+ // NoLaunchableActivityApp is installed for duration of this test - make sure
+ // it's NOT present on the activity list For example, DO / PO mode won't show icons.
+ // This test is being called by DeviceOwnerTest.
assertInjectedActivityNotFound(NO_LAUNCHABLE_ACTIVITY_APP_PACKAGE);
}
@@ -294,19 +285,6 @@
assertInjectedActivityNotFound(MANAGED_PROFILE_PKG);
}
- private void assertInjectedActivityNotFound(String targetPackage) {
- List<LauncherActivityInfo> activities = mLauncherApps.getActivityList(null, mUser);
- for (LauncherActivityInfo activity : activities) {
- if (!activity.getUser().equals(mUser)) {
- continue;
- }
- ComponentName compName = activity.getComponentName();
- if (compName.getPackageName().equals(targetPackage)) {
- fail("Injected activity found: " + compName.flattenToString());
- }
- }
- }
-
public void testNoSystemAppHasSyntheticAppDetailsActivityInjected() throws Exception {
List<LauncherActivityInfo> activities = mLauncherApps.getActivityList(null, mUser);
for (LauncherActivityInfo activity : activities) {
@@ -347,6 +325,32 @@
}
}
+ private void assertActivityInjected(String targetPackage) {
+ List<LauncherActivityInfo> activities = mLauncherApps.getActivityList(null, mUser);
+ boolean noLaunchableActivityAppFound = false;
+ for (LauncherActivityInfo activity : activities) {
+ if (!activity.getUser().equals(mUser)) {
+ continue;
+ }
+ ComponentName compName = activity.getComponentName();
+ if (compName.getPackageName().equals(targetPackage)) {
+ noLaunchableActivityAppFound = true;
+ // make sure it points to the synthetic app details activity
+ assertEquals(activity.getName(), SYNTHETIC_APP_DETAILS_ACTIVITY);
+ // make sure it's both exported and enabled
+ try {
+ PackageManager pm = mInstrumentation.getContext().getPackageManager();
+ ActivityInfo ai = pm.getActivityInfo(compName, /*flags=*/ 0);
+ assertTrue("Component " + compName + " is not enabled", ai.enabled);
+ assertTrue("Component " + compName + " is not exported", ai.exported);
+ } catch (NameNotFoundException e) {
+ fail("Package " + compName.getPackageName() + " not found.");
+ }
+ }
+ }
+ assertTrue(noLaunchableActivityAppFound);
+ }
+
@FunctionalInterface
public interface ExceptionRunnable {
void run() throws Exception;
@@ -454,4 +458,17 @@
return mResult.waitForResult();
}
+
+ private void assertInjectedActivityNotFound(String targetPackage) {
+ List<LauncherActivityInfo> activities = mLauncherApps.getActivityList(null, mUser);
+ for (LauncherActivityInfo activity : activities) {
+ if (!activity.getUser().equals(mUser)) {
+ continue;
+ }
+ ComponentName compName = activity.getComponentName();
+ if (compName.getPackageName().equals(targetPackage)) {
+ fail("Injected activity found: " + compName.flattenToString());
+ }
+ }
+ }
}
diff --git a/hostsidetests/devicepolicy/app/LauncherTestsSupport/Android.bp b/hostsidetests/devicepolicy/app/LauncherTestsSupport/Android.bp
new file mode 100644
index 0000000..9749563
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/LauncherTestsSupport/Android.bp
@@ -0,0 +1,28 @@
+// 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.
+
+android_test {
+ name: "CtsLauncherAppsTestsSupport",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ libs: ["junit"],
+ sdk_version: "current",
+ min_sdk_version: "21",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
diff --git a/hostsidetests/devicepolicy/app/LauncherTestsSupport/Android.mk b/hostsidetests/devicepolicy/app/LauncherTestsSupport/Android.mk
deleted file mode 100644
index 935be3b..0000000
--- a/hostsidetests/devicepolicy/app/LauncherTestsSupport/Android.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-# 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_PACKAGE_NAME := CtsLauncherAppsTestsSupport
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := junit
-
-LOCAL_SDK_VERSION := current
-LOCAL_MIN_SDK_VERSION := 21
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/Android.bp b/hostsidetests/devicepolicy/app/ManagedProfile/Android.bp
new file mode 100644
index 0000000..c2504c9
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/ManagedProfile/Android.bp
@@ -0,0 +1,43 @@
+// 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.
+
+android_test {
+ name: "CtsManagedProfileApp",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ libs: [
+ "android.test.runner.stubs",
+ "junit",
+ "android.test.base.stubs",
+ ],
+ static_libs: [
+ "ctstestrunner-axt",
+ "compatibility-device-util-axt",
+ "ub-uiautomator",
+ "androidx.test.rules",
+ "guava",
+ "truth-prebuilt",
+ "testng",
+ "androidx.legacy_legacy-support-v4",
+ ],
+ sdk_version: "test_current",
+ min_sdk_version: "27",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "arcts",
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/Android.mk b/hostsidetests/devicepolicy/app/ManagedProfile/Android.mk
deleted file mode 100644
index b2d9325..0000000
--- a/hostsidetests/devicepolicy/app/ManagedProfile/Android.mk
+++ /dev/null
@@ -1,49 +0,0 @@
-# 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_PACKAGE_NAME := CtsManagedProfileApp
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs junit android.test.base.stubs
-
-LOCAL_USE_AAPT2 := true
-
-LOCAL_STATIC_JAVA_LIBRARIES = \
- ctstestrunner-axt \
- compatibility-device-util-axt \
- ub-uiautomator \
- androidx.test.rules \
- guava \
- truth-prebuilt \
- testng
-
-LOCAL_STATIC_ANDROID_LIBRARIES := \
- androidx.legacy_legacy-support-v4
-
-LOCAL_SDK_VERSION := test_current
-LOCAL_MIN_SDK_VERSION := 27
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := arcts cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/MeteredDataTestApp/Android.bp b/hostsidetests/devicepolicy/app/MeteredDataTestApp/Android.bp
new file mode 100644
index 0000000..0fefa1a
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/MeteredDataTestApp/Android.bp
@@ -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.
+
+android_test {
+ name: "CtsMeteredDataTestApp",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ // Tag this module as a cts test artifact
+ test_suites: [
+ "arcts",
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ sdk_version: "current",
+}
diff --git a/hostsidetests/devicepolicy/app/MeteredDataTestApp/Android.mk b/hostsidetests/devicepolicy/app/MeteredDataTestApp/Android.mk
deleted file mode 100644
index a63c410b..0000000
--- a/hostsidetests/devicepolicy/app/MeteredDataTestApp/Android.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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)
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := optional
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsMeteredDataTestApp
-
-LOCAL_SDK_VERSION := current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := arcts cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
\ No newline at end of file
diff --git a/hostsidetests/devicepolicy/app/NoLaunchableActivityApp/Android.bp b/hostsidetests/devicepolicy/app/NoLaunchableActivityApp/Android.bp
new file mode 100644
index 0000000..1336e86
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/NoLaunchableActivityApp/Android.bp
@@ -0,0 +1,34 @@
+// 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.
+
+android_test {
+ name: "CtsNoLaunchableActivityApp",
+ // Don't include this package in any target
+ // When built, explicitly put it in the data partition.
+ dex_preopt: {
+ enabled: false,
+ },
+ optimize: {
+ enabled: false,
+ },
+ srcs: ["src/**/*.java"],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ "cts_instant",
+ ],
+ sdk_version: "current",
+}
diff --git a/hostsidetests/devicepolicy/app/NoLaunchableActivityApp/Android.mk b/hostsidetests/devicepolicy/app/NoLaunchableActivityApp/Android.mk
deleted file mode 100644
index c3a2e9f..0000000
--- a/hostsidetests/devicepolicy/app/NoLaunchableActivityApp/Android.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
-
-LOCAL_PACKAGE_NAME := CtsNoLaunchableActivityApp
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/NoLaunchableActivityApp/AndroidManifest.xml b/hostsidetests/devicepolicy/app/NoLaunchableActivityApp/AndroidManifest.xml
index 7b8b808..59f3767 100755
--- a/hostsidetests/devicepolicy/app/NoLaunchableActivityApp/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/NoLaunchableActivityApp/AndroidManifest.xml
@@ -17,7 +17,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.cts.nolaunchableactivityapp">
-
+ <uses-permission android:name="android.permission.INTERNET" />
<application>
<service android:name=".EmptyService" android:enabled="true"></service>
</application>
diff --git a/hostsidetests/devicepolicy/app/NoLaunchableActivityApp/no_component_AndroidManifest.xml b/hostsidetests/devicepolicy/app/NoLaunchableActivityApp/no_component_AndroidManifest.xml
new file mode 100755
index 0000000..a48cb1d
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/NoLaunchableActivityApp/no_component_AndroidManifest.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.cts.nocomponentapp">
+
+ <uses-permission android:name="android.permission.INTERNET" />
+ <application />
+
+</manifest>
+
diff --git a/hostsidetests/devicepolicy/app/NoLaunchableActivityApp/no_permission_AndroidManifest.xml b/hostsidetests/devicepolicy/app/NoLaunchableActivityApp/no_permission_AndroidManifest.xml
new file mode 100755
index 0000000..9e7ea7a
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/NoLaunchableActivityApp/no_permission_AndroidManifest.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.cts.nopermissionapp">
+ <application>
+ <service android:name=".EmptyService" android:enabled="true"></service>
+ </application>
+
+</manifest>
+
diff --git a/hostsidetests/devicepolicy/app/NotificationSender/Android.bp b/hostsidetests/devicepolicy/app/NotificationSender/Android.bp
new file mode 100644
index 0000000..681225f
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/NotificationSender/Android.bp
@@ -0,0 +1,26 @@
+// 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.
+
+android_test {
+ name: "CtsNotificationSenderApp",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ // Tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ sdk_version: "current",
+}
diff --git a/hostsidetests/devicepolicy/app/NotificationSender/Android.mk b/hostsidetests/devicepolicy/app/NotificationSender/Android.mk
deleted file mode 100644
index 8c7633e..0000000
--- a/hostsidetests/devicepolicy/app/NotificationSender/Android.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := optional
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsNotificationSenderApp
-
-LOCAL_SDK_VERSION := current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/PackageInstaller/Android.bp b/hostsidetests/devicepolicy/app/PackageInstaller/Android.bp
new file mode 100644
index 0000000..249d1fa
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/PackageInstaller/Android.bp
@@ -0,0 +1,37 @@
+// 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.
+
+android_test {
+ name: "CtsPackageInstallerApp",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ libs: [
+ "android.test.runner.stubs",
+ "android.test.base.stubs",
+ ],
+ static_libs: [
+ "androidx.legacy_legacy-support-v4",
+ "ctstestrunner-axt",
+ "ub-uiautomator",
+ ],
+ sdk_version: "test_current",
+ min_sdk_version: "21",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "arcts",
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
diff --git a/hostsidetests/devicepolicy/app/PackageInstaller/Android.mk b/hostsidetests/devicepolicy/app/PackageInstaller/Android.mk
deleted file mode 100644
index 3fb65c9..0000000
--- a/hostsidetests/devicepolicy/app/PackageInstaller/Android.mk
+++ /dev/null
@@ -1,40 +0,0 @@
-# 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_PACKAGE_NAME := CtsPackageInstallerApp
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- androidx.legacy_legacy-support-v4 \
- ctstestrunner-axt \
- ub-uiautomator
-
-LOCAL_SDK_VERSION := test_current
-LOCAL_MIN_SDK_VERSION := 21
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := arcts cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/PasswordComplexity/Android.bp b/hostsidetests/devicepolicy/app/PasswordComplexity/Android.bp
new file mode 100644
index 0000000..678bbb8
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/PasswordComplexity/Android.bp
@@ -0,0 +1,35 @@
+// 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.
+
+android_test {
+ name: "CtsPasswordComplexity",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ static_libs: [
+ "ctstestrunner-axt",
+ "compatibility-device-util-axt",
+ ],
+ libs: [
+ "android.test.runner.stubs",
+ "android.test.base.stubs",
+ ],
+ sdk_version: "test_current",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "arcts",
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
diff --git a/hostsidetests/devicepolicy/app/PasswordComplexity/Android.mk b/hostsidetests/devicepolicy/app/PasswordComplexity/Android.mk
deleted file mode 100644
index 124673b..0000000
--- a/hostsidetests/devicepolicy/app/PasswordComplexity/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-# 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_PACKAGE_NAME := CtsPasswordComplexity
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner-axt \
- compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_SDK_VERSION := current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := arcts cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/PrintingApp/Android.bp b/hostsidetests/devicepolicy/app/PrintingApp/Android.bp
new file mode 100644
index 0000000..17d13f9
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/PrintingApp/Android.bp
@@ -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.
+
+android_test {
+ name: "CtsDevicePolicyPrintingApp",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "arcts",
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
diff --git a/hostsidetests/devicepolicy/app/PrintingApp/Android.mk b/hostsidetests/devicepolicy/app/PrintingApp/Android.mk
deleted file mode 100644
index be8f1f7..0000000
--- a/hostsidetests/devicepolicy/app/PrintingApp/Android.mk
+++ /dev/null
@@ -1,34 +0,0 @@
-# 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)
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := optional
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsDevicePolicyPrintingApp
-
-LOCAL_SDK_VERSION := current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := arcts cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/ProfileOwner/Android.bp b/hostsidetests/devicepolicy/app/ProfileOwner/Android.bp
new file mode 100644
index 0000000..ed9c9bb
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/ProfileOwner/Android.bp
@@ -0,0 +1,37 @@
+// 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.
+
+android_test {
+ name: "CtsProfileOwnerApp",
+ defaults: ["cts_defaults"],
+ platform_apis: true,
+ min_sdk_version: "24",
+ srcs: ["src/**/*.java"],
+ libs: [
+ "android.test.runner.stubs",
+ "junit",
+ "android.test.base.stubs",
+ ],
+ static_libs: [
+ "ctstestrunner-axt",
+ "compatibility-device-util-axt",
+ "ub-uiautomator",
+ ],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
diff --git a/hostsidetests/devicepolicy/app/ProfileOwner/Android.mk b/hostsidetests/devicepolicy/app/ProfileOwner/Android.mk
deleted file mode 100644
index ae6fd8f..0000000
--- a/hostsidetests/devicepolicy/app/ProfileOwner/Android.mk
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsProfileOwnerApp
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_MIN_SDK_VERSION := 24
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := \
- android.test.runner.stubs \
- junit \
- android.test.base.stubs \
-
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- ctstestrunner-axt \
- compatibility-device-util-axt \
- ub-uiautomator
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/SimpleApp/Android.bp b/hostsidetests/devicepolicy/app/SimpleApp/Android.bp
new file mode 100644
index 0000000..64908db
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/SimpleApp/Android.bp
@@ -0,0 +1,27 @@
+// 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.
+
+android_test {
+ name: "CtsSimpleApp",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ // Tag this module as a cts test artifact
+ test_suites: [
+ "arcts",
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ sdk_version: "current",
+}
diff --git a/hostsidetests/devicepolicy/app/SimpleApp/Android.mk b/hostsidetests/devicepolicy/app/SimpleApp/Android.mk
deleted file mode 100644
index b4f6e6d..0000000
--- a/hostsidetests/devicepolicy/app/SimpleApp/Android.mk
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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)
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := optional
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_PACKAGE_NAME := CtsSimpleApp
-
-LOCAL_SDK_VERSION := current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := arcts cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/SimplePreMApp/Android.bp b/hostsidetests/devicepolicy/app/SimplePreMApp/Android.bp
new file mode 100644
index 0000000..84df4e6
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/SimplePreMApp/Android.bp
@@ -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.
+
+// This app is meant for testing device policy permission APIs on legacy apps (pre-M)
+
+android_test {
+ name: "CtsSimplePreMApp",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ sdk_version: "21",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "arcts",
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
diff --git a/hostsidetests/devicepolicy/app/SimplePreMApp/Android.mk b/hostsidetests/devicepolicy/app/SimplePreMApp/Android.mk
deleted file mode 100644
index 4a6e4f8..0000000
--- a/hostsidetests/devicepolicy/app/SimplePreMApp/Android.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-# 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.
-
-# This app is meant for testing device policy permission APIs on legacy apps (pre-M)
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := optional
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsSimplePreMApp
-
-LOCAL_SDK_VERSION := 21
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := arcts cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/SingleAdminApp/Android.bp b/hostsidetests/devicepolicy/app/SingleAdminApp/Android.bp
new file mode 100644
index 0000000..a08331e
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/SingleAdminApp/Android.bp
@@ -0,0 +1,37 @@
+// 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.
+
+android_test {
+ name: "CtsDevicePolicySingleAdminTestApp",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ libs: [
+ "android.test.runner.stubs",
+ "junit",
+ ],
+ static_libs: [
+ "androidx.legacy_legacy-support-v4",
+ "ctstestrunner-axt",
+ "compatibility-device-util-axt",
+ "ub-uiautomator",
+ "androidx.test.rules",
+ ],
+ sdk_version: "test_current",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
diff --git a/hostsidetests/devicepolicy/app/SingleAdminApp/Android.mk b/hostsidetests/devicepolicy/app/SingleAdminApp/Android.mk
deleted file mode 100644
index 66afc53..0000000
--- a/hostsidetests/devicepolicy/app/SingleAdminApp/Android.mk
+++ /dev/null
@@ -1,41 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsDevicePolicySingleAdminTestApp
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs junit
-
-LOCAL_STATIC_JAVA_LIBRARIES = \
- androidx.legacy_legacy-support-v4 \
- ctstestrunner-axt \
- compatibility-device-util-axt \
- ub-uiautomator \
- androidx.test.rules
-
-LOCAL_SDK_VERSION := test_current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/Android.bp b/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/Android.bp
new file mode 100644
index 0000000..8c5eec3
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/Android.bp
@@ -0,0 +1,39 @@
+// 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.
+
+android_test {
+ name: "CtsTransferOwnerIncomingApp",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ libs: [
+ "android.test.runner.stubs",
+ "junit",
+ ],
+ static_libs: [
+ "androidx.legacy_legacy-support-v4",
+ "ctstestrunner-axt",
+ "compatibility-device-util-axt",
+ "ub-uiautomator",
+ "androidx.test.rules",
+ "testng",
+ ],
+ sdk_version: "test_current",
+ min_sdk_version: "24",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
diff --git a/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/Android.mk b/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/Android.mk
deleted file mode 100644
index bbd0ea6..0000000
--- a/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/Android.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsTransferOwnerIncomingApp
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs junit
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- androidx.legacy_legacy-support-v4 \
- ctstestrunner-axt \
- compatibility-device-util-axt \
- ub-uiautomator \
- androidx.test.rules \
- testng
-
-LOCAL_SDK_VERSION := test_current
-LOCAL_MIN_SDK_VERSION := 24
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/Android.bp b/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/Android.bp
new file mode 100644
index 0000000..a68350f
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/Android.bp
@@ -0,0 +1,39 @@
+// 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.
+
+android_test {
+ name: "CtsTransferOwnerOutgoingApp",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ libs: [
+ "android.test.runner.stubs",
+ "junit",
+ ],
+ static_libs: [
+ "androidx.legacy_legacy-support-v4",
+ "ctstestrunner-axt",
+ "compatibility-device-util-axt",
+ "ub-uiautomator",
+ "androidx.test.rules",
+ "testng",
+ ],
+ sdk_version: "test_current",
+ min_sdk_version: "24",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
diff --git a/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/Android.mk b/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/Android.mk
deleted file mode 100644
index ed4652f..0000000
--- a/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/Android.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := CtsTransferOwnerOutgoingApp
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs junit
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
- androidx.legacy_legacy-support-v4 \
- ctstestrunner-axt \
- compatibility-device-util-axt \
- ub-uiautomator \
- androidx.test.rules \
- testng
-
-LOCAL_SDK_VERSION := test_current
-LOCAL_MIN_SDK_VERSION := 24
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/app/WidgetProvider/Android.bp b/hostsidetests/devicepolicy/app/WidgetProvider/Android.bp
new file mode 100644
index 0000000..d0d164d
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/WidgetProvider/Android.bp
@@ -0,0 +1,26 @@
+// 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.
+
+android_test {
+ name: "CtsWidgetProviderApp",
+ defaults: ["cts_defaults"],
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
diff --git a/hostsidetests/devicepolicy/app/WifiConfigCreator/Android.bp b/hostsidetests/devicepolicy/app/WifiConfigCreator/Android.bp
new file mode 100644
index 0000000..b7a774a
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/WifiConfigCreator/Android.bp
@@ -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.
+
+android_test {
+ name: "CtsWifiConfigCreator",
+ defaults: ["cts_defaults"],
+ // Don't include this package in any target.
+ // When built, explicitly put it in the data partition.
+ srcs: ["src/**/*.java"],
+ static_libs: ["compatibility-device-util-axt"],
+ sdk_version: "test_current",
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
diff --git a/hostsidetests/devicepolicy/app/WifiConfigCreator/Android.mk b/hostsidetests/devicepolicy/app/WifiConfigCreator/Android.mk
deleted file mode 100644
index 6ec2c8d..0000000
--- a/hostsidetests/devicepolicy/app/WifiConfigCreator/Android.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-# 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)
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := optional
-
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsWifiConfigCreator
-
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt
-
-LOCAL_SDK_VERSION := current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceOwnerTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceOwnerTest.java
index 3658b5f..d96a3b3 100755
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceOwnerTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceOwnerTest.java
@@ -1108,7 +1108,8 @@
// Run test to check if launcher api shows hidden app
String mSerialNumber = Integer.toString(getUserSerialNumber(USER_SYSTEM));
runDeviceTestsAsUser(BaseLauncherAppsTest.LAUNCHER_TESTS_PKG,
- BaseLauncherAppsTest.LAUNCHER_TESTS_CLASS, "testNoTestAppInjectedActivityFound",
+ BaseLauncherAppsTest.LAUNCHER_TESTS_CLASS,
+ "testDoPoNoTestAppInjectedActivityFound",
mPrimaryUserId, Collections.singletonMap(BaseLauncherAppsTest.PARAM_TEST_USER,
mSerialNumber));
} finally {
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/LauncherAppsProfileTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/LauncherAppsProfileTest.java
index b3a852f..decab02 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/LauncherAppsProfileTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/LauncherAppsProfileTest.java
@@ -128,7 +128,7 @@
// Run tests to check SimpleApp exists in both profile and main user.
runDeviceTestsAsUser(LAUNCHER_TESTS_PKG,
- LAUNCHER_TESTS_CLASS, "testNoTestAppInjectedActivityFound",
+ LAUNCHER_TESTS_CLASS, "testDoPoNoTestAppInjectedActivityFound",
mParentUserId, Collections.singletonMap(PARAM_TEST_USER, mProfileSerialNumber));
runDeviceTestsAsUser(LAUNCHER_TESTS_PKG,
LAUNCHER_TESTS_CLASS, "testNoLaunchableActivityAppHasAppDetailsActivityInjected",
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/LimitAppIconHidingTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/LimitAppIconHidingTest.java
index 4daa778..09d2541 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/LimitAppIconHidingTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/LimitAppIconHidingTest.java
@@ -25,6 +25,10 @@
private static final String LAUNCHER_TESTS_NO_LAUNCHABLE_ACTIVITY_APK =
"CtsNoLaunchableActivityApp.apk";
+ private static final String LAUNCHER_TESTS_NO_COMPONENT_APK =
+ "CtsNoComponentApp.apk";
+ private static final String LAUNCHER_TESTS_NO_PERMISSION_APK =
+ "CtsNoPermissionApp.apk";
private boolean mHasLauncherApps;
private String mSerialNumber;
@@ -55,11 +59,15 @@
protected void installTestApps(int userId) throws Exception {
super.installTestApps(mCurrentUserId);
installAppAsUser(LAUNCHER_TESTS_NO_LAUNCHABLE_ACTIVITY_APK, mCurrentUserId);
+ installAppAsUser(LAUNCHER_TESTS_NO_COMPONENT_APK, mCurrentUserId);
+ installAppAsUser(LAUNCHER_TESTS_NO_PERMISSION_APK, mCurrentUserId);
}
@Override
protected void uninstallTestApps() throws Exception {
super.uninstallTestApps();
+ getDevice().uninstallPackage(LAUNCHER_TESTS_NO_PERMISSION_APK);
+ getDevice().uninstallPackage(LAUNCHER_TESTS_NO_COMPONENT_APK);
getDevice().uninstallPackage(LAUNCHER_TESTS_NO_LAUNCHABLE_ACTIVITY_APK);
}
@@ -81,6 +89,24 @@
mCurrentUserId, Collections.singletonMap(PARAM_TEST_USER, mSerialNumber));
}
+ public void testNoComponentAppNotInjected() throws Exception {
+ if (!mHasLauncherApps) {
+ return;
+ }
+ runDeviceTestsAsUser(LAUNCHER_TESTS_PKG,
+ LAUNCHER_TESTS_CLASS, "testNoComponentAppNotInjected",
+ mCurrentUserId, Collections.singletonMap(PARAM_TEST_USER, mSerialNumber));
+ }
+
+ public void testNoPermissionAppNotInjected() throws Exception {
+ if (!mHasLauncherApps) {
+ return;
+ }
+ runDeviceTestsAsUser(LAUNCHER_TESTS_PKG,
+ LAUNCHER_TESTS_CLASS, "testNoPermissionAppNotInjected",
+ mCurrentUserId, Collections.singletonMap(PARAM_TEST_USER, mSerialNumber));
+ }
+
public void testGetSetSyntheticAppDetailsActivityEnabled() throws Exception {
if (!mHasLauncherApps) {
return;
diff --git a/hostsidetests/gputools/apps/jni/android_gputools_cts_RootlessGpuDebug.cpp b/hostsidetests/gputools/apps/jni/android_gputools_cts_RootlessGpuDebug.cpp
index bdbfd06..8a27b9e 100644
--- a/hostsidetests/gputools/apps/jni/android_gputools_cts_RootlessGpuDebug.cpp
+++ b/hostsidetests/gputools/apps/jni/android_gputools_cts_RootlessGpuDebug.cpp
@@ -84,6 +84,14 @@
EGLint numConfigs;
EGLint format;
+ // Check for the EGL_ANDROID_GLES_layers
+ std::string display_extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
+ if (display_extensions.find("EGL_ANDROID_GLES_layers") == std::string::npos)
+ {
+ result = "Did not find EGL_ANDROID_GLES_layers extension";
+ return result;
+ }
+
if ((display = eglGetDisplay(EGL_DEFAULT_DISPLAY)) == EGL_NO_DISPLAY) {
result = "eglGetDisplay() returned error " + std::to_string(eglGetError());
return result;
diff --git a/hostsidetests/gputools/layers/jni/glesLayer.cpp b/hostsidetests/gputools/layers/jni/glesLayer.cpp
index a053de0..03fe970 100644
--- a/hostsidetests/gputools/layers/jni/glesLayer.cpp
+++ b/hostsidetests/gputools/layers/jni/glesLayer.cpp
@@ -272,12 +272,12 @@
extern "C" {
- __attribute((visibility("default"))) EGLAPI void InitializeLayer(void* layer_id,
+ __attribute((visibility("default"))) EGLAPI void AndroidGLESLayer_Initialize(void* layer_id,
PFNEGLGETNEXTLAYERPROCADDRESSPROC get_next_layer_proc_address) {
return (void)glesLayer_InitializeLayer(layer_id, get_next_layer_proc_address);
}
- __attribute((visibility("default"))) EGLAPI void* GetLayerProcAddress(const char *funcName, EGLFuncPointer next) {
+ __attribute((visibility("default"))) EGLAPI void* AndroidGLESLayer_GetProcAddress(const char *funcName, EGLFuncPointer next) {
return (void*)glesLayer_GetLayerProcAddress(funcName, next);
}
}
diff --git a/hostsidetests/gputools/layers/jni/nullLayer.cpp b/hostsidetests/gputools/layers/jni/nullLayer.cpp
index 7253b5c..c5f84ca 100644
--- a/hostsidetests/gputools/layers/jni/nullLayer.cpp
+++ b/hostsidetests/gputools/layers/jni/nullLayer.cpp
@@ -43,10 +43,10 @@
// Minimal dispatch table for this simple layer
struct {
+ PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
} g_VulkanDispatchTable;
-
template<class T>
VkResult getProperties(const uint32_t count, const T *properties, uint32_t *pCount,
T *pProperties) {
@@ -90,6 +90,44 @@
return getProperties<VkExtensionProperties>(0, NULL, pCount, pProperties);
}
+VKAPI_ATTR VkResult VKAPI_CALL nullCreateDevice(VkPhysicalDevice physicalDevice,
+ const VkDeviceCreateInfo* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkDevice* pDevice) {
+
+ VkLayerDeviceCreateInfo *layerCreateInfo = (VkLayerDeviceCreateInfo*)pCreateInfo->pNext;
+
+ const char* msg = "nullCreateDevice called in nullLayer" xstr(LAYERNAME);
+ ALOGI("%s", msg);
+
+ // Step through the pNext chain until we get to the link function
+ while(layerCreateInfo && (layerCreateInfo->sType != VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO ||
+ layerCreateInfo->function != VK_LAYER_FUNCTION_LINK)) {
+
+ layerCreateInfo = (VkLayerDeviceCreateInfo *)layerCreateInfo->pNext;
+ }
+
+ if(layerCreateInfo == NULL)
+ return VK_ERROR_INITIALIZATION_FAILED;
+
+ // Grab GDPA and GIPA for the next layer
+ PFN_vkGetDeviceProcAddr gdpa = layerCreateInfo->u.pLayerInfo->pfnNextGetDeviceProcAddr;
+ PFN_vkGetInstanceProcAddr gipa = layerCreateInfo->u.pLayerInfo->pfnNextGetInstanceProcAddr;
+
+ // Track them in our dispatch table
+ g_VulkanDispatchTable.GetDeviceProcAddr = gdpa;
+ g_VulkanDispatchTable.GetInstanceProcAddr = gipa;
+
+ // Advance the chain for next layer
+ layerCreateInfo->u.pLayerInfo = layerCreateInfo->u.pLayerInfo->pNext;
+
+ // Call the next layer
+ PFN_vkCreateDevice createFunc = (PFN_vkCreateDevice)gipa(VK_NULL_HANDLE, "vkCreateDevice");
+ VkResult ret = createFunc(physicalDevice, pCreateInfo, pAllocator, pDevice);
+
+ return ret;
+}
+
VKAPI_ATTR VkResult VKAPI_CALL nullCreateInstance(const VkInstanceCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkInstance* pInstance) {
@@ -112,7 +150,7 @@
// Grab GIPA for the next layer
PFN_vkGetInstanceProcAddr gpa = layerCreateInfo->u.pLayerInfo->pfnNextGetInstanceProcAddr;
- // Track is in our dispatch table
+ // Track it in our dispatch table
g_VulkanDispatchTable.GetInstanceProcAddr = gpa;
// Advance the chain for next layer
@@ -125,16 +163,22 @@
return ret;
}
-VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetDeviceProcAddr(VkDevice /* dev */, const char* /* funcName */) {
- return nullptr;
+VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetDeviceProcAddr(VkDevice dev, const char* funcName) {
+
+ const char* targetFunc = "vkCreateDevice";
+ if (!strncmp(targetFunc, funcName, sizeof("vkCreateDevice"))) {
+ return (PFN_vkVoidFunction)nullCreateDevice;
+ }
+
+ return (PFN_vkVoidFunction)g_VulkanDispatchTable.GetDeviceProcAddr(dev, funcName);
}
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL GetInstanceProcAddr(VkInstance instance, const char* funcName) {
- // Our simple layer only intercepts vkCreateInstance
const char* targetFunc = "vkCreateInstance";
- if (!strncmp(targetFunc, funcName, sizeof(&targetFunc)))
+ if (!strncmp(targetFunc, funcName, sizeof("vkCreateInstance"))) {
return (PFN_vkVoidFunction)nullCreateInstance;
+ }
return (PFN_vkVoidFunction)g_VulkanDispatchTable.GetInstanceProcAddr(instance, funcName);
}
diff --git a/hostsidetests/gputools/src/android/gputools/cts/CtsRootlessGpuDebugHostTest.java b/hostsidetests/gputools/src/android/gputools/cts/CtsRootlessGpuDebugHostTest.java
index a2c9b8c..7a1f922 100644
--- a/hostsidetests/gputools/src/android/gputools/cts/CtsRootlessGpuDebugHostTest.java
+++ b/hostsidetests/gputools/src/android/gputools/cts/CtsRootlessGpuDebugHostTest.java
@@ -22,6 +22,7 @@
import java.util.Scanner;
import org.junit.After;
+import org.junit.Before;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -32,7 +33,7 @@
@RunWith(DeviceJUnit4ClassRunner.class)
public class CtsRootlessGpuDebugHostTest implements IDeviceTest {
- public static final String TAG = CtsRootlessGpuDebugHostTest.class.getSimpleName();
+ public static final String TAG = "RootlessGpuDebugDeviceActivity";
/**
* A reference to the device under test.
@@ -117,6 +118,8 @@
private static final String SHIM_B_LIB = "libGLES_" + SHIM_B + ".so";
private static final String SHIM_C_LIB = "libGLES_" + SHIM_C + ".so";
+ private static boolean initialized = false;
+
// This is how long we'll scan the log for a result before giving up. This limit will only
// be reached if something has gone wrong
private static final long LOG_SEARCH_TIMEOUT_MS = 5000;
@@ -126,11 +129,11 @@
}
/**
- * Grab and format the process ID of requested app.
+ * Return current timestamp in format accepted by logcat
*/
- private String getPID(String app) throws Exception {
- String pid = mDevice.executeAdbCommand("shell", "pidof", app);
- return removeWhitespace(pid);
+ private String getTime() throws Exception {
+ // logcat will accept "MM-DD hh:mm:ss.mmm"
+ return mDevice.executeShellCommand("date +\"%m-%d %H:%M:%S.%3N\"");
}
/**
@@ -159,14 +162,14 @@
public int lineNumber;
}
- private LogScanResult scanLog(String pid, String searchString) throws Exception {
- return scanLog(pid, searchString, "");
+ private LogScanResult scanLog(String tag, String searchString, String appStartTime) throws Exception {
+ return scanLog(tag, searchString, "", appStartTime);
}
/**
- * Scan the logcat for requested process ID, returning if found and which line
+ * Scan the logcat for requested layer tag, returning if found and which line
*/
- private LogScanResult scanLog(String pid, String searchString, String endString) throws Exception {
+ private LogScanResult scanLog(String tag, String searchString, String endString, String appStartTime) throws Exception {
LogScanResult result = new LogScanResult();
result.found = false;
@@ -183,8 +186,13 @@
// Give our activity a chance to run and fill the log
Thread.sleep(1000);
- // Pull the logcat for a single process
- String logcat = mDevice.executeAdbCommand("logcat", "-v", "brief", "-d", "--pid=" + pid, "*:V");
+ // Pull the logcat since the app started, filter for tags
+ // This command should look something like this:
+ // adb logcat -d -t '03-27 21:35:05.392' -s "RootlessGpuDebugDeviceActivity,nullLayerC"
+ String logcat = mDevice.executeShellCommand(
+ "logcat -d " +
+ "-t '" + removeWhitespace(appStartTime) + "' " +
+ "-s \"" + tag + "\"");
int lineNumber = 0;
Scanner apkIn = new Scanner(logcat);
while (apkIn.hasNextLine()) {
@@ -232,6 +240,17 @@
}
/**
+ * Clean up before starting any tests
+ */
+ @Before
+ public void init() throws Exception {
+ if (!initialized) {
+ cleanup();
+ initialized = true;
+ }
+ }
+
+ /**
* This is the primary test of the feature. It pushes layers to our debuggable app and ensures they are
* loaded in the correct order.
*/
@@ -256,20 +275,18 @@
"run-as", DEBUG_APP, "--user", Integer.toString(mDevice.getCurrentUser()),
"sh", "-c", "\'cat", ">", LAYER_B_LIB, ";", "chmod", "700", LAYER_B_LIB + "\'");
- // Kick off our DEBUG app
- mDevice.executeAdbCommand("shell", "am", "start", "-n", DEBUG_APP + "/" + ACTIVITY);
- // Give it a chance to start, then grab process ID
- Thread.sleep(1000);
- String pid = getPID(DEBUG_APP);
+ // Kick off our DEBUG app
+ String appStartTime = getTime();
+ mDevice.executeAdbCommand("shell", "am", "start", "-n", DEBUG_APP + "/" + ACTIVITY);
// Check that both layers were loaded, in the correct order
String searchStringA = "nullCreateInstance called in " + LAYER_A;
- LogScanResult resultA = scanLog(pid, searchStringA);
+ LogScanResult resultA = scanLog(TAG + "," + LAYER_A + "," + LAYER_B, searchStringA, appStartTime);
Assert.assertTrue("LayerA was not loaded", resultA.found);
String searchStringB = "nullCreateInstance called in " + LAYER_B;
- LogScanResult resultB = scanLog(pid, searchStringB);
+ LogScanResult resultB = scanLog(TAG + "," + LAYER_A + "," + LAYER_B, searchStringB, appStartTime);
Assert.assertTrue("LayerB was not loaded", resultB.found);
Assert.assertTrue("LayerA should be loaded before LayerB", resultA.lineNumber < resultB.lineNumber);
@@ -296,15 +313,12 @@
"sh", "-c", "\'cat", ">", LAYER_A_LIB, ";", "chmod", "700", LAYER_A_LIB + "\'", "||", "echo", "run-as", "failed");
// Kick off our RELEASE app
+ String appStartTime = getTime();
mDevice.executeAdbCommand("shell", "am", "start", "-n", RELEASE_APP + "/" + ACTIVITY);
- // Give it a chance to start, then grab process ID
- Thread.sleep(1000);
- String pid = getPID(RELEASE_APP);
-
// Ensure we don't load the layer in base dir
String searchStringA = LAYER_A_NAME + "loaded";
- LogScanResult resultA = scanLog(pid, searchStringA);
+ LogScanResult resultA = scanLog(TAG + "," + LAYER_A, searchStringA, appStartTime);
Assert.assertFalse("LayerA was enumerated", resultA.found);
}
@@ -329,15 +343,12 @@
"sh", "-c", "\'cat", ">", LAYER_A_LIB, ";", "chmod", "700", LAYER_A_LIB + "\'");
// Kick off our DEBUG app
+ String appStartTime = getTime();
mDevice.executeAdbCommand("shell", "am", "start", "-n", DEBUG_APP + "/" + ACTIVITY);
- // Give it a chance to start, then grab process ID
- Thread.sleep(1000);
- String pid = getPID(DEBUG_APP);
-
// Ensure we don't load the layer in base dir
String searchStringA = LAYER_A_NAME + "loaded";
- LogScanResult resultA = scanLog(pid, searchStringA);
+ LogScanResult resultA = scanLog(TAG + "," + LAYER_A, searchStringA, appStartTime);
Assert.assertFalse("LayerA was enumerated", resultA.found);
}
@@ -362,15 +373,12 @@
"sh", "-c", "\'cat", ">", LAYER_A_LIB, ";", "chmod", "700", LAYER_A_LIB + "\'");
// Kick off our DEBUG app
+ String appStartTime = getTime();
mDevice.executeAdbCommand("shell", "am", "start", "-n", DEBUG_APP + "/" + ACTIVITY);
- // Give it a chance to start, then grab process ID
- Thread.sleep(1000);
- String pid = getPID(DEBUG_APP);
-
// Ensure we don't load the layer in base dir
String searchStringA = LAYER_A_NAME + "loaded";
- LogScanResult resultA = scanLog(pid, searchStringA);
+ LogScanResult resultA = scanLog(TAG + "," + LAYER_A, searchStringA, appStartTime);
Assert.assertFalse("LayerA was enumerated", resultA.found);
}
@@ -395,15 +403,12 @@
"sh", "-c", "\'cat", ">", LAYER_A_LIB, ";", "chmod", "700", LAYER_A_LIB + "\'");
// Kick off our DEBUG app
+ String appStartTime = getTime();
mDevice.executeAdbCommand("shell", "am", "start", "-n", DEBUG_APP + "/" + ACTIVITY);
- // Give it a chance to start, then grab process ID
- Thread.sleep(1000);
- String pid = getPID(DEBUG_APP);
-
// Ensure layerA is not loaded
String searchStringA = "nullCreateInstance called in " + LAYER_A;
- LogScanResult resultA = scanLog(pid, searchStringA);
+ LogScanResult resultA = scanLog(TAG + "," + LAYER_A, searchStringA, appStartTime);
Assert.assertFalse("LayerA was loaded", resultA.found);
}
@@ -424,19 +429,16 @@
mDevice.executeAdbCommand("shell", "setprop", "debug.vulkan.layers " + LAYER_C_NAME);
// Kick off our RELEASE app
+ String appStartTime = getTime();
mDevice.executeAdbCommand("shell", "am", "start", "-n", RELEASE_APP + "/" + ACTIVITY);
- // Give it a chance to start, then grab process ID
- Thread.sleep(1000);
- String pid = getPID(RELEASE_APP);
-
// Check that both layers were loaded, in the correct order
String searchStringA = LAYER_A_NAME + "loaded";
- LogScanResult resultA = scanLog(pid, searchStringA);
+ LogScanResult resultA = scanLog(TAG + "," + LAYER_A, searchStringA, appStartTime);
Assert.assertFalse("LayerA was enumerated", resultA.found);
String searchStringC = "nullCreateInstance called in " + LAYER_C;
- LogScanResult resultC = scanLog(pid, searchStringC);
+ LogScanResult resultC = scanLog(TAG + "," + LAYER_C, searchStringC, appStartTime);
Assert.assertTrue("LayerC was not loaded", resultC.found);
}
@@ -467,19 +469,16 @@
mDevice.executeAdbCommand("shell", "setprop", "debug.vulkan.layers " + LAYER_B_NAME);
// Kick off our DEBUG app
+ String appStartTime = getTime();
mDevice.executeAdbCommand("shell", "am", "start", "-n", DEBUG_APP + "/" + ACTIVITY);
- // Give it a chance to start, then grab process ID
- Thread.sleep(1000);
- String pid = getPID(DEBUG_APP);
-
// Ensure only layerA is loaded
String searchStringA = "nullCreateInstance called in " + LAYER_A;
- LogScanResult resultA = scanLog(pid, searchStringA);
+ LogScanResult resultA = scanLog(TAG + "," + LAYER_A, searchStringA, appStartTime);
Assert.assertTrue("LayerA was not loaded", resultA.found);
String searchStringB = "nullCreateInstance called in " + LAYER_B;
- LogScanResult resultB = scanLog(pid, searchStringB);
+ LogScanResult resultB = scanLog(TAG + "," + LAYER_B, searchStringB, appStartTime);
Assert.assertFalse("LayerB was loaded", resultB.found);
}
@@ -498,15 +497,12 @@
mDevice.executeAdbCommand("shell", "settings", "put", "global", "gpu_debug_layer_app", LAYERS_APP);
// Kick off our DEBUG app
+ String appStartTime = getTime();
mDevice.executeAdbCommand("shell", "am", "start", "-n", DEBUG_APP + "/" + ACTIVITY);
- // Give it a chance to start, then grab process ID
- Thread.sleep(1000);
- String pid = getPID(DEBUG_APP);
-
// Check that our external layer was loaded
String searchStringC = "nullCreateInstance called in " + LAYER_C;
- LogScanResult resultC = scanLog(pid, searchStringC);
+ LogScanResult resultC = scanLog(TAG + "," + LAYER_C, searchStringC, appStartTime);
Assert.assertTrue("LayerC was not loaded", resultC.found);
}
@@ -534,19 +530,16 @@
"sh", "-c", "\'cat", ">", SHIM_B_LIB, ";", "chmod", "700", SHIM_B_LIB + "\'");
// Kick off our DEBUG app
+ String appStartTime = getTime();
mDevice.executeAdbCommand("shell", "am", "start", "-n", DEBUG_APP + "/" + ACTIVITY);
- // Give it a chance to start, then grab process ID
- Thread.sleep(1000);
- String pid = getPID(DEBUG_APP);
-
// Check that both layers were loaded, in the correct order
String searchStringA = "glesLayer_eglChooseConfig called in " + SHIM_A;
- LogScanResult resultA = scanLog(pid, searchStringA);
+ LogScanResult resultA = scanLog(TAG + "," + SHIM_A + "," + SHIM_B, searchStringA, appStartTime);
Assert.assertTrue("glesLayer1 was not loaded", resultA.found);
String searchStringB = "glesLayer_eglChooseConfig called in " + SHIM_B;
- LogScanResult resultB = scanLog(pid, searchStringB);
+ LogScanResult resultB = scanLog(TAG + "," + SHIM_A + "," + SHIM_B, searchStringB, appStartTime);
Assert.assertTrue("glesLayer2 was not loaded", resultB.found);
Assert.assertTrue("glesLayer1 should be loaded before glesLayer2", resultA.lineNumber < resultB.lineNumber);
@@ -574,15 +567,12 @@
"sh", "-c", "\'cat", ">", SHIM_A_LIB, ";", "chmod", "700", SHIM_A_LIB + "\'", "||", "echo", "run-as", "failed");
// Kick off our RELEASE app
+ String appStartTime = getTime();
mDevice.executeAdbCommand("shell", "am", "start", "-n", RELEASE_APP + "/" + ACTIVITY);
- // Give it a chance to start, then grab process ID
- Thread.sleep(1000);
- String pid = getPID(RELEASE_APP);
-
// Ensure we don't load the layer in base dir
String searchStringA = SHIM_A + " loaded";
- LogScanResult resultA = scanLog(pid, searchStringA);
+ LogScanResult resultA = scanLog(TAG + "," + SHIM_A, searchStringA, appStartTime);
Assert.assertFalse(SHIM_A + " was enumerated", resultA.found);
}
@@ -606,15 +596,12 @@
"sh", "-c", "\'cat", ">", SHIM_A_LIB, ";", "chmod", "700", SHIM_A_LIB + "\'");
// Kick off our DEBUG app
+ String appStartTime = getTime();
mDevice.executeAdbCommand("shell", "am", "start", "-n", DEBUG_APP + "/" + ACTIVITY);
- // Give it a chance to start, then grab process ID
- Thread.sleep(1000);
- String pid = getPID(DEBUG_APP);
-
// Ensure we don't load the layer in base dir
String searchStringA = SHIM_A + " loaded";
- LogScanResult resultA = scanLog(pid, searchStringA);
+ LogScanResult resultA = scanLog(TAG + "," + SHIM_A, searchStringA, appStartTime);
Assert.assertFalse(SHIM_A + " was enumerated", resultA.found);
}
@@ -638,15 +625,12 @@
"sh", "-c", "\'cat", ">", SHIM_A_LIB, ";", "chmod", "700", SHIM_A_LIB + "\'");
// Kick off our DEBUG app
+ String appStartTime = getTime();
mDevice.executeAdbCommand("shell", "am", "start", "-n", DEBUG_APP + "/" + ACTIVITY);
- // Give it a chance to start, then grab process ID
- Thread.sleep(1000);
- String pid = getPID(DEBUG_APP);
-
// Ensure we don't load the layer in base dir
String searchStringA = SHIM_A + " loaded";
- LogScanResult resultA = scanLog(pid, searchStringA);
+ LogScanResult resultA = scanLog(TAG + "," + SHIM_A, searchStringA, appStartTime);
Assert.assertFalse("ShimA was enumerated", resultA.found);
}
@@ -670,15 +654,12 @@
"sh", "-c", "\'cat", ">", SHIM_A_LIB, ";", "chmod", "700", SHIM_A_LIB + "\'");
// Kick off our DEBUG app
+ String appStartTime = getTime();
mDevice.executeAdbCommand("shell", "am", "start", "-n", DEBUG_APP + "/" + ACTIVITY);
- // Give it a chance to start, then grab process ID
- Thread.sleep(1000);
- String pid = getPID(DEBUG_APP);
-
// Ensure layerA is not loaded
String searchStringA = "glesLayer_eglChooseConfig called in " + SHIM_A;
- LogScanResult resultA = scanLog(pid, searchStringA);
+ LogScanResult resultA = scanLog(TAG + "," + SHIM_A, searchStringA, appStartTime);
Assert.assertFalse("ShimA was loaded", resultA.found);
}
@@ -699,19 +680,16 @@
mDevice.executeAdbCommand("shell", "setprop", "debug.gles.layers " + SHIM_C_LIB);
// Kick off our RELEASE app
+ String appStartTime = getTime();
mDevice.executeAdbCommand("shell", "am", "start", "-n", RELEASE_APP + "/" + ACTIVITY);
- // Give it a chance to start, then grab process ID
- Thread.sleep(1000);
- String pid = getPID(RELEASE_APP);
-
// Check that both layers were loaded, in the correct order
String searchStringA = SHIM_A + "loaded";
- LogScanResult resultA = scanLog(pid, searchStringA);
+ LogScanResult resultA = scanLog(TAG + "," + SHIM_A, searchStringA, appStartTime);
Assert.assertFalse("ShimA was enumerated", resultA.found);
String searchStringC = "glesLayer_eglChooseConfig called in " + SHIM_C;
- LogScanResult resultC = scanLog(pid, searchStringC);
+ LogScanResult resultC = scanLog(TAG + "," + SHIM_C, searchStringC, appStartTime);
Assert.assertTrue("ShimC was not loaded", resultC.found);
}
@@ -740,19 +718,16 @@
mDevice.executeAdbCommand("shell", "setprop", "debug.gles.layers " + SHIM_B_LIB);
// Kick off our DEBUG app
+ String appStartTime = getTime();
mDevice.executeAdbCommand("shell", "am", "start", "-n", DEBUG_APP + "/" + ACTIVITY);
- // Give it a chance to start, then grab process ID
- Thread.sleep(1000);
- String pid = getPID(DEBUG_APP);
-
// Ensure only layerA is loaded
String searchStringA = "glesLayer_eglChooseConfig called in " + SHIM_A;
- LogScanResult resultA = scanLog(pid, searchStringA);
+ LogScanResult resultA = scanLog(TAG + "," + SHIM_A, searchStringA, appStartTime);
Assert.assertTrue("ShimA was not loaded", resultA.found);
String searchStringB = "glesLayer_eglChooseConfig called in " + SHIM_B;
- LogScanResult resultB = scanLog(pid, searchStringB);
+ LogScanResult resultB = scanLog(TAG + "," + SHIM_B, searchStringB, appStartTime);
Assert.assertFalse("ShimB was loaded", resultB.found);
}
@@ -771,15 +746,12 @@
mDevice.executeAdbCommand("shell", "settings", "put", "global", "gpu_debug_layer_app", LAYERS_APP);
// Kick off our DEBUG app
+ String appStartTime = getTime();
mDevice.executeAdbCommand("shell", "am", "start", "-n", DEBUG_APP + "/" + ACTIVITY);
- // Give it a chance to start, then grab process ID
- Thread.sleep(1000);
- String pid = getPID(DEBUG_APP);
-
// Check that our external layer was loaded
String searchStringC = "glesLayer_eglChooseConfig called in " + SHIM_C;
- LogScanResult resultC = scanLog(pid, searchStringC);
+ LogScanResult resultC = scanLog(TAG + "," + SHIM_C, searchStringC, appStartTime);
Assert.assertTrue("ShimC was not loaded", resultC.found);
}
diff --git a/hostsidetests/incident/src/com/android/server/cts/BatteryStatsValidationTest.java b/hostsidetests/incident/src/com/android/server/cts/BatteryStatsValidationTest.java
index 90e5d8a..6c28d72 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/inputmethodservice/hostside/OWNERS b/hostsidetests/inputmethodservice/hostside/OWNERS
new file mode 100644
index 0000000..712b215
--- /dev/null
+++ b/hostsidetests/inputmethodservice/hostside/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 34867
+include /tests/inputmethod/OWNERS
diff --git a/hostsidetests/seccomp/AndroidTest.xml b/hostsidetests/seccomp/AndroidTest.xml
index cbfd1c4..9f7b1e6 100644
--- a/hostsidetests/seccomp/AndroidTest.xml
+++ b/hostsidetests/seccomp/AndroidTest.xml
@@ -16,6 +16,11 @@
<configuration description="Config for CTS Sseccomp host test cases">
<option name="test-suite-tag" value="cts" />
<option name="config-descriptor:metadata" key="component" value="misc" />
+ <!-- Run in instant_app mode as well, since application zygotes are available
+ even in that context -->
+ <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
+ <!-- Do test multiple ABIs, because the seccomp filter differs per ABI -->
+ <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsSeccompDeviceApp.apk" />
diff --git a/hostsidetests/seccomp/app/AndroidManifest.xml b/hostsidetests/seccomp/app/AndroidManifest.xml
index 0ebea4f..45943d5 100644
--- a/hostsidetests/seccomp/app/AndroidManifest.xml
+++ b/hostsidetests/seccomp/app/AndroidManifest.xml
@@ -16,7 +16,8 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="android.seccomp.cts.app">
+ package="android.seccomp.cts.app"
+ android:targetSandboxVersion="2">
<application android:zygotePreloadName=".ZygotePreload">
<uses-library android:name="android.test.runner" />
diff --git a/hostsidetests/seccomp/src/android/seccomp/cts/SeccompHostJUnit4DeviceTest.java b/hostsidetests/seccomp/src/android/seccomp/cts/SeccompHostJUnit4DeviceTest.java
index 1d845f9..9b26a38 100644
--- a/hostsidetests/seccomp/src/android/seccomp/cts/SeccompHostJUnit4DeviceTest.java
+++ b/hostsidetests/seccomp/src/android/seccomp/cts/SeccompHostJUnit4DeviceTest.java
@@ -45,7 +45,6 @@
@Before
public void setUp() throws Exception {
- installPackage(TEST_APP);
}
@Test
@@ -65,7 +64,6 @@
@After
public void tearDown() throws Exception {
- uninstallPackage(getDevice(), TEST_PKG);
}
}
diff --git a/hostsidetests/stagedinstall/AndroidTest.xml b/hostsidetests/stagedinstall/AndroidTest.xml
index 4be4042..ab3764c 100644
--- a/hostsidetests/stagedinstall/AndroidTest.xml
+++ b/hostsidetests/stagedinstall/AndroidTest.xml
@@ -16,15 +16,16 @@
<configuration description="Runs the staged install API tests">
<option name="test-suite-tag" value="cts" />
<option name="config-descriptor:metadata" key="component" value="framework" />
+ <!-- Instant apps can't have INSTALL_PACKAGES permission. -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="StagedInstallTest.apk" />
</target_preparer>
<target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
- <option name="run-command" value="mkdir -p /data/local/tmp/ctsstagedinstall" />
<option name="run-command" value="pm uninstall com.android.tests.stagedinstall.testapp.A" />
<option name="run-command" value="pm uninstall com.android.tests.stagedinstall.testapp.B" />
- <option name="teardown-command" value="rm -rf /data/local/tmp/ctsstagedinstall" />
<option name="teardown-command" value="pm uninstall com.android.tests.stagedinstall.testapp.A" />
<option name="teardown-command" value="pm uninstall com.android.tests.stagedinstall.testapp.B" />
</target_preparer>
diff --git a/hostsidetests/stagedinstall/app/AndroidManifest.xml b/hostsidetests/stagedinstall/app/AndroidManifest.xml
index beb0c8b..c327b79 100644
--- a/hostsidetests/stagedinstall/app/AndroidManifest.xml
+++ b/hostsidetests/stagedinstall/app/AndroidManifest.xml
@@ -20,6 +20,11 @@
<application>
<receiver android:name="com.android.tests.stagedinstall.LocalIntentSender"
android:exported="true" />
+ <receiver android:name="com.android.tests.stagedinstall.SessionUpdateBroadcastReceiver">
+ <intent-filter>
+ <action android:name="android.content.pm.action.SESSION_UPDATED"/>
+ </intent-filter>
+ </receiver>
<uses-library android:name="android.test.runner" />
</application>
@@ -27,5 +32,4 @@
<instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
android:targetPackage="com.android.tests.stagedinstall"
android:label="StagedInstall Test"/>
-
</manifest>
\ No newline at end of file
diff --git a/hostsidetests/stagedinstall/app/src/com/android/tests/stagedinstall/SessionUpdateBroadcastReceiver.java b/hostsidetests/stagedinstall/app/src/com/android/tests/stagedinstall/SessionUpdateBroadcastReceiver.java
new file mode 100644
index 0000000..b0e2f93
--- /dev/null
+++ b/hostsidetests/stagedinstall/app/src/com/android/tests/stagedinstall/SessionUpdateBroadcastReceiver.java
@@ -0,0 +1,52 @@
+/*
+ * 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.tests.stagedinstall;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageInstaller;
+import android.util.Log;
+
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+
+public class SessionUpdateBroadcastReceiver extends BroadcastReceiver {
+
+ static final BlockingQueue<PackageInstaller.SessionInfo> sessionBroadcasts
+ = new LinkedBlockingQueue<>();
+
+ private static final String TAG = "StagedInstallTest";
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ PackageInstaller.SessionInfo info =
+ intent.getParcelableExtra(PackageInstaller.EXTRA_SESSION);
+ assertThat(info).isNotNull();
+ Log.i(TAG, "Received SESSION_UPDATED for session " + info.getSessionId()
+ + " isReady:" + info.isStagedSessionReady()
+ + " isFailed:" + info.isStagedSessionFailed()
+ + " isApplied:" + info.isStagedSessionApplied());
+ try {
+ sessionBroadcasts.put(info);
+ } catch (InterruptedException e) {
+
+ }
+ }
+}
diff --git a/hostsidetests/stagedinstall/app/src/com/android/tests/stagedinstall/StagedInstallTest.java b/hostsidetests/stagedinstall/app/src/com/android/tests/stagedinstall/StagedInstallTest.java
index b572746..c9352b7 100644
--- a/hostsidetests/stagedinstall/app/src/com/android/tests/stagedinstall/StagedInstallTest.java
+++ b/hostsidetests/stagedinstall/app/src/com/android/tests/stagedinstall/StagedInstallTest.java
@@ -22,10 +22,8 @@
import static org.junit.Assert.fail;
import android.Manifest;
-import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
-import android.content.IntentFilter;
import android.content.pm.PackageInfo;
import android.content.pm.PackageInstaller;
import android.content.pm.PackageManager;
@@ -48,9 +46,8 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
+import java.time.Duration;
import java.util.List;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
@@ -81,7 +78,11 @@
private static final String TEST_APP_A = "com.android.tests.stagedinstall.testapp.A";
private static final String TEST_APP_B = "com.android.tests.stagedinstall.testapp.B";
- private static final String TEST_STATE_FILE = "/data/local/tmp/ctsstagedinstall/state";
+ private File mTestStateFile = new File(InstrumentationRegistry.getTargetContext().getFilesDir(),
+ "ctsstagedinstall_state");
+
+ private static final Duration WAIT_FOR_SESSION_REMOVED_TTL = Duration.ofSeconds(10);
+ private static final Duration SLEEP_DURATION = Duration.ofMillis(200);
@Before
public void adoptShellPermissions() {
@@ -101,6 +102,11 @@
.dropShellPermissionIdentity();
}
+ @Before
+ public void clearBroadcastReceiver() {
+ SessionUpdateBroadcastReceiver.sessionBroadcasts.clear();
+ }
+
// This is marked as @Test to take advantage of @Before/@After methods of this class. Actual
// purpose of this method to be called before and after each test case of
// com.android.test.stagedinstall.host.StagedInstallTest to reduce tests flakiness.
@@ -119,7 +125,7 @@
}
uninstall(TEST_APP_A);
uninstall(TEST_APP_B);
- Files.deleteIfExists(new File(TEST_STATE_FILE).toPath());
+ Files.deleteIfExists(mTestStateFile.toPath());
}
@Test
@@ -140,12 +146,10 @@
@Test
public void testInstallStagedApk_Commit() throws Exception {
- prepareBroadcastReceiver();
int sessionId = stageSingleApk(
"StagedInstallTestAppAv1.apk").assertSuccessful().getSessionId();
assertThat(getInstalledVersion(TEST_APP_A)).isEqualTo(-1);
waitForIsReadyBroadcast(sessionId);
- unregisterBroadcastReceiver();
assertSessionReady(sessionId);
storeSessionId(sessionId);
}
@@ -159,7 +163,6 @@
@Test
public void testInstallMultipleStagedApks_Commit() throws Exception {
- prepareBroadcastReceiver();
int sessionId = stageMultipleApks(
"StagedInstallTestAppAv1.apk",
"StagedInstallTestAppBv1.apk")
@@ -167,7 +170,6 @@
assertThat(getInstalledVersion(TEST_APP_A)).isEqualTo(-1);
assertThat(getInstalledVersion(TEST_APP_B)).isEqualTo(-1);
waitForIsReadyBroadcast(sessionId);
- unregisterBroadcastReceiver();
// TODO: test that the staged Session is in place and is ready
}
@@ -191,7 +193,6 @@
@Test
public void testAbandonStagedApkBeforeReboot_CommitAndAbandon() throws Exception {
- prepareBroadcastReceiver();
int sessionId = stageSingleApk(
"StagedInstallTestAppAv1.apk").assertSuccessful().getSessionId();
assertThat(getInstalledVersion(TEST_APP_A)).isEqualTo(-1);
@@ -199,9 +200,24 @@
PackageInstaller.SessionInfo session = getStagedSessionInfo(sessionId);
assertThat(session.isStagedSessionReady()).isTrue();
abandonSession(sessionId);
- session = getStagedSessionInfo(sessionId);
+ assertThat(getStagedSessionInfo(sessionId)).isNull();
+ // Allow the session to be removed from PackageInstaller
+ Duration spentWaiting = Duration.ZERO;
+ while (spentWaiting.compareTo(WAIT_FOR_SESSION_REMOVED_TTL) < 0) {
+ session = getSessionInfo(sessionId);
+ if (session == null) {
+ Log.i(TAG, "Done waiting after " + spentWaiting);
+ break;
+ }
+ try {
+ Thread.sleep(SLEEP_DURATION.toMillis());
+ spentWaiting = spentWaiting.plus(SLEEP_DURATION);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new RuntimeException(e);
+ }
+ }
assertThat(session).isNull();
- unregisterBroadcastReceiver();
}
@Test
@@ -209,6 +225,26 @@
assertThat(getInstalledVersion(TEST_APP_A)).isEqualTo(-1);
}
+ @Test
+ public void testGetActiveStagedSesssion() throws Exception {
+ PackageInstaller packageInstaller = getPackageInstaller();
+ int sessionId = stageSingleApk(
+ "StagedInstallTestAppAv1.apk").assertSuccessful().getSessionId();
+ PackageInstaller.SessionInfo session = packageInstaller.getActiveStagedSession();
+ assertThat(session.getSessionId()).isEqualTo(sessionId);
+ }
+
+ @Test
+ public void testGetActiveStagedSessionNoSessionActive() throws Exception {
+ PackageInstaller packageInstaller = getPackageInstaller();
+ PackageInstaller.SessionInfo session = packageInstaller.getActiveStagedSession();
+ assertThat(session).isNull();
+ }
+
+ private static PackageInstaller getPackageInstaller() {
+ return InstrumentationRegistry.getContext().getPackageManager().getPackageInstaller();
+ }
+
private static long getInstalledVersion(String packageName) {
Context context = InstrumentationRegistry.getContext();
PackageManager pm = context.getPackageManager();
@@ -315,14 +351,14 @@
assertion.accept(sessionInfo);
}
- private static void storeSessionId(int sessionId) throws Exception {
- try (BufferedWriter writer = new BufferedWriter(new FileWriter(TEST_STATE_FILE))) {
+ private void storeSessionId(int sessionId) throws Exception {
+ try (BufferedWriter writer = new BufferedWriter(new FileWriter(mTestStateFile))) {
writer.write("" + sessionId);
}
}
- private static int retrieveLastSessionId() throws Exception {
- try (BufferedReader reader = new BufferedReader(new FileReader(TEST_STATE_FILE))) {
+ private int retrieveLastSessionId() throws Exception {
+ try (BufferedReader reader = new BufferedReader(new FileReader(mTestStateFile))) {
return Integer.parseInt(reader.readLine());
}
}
@@ -378,9 +414,6 @@
return null;
}
- /**
- * TODO: after fixing b/128513530, make sure this returns null after session is aborted
- */
private static PackageInstaller.SessionInfo getSessionInfo(int sessionId) {
Context context = InstrumentationRegistry.getContext();
PackageInstaller packageInstaller = context.getPackageManager().getPackageInstaller();
@@ -411,39 +444,12 @@
}
}
- private final BlockingQueue<PackageInstaller.SessionInfo> mSessionBroadcasts
- = new LinkedBlockingQueue<>();
-
- // TODO(b/124897340): Move the receiver to its own class and declare it in manifest, when this
- // will become an explicit broadcast.
- private BroadcastReceiver mSessionUpdateReceiver = null;
- private void prepareBroadcastReceiver() {
- mSessionBroadcasts.clear();
- mSessionUpdateReceiver = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- PackageInstaller.SessionInfo info =
- intent.getParcelableExtra(PackageInstaller.EXTRA_SESSION);
- if (info != null) {
- try {
- mSessionBroadcasts.put(info);
- } catch (InterruptedException e) {
-
- }
- }
- }
- };
- IntentFilter sessionUpdatedFilter =
- new IntentFilter(PackageInstaller.ACTION_SESSION_UPDATED);
- Context context = InstrumentationRegistry.getContext();
- context.registerReceiver(mSessionUpdateReceiver, sessionUpdatedFilter);
- }
-
private void waitForIsReadyBroadcast(int sessionId) {
Log.i(TAG, "Waiting for session " + sessionId + " to be ready");
try {
PackageInstaller.SessionInfo info =
- mSessionBroadcasts.poll(60, TimeUnit.SECONDS);
+ SessionUpdateBroadcastReceiver.sessionBroadcasts.poll(60, TimeUnit.SECONDS);
+ assertThat(info).isNotNull();
assertThat(info.getSessionId()).isEqualTo(sessionId);
assertThat(info.isStagedSessionReady()).isTrue();
assertThat(info.isStagedSessionApplied()).isFalse();
@@ -453,9 +459,4 @@
throw new AssertionError(e);
}
}
-
- private void unregisterBroadcastReceiver() {
- Context context = InstrumentationRegistry.getContext();
- context.unregisterReceiver(mSessionUpdateReceiver);
- }
}
diff --git a/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/StagedInstallTest.java b/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/StagedInstallTest.java
index a704bb8..e64c6b3 100644
--- a/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/StagedInstallTest.java
+++ b/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/StagedInstallTest.java
@@ -98,6 +98,16 @@
runPhase("testInstallMultipleStagedApks_VerifyPostReboot");
}
+ @Test
+ public void testGetActiveStagedSesssion() throws Exception {
+ runPhase("testGetActiveStagedSesssion");
+ }
+
+ @Test
+ public void testGetActiveStagedSessionNoSessionActive() throws Exception {
+ runPhase("testGetActiveStagedSessionNoSessionActive");
+ }
+
private static final class FailedTestLogHook extends TestWatcher {
private final BaseHostJUnit4Test mInstance;
@@ -130,4 +140,4 @@
}
}
-}
\ No newline at end of file
+}
diff --git a/hostsidetests/statsd/src/android/cts/statsd/atom/UidAtomTests.java b/hostsidetests/statsd/src/android/cts/statsd/atom/UidAtomTests.java
index 711e095..8af962c 100644
--- a/hostsidetests/statsd/src/android/cts/statsd/atom/UidAtomTests.java
+++ b/hostsidetests/statsd/src/android/cts/statsd/atom/UidAtomTests.java
@@ -245,10 +245,10 @@
}
String oldRate = getDevice().executeShellCommand(
- "settings get global hidden_api_access_statslog_sampling_rate").trim();
+ "device_config get app_compat hidden_api_access_statslog_sampling_rate").trim();
getDevice().executeShellCommand(
- "settings put global hidden_api_access_statslog_sampling_rate 65536");
+ "device_config put app_compat hidden_api_access_statslog_sampling_rate 65536");
try {
final int atomTag = Atom.HIDDEN_API_USED_FIELD_NUMBER;
@@ -270,10 +270,11 @@
} finally {
if (!oldRate.equals("null")) {
getDevice().executeShellCommand(
- "settings put global hidden_api_access_statslog_sampling_rate " + oldRate);
+ "device_config put app_compat hidden_api_access_statslog_sampling_rate "
+ + oldRate);
} else {
getDevice().executeShellCommand(
- "settings delete global hidden_api_access_statslog_sampling_rate");
+ "device_config delete hidden_api_access_statslog_sampling_rate");
}
}
}
diff --git a/hostsidetests/statsd/src/android/cts/statsd/metric/ValueMetricsTests.java b/hostsidetests/statsd/src/android/cts/statsd/metric/ValueMetricsTests.java
index 4351d4e..a54215b 100644
--- a/hostsidetests/statsd/src/android/cts/statsd/metric/ValueMetricsTests.java
+++ b/hostsidetests/statsd/src/android/cts/statsd/metric/ValueMetricsTests.java
@@ -98,14 +98,14 @@
doAppBreadcrumbReportedStop(3);
// Wait for the metrics to propagate to statsd.
- Thread.sleep(2000);
+ Thread.sleep(1000);
StatsLogReport metricReport = getStatsLogReport();
LogUtil.CLog.d("Got the following value metric data: " + metricReport.toString());
assertEquals(MetricsUtils.VALUE_METRIC_ID, metricReport.getMetricId());
assertTrue(metricReport.hasValueMetrics());
StatsLogReport.ValueMetricDataWrapper valueData = metricReport.getValueMetrics();
- assertEquals(valueData.getDataCount(), 1);
+ assertEquals(1, valueData.getDataCount());
int bucketCount = valueData.getData(0).getBucketInfoCount();
assertTrue(bucketCount > 1);
@@ -117,7 +117,7 @@
assertEquals(0, bucketInfo.getValues(0).getIndex());
totalValue += (int) bucketInfo.getValues(0).getValueLong();
}
- assertEquals(totalValue, 8);
+ assertEquals(8, totalValue);
}
// Test value metric with pulled atoms and across multiple buckets
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/devicepolicy/app/ContentCaptureApp/Android.mk b/tests/DropBoxManager/Android.mk
old mode 100644
new mode 100755
similarity index 80%
rename from hostsidetests/devicepolicy/app/ContentCaptureApp/Android.mk
rename to tests/DropBoxManager/Android.mk
index 1fb6251..ee3e11f
--- a/hostsidetests/devicepolicy/app/ContentCaptureApp/Android.mk
+++ b/tests/DropBoxManager/Android.mk
@@ -22,16 +22,16 @@
# When built, explicitly put it in the data partition.
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_STATIC_JAVA_LIBRARIES := ub-uiautomator androidx.test.rules compatibility-device-util-axt
+
LOCAL_SRC_FILES := $(call all-java-files-under, src)
-# Tag this module as a cts test artifact
LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-LOCAL_PACKAGE_NAME := CtsDevicePolicyContentCaptureApp
+LOCAL_PACKAGE_NAME := CtsDropBoxManagerTestCases
-LOCAL_SDK_VERSION := system_current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := arcts cts vts general-tests
+LOCAL_PRIVATE_PLATFORM_APIS := true
include $(BUILD_CTS_PACKAGE)
+
+include $(call all-makefiles-under, $(LOCAL_PATH))
diff --git a/tests/DropBoxManager/AndroidManifest.xml b/tests/DropBoxManager/AndroidManifest.xml
new file mode 100644
index 0000000..ec17e48
--- /dev/null
+++ b/tests/DropBoxManager/AndroidManifest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.dropboxmanager.cts" >
+
+ <uses-permission android:name="android.permission.READ_LOGS"/>
+
+ <application android:label="Cts Drop Box Manager Test">
+ <uses-library android:name="android.test.runner"/>
+ </application>
+
+ <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
+ android:functionalTest="true"
+ android:targetPackage="android.dropboxmanager.cts"
+ android:label="Drop Box Manager Tests"/>
+</manifest>
diff --git a/tests/DropBoxManager/AndroidTest.xml b/tests/DropBoxManager/AndroidTest.xml
new file mode 100644
index 0000000..af6f407
--- /dev/null
+++ b/tests/DropBoxManager/AndroidTest.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<configuration description="Config for CTS Drop Box Manager test cases">
+ <option name="test-suite-tag" value="cts" />
+ <option name="config-descriptor:metadata" key="component" value="framework" />
+ <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+
+ <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+ <option name="cleanup-apks" value="true" />
+ <option name="test-file-name" value="CtsDropBoxManagerTestCases.apk" />
+ </target_preparer>
+
+ <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
+ <option name="package" value="android.dropboxmanager.cts" />
+ </test>
+
+</configuration>
diff --git a/tests/DropBoxManager/src/android/dropboxmanager/cts/DropBoxTests.java b/tests/DropBoxManager/src/android/dropboxmanager/cts/DropBoxTests.java
new file mode 100644
index 0000000..be21324
--- /dev/null
+++ b/tests/DropBoxManager/src/android/dropboxmanager/cts/DropBoxTests.java
@@ -0,0 +1,350 @@
+/*
+ * 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.dropboxmanager.cts;
+
+import static org.junit.Assert.assertEquals;
+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.content.IntentFilter;
+import android.os.DropBoxManager;
+import android.os.SystemClock;
+import android.platform.test.annotations.AppModeFull;
+import android.provider.Settings;
+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;
+import org.junit.runner.RunWith;
+
+import java.io.IOException;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import com.android.compatibility.common.util.AmUtils;
+import com.android.compatibility.common.util.SystemUtil;
+import com.android.internal.annotations.GuardedBy;
+
+/**
+ * Tests DropBox entry management
+ */
+@LargeTest
+@RunWith(AndroidJUnit4.class)
+public class DropBoxTests {
+ private static final String ENABLED_TAG = "DropBoxTestsEnabledTag";
+ private static final String LOW_PRIORITY_TAG = "DropBoxTestsLowPriorityTag";
+ private static final String ANOTHER_LOW_PRIORITY_TAG = "AnotherDropBoxTestsLowPriorityTag";
+ private static final long BROADCAST_RATE_LIMIT = 1000L;
+ private static final long BROADCAST_DELAY_ALLOWED_ERROR = 200L;
+
+ private static final String SET_RATE_LIMIT_SHELL_COMMAND = "cmd dropbox set-rate-limit {0}";
+ private static final String ADD_LOW_PRIORITY_SHELL_COMMAND =
+ "cmd dropbox add-low-priority {0}";
+ private static final String RESTORE_DEFAULTS_SHELL_COMMAND = "cmd dropbox restore-defaults";
+
+ private Context mContext;
+ private DropBoxManager mDropBoxManager;
+
+ private CountDownLatch mEnabledTagLatch = new CountDownLatch(0);
+ private CountDownLatch mLowPriorityTagLatch = new CountDownLatch(0);
+ private CountDownLatch mAnotherLowPriorityTagLatch = new CountDownLatch(0);
+
+ private ArrayList<DropBoxEntryAddedData> mEnabledBuffer;
+ private ArrayList<DropBoxEntryAddedData> mLowPriorityBuffer;
+ private ArrayList<DropBoxEntryAddedData> mAnotherLowPriorityBuffer;
+
+ public static class DropBoxEntryAddedData {
+ String tag;
+ long time;
+ int droppedCount;
+ long received;
+ }
+
+ private final BroadcastReceiver mDropBoxEntryAddedReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ final DropBoxEntryAddedData data = new DropBoxEntryAddedData();
+ data.tag = intent.getStringExtra(DropBoxManager.EXTRA_TAG);
+ data.time = intent.getLongExtra(DropBoxManager.EXTRA_TIME, 0);
+ data.droppedCount = intent.getIntExtra(DropBoxManager.EXTRA_DROPPED_COUNT, 0);
+ data.received = SystemClock.elapsedRealtime();
+ if (ENABLED_TAG.equals(data.tag)) {
+ mEnabledBuffer.add(data);
+ mEnabledTagLatch.countDown();
+ } else if (LOW_PRIORITY_TAG.equals(data.tag)) {
+ mLowPriorityBuffer.add(data);
+ mLowPriorityTagLatch.countDown();
+ } else if (ANOTHER_LOW_PRIORITY_TAG.equals(data.tag)) {
+ mAnotherLowPriorityBuffer.add(data);
+ mAnotherLowPriorityTagLatch.countDown();
+ }
+ }
+ };
+
+ @Before
+ public void setUp() throws Exception {
+ mContext = InstrumentationRegistry.getTargetContext();
+ mDropBoxManager = mContext.getSystemService(DropBoxManager.class);
+
+ AmUtils.waitForBroadcastIdle();
+
+ final IntentFilter intentFilter = new IntentFilter();
+ intentFilter.addAction(DropBoxManager.ACTION_DROPBOX_ENTRY_ADDED);
+ mContext.registerReceiver(mDropBoxEntryAddedReceiver, intentFilter);
+
+ setTagLowPriority(LOW_PRIORITY_TAG);
+ setTagLowPriority(ANOTHER_LOW_PRIORITY_TAG);
+
+ setBroadcastRateLimitSetting(BROADCAST_RATE_LIMIT);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ mContext.unregisterReceiver(mDropBoxEntryAddedReceiver);
+
+ // Restore dropbox defaults
+ restoreDropboxDefaults();
+ }
+
+ private void sendExcessiveDropBoxEntries(String tag, int count, long delayPerEntry)
+ throws Exception {
+ int i = 0;
+ mDropBoxManager.addText(tag, String.valueOf(i++));
+ for (; i < count; i++) {
+ Thread.sleep(delayPerEntry);
+ mDropBoxManager.addText(tag, String.valueOf(i));
+ }
+ }
+
+ /**
+ * A single DropBox entry for a low priority tag should have their
+ * ACTION_DROPBOX_ENTRY_ADDED broadcasts delayed
+ */
+ @Test
+ public void testLowPrioritySingleEntry() throws Exception {
+ final int nLowPriorityEntries = 1;
+
+ mLowPriorityTagLatch = new CountDownLatch(nLowPriorityEntries);
+ mLowPriorityBuffer = new ArrayList(nLowPriorityEntries);
+
+ final long startTime = SystemClock.elapsedRealtime();
+ mDropBoxManager.addText(LOW_PRIORITY_TAG, "test");
+
+ assertTrue(mLowPriorityTagLatch.await(BROADCAST_RATE_LIMIT * 3 / 2,
+ TimeUnit.MILLISECONDS));
+ final long endTime = SystemClock.elapsedRealtime();
+
+ assertEqualsWithinDelta("Broadcast not received at expected time", BROADCAST_RATE_LIMIT,
+ endTime - startTime, BROADCAST_DELAY_ALLOWED_ERROR);
+
+ assertEquals("A single broadcast should be sent for a single low priority dropbox entry",
+ 1, mLowPriorityBuffer.size());
+ DropBoxEntryAddedData data = mLowPriorityBuffer.get(0);
+ assertEquals("Dropped broadcast count should be 0",
+ 0, data.droppedCount);
+ }
+
+ /**
+ * Many contemporary DropBox entries for a low priority tag should have their
+ * ACTION_DROPBOX_ENTRY_ADDED broadcasts collapsed into one broadcast
+ */
+ @Test
+ public void testLowPriorityRapidEntryLimiting() throws Exception {
+ final int nLowPriorityEntries = 10;
+
+ mLowPriorityTagLatch = new CountDownLatch(1);
+ mLowPriorityBuffer = new ArrayList(nLowPriorityEntries * 2);
+
+ // add several low priority entries in quick sucession
+ final long startTime = SystemClock.elapsedRealtime();
+ sendExcessiveDropBoxEntries(LOW_PRIORITY_TAG, nLowPriorityEntries, 0);
+ assertTrue(mLowPriorityTagLatch.await(BROADCAST_RATE_LIMIT * 3 / 2,
+ TimeUnit.MILLISECONDS));
+ final long endTime = SystemClock.elapsedRealtime();
+
+ assertEqualsWithinDelta("Broadcast not received at expected time", BROADCAST_RATE_LIMIT,
+ endTime - startTime, BROADCAST_DELAY_ALLOWED_ERROR);
+
+ assertEquals("Many low priority dropbox entries within the rate limit period should " +
+ "result in 1 broadcast", 1, mLowPriorityBuffer.size());
+ DropBoxEntryAddedData data = mLowPriorityBuffer.get(0);
+ assertEquals("All but one of the low priority broadcasts should have been dropped",
+ nLowPriorityEntries - 1, data.droppedCount);
+ }
+
+ /**
+ * Many DropBox entries for a low priority tag should have their
+ * ACTION_DROPBOX_ENTRY_ADDED broadcasts collapsed into a few broadcast
+ */
+ @Test
+ public void testLowPrioritySustainedRapidEntryLimiting() throws Exception {
+ final int nLowPriorityEntries = 10;
+
+ mLowPriorityTagLatch = new CountDownLatch(2);
+ mLowPriorityBuffer = new ArrayList(nLowPriorityEntries * 2);
+
+ // add several low priority entries across the rate limit period
+ final long startTime = SystemClock.elapsedRealtime();
+ sendExcessiveDropBoxEntries(LOW_PRIORITY_TAG, nLowPriorityEntries,
+ BROADCAST_RATE_LIMIT * 3 / 2 / nLowPriorityEntries);
+ assertTrue(mLowPriorityTagLatch.await(BROADCAST_RATE_LIMIT * 5 / 2,
+ TimeUnit.MILLISECONDS));
+ final long endTime = SystemClock.elapsedRealtime();
+
+ assertEqualsWithinDelta("Broadcast not received at expected time",
+ BROADCAST_RATE_LIMIT * 2, endTime - startTime, BROADCAST_DELAY_ALLOWED_ERROR * 2);
+
+ assertEquals("Many low priority dropbox entries across two rate limit periods should " +
+ "result in 2 broadcasts", 2, mLowPriorityBuffer.size());
+ DropBoxEntryAddedData data = mLowPriorityBuffer.get(0);
+ int droppedCount = data.droppedCount;
+ data = mLowPriorityBuffer.get(1);
+ droppedCount += data.droppedCount;
+ assertEquals("All but two of the low priority broadcasts should have been dropped",
+ nLowPriorityEntries - 2, droppedCount);
+ }
+
+ /**
+ * Many contemporary DropBox entries from multiple low priority tag should have their
+ * ACTION_DROPBOX_ENTRY_ADDED broadcasts collapsed into seperate broadcasts per tag.
+ * Different tags should not interfer with each others' broadcasts
+ */
+ @Test
+ public void testMultipleLowPriorityRateLimiting() throws Exception {
+ final int nLowPriorityEntries = 10;
+ final int nOtherEntries = 10;
+
+ mLowPriorityTagLatch = new CountDownLatch(1);
+ mLowPriorityBuffer = new ArrayList(nLowPriorityEntries * 2);
+ mAnotherLowPriorityTagLatch = new CountDownLatch(1);
+ mAnotherLowPriorityBuffer = new ArrayList(nOtherEntries * 2);
+
+ final long startTimeDelta = BROADCAST_RATE_LIMIT / 2;
+
+ // add several low priority entries across multiple tags
+ sendExcessiveDropBoxEntries(LOW_PRIORITY_TAG, nLowPriorityEntries, 0);
+ Thread.sleep(startTimeDelta);
+ final long startTime = SystemClock.elapsedRealtime();
+ sendExcessiveDropBoxEntries(ANOTHER_LOW_PRIORITY_TAG, nOtherEntries, 0);
+ assertTrue(mAnotherLowPriorityTagLatch.await(BROADCAST_RATE_LIMIT * 3 / 2,
+ TimeUnit.MILLISECONDS));
+ final long endTime = SystemClock.elapsedRealtime();
+
+ assertEqualsWithinDelta("Broadcast not received at expected time", BROADCAST_RATE_LIMIT,
+ endTime - startTime, BROADCAST_DELAY_ALLOWED_ERROR);
+
+ assertEquals("Many low priority dropbox entries within the rate limit period should " +
+ "result in 1 broadcast for " + LOW_PRIORITY_TAG, 1, mLowPriorityBuffer.size());
+ assertEquals("Many low priority dropbox entries within the rate limit period should " +
+ "result in 1 broadcastfor " + ANOTHER_LOW_PRIORITY_TAG, 1,
+ mAnotherLowPriorityBuffer.size());
+ DropBoxEntryAddedData data = mLowPriorityBuffer.get(0);
+ DropBoxEntryAddedData anotherData = mAnotherLowPriorityBuffer.get(0);
+ assertEquals("All but one of the low priority broadcasts should have been dropped for " +
+ LOW_PRIORITY_TAG, nLowPriorityEntries - 1, data.droppedCount);
+ assertEquals("All but one of the low priority broadcasts should have been dropped for " +
+ ANOTHER_LOW_PRIORITY_TAG, nOtherEntries - 1, anotherData.droppedCount);
+
+ final long receivedTimeDelta = anotherData.received - data.received;
+ final long errorMargin = receivedTimeDelta - startTimeDelta;
+
+ // Received time delta should be around start time delta (20% margin of error)
+ if (errorMargin < -startTimeDelta / 5 || errorMargin > startTimeDelta / 5 ) {
+ fail("Multiple low priority entry tags interfered with each others delayed broadcast" +
+ "\nstartTimeDelta = " + String.valueOf(startTimeDelta) +
+ "\nreceivedTimeDelta = " + String.valueOf(receivedTimeDelta));
+ }
+ }
+
+ /**
+ * Broadcasts for regular priority DropBox entries should not be throttled and they should not
+ * interfere with the throttling of low priority Dropbox entry broadcasts.
+ */
+ @Test
+ public void testLowPriorityRateLimitingWithEnabledEntries() throws Exception {
+
+ final int nLowPriorityEntries = 10;
+ final int nEnabledEntries = 10;
+
+ mLowPriorityTagLatch = new CountDownLatch(1);
+ mLowPriorityBuffer = new ArrayList(nLowPriorityEntries * 2);
+ mEnabledTagLatch = new CountDownLatch(nEnabledEntries);
+ mEnabledBuffer = new ArrayList(nEnabledEntries * 2);
+
+ final long startTimeDelta = BROADCAST_RATE_LIMIT / 2;
+
+ final long startTime = SystemClock.elapsedRealtime();
+ // add several low priority and enabled entries
+ sendExcessiveDropBoxEntries(LOW_PRIORITY_TAG, nLowPriorityEntries, 0);
+ sendExcessiveDropBoxEntries(ENABLED_TAG, nEnabledEntries, 0);
+ assertTrue(mLowPriorityTagLatch.await(BROADCAST_RATE_LIMIT * 3 / 2,
+ TimeUnit.MILLISECONDS));
+ final long endTime = SystemClock.elapsedRealtime();
+
+ assertEqualsWithinDelta("Broadcast not received at expected time", BROADCAST_RATE_LIMIT,
+ endTime - startTime, BROADCAST_DELAY_ALLOWED_ERROR);
+
+ assertEquals("Broadcasts for enabled tags should not be limited", nEnabledEntries,
+ mEnabledBuffer.size());
+
+ assertEquals("Many low priority dropbox entries within the rate limit period should " +
+ "result in 1 broadcast for " + LOW_PRIORITY_TAG, 1, mLowPriorityBuffer.size());
+ DropBoxEntryAddedData data = mLowPriorityBuffer.get(0);
+ assertEquals("All but one of the low priority broadcasts should have been dropped " +
+ LOW_PRIORITY_TAG, nLowPriorityEntries - 1, data.droppedCount);
+
+ for (int i = 0; i < nEnabledEntries; i++) {
+ DropBoxEntryAddedData enabledData = mEnabledBuffer.get(i);
+ assertEquals("Enabled tag broadcasts should not be dropped", 0,
+ enabledData.droppedCount);
+ }
+ }
+
+ private void setTagLowPriority(String tag) throws IOException {
+ final String putCmd = MessageFormat.format(ADD_LOW_PRIORITY_SHELL_COMMAND, tag);
+ SystemUtil.runShellCommand(putCmd);
+ }
+
+ private void setBroadcastRateLimitSetting(long period) throws IOException {
+ final String putCmd = MessageFormat.format(SET_RATE_LIMIT_SHELL_COMMAND,
+ String.valueOf(period));
+ SystemUtil.runShellCommand(putCmd);
+ }
+
+ private void restoreDropboxDefaults() throws IOException {
+ SystemUtil.runShellCommand(RESTORE_DEFAULTS_SHELL_COMMAND);
+ }
+
+ private void assertEqualsWithinDelta(String msg, long expected, long actual, long delta) {
+ if (expected - actual > delta || actual - expected > delta) {
+ assertEquals(msg, expected, actual);
+ }
+ }
+}
diff --git a/tests/JobScheduler/src/android/jobscheduler/cts/BatteryConstraintTest.java b/tests/JobScheduler/src/android/jobscheduler/cts/BatteryConstraintTest.java
index f8a4228b..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/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityButtonTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityButtonTest.java
index 5c8cf31..84fb0ef 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityButtonTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityButtonTest.java
@@ -14,6 +14,8 @@
package android.accessibilityservice.cts;
+import static android.accessibilityservice.cts.utils.CtsTestUtils.runIfNotNull;
+
import android.accessibilityservice.AccessibilityButtonController;
import android.app.Instrumentation;
import android.platform.test.annotations.AppModeFull;
@@ -60,7 +62,7 @@
@After
public void tearDown() {
- mService.runOnServiceSync(() -> mService.disableSelf());
+ runIfNotNull(mService, service -> service.runOnServiceSync(service::disableSelf));
}
@Test
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityFingerprintGestureTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityFingerprintGestureTest.java
index a65b41e..1db66a2 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityFingerprintGestureTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityFingerprintGestureTest.java
@@ -14,6 +14,7 @@
package android.accessibilityservice.cts;
+import static android.accessibilityservice.cts.utils.CtsTestUtils.runIfNotNull;
import static android.content.pm.PackageManager.FEATURE_FINGERPRINT;
import static org.junit.Assert.assertFalse;
@@ -78,7 +79,8 @@
@After
public void tearDown() throws Exception {
- mFingerprintGestureService.runOnServiceSync(() -> mFingerprintGestureService.disableSelf());
+ runIfNotNull(mFingerprintGestureService,
+ service -> service.runOnServiceSync(service::disableSelf));
}
@Test
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDetectorTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDetectorTest.java
index c831b8a..24c00ff 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDetectorTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDetectorTest.java
@@ -14,6 +14,7 @@
package android.accessibilityservice.cts;
+import static android.accessibilityservice.cts.utils.CtsTestUtils.runIfNotNull;
import static android.accessibilityservice.cts.utils.GestureUtils.click;
import static android.accessibilityservice.cts.utils.GestureUtils.endTimeOf;
import static android.accessibilityservice.cts.utils.GestureUtils.longClick;
@@ -104,7 +105,7 @@
if (!mHasTouchScreen || !mScreenBigEnough) {
return;
}
- mService.runOnServiceSync(() -> mService.disableSelf());
+ runIfNotNull(mService, service -> service.runOnServiceSync(service::disableSelf));
}
@Test
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDispatchTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDispatchTest.java
index 3814125..757be1b 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDispatchTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDispatchTest.java
@@ -16,6 +16,7 @@
import static android.accessibilityservice.cts.utils.AsyncUtils.await;
import static android.accessibilityservice.cts.utils.AsyncUtils.awaitCancellation;
+import static android.accessibilityservice.cts.utils.CtsTestUtils.runIfNotNull;
import static android.accessibilityservice.cts.utils.GestureUtils.add;
import static android.accessibilityservice.cts.utils.GestureUtils.ceil;
import static android.accessibilityservice.cts.utils.GestureUtils.click;
@@ -136,7 +137,7 @@
return;
}
- mService.runOnServiceSync(() -> mService.disableSelf());
+ runIfNotNull(mService, service -> service.runOnServiceSync(service::disableSelf));
super.tearDown();
}
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityMagnificationTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityMagnificationTest.java
index ebb711b..bffdf96 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityMagnificationTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityMagnificationTest.java
@@ -16,6 +16,8 @@
package android.accessibilityservice.cts;
+import static android.accessibilityservice.cts.utils.CtsTestUtils.runIfNotNull;
+
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.anyFloat;
import static org.mockito.Mockito.eq;
@@ -27,13 +29,10 @@
import android.accessibilityservice.AccessibilityService.MagnificationController.OnMagnificationChangedListener;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.app.Instrumentation;
-import android.content.Context;
import android.graphics.Rect;
import android.graphics.Region;
import android.platform.test.annotations.AppModeFull;
import android.test.InstrumentationTestCase;
-import android.util.DisplayMetrics;
-import android.view.WindowManager;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -64,10 +63,7 @@
@Override
protected void tearDown() throws Exception {
- if (mService != null) {
- mService.runOnServiceSync(() -> mService.disableSelfAndRemove());
- mService = null;
- }
+ runIfNotNull(mService, service -> service.runOnServiceSync(service::disableSelfAndRemove));
super.tearDown();
}
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityOverlayTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityOverlayTest.java
index 8efcb4c..bd053f3 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityOverlayTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityOverlayTest.java
@@ -16,6 +16,8 @@
package android.accessibilityservice.cts;
+import static android.accessibilityservice.cts.utils.CtsTestUtils.runIfNotNull;
+
import static org.junit.Assert.assertTrue;
import android.accessibilityservice.AccessibilityServiceInfo;
@@ -63,7 +65,7 @@
@After
public void tearDown() {
- mService.runOnServiceSync(() -> mService.disableSelf());
+ runIfNotNull(mService, service -> service.runOnServiceSync(service::disableSelf));
}
@Test
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilitySoftKeyboardModesTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilitySoftKeyboardModesTest.java
index b2f2412..c683a8d 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilitySoftKeyboardModesTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilitySoftKeyboardModesTest.java
@@ -16,6 +16,7 @@
import static android.accessibilityservice.AccessibilityService.SHOW_MODE_AUTO;
import static android.accessibilityservice.AccessibilityService.SHOW_MODE_HIDDEN;
import static android.accessibilityservice.AccessibilityService.SHOW_MODE_IGNORE_HARD_KEYBOARD;
+import static android.accessibilityservice.cts.utils.CtsTestUtils.runIfNotNull;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -65,9 +66,7 @@
@After
public void tearDown() throws Exception {
- if (mService != null) {
- mService.runOnServiceSync(() -> mService.disableSelf());
- }
+ runIfNotNull(mService, service -> service.runOnServiceSync(service::disableSelf));
}
@Test
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/MagnificationGestureHandlerTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/MagnificationGestureHandlerTest.java
index 1456b23..df17442 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/MagnificationGestureHandlerTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/MagnificationGestureHandlerTest.java
@@ -18,6 +18,7 @@
import static android.accessibilityservice.cts.utils.AsyncUtils.await;
import static android.accessibilityservice.cts.utils.AsyncUtils.waitOn;
+import static android.accessibilityservice.cts.utils.CtsTestUtils.runIfNotNull;
import static android.accessibilityservice.cts.utils.GestureUtils.add;
import static android.accessibilityservice.cts.utils.GestureUtils.click;
import static android.accessibilityservice.cts.utils.GestureUtils.dispatchGesture;
@@ -139,10 +140,7 @@
setMagnificationEnabled(mOriginalIsMagnificationEnabled);
- if (mService != null) {
- mService.runOnServiceSync(() -> mService.disableSelfAndRemove());
- mService = null;
- }
+ runIfNotNull(mService, service -> service.runOnServiceSync(service::disableSelfAndRemove));
}
@Test
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/ActivityLaunchUtils.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/ActivityLaunchUtils.java
index ff6c8b0..6902c8f 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/ActivityLaunchUtils.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/ActivityLaunchUtils.java
@@ -45,7 +45,9 @@
import com.android.compatibility.common.util.TestUtils;
import java.util.List;
+import java.util.Objects;
import java.util.function.BooleanSupplier;
+import java.util.stream.Collectors;
/**
* Utilities useful when launching an activity to make sure it's all the way on the screen
@@ -168,6 +170,11 @@
}
}
}
+ // List unexpected package names of default home screen that invoking ResolverActivity
+ final CharSequence homePackageNames = resolveInfos.stream()
+ .map(r -> r.activityInfo).filter(Objects::nonNull)
+ .map(a -> a.packageName).collect(Collectors.joining(", "));
+ Log.v(LOG_TAG, "No window matched with package names of home screen: " + homePackageNames);
return false;
}
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/CtsTestUtils.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/CtsTestUtils.java
index 545483b..b159c7d 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/CtsTestUtils.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/CtsTestUtils.java
@@ -17,6 +17,9 @@
package android.accessibilityservice.cts.utils;
+import java.util.Optional;
+import java.util.function.Consumer;
+
public class CtsTestUtils {
private CtsTestUtils() {}
@@ -35,4 +38,8 @@
throw new RuntimeException(e);
}
}
+
+ public static <T> void runIfNotNull(T callee, Consumer<T> action) {
+ Optional.ofNullable(callee).ifPresent(action);
+ }
}
diff --git a/tests/app/Android.mk b/tests/app/Android.mk
index 920a74b..d7e56df 100644
--- a/tests/app/Android.mk
+++ b/tests/app/Android.mk
@@ -45,6 +45,9 @@
LOCAL_PACKAGE_NAME := CtsAppTestCases
+# Disable from Test Mapping Temporarily until b/124731615 is fixed.
+LOCAL_PRESUBMIT_DISABLED := true
+
LOCAL_INSTRUMENTATION_FOR := CtsAppTestStubs
LOCAL_SDK_VERSION := test_current
diff --git a/tests/app/src/android/app/cts/ServiceTest.java b/tests/app/src/android/app/cts/ServiceTest.java
index 33353b3..68901e8 100644
--- a/tests/app/src/android/app/cts/ServiceTest.java
+++ b/tests/app/src/android/app/cts/ServiceTest.java
@@ -38,6 +38,7 @@
import android.os.Binder;
import android.os.Bundle;
import android.os.Handler;
+import android.os.HandlerThread;
import android.os.IBinder;
import android.os.Parcel;
import android.os.ParcelFileDescriptor;
@@ -94,6 +95,8 @@
private Intent mIsolatedService;
private Intent mExternalService;
private Executor mContextMainExecutor;
+ private HandlerThread mBackgroundThread;
+ private Executor mBackgroundThreadExecutor;
private IBinder mStateReceiver;
@@ -147,6 +150,7 @@
private final boolean mSetReporter;
private boolean mMonitor;
private int mCount;
+ private Thread mOnServiceConnectedThread;
public TestConnection(boolean expectDisconnect, boolean setReporter) {
mExpectDisconnect = expectDisconnect;
@@ -158,8 +162,13 @@
mMonitor = v;
}
+ public Thread getOnServiceConnectedThread() {
+ return mOnServiceConnectedThread;
+ }
+
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
+ mOnServiceConnectedThread = Thread.currentThread();
if (mSetReporter) {
Parcel data = Parcel.obtain();
data.writeInterfaceToken(LocalService.SERVICE_LOCAL);
@@ -215,6 +224,7 @@
private int mUid;
private int mPid;
private int mPpid;
+ private Thread mOnServiceConnectedThread;
public IsolatedConnection() {
mUid = mPid = -1;
@@ -344,9 +354,14 @@
return value;
}
+ public Thread getOnServiceConnectedThread() {
+ return mOnServiceConnectedThread;
+ }
+
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
synchronized (this) {
+ mOnServiceConnectedThread = Thread.currentThread();
mService = service;
mUid = getUidIpc();
mPid = getPidIpc();
@@ -649,6 +664,19 @@
mContextMainExecutor = mContext.getMainExecutor();
}
+ private void setupBackgroundThread() {
+ HandlerThread thread = new HandlerThread("ServiceTestBackgroundThread");
+ thread.start();
+ Handler handler = new Handler(thread.getLooper());
+ mBackgroundThread = thread;
+ mBackgroundThreadExecutor = new Executor() {
+ @Override
+ public void execute(Runnable runnable) {
+ handler.post(runnable);
+ }
+ };
+ }
+
@Override
protected void tearDown() throws Exception {
super.tearDown();
@@ -658,6 +686,11 @@
mContext.stopService(mLocalGrantedService);
mContext.stopService(mLocalService_ApplicationHasPermission);
mContext.stopService(mExternalService);
+ if (mBackgroundThread != null) {
+ mBackgroundThread.quitSafely();
+ }
+ mBackgroundThread = null;
+ mBackgroundThreadExecutor = null;
}
private class MockBinder extends Binder {
@@ -742,6 +775,19 @@
bindExpectResult(mLocalService);
}
+ public void testBindServiceWithExecutor() throws Exception {
+ setupBackgroundThread();
+
+ TestConnection conn = new TestConnection(true, false);
+ mExpectedServiceState = STATE_START_1;
+ mContext.bindService(
+ mLocalService, Context.BIND_AUTO_CREATE, mBackgroundThreadExecutor, conn);
+ waitForResultOrThrow(DELAY, EXIST_CONN_TO_RECEIVE_SERVICE);
+ assertEquals(mBackgroundThread, conn.getOnServiceConnectedThread());
+
+ mContext.unbindService(conn);
+ }
+
/* Just the Intent for a foreground service */
private Intent foregroundServiceIntent(int command) {
return new Intent(mLocalForegroundService)
@@ -1168,6 +1214,16 @@
}
}
+ public void testBindIsolatedServiceOnBackgroundThread() throws Exception {
+ setupBackgroundThread();
+ IsolatedConnection conn = new IsolatedConnection();
+ mContext.bindIsolatedService(mIsolatedService, Context.BIND_AUTO_CREATE,
+ "background_instance", mBackgroundThreadExecutor, conn);
+ conn.waitForService(DELAY);
+ assertEquals(mBackgroundThread, conn.getOnServiceConnectedThread());
+ mContext.unbindService(conn);
+ }
+
static final int BINDING_WEAK = 0;
static final int BINDING_STRONG = 1;
static final int BINDING_ANY = -1;
diff --git a/tests/autofillservice/src/android/autofillservice/cts/augmented/AugmentedAutofillAutoActivityLaunchTestCase.java b/tests/autofillservice/src/android/autofillservice/cts/augmented/AugmentedAutofillAutoActivityLaunchTestCase.java
index 43dec19..88c92ed 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/augmented/AugmentedAutofillAutoActivityLaunchTestCase.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/augmented/AugmentedAutofillAutoActivityLaunchTestCase.java
@@ -20,12 +20,8 @@
import android.autofillservice.cts.AbstractAutoFillActivity;
import android.autofillservice.cts.AutoFillServiceTestCase;
-import android.autofillservice.cts.Helper;
import android.autofillservice.cts.augmented.CtsAugmentedAutofillService.AugmentedReplier;
import android.content.AutofillOptions;
-import android.os.SystemClock;
-import android.util.ArraySet;
-import android.util.Log;
import android.view.autofill.AutofillManager;
import org.junit.AfterClass;
@@ -41,9 +37,6 @@
public abstract class AugmentedAutofillAutoActivityLaunchTestCase
<A extends AbstractAutoFillActivity> extends AutoFillServiceTestCase.AutoActivityLaunch<A> {
- private static final String TAG = AugmentedAutofillAutoActivityLaunchTestCase.class
- .getSimpleName();
-
protected static AugmentedReplier sAugmentedReplier;
protected AugmentedUiBot mAugmentedUiBot;
@@ -91,11 +84,6 @@
}
protected CtsAugmentedAutofillService enableAugmentedService() throws InterruptedException {
- return enableAugmentedService(/* whitelistSelf= */ true);
- }
-
- protected CtsAugmentedAutofillService enableAugmentedService(boolean whitelistSelf)
- throws InterruptedException {
if (mServiceWatcher != null) {
throw new IllegalStateException("There Can Be Only One!");
}
@@ -103,16 +91,6 @@
mServiceWatcher = CtsAugmentedAutofillService.setServiceWatcher();
AugmentedHelper.setAugmentedService(CtsAugmentedAutofillService.SERVICE_NAME);
- // TODO(b/124456706): instead of sleeping it should wait for onConnected()
- SystemClock.sleep(1000);
-
- if (whitelistSelf) {
- Log.d(TAG, "Whitelisting " + Helper.MY_PACKAGE + " for augmented autofill");
- final ArraySet<String> packages = new ArraySet<>(1);
- packages.add(Helper.MY_PACKAGE);
- getAutofillManager().setAugmentedAutofillWhitelist(packages, /* activities= */ null);
- }
-
CtsAugmentedAutofillService service = mServiceWatcher.waitOnConnected();
service.waitUntilConnected();
return service;
diff --git a/tests/autofillservice/src/android/autofillservice/cts/augmented/AugmentedAutofillManualActivityLaunchTestCase.java b/tests/autofillservice/src/android/autofillservice/cts/augmented/AugmentedAutofillManualActivityLaunchTestCase.java
index 6caa368..aa65877 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/augmented/AugmentedAutofillManualActivityLaunchTestCase.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/augmented/AugmentedAutofillManualActivityLaunchTestCase.java
@@ -19,12 +19,8 @@
import static android.autofillservice.cts.Helper.disallowOverlays;
import android.autofillservice.cts.AutoFillServiceTestCase;
-import android.autofillservice.cts.Helper;
import android.autofillservice.cts.augmented.CtsAugmentedAutofillService.AugmentedReplier;
import android.content.AutofillOptions;
-import android.os.SystemClock;
-import android.util.ArraySet;
-import android.util.Log;
import android.view.autofill.AutofillManager;
import org.junit.AfterClass;
@@ -40,9 +36,6 @@
public abstract class AugmentedAutofillManualActivityLaunchTestCase
extends AutoFillServiceTestCase.ManualActivityLaunch {
- private static final String TAG = AugmentedAutofillManualActivityLaunchTestCase.class
- .getSimpleName();
-
protected static AugmentedReplier sAugmentedReplier;
protected AugmentedUiBot mAugmentedUiBot;
@@ -98,16 +91,6 @@
mServiceWatcher = CtsAugmentedAutofillService.setServiceWatcher();
AugmentedHelper.setAugmentedService(CtsAugmentedAutofillService.SERVICE_NAME);
- // TODO(b/124456706): instead of sleeping it should wait for onConnected()
- SystemClock.sleep(1000);
-
- if (whitelistSelf) {
- Log.d(TAG, "Whitelisting " + Helper.MY_PACKAGE + " for augmented autofill");
- final ArraySet<String> packages = new ArraySet<>(1);
- packages.add(Helper.MY_PACKAGE);
- getAutofillManager().setAugmentedAutofillWhitelist(packages, /* activities= */ null);
- }
-
CtsAugmentedAutofillService service = mServiceWatcher.waitOnConnected();
service.waitUntilConnected();
return service;
diff --git a/tests/autofillservice/src/android/autofillservice/cts/augmented/CtsAugmentedAutofillService.java b/tests/autofillservice/src/android/autofillservice/cts/augmented/CtsAugmentedAutofillService.java
index f7b2eba..fa2f682 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/augmented/CtsAugmentedAutofillService.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/augmented/CtsAugmentedAutofillService.java
@@ -35,7 +35,9 @@
import android.service.autofill.augmented.FillController;
import android.service.autofill.augmented.FillRequest;
import android.service.autofill.augmented.FillResponse;
+import android.util.ArraySet;
import android.util.Log;
+import android.view.autofill.AutofillManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -128,6 +130,17 @@
sServiceWatcher.mService = this;
sServiceWatcher.mCreated.countDown();
+ Log.d(TAG, "Whitelisting " + Helper.MY_PACKAGE + " for augmented autofill");
+ final ArraySet<String> packages = new ArraySet<>(1);
+ packages.add(Helper.MY_PACKAGE);
+
+ final AutofillManager afm = getApplication().getSystemService(AutofillManager.class);
+ if (afm == null) {
+ addException("No AutofillManager on application context on onConnected()");
+ return;
+ }
+ afm.setAugmentedAutofillWhitelist(packages, /* activities= */ null);
+
if (mConnectedLatch.getCount() == 0) {
addException("already connected: %s", mConnectedLatch);
}
diff --git a/tests/camera/src/android/hardware/camera2/cts/ExtendedCameraCharacteristicsTest.java b/tests/camera/src/android/hardware/camera2/cts/ExtendedCameraCharacteristicsTest.java
index d661ffa..7e80a61 100644
--- a/tests/camera/src/android/hardware/camera2/cts/ExtendedCameraCharacteristicsTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/ExtendedCameraCharacteristicsTest.java
@@ -80,6 +80,8 @@
private static final Size VGA = new Size(640, 480);
private static final Size QVGA = new Size(320, 240);
+ private static final long MIN_BACK_SENSOR_RESOLUTION = 2000000;
+ private static final long MIN_FRONT_SENSOR_RESOLUTION = VGA.getHeight() * VGA.getWidth();
private static final long LOW_LATENCY_THRESHOLD_MS = 200;
private static final float LATENCY_TOLERANCE_FACTOR = 1.1f; // 10% tolerance
private static final int MAX_NUM_IMAGES = 5;
@@ -206,11 +208,36 @@
Rect activeRect = CameraTestUtils.getValueNotNull(
c, CameraCharacteristics.SENSOR_INFO_ACTIVE_ARRAY_SIZE);
- Size activeArraySize = new Size(activeRect.width(), activeRect.height());
+ Size pixelArraySize = CameraTestUtils.getValueNotNull(
+ c, CameraCharacteristics.SENSOR_INFO_PIXEL_ARRAY_SIZE);
+
+ int activeArrayHeight = activeRect.height();
+ int activeArrayWidth = activeRect.width();
+ long sensorResolution = pixelArraySize.getHeight() * pixelArraySize.getWidth() ;
+ Integer lensFacing = c.get(CameraCharacteristics.LENS_FACING);
+ assertNotNull("Can't get lens facing info for camera id: " + mIds[counter], lensFacing);
+
+ // Check that the sensor sizes are atleast what the CDD specifies
+ switch(lensFacing) {
+ case CameraCharacteristics.LENS_FACING_FRONT:
+ assertTrue("Front Sensor resolution should be at least " +
+ MIN_FRONT_SENSOR_RESOLUTION + " pixels, is "+ sensorResolution,
+ sensorResolution >= MIN_FRONT_SENSOR_RESOLUTION);
+ break;
+ case CameraCharacteristics.LENS_FACING_BACK:
+ assertTrue("Back Sensor resolution should be at least "
+ + MIN_BACK_SENSOR_RESOLUTION +
+ " pixels, is "+ sensorResolution,
+ sensorResolution >= MIN_BACK_SENSOR_RESOLUTION);
+ break;
+ default:
+ break;
+ }
+
Integer hwLevel = c.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL);
- if (activeArraySize.getWidth() >= FULLHD.getWidth() &&
- activeArraySize.getHeight() >= FULLHD.getHeight()) {
+ if (activeArrayWidth >= FULLHD.getWidth() &&
+ activeArrayHeight >= FULLHD.getHeight()) {
assertArrayContainsAnyOf(String.format(
"Required FULLHD size not found for format %x for: ID %s",
ImageFormat.JPEG, mIds[counter]), jpegSizes,
@@ -223,8 +250,8 @@
}
}
- if (activeArraySize.getWidth() >= HD.getWidth() &&
- activeArraySize.getHeight() >= HD.getHeight()) {
+ if (activeArrayWidth >= HD.getWidth() &&
+ activeArrayHeight >= HD.getHeight()) {
assertArrayContains(String.format(
"Required HD size not found for format %x for: ID %s",
ImageFormat.JPEG, mIds[counter]), jpegSizes, HD);
@@ -235,8 +262,8 @@
}
}
- if (activeArraySize.getWidth() >= VGA.getWidth() &&
- activeArraySize.getHeight() >= VGA.getHeight()) {
+ if (activeArrayWidth >= VGA.getWidth() &&
+ activeArrayHeight >= VGA.getHeight()) {
assertArrayContains(String.format(
"Required VGA size not found for format %x for: ID %s",
ImageFormat.JPEG, mIds[counter]), jpegSizes, VGA);
@@ -247,8 +274,8 @@
}
}
- if (activeArraySize.getWidth() >= QVGA.getWidth() &&
- activeArraySize.getHeight() >= QVGA.getHeight()) {
+ if (activeArrayWidth >= QVGA.getWidth() &&
+ activeArrayHeight >= QVGA.getHeight()) {
assertArrayContains(String.format(
"Required QVGA size not found for format %x for: ID %s",
ImageFormat.JPEG, mIds[counter]), jpegSizes, QVGA);
diff --git a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerDisplayKeyguardTests.java b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerDisplayKeyguardTests.java
index 6b3df7c..99c9c82 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerDisplayKeyguardTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerDisplayKeyguardTests.java
@@ -21,7 +21,9 @@
import static android.view.WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG;
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.Assume.assumeTrue;
import android.platform.test.annotations.Presubmit;
@@ -30,6 +32,8 @@
import org.junit.Before;
import org.junit.Test;
+import java.util.List;
+
/**
* Display tests that require a keyguard.
*
@@ -68,37 +72,60 @@
}
/**
- * Tests keyguard dialog should shows on external display.
+ * Tests keyguard dialog shows on secondary display.
* @throws Exception
*/
@Test
public void testShowKeyguardDialogOnSecondaryDisplay() throws Exception {
try (final LockScreenSession lockScreenSession = new LockScreenSession();
final VirtualDisplaySession virtualDisplaySession = new VirtualDisplaySession()) {
- final ActivityDisplay newDisplay = virtualDisplaySession.setPublicDisplay(true)
+ final ActivityDisplay publicDisplay = virtualDisplaySession.setPublicDisplay(true)
.createDisplay();
-
lockScreenSession.gotoKeyguard();
- WindowManagerState.WindowState keyguardWindowState =
- mAmWmState.waitForValidProduct(
- this::getKeyguardDialogWindowState, "KeyguardDialog",
- w -> w.isShown() && w.getDisplayId() == newDisplay.mId);
- assertNotNull("KeyguardDialog must show up", keyguardWindowState);
- assertEquals("KeyguardDialog should show on external display", newDisplay.mId,
- keyguardWindowState.getDisplayId());
+ mAmWmState.waitForWithWmState((state) -> isKeyguardOnDisplay(state, publicDisplay.mId),
+ "Waiting for keyguard window to show");
+
+ assertTrue("KeyguardDialog must show on external public display",
+ isKeyguardOnDisplay(mAmWmState.getWmState(), publicDisplay.mId));
// Keyguard dialog mustn't be removed when press back key
pressBackButton();
- keyguardWindowState = mAmWmState.waitForValidProduct(
- this::getKeyguardDialogWindowState, "KeyguardDialog",
- w -> w.isShown() && w.getDisplayId() == newDisplay.mId);
- assertNotNull("KeyguardDialog must show up", keyguardWindowState);
+ mAmWmState.computeState(true);
+ assertTrue("KeyguardDialog must not be removed when press back key",
+ isKeyguardOnDisplay(mAmWmState.getWmState(), publicDisplay.mId));
}
}
- private WindowManagerState.WindowState getKeyguardDialogWindowState() {
- final WindowManagerState wmState = mAmWmState.getWmState();
- wmState.computeState();
- return mAmWmState.getWmState().findFirstWindowWithType(TYPE_KEYGUARD_DIALOG);
+ /**
+ * Tests keyguard dialog cannot be shown on private display.
+ * @throws Exception
+ */
+ @Test
+ public void testNoKeyguardDialogOnPrivateDisplay() throws Exception {
+ try (final LockScreenSession lockScreenSession = new LockScreenSession();
+ final VirtualDisplaySession virtualDisplaySession = new VirtualDisplaySession()) {
+ final ActivityDisplay privateDisplay = virtualDisplaySession.setPublicDisplay(false)
+ .createDisplay();
+ final ActivityDisplay publicDisplay = virtualDisplaySession.setPublicDisplay(true)
+ .createDisplay();
+
+ lockScreenSession.gotoKeyguard();
+ mAmWmState.waitForWithWmState((state) -> isKeyguardOnDisplay(state, publicDisplay.mId),
+ "Waiting for keyguard window to show");
+
+ assertTrue("KeyguardDialog must show on external public display",
+ isKeyguardOnDisplay(mAmWmState.getWmState(), publicDisplay.mId));
+ assertFalse("KeyguardDialog must not show on external private display",
+ isKeyguardOnDisplay(mAmWmState.getWmState(), privateDisplay.mId));
+ }
+ }
+
+ private boolean isKeyguardOnDisplay(WindowManagerState windowManagerState, int displayId) {
+ final List<WindowManagerState.WindowState> states =
+ windowManagerState.getMatchingWindowType(TYPE_KEYGUARD_DIALOG);
+ for (WindowManagerState.WindowState ws : states) {
+ if (ws.getDisplayId() == displayId) return true;
+ }
+ return false;
}
}
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 9acba25..5bd0092 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerPinnedStackTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerPinnedStackTests.java
@@ -97,6 +97,7 @@
import com.android.compatibility.common.util.AppOpsUtils;
import com.android.compatibility.common.util.SystemUtil;
+import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
@@ -140,10 +141,15 @@
private static final int MAX_ASPECT_RATIO_DENOMINATOR = 100;
private static final int ABOVE_MAX_ASPECT_RATIO_NUMERATOR = MAX_ASPECT_RATIO_NUMERATOR + 1;
+ @Before
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ assumeTrue(supportsPip());
+ }
+
@Test
public void testMinimumDeviceSize() throws Exception {
- assumeTrue(supportsPip());
-
mAmWmState.assertDeviceDefaultDisplaySize(
"Devices supporting picture-in-picture must be larger than the default minimum"
+ " task size");
@@ -182,8 +188,6 @@
@Test
public void testNonTappablePipActivity() throws Exception {
- assumeTrue(supportsPip());
-
// Launch the tap-to-finish activity at a specific place
launchActivity(PIP_ACTIVITY,
EXTRA_ENTER_PIP, "true",
@@ -202,8 +206,6 @@
@Test
public void testPinnedStackDefaultBounds() throws Exception {
- assumeTrue(supportsPip());
-
// Launch a PIP activity
launchActivity(PIP_ACTIVITY, EXTRA_ENTER_PIP, "true");
// Wait for animation complete since we are comparing bounds
@@ -242,8 +244,6 @@
@Test
public void testPinnedStackMovementBounds() throws Exception {
- assumeTrue(supportsPip());
-
// Launch a PIP activity
launchActivity(PIP_ACTIVITY, EXTRA_ENTER_PIP, "true");
// Wait for animation complete since we are comparing bounds
@@ -283,8 +283,6 @@
@Test
@FlakyTest // TODO: Reintroduce to presubmit once b/71508234 is resolved.
public void testPinnedStackOutOfBoundsInsetsNonNegative() throws Exception {
- assumeTrue(supportsPip());
-
final WindowManagerState wmState = mAmWmState.getWmState();
// Launch an activity into the pinned stack
@@ -315,8 +313,6 @@
@Test
public void testPinnedStackInBoundsAfterRotation() throws Exception {
- assumeTrue(supportsPip());
-
// Launch an activity into the pinned stack
launchActivity(PIP_ACTIVITY,
EXTRA_ENTER_PIP, "true",
@@ -339,8 +335,6 @@
@Test
public void testEnterPipToOtherOrientation() throws Exception {
- assumeTrue(supportsPip());
-
// Launch a portrait only app on the fullscreen stack
launchActivity(TEST_ACTIVITY,
EXTRA_FIXED_ORIENTATION, String.valueOf(ORIENTATION_PORTRAIT));
@@ -367,8 +361,6 @@
}
private void testEnterPipAspectRatio(int num, int denom) throws Exception {
- assumeTrue(supportsPip());
-
launchActivity(PIP_ACTIVITY,
EXTRA_ENTER_PIP, "true",
EXTRA_ENTER_PIP_ASPECT_RATIO_NUMERATOR, Integer.toString(num),
@@ -394,8 +386,6 @@
}
private void testResizePipAspectRatio(int num, int denom) throws Exception {
- assumeTrue(supportsPip());
-
launchActivity(PIP_ACTIVITY,
EXTRA_ENTER_PIP, "true",
EXTRA_SET_ASPECT_RATIO_NUMERATOR, Integer.toString(num),
@@ -421,8 +411,6 @@
}
private void testEnterPipExtremeAspectRatio(int num, int denom) throws Exception {
- assumeTrue(supportsPip());
-
// Assert that we could not create a pinned stack with an extreme aspect ratio
launchActivity(PIP_ACTIVITY,
EXTRA_ENTER_PIP, "true",
@@ -444,8 +432,6 @@
}
private void testSetPipExtremeAspectRatio(int num, int denom) throws Exception {
- assumeTrue(supportsPip());
-
// Try to resize the a normal pinned stack to an extreme aspect ratio and ensure that
// fails (the aspect ratio remains the same)
launchActivity(PIP_ACTIVITY,
@@ -466,8 +452,6 @@
@Test
public void testDisallowPipLaunchFromStoppedActivity() throws Exception {
- assumeTrue(supportsPip());
-
// Launch the bottom pip activity which will launch a new activity on top and attempt to
// enter pip when it is stopped
launchActivity(PIP_ON_STOP_ACTIVITY);
@@ -481,8 +465,6 @@
@Test
public void testAutoEnterPictureInPicture() throws Exception {
- assumeTrue(supportsPip());
-
// Launch a test activity so that we're not over home
launchActivity(TEST_ACTIVITY);
@@ -498,8 +480,6 @@
@Test
public void testAutoEnterPictureInPictureLaunchActivity() throws Exception {
- assumeTrue(supportsPip());
-
// Launch a test activity so that we're not over home
launchActivity(TEST_ACTIVITY);
@@ -520,8 +500,6 @@
@Test
public void testAutoEnterPictureInPictureFinish() throws Exception {
- assumeTrue(supportsPip());
-
// Launch a test activity so that we're not over home
launchActivity(TEST_ACTIVITY);
@@ -536,8 +514,6 @@
@Test
public void testAutoEnterPictureInPictureAspectRatio() throws Exception {
- assumeTrue(supportsPip());
-
// Launch the PIP activity on pause, and set the aspect ratio
launchActivity(PIP_ACTIVITY,
EXTRA_ENTER_PIP_ON_PAUSE, "true",
@@ -558,8 +534,6 @@
@Test
public void testAutoEnterPictureInPictureOverPip() throws Exception {
- assumeTrue(supportsPip());
-
// Launch another PIP activity
launchActivity(LAUNCH_INTO_PINNED_STACK_PIP_ACTIVITY);
waitForEnterPip(ALWAYS_FOCUSABLE_PIP_ACTIVITY);
@@ -582,8 +556,6 @@
@Test
public void testDisallowMultipleTasksInPinnedStack() throws Exception {
- assumeTrue(supportsPip());
-
// Launch a test activity so that we have multiple fullscreen tasks
launchActivity(TEST_ACTIVITY);
@@ -604,8 +576,6 @@
@Test
public void testPipUnPipOverHome() throws Exception {
- assumeTrue(supportsPip());
-
// Go home
launchHomeActivity();
// Launch an auto pip activity
@@ -623,8 +593,6 @@
@Test
public void testPipUnPipOverApp() throws Exception {
- assumeTrue(supportsPip());
-
// Launch a test activity so that we're not over home
launchActivity(TEST_ACTIVITY);
@@ -643,8 +611,6 @@
@Test
public void testRemovePipWithNoFullscreenStack() throws Exception {
- assumeTrue(supportsPip());
-
// Launch a pip activity
launchActivity(PIP_ACTIVITY, EXTRA_ENTER_PIP, "true");
waitForEnterPip(PIP_ACTIVITY);
@@ -659,8 +625,6 @@
@Test
public void testRemovePipWithVisibleFullscreenStack() throws Exception {
- assumeTrue(supportsPip());
-
// Launch a fullscreen activity, and a pip activity over that
launchActivity(TEST_ACTIVITY);
launchActivity(PIP_ACTIVITY, EXTRA_ENTER_PIP, "true");
@@ -677,8 +641,6 @@
@FlakyTest(bugId = 70746098)
@Test
public void testRemovePipWithHiddenFullscreenStack() throws Exception {
- assumeTrue(supportsPip());
-
// Launch a fullscreen activity, return home and while the fullscreen stack is hidden,
// launch a pip activity over home
launchActivity(TEST_ACTIVITY);
@@ -696,8 +658,6 @@
@Test
public void testMovePipToBackWithNoFullscreenStack() throws Exception {
- assumeTrue(supportsPip());
-
// Start with a clean slate, remove all the stacks but home
removeStacksWithActivityTypes(ALL_ACTIVITY_TYPE_BUT_HOME);
@@ -716,8 +676,6 @@
@FlakyTest(bugId = 70906499)
@Test
public void testMovePipToBackWithVisibleFullscreenStack() throws Exception {
- assumeTrue(supportsPip());
-
// Launch a fullscreen activity, and a pip activity over that
launchActivity(TEST_ACTIVITY);
launchActivity(PIP_ACTIVITY, EXTRA_ENTER_PIP, "true");
@@ -734,8 +692,6 @@
@FlakyTest(bugId = 70906499)
@Test
public void testMovePipToBackWithHiddenFullscreenStack() throws Exception {
- assumeTrue(supportsPip());
-
// Launch a fullscreen activity, return home and while the fullscreen stack is hidden,
// launch a pip activity over home
launchActivity(TEST_ACTIVITY);
@@ -753,8 +709,6 @@
@Test
public void testPinnedStackAlwaysOnTop() throws Exception {
- assumeTrue(supportsPip());
-
// Launch activity into pinned stack and assert it's on top.
launchActivity(PIP_ACTIVITY, EXTRA_ENTER_PIP, "true");
waitForEnterPip(PIP_ACTIVITY);
@@ -774,8 +728,6 @@
@Test
public void testAppOpsDenyPipOnPause() throws Exception {
- assumeTrue(supportsPip());
-
try (final AppOpsSession appOpsSession = new AppOpsSession(PIP_ACTIVITY)) {
// Disable enter-pip and try to enter pip
appOpsSession.setOpToMode(APP_OPS_OP_ENTER_PICTURE_IN_PICTURE, APP_OPS_MODE_IGNORED);
@@ -792,8 +744,6 @@
@Test
public void testEnterPipFromTaskWithMultipleActivities() throws Exception {
- assumeTrue(supportsPip());
-
// Try to enter picture-in-picture from an activity that has more than one activity in the
// task and ensure that it works
launchActivity(LAUNCH_ENTER_PIP_ACTIVITY);
@@ -803,8 +753,6 @@
@Test
public void testEnterPipWithResumeWhilePausingActivityNoStop() throws Exception {
- assumeTrue(supportsPip());
-
/*
* Launch the resumeWhilePausing activity and ensure that the PiP activity did not get
* stopped and actually went into the pinned stack.
@@ -833,8 +781,6 @@
@Test
public void testDisallowEnterPipActivityLocked() throws Exception {
- assumeTrue(supportsPip());
-
launchActivity(PIP_ACTIVITY, EXTRA_ENTER_PIP_ON_PAUSE, "true");
ActivityTask task = mAmWmState.getAmState().getStandardStackByWindowingMode(
WINDOWING_MODE_FULLSCREEN).getTopTask();
@@ -858,8 +804,6 @@
@FlakyTest(bugId = 70328524)
@Test
public void testConfigurationChangeOrderDuringTransition() throws Exception {
- assumeTrue(supportsPip());
-
// Launch a PiP activity and ensure configuration change only happened once, and that the
// configuration change happened after the picture-in-picture and multi-window callbacks
launchActivity(PIP_ACTIVITY);
@@ -907,8 +851,6 @@
@Test
public void testEnterPipInterruptedCallbacks() throws Exception {
- assumeTrue(supportsPip());
-
try (final TransitionAnimationScaleSession transitionAnimationScaleSession =
new TransitionAnimationScaleSession()) {
// Slow down the transition animations for this test
@@ -943,8 +885,6 @@
@Test
public void testStopBeforeMultiWindowCallbacksOnDismiss() throws Exception {
- assumeTrue(supportsPip());
-
// Launch a PiP activity
launchActivity(PIP_ACTIVITY, EXTRA_ENTER_PIP, "true");
// Wait for animation complete so that system has reported pip mode change event to
@@ -978,8 +918,6 @@
@Test
public void testPreventSetAspectRatioWhileExpanding() throws Exception {
- assumeTrue(supportsPip());
-
// Launch the PiP activity
launchActivity(PIP_ACTIVITY, EXTRA_ENTER_PIP, "true");
waitForEnterPip(PIP_ACTIVITY);
@@ -993,8 +931,6 @@
@Test
public void testSetRequestedOrientationWhilePinned() throws Exception {
- assumeTrue(supportsPip());
-
// Launch the PiP activity fixed as portrait, and enter picture-in-picture
launchActivity(PIP_ACTIVITY,
EXTRA_PIP_ORIENTATION, String.valueOf(ORIENTATION_PORTRAIT),
@@ -1014,7 +950,6 @@
@Test
public void testWindowButtonEntersPip() throws Exception {
- assumeTrue(supportsPip());
assumeTrue(!mAmWmState.getAmState().isHomeRecentsComponent());
// Launch the PiP activity trigger the window button, ensure that we have entered PiP
@@ -1026,8 +961,6 @@
@Test
public void testFinishPipActivityWithTaskOverlay() throws Exception {
- assumeTrue(supportsPip());
-
// Launch PiP activity
launchActivity(PIP_ACTIVITY, EXTRA_ENTER_PIP, "true");
waitForEnterPip(PIP_ACTIVITY);
@@ -1049,8 +982,6 @@
@Test
public void testNoResumeAfterTaskOverlayFinishes() throws Exception {
- assumeTrue(supportsPip());
-
// Launch PiP activity
launchActivity(PIP_ACTIVITY, EXTRA_ENTER_PIP, "true");
waitForEnterPip(PIP_ACTIVITY);
@@ -1079,7 +1010,6 @@
@Test
public void testPinnedStackWithDockedStack() throws Exception {
- assumeTrue(supportsPip());
assumeTrue(supportsSplitScreenMultiWindow());
launchActivity(PIP_ACTIVITY, EXTRA_ENTER_PIP, "true");
@@ -1115,8 +1045,6 @@
@Test
public void testLaunchTaskByComponentMatchMultipleTasks() throws Exception {
- assumeTrue(supportsPip());
-
// Launch a fullscreen activity which will launch a PiP activity in a new task with the same
// affinity
launchActivity(TEST_ACTIVITY_WITH_SAME_AFFINITY);
@@ -1140,8 +1068,6 @@
@Test
public void testLaunchTaskByAffinityMatchMultipleTasks() throws Exception {
- assumeTrue(supportsPip());
-
// Launch a fullscreen activity which will launch a PiP activity in a new task with the same
// affinity, and also launch another activity in the same task, while finishing itself. As
// a result, the task will not have a component matching the same activity as what it was
@@ -1173,8 +1099,6 @@
@Test
public void testLaunchTaskByAffinityMatchSingleTask() throws Exception {
- assumeTrue(supportsPip());
-
// Launch an activity into the pinned stack with a fixed affinity
launchActivity(TEST_ACTIVITY_WITH_SAME_AFFINITY,
EXTRA_ENTER_PIP, "true",
@@ -1198,8 +1122,6 @@
@FlakyTest
@Test
public void testDisplayMetricsPinUnpin() throws Exception {
- assumeTrue(supportsPip());
-
separateTestJournal();
launchActivity(TEST_ACTIVITY);
final int defaultWindowingMode = mAmWmState.getAmState()
@@ -1234,8 +1156,6 @@
@Test
public void testEnterPictureInPictureSavePosition() throws Exception {
- assumeTrue(supportsPip());
-
// Ensure we have static shelf offset by running this test over a non-home activity
launchActivity(NO_RELAUNCH_ACTIVITY);
mAmWmState.waitForActivityState(mAmWmState.getAmState().getHomeActivityName(),
@@ -1284,8 +1204,6 @@
@Test
@FlakyTest(bugId = 71792368)
public void testEnterPictureInPictureDiscardSavedPositionOnFinish() throws Exception {
- assumeTrue(supportsPip());
-
// Ensure we have static shelf offset by running this test over a non-home activity
launchActivity(NO_RELAUNCH_ACTIVITY);
mAmWmState.waitForActivityState(mAmWmState.getAmState().getHomeActivityName(),
diff --git a/tests/framework/base/activitymanager/src/android/server/am/lifecycle/ActivityStarterTests.java b/tests/framework/base/activitymanager/src/android/server/am/lifecycle/ActivityStarterTests.java
index 7af6404..f419870 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/lifecycle/ActivityStarterTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/lifecycle/ActivityStarterTests.java
@@ -89,7 +89,10 @@
| Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
final Activity secondLaunchActivity = mFirstActivityTestRule.launchActivity(intent);
- waitAndAssertActivityStates(state(secondLaunchActivity, ON_RESUME));
+ mAmWmState.waitForActivityState(secondLaunchActivity.getComponentName(), STATE_RESUMED);
+ assertEquals("The activity should be started and be resumed",
+ getActivityName(secondLaunchActivity.getComponentName()),
+ mAmWmState.getAmState().getTopActivityName(0));
}
/**
diff --git a/tests/framework/base/windowmanager/AndroidManifest.xml b/tests/framework/base/windowmanager/AndroidManifest.xml
index f5816dd..219594e 100644
--- a/tests/framework/base/windowmanager/AndroidManifest.xml
+++ b/tests/framework/base/windowmanager/AndroidManifest.xml
@@ -20,6 +20,7 @@
android:targetSandboxVersion="2">
<uses-permission android:name="android.permission.CAPTURE_VIDEO_OUTPUT" />
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<application android:label="CtsWindowManagerDeviceTestCases">
<uses-library android:name="android.test.runner"/>
@@ -86,6 +87,11 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
+ <service android:name="android.view.cts.surfacevalidator.LocalMediaProjectionService"
+ android:foregroundServiceType="mediaProjection"
+ android:enabled="true">
+ </service>
+
</application>
<instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
diff --git a/tests/inputmethod/OWNERS b/tests/inputmethod/OWNERS
new file mode 100644
index 0000000..75ffacf
--- /dev/null
+++ b/tests/inputmethod/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 34867
+tarandeep@google.com
+takaoka@google.com
+yukawa@google.com
+*
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 ba0ab0a..c8de00f 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/util/NavigationBarInfo.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/util/NavigationBarInfo.java
@@ -137,7 +137,7 @@
(color, lightNavigationBar) -> getBottomNavigationBarBitmapForActivity(
color, lightNavigationBar, actualBottomInset,
true /* showDimmingDialog */)).getResult()
- == LightNavigationBarVerifier.ResultType.NOT_SUPPORTED;
+ == LightNavigationBarVerifier.ResultType.SUPPORTED;
sInstance = new NavigationBarInfo(
true, actualBottomInset, colorSupported, lightModeSupported, dimmingSupported);
diff --git a/tests/jdwp/Android.bp b/tests/jdwp/Android.bp
new file mode 100644
index 0000000..c51958a
--- /dev/null
+++ b/tests/jdwp/Android.bp
@@ -0,0 +1,34 @@
+// 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.
+
+java_test {
+
+ name: "CtsJdwpTestCases",
+
+ static_libs: ["apache-harmony-jdwp-tests"],
+
+ // Tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+
+ dex_preopt: {
+ enabled: false,
+ },
+ optimize: {
+ enabled: false,
+ },
+}
diff --git a/tests/jdwp/Android.mk b/tests/jdwp/Android.mk
deleted file mode 100644
index a37eff0..0000000
--- a/tests/jdwp/Android.mk
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := CtsJdwpTestCases
-
-LOCAL_STATIC_JAVA_LIBRARIES := apache-harmony-jdwp-tests
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_DEX_PREOPT := false
-LOCAL_PROGUARD_ENABLED := disabled
-
-include $(BUILD_JAVA_LIBRARY)
-
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/jdwp/runner/Android.mk b/tests/jdwp/runner/Android.mk
deleted file mode 100644
index 71388aa..0000000
--- a/tests/jdwp/runner/Android.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-# 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.
-
-include $(call all-subdir-makefiles)
diff --git a/tests/jdwp/runner/device-side/Android.bp b/tests/jdwp/runner/device-side/Android.bp
new file mode 100644
index 0000000..b3f370c
--- /dev/null
+++ b/tests/jdwp/runner/device-side/Android.bp
@@ -0,0 +1,37 @@
+// 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.
+
+java_test_helper_library {
+ name: "cts-dalvik-device-test-runner",
+ installable: true,
+
+ srcs: ["src/**/*.java"],
+
+ dex_preopt: {
+ enabled: false,
+ },
+
+ optimize: {
+ enabled: false,
+ },
+
+ static_libs: ["junit"],
+
+ // Tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+}
diff --git a/tests/jdwp/runner/device-side/Android.mk b/tests/jdwp/runner/device-side/Android.mk
deleted file mode 100644
index 9bfe418..0000000
--- a/tests/jdwp/runner/device-side/Android.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_MODULE := cts-dalvik-device-test-runner
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_STATIC_JAVA_LIBRARIES := junit
-
-# don't include these packages in any target
-LOCAL_MODULE_TAGS := optional
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_JAVA_LIBRARY)
diff --git a/tests/security/Android.bp b/tests/security/Android.bp
new file mode 100644
index 0000000..d9786a8
--- /dev/null
+++ b/tests/security/Android.bp
@@ -0,0 +1,25 @@
+// 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.
+
+java_library {
+ name: "cts-security-test-support-library",
+ static_libs: [
+ "bouncycastle-unbundled",
+ "bouncycastle-bcpkix-unbundled",
+ "guava",
+ "truth-prebuilt",
+ "testng",
+ ],
+ srcs: ["src/**/*.java"],
+}
diff --git a/tests/security/Android.mk b/tests/security/Android.mk
deleted file mode 100755
index 5b0cf00..0000000
--- a/tests/security/Android.mk
+++ /dev/null
@@ -1,26 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-# Don't include this package in any target.
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_STATIC_JAVA_LIBRARIES := bouncycastle-unbundled bouncycastle-bcpkix-unbundled guava truth-prebuilt testng
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_MODULE := cts-security-test-support-library
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/tests/signature/api-check/build_signature_apk.mk b/tests/signature/api-check/build_signature_apk.mk
index 4181827..8696c4d 100644
--- a/tests/signature/api-check/build_signature_apk.mk
+++ b/tests/signature/api-check/build_signature_apk.mk
@@ -61,15 +61,7 @@
cts_signature_module_deps := $(addprefix cts-,$(cts_signature_module_deps))
cts_signature_module_deps := $(subst -all-api-zip,-all.api,$(cts_signature_module_deps))
-ifndef ENABLE_DEFAULT_TEST_LOCATION
-# Construct path to dependency.
-# Join module name directory and file name and prefix with TARGET_OUT_TESTCASES
-LOCAL_ADDITIONAL_DEPENDENCIES += \
- $(addprefix $(TARGET_OUT_TESTCASES)/,\
- $(join $(cts_signature_module_deps),$(addprefix /,$(LOCAL_SIGNATURE_API_FILES))))
-else
LOCAL_REQUIRED_MODULES := $(cts_signature_module_deps)
-endif
LOCAL_DEX_PREOPT := false
LOCAL_PROGUARD_ENABLED := disabled
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 9956c44..0f87bfe 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
@@ -1102,8 +1102,6 @@
final long startTime = System.currentTimeMillis();
// Launch the series of Activities.
launchSubActivities(activitySequence);
-
- mUiDevice.pressHome();
SystemClock.sleep(250);
final long endTime = System.currentTimeMillis();
@@ -1138,8 +1136,8 @@
}
}
assertEquals("Unexpected number of activity resumes", 3, resumes);
- assertEquals("Unexpected number of activity pauses", 3, pauses);
- assertEquals("Unexpected number of activity stops", 3, stops);
+ assertEquals("Unexpected number of activity pauses", 2, pauses);
+ assertEquals("Unexpected number of activity stops", 2, stops);
}
diff --git a/tests/tests/appwidget/OWNERS b/tests/tests/appwidget/OWNERS
new file mode 100644
index 0000000..563e9e8
--- /dev/null
+++ b/tests/tests/appwidget/OWNERS
@@ -0,0 +1,3 @@
+# Bug component: 164335
+adamcohen@google.com
+sunnygoyal@google.com
diff --git a/tests/tests/bionic/Android.mk b/tests/tests/bionic/Android.mk
index ec21b5c..fa95fe9 100644
--- a/tests/tests/bionic/Android.mk
+++ b/tests/tests/bionic/Android.mk
@@ -14,6 +14,7 @@
LOCAL_SHARED_LIBRARIES += \
ld-android \
libdl \
+ libdl_android \
libdl_preempt_test_1 \
libdl_preempt_test_2 \
libdl_test_df_1_global \
diff --git a/tests/tests/content/src/android/content/om/cts/OverlayManagerTest.java b/tests/tests/content/src/android/content/om/cts/OverlayManagerTest.java
index be88afb..7db951d4 100644
--- a/tests/tests/content/src/android/content/om/cts/OverlayManagerTest.java
+++ b/tests/tests/content/src/android/content/om/cts/OverlayManagerTest.java
@@ -16,8 +16,12 @@
package android.content.om.cts;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import android.content.Context;
import android.content.om.IOverlayManager;
@@ -52,11 +56,25 @@
}
@Test
+ public void testSetEnabled() throws Exception {
+ String packageName = "overlay source package name";
+ int userId = UserHandle.myUserId();
+ UserHandle user = UserHandle.of(userId);
+ verify(mMockService, times(0)).setEnabled(packageName, true, userId);
+ when(mMockService.setEnabled(anyString(), any(Boolean.class), anyInt()))
+ .thenReturn(Boolean.TRUE);
+ mManager.setEnabled(packageName, true, user);
+ verify(mMockService, times(1)).setEnabled(packageName, true, userId);
+ }
+
+ @Test
public void testSetEnabledExclusiveInCategory() throws Exception {
String packageName = "overlay source package name";
int userId = UserHandle.myUserId();
UserHandle user = UserHandle.of(userId);
verify(mMockService, times(0)).setEnabledExclusiveInCategory(packageName, userId);
+ when(mMockService.setEnabledExclusiveInCategory(anyString(), anyInt()))
+ .thenReturn(Boolean.TRUE);
mManager.setEnabledExclusiveInCategory(packageName, user);
verify(mMockService, times(1)).setEnabledExclusiveInCategory(packageName, userId);
}
diff --git a/tests/tests/graphics/Android.mk b/tests/tests/graphics/Android.mk
index d3d1046..74cecda 100644
--- a/tests/tests/graphics/Android.mk
+++ b/tests/tests/graphics/Android.mk
@@ -29,7 +29,8 @@
ctsdeviceutillegacy-axt \
ctstestrunner-axt \
androidx.annotation_annotation \
- junit
+ junit \
+ testng
LOCAL_STATIC_ANDROID_LIBRARIES += \
androidx.core_core
diff --git a/tests/tests/graphics/src/android/graphics/cts/BitmapFactoryTest.java b/tests/tests/graphics/src/android/graphics/cts/BitmapFactoryTest.java
index 4185f93..b507bf9 100644
--- a/tests/tests/graphics/src/android/graphics/cts/BitmapFactoryTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/BitmapFactoryTest.java
@@ -18,11 +18,13 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
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.testng.Assert.assertThrows;
import android.content.res.Resources;
import android.graphics.Bitmap;
@@ -399,6 +401,52 @@
assertTrue(pass.isMutable());
}
+ @Test
+ public void testDecodeReuseAttempt() {
+ // BitmapFactory "silently" ignores an immutable inBitmap. (It does print a log message.)
+ BitmapFactory.Options options = new BitmapFactory.Options();
+ options.inMutable = false;
+
+ Bitmap start = BitmapFactory.decodeResource(mRes, R.drawable.start, options);
+ assertFalse(start.isMutable());
+
+ options.inBitmap = start;
+ Bitmap pass = BitmapFactory.decodeResource(mRes, R.drawable.pass, options);
+ assertNotNull(pass);
+ assertNotEquals(start, pass);
+ }
+
+ @Test
+ public void testDecodeReuseRecycled() {
+ BitmapFactory.Options options = new BitmapFactory.Options();
+ options.inMutable = true;
+
+ Bitmap start = BitmapFactory.decodeResource(mRes, R.drawable.start, options);
+ assertNotNull(start);
+ start.recycle();
+
+ options.inBitmap = start;
+
+ assertThrows(IllegalArgumentException.class, () -> {
+ BitmapFactory.decodeResource(mRes, R.drawable.pass, options);
+ });
+ }
+
+ @Test
+ public void testDecodeReuseHardware() {
+ BitmapFactory.Options options = new BitmapFactory.Options();
+ options.inPreferredConfig = Bitmap.Config.HARDWARE;
+
+ Bitmap start = BitmapFactory.decodeResource(mRes, R.drawable.start, options);
+ assertNotNull(start);
+
+ options.inBitmap = start;
+
+ assertThrows(IllegalArgumentException.class, () -> {
+ BitmapFactory.decodeResource(mRes, R.drawable.pass, options);
+ });
+ }
+
/**
* Create bitmap sized to load unscaled resources: start, pass, and alpha
*/
diff --git a/tests/tests/graphics/src/android/graphics/cts/BitmapRegionDecoderTest.java b/tests/tests/graphics/src/android/graphics/cts/BitmapRegionDecoderTest.java
index b828a04..cf839df 100644
--- a/tests/tests/graphics/src/android/graphics/cts/BitmapRegionDecoderTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/BitmapRegionDecoderTest.java
@@ -22,6 +22,7 @@
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import static org.testng.Assert.assertThrows;
import android.content.res.Resources;
import android.graphics.Bitmap;
@@ -626,6 +627,20 @@
decoder.decodeRegion(new Rect(0, 0, TILE_SIZE, TILE_SIZE), opts);
}
+ @Test
+ public void testRecycledBitmapIn() throws IOException {
+ Options opts = new BitmapFactory.Options();
+ Bitmap bitmap = Bitmap.createBitmap(TILE_SIZE, TILE_SIZE, Config.ARGB_8888);
+ bitmap.recycle();
+
+ opts.inBitmap = bitmap;
+ InputStream is = obtainInputStream(RES_IDS[0]);
+ BitmapRegionDecoder decoder = BitmapRegionDecoder.newInstance(is, false);
+ assertThrows(IllegalArgumentException.class, () -> {
+ decoder.decodeRegion(new Rect(0, 0, TILE_SIZE, TILE_SIZE), opts);
+ });
+ }
+
private void compareRegionByRegion(BitmapRegionDecoder decoder,
Options opts, int mseMargin, Bitmap wholeImage) {
int width = decoder.getWidth();
diff --git a/tests/tests/graphics/src/android/graphics/cts/BitmapTest.java b/tests/tests/graphics/src/android/graphics/cts/BitmapTest.java
index 30db277d..ccf79b1 100644
--- a/tests/tests/graphics/src/android/graphics/cts/BitmapTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/BitmapTest.java
@@ -2020,7 +2020,7 @@
Debug.MemoryInfo meminfoEnd = new Debug.MemoryInfo();
int fdCount = -1;
for (int i = 0; i < 2000; i++) {
- if (i == 2) {
+ if (i == 4) {
// Not really the "start" but by having done a couple
// we've fully initialized any state that may be required,
// so memory usage should be stable now
@@ -2031,7 +2031,7 @@
if (i % 100 == 5) {
assertNotLeaking(i, meminfoStart, meminfoEnd);
final int curFdCount = getFdCount();
- if (curFdCount - fdCount > 5) {
+ if (curFdCount - fdCount > 10) {
fail(String.format("FDs leaked. Expected=%d, current=%d, iteration=%d",
fdCount, curFdCount, i));
}
@@ -2039,7 +2039,10 @@
test.run();
}
assertNotLeaking(2000, meminfoStart, meminfoEnd);
- assertEquals(fdCount, getFdCount());
+ final int curFdCount = getFdCount();
+ if (curFdCount - fdCount > 10) {
+ fail(String.format("FDs leaked. Expected=%d, current=%d", fdCount, curFdCount));
+ }
}
@Test
diff --git a/tests/tests/graphics/src/android/graphics/cts/ComposeShaderTest.java b/tests/tests/graphics/src/android/graphics/cts/ComposeShaderTest.java
index d7378b9..2e9f343 100644
--- a/tests/tests/graphics/src/android/graphics/cts/ComposeShaderTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/ComposeShaderTest.java
@@ -20,6 +20,7 @@
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapShader;
+import android.graphics.BlendMode;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ComposeShader;
@@ -62,6 +63,39 @@
for (int x = 0; x < SIZE; x++) {
float greenX = 1f - (x / 255f);
float greenY = 1f - (y / 255f);
+ int green = (int) ((greenX + greenY - greenX * greenY) * 255);
+ int pixel = bitmap.getPixel(x, y);
+ try {
+ assertEquals(0xFF, Color.alpha(pixel), TOLERANCE);
+ assertEquals(y, Color.red(pixel), TOLERANCE);
+ assertEquals(green, Color.green(pixel), TOLERANCE);
+ assertEquals(x, Color.blue(pixel), TOLERANCE);
+ } catch (Error e) {
+ Log.w(getClass().getName(), "Failed at (" + x + "," + y + ")");
+ throw e;
+ }
+ }
+ }
+ }
+
+ @Test
+ public void testBlendMode() {
+ LinearGradient blueGradient = new LinearGradient(0, 0, SIZE, 0,
+ Color.GREEN, Color.BLUE, Shader.TileMode.CLAMP);
+ LinearGradient redGradient = new LinearGradient(0, 0, 0, SIZE,
+ Color.GREEN, Color.RED, Shader.TileMode.CLAMP);
+ ComposeShader shader = new ComposeShader(blueGradient, redGradient, BlendMode.SCREEN);
+
+ Bitmap bitmap = Bitmap.createBitmap(SIZE, SIZE, Config.ARGB_8888);
+ Canvas canvas = new Canvas(bitmap);
+ Paint paint = new Paint();
+ paint.setShader(shader);
+ canvas.drawPaint(paint);
+
+ for (int y = 0; y < SIZE; y++) {
+ for (int x = 0; x < SIZE; x++) {
+ float greenX = 1f - (x / 255f);
+ float greenY = 1f - (y / 255f);
int green = (int)((greenX + greenY - greenX * greenY) * 255);
int pixel = bitmap.getPixel(x, y);
try {
diff --git a/tests/tests/graphics/src/android/graphics/cts/InsetsTest.java b/tests/tests/graphics/src/android/graphics/cts/InsetsTest.java
index ace3d91..419baf3 100644
--- a/tests/tests/graphics/src/android/graphics/cts/InsetsTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/InsetsTest.java
@@ -20,6 +20,7 @@
import android.graphics.Insets;
import android.graphics.Rect;
+import android.os.Parcel;
import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;
@@ -95,4 +96,15 @@
Insets insets2 = Insets.of(1000, 100, 10, 1);
assertEquals(Insets.max(insets2, insets1), Insets.of(1000, 100, 100, 1000));
}
+
+ @Test
+ public void testParcel() {
+ Insets inset = Insets.of(1, 3, 5, 7);
+ final Parcel parcel = Parcel.obtain();
+ inset.writeToParcel(parcel, 0);
+ parcel.setDataPosition(0);
+ assertEquals(inset, Insets.CREATOR.createFromParcel(parcel));
+ assertEquals(parcel.dataSize(), parcel.dataPosition());
+ parcel.recycle();
+ }
}
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 8145988..f8d49ef 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedImageDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedImageDrawableTest.java
@@ -43,6 +43,7 @@
import android.widget.ImageView;
import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.FlakyTest;
import androidx.test.rule.ActivityTestRule;
import androidx.test.runner.AndroidJUnit4;
@@ -247,6 +248,7 @@
}
@Test
+ @FlakyTest (bugId = 120280954)
public void testLifeCycle() throws Throwable {
AnimatedImageDrawable drawable = createFromImageDecoder(RES_ID);
@@ -323,6 +325,7 @@
}
@Test
+ @FlakyTest (bugId = 72737527)
public void testAddCallbackAfterStart() throws Throwable {
AnimatedImageDrawable drawable = createFromImageDecoder(RES_ID);
Callback cb = new Callback(drawable);
@@ -368,6 +371,7 @@
}
@Test
+ @FlakyTest (bugId = 72737527)
public void testRepeatCounts() throws Throwable {
for (int repeatCount : new int[] { 3, 5, 7, 16 }) {
AnimatedImageDrawable drawable = createFromImageDecoder(RES_ID);
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 f6d4bc8..bfc3be2 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableParameterizedTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableParameterizedTest.java
@@ -35,6 +35,7 @@
import android.widget.ImageView;
import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.FlakyTest;
import androidx.test.filters.LargeTest;
import androidx.test.filters.SmallTest;
import androidx.test.rule.ActivityTestRule;
@@ -116,6 +117,7 @@
}
@Test
+ @FlakyTest (bugId = 72737527)
public void testAnimationOnLayer() throws Throwable {
final Animatable2Callback callback = new Animatable2Callback();
// Can't simply use final here, b/c it needs to be initialized and referred later in UI
@@ -280,6 +282,7 @@
}
@Test
+ @FlakyTest (bugId = 72737527)
public void testInfiniteAVD() throws Throwable {
final Animatable2Callback callback = new Animatable2Callback();
// Can't simply use final here, b/c it needs to be initialized and referred later in UI
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 fe80ba3..10723f0 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableTest.java
@@ -39,6 +39,7 @@
import android.util.Xml;
import android.widget.ImageView;
+import androidx.test.filters.FlakyTest;
import androidx.test.filters.LargeTest;
import androidx.test.filters.SmallTest;
import androidx.test.rule.ActivityTestRule;
@@ -240,6 +241,7 @@
}
@Test
+ @FlakyTest (bugId = 72737527)
public void testAddCallbackBeforeStart() throws Throwable {
final Animatable2Callback callback = new Animatable2Callback();
// The AVD has a duration as 100ms.
@@ -257,6 +259,7 @@
}
@Test
+ @FlakyTest (bugId = 72737527)
public void testAddCallbackAfterTrigger() throws Throwable {
final Animatable2Callback callback = new Animatable2Callback();
// The AVD has a duration as 100ms.
@@ -278,6 +281,7 @@
}
@Test
+ @FlakyTest (bugId = 72737527)
public void testAddCallbackAfterStart() throws Throwable {
final Animatable2Callback callback = new Animatable2Callback();
// The AVD has a duration as 100ms.
@@ -317,6 +321,7 @@
}
@Test
+ @FlakyTest (bugId = 72737527)
public void testClearCallback() throws Throwable {
final Animatable2Callback callback = new Animatable2Callback();
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 e46f8c7..959fc00 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/BitmapDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/BitmapDrawableTest.java
@@ -31,6 +31,7 @@
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;
+import android.graphics.BlendMode;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
@@ -327,8 +328,17 @@
d.setTintMode(Mode.SRC_OVER);
assertEquals("Nine-patch is tinted", Color.BLACK, DrawableTestUtils.getPixel(d, 0, 0));
- d.setTintList(null);
- d.setTintMode(null);
+ }
+
+ @Test
+ public void testSetBlendMode() {
+ final InputStream source = mContext.getResources().openRawResource(R.raw.testimage);
+ final BitmapDrawable d = new BitmapDrawable(source);
+
+ d.setTint(Color.BLACK);
+ d.setTintMode(BlendMode.SRC_OVER);
+ assertEquals("Nine-patch is tinted", Color.BLACK, DrawableTestUtils.getPixel(d, 0, 0));
+
}
@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 971d2a8..bd9c9c0e 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableContainerTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableContainerTest.java
@@ -38,6 +38,7 @@
import static org.mockito.Mockito.verify;
import android.content.res.ColorStateList;
+import android.graphics.BlendMode;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
@@ -328,11 +329,19 @@
Drawable dr = spy(new ColorDrawable(Color.GREEN));
addAndSelectDrawable(dr);
- verify(dr, times(1)).setTintMode(Mode.SRC_OVER);
+ verify(dr, times(1)).setTintMode(BlendMode.SRC_OVER);
+ }
- mDrawableContainer.setTintList(null);
- mDrawableContainer.setTintMode(null);
- verify(dr, times(1)).setTintMode(null);
+ @Test
+ public void testSetBlendMode() {
+ mMockDrawableContainer.setConstantState(mDrawableContainerState);
+ mDrawableContainer.setTint(Color.BLACK);
+ mDrawableContainer.setTintMode(BlendMode.SRC_OVER);
+
+ Drawable dr = spy(new ColorDrawable(Color.GREEN));
+ addAndSelectDrawable(dr);
+
+ verify(dr, times(1)).setTintMode(BlendMode.SRC_OVER);
}
@Test
@@ -875,10 +884,13 @@
// Since Mockito can't mock or spy on protected methods, we have a custom extension
// of Drawable to track calls to protected methods. This class also has empty implementations
// of the base abstract methods.
- private class MockDrawable extends Drawable {
+ public class MockDrawable extends Drawable {
private boolean mHasCalledOnBoundsChanged;
private boolean mHasCalledOnStateChanged;
private boolean mHasCalledOnLevelChanged;
+ private boolean mHasOnApplyBlendModeChanged;
+
+ private BlendMode mBlendMode = null;
private Insets mInsets = null;
@@ -920,6 +932,10 @@
return mHasCalledOnLevelChanged;
}
+ public BlendMode getBlendMode() {
+ return mBlendMode;
+ }
+
public void reset() {
mHasCalledOnLevelChanged = false;
mHasCalledOnStateChanged = false;
@@ -927,6 +943,12 @@
}
@Override
+ public void setTintMode(BlendMode blendMode) {
+ mHasOnApplyBlendModeChanged = true;
+ mBlendMode = blendMode;
+ }
+
+ @Override
protected void onBoundsChange(Rect bounds) {
super.onBoundsChange(bounds);
mHasCalledOnBoundsChanged = true;
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 ce548d0..716e25f 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableTest.java
@@ -33,6 +33,7 @@
import android.content.res.Resources;
import android.content.res.Resources.Theme;
import android.graphics.BitmapFactory;
+import android.graphics.BlendMode;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Insets;
@@ -798,6 +799,71 @@
assertEquals(Insets.NONE, mockDrawable.getOpticalInsets());
}
+ @Test
+ public void testNoSetTintModeInfiniteLoop() {
+ // Setting a PorterDuff.Mode should delegate to the BlendMode API
+ TestTintDrawable testTintDrawable = new TestTintDrawable();
+
+ testTintDrawable.setTintMode(PorterDuff.Mode.OVERLAY);
+ assertEquals(2, testTintDrawable.getNumTimesTintModeInvoked());
+ assertEquals(1, testTintDrawable.getNumTimesBlendModeInvoked());
+ }
+
+ @Test
+ public void testPorterDuffTintWithUnsupportedBlendMode() {
+ // Setting a BlendMode should delegate to the PorterDuff.Mode API
+ TestTintDrawable testTintDrawable = new TestTintDrawable();
+ testTintDrawable.setTintMode(BlendMode.LUMINOSITY);
+ // 0 times invoking setTintMode because there is no equivalent for the luminosity blend mode
+ // on older API levels
+ assertEquals(0, testTintDrawable.getNumTimesTintModeInvoked());
+ assertEquals(1, testTintDrawable.getNumTimesBlendModeInvoked());
+ }
+
+ @Test
+ public void testPorterDuffTintWithSupportedBlendMode() {
+ TestTintDrawable testTintDrawable = new TestTintDrawable();
+ testTintDrawable.setTintMode(BlendMode.SRC_OVER);
+ assertEquals(1, testTintDrawable.getNumTimesTintModeInvoked());
+ assertEquals(2, testTintDrawable.getNumTimesBlendModeInvoked());
+ }
+
+ @Test
+ public void testBlendModeImplementationInvokedWithBlendMode() {
+ TestBlendModeImplementedDrawable test = new TestBlendModeImplementedDrawable();
+
+ test.setTintMode(BlendMode.SRC);
+ assertEquals(1, test.getNumTimesBlendModeInvoked());
+ assertEquals(0, test.getNumTimesTintModeInvoked());
+ }
+
+ @Test
+ public void testBlendModeImplementationInvokedWithPorterDuffMode() {
+ TestBlendModeImplementedDrawable test = new TestBlendModeImplementedDrawable();
+ test.setTintMode(PorterDuff.Mode.CLEAR);
+
+ assertEquals(1, test.getNumTimesTintModeInvoked());
+ assertEquals(1, test.getNumTimesBlendModeInvoked());
+ }
+
+ @Test
+ public void testPorterDuffImplementationInvokedWithBlendMode() {
+ TestPorterDuffImplementedDrawable test = new TestPorterDuffImplementedDrawable();
+ test.setTintMode(BlendMode.CLEAR);
+
+ assertEquals(1, test.getNumTimesBlendModeInvoked());
+ assertEquals(1, test.getNumTimesTintModeInvoked());
+ }
+
+ @Test
+ public void testPorterDuffImplementationInvokedWithPorterDuffMode() {
+ TestPorterDuffImplementedDrawable test = new TestPorterDuffImplementedDrawable();
+ test.setTintMode(PorterDuff.Mode.CLEAR);
+
+ assertEquals(1, test.getNumTimesTintModeInvoked());
+ assertEquals(0, test.getNumTimesBlendModeInvoked());
+ }
+
// Since Mockito can't mock or spy on protected methods, we have a custom extension
// of Drawable to track calls to protected methods. This class also has empty implementations
// of the base abstract methods.
@@ -839,4 +905,142 @@
return super.onStateChange(state);
}
}
+
+ private static class TestTintDrawable extends Drawable {
+
+ private int mSetTintModeInvoked = 0;
+ private int mSetBlendModeInvoked = 0;
+
+ @Override
+ public void draw(Canvas canvas) {
+
+ }
+
+ @Override
+ public void setAlpha(int alpha) {
+
+ }
+
+ @Override
+ public void setColorFilter(ColorFilter colorFilter) {
+
+ }
+
+ @Override
+ public int getOpacity() {
+ return 0;
+ }
+
+ @Override
+ public void setTintMode(PorterDuff.Mode tintMode) {
+ mSetTintModeInvoked++;
+ super.setTintMode(tintMode);
+ }
+
+ @Override
+ public void setTintMode(BlendMode blendMode) {
+ mSetBlendModeInvoked++;
+ super.setTintMode(blendMode);
+ }
+
+ public int getNumTimesTintModeInvoked() {
+ return mSetTintModeInvoked;
+ }
+
+ public int getNumTimesBlendModeInvoked() {
+ return mSetBlendModeInvoked;
+ }
+ }
+
+ private static class TestBlendModeImplementedDrawable extends Drawable {
+
+ private int mSetTintModeInvoked = 0;
+ private int mSetBlendModeInvoked = 0;
+
+ @Override
+ public void draw(Canvas canvas) {
+
+ }
+
+ @Override
+ public void setAlpha(int alpha) {
+
+ }
+
+ @Override
+ public void setColorFilter(ColorFilter colorFilter) {
+
+ }
+
+ @Override
+ public int getOpacity() {
+ return 0;
+ }
+
+ @Override
+ public void setTintMode(PorterDuff.Mode tintMode) {
+ mSetTintModeInvoked++;
+ super.setTintMode(tintMode);
+ }
+
+ @Override
+ public void setTintMode(BlendMode blendMode) {
+ // Intentionally not delegating to super class implementation
+ mSetBlendModeInvoked++;
+ }
+
+ public int getNumTimesTintModeInvoked() {
+ return mSetTintModeInvoked;
+ }
+
+ public int getNumTimesBlendModeInvoked() {
+ return mSetBlendModeInvoked;
+ }
+ }
+
+ private static class TestPorterDuffImplementedDrawable extends Drawable {
+
+ private int mSetTintModeInvoked = 0;
+ private int mSetBlendModeInvoked = 0;
+
+ @Override
+ public void draw(Canvas canvas) {
+
+ }
+
+ @Override
+ public void setAlpha(int alpha) {
+
+ }
+
+ @Override
+ public void setColorFilter(ColorFilter colorFilter) {
+
+ }
+
+ @Override
+ public int getOpacity() {
+ return 0;
+ }
+
+ @Override
+ public void setTintMode(PorterDuff.Mode tintMode) {
+ // Intentionally not delegating to super class implementation
+ mSetTintModeInvoked++;
+ }
+
+ @Override
+ public void setTintMode(BlendMode blendMode) {
+ mSetBlendModeInvoked++;
+ super.setTintMode(blendMode);
+ }
+
+ public int getNumTimesTintModeInvoked() {
+ return mSetTintModeInvoked;
+ }
+
+ public int getNumTimesBlendModeInvoked() {
+ return mSetBlendModeInvoked;
+ }
+ }
}
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 f6964c6..601eb3f 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/NinePatchDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/NinePatchDrawableTest.java
@@ -30,6 +30,7 @@
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapFactory;
+import android.graphics.BlendMode;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
@@ -222,9 +223,17 @@
mNinePatchDrawable.setTintMode(Mode.SRC_OVER);
assertEquals("Nine-patch is tinted", Color.BLACK,
DrawableTestUtils.getPixel(mNinePatchDrawable, 0, 0));
+ }
+
+ @Test
+ public void testSetBlendMode() {
+ mNinePatchDrawable.setTint(Color.BLACK);
+ mNinePatchDrawable.setTintMode(BlendMode.SRC_OVER);
+ assertEquals("Nine-patch is tinted", Color.BLACK,
+ DrawableTestUtils.getPixel(mNinePatchDrawable, 0, 0));
mNinePatchDrawable.setTintList(null);
- mNinePatchDrawable.setTintMode(null);
+ mNinePatchDrawable.setTintMode((BlendMode) null);
}
@Test
diff --git a/tests/tests/media/src/android/media/cts/AudioPlaybackCaptureTest.java b/tests/tests/media/src/android/media/cts/AudioPlaybackCaptureTest.java
index 3e6bff4..59500439 100644
--- a/tests/tests/media/src/android/media/cts/AudioPlaybackCaptureTest.java
+++ b/tests/tests/media/src/android/media/cts/AudioPlaybackCaptureTest.java
@@ -19,6 +19,10 @@
import static com.google.common.truth.Truth.assertThat;
+import static android.media.AudioAttributes.ALLOW_CAPTURE_BY_ALL;
+import static android.media.AudioAttributes.ALLOW_CAPTURE_BY_SYSTEM;
+import static android.media.AudioAttributes.ALLOW_CAPTURE_BY_NONE;
+
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotSame;
@@ -26,6 +30,7 @@
import android.media.AudioAttributes;
import android.media.AudioAttributes.AttributeUsage;
+import android.media.AudioAttributes.CapturePolicy;
import android.media.AudioFormat;
import android.media.AudioManager;
import android.media.AudioPlaybackCaptureConfiguration;
@@ -123,7 +128,7 @@
return audioRecord;
}
- private MediaPlayer createMediaPlayer(boolean allowCapture, int resid,
+ private MediaPlayer createMediaPlayer(@CapturePolicy int capturePolicy, int resid,
@AttributeUsage int usage) {
MediaPlayer mediaPlayer = MediaPlayer.create(
mActivity,
@@ -131,7 +136,7 @@
new AudioAttributes.Builder()
.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
.setUsage(usage)
- .setAllowCapture(allowCapture)
+ .setAllowedCapturePolicy(capturePolicy)
.build(),
mAudioManager.generateAudioSessionId());
mediaPlayer.setLooping(true);
@@ -161,10 +166,10 @@
return onlySilence;
}
- public void testPlaybackCapture(boolean allowCapture,
+ public void testPlaybackCapture(@CapturePolicy int capturePolicy,
@AttributeUsage int playbackUsage,
boolean dataPresent) throws Exception {
- MediaPlayer mediaPlayer = createMediaPlayer(allowCapture, R.raw.testwav_16bit_44100hz,
+ MediaPlayer mediaPlayer = createMediaPlayer(capturePolicy, R.raw.testwav_16bit_44100hz,
playbackUsage);
if (mPlaybackBeforeCapture) {
mediaPlayer.start();
@@ -193,6 +198,17 @@
}
}
+ public void testPlaybackCapture(boolean allowCapture,
+ @AttributeUsage int playbackUsage,
+ boolean dataPresent) throws Exception {
+ if (allowCapture) {
+ testPlaybackCapture(ALLOW_CAPTURE_BY_ALL, playbackUsage, dataPresent);
+ } else {
+ testPlaybackCapture(ALLOW_CAPTURE_BY_SYSTEM, playbackUsage, dataPresent);
+ testPlaybackCapture(ALLOW_CAPTURE_BY_NONE, playbackUsage, dataPresent);
+ }
+ }
+
private static final boolean OPT_IN = true;
private static final boolean OPT_OUT = false;
@@ -305,7 +321,7 @@
public void testCaptureExcludeUid() throws Exception {
mAPCTestConfig.excludeUids = new int[]{ 0 };
testPlaybackCapture(OPT_IN, AudioAttributes.USAGE_GAME, EXPECT_DATA);
- testPlaybackCapture(OPT_OUT, AudioAttributes.USAGE_GAME, EXPECT_SILENCE);
+ testPlaybackCapture(OPT_OUT, AudioAttributes.USAGE_UNKNOWN, EXPECT_SILENCE);
testPlaybackCapture(OPT_IN, AudioAttributes.USAGE_VOICE_COMMUNICATION, EXPECT_SILENCE);
mAPCTestConfig.excludeUids = new int[]{ mUid };
diff --git a/tests/tests/media/src/android/media/cts/AudioRecordTest.java b/tests/tests/media/src/android/media/cts/AudioRecordTest.java
index f45937d..32a1816 100644
--- a/tests/tests/media/src/android/media/cts/AudioRecordTest.java
+++ b/tests/tests/media/src/android/media/cts/AudioRecordTest.java
@@ -27,13 +27,16 @@
import android.content.Context;
import android.content.pm.PackageManager;
import android.media.AudioFormat;
+import android.media.AudioManager;
import android.media.AudioRecord;
import android.media.AudioRecord.OnRecordPositionUpdateListener;
+import android.media.AudioRecordingConfiguration;
import android.media.AudioTimestamp;
import android.media.AudioTrack;
import android.media.MediaRecorder;
import android.media.MediaSyncEvent;
import android.media.MicrophoneInfo;
+import android.media.cts.AudioRecordingConfigurationTest.MyAudioRecordingCallback;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
@@ -59,14 +62,16 @@
import java.nio.ByteBuffer;
import java.nio.ShortBuffer;
import java.util.ArrayList;
+import java.util.concurrent.Executor;
import java.util.List;
+
@RunWith(AndroidJUnit4.class)
public class AudioRecordTest {
private final static String TAG = "AudioRecordTest";
private static final String REPORT_LOG_NAME = "CtsMediaTestCases";
private AudioRecord mAudioRecord;
- private int mHz = 44100;
+ private static final int SAMPLING_RATE_HZ = 44100;
private boolean mIsOnMarkerReachedCalled;
private boolean mIsOnPeriodicNotificationCalled;
private boolean mIsHandleMessageCalled;
@@ -81,6 +86,7 @@
super.handleMessage(msg);
}
};
+ private static final int RECORD_DURATION_MS = 500;
@Before
public void setUp() throws Exception {
@@ -101,12 +107,17 @@
Looper.prepare();
mLooper = Looper.myLooper();
synchronized(this) {
- mAudioRecord = new AudioRecord(MediaRecorder.AudioSource.DEFAULT, mHz,
- AudioFormat.CHANNEL_CONFIGURATION_MONO,
- AudioFormat.ENCODING_PCM_16BIT,
- AudioRecord.getMinBufferSize(mHz,
- AudioFormat.CHANNEL_CONFIGURATION_MONO,
- AudioFormat.ENCODING_PCM_16BIT) * 10);
+ mAudioRecord = new AudioRecord.Builder()
+ .setAudioFormat(new AudioFormat.Builder()
+ .setSampleRate(SAMPLING_RATE_HZ)
+ .setEncoding(AudioFormat.ENCODING_PCM_16BIT)
+ .setChannelMask(AudioFormat.CHANNEL_IN_MONO).build())
+ .setAudioSource(MediaRecorder.AudioSource.DEFAULT)
+ .setBufferSizeInBytes(
+ AudioRecord.getMinBufferSize(SAMPLING_RATE_HZ,
+ AudioFormat.CHANNEL_IN_MONO,
+ AudioFormat.ENCODING_PCM_16BIT) * 10)
+ .build();
this.notify();
}
Looper.loop();
@@ -144,10 +155,10 @@
assertEquals(AudioFormat.CHANNEL_IN_MONO,
mAudioRecord.getChannelConfiguration());
assertEquals(AudioRecord.STATE_INITIALIZED, mAudioRecord.getState());
- assertEquals(mHz, mAudioRecord.getSampleRate());
+ assertEquals(SAMPLING_RATE_HZ, mAudioRecord.getSampleRate());
assertEquals(AudioRecord.RECORDSTATE_STOPPED, mAudioRecord.getRecordingState());
- int bufferSize = AudioRecord.getMinBufferSize(mHz,
+ int bufferSize = AudioRecord.getMinBufferSize(SAMPLING_RATE_HZ,
AudioFormat.CHANNEL_CONFIGURATION_DEFAULT, AudioFormat.ENCODING_PCM_16BIT);
assertTrue(bufferSize > 0);
}
@@ -939,6 +950,69 @@
}
}
+ private Executor mExec = new Executor() {
+ @Override
+ public void execute(Runnable command) {
+ command.run();
+ }
+ };
+
+ @Test
+ public void testAudioRecordInfoCallback() throws Exception {
+ if (!hasMicrophone()) {
+ return;
+ }
+ AudioRecordingConfigurationTest.MyAudioRecordingCallback callback =
+ new AudioRecordingConfigurationTest.MyAudioRecordingCallback(
+ mAudioRecord.getAudioSessionId(), MediaRecorder.AudioSource.DEFAULT);
+ mAudioRecord.registerAudioRecordingCallback(mExec, callback);
+ mAudioRecord.startRecording();
+ assertEquals(AudioRecord.RECORDSTATE_RECORDING, mAudioRecord.getRecordingState());
+
+ try {
+ Thread.sleep(RECORD_DURATION_MS);
+ } catch (InterruptedException e) {
+ }
+ assertTrue(callback.mCalled);
+ assertTrue(callback.mConfigs.size() <= 1);
+ if (callback.mConfigs.size() == 1) {
+ checkRecordingConfig(callback.mConfigs.get(0));
+ }
+
+ mAudioRecord.unregisterAudioRecordingCallback(callback);
+ }
+
+ @Test
+ public void testGetActiveRecordingConfiguration() throws Exception {
+ if (!hasMicrophone()) {
+ return;
+ }
+ mAudioRecord.startRecording();
+ assertEquals(AudioRecord.RECORDSTATE_RECORDING, mAudioRecord.getRecordingState());
+
+ try {
+ Thread.sleep(RECORD_DURATION_MS);
+ } catch (InterruptedException e) {
+ }
+
+ AudioRecordingConfiguration config = mAudioRecord.getActiveRecordingConfiguration();
+ checkRecordingConfig(config);
+ }
+
+ private static void checkRecordingConfig(AudioRecordingConfiguration config) {
+ assertNotNull(config);
+ AudioFormat format = config.getClientFormat();
+ assertEquals(AudioFormat.CHANNEL_IN_MONO, format.getChannelMask());
+ assertEquals(AudioFormat.ENCODING_PCM_16BIT, format.getEncoding());
+ assertEquals(SAMPLING_RATE_HZ, format.getSampleRate());
+ assertEquals(MediaRecorder.AudioSource.MIC, config.getAudioSource());
+ assertNotNull(config.getAudioDevice());
+ assertNotNull(config.getClientEffects());
+ assertNotNull(config.getEffects());
+ // no requirement here, just testing the API
+ config.isClientSilenced();
+ }
+
private AudioRecord createAudioRecord(
int audioSource, int sampleRateInHz,
int channelConfig, int audioFormat, int bufferSizeInBytes,
diff --git a/tests/tests/media/src/android/media/cts/AudioRecordingConfigurationTest.java b/tests/tests/media/src/android/media/cts/AudioRecordingConfigurationTest.java
index eb7296f..4258c03 100644
--- a/tests/tests/media/src/android/media/cts/AudioRecordingConfigurationTest.java
+++ b/tests/tests/media/src/android/media/cts/AudioRecordingConfigurationTest.java
@@ -248,10 +248,9 @@
configs.get(0), unmarshalledConf);
}
- class MyAudioRecordingCallback extends AudioManager.AudioRecordingCallback {
+ static class MyAudioRecordingCallback extends AudioManager.AudioRecordingCallback {
boolean mCalled = false;
List<AudioRecordingConfiguration> mConfigs;
- final AudioManager mAM;
final int mTestSource;
final int mTestSession;
@@ -261,7 +260,6 @@
}
MyAudioRecordingCallback(int session, int source) {
- mAM = new AudioManager(getContext());
mTestSource = source;
mTestSession = session;
}
diff --git a/tests/tests/media/src/android/media/cts/MediaCodecCapabilitiesTest.java b/tests/tests/media/src/android/media/cts/MediaCodecCapabilitiesTest.java
index cc5defe..ad0aa36 100644
--- a/tests/tests/media/src/android/media/cts/MediaCodecCapabilitiesTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaCodecCapabilitiesTest.java
@@ -174,6 +174,19 @@
}
}
+ public void testVp9DecoderCapabilitiesOnTv() throws Exception {
+ if (isTv() && MediaUtils.hasHardwareCodec(MIMETYPE_VIDEO_VP9, /* encode = */ false)) {
+ // CDD [5.3.7.4/T-1-1]
+ assertTrue(MediaUtils.canDecodeVideo(MIMETYPE_VIDEO_VP9, 1920, 1080, 60 /* fps */,
+ VP9Profile0, null, null));
+ if (MediaUtils.canDecodeVideo(MIMETYPE_VIDEO_VP9, 3840, 2160, 60 /* fps */)) {
+ // CDD [5.3.7.5/T-2-1]
+ assertTrue(MediaUtils.canDecodeVideo(MIMETYPE_VIDEO_VP9, 3840, 2160, 60 /* fps */,
+ VP9Profile0, null, null));
+ }
+ }
+ }
+
public void testAvcBaseline1() throws Exception {
if (!checkDecoder(MIMETYPE_VIDEO_AVC, AVCProfileBaseline, AVCLevel1)) {
return; // skip
diff --git a/tests/tests/media/src/android/media/cts/MediaRecorderTest.java b/tests/tests/media/src/android/media/cts/MediaRecorderTest.java
index 1c3a595..ac68057 100644
--- a/tests/tests/media/src/android/media/cts/MediaRecorderTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaRecorderTest.java
@@ -22,6 +22,8 @@
import android.graphics.Color;
import android.graphics.Paint;
import android.hardware.Camera;
+import android.media.AudioFormat;
+import android.media.AudioRecordingConfiguration;
import android.media.CamcorderProfile;
import android.media.EncoderCapabilities;
import android.media.EncoderCapabilities.VideoEncoderCap;
@@ -36,6 +38,7 @@
import android.media.MediaRecorder.OnErrorListener;
import android.media.MediaRecorder.OnInfoListener;
import android.media.MicrophoneInfo;
+import android.media.cts.AudioRecordingConfigurationTest.MyAudioRecordingCallback;
import android.opengl.GLES20;
import android.os.ConditionVariable;
import android.os.Environment;
@@ -62,6 +65,7 @@
import java.util.List;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
@SmallTest
@@ -607,16 +611,22 @@
return 1;
}
+ private void configureDefaultMediaRecorder() {
+ mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
+ mMediaRecorder.setAudioChannels(AUDIO_NUM_CHANNELS);
+ mMediaRecorder.setAudioSamplingRate(AUDIO_SAMPLE_RATE_HZ);
+ mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
+ mMediaRecorder.setOutputFile(OUTPUT_PATH);
+ mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
+ mMediaRecorder.setMaxFileSize(MAX_FILE_SIZE * 10);
+ }
+
public void testGetActiveMicrophones() throws Exception {
if (!hasMicrophone() || !hasAac()) {
MediaUtils.skipTest("no audio codecs or microphone");
return;
}
- mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
- mMediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
- mMediaRecorder.setOutputFile(OUTPUT_PATH);
- mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
- mMediaRecorder.setMaxFileSize(MAX_FILE_SIZE * 10);
+ configureDefaultMediaRecorder();
mMediaRecorder.prepare();
mMediaRecorder.start();
Thread.sleep(1000);
@@ -1632,4 +1642,62 @@
// expected
}
}
+
+ public void testAudioRecordInfoCallback() throws Exception {
+ if (!hasMicrophone() || !hasAac()) {
+ MediaUtils.skipTest("no audio codecs or microphone");
+ return;
+ }
+ AudioRecordingConfigurationTest.MyAudioRecordingCallback callback =
+ new AudioRecordingConfigurationTest.MyAudioRecordingCallback(
+ 0 /*unused*/, MediaRecorder.AudioSource.DEFAULT);
+ mMediaRecorder.registerAudioRecordingCallback(mExec, callback);
+ configureDefaultMediaRecorder();
+ mMediaRecorder.prepare();
+ mMediaRecorder.start();
+ Thread.sleep(1000);
+ assertTrue(callback.mCalled);
+ assertTrue(callback.mConfigs.size() <= 1);
+ if (callback.mConfigs.size() == 1) {
+ checkRecordingConfig(callback.mConfigs.get(0));
+ }
+ mMediaRecorder.stop();
+ mMediaRecorder.unregisterAudioRecordingCallback(callback);
+ }
+
+ public void testGetActiveRecordingConfiguration() throws Exception {
+ if (!hasMicrophone() || !hasAac()) {
+ MediaUtils.skipTest("no audio codecs or microphone");
+ return;
+ }
+ configureDefaultMediaRecorder();
+ mMediaRecorder.prepare();
+ mMediaRecorder.start();
+ Thread.sleep(1000);
+ AudioRecordingConfiguration config = mMediaRecorder.getActiveRecordingConfiguration();
+ checkRecordingConfig(config);
+ mMediaRecorder.stop();
+ }
+
+ private Executor mExec = new Executor() {
+ @Override
+ public void execute(Runnable command) {
+ command.run();
+ }
+ };
+
+ private static void checkRecordingConfig(AudioRecordingConfiguration config) {
+ assertNotNull(config);
+ AudioFormat format = config.getClientFormat();
+ assertEquals(AUDIO_NUM_CHANNELS, format.getChannelCount());
+ assertEquals(AUDIO_SAMPLE_RATE_HZ, format.getSampleRate());
+ assertEquals(MediaRecorder.AudioSource.MIC, config.getAudioSource());
+ assertNotNull(config.getAudioDevice());
+ assertNotNull(config.getClientEffects());
+ assertNotNull(config.getEffects());
+ // no requirement here, just testing the API
+ config.isClientSilenced();
+ }
+
+
}
diff --git a/tests/tests/media/src/android/media/cts/MediaScannerConnectionTest.java b/tests/tests/media/src/android/media/cts/MediaScannerConnectionTest.java
index fd436fc..8ca7df7 100644
--- a/tests/tests/media/src/android/media/cts/MediaScannerConnectionTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaScannerConnectionTest.java
@@ -16,9 +16,6 @@
package android.media.cts;
-import android.media.cts.R;
-
-
import android.content.ComponentName;
import android.content.Context;
import android.media.MediaScannerConnection;
@@ -32,8 +29,6 @@
import com.android.compatibility.common.util.PollingCheck;
import java.io.File;
-import java.io.FileOutputStream;
-import java.io.InputStream;
@AppModeFull(reason = "TODO: evaluate and port to instant")
public class MediaScannerConnectionTest extends AndroidTestCase {
diff --git a/tests/tests/media/src/android/media/cts/MediaScannerTest.java b/tests/tests/media/src/android/media/cts/MediaScannerTest.java
index 4721419..c19018d 100644
--- a/tests/tests/media/src/android/media/cts/MediaScannerTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaScannerTest.java
@@ -19,10 +19,7 @@
import android.app.UiAutomation;
import android.content.ComponentName;
import android.content.ContentResolver;
-import android.content.ContentUris;
import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
import android.media.MediaMetadataRetriever;
@@ -40,8 +37,8 @@
import android.test.AndroidTestCase;
import android.util.Log;
-import androidx.test.filters.SmallTest;
import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
import com.android.compatibility.common.util.FileCopyHelper;
import com.android.compatibility.common.util.PollingCheck;
@@ -621,25 +618,16 @@
}
}
- static void startMediaScan() {
- // Ugh, the best proxy we have is pretending that it was just mounted
- InstrumentationRegistry.getInstrumentation().getUiAutomation().executeShellCommand(
- "am broadcast -a android.intent.action.MEDIA_SCANNER_SCAN_VOLUME "
- + "--receiver-include-background -d "
- + Uri.fromFile(Environment.getExternalStorageDirectory()));
+ public static void startMediaScan() {
+ new Thread(() -> {
+ MediaStore.scanVolume(InstrumentationRegistry.getTargetContext(),
+ Environment.getExternalStorageDirectory());
+ }).start();
}
- private void startMediaScanAndWait() throws InterruptedException {
- ScannerNotificationReceiver finishedReceiver = new ScannerNotificationReceiver(
- Intent.ACTION_MEDIA_SCANNER_FINISHED);
- IntentFilter finishedIntentFilter = new IntentFilter(Intent.ACTION_MEDIA_SCANNER_FINISHED);
- finishedIntentFilter.addDataScheme("file");
- mContext.registerReceiver(finishedReceiver, finishedIntentFilter);
-
- startMediaScan();
-
- finishedReceiver.waitForBroadcast();
- mContext.unregisterReceiver(finishedReceiver);
+ public static void startMediaScanAndWait() {
+ MediaStore.scanVolume(InstrumentationRegistry.getTargetContext(),
+ Environment.getExternalStorageDirectory());
}
private void checkMediaScannerConnection() {
diff --git a/tests/tests/media/src/android/media/cts/ThumbnailUtilsTest.java b/tests/tests/media/src/android/media/cts/ThumbnailUtilsTest.java
index b90c6a7..6ae9e19 100644
--- a/tests/tests/media/src/android/media/cts/ThumbnailUtilsTest.java
+++ b/tests/tests/media/src/android/media/cts/ThumbnailUtilsTest.java
@@ -21,6 +21,7 @@
import android.content.Context;
import android.graphics.Bitmap;
import android.media.ThumbnailUtils;
+import android.platform.test.annotations.AppModeFull;
import android.util.Size;
import androidx.test.InstrumentationRegistry;
@@ -37,6 +38,7 @@
import java.io.InputStream;
import java.io.OutputStream;
+@AppModeFull(reason = "Instant apps cannot access the SD card")
@RunWith(AndroidJUnit4.class)
public class ThumbnailUtilsTest {
private static final Size[] TEST_SIZES = new Size[] {
diff --git a/tests/tests/nativehardware/jni/AHardwareBufferTest.cpp b/tests/tests/nativehardware/jni/AHardwareBufferTest.cpp
index c6c97ea..9a9f3e3 100644
--- a/tests/tests/nativehardware/jni/AHardwareBufferTest.cpp
+++ b/tests/tests/nativehardware/jni/AHardwareBufferTest.cpp
@@ -20,6 +20,7 @@
#include <sys/un.h>
#include <unistd.h>
+#include <limits>
#include <sstream>
#include <string>
@@ -30,6 +31,7 @@
//#define LOG_NDEBUG 0
#define BAD_VALUE -EINVAL
+#define INVALID_OPERATION -ENOSYS
#define NO_ERROR 0
#define LOG_TAG "AHBTest"
@@ -312,6 +314,48 @@
AHardwareBuffer_release(received);
}
+TEST(AHardwareBufferTest, LockAndGetInfoAndUnlockSucceed) {
+ AHardwareBuffer* buffer = nullptr;
+ AHardwareBuffer_Desc desc = {};
+
+ desc.width = 2;
+ desc.height = 4;
+ desc.layers = 1;
+ desc.usage = AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE | AHARDWAREBUFFER_USAGE_CPU_READ_RARELY;
+ desc.format = AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM;
+
+ int32_t bytesPerPixel = std::numeric_limits<int32_t>::min();
+ int32_t bytesPerStride = std::numeric_limits<int32_t>::min();
+
+ // Test that an invalid buffer fails.
+ int err = AHardwareBuffer_lockAndGetInfo(NULL, 0, -1, NULL, NULL, &bytesPerPixel, &bytesPerStride);
+ EXPECT_EQ(BAD_VALUE, err);
+
+ err = AHardwareBuffer_allocate(&desc, &buffer);
+ EXPECT_EQ(NO_ERROR, err);
+ void* bufferData = NULL;
+
+ // Test invalid usage flag
+ err = AHardwareBuffer_lockAndGetInfo(buffer, ~(AHARDWAREBUFFER_USAGE_CPU_WRITE_MASK | AHARDWAREBUFFER_USAGE_CPU_READ_MASK), -1, NULL, &bufferData, &bytesPerPixel, &bytesPerStride);
+ EXPECT_EQ(BAD_VALUE, err);
+
+ err = AHardwareBuffer_lockAndGetInfo(buffer, AHARDWAREBUFFER_USAGE_CPU_READ_RARELY, -1, NULL, &bufferData, &bytesPerPixel, &bytesPerStride);
+
+ if (bytesPerPixel == -1 || bytesPerStride == -1) {
+ EXPECT_EQ(INVALID_OPERATION, err);
+ } else {
+ EXPECT_EQ(NO_ERROR, err);
+ EXPECT_LE(0, bytesPerPixel);
+ EXPECT_LE(0, bytesPerStride);
+ EXPECT_TRUE(bufferData != NULL);
+
+ int32_t fence = -1;
+ err = AHardwareBuffer_unlock(buffer, &fence);
+ EXPECT_EQ(NO_ERROR, err);
+ }
+ AHardwareBuffer_release(buffer);
+}
+
TEST(AHardwareBufferTest, LockAndUnlockSucceed) {
AHardwareBuffer* buffer = NULL;
AHardwareBuffer_Desc desc = {};
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/jni/NativeMultinetworkJni.cpp b/tests/tests/net/jni/NativeMultinetworkJni.cpp
index d1a92a4..a6b5e90 100644
--- a/tests/tests/net/jni/NativeMultinetworkJni.cpp
+++ b/tests/tests/net/jni/NativeMultinetworkJni.cpp
@@ -245,13 +245,12 @@
net_handle_t handle = (net_handle_t) nethandle;
int fd = android_res_nquery(handle, kGoogleName, ns_c_in, ns_t_a, 0);
- int rcode = -1;
- uint8_t buf[MAXPACKET] = {};
+ errno = 0;
android_res_cancel(fd);
- EXPECT_EQ(env, -EBADF, android_res_nresult(fd, &rcode, buf, MAXPACKET), "res_cancel");
-
- android_res_cancel(fd);
- EXPECT_EQ(env, -EBADF, android_res_nresult(fd, &rcode, buf, MAXPACKET), "res_cancel");
+ int err = errno;
+ EXPECT_EQ(env, 0, err, "res_cancel");
+ // DO NOT call cancel or result with the same fd more than once,
+ // otherwise it will hit fdsan double-close fd.
return 0;
}
@@ -288,10 +287,10 @@
fd = android_res_nsend(handle, largeBuf, sizeof(largeBuf), 0);
EXPECT_EQ(env, -EMSGSIZE, fd, "res_nsend buffer larger than 8KB");
- // 1000 bytes filled with 0. This returns EMSGSIZE because FrameworkListener limits the size of
- // commands to 1024 bytes. TODO: b/126307309
- fd = android_res_nsend(handle, largeBuf, 1000, 0);
- EXPECT_EQ(env, -EMSGSIZE, fd, "res_nsend 1000 bytes filled with 0");
+ // 5000 bytes filled with 0. This returns EMSGSIZE because FrameworkListener limits the size of
+ // commands to 4096 bytes.
+ fd = android_res_nsend(handle, largeBuf, 5000, 0);
+ EXPECT_EQ(env, -EMSGSIZE, fd, "res_nsend 5000 bytes filled with 0");
// 500 bytes filled with 0
fd = android_res_nsend(handle, largeBuf, 500, 0);
@@ -299,16 +298,16 @@
EXPECT_EQ(env, 0, expectAnswersNotValid(env, fd, -EINVAL),
"res_nsend 500 bytes filled with 0 check answers");
- // 1000 bytes filled with 0xFF
- uint8_t ffBuf[1001] = {};
+ // 5000 bytes filled with 0xFF
+ uint8_t ffBuf[5001] = {};
memset(ffBuf, 0xFF, sizeof(ffBuf));
- ffBuf[1000] = '\0';
+ ffBuf[5000] = '\0';
fd = android_res_nsend(handle, ffBuf, sizeof(ffBuf), 0);
- EXPECT_EQ(env, -EMSGSIZE, fd, "res_nsend 1000 bytes filled with 0xFF");
+ EXPECT_EQ(env, -EMSGSIZE, fd, "res_nsend 5000 bytes filled with 0xFF");
// 500 bytes filled with 0xFF
- ffBuf[501] = '\0';
- fd = android_res_nsend(handle, ffBuf, 500, 0);
+ ffBuf[500] = '\0';
+ fd = android_res_nsend(handle, ffBuf, 501, 0);
EXPECT_GE(env, fd, 0, "res_nsend 500 bytes filled with 0xFF");
EXPECT_EQ(env, 0, expectAnswersNotValid(env, fd, -EINVAL),
"res_nsend 500 bytes filled with 0xFF check answers");
diff --git a/tests/tests/net/native/dns/NativeDnsAsyncTest.cpp b/tests/tests/net/native/dns/NativeDnsAsyncTest.cpp
index 2fc9ff8f..e501475 100644
--- a/tests/tests/net/native/dns/NativeDnsAsyncTest.cpp
+++ b/tests/tests/net/native/dns/NativeDnsAsyncTest.cpp
@@ -194,13 +194,12 @@
TEST (NativeDnsAsyncTest, Async_Cancel) {
int fd = android_res_nquery(
NETWORK_UNSPECIFIED, "www.google.com", ns_c_in, ns_t_a, 0);
- int rcode = -1;
- uint8_t buf[MAXPACKET] = {};
+ errno = 0;
android_res_cancel(fd);
- android_res_cancel(fd);
-
- int res = android_res_nresult(fd, &rcode, buf, MAXPACKET);
- EXPECT_EQ(-EBADF, res);
+ int err = errno;
+ EXPECT_EQ(err, 0);
+ // DO NOT call cancel or result with the same fd more than once,
+ // otherwise it will hit fdsan double-close fd.
}
TEST (NativeDnsAsyncTest, Async_Query_MALFORMED) {
@@ -235,9 +234,9 @@
NETWORK_UNSPECIFIED, largeBuf.data(), largeBuf.size(), 0);
EXPECT_EQ(-EMSGSIZE, fd);
- // 1000 bytes filled with 0. This returns EMSGSIZE because FrameworkListener limits the size of
- // commands to 1024 bytes. TODO: fix this.
- fd = android_res_nsend(NETWORK_UNSPECIFIED, largeBuf.data(), 1000, 0);
+ // 5000 bytes filled with 0. This returns EMSGSIZE because FrameworkListener limits the size of
+ // commands to 4096 bytes.
+ fd = android_res_nsend(NETWORK_UNSPECIFIED, largeBuf.data(), 5000, 0);
EXPECT_EQ(-EMSGSIZE, fd);
// 500 bytes filled with 0
@@ -245,8 +244,8 @@
EXPECT_GE(fd, 0);
expectAnswersNotValid(fd, -EINVAL);
- // 1000 bytes filled with 0xFF
- std::vector<uint8_t> ffBuf(1000, 0xFF);
+ // 5000 bytes filled with 0xFF
+ std::vector<uint8_t> ffBuf(5000, 0xFF);
fd = android_res_nsend(
NETWORK_UNSPECIFIED, ffBuf.data(), ffBuf.size(), 0);
EXPECT_EQ(-EMSGSIZE, fd);
diff --git a/tests/tests/net/src/android/net/wifi/cts/WifiManager_WifiLockTest.java b/tests/tests/net/src/android/net/wifi/cts/WifiLockTest.java
similarity index 93%
rename from tests/tests/net/src/android/net/wifi/cts/WifiManager_WifiLockTest.java
rename to tests/tests/net/src/android/net/wifi/cts/WifiLockTest.java
index e08a972..0703e60 100644
--- a/tests/tests/net/src/android/net/wifi/cts/WifiManager_WifiLockTest.java
+++ b/tests/tests/net/src/android/net/wifi/cts/WifiLockTest.java
@@ -21,9 +21,9 @@
import android.net.wifi.WifiManager.WifiLock;
import android.test.AndroidTestCase;
-public class WifiManager_WifiLockTest extends AndroidTestCase {
+public class WifiLockTest extends AndroidTestCase {
- private static final String WIFI_TAG = "WifiManager_WifiLockTest";
+ private static final String WIFI_TAG = "WifiLockTest";
/**
* Verify acquire and release of High Performance wifi locks
@@ -82,7 +82,7 @@
wl.release();
assertFalse(wl.isHeld());
assertNotNull(wl.toString());
- // should be ignored
+ // releasing again after release: but ignored for non-referenced locks
wl.release();
}
}
diff --git a/tests/tests/packageinstaller/atomicinstall/AndroidTest.xml b/tests/tests/packageinstaller/atomicinstall/AndroidTest.xml
index e8284d2..e248a62 100644
--- a/tests/tests/packageinstaller/atomicinstall/AndroidTest.xml
+++ b/tests/tests/packageinstaller/atomicinstall/AndroidTest.xml
@@ -16,6 +16,9 @@
<configuration description="Runs the atomic install API tests">
<option name="test-suite-tag" value="cts" />
<option name="config-descriptor:metadata" key="component" value="framework" />
+ <!-- Instant apps can't have INSTALL_PACKAGES permission. -->
+ <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+ <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
<option name="test-file-name" value="CtsAtomicInstallTestCases.apk" />
diff --git a/tests/tests/permission/AndroidTest.xml b/tests/tests/permission/AndroidTest.xml
index 5f28a77..ea38aa2 100644
--- a/tests/tests/permission/AndroidTest.xml
+++ b/tests/tests/permission/AndroidTest.xml
@@ -50,11 +50,14 @@
<option name="push" value="CtsAppThatAccessesStorageOnCommand28.apk->/data/local/tmp/cts/permissions/CtsAppThatAccessesStorageOnCommand28.apk" />
<option name="push" value="CtsAppThatAccessesStorageOnCommand29.apk->/data/local/tmp/cts/permissions/CtsAppThatAccessesStorageOnCommand29.apk" />
<option name="push" value="CtsAppThatAccessesStorageOnCommand28v3.apk->/data/local/tmp/cts/permissions/CtsAppThatAccessesStorageOnCommand28v3.apk" />
+ <option name="push" value="CtsAppWithSharedUidThatRequestsPermissions.apk->/data/local/tmp/cts/permissions/CtsAppWithSharedUidThatRequestsPermissions.apk" />
+ <option name="push" value="CtsAppWithSharedUidThatRequestsNoPermissions.apk->/data/local/tmp/cts/permissions/CtsAppWithSharedUidThatRequestsNoPermissions.apk" />
</target_preparer>
<!-- Remove additional apps if installed -->
<target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
<option name="teardown-command" value="pm uninstall android.permission.cts.appthatrequestpermission" />
+ <option name="teardown-command" value="pm uninstall android.permission.cts.appthatrequestnopermission" />
</target_preparer>
<test class="com.android.tradefed.testtype.AndroidJUnitTest" >
diff --git a/hostsidetests/devicepolicy/app/WidgetProvider/Android.mk b/tests/tests/permission/AppWithSharedUidThatRequestsNoPermissions/Android.mk
similarity index 71%
rename from hostsidetests/devicepolicy/app/WidgetProvider/Android.mk
rename to tests/tests/permission/AppWithSharedUidThatRequestsNoPermissions/Android.mk
index 1a804b8..98395d0 100644
--- a/hostsidetests/devicepolicy/app/WidgetProvider/Android.mk
+++ b/tests/tests/permission/AppWithSharedUidThatRequestsNoPermissions/Android.mk
@@ -1,4 +1,5 @@
-# Copyright (C) 2015 The Android Open Source Project
+#
+# 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.
@@ -11,22 +12,15 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-
+#
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
-LOCAL_PACKAGE_NAME := CtsWidgetProviderApp
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
+LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
+LOCAL_PACKAGE_NAME := CtsAppWithSharedUidThatRequestsNoPermissions
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/permission/AppWithSharedUidThatRequestsNoPermissions/AndroidManifest.xml b/tests/tests/permission/AppWithSharedUidThatRequestsNoPermissions/AndroidManifest.xml
new file mode 100644
index 0000000..0b34036
--- /dev/null
+++ b/tests/tests/permission/AppWithSharedUidThatRequestsNoPermissions/AndroidManifest.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.permission.cts.appthatrequestnopermission"
+ android:sharedUserId="cts.permissions">
+
+ <application />
+</manifest>
+
diff --git a/hostsidetests/devicepolicy/app/WidgetProvider/Android.mk b/tests/tests/permission/AppWithSharedUidThatRequestsPermissions/Android.mk
similarity index 71%
copy from hostsidetests/devicepolicy/app/WidgetProvider/Android.mk
copy to tests/tests/permission/AppWithSharedUidThatRequestsPermissions/Android.mk
index 1a804b8..22ddf98 100644
--- a/hostsidetests/devicepolicy/app/WidgetProvider/Android.mk
+++ b/tests/tests/permission/AppWithSharedUidThatRequestsPermissions/Android.mk
@@ -1,4 +1,5 @@
-# Copyright (C) 2015 The Android Open Source Project
+#
+# 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.
@@ -11,22 +12,15 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-
+#
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
-LOCAL_PACKAGE_NAME := CtsWidgetProviderApp
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
+LOCAL_MODULE_TAGS := tests
LOCAL_SDK_VERSION := current
-
-# tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
+LOCAL_PACKAGE_NAME := CtsAppWithSharedUidThatRequestsPermissions
include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/permission/AppWithSharedUidThatRequestsPermissions/AndroidManifest.xml b/tests/tests/permission/AppWithSharedUidThatRequestsPermissions/AndroidManifest.xml
new file mode 100644
index 0000000..ce02f17
--- /dev/null
+++ b/tests/tests/permission/AppWithSharedUidThatRequestsPermissions/AndroidManifest.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="android.permission.cts.appthatrequestpermission"
+ android:sharedUserId="cts.permissions">
+
+ <uses-permission android:name="android.permission.INTERNET" />
+ <uses-permission android:name="android.permission.READ_CONTACTS" />
+ <uses-permission android:name="android.permission.READ_CALENDAR" />
+
+ <application />
+</manifest>
+
diff --git a/tests/tests/permission/src/android/permission/cts/SharedUidPermissionsTest.java b/tests/tests/permission/src/android/permission/cts/SharedUidPermissionsTest.java
new file mode 100644
index 0000000..aa0e2c9
--- /dev/null
+++ b/tests/tests/permission/src/android/permission/cts/SharedUidPermissionsTest.java
@@ -0,0 +1,76 @@
+/*
+ * 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.permission.cts;
+
+import static android.Manifest.permission.READ_CALENDAR;
+import static android.Manifest.permission.READ_CONTACTS;
+import static android.permission.cts.PermissionUtils.grantPermission;
+import static android.permission.cts.PermissionUtils.install;
+import static android.permission.cts.PermissionUtils.isPermissionGranted;
+import static android.permission.cts.PermissionUtils.uninstallApp;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.platform.test.annotations.AppModeFull;
+import android.util.Log;
+
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+public class SharedUidPermissionsTest {
+ private static final String LOG_TAG = SharedUidPermissionsTest.class.getSimpleName();
+
+ /** The package name of all apps used in the test */
+ private static final String PKG_THAT_REQUESTS_PERMISSIONS = "android.permission.cts.appthatrequestpermission";
+ private static final String PKG_THAT_REQUESTS_NO_PERMISSIONS = "android.permission.cts.appthatrequestnopermission";
+
+ private static final String TMP_DIR = "/data/local/tmp/cts/permissions/";
+ private static final String APK_THAT_REQUESTS_PERMISSIONS =
+ TMP_DIR + "CtsAppWithSharedUidThatRequestsPermissions.apk";
+ private static final String APK_THAT_REQUESTS_NO_PERMISSIONS =
+ TMP_DIR + "CtsAppWithSharedUidThatRequestsNoPermissions.apk";
+
+ @Test
+ @AppModeFull(reason = "Instant apps cannot read properties of other packages which is needed "
+ + "to grant permissions to them.")
+ public void appsWithSharedUidsSharePermissions() throws Exception {
+ install(APK_THAT_REQUESTS_PERMISSIONS);
+ install(APK_THAT_REQUESTS_NO_PERMISSIONS);
+
+ try {
+ grantPermission(PKG_THAT_REQUESTS_PERMISSIONS, READ_CONTACTS);
+ grantPermission(PKG_THAT_REQUESTS_PERMISSIONS, READ_CALENDAR);
+
+ // Permissions are shared
+ assertThat(isPermissionGranted(PKG_THAT_REQUESTS_NO_PERMISSIONS, READ_CONTACTS)).isTrue();
+ assertThat(isPermissionGranted(PKG_THAT_REQUESTS_NO_PERMISSIONS, READ_CALENDAR)).isTrue();
+
+ uninstallApp(PKG_THAT_REQUESTS_PERMISSIONS);
+
+ // When the app requesting the permissions is uninstalled, the other apps are no longer
+ // granted the permissions it requested.
+ assertThat(isPermissionGranted(PKG_THAT_REQUESTS_NO_PERMISSIONS, READ_CONTACTS)).isFalse();
+ assertThat(isPermissionGranted(PKG_THAT_REQUESTS_NO_PERMISSIONS, READ_CALENDAR)).isFalse();
+ } finally {
+ uninstallApp(PKG_THAT_REQUESTS_PERMISSIONS);
+ uninstallApp(PKG_THAT_REQUESTS_NO_PERMISSIONS);
+ }
+ }
+}
diff --git a/tests/tests/permission2/res/raw/android_manifest.xml b/tests/tests/permission2/res/raw/android_manifest.xml
index 8ca676b..989c10c 100644
--- a/tests/tests/permission2/res/raw/android_manifest.xml
+++ b/tests/tests/permission2/res/raw/android_manifest.xml
@@ -1876,6 +1876,11 @@
<permission android:name="android.permission.MANAGE_DYNAMIC_SYSTEM"
android:protectionLevel="signature" />
+ <!-- @SystemApi Allows an application to install a DynamicSystem image and get status updates.
+ @hide -->
+ <permission android:name="android.permission.INSTALL_DYNAMIC_SYSTEM"
+ android:protectionLevel="signature|privileged" />
+
<!-- @SystemApi Allows access to Broadcast Radio
@hide This is not a third-party API (intended for system apps).-->
<permission android:name="android.permission.ACCESS_BROADCAST_RADIO"
@@ -3582,10 +3587,30 @@
android:protectionLevel="signature" />
<!-- @SystemApi Allows an application to capture audio output.
+ Use the {@code CAPTURE_MEDIA_OUTPUT} permission if only the {@code USAGE_UNKNOWN}),
+ {@code USAGE_MEDIA}) or {@code USAGE_GAME}) usages are intended to be captured.
<p>Not for use by third-party applications.</p> -->
<permission android:name="android.permission.CAPTURE_AUDIO_OUTPUT"
android:protectionLevel="signature|privileged" />
+ <!-- @SystemApi Allows an application to capture the audio played by other apps
+ that have set an allow capture policy of
+ {@link android.media.AudioAttributes#ALLOW_CAPTURE_BY_SYSTEM}.
+
+ Without this permission, only audio with an allow capture policy of
+ {@link android.media.AudioAttributes#ALLOW_CAPTURE_BY_ALL} can be used.
+
+ There are strong restriction listed at
+ {@link android.media.AudioAttributes#ALLOW_CAPTURE_BY_SYSTEM}
+ on what an app can do with the captured audio.
+
+ See {@code CAPTURE_AUDIO_OUTPUT} for capturing audio use cases other than media playback.
+
+ <p>Not for use by third-party applications.</p>
+ @hide -->
+ <permission android:name="android.permission.CAPTURE_MEDIA_OUTPUT"
+ android:protectionLevel="signature|privileged" />
+
<!-- @SystemApi Allows an application to capture audio for hotword detection.
<p>Not for use by third-party applications.</p>
@hide -->
@@ -4452,6 +4477,13 @@
<permission android:name="android.permission.BIND_CARRIER_MESSAGING_CLIENT_SERVICE"
android:protectionLevel="signature" />
+ <!-- Must be required by an {@link android.service.watchdog.ExplicitHealthCheckService} to
+ ensure that only the system can bind to it.
+ @hide This is not a third-party API (intended for OEMs and system apps).
+ -->
+ <permission android:name="android.permission.BIND_EXPLICIT_HEALTH_CHECK_SERVICE"
+ android:protectionLevel="signature|privileged" />
+
<!-- @hide Permission that allows background clipboard access.
<p>Not for use by third-party applications. -->
<permission android:name="android.permission.READ_CLIPBOARD_IN_BACKGROUND"
diff --git a/tests/tests/provider/AndroidTest.xml b/tests/tests/provider/AndroidTest.xml
index e17c157..a802979 100644
--- a/tests/tests/provider/AndroidTest.xml
+++ b/tests/tests/provider/AndroidTest.xml
@@ -21,9 +21,6 @@
<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
<option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
- <target_preparer class="com.android.tradefed.targetprep.SwitchUserTargetPreparer">
- <option name="user-type" value="system"/>
- </target_preparer>
<target_preparer class="android.provider.cts.preconditions.ExternalStoragePreparer" />
<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
<option name="cleanup-apks" value="true" />
diff --git a/tests/tests/provider/src/android/provider/cts/BlockedNumberBackupRestoreTest.java b/tests/tests/provider/src/android/provider/cts/BlockedNumberBackupRestoreTest.java
index cb8eeda..4d90e1a 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.util.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 39aa0bb..97fa23a 100644
--- a/tests/tests/provider/src/android/provider/cts/BlockedNumberContractTest.java
+++ b/tests/tests/provider/src/android/provider/cts/BlockedNumberContractTest.java
@@ -23,9 +23,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;
@@ -41,9 +43,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,
@@ -55,6 +59,7 @@
mContext = getInstrumentation().getContext();
mContentResolver = mContext.getContentResolver();
mAddedUris = new ArrayList<>();
+ mIsSystemUser = isSystemUser(mContext);
}
@Override
@@ -69,6 +74,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())
@@ -122,6 +131,10 @@
}
public void testInsertAndBlockCheck_succeeds() throws Exception {
+ if (!mIsSystemUser) {
+ Log.i(TAG, "skipping BlockedNumberContractTest");
+ return;
+ }
setDefaultSmsApp(true);
assertTrue(BlockedNumberContract.canCurrentUserBlockNumbers(mContext));
@@ -149,6 +162,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.
@@ -164,6 +181,10 @@
}
public void testInsert_failsWithInvalidInputs() throws Exception {
+ if (!mIsSystemUser) {
+ Log.i(TAG, "skipping BlockedNumberContractTest");
+ return;
+ }
setDefaultSmsApp(true);
try {
@@ -205,6 +226,10 @@
}
public void testUpdate_isUnsupported() throws Exception {
+ if (!mIsSystemUser) {
+ Log.i(TAG, "skipping BlockedNumberContractTest");
+ return;
+ }
setDefaultSmsApp(true);
try {
mContentResolver.update(
@@ -215,12 +240,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");
@@ -263,6 +296,10 @@
}
public void testDelete_failsOnInvalidInputs() throws Exception {
+ if (!mIsSystemUser) {
+ Log.i(TAG, "skipping BlockedNumberContractTest");
+ return;
+ }
setDefaultSmsApp(true);
try {
@@ -284,6 +321,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);
@@ -310,6 +351,10 @@
}
public void testAccessingNonExistentMethod_fails() throws Exception {
+ if (!mIsSystemUser) {
+ Log.i(TAG, "skipping BlockedNumberContractTest");
+ return;
+ }
setDefaultSmsApp(true);
try {
@@ -357,4 +402,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/MediaStoreTest.java b/tests/tests/provider/src/android/provider/cts/MediaStoreTest.java
index 0d06f2e..213cad5 100644
--- a/tests/tests/provider/src/android/provider/cts/MediaStoreTest.java
+++ b/tests/tests/provider/src/android/provider/cts/MediaStoreTest.java
@@ -182,7 +182,7 @@
final File file = new File(ProviderTestUtils.stageDir(mVolumeName),
"cts" + System.nanoTime() + ".jpg");
ProviderTestUtils.stageFile(R.raw.volantis, file);
- inside = ProviderTestUtils.scanFile(file, true);
+ inside = ProviderTestUtils.scanFileFromShell(file);
outside = ProviderTestUtils.stageMedia(R.raw.volantis, mExternalImages);
{
diff --git a/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_MediaTest.java b/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_MediaTest.java
index 4eac249..78df1a9 100644
--- a/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_MediaTest.java
+++ b/tests/tests/provider/src/android/provider/cts/MediaStore_Audio_MediaTest.java
@@ -174,12 +174,12 @@
// Publish some content
final File dir = ProviderTestUtils.stageDir(mVolumeName);
- final Uri a = ProviderTestUtils.scanFile(
- ProviderTestUtils.stageFile(R.raw.testmp3_2, new File(dir, "a.mp3")), true);
- final Uri b = ProviderTestUtils.scanFile(
- ProviderTestUtils.stageFile(R.raw.testmp3, new File(dir, "b.mp3")), true);
- final Uri c = ProviderTestUtils.scanFile(
- ProviderTestUtils.stageFile(R.raw.testmp3_2, new File(dir, "c.mp3")), true);
+ final Uri a = ProviderTestUtils.scanFileFromShell(
+ ProviderTestUtils.stageFile(R.raw.testmp3_2, new File(dir, "a.mp3")));
+ final Uri b = ProviderTestUtils.scanFileFromShell(
+ ProviderTestUtils.stageFile(R.raw.testmp3, new File(dir, "b.mp3")));
+ final Uri c = ProviderTestUtils.scanFileFromShell(
+ ProviderTestUtils.stageFile(R.raw.testmp3_2, new File(dir, "c.mp3")));
// Confirm we can canonicalize and recover it
final Uri canonicalized = mContentResolver.canonicalize(b);
@@ -195,8 +195,8 @@
assertNull(mContentResolver.uncanonicalize(canonicalized));
// Publish data again and confirm we can recover it
- final Uri d = ProviderTestUtils.scanFile(
- ProviderTestUtils.stageFile(R.raw.testmp3, new File(dir, "d.mp3")), true);
+ final Uri d = ProviderTestUtils.scanFileFromShell(
+ ProviderTestUtils.stageFile(R.raw.testmp3, new File(dir, "d.mp3")));
assertEquals(d, mContentResolver.uncanonicalize(canonicalized));
}
}
diff --git a/tests/tests/provider/src/android/provider/cts/MediaStore_DownloadsTest.java b/tests/tests/provider/src/android/provider/cts/MediaStore_DownloadsTest.java
index 46f4073..ed6b6e1 100644
--- a/tests/tests/provider/src/android/provider/cts/MediaStore_DownloadsTest.java
+++ b/tests/tests/provider/src/android/provider/cts/MediaStore_DownloadsTest.java
@@ -210,7 +210,7 @@
public void testUpdateDownload() throws Exception {
final String displayName = "cts" + System.nanoTime();
final PendingParams params = new PendingParams(
- Downloads.EXTERNAL_CONTENT_URI, displayName, "video/3gp");
+ Downloads.EXTERNAL_CONTENT_URI, displayName, "video/3gpp");
final Uri downloadUri = Uri.parse("https://www.android.com/download?file=testvideo.3gp");
params.setDownloadUri(downloadUri);
@@ -349,7 +349,7 @@
}
private void verifyScannedDownload(File file) throws Exception {
- final Uri mediaStoreUri = ProviderTestUtils.scanFile(file, false);
+ final Uri mediaStoreUri = ProviderTestUtils.scanFile(file);
Log.e(TAG, "Scanned file " + file.getAbsolutePath() + ": " + mediaStoreUri);
mAddedUris.add(mediaStoreUri);
assertArrayEquals("File hashes should match for " + file + " and " + mediaStoreUri,
diff --git a/tests/tests/provider/src/android/provider/cts/MediaStore_Images_MediaTest.java b/tests/tests/provider/src/android/provider/cts/MediaStore_Images_MediaTest.java
index eb11276..314e2ae 100644
--- a/tests/tests/provider/src/android/provider/cts/MediaStore_Images_MediaTest.java
+++ b/tests/tests/provider/src/android/provider/cts/MediaStore_Images_MediaTest.java
@@ -411,12 +411,12 @@
// Publish some content
final File dir = ProviderTestUtils.stageDir(mVolumeName);
- final Uri a = ProviderTestUtils.scanFile(
- ProviderTestUtils.stageFile(R.raw.scenery, new File(dir, "a.jpg")), true);
- final Uri b = ProviderTestUtils.scanFile(
- ProviderTestUtils.stageFile(R.raw.lg_g4_iso_800_jpg, new File(dir, "b.jpg")), true);
- final Uri c = ProviderTestUtils.scanFile(
- ProviderTestUtils.stageFile(R.raw.scenery, new File(dir, "c.jpg")), true);
+ final Uri a = ProviderTestUtils.scanFileFromShell(
+ ProviderTestUtils.stageFile(R.raw.scenery, new File(dir, "a.jpg")));
+ final Uri b = ProviderTestUtils.scanFileFromShell(
+ ProviderTestUtils.stageFile(R.raw.lg_g4_iso_800_jpg, new File(dir, "b.jpg")));
+ final Uri c = ProviderTestUtils.scanFileFromShell(
+ ProviderTestUtils.stageFile(R.raw.scenery, new File(dir, "c.jpg")));
// Confirm we can canonicalize and recover it
final Uri canonicalized = mContentResolver.canonicalize(b);
@@ -432,8 +432,8 @@
assertNull(mContentResolver.uncanonicalize(canonicalized));
// Publish data again and confirm we can recover it
- final Uri d = ProviderTestUtils.scanFile(
- ProviderTestUtils.stageFile(R.raw.lg_g4_iso_800_jpg, new File(dir, "d.jpg")), true);
+ final Uri d = ProviderTestUtils.scanFileFromShell(
+ ProviderTestUtils.stageFile(R.raw.lg_g4_iso_800_jpg, new File(dir, "d.jpg")));
assertEquals(d, mContentResolver.uncanonicalize(canonicalized));
}
}
diff --git a/tests/tests/provider/src/android/provider/cts/ProviderTestUtils.java b/tests/tests/provider/src/android/provider/cts/ProviderTestUtils.java
index 71aa629..f6090d0 100644
--- a/tests/tests/provider/src/android/provider/cts/ProviderTestUtils.java
+++ b/tests/tests/provider/src/android/provider/cts/ProviderTestUtils.java
@@ -21,14 +21,10 @@
import static org.junit.Assert.fail;
import android.app.UiAutomation;
-import android.content.ContentProviderClient;
-import android.content.ContentResolver;
import android.content.Context;
-import android.content.Intent;
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
import android.net.Uri;
-import android.os.Bundle;
import android.os.Environment;
import android.os.FileUtils;
import android.os.ParcelFileDescriptor;
@@ -231,29 +227,16 @@
}
}
- static Uri scanFile(File file, boolean originatedFromShell) throws Exception {
- final ContentResolver resolver = InstrumentationRegistry.getTargetContext()
- .getContentResolver();
- try (ContentProviderClient cpc = resolver
- .acquireContentProviderClient(MediaStore.AUTHORITY)) {
- final Bundle in = new Bundle();
- in.putParcelable(Intent.EXTRA_STREAM, Uri.fromFile(file));
- in.putBoolean(MediaStore.EXTRA_ORIGINATED_FROM_SHELL, originatedFromShell);
- final Bundle out = cpc.call(MediaStore.AUTHORITY, MediaStore.SCAN_FILE_CALL, null, in);
- return out.getParcelable(Intent.EXTRA_STREAM);
- }
+ static Uri scanFile(File file) throws Exception {
+ return MediaStore.scanFile(InstrumentationRegistry.getTargetContext(), file);
+ }
+
+ static Uri scanFileFromShell(File file) throws Exception {
+ return MediaStore.scanFileFromShell(InstrumentationRegistry.getTargetContext(), file);
}
static void scanVolume(File file) throws Exception {
- final ContentResolver resolver = InstrumentationRegistry.getTargetContext()
- .getContentResolver();
- try (ContentProviderClient cpc = resolver
- .acquireContentProviderClient(MediaStore.AUTHORITY)) {
- final Bundle in = new Bundle();
- in.putParcelable(Intent.EXTRA_STREAM, Uri.fromFile(file));
- in.putBoolean(Intent.EXTRA_LOCAL_ONLY, true);
- cpc.call(MediaStore.AUTHORITY, MediaStore.SCAN_VOLUME_CALL, null, in);
- }
+ MediaStore.scanVolume(InstrumentationRegistry.getTargetContext(), file);
}
public static byte[] hash(InputStream in) throws Exception {
diff --git a/tests/tests/selinux/common/src/android/security/SELinuxTargetSdkTestBase.java b/tests/tests/selinux/common/src/android/security/SELinuxTargetSdkTestBase.java
index 69a4a4a..587c3e8 100644
--- a/tests/tests/selinux/common/src/android/security/SELinuxTargetSdkTestBase.java
+++ b/tests/tests/selinux/common/src/android/security/SELinuxTargetSdkTestBase.java
@@ -29,6 +29,27 @@
}
}
+ protected static void noExecuteOnly() throws IOException {
+ String[] maps = {"^[0-9a-z]+-[0-9a-z]+\\s+--xp.*\\/apex\\/com\\.android\\.runtime\\/.*",
+ "^[0-9a-z]+-[0-9a-z]+\\s+--xp.*\\/system\\/.*"};
+ for (String map : maps) {
+ final Pattern mapsPattern = Pattern.compile(map);
+ BufferedReader reader = new BufferedReader(new FileReader("/proc/self/maps"));
+ String line;
+ try {
+ while ((line = reader.readLine()) != null) {
+ Matcher m = mapsPattern.matcher(line);
+ assertFalse("System provided libraries should be not be marked execute-only " +
+ "for apps with targetSdkVersion<Q, but an execute-only segment was " +
+ "found:\n" + line, m.matches());
+ }
+
+ } finally {
+ reader.close();
+ }
+ }
+ }
+
protected static String getProperty(String property)
throws IOException {
Process process = new ProcessBuilder("getprop", property).start();
diff --git a/tests/tests/selinux/selinuxTargetSdk25/src/android/security/SELinuxTargetSdkTest.java b/tests/tests/selinux/selinuxTargetSdk25/src/android/security/SELinuxTargetSdkTest.java
index f0a76fc..df02df2 100644
--- a/tests/tests/selinux/selinuxTargetSdk25/src/android/security/SELinuxTargetSdkTest.java
+++ b/tests/tests/selinux/selinuxTargetSdk25/src/android/security/SELinuxTargetSdkTest.java
@@ -61,4 +61,8 @@
public void testDex2oat() throws Exception {
checkDex2oatAccess(true);
}
+
+ public void testNoExecuteOnly() throws IOException {
+ noExecuteOnly();
+ }
}
diff --git a/tests/tests/selinux/selinuxTargetSdk27/src/android/security/SELinuxTargetSdkTest.java b/tests/tests/selinux/selinuxTargetSdk27/src/android/security/SELinuxTargetSdkTest.java
index 0394a18..e7c0e67 100644
--- a/tests/tests/selinux/selinuxTargetSdk27/src/android/security/SELinuxTargetSdkTest.java
+++ b/tests/tests/selinux/selinuxTargetSdk27/src/android/security/SELinuxTargetSdkTest.java
@@ -64,4 +64,8 @@
public void testDex2oat() throws Exception {
checkDex2oatAccess(true);
}
+
+ public void testNoExecuteOnly() throws IOException {
+ noExecuteOnly();
+ }
}
diff --git a/tests/tests/selinux/selinuxTargetSdk28/src/android/security/SELinuxTargetSdkTest.java b/tests/tests/selinux/selinuxTargetSdk28/src/android/security/SELinuxTargetSdkTest.java
index 92e1070..1ab9706 100644
--- a/tests/tests/selinux/selinuxTargetSdk28/src/android/security/SELinuxTargetSdkTest.java
+++ b/tests/tests/selinux/selinuxTargetSdk28/src/android/security/SELinuxTargetSdkTest.java
@@ -64,4 +64,8 @@
public void testDex2oat() throws Exception {
checkDex2oatAccess(true);
}
+
+ public void testNoExecuteOnly() throws IOException {
+ noExecuteOnly();
+ }
}
diff --git a/tests/tests/systemui/OWNERS b/tests/tests/systemui/OWNERS
new file mode 100644
index 0000000..958a89a
--- /dev/null
+++ b/tests/tests/systemui/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 136515
+evanlaird@google.com
diff --git a/tests/tests/telecom/AndroidManifest.xml b/tests/tests/telecom/AndroidManifest.xml
index 51bebe4..fd24f86 100644
--- a/tests/tests/telecom/AndroidManifest.xml
+++ b/tests/tests/telecom/AndroidManifest.xml
@@ -28,6 +28,7 @@
<uses-permission android:name="android.permission.REGISTER_CALL_PROVIDER" />
<uses-permission android:name="android.permission.ACCEPT_HANDOVER" />
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
+ <uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
<uses-permission android:name="com.android.voicemail.permission.ADD_VOICEMAIL" />
@@ -102,6 +103,12 @@
</intent-filter>
</receiver>
+ <receiver android:name="android.telecom.cts.NewOutgoingCallBroadcastReceiver">
+ <intent-filter>
+ <action android:name="android.intent.action.NEW_OUTGOING_CALL"/>
+ </intent-filter>
+ </receiver>
+
<activity android:name="android.telecom.cts.MockDialerActivity">
<intent-filter>
<action android:name="android.intent.action.DIAL" />
diff --git a/tests/tests/telecom/src/android/telecom/cts/BaseTelecomTestWithMockServices.java b/tests/tests/telecom/src/android/telecom/cts/BaseTelecomTestWithMockServices.java
index 7472e48..dbc02b1 100644
--- a/tests/tests/telecom/src/android/telecom/cts/BaseTelecomTestWithMockServices.java
+++ b/tests/tests/telecom/src/android/telecom/cts/BaseTelecomTestWithMockServices.java
@@ -462,6 +462,11 @@
// that placing the call has fully completed.
final int expectedConnectionCount = currentConnectionCount + 1;
assertCSConnections(expectedConnectionCount);
+
+ // Ensure the new outgoing call broadcast fired for the outgoing call.
+ assertTrue(NewOutgoingCallBroadcastReceiver.isNewOutgoingCallBroadcastReceived());
+ // CTS test does not have read call log permission so should not get the phone number.
+ assertNull(NewOutgoingCallBroadcastReceiver.getReceivedNumber());
}
int getNumberOfConnections() {
diff --git a/tests/tests/telecom/src/android/telecom/cts/NewOutgoingCallBroadcastReceiver.java b/tests/tests/telecom/src/android/telecom/cts/NewOutgoingCallBroadcastReceiver.java
new file mode 100644
index 0000000..957add7
--- /dev/null
+++ b/tests/tests/telecom/src/android/telecom/cts/NewOutgoingCallBroadcastReceiver.java
@@ -0,0 +1,35 @@
+package android.telecom.cts;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+
+/**
+ * Broadcast receiver for {@link Intent#ACTION_NEW_OUTGOING_CALL}.
+ */
+public class NewOutgoingCallBroadcastReceiver extends BroadcastReceiver {
+ private static boolean sIsNewOutgoingCallBroadcastReceived = false;
+ private static Uri sReceivedPhoneNumber = null;
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (Intent.ACTION_NEW_OUTGOING_CALL.equals(intent.getAction())) {
+ sIsNewOutgoingCallBroadcastReceived = true;
+ sReceivedPhoneNumber = intent.getData();
+ }
+ }
+
+ public static boolean isNewOutgoingCallBroadcastReceived() {
+ return sIsNewOutgoingCallBroadcastReceived;
+ }
+
+ public static Uri getReceivedNumber() {
+ return sReceivedPhoneNumber;
+ }
+
+ public static void reset() {
+ sIsNewOutgoingCallBroadcastReceived = false;
+ sReceivedPhoneNumber = null;
+ }
+}
diff --git a/tests/tests/telecom/src/android/telecom/cts/OutgoingCallTest.java b/tests/tests/telecom/src/android/telecom/cts/OutgoingCallTest.java
index 049355f..36154d7 100644
--- a/tests/tests/telecom/src/android/telecom/cts/OutgoingCallTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/OutgoingCallTest.java
@@ -31,6 +31,7 @@
@Override
protected void setUp() throws Exception {
super.setUp();
+ NewOutgoingCallBroadcastReceiver.reset();
if (mShouldTestTelecom) {
setupConnectionService(null, FLAG_REGISTER | FLAG_ENABLE);
}
diff --git a/tests/tests/telecom/src/android/telecom/cts/SelfManagedConnectionServiceTest.java b/tests/tests/telecom/src/android/telecom/cts/SelfManagedConnectionServiceTest.java
index 71bfa2f..e17c476 100644
--- a/tests/tests/telecom/src/android/telecom/cts/SelfManagedConnectionServiceTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/SelfManagedConnectionServiceTest.java
@@ -52,6 +52,7 @@
@Override
protected void setUp() throws Exception {
super.setUp();
+ NewOutgoingCallBroadcastReceiver.reset();
mContext = getInstrumentation().getContext();
if (mShouldTestTelecom) {
// Register and enable the CTS ConnectionService; we want to be able to test a managed
@@ -334,6 +335,9 @@
// But there should be a call (including self-managed).
assertTrue(mTelecomManager.isInCall());
+ // Expect that the new outgoing call broadcast did not fire for the self-managed calls.
+ assertFalse(NewOutgoingCallBroadcastReceiver.isNewOutgoingCallBroadcastReceived());
+
setDisconnectedAndVerify(connection);
}
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/ServiceStateTest.java b/tests/tests/telephony/current/src/android/telephony/cts/ServiceStateTest.java
index 28c5b0a..04fdb2a 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/ServiceStateTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/ServiceStateTest.java
@@ -178,6 +178,14 @@
assertTrue(dataVoiceRoaming.getRoaming());
}
+ public void testIsManualSelection() {
+ ServiceState serviceState = new ServiceState();
+ serviceState.setIsManualSelection(false);
+ assertFalse(serviceState.getIsManualSelection());
+ serviceState.setIsManualSelection(true);
+ assertTrue(serviceState.getIsManualSelection());
+ }
+
private ServiceState getServiceStateWithOperatorName(String name, String numeric) {
ServiceState serviceState = new ServiceState();
serviceState.setOperatorName(name, name, numeric);
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/SmsUsageMonitorShortCodeTest.java b/tests/tests/telephony/current/src/android/telephony/cts/SmsUsageMonitorShortCodeTest.java
index 58c33be..d4df7f9 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/SmsUsageMonitorShortCodeTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/SmsUsageMonitorShortCodeTest.java
@@ -18,12 +18,19 @@
import android.content.Context;
import android.content.pm.PackageManager;
+import android.telephony.SmsManager;
import android.test.InstrumentationTestCase;
import android.test.UiThreadTest;
import com.android.internal.telephony.SmsUsageMonitor;
import android.telephony.PhoneNumberUtils;
+import static android.telephony.SmsManager.SMS_CATEGORY_FREE_SHORT_CODE;
+import static android.telephony.SmsManager.SMS_CATEGORY_STANDARD_SHORT_CODE;
+import static android.telephony.SmsManager.SMS_CATEGORY_NOT_SHORT_CODE;
+import static android.telephony.SmsManager.SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE;
+import static android.telephony.SmsManager.SMS_CATEGORY_PREMIUM_SHORT_CODE;
+
/**
* Test cases for SMS short code pattern matching in SmsUsageMonitor.
*/
@@ -32,30 +39,6 @@
private PackageManager mPackageManager;
private Context mContext;
- /** Return value from {@link SmsUsageMonitor#checkDestination} for regular phone numbers. */
- static final int CATEGORY_NOT_SHORT_CODE = 0;
-
- /**
- * Return value from {@link SmsUsageMonitor#checkDestination} for free (no cost)
- * short codes.
- */
- static final int CATEGORY_FREE_SHORT_CODE = 1;
-
- /**
- * Return value from {@link SmsUsageMonitor#checkDestination} for standard rate (non-premium)
- * short codes.
- */
- static final int CATEGORY_STANDARD_SHORT_CODE = 2;
-
- /**
- * Return value from {@link SmsUsageMonitor#checkDestination} for possible premium
- * short codes.
- */
- static final int CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE = 3;
-
- /** Return value from {@link SmsUsageMonitor#checkDestination} for premium short codes. */
- static final int CATEGORY_PREMIUM_SHORT_CODE = 4;
-
private static final class ShortCodeTest {
final String countryIso;
final String address;
@@ -72,412 +55,412 @@
* List of short code test cases.
*/
private static final ShortCodeTest[] sShortCodeTests = new ShortCodeTest[] {
- new ShortCodeTest("al", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("al", "4321", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("al", "54321", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("al", "15191", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("al", "55500", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("al", "55600", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("al", "654321", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("al", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("al", "4321", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("al", "54321", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("al", "15191", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("al", "55500", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("al", "55600", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("al", "654321", SMS_CATEGORY_NOT_SHORT_CODE),
new ShortCodeTest("am", "112", expectedReturnCode("112")),
- new ShortCodeTest("am", "101", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("am", "102", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("am", "103", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("am", "222", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("am", "1111", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("am", "9999", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("am", "1121", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("am", "1141", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("am", "1161", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("am", "3024", CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("am", "101", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("am", "102", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("am", "103", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("am", "222", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("am", "1111", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("am", "9999", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("am", "1121", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("am", "1141", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("am", "1161", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("am", "3024", SMS_CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("at", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("at", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("at", "0901234", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("at", "0900666266", CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("at", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("at", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("at", "0901234", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("at", "0900666266", SMS_CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("au", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("au", "180000", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("au", "190000", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("au", "1900000", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("au", "19000000", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("au", "19998882", CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("au", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("au", "180000", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("au", "190000", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("au", "1900000", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("au", "19000000", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("au", "19998882", SMS_CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("az", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("az", "1234", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("az", "12345", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("az", "87744", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("az", "3301", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("az", "3302", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("az", "9012", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("az", "9014", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("az", "9394", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("az", "87744", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("az", "93101", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("az", "123456", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("az", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("az", "1234", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("az", "12345", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("az", "87744", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("az", "3301", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("az", "3302", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("az", "9012", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("az", "9014", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("az", "9394", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("az", "87744", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("az", "93101", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("az", "123456", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("be", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("be", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("be", "567890", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("be", "8000", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("be", "6566", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("be", "7777", CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("be", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("be", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("be", "567890", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("be", "8000", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("be", "6566", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("be", "7777", SMS_CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("bg", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("bg", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("bg", "1234", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("bg", "12345", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("bg", "1816", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("bg", "1915", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("bg", "1916", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("bg", "1935", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("bg", "18423", CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("bg", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("bg", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("bg", "1234", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("bg", "12345", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("bg", "1816", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("bg", "1915", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("bg", "1916", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("bg", "1935", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("bg", "18423", SMS_CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("by", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("by", "1234", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("by", "3336", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("by", "5013", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("by", "5014", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("by", "7781", CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("by", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("by", "1234", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("by", "3336", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("by", "5013", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("by", "5014", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("by", "7781", SMS_CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ca", "911", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ca", "+18005551234", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ca", "8005551234", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ca", "20000", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ca", "200000", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ca", "2000000", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ca", "60999", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ca", "88188", CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ca", "911", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("ca", "+18005551234", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("ca", "8005551234", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("ca", "20000", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ca", "200000", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ca", "2000000", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("ca", "60999", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ca", "88188", SMS_CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ch", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ch", "123", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ch", "234", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ch", "3456", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ch", "98765", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("ch", "543", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ch", "83111", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ch", "234567", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ch", "87654321", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("ch", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("ch", "123", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("ch", "234", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ch", "3456", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ch", "98765", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("ch", "543", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ch", "83111", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ch", "234567", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("ch", "87654321", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("cn", "120", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("cn", "1062503000", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("cn", "1065123456", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("cn", "1066335588", CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("cn", "120", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("cn", "1062503000", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("cn", "1065123456", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("cn", "1066335588", SMS_CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("cy", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("cy", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("cy", "4321", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("cy", "54321", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("cy", "654321", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("cy", "7510", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("cy", "987654321", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("cy", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("cy", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("cy", "4321", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("cy", "54321", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("cy", "654321", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("cy", "7510", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("cy", "987654321", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("cz", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("cz", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("cz", "9090150", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("cz", "90901599", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("cz", "987654321", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("cz", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("cz", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("cz", "9090150", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("cz", "90901599", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("cz", "987654321", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("de", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("de", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("de", "1234", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "12345", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "8888", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "11111", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "11886", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "22022", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "23300", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "3434", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "34567", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "41414", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "55655", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "66766", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "66777", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "77677", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "80888", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "1232286", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("de", "987654321", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("de", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("de", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("de", "1234", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("de", "12345", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("de", "8888", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("de", "11111", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("de", "11886", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("de", "22022", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("de", "23300", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("de", "3434", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("de", "34567", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("de", "41414", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("de", "55655", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("de", "66766", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("de", "66777", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("de", "77677", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("de", "80888", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("de", "1232286", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("de", "987654321", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("dk", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("dk", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("dk", "1259", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("dk", "16123", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("dk", "987654321", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("dk", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("dk", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("dk", "1259", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("dk", "16123", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("dk", "987654321", SMS_CATEGORY_NOT_SHORT_CODE),
new ShortCodeTest("ee", "112", expectedReturnCode("112")),
- new ShortCodeTest("ee", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("ee", "123", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ee", "1259", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ee", "15330", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ee", "17999", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ee", "17010", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ee", "17013", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ee", "9034567", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ee", "34567890", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("ee", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("ee", "123", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ee", "1259", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ee", "15330", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ee", "17999", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ee", "17010", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ee", "17013", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ee", "9034567", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ee", "34567890", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("es", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("es", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("es", "25165", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("es", "27333", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("es", "995399", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("es", "87654321", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("es", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("es", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("es", "25165", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("es", "27333", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("es", "995399", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("es", "87654321", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("fi", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("fi", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("fi", "12345", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("fi", "123456", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("fi", "17159", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("fi", "17163", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("fi", "0600123", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("fi", "070012345", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("fi", "987654321", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("fi", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("fi", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("fi", "12345", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("fi", "123456", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("fi", "17159", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("fi", "17163", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("fi", "0600123", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("fi", "070012345", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("fi", "987654321", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("fr", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("fr", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("fr", "34567", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("fr", "45678", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("fr", "81185", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("fr", "87654321", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("fr", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("fr", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("fr", "34567", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("fr", "45678", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("fr", "81185", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("fr", "87654321", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("gb", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("gb", "999", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("gb", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("gb", "4567", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("gb", "45678", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("gb", "56789", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("gb", "79067", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("gb", "80079", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("gb", "654321", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("gb", "7654321", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("gb", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("gb", "999", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("gb", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("gb", "4567", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("gb", "45678", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("gb", "56789", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("gb", "79067", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("gb", "80079", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("gb", "654321", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("gb", "7654321", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ge", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ge", "8765", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ge", "2345", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ge", "8012", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ge", "8013", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ge", "8014", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ge", "8889", CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ge", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("ge", "8765", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ge", "2345", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ge", "8012", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ge", "8013", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ge", "8014", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ge", "8889", SMS_CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("gr", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("gr", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("gr", "54321", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("gr", "19567", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("gr", "19678", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("gr", "87654321", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("gr", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("gr", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("gr", "54321", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("gr", "19567", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("gr", "19678", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("gr", "87654321", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("hu", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("hu", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("hu", "012", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("hu", "0123", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("hu", "1234", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("hu", "1784", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("hu", "2345", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("hu", "01234", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("hu", "012345678", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("hu", "0123456789", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("hu", "1234567890", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("hu", "0691227910", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("hu", "2345678901", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("hu", "01234567890", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("hu", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("hu", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("hu", "012", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("hu", "0123", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("hu", "1234", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("hu", "1784", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("hu", "2345", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("hu", "01234", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("hu", "012345678", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("hu", "0123456789", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("hu", "1234567890", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("hu", "0691227910", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("hu", "2345678901", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("hu", "01234567890", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ie", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ie", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("ie", "50123", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("ie", "51234", CATEGORY_STANDARD_SHORT_CODE),
- new ShortCodeTest("ie", "52345", CATEGORY_STANDARD_SHORT_CODE),
- new ShortCodeTest("ie", "57890", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ie", "67890", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ie", "87654321", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("ie", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("ie", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("ie", "50123", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("ie", "51234", SMS_CATEGORY_STANDARD_SHORT_CODE),
+ new ShortCodeTest("ie", "52345", SMS_CATEGORY_STANDARD_SHORT_CODE),
+ new ShortCodeTest("ie", "57890", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ie", "67890", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ie", "87654321", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("il", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("il", "5432", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("il", "4422", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("il", "4545", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("il", "98765", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("il", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("il", "5432", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("il", "4422", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("il", "4545", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("il", "98765", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("it", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("it", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("it", "4567", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("it", "48000", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("it", "45678", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("it", "56789", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("it", "456789", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("it", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("it", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("it", "4567", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("it", "48000", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("it", "45678", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("it", "56789", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("it", "456789", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("kg", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("kg", "5432", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("kg", "4152", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("kg", "4157", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("kg", "4449", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("kg", "98765", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("kg", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("kg", "5432", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("kg", "4152", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("kg", "4157", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("kg", "4449", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("kg", "98765", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("kz", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("kz", "5432", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("kz", "9194", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("kz", "7790", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("kz", "98765", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("kz", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("kz", "5432", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("kz", "9194", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("kz", "7790", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("kz", "98765", SMS_CATEGORY_NOT_SHORT_CODE),
new ShortCodeTest("lt", "112", expectedReturnCode("112")),
- new ShortCodeTest("lt", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("lt", "123", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("lt", "1234", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("lt", "1381", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("lt", "1394", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("lt", "1645", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("lt", "12345", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("lt", "123456", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("lt", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("lt", "123", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("lt", "1234", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("lt", "1381", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("lt", "1394", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("lt", "1645", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("lt", "12345", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("lt", "123456", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("lu", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("lu", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("lu", "1234", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("lu", "12345", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("lu", "64747", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("lu", "678901", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("lu", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("lu", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("lu", "1234", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("lu", "12345", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("lu", "64747", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("lu", "678901", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("lv", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("lv", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("lv", "5432", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("lv", "1819", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("lv", "1863", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("lv", "1874", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("lv", "98765", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("lv", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("lv", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("lv", "5432", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("lv", "1819", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("lv", "1863", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("lv", "1874", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("lv", "98765", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("mx", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("mx", "2345", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("mx", "7766", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("mx", "23456", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("mx", "53035", CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("mx", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("mx", "2345", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("mx", "7766", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("mx", "23456", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("mx", "53035", SMS_CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("my", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("my", "1234", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("my", "23456", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("my", "32298", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("my", "33776", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("my", "345678", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("my", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("my", "1234", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("my", "23456", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("my", "32298", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("my", "33776", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("my", "345678", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("nl", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("nl", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("nl", "1234", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("nl", "4466", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("nl", "5040", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("nl", "23456", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("nl", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("nl", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("nl", "1234", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("nl", "4466", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("nl", "5040", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("nl", "23456", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("no", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("no", "1234", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("no", "2201", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("no", "2226", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("no", "2227", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("no", "23456", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("no", "234567", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("no", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("no", "1234", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("no", "2201", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("no", "2226", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("no", "2227", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("no", "23456", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("no", "234567", SMS_CATEGORY_NOT_SHORT_CODE),
new ShortCodeTest("nz", "112", expectedReturnCode("112")),
- new ShortCodeTest("nz", "123", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("nz", "2345", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("nz", "3903", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("nz", "8995", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("nz", "23456", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("nz", "123", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("nz", "2345", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("nz", "3903", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("nz", "8995", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("nz", "23456", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("pl", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("pl", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("pl", "7890", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("pl", "34567", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("pl", "7910", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("pl", "74240", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("pl", "79866", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("pl", "92525", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("pl", "87654321", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("pl", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("pl", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("pl", "7890", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("pl", "34567", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("pl", "7910", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("pl", "74240", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("pl", "79866", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("pl", "92525", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("pl", "87654321", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("pt", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("pt", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("pt", "61000", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("pt", "62345", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("pt", "68304", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("pt", "69876", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("pt", "87654321", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("pt", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("pt", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("pt", "61000", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("pt", "62345", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("pt", "68304", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("pt", "69876", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("pt", "87654321", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ro", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ro", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("ro", "1234", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ro", "1263", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ro", "1288", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ro", "1314", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ro", "1380", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ro", "7890", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ro", "12345", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("ro", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("ro", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("ro", "1234", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ro", "1263", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ro", "1288", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ro", "1314", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ro", "1380", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ro", "7890", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ro", "12345", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ru", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ru", "5432", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ru", "1161", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ru", "2097", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ru", "3933", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ru", "7781", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ru", "98765", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("ru", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("ru", "5432", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ru", "1161", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ru", "2097", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ru", "3933", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ru", "7781", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ru", "98765", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("se", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("se", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("se", "1234", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("se", "72345", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("se", "72999", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("se", "123456", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("se", "87654321", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("se", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("se", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("se", "1234", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("se", "72345", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("se", "72999", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("se", "123456", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("se", "87654321", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("sg", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("sg", "1234", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("sg", "70000", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("sg", "79999", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("sg", "73800", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("sg", "74688", CATEGORY_STANDARD_SHORT_CODE),
- new ShortCodeTest("sg", "987654", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("sg", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("sg", "1234", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("sg", "70000", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("sg", "79999", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("sg", "73800", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("sg", "74688", SMS_CATEGORY_STANDARD_SHORT_CODE),
+ new ShortCodeTest("sg", "987654", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("si", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("si", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("si", "1234", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("si", "3838", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("si", "72999", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("si", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("si", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("si", "1234", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("si", "3838", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("si", "72999", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("sk", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("sk", "116117", CATEGORY_FREE_SHORT_CODE),
- new ShortCodeTest("sk", "1234", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("sk", "6674", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("sk", "7604", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("sk", "72999", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("sk", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("sk", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
+ new ShortCodeTest("sk", "1234", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("sk", "6674", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("sk", "7604", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("sk", "72999", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("tj", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("tj", "5432", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("tj", "1161", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("tj", "1171", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("tj", "4161", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("tj", "4449", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("tj", "98765", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("tj", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("tj", "5432", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("tj", "1161", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("tj", "1171", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("tj", "4161", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("tj", "4449", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("tj", "98765", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ua", "112", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("ua", "5432", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ua", "4448", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ua", "7094", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ua", "7540", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("ua", "98765", CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("ua", "112", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("ua", "5432", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ua", "4448", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ua", "7094", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ua", "7540", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("ua", "98765", SMS_CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("us", "911", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("us", "+18005551234", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("us", "8005551234", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("us", "20000", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("us", "200000", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("us", "2000000", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("us", "20433", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("us", "21472", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("us", "23333", CATEGORY_PREMIUM_SHORT_CODE),
- new ShortCodeTest("us", "99807", CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("us", "911", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("us", "+18005551234", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("us", "8005551234", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("us", "20000", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("us", "200000", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("us", "2000000", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("us", "20433", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("us", "21472", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("us", "23333", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("us", "99807", SMS_CATEGORY_PREMIUM_SHORT_CODE),
// generic rules for other countries: 5 digits or less considered potential short code
- new ShortCodeTest("zz", "2000000", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest("zz", "54321", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("zz", "4321", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest("zz", "321", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("zz", "2000000", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest("zz", "54321", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("zz", "4321", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest("zz", "321", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
new ShortCodeTest("zz", "112", expectedReturnCode("112")),
- new ShortCodeTest(null, "2000000", CATEGORY_NOT_SHORT_CODE),
- new ShortCodeTest(null, "54321", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest(null, "4321", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
- new ShortCodeTest(null, "321", CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest(null, "2000000", SMS_CATEGORY_NOT_SHORT_CODE),
+ new ShortCodeTest(null, "54321", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest(null, "4321", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+ new ShortCodeTest(null, "321", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
new ShortCodeTest(null, "112", expectedReturnCode("112")),
};
@@ -490,27 +473,27 @@
private static int expectedReturnCode(String address) {
return PhoneNumberUtils.isEmergencyNumber(address) ?
- CATEGORY_NOT_SHORT_CODE : CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE;
+ SMS_CATEGORY_NOT_SHORT_CODE : SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE;
}
@UiThreadTest
- public void testSmsUsageMonitor() {
+ public void testSmsShortCodeDestination() {
if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
// do not test if device does not support telephony (voice or sms)
return;
}
- SmsUsageMonitor monitor = new SmsUsageMonitor(mContext);
for (ShortCodeTest test : sShortCodeTests) {
// It is intended that a short code number in country A may be an emergency number
// in country B. It is intended that the destination will be changed because of this
// reason. checkDestination() returns CATEGORY_NOT_SHORT_CODE for emergency numbers.
- if (test.category != CATEGORY_NOT_SHORT_CODE
+ if (test.category != SMS_CATEGORY_NOT_SHORT_CODE
&& PhoneNumberUtils.isEmergencyNumber(test.address, test.countryIso)) {
continue;
}
assertEquals("country: " + test.countryIso + " number: " + test.address,
- test.category, monitor.checkDestination(test.address, test.countryIso));
+ test.category, SmsManager.getDefault().checkSmsShortCodeDestination(
+ test.address, test.countryIso));
}
}
}
diff --git a/tests/tests/telephony/current/src/android/telephony/gsm/cts/SmsManagerTest.java b/tests/tests/telephony/current/src/android/telephony/gsm/cts/SmsManagerTest.java
deleted file mode 100644
index 5cd81a3..0000000
--- a/tests/tests/telephony/current/src/android/telephony/gsm/cts/SmsManagerTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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 android.telephony.gsm.cts;
-
-import java.util.ArrayList;
-
-import android.app.PendingIntent;
-import android.telephony.gsm.SmsManager;
-
-@SuppressWarnings("deprecation")
-public class SmsManagerTest extends android.telephony.cts.SmsManagerTest {
-
- @Override
- public void testGetDefault() {
- assertNotNull(getSmsManager());
- }
-
- @Override
- protected ArrayList<String> divideMessage(String text) {
- return getSmsManager().divideMessage(text);
- }
-
- private android.telephony.gsm.SmsManager getSmsManager() {
- return android.telephony.gsm.SmsManager.getDefault();
- }
-
- @Override
- protected void sendMultiPartTextMessage(String destAddr, ArrayList<String> parts,
- ArrayList<PendingIntent> sentIntents, ArrayList<PendingIntent> deliveryIntents) {
- getSmsManager().sendMultipartTextMessage(destAddr, null, parts, sentIntents, deliveryIntents);
- }
-
- @Override
- protected void sendDataMessage(String destAddr,short port, byte[] data, PendingIntent sentIntent, PendingIntent deliveredIntent) {
- getSmsManager().sendDataMessage(destAddr, null, port, data, sentIntent, deliveredIntent);
- }
-
- @Override
- protected void sendTextMessage(String destAddr, String text, PendingIntent sentIntent, PendingIntent deliveredIntent) {
- getSmsManager().sendTextMessage(destAddr, null, text, sentIntent, deliveredIntent);
- }
-}
\ No newline at end of file
diff --git a/tests/tests/telephony/current/src/android/telephony/gsm/cts/SmsMessage_SubmitPduTest.java b/tests/tests/telephony/current/src/android/telephony/gsm/cts/SmsMessage_SubmitPduTest.java
deleted file mode 100644
index b933841..0000000
--- a/tests/tests/telephony/current/src/android/telephony/gsm/cts/SmsMessage_SubmitPduTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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 android.telephony.gsm.cts;
-
-import android.telephony.gsm.SmsMessage;
-import android.test.AndroidTestCase;
-
-@SuppressWarnings("deprecation")
-public class SmsMessage_SubmitPduTest extends AndroidTestCase {
-
- public void testToString() {
- SmsMessage.SubmitPdu sp = new SmsMessage.SubmitPdu();
- assertNotNull(sp.toString());
- }
-}
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 6112b73..89a3b4d 100644
--- a/tests/tests/text/src/android/text/format/cts/TimeTest.java
+++ b/tests/tests/text/src/android/text/format/cts/TimeTest.java
@@ -35,9 +35,19 @@
import org.junit.Test;
import org.junit.runner.RunWith;
+import java.time.Duration;
+import java.time.Instant;
+import java.time.LocalDateTime;
+import java.time.Month;
+import java.time.ZoneId;
+import java.time.temporal.ChronoUnit;
+import java.time.zone.ZoneOffsetTransition;
+import java.time.zone.ZoneRules;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
@@ -1251,17 +1261,19 @@
public void testSetToNow() {
Time t = new Time(Time.TIMEZONE_UTC);
- // Time works in seconds so all millis values have to be divided by 1000, otherwise
- // the greater accuracy of System.currentTimeMillis() causes the test to fail.
-
- long lowerBound = System.currentTimeMillis() / 1000;
+ Instant lowerBound = Instant.now();
t.setToNow();
- long upperBound = System.currentTimeMillis() / 1000;
+ Instant upperBound = Instant.now();
- long actual = t.toMillis(true /* ignore isDst */) / 1000;
- assertTrue(lowerBound <= actual && actual <= upperBound);
+ // Time.toMillis() only works in seconds so lower/upper/toMillis() are converted to seconds,
+ // otherwise the greater accuracy from using milliseconds for lowerBound/upperBound can
+ // cause the test to fail.
+ long actualSeconds =
+ Instant.ofEpochMilli(t.toMillis(true /* ignore isDst */)).getEpochSecond();
+ assertTrue(lowerBound.getEpochSecond() <= actualSeconds
+ && actualSeconds <= upperBound.getEpochSecond());
}
@Test
@@ -1408,7 +1420,7 @@
// Try each minute from one minute before the skipped hour until one after.
for (int i = -1; i <= 60; i++) {
- int minutesInMillis = i * 60000;
+ int minutesInMillis = (int) Duration.ofMinutes(i).toMillis();
int[] timeFields = new int[] { 2007, 2, 11, 2, i, 0, -999 /* not used */, 9, 9, 9 };
Time time = new Time(timezone);
@@ -1478,7 +1490,7 @@
// Try each minute from one minute before the duplicated hour until one after.
for (int i = -1; i <= 60; i++) {
- int minutesInMillis = i * 60000;
+ int minutesInMillis = (int) Duration.ofMinutes(i).toMillis();
Time time = new Time(PstPdt.ID);
int[] timeFields = new int[] { 2007, 10, 4, 1, i, 0, -999 /* not used */, 9, 9, 9};
@@ -1784,23 +1796,24 @@
@Test
public void testSetMillis_utc() {
+ Instant baseTime = Instant.ofEpochSecond(0);
String tz = Time.TIMEZONE_UTC;
Time t = new Time(tz);
- t.set(1000L);
+ t.set(baseTime.plus(1, ChronoUnit.SECONDS).toEpochMilli());
Time expected = new Time(tz);
Fields.set(expected, 1970, 0, 1, 0, 0, 1, 0 /* isDst */, 0, 0, 4);
Fields.verifyTimeEquals(expected, t);
- t.set(2000L);
+ t.set(baseTime.plus(2, ChronoUnit.SECONDS).toEpochMilli());
Fields.set(expected, 1970, 0, 1, 0, 0, 2, 0 /* isDst */, 0, 0, 4);
Fields.verifyTimeEquals(expected, t);
- t.set(1000L * 60);
+ t.set(baseTime.plus(1, ChronoUnit.MINUTES).toEpochMilli());
Fields.set(expected, 1970, 0, 1, 0, 1, 0, 0 /* isDst */, 0, 0, 4);
Fields.verifyTimeEquals(expected, t);
- t.set((1000L * 60 * 60 * 24) + 1000L);
+ t.set(baseTime.plus(1, ChronoUnit.DAYS).plus(1, ChronoUnit.SECONDS).toEpochMilli());
Fields.set(expected, 1970, 0, 2, 0, 0, 1, 0 /* isDst */, 0, 1, 5);
Fields.verifyTimeEquals(expected, t);
}
@@ -1952,7 +1965,7 @@
public void testSetJulianDay() {
Time time = new Time();
- // For each day of the year in 2008, and for each timezone,
+ // For each 20th day of the year in 2008, and for each timezone,
// test that we can set the Julian day correctly.
for (int monthDay = 1; monthDay <= 366; monthDay += 20) {
for (int zoneIndex = 0; zoneIndex < mTimeZones.length; zoneIndex++) {
@@ -1987,7 +2000,7 @@
continue;
}
int day = Time.getJulianDay(millis, time.gmtoff);
- assertEquals("Error: gmtoff " + (time.gmtoff / 3600.0) + " day " + julianDay
+ assertEquals("Error: gmtoff " + time.gmtoff + " day " + julianDay
+ " millis " + millis+ " " + time.format("%B %d, %Y")
+ " " + time.timezone,
day, julianDay);
@@ -2178,7 +2191,7 @@
// Try each minute from one minute before the skipped hour until one after.
for (int i = -1; i <= 60; i++) {
- int minutesInMillis = i * 60000;
+ int minutesInMillis = (int) Duration.ofMinutes(i).toMillis();
int[] dateTimeArgs = new int[] { 2007, 2, 11, 2, i, 0 };
int[] normalizedAdjustedBackwardDateTimeArgs;
@@ -2369,7 +2382,7 @@
normalizedAdjustedForwardDateTimeArgs = null;
}
- int minutesInMillis = i * 60000;
+ int minutesInMillis = (int) Duration.ofMinutes(i).toMillis();
// isDst = 0, normalize(true)
Fields.setDateTime(time, dateTimeArgs);
@@ -2825,12 +2838,223 @@
}
@Test
- public void test_bug118835133() {
- Time t = new Time("Asia/Singapore");
- Fields.set(t, 2018, 9, 30, 12, 48, 32, 0 /* isDst */, 0, 0, 0);
- // With http://b/118835133 toMillis() returns -1.
- assertEquals(1540874912000L, t.toMillis(true /* ignoreDst */));
+ public void test_bug118835133_valuesCloseToInt32Saturation() {
+ // With http://b/118835133 toMillis() returns -1. This is the original bug case.
+ LocalDateTime localDateTime = LocalDateTime.of(2018, Month.OCTOBER, 30, 12, 48, 32);
+ assertLocalTimeMillis("Asia/Singapore", localDateTime, 1540874912000L);
+
+ // The following tests check the upper limits of what we support. There's no guarantee
+ // we can't deal with values higher that this but the exact value depends on the version of
+ // zic being used as a transition at exactly Integer.MAX_VALUE can affect our ability to
+ // deal with times. So, we just assert what we know we must be able to do to catch major
+ // regressions. The following timezones are chosen because of their respective geographical
+ // locations (positive / negative offset from UTC) plus whether they had transitions at
+ // Integer.MAX_VALUE with zic > 2014b. The transitions could change in future but there's
+ // nothing we can do about that.
+
+ // Positive offset, has MAX_VALUE transition with zic 2018e.
+ checkUpperSupportedLimit("Asia/Singapore");
+ // Negative offset, has MAX_VALUE transition with zic 2018e.
+ checkUpperSupportedLimit("America/Argentina/Buenos_Aires");
+ // Positive offset, has no MAX_VALUE transition with zic 2018e.
+ checkUpperSupportedLimit("Asia/Shanghai");
+ // Negative offset, has no MAX_VALUE transition with zic 2018e.
+ checkUpperSupportedLimit("America/Los_Angeles");
+
+ // See comment above, but for Integer.MIN_VALUE / lower bound. Most zones have a MIN_VALUE
+ // transition with zic 2018e so it is harder to test zones without them so we just cover the
+ // same ones as we do for upper bound above.
+
+ // Positive offset, has MIN_VALUE transition with zic 2018e.
+ checkLowerSupportedLimit("Asia/Singapore");
+ checkLowerSupportedLimit("Asia/Shanghai");
+ // Negative offset, has MIN_VALUE transition with zic 2018e.
+ checkLowerSupportedLimit("America/Argentina/Buenos_Aires");
+ checkLowerSupportedLimit("America/Los_Angeles");
}
+
+ private static void checkUpperSupportedLimit(String timeZoneId) {
+ // Integer.MAX_VALUE == Jan 19, 2038 03:14:07 GMT.
+ LocalDateTime max32BitTime = LocalDateTime.of(2038, Month.JANUARY, 19, 3, 14, 7);
+
+ // We take off one extra day in all cases because we can't guarantee we can handle
+ // exactly Integer.MAX_VALUE in all cases due to integer overflow when applying zone
+ // offsets. It gets fiddly if we try to be exact and this is good enough.
+ LocalDateTime testLocalTime = max32BitTime.minusDays(1);
+
+ long expectedMillis = calculateExpectedMillis(timeZoneId, testLocalTime);
+ assertLocalTimeMillis(timeZoneId, testLocalTime, expectedMillis);
+ }
+
+ private static void checkLowerSupportedLimit(String timeZoneId) {
+ // Integer.MIN_VALUE == 13 Dec 1901 20:45:52 GMT.
+ LocalDateTime min32BitTime = LocalDateTime.of(1901, Month.DECEMBER, 13, 20, 45, 52);
+
+ // We add on one extra day in all cases because we can't guarantee we can handle
+ // exactly Integer.MIN_VALUE in all cases due to integer underflow when applying
+ // zone offsets. It gets fiddly if we try to be exact and this is good enough.
+ LocalDateTime testLocalTime = min32BitTime.plusDays(1);
+
+ long expectedMillis = calculateExpectedMillis(timeZoneId, testLocalTime);
+ assertLocalTimeMillis(timeZoneId, testLocalTime, expectedMillis);
+ }
+
+ private static long calculateExpectedMillis(String timeZoneId, LocalDateTime localDateTime) {
+ // We use java.util.TimeZone with Calendar because that's the same data as used by Time and
+ // so they should generally agree. ICU, and java.time which is backed by ICU on Android, are
+ // generally better because they handle things outside of the Integer range.
+ TimeZone tz = TimeZone.getTimeZone(timeZoneId);
+ Calendar calendar = new GregorianCalendar(tz);
+ calendar.set(
+ localDateTime.getYear(),
+ localDateTime.getMonthValue() - 1 /* calendar uses [0-11] */,
+ localDateTime.getDayOfMonth(),
+ localDateTime.getHour(),
+ localDateTime.getMinute(),
+ localDateTime.getSecond()
+ );
+ calendar.set(Calendar.MILLISECOND, 0);
+ return calendar.getTimeInMillis();
+ }
+
+ private static void assertLocalTimeMillis(String timeZoneId, LocalDateTime testLocalTime,
+ long expectedMillis) {
+
+ Time t = new Time(timeZoneId);
+ Fields.set(t,
+ testLocalTime.getYear(),
+ testLocalTime.getMonthValue() - 1 /* Time class uses [0-11] */,
+ testLocalTime.getDayOfMonth(),
+ testLocalTime.getHour(),
+ testLocalTime.getMinute(),
+ testLocalTime.getSecond(),
+ 0 /* isDst */, 0, 0, 0);
+ assertEquals(expectedMillis, t.toMillis(true /* ignoreDst */));
+ }
+
+ /**
+ * This is a test to ensure that Time generally works in the time period that apps will be
+ * interested in. There are various specific tests that exist to catch known edge cases but this
+ * test gives more general coverage looking for obvious issues in simple cases. Inspired by
+ * b/118835133 which revealed there was an obvious problem with recent dates in some zones after
+ * Android was upgraded to a newer zic tool.
+ */
+ @Test
+ public void test_toMillisAndNormalizeGenerallyWork() {
+ String[] tzIds = TimeZone.getAvailableIDs();
+ for (String tzId : tzIds) {
+ TimeZone timeZone = TimeZone.getTimeZone(tzId);
+ Calendar calendar = new GregorianCalendar(timeZone);
+ for (long timeInMillis : calculateToMillisTestTimes(tzId)) {
+ // We use Calendar to obtain local time fields for timeInMillis.
+ calendar.setTimeInMillis(timeInMillis);
+
+ Time time = new Time(tzId);
+ Fields.setDateTime(time, calendar);
+
+ // Now we check that Time can work out the time in millis from the local time fields
+ // we give it.
+ assertEquals("toMillis() must match calendar in " + tzId + " at "
+ + time, calendar.getTimeInMillis(), time.toMillis(true /* ignoreDst */));
+
+ // Repeat with normalize(), which allows us to also check isDst / gmtoff.
+ long normalizedMillis = time.normalize(true /* ignoreDst */);
+ assertEquals("normalize() must match calendar in " + tzId + " at "
+ + time, calendar.getTimeInMillis(), normalizedMillis);
+ assertEquals("isDst failed to match calendar in " + tzId + " at "
+ + time, timeZone.inDaylightTime(new Date(timeInMillis)), (time.isDst != 0));
+ assertEquals(timeZone.getOffset(timeInMillis),
+ Duration.ofSeconds(time.gmtoff).toMillis());
+ }
+ }
+ }
+
+ private static List<Long> calculateToMillisTestTimes(String tzId) {
+ List<Long> times = new ArrayList<>();
+
+ // Some local times can be ambiguous (when there's a "fall back") or missing (when there's
+ // a "spring forward"). Calendar and Time may reasonably do different things for these. We
+ // try to avoid those cases by picking the middle of intervals with a given offset, or at
+ // least a day away from a transition if we can't do that.
+
+ // java.time is used to calculate times below. java.time is built on ICU on Android
+ // which is independently developed. It enables us to get to the transition / interval
+ // information we need to generate mid-points using public APIs, something we can't
+ // currently do any other way.
+
+ // Start generating times using the interval around 1970, then iterate through following
+ // intervals. Stop when we get close to the top of the supported range for Time.
+ final Instant startTime = Instant.ofEpochSecond(0);
+ final Instant stopTime = Instant.ofEpochSecond(Integer.MAX_VALUE).minus(1, ChronoUnit.DAYS);
+
+ ZoneId zoneId = ZoneId.of(tzId);
+ ZoneRules rules = zoneId.getRules();
+ ZoneOffsetTransition low = rules.previousTransition(startTime);
+ if (low == null) {
+ low = rules.nextTransition(startTime);
+ if (low == null) {
+ // Make sure we always test some times even for simple time zones without
+ // transitions.
+ return Arrays.asList(startTime.toEpochMilli(), stopTime.toEpochMilli());
+ }
+ }
+
+ ZoneOffsetTransition high;
+ while ((high = rules.nextTransition(low.getInstant())) != null) {
+ Instant highTime = high.getInstant();
+ if (highTime.isAfter(stopTime)) {
+ break;
+ }
+
+ Instant lowTime = low.getInstant();
+ Instant midPointTime = calculateMidPoint(highTime, lowTime);
+ if (midPointTime.isBefore(startTime)) {
+ // Avoid the first-loop case where the mid point can be before the start time.
+ // The next transition must be after start time so use a time before that.
+ times.add(highTime.minus(1, ChronoUnit.DAYS).toEpochMilli());
+ } else {
+ times.add(midPointTime.toEpochMilli());
+ }
+
+ low = high;
+ }
+
+ // Add a time for the last interval we encountered. We either ran out of transitions or the
+ // end point of the next transition is above the stop time.
+ Instant finalTime = low.getInstant().plus(1, ChronoUnit.DAYS);
+ if (finalTime.isAfter(startTime) && finalTime.isBefore(stopTime)) {
+ times.add(finalTime.toEpochMilli());
+ }
+ return times;
+ }
+
+ private static Instant calculateMidPoint(Instant highStart, Instant lowStart) {
+ // Use seconds so we don't end up with half seconds that Time can't deal with.
+ long midPointSeconds = (lowStart.getEpochSecond() + highStart.getEpochSecond()) / 2;
+ return Instant.ofEpochSecond(midPointSeconds);
+ }
+
+ @Test
+ public void test_bug118835133_fixEarliestRawOffsetValue() {
+ // This test confirms the behavior between Integer.MIN_VALUE seconds and the next
+ // transition. With zic <= 2014b there is no explicit transition at Integer.MIN_VALUE
+ // seconds. This test should pass regardless of zic version used as the Android behavior
+ // is stable for this zone as we have fixed the logic used to determine the offset before
+ // the first transition AND the first transition for the zone is after Integer.MIN_VALUE.
+ Time t = new Time("Africa/Abidjan");
+ // Jan 1, 1912 12:16:08 AM UTC / Jan 1, 1912 00:00:00 local time
+ Instant oldEarliestTransition = Instant.ofEpochSecond(-1830383032);
+ Instant beforeOldEarliestTransition = oldEarliestTransition.minus(Duration.ofDays(1));
+ t.set(beforeOldEarliestTransition.toEpochMilli());
+
+ // The expected local time equivalent to the oldEarliestTransition time minus 1 day and
+ // offset by -968 seconds.
+ Time expected = new Time("Africa/Abidjan");
+ Fields.set(expected, 1911, 11, 31, 0, 0, 0, 0 /* isDst */, -968, 364, 0);
+
+ Fields.verifyTimeEquals(expected, t);
+ }
+
private static void verifyNormalizeResult(boolean normalizeArgument, Time toNormalize,
Time expectedTime, long expectedTimeMillis) {
long actualTimeMillis = toNormalize.normalize(normalizeArgument /* ignore isDst */);
@@ -2903,6 +3127,9 @@
return String.format(format.toString(), values.toArray());
}
+ /**
+ * Set date/time fields (only) on the supplied time. month is [0-11].
+ */
public static void setDateTime(Time t, int year, int month, int monthDay, int hour,
int minute, int second) {
t.year = year;
@@ -2914,6 +3141,22 @@
t.allDay = false;
}
+ /**
+ * Set date/time fields (only) on the supplied time using the equivalent Calendar fields.
+ */
+ public static void setDateTime(Time t, Calendar calendar) {
+ setDateTime(t,
+ calendar.get(Calendar.YEAR),
+ calendar.get(Calendar.MONTH),
+ calendar.get(Calendar.DAY_OF_MONTH),
+ calendar.get(Calendar.HOUR_OF_DAY),
+ calendar.get(Calendar.MINUTE),
+ calendar.get(Calendar.SECOND));
+ }
+
+ /**
+ * See {@link #setDateTime(Time, int, int, int, int, int, int)} for array order.
+ */
public static void setDateTime(Time t, int[] args) {
assertEquals(6, args.length);
setDateTime(t, args[0], args[1], args[2], args[3], args[4], args[5]);
@@ -2929,6 +3172,9 @@
t.weekDay = weekDay;
}
+ /**
+ * Set fields on the supplied time. month is [0-11].
+ */
public static void setAllDayDate(Time t, int year, int month, int monthDay) {
t.year = year;
t.month = month;
@@ -2936,12 +3182,18 @@
t.allDay = true;
}
+ /**
+ * See {@link #set(Time, int, int, int, int, int, int, int, int, int, int)} for array order.
+ */
public static void set(Time t, int[] args) {
assertEquals(10, args.length);
set(t, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8],
args[9]);
}
+ /**
+ * Set fields on the supplied time. month is [0-11].
+ */
public static void set(Time t, int year, int month, int monthDay, int hour, int minute,
int second, int isDst, int gmtoff, int yearDay, int weekDay) {
setDateTime(t, year, month, monthDay, hour, minute, second);
@@ -2967,7 +3219,7 @@
}
public static int getUtcOffsetMillis(boolean isDst) {
- return getUtcOffsetSeconds(isDst) * 1000;
+ return (int) Duration.ofSeconds(getUtcOffsetSeconds(isDst)).toMillis();
}
}
diff --git a/tests/tests/theme/OWNERS b/tests/tests/theme/OWNERS
new file mode 100644
index 0000000..ae2c27b
--- /dev/null
+++ b/tests/tests/theme/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 25700
+alanv@google.com
\ No newline at end of file
diff --git a/tests/tests/theme/res/values-land/styles.xml b/tests/tests/theme/res/values-land/styles.xml
new file mode 100644
index 0000000..b6cd950
--- /dev/null
+++ b/tests/tests/theme/res/values-land/styles.xml
@@ -0,0 +1,23 @@
+<?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.
+-->
+<resources>
+
+ <!-- Base application theme. -->
+ <style name="RebaseTestThemeOverlay">
+ <item name="rebase_configuration_dependent_text">rebase_landscape</item>
+ </style>
+
+</resources>
diff --git a/tests/tests/theme/res/values-port/styles.xml b/tests/tests/theme/res/values-port/styles.xml
new file mode 100644
index 0000000..05068c9
--- /dev/null
+++ b/tests/tests/theme/res/values-port/styles.xml
@@ -0,0 +1,23 @@
+<?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.
+-->
+<resources>
+
+ <!-- Base application theme. -->
+ <style name="RebaseTestThemeOverlay">
+ <item name="rebase_configuration_dependent_text">rebase_portrait</item>
+ </style>
+
+</resources>
diff --git a/tests/tests/theme/res/values/attrs.xml b/tests/tests/theme/res/values/attrs.xml
new file mode 100644
index 0000000..1339b7d
--- /dev/null
+++ b/tests/tests/theme/res/values/attrs.xml
@@ -0,0 +1,21 @@
+<?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.
+-->
+<resources>
+
+ <!-- Base application theme. -->
+ <attr name="rebase_configuration_dependent_text" format="string"/>
+
+</resources>
diff --git a/tests/tests/theme/res/values/styles.xml b/tests/tests/theme/res/values/styles.xml
new file mode 100644
index 0000000..258389d
--- /dev/null
+++ b/tests/tests/theme/res/values/styles.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+
+ <!-- Base application theme. -->
+ <style name="RebaseTestThemeBase">
+ <item name="rebase_configuration_dependent_text">base</item>
+ </style>
+
+ <style name="RebaseTestThemeOverlay"/>
+
+</resources>
diff --git a/tests/tests/theme/src/android/theme/cts/ThemeRebaseTest.java b/tests/tests/theme/src/android/theme/cts/ThemeRebaseTest.java
new file mode 100644
index 0000000..63bb7d9
--- /dev/null
+++ b/tests/tests/theme/src/android/theme/cts/ThemeRebaseTest.java
@@ -0,0 +1,111 @@
+/*
+ * 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.theme.cts;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
+import android.content.Context;
+import android.content.res.Configuration;
+import android.content.res.Resources;
+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.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@SmallTest
+@RunWith(AndroidJUnit4.class)
+public class ThemeRebaseTest {
+
+ private Context mContext;
+ private Resources.Theme mTheme;
+ private Configuration mInitialConfig;
+ private TypedValue mOutValue = new TypedValue();
+
+ @Before
+ public void before() {
+ Context targetContext = InstrumentationRegistry.getTargetContext();
+ Configuration config = new Configuration();
+ config.orientation = Configuration.ORIENTATION_PORTRAIT;
+ mContext = targetContext.createConfigurationContext(config);
+ mTheme = mContext.getTheme();
+ mInitialConfig = new Configuration(mContext.getResources().getConfiguration());
+ }
+
+ /**
+ * {@link Resources#updateConfiguration(Configuration, DisplayMetrics)} doesn't update the
+ * {@link android.app.ResourcesManager} cache's {@link android.content.res.ResourcesKey},
+ * so we need to manually reset the {@link Configuration} so that new calls to
+ * {@link Context#createConfigurationContext} work as expected.
+ */
+ @After
+ public void after() {
+ Resources resources = mContext.getResources();
+ resources.updateConfiguration(mInitialConfig, resources.getDisplayMetrics());
+ }
+
+ @Test
+ public void testConfigChangeAndRebase() {
+ mTheme.applyStyle(R.style.RebaseTestThemeBase, false);
+
+ assertConfigText("base");
+
+ mTheme.applyStyle(R.style.RebaseTestThemeOverlay, true);
+
+ assertConfigText("rebase_portrait");
+
+ Configuration newConfig = new Configuration(mInitialConfig);
+ newConfig.orientation = Configuration.ORIENTATION_LANDSCAPE;
+ mContext.getResources().updateConfiguration(newConfig, null);
+
+ assertNotEquals(mTheme.getChangingConfigurations(), 0);
+
+ // Assert value hasn't changed before rebase
+ assertConfigText("rebase_portrait");
+
+ mTheme.rebase();
+
+ assertConfigText("rebase_landscape");
+ }
+
+ @Test
+ public void testNoConfigChangeDoesNothing() {
+ mTheme.applyStyle(R.style.RebaseTestThemeBase, false);
+
+ assertConfigText("base");
+
+ mTheme.applyStyle(R.style.RebaseTestThemeOverlay, true);
+
+ assertConfigText("rebase_portrait");
+
+ mTheme.rebase();
+
+ assertConfigText("rebase_portrait");
+ }
+
+ private void assertConfigText(String expectedText) {
+ mTheme.resolveAttribute(R.attr.rebase_configuration_dependent_text, mOutValue, true);
+ assertEquals(expectedText, mOutValue.string);
+ }
+}
diff --git a/tests/tests/view/AndroidManifest.xml b/tests/tests/view/AndroidManifest.xml
index 5c814ab..4bd8e6b 100644
--- a/tests/tests/view/AndroidManifest.xml
+++ b/tests/tests/view/AndroidManifest.xml
@@ -22,6 +22,7 @@
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-feature android:name="android.hardware.camera" />
<application android:label="Android TestCase"
@@ -313,6 +314,11 @@
</intent-filter>
</activity>
+ <service android:name="android.view.cts.surfacevalidator.LocalMediaProjectionService"
+ android:foregroundServiceType="mediaProjection"
+ android:enabled="true">
+ </service>
+
<activity android:name="android.view.cts.HoverCtsActivity"
android:screenOrientation="locked">
<intent-filter>
diff --git a/tests/tests/view/src/android/view/cts/SystemGestureExclusionRectsTest.java b/tests/tests/view/src/android/view/cts/SystemGestureExclusionRectsTest.java
index 779efd7..4992363 100644
--- a/tests/tests/view/src/android/view/cts/SystemGestureExclusionRectsTest.java
+++ b/tests/tests/view/src/android/view/cts/SystemGestureExclusionRectsTest.java
@@ -41,8 +41,10 @@
import org.junit.runner.RunWith;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
/**
@@ -133,10 +135,12 @@
assertEquals("reached expected animated destination", prev.right, 35);
- // Make sure we don't get any more callbacks after removing the VTO listener
- final List<List<Rect>> oldResults = new ArrayList<>(results);
+ // Make sure we don't get any more callbacks after removing the VTO listener.
+ // Capture values on the UI thread to avoid races.
+ final List<List<Rect>> oldResults = new ArrayList<>();
final CountDownLatch secondDoneAnimating = new CountDownLatch(1);
mActivityRule.runOnUiThread(() -> {
+ oldResults.addAll(results);
final View v = activity.findViewById(R.id.animating_view);
final ViewTreeObserver vto = v.getViewTreeObserver();
vto.removeOnSystemGestureExclusionRectsChangedListener(vtoListener);
@@ -148,6 +152,57 @@
assertEquals("got unexpected exclusion rects", oldResults, results);
}
+ /**
+ * Test that the system internals correctly handle cycling between exclusion rects present
+ * and rects absent.
+ */
+ @Test
+ public void removingRects() throws Throwable {
+ final Activity activity = mActivityRule.getActivity();
+ for (int i = 0; i < 3; i++) {
+ final GestureExclusionLatcher[] setter = new GestureExclusionLatcher[1];
+ mActivityRule.runOnUiThread(() -> {
+ final View v = activity.findViewById(R.id.animating_view);
+ setter[0] = GestureExclusionLatcher.watching(v.getViewTreeObserver());
+ v.setSystemGestureExclusionRects(Lists.newArrayList(new Rect(0, 0, 5, 5)));
+ });
+ assertTrue("set rects timeout", setter[0].await(3, SECONDS));
+
+ final GestureExclusionLatcher[] unsetter = new GestureExclusionLatcher[1];
+ mActivityRule.runOnUiThread(() -> {
+ final View v = activity.findViewById(R.id.animating_view);
+ unsetter[0] = GestureExclusionLatcher.watching(v.getViewTreeObserver());
+ v.setSystemGestureExclusionRects(Collections.emptyList());
+ });
+ assertTrue("unset rects timeout", unsetter[0].await(3, SECONDS));
+ }
+ }
+
+ private static class GestureExclusionLatcher implements Consumer<List<Rect>> {
+ private final CountDownLatch mLatch = new CountDownLatch(1);
+ private final ViewTreeObserver mVto;
+
+ public static GestureExclusionLatcher watching(ViewTreeObserver vto) {
+ final GestureExclusionLatcher latcher = new GestureExclusionLatcher(vto);
+ vto.addOnSystemGestureExclusionRectsChangedListener(latcher);
+ return latcher;
+ }
+
+ private GestureExclusionLatcher(ViewTreeObserver vto) {
+ mVto = vto;
+ }
+
+ public boolean await(long time, TimeUnit unit) throws InterruptedException {
+ return mLatch.await(time, unit);
+ }
+
+ @Override
+ public void accept(List<Rect> rects) {
+ mLatch.countDown();
+ mVto.removeOnSystemGestureExclusionRectsChangedListener(this);
+ }
+ }
+
private static class AnimationDoneListener extends AnimatorListenerAdapter {
private final CountDownLatch mLatch;
diff --git a/tests/tests/view/surfacevalidator/src/android/view/cts/surfacevalidator/CapturedActivity.java b/tests/tests/view/surfacevalidator/src/android/view/cts/surfacevalidator/CapturedActivity.java
index 25155bd..ce94185 100644
--- a/tests/tests/view/surfacevalidator/src/android/view/cts/surfacevalidator/CapturedActivity.java
+++ b/tests/tests/view/surfacevalidator/src/android/view/cts/surfacevalidator/CapturedActivity.java
@@ -19,8 +19,10 @@
import static org.junit.Assert.fail;
import android.app.Activity;
+import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
+import android.content.ServiceConnection;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.Point;
@@ -32,6 +34,7 @@
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
+import android.os.IBinder;
import android.os.Looper;
import android.support.test.uiautomator.By;
import android.support.test.uiautomator.UiDevice;
@@ -81,6 +84,7 @@
private volatile boolean mOnEmbedded;
private volatile boolean mOnWatch;
private CountDownLatch mCountDownLatch;
+ private boolean mProjectionServiceBound = false;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -105,7 +109,7 @@
(MediaProjectionManager) getSystemService(Context.MEDIA_PROJECTION_SERVICE);
mCountDownLatch = new CountDownLatch(1);
- startActivityForResult(mProjectionManager.createScreenCaptureIntent(), PERMISSION_CODE);
+ bindMediaProjectionService();
}
public void dismissPermissionDialog() {
@@ -119,6 +123,27 @@
}
}
+ private ServiceConnection mConnection = new ServiceConnection() {
+
+ @Override
+ public void onServiceConnected(ComponentName className, IBinder service) {
+ startActivityForResult(mProjectionManager.createScreenCaptureIntent(), PERMISSION_CODE);
+ dismissPermissionDialog();
+ mProjectionServiceBound = true;
+ }
+
+ @Override
+ public void onServiceDisconnected(ComponentName arg0) {
+ mProjectionServiceBound = false;
+ }
+ };
+
+ private void bindMediaProjectionService() {
+ Intent intent = new Intent(this, LocalMediaProjectionService.class);
+ startService(intent);
+ bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
+ }
+
@Override
public void onDestroy() {
super.onDestroy();
@@ -127,6 +152,10 @@
mMediaProjection.stop();
mMediaProjection = null;
}
+ if (mProjectionServiceBound) {
+ unbindService(mConnection);
+ mProjectionServiceBound = false;
+ }
}
@Override
diff --git a/tests/tests/view/surfacevalidator/src/android/view/cts/surfacevalidator/LocalMediaProjectionService.java b/tests/tests/view/surfacevalidator/src/android/view/cts/surfacevalidator/LocalMediaProjectionService.java
new file mode 100644
index 0000000..d3d3fa2
--- /dev/null
+++ b/tests/tests/view/surfacevalidator/src/android/view/cts/surfacevalidator/LocalMediaProjectionService.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright 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.view.cts.surfacevalidator;
+
+import android.app.Notification;
+import android.app.NotificationChannel;
+import android.app.NotificationManager;
+import android.app.Service;
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.drawable.Icon;
+import android.os.Binder;
+import android.os.IBinder;
+
+public class LocalMediaProjectionService extends Service {
+
+ private final IBinder mBinder = new LocalBinder();
+ private Bitmap mTestBitmap;
+
+ private static final String NOTIFICATION_CHANNEL_ID = "Surfacevalidator";
+ private static final String CHANNEL_NAME = "ProjectionService";
+
+ public class LocalBinder extends Binder {
+ LocalMediaProjectionService getService() {
+ return LocalMediaProjectionService.this;
+ }
+ }
+
+ @Override
+ public int onStartCommand(Intent intent, int flags, int startId) {
+ startForeground();
+ return super.onStartCommand(intent, flags, startId);
+ }
+
+ @Override
+ public IBinder onBind(Intent intent) {
+ return mBinder;
+ }
+
+ @Override
+ public void onDestroy() {
+ if (mTestBitmap != null) {
+ mTestBitmap.recycle();
+ mTestBitmap = null;
+ }
+ super.onDestroy();
+ }
+
+ private Icon createNotificationIcon() {
+ mTestBitmap = Bitmap.createBitmap(50, 50, Bitmap.Config.ARGB_8888);
+ final Canvas canvas = new Canvas(mTestBitmap);
+ canvas.drawColor(Color.BLUE);
+ return Icon.createWithBitmap(mTestBitmap);
+ }
+
+ private void startForeground() {
+ final NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID,
+ CHANNEL_NAME, NotificationManager.IMPORTANCE_NONE);
+ channel.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
+
+ final NotificationManager notificationManager =
+ (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
+ notificationManager.createNotificationChannel(channel);
+
+ final Notification.Builder notificationBuilder =
+ new Notification.Builder(this, NOTIFICATION_CHANNEL_ID);
+
+ final Notification notification = notificationBuilder.setOngoing(true)
+ .setContentTitle("App is running")
+ .setSmallIcon(createNotificationIcon())
+ .setCategory(Notification.CATEGORY_SERVICE)
+ .setContentText("Context")
+ .build();
+
+ startForeground(2, notification);
+ }
+
+}
diff --git a/tools/cts-api-coverage/src/com/android/cts/apicoverage/ApiClass.java b/tools/cts-api-coverage/src/com/android/cts/apicoverage/ApiClass.java
index 5870a91..8c04be7 100644
--- a/tools/cts-api-coverage/src/com/android/cts/apicoverage/ApiClass.java
+++ b/tools/cts-api-coverage/src/com/android/cts/apicoverage/ApiClass.java
@@ -22,6 +22,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import java.util.Set;
/** Representation of a class in the API with constructors and methods. */
@@ -116,33 +117,26 @@
// Mark matching constructors in the superclass
mSuperClass.markConstructorCovered(parameterTypes, coveredbyApk);
}
- ApiConstructor apiConstructor = getConstructor(parameterTypes);
- if (apiConstructor != null) {
- apiConstructor.setCovered(coveredbyApk);
- }
-
+ Optional<ApiConstructor> apiConstructor = getConstructor(parameterTypes);
+ apiConstructor.ifPresent(constructor -> constructor.setCovered(coveredbyApk));
}
/** Look for a matching method and if found and mark it as covered */
- public void markMethodCovered(
- String name, List<String> parameterTypes, String returnType, String coveredbyApk) {
+ public void markMethodCovered(String name, List<String> parameterTypes, String coveredbyApk) {
if (mSuperClass != null) {
// Mark matching methods in the super class
- mSuperClass.markMethodCovered(name, parameterTypes, returnType, coveredbyApk);
+ mSuperClass.markMethodCovered(name, parameterTypes, coveredbyApk);
}
if (!mInterfaceMap.isEmpty()) {
// Mark matching methods in the interfaces
- for (String interfaceName : mInterfaceMap.keySet()) {
- ApiClass mInterface = mInterfaceMap.get(interfaceName);
+ for (ApiClass mInterface : mInterfaceMap.values()) {
if (mInterface != null) {
- mInterface.markMethodCovered(name, parameterTypes, returnType, coveredbyApk);
+ mInterface.markMethodCovered(name, parameterTypes, coveredbyApk);
}
}
}
- ApiMethod apiMethod = getMethod(name, parameterTypes, returnType);
- if (apiMethod != null) {
- apiMethod.setCovered(coveredbyApk);
- }
+ Optional<ApiMethod> apiMethod = getMethod(name, parameterTypes);
+ apiMethod.ifPresent(method -> method.setCovered(coveredbyApk));
}
public Collection<ApiMethod> getMethods() {
@@ -182,17 +176,16 @@
return getTotalMethods();
}
- private ApiMethod getMethod(String name, List<String> parameterTypes, String returnType) {
+ private Optional<ApiMethod> getMethod(String name, List<String> parameterTypes) {
for (ApiMethod method : mApiMethods) {
boolean methodNameMatch = name.equals(method.getName());
boolean parameterTypeMatch =
compareParameterTypes(method.getParameterTypes(), parameterTypes);
- boolean returnTypeMatch = compareType(method.getReturnType(), returnType);
- if (methodNameMatch && parameterTypeMatch && returnTypeMatch) {
- return method;
+ if (methodNameMatch && parameterTypeMatch) {
+ return Optional.of(method);
}
}
- return null;
+ return Optional.empty();
}
/**
@@ -267,12 +260,12 @@
return type.length() == 3 && isGenericType(type.substring(0, 1)) && isArrayType(type);
}
- private ApiConstructor getConstructor(List<String> parameterTypes) {
+ private Optional<ApiConstructor> getConstructor(List<String> parameterTypes) {
for (ApiConstructor constructor : mApiConstructors) {
if (compareParameterTypes(constructor.getParameterTypes(), parameterTypes)) {
- return constructor;
+ return Optional.of(constructor);
}
}
- return null;
+ return Optional.empty();
}
}
diff --git a/tools/cts-api-coverage/src/com/android/cts/apicoverage/ApiPackage.java b/tools/cts-api-coverage/src/com/android/cts/apicoverage/ApiPackage.java
index e242355..b09a281 100644
--- a/tools/cts-api-coverage/src/com/android/cts/apicoverage/ApiPackage.java
+++ b/tools/cts-api-coverage/src/com/android/cts/apicoverage/ApiPackage.java
@@ -84,34 +84,37 @@
Map.Entry<String, ApiClass> entry = it.next();
ApiClass apiClass = entry.getValue();
if (apiClass.getSuperClassName() != null) {
+ // Add the super class
String superClassName = apiClass.getSuperClassName();
- // Split the fully qualified class name into package and class name.
- String packageName = superClassName.substring(0, superClassName.lastIndexOf('.'));
- String className = superClassName.substring(
- superClassName.lastIndexOf('.') + 1, superClassName.length());
- if (packageMap.containsKey(packageName)) {
- ApiPackage apiPackage = packageMap.get(packageName);
- ApiClass superClass = apiPackage.getClass(className);
- if (superClass != null) {
- // Add the super class
- apiClass.setSuperClass(superClass);
- }
- }
+ ApiClass superClass = findClass(packageMap, superClassName);
+ apiClass.setSuperClass(superClass);
}
for (String interfaceName : apiClass.getInterfaceNames()) {
- // Split the fully qualified interface name into package and interface name.
- String packageName = interfaceName.substring(0, interfaceName.lastIndexOf('.'));
- String className = interfaceName.substring(
- interfaceName.lastIndexOf('.') + 1, interfaceName.length());
- if (packageMap.containsKey(packageName)) {
- ApiPackage apiPackage = packageMap.get(packageName);
- ApiClass apiInterface = apiPackage.getClass(className);
- if (apiInterface != null) {
- // Add the interface
- apiClass.resolveInterface(interfaceName, apiInterface);
- }
- }
+ // Add the interface
+ ApiClass apiInterface = findClass(packageMap, interfaceName);
+ apiClass.resolveInterface(interfaceName, apiInterface);
}
}
}
+
+ /** Find a class that matches the fully qualified class name. */
+ private ApiClass findClass(Map<String, ApiPackage> packageMap, String fullClassName) {
+ // Split the fully qualified class name into package and class name.
+ int delimiterIndex = fullClassName.lastIndexOf('.');
+ while (delimiterIndex > 0) {
+ String packageName = fullClassName.substring(0, delimiterIndex);
+ String className = fullClassName.substring(delimiterIndex + 1);
+ if (packageMap.containsKey(packageName)) {
+ ApiPackage apiPackage = packageMap.get(packageName);
+ ApiClass apiClass = apiPackage.getClass(className);
+ if (apiClass != null) {
+ // api class found
+ return apiClass;
+ }
+ }
+ delimiterIndex = fullClassName.lastIndexOf('.', delimiterIndex - 1);
+ }
+ return null;
+ }
}
+
diff --git a/tools/cts-api-coverage/src/com/android/cts/apicoverage/CtsApiCoverage.java b/tools/cts-api-coverage/src/com/android/cts/apicoverage/CtsApiCoverage.java
index 95eb89f9..a5fa922 100644
--- a/tools/cts-api-coverage/src/com/android/cts/apicoverage/CtsApiCoverage.java
+++ b/tools/cts-api-coverage/src/com/android/cts/apicoverage/CtsApiCoverage.java
@@ -73,8 +73,6 @@
private static final String NDK_PACKAGE_NAME = "ndk";
- private static final String NDK_DUMMY_RETURN_TYPE = "na";
-
private static void printUsage() {
System.out.println("Usage: cts-api-coverage [OPTION]... [APK]...");
System.out.println();
@@ -313,7 +311,6 @@
apiClass.markMethodCovered(
sym.name,
parameterTypes,
- NDK_DUMMY_RETURN_TYPE,
moduleName);
} else {
System.err.println(
diff --git a/tools/cts-api-coverage/src/com/android/cts/apicoverage/DexDepsXmlHandler.java b/tools/cts-api-coverage/src/com/android/cts/apicoverage/DexDepsXmlHandler.java
index b728654..089662d 100644
--- a/tools/cts-api-coverage/src/com/android/cts/apicoverage/DexDepsXmlHandler.java
+++ b/tools/cts-api-coverage/src/com/android/cts/apicoverage/DexDepsXmlHandler.java
@@ -39,8 +39,6 @@
private String mCurrentMethodName;
- private String mCurrentMethodReturnType;
-
private List<String> mCurrentParameterTypes = new ArrayList<String>();
DexDepsXmlHandler(ApiCoverage packageMap, String testApkName) {
@@ -61,7 +59,6 @@
mCurrentParameterTypes.clear();
} else if ("method".equalsIgnoreCase(localName)) {
mCurrentMethodName = CurrentXmlHandler.getValue(attributes, "name");
- mCurrentMethodReturnType = CurrentXmlHandler.getValue(attributes, "return");
mCurrentParameterTypes.clear();
} else if ("parameter".equalsIgnoreCase(localName)) {
mCurrentParameterTypes.add(CurrentXmlHandler.getValue(attributes, "type"));
@@ -85,8 +82,7 @@
ApiClass apiClass = apiPackage.getClass(mCurrentClassName);
if (apiClass != null) {
apiClass.markMethodCovered(
- mCurrentMethodName, mCurrentParameterTypes, mCurrentMethodReturnType,
- mTestApkName);
+ mCurrentMethodName, mCurrentParameterTypes, mTestApkName);
}
}
}
diff --git a/tools/cts-device-info/jni/Android.bp b/tools/cts-device-info/jni/Android.bp
new file mode 100644
index 0000000..c8b788f
--- /dev/null
+++ b/tools/cts-device-info/jni/Android.bp
@@ -0,0 +1,33 @@
+// 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.
+
+cc_library_shared {
+ name: "libctsdeviceinfo",
+ srcs: [
+ "CtsDeviceInfoJniOnLoad.cpp",
+ "com_android_cts_deviceinfo_VulkanDeviceInfo.cpp",
+ ],
+ static_libs: ["libvkjson_ndk"],
+ shared_libs: [
+ "libvulkan",
+ "liblog",
+ "libdl",
+ ],
+ stl: "c++_static",
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
+ sdk_version: "current",
+}
diff --git a/tools/cts-device-info/jni/Android.mk b/tools/cts-device-info/jni/Android.mk
deleted file mode 100644
index 5786c20..0000000
--- a/tools/cts-device-info/jni/Android.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-# 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.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libctsdeviceinfo
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_SRC_FILES := \
- CtsDeviceInfoJniOnLoad.cpp \
- com_android_cts_deviceinfo_VulkanDeviceInfo.cpp
-
-LOCAL_STATIC_LIBRARIES := libvkjson_ndk
-LOCAL_SHARED_LIBRARIES := libvulkan liblog libdl
-LOCAL_NDK_STL_VARIANT := c++_static
-
-LOCAL_CFLAGS := -Wall -Werror
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/tools/cts-holo-generation/Android.bp b/tools/cts-holo-generation/Android.bp
new file mode 100644
index 0000000..72fb338
--- /dev/null
+++ b/tools/cts-holo-generation/Android.bp
@@ -0,0 +1,30 @@
+// 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.
+
+android_app {
+ name: "CtsHoloGeneration",
+ dex_preopt: {
+ enabled: false,
+ },
+ optimize: {
+ enabled: false,
+ },
+ static_libs: ["androidx.test.rules"],
+ libs: [
+ "android.test.runner.stubs",
+ "android.test.base.stubs",
+ ],
+ srcs: ["src/**/*.java"],
+ sdk_version: "current",
+}
diff --git a/tools/cts-holo-generation/Android.mk b/tools/cts-holo-generation/Android.mk
deleted file mode 100644
index de39c63..0000000
--- a/tools/cts-holo-generation/Android.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-# 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)
-
-# don't include this package in any target
-LOCAL_MODULE_TAGS := optional
-# and when built explicitly put it in the data partition
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-# and because it is in data, do not strip classes.dex
-LOCAL_DEX_PREOPT := false
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_PACKAGE_NAME := CtsHoloGeneration
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_PACKAGE)
diff --git a/tools/cts-media-preparer-app/Android.bp b/tools/cts-media-preparer-app/Android.bp
new file mode 100644
index 0000000..37b7e2e
--- /dev/null
+++ b/tools/cts-media-preparer-app/Android.bp
@@ -0,0 +1,36 @@
+// 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.
+
+android_test {
+ name: "CtsMediaPreparerApp",
+ defaults: ["cts_defaults"],
+ dex_preopt: {
+ enabled: false,
+ },
+ optimize: {
+ enabled: false,
+ },
+ srcs: ["src/**/*.java"],
+ static_libs: [
+ "androidx.test.rules",
+ "compatibility-device-util-axt",
+ ],
+ // tag this module as a cts test artifact
+ test_suites: [
+ "cts",
+ "vts",
+ "general-tests",
+ ],
+ sdk_version: "test_current",
+}
diff --git a/tools/cts-media-preparer-app/Android.mk b/tools/cts-media-preparer-app/Android.mk
deleted file mode 100644
index c2d5731..0000000
--- a/tools/cts-media-preparer-app/Android.mk
+++ /dev/null
@@ -1,39 +0,0 @@
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH:= $(call my-dir)
-
-include $(CLEAR_VARS)
-
-# Don't include this package in any target
-LOCAL_MODULE_TAGS := tests
-# When built, explicitly put it in the data partition.
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_DEX_PREOPT := false
-
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-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
-
-LOCAL_PACKAGE_NAME := CtsMediaPreparerApp
-
-LOCAL_SDK_VERSION := current
-
-include $(BUILD_CTS_PACKAGE)