summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-prod (mdb) <android-build-team-robot@google.com>2019-10-07 20:11:01 +0000
committerandroid-build-prod (mdb) <android-build-team-robot@google.com>2019-10-07 20:11:01 +0000
commit7c1e1f93bec43e828725159759a30aa91f16063d (patch)
treec56c1fbae01d0c73084efdfb708f8a4eec6a616b
parent40851740a673bf790ed3ab7d03544fdd312b2068 (diff)
parent7d6b276bfde2e8d6bef02d457c02e3eec991b254 (diff)
downloadcts-7c1e1f93bec43e828725159759a30aa91f16063d.tar.gz
Snap for 5925218 from 7d6b276bfde2e8d6bef02d457c02e3eec991b254 to android10-tests-release
Change-Id: I24e4227c91292b37f9299d3e0b44ece42ff4aa5d
-rw-r--r--apps/CameraITS/pymodules/its/objects.py28
-rw-r--r--apps/CameraITS/tests/scene4/test_aspect_ratio_and_crop.py22
-rw-r--r--apps/CtsVerifier/AndroidManifest.xml10
-rw-r--r--apps/CtsVerifier/res/layout/multiuser_headless_system_user.xml122
-rwxr-xr-xapps/CtsVerifier/res/values/strings.xml30
-rw-r--r--apps/CtsVerifier/src/com/android/cts/verifier/multiuser/HeadlessSystemUserTestActivity.java92
-rw-r--r--tests/autofillservice/src/android/autofillservice/cts/LoginActivityTest.java3
-rw-r--r--tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecyclePipTests.java4
-rw-r--r--tests/sensor/src/android/hardware/cts/SensorTest.java3
-rw-r--r--tests/tests/media/src/android/media/cts/AudioRecordTest.java45
-rw-r--r--tests/tests/telephony/current/src/android/telephony/cts/SubscriptionManagerTest.java4
-rw-r--r--tests/tests/transition/res/values/styles.xml2
12 files changed, 334 insertions, 31 deletions
diff --git a/apps/CameraITS/pymodules/its/objects.py b/apps/CameraITS/pymodules/its/objects.py
index 1f457f424ff..3c39205af48 100644
--- a/apps/CameraITS/pymodules/its/objects.py
+++ b/apps/CameraITS/pymodules/its/objects.py
@@ -12,16 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import os
-import os.path
-import sys
-import re
-import json
-import tempfile
-import time
-import unittest
-import subprocess
import math
+import unittest
+
def int_to_rational(i):
"""Function to convert Python integers to Camera2 rationals.
@@ -322,6 +315,23 @@ def get_largest_yuv_format(props, match_ar=None):
return fmt
+def get_largest_jpeg_format(props, match_ar=None):
+ """Return a capture request and format spec for the largest jpeg size.
+
+ Args:
+ props: the object returned from its.device.get_camera_properties().
+ match_ar: aspect ratio to match
+
+ Returns:
+ fmt: an output format specification, for the largest possible jpeg
+ format for this device.
+ """
+ size = get_available_output_sizes("jpeg", props, match_ar_size=match_ar)[0]
+ fmt = {"format": "jpeg", "width": size[0], "height": size[1]}
+
+ return fmt
+
+
def get_max_digital_zoom(props):
"""Returns the maximum amount of zooming possible by the camera device.
diff --git a/apps/CameraITS/tests/scene4/test_aspect_ratio_and_crop.py b/apps/CameraITS/tests/scene4/test_aspect_ratio_and_crop.py
index 4d601e823b1..de134a73a8f 100644
--- a/apps/CameraITS/tests/scene4/test_aspect_ratio_and_crop.py
+++ b/apps/CameraITS/tests/scene4/test_aspect_ratio_and_crop.py
@@ -84,7 +84,7 @@ def aspect_ratio_scale_factors(ref_ar_string, props):
for ar_string in AR_CHECKED:
match_ar = [float(x) for x in ar_string.split(":")]
try:
- f = its.objects.get_largest_yuv_format(props, match_ar=match_ar)
+ f = its.objects.get_largest_jpeg_format(props, match_ar=match_ar)
if f["height"] > height_max:
height_max = f["height"]
if f["width"] > width_max:
@@ -113,8 +113,8 @@ def aspect_ratio_scale_factors(ref_ar_string, props):
return ar_scaling
-def find_yuv_fov_reference(cam, req, props):
- """Determine the circle coverage of the image in YUV reference image.
+def find_jpeg_fov_reference(cam, req, props):
+ """Determine the circle coverage of the image in JPEG reference image.
Args:
cam: camera object
@@ -131,7 +131,7 @@ def find_yuv_fov_reference(cam, req, props):
for ar in AR_CHECKED:
match_ar = [float(x) for x in ar.split(":")]
try:
- f = its.objects.get_largest_yuv_format(props, match_ar=match_ar)
+ f = its.objects.get_largest_jpeg_format(props, match_ar=match_ar)
fmt_dict[f["height"]*f["width"]] = {"fmt": f, "ar": ar}
except IndexError:
continue
@@ -143,16 +143,18 @@ def find_yuv_fov_reference(cam, req, props):
cap = cam.do_capture(req, fmt_dict[ar_max_pixels]["fmt"])
w = cap["width"]
h = cap["height"]
+ fmt = cap["format"]
+
img = its.image.convert_capture_to_rgb_image(cap, props=props)
- print "Captured %s %dx%d" % ("yuv", w, h)
- img_name = "%s_%s_w%d_h%d.png" % (NAME, "yuv", w, h)
+ print "Captured %s %dx%d" % (fmt, w, h)
+ img_name = "%s_%s_w%d_h%d.png" % (NAME, fmt, w, h)
_, _, circle_size = measure_aspect_ratio(img, False, img_name, True)
fov_percent = calc_circle_image_ratio(circle_size[1], circle_size[0], w, h)
ref_fov["fmt"] = fmt_dict[ar_max_pixels]["ar"]
ref_fov["percent"] = fov_percent
ref_fov["w"] = w
ref_fov["h"] = h
- print "Using YUV reference:", ref_fov
+ print "Using JPEG reference:", ref_fov
return ref_fov
@@ -237,7 +239,7 @@ def main():
# If raw capture is available, use it as ground truth.
if raw_avlb:
# Capture full-frame raw. Use its aspect ratio and circle center
- # location as ground truth for the other jepg or yuv images.
+ # location as ground truth for the other jpeg or yuv images.
print "Creating references for fov_coverage from RAW"
out_surface = {"format": "raw"}
cap_raw = cam.do_capture(req, out_surface)
@@ -311,9 +313,9 @@ def main():
ref_fov["h"] = h_raw
print "Using RAW reference:", ref_fov
else:
- ref_fov = find_yuv_fov_reference(cam, req, props)
+ ref_fov = find_jpeg_fov_reference(cam, req, props)
else:
- ref_fov = find_yuv_fov_reference(cam, req, props)
+ ref_fov = find_jpeg_fov_reference(cam, req, props)
# Determine scaling factors for AR calculations
ar_scaling = aspect_ratio_scale_factors(ref_fov["fmt"], props)
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index 12d8cee77ce..41cbad77a53 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -3811,6 +3811,16 @@
</intent-filter>
<meta-data android:name="test_category" android:value="@string/test_category_instant_apps" />
</activity>
+ <activity android:name=".multiuser.HeadlessSystemUserTestActivity"
+ android:label="@string/multiuser_headless_sys_user_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_car" />
+ <meta-data android:name="test_required_features"
+ android:value="android.hardware.type.automotive" />
+ </activity>
</application>
</manifest>
diff --git a/apps/CtsVerifier/res/layout/multiuser_headless_system_user.xml b/apps/CtsVerifier/res/layout/multiuser_headless_system_user.xml
new file mode 100644
index 00000000000..507acb62872
--- /dev/null
+++ b/apps/CtsVerifier/res/layout/multiuser_headless_system_user.xml
@@ -0,0 +1,122 @@
+<?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"
+ style="@style/RootLayoutPadding"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+ <ScrollView
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/multiuser_headless_sys_user_can_skip_txt"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_margin="@dimen/js_padding"
+ android:scrollbars="vertical"
+ android:gravity="bottom"
+ android:text="@string/multiuser_headless_sys_user_can_skip"
+ android:visibility="gone" />
+
+ <!-- Does System UI allow switching or selecting users? -->
+ <LinearLayout
+ android:id="@+id/multiuser_headless_sys_user_allow_switching_layout"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:visibility="gone">
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_margin="@dimen/js_padding"
+ android:scrollbars="vertical"
+ android:gravity="bottom"
+ android:id="@+id/multiuser_headless_sys_user_switchable_txt"
+ android:text="@string/multiuser_headless_sys_user_switchable_instructions" />
+ <Button android:id="@+id/multiuser_headless_sys_user_switchable_next_btn"
+ android:text="@string/multiuser_headless_sys_user_next"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="@dimen/js_padding" />
+ </LinearLayout>
+
+ <!-- Is User 0 name unique? -->
+ <LinearLayout
+ android:id="@+id/multiuser_headless_sys_user_adb_users_layout"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+ android:visibility="gone">
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_margin="@dimen/js_padding"
+ android:scrollbars="vertical"
+ android:gravity="bottom"
+ android:id="@+id/multiuser_headless_sys_user_adb_users_txt"
+ android:text="@string/multiuser_headless_sys_user_adb_users_instructions" />
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+ <Button android:id="@+id/multiuser_headless_sys_user_adb_users_yes_btn"
+ android:text="@string/multiuser_headless_sys_user_yes"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="@dimen/js_padding" />
+ <Button android:id="@+id/multiuser_headless_sys_user_adb_users_no_btn"
+ android:text="@string/multiuser_headless_sys_user_no"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_margin="@dimen/js_padding" />
+ </LinearLayout>
+ </LinearLayout>
+
+ <!-- Instructions for unique user 0 name -->
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_margin="@dimen/js_padding"
+ android:scrollbars="vertical"
+ android:gravity="bottom"
+ android:id="@+id/multiuser_headless_sys_user_unique_txt"
+ android:text="@string/multiuser_headless_sys_user_unique_instructions"
+ android:visibility="gone"/>
+
+ <!-- Instructions for common user 0 name -->
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_margin="@dimen/js_padding"
+ android:scrollbars="vertical"
+ android:gravity="bottom"
+ android:id="@+id/multiuser_headless_sys_user_common_txt"
+ android:text="@string/multiuser_headless_sys_user_common_instructions"
+ android:visibility="gone"/>
+ </LinearLayout>
+ </ScrollView>
+
+ <include 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 c318d43206a..3b14b44f794 100755
--- a/apps/CtsVerifier/res/values/strings.xml
+++ b/apps/CtsVerifier/res/values/strings.xml
@@ -5171,4 +5171,34 @@ Follow the instructions on the screen to measure the frequency response for the
6. Verify there is an action allowing user to clear/delete app. \n\n
7. Click Pass button if checks in step 5 and 6 passed, otherwise click Fail button.
</string>
+
+ <!-- Strings for Mulituser.HeadlessSystemUser Test -->
+ <string name="multiuser_headless_sys_user_test">Headless System User Test</string>
+ <string name="multiuser_headless_sys_user_info">This test verifies that users cannot interact with the headless system user (user 0).</string>
+ <string name="multiuser_headless_sys_user_can_skip">Your device does not support multiuser. You can tap Pass.</string>
+ <string name="multiuser_headless_sys_user_next">Proceed</string>
+ <string name="multiuser_headless_sys_user_yes">Yes</string>
+ <string name="multiuser_headless_sys_user_no">No</string>
+ <string name="multiuser_headless_sys_user_switchable_instructions">
+ Tap Proceed if the system allows switching or selecting users. Otherwise, tap Pass at the bottom.
+ </string>
+ <string name="multiuser_headless_sys_user_adb_users_instructions">
+ Run the \'adb shell pm list users\' shell command and identify the name of User 0. Is User 0 name unique?
+ </string>
+ <string name="multiuser_headless_sys_user_unique_instructions">
+ You will need to test every screen that can switch or select users.\n\n
+ For each screen, verify User 0\'s name is not shown. Please do the following: \n\n
+ 1. Navigate to a screen that can switch or select users. \n
+ 2. Tap Fail at the bottom if User 0 name is shown in the user selection screen. \n
+ 3. Repeat test at another switch or select user screen. Tap Pass when all screens are tested without fail.
+ </string>
+ <string name="multiuser_headless_sys_user_common_instructions">
+ You will need to test every screen that can switch or select users.\n\n
+ For each screen, switch into each user to verify they are not user 0. Please do the following: \n\n
+ 1. Navigate to a screen to switch user. \n
+ 2. Run the \'adb shell am get-current-user\' shell command. \n
+ 3. If return is 0, click Fail button. Otherwise, continue to next step. \n
+ 4. Switch to another user with User 0 name from the screen and repeat steps 2-4 until all users are verified. \n
+ 5. Repeat test at another switch or select user screen. Tap Pass when all screens are tested without fail.
+ </string>
</resources>
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/multiuser/HeadlessSystemUserTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/multiuser/HeadlessSystemUserTestActivity.java
new file mode 100644
index 00000000000..ed0cea70ed5
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/multiuser/HeadlessSystemUserTestActivity.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.cts.verifier.multiuser;
+
+import com.android.compatibility.common.util.CddTest;
+import com.android.cts.verifier.PassFailButtons;
+import com.android.cts.verifier.R;
+
+import android.os.Bundle;
+import android.os.UserManager;
+import android.view.View;
+import android.widget.Button;
+
+/**
+ * CTS Verifier to test the 'MUST NOT allow users to interact with nor switch into the
+ * Headless System User' CDD Automotive requirement.
+ */
+@CddTest(requirement="9.5/A-1-1")
+public class HeadlessSystemUserTestActivity extends PassFailButtons.Activity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // Setup the UI.
+ setContentView(R.layout.multiuser_headless_system_user);
+ setPassFailButtonClickListeners();
+ setInfoResources(
+ R.string.multiuser_headless_sys_user_test,
+ R.string.multiuser_headless_sys_user_info,
+ -1);
+
+ boolean supportsMultiUser = UserManager.getMaxSupportedUsers() > 1;
+
+ if (supportsMultiUser) {
+ findViewById(R.id.multiuser_headless_sys_user_allow_switching_layout)
+ .setVisibility(View.VISIBLE);
+ } else {
+ findViewById(R.id.multiuser_headless_sys_user_can_skip_txt)
+ .setVisibility(View.VISIBLE);
+ }
+
+ Button nextBtn = findViewById(R.id.multiuser_headless_sys_user_switchable_next_btn);
+ nextBtn.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ findViewById(R.id.multiuser_headless_sys_user_adb_users_layout)
+ .setVisibility(View.VISIBLE);
+ }
+ });
+
+ Button yesBtn = findViewById(R.id.multiuser_headless_sys_user_adb_users_yes_btn);
+ yesBtn.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ toggleInstructions(true);
+ }
+ });
+
+ Button noBtn = findViewById(R.id.multiuser_headless_sys_user_adb_users_no_btn);
+ noBtn.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ toggleInstructions(false);
+ }
+ });
+ }
+
+ private void toggleInstructions(boolean isUser0NameUnique) {
+ if (isUser0NameUnique) {
+ findViewById(R.id.multiuser_headless_sys_user_unique_txt).setVisibility(View.VISIBLE);
+ findViewById(R.id.multiuser_headless_sys_user_common_txt).setVisibility(View.GONE);
+ } else {
+ findViewById(R.id.multiuser_headless_sys_user_unique_txt).setVisibility(View.GONE);
+ findViewById(R.id.multiuser_headless_sys_user_common_txt).setVisibility(View.VISIBLE);
+ }
+ }
+} \ No newline at end of file
diff --git a/tests/autofillservice/src/android/autofillservice/cts/LoginActivityTest.java b/tests/autofillservice/src/android/autofillservice/cts/LoginActivityTest.java
index 0dbfc7311bd..64dee4d8549 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/LoginActivityTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/LoginActivityTest.java
@@ -2397,6 +2397,9 @@ public class LoginActivityTest extends AbstractLoginActivityTestCase {
assertTextAndValue(passwordNode, password);
waitUntilDisconnected();
+
+ // Wait and check if the save window is correctly hidden.
+ mUiBot.assertSaveNotShowing(SAVE_DATA_TYPE_PASSWORD);
} catch (RetryableException e) {
throw new RetryableException(e, "on step %d", i);
} catch (Throwable t) {
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecyclePipTests.java b/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecyclePipTests.java
index 9024c9a2f72..5ddfb06bc0a 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecyclePipTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecyclePipTests.java
@@ -212,6 +212,8 @@ public class ActivityLifecyclePipTests extends ActivityLifecycleClientTestBase {
@Test
public void testSplitScreenBelowPip() throws Exception {
+ assumeTrue(supportsSplitScreenMultiWindow());
+
// Launch Pip-capable activity and enter Pip immediately
final Activity pipActivity = mPipActivityTestRule.launchActivity(
new Intent().putExtra(EXTRA_ENTER_PIP, true));
@@ -250,6 +252,8 @@ public class ActivityLifecyclePipTests extends ActivityLifecycleClientTestBase {
@Test
public void testPipAboveSplitScreen() throws Exception {
+ assumeTrue(supportsSplitScreenMultiWindow());
+
// Launch first activity
final Activity firstActivity =
mFirstActivityTestRule.launchActivity(new Intent());
diff --git a/tests/sensor/src/android/hardware/cts/SensorTest.java b/tests/sensor/src/android/hardware/cts/SensorTest.java
index debf8ce75dd..8eb1ddf8143 100644
--- a/tests/sensor/src/android/hardware/cts/SensorTest.java
+++ b/tests/sensor/src/android/hardware/cts/SensorTest.java
@@ -93,7 +93,8 @@ public class SensorTest extends SensorTestCase {
mAndroidSensorList = new ArrayList<>();
for (Sensor s : mSensorList) {
- if (s.getType() < Sensor.TYPE_DEVICE_PRIVATE_BASE) {
+ if (s.getType() < Sensor.TYPE_DEVICE_PRIVATE_BASE &&
+ (!context.getPackageManager().isInstantApp() || s.getType() != Sensor.TYPE_HEART_RATE)) {
mAndroidSensorList.add(s);
}
}
diff --git a/tests/tests/media/src/android/media/cts/AudioRecordTest.java b/tests/tests/media/src/android/media/cts/AudioRecordTest.java
index 90a5a3f0f70..abfe7cb56d1 100644
--- a/tests/tests/media/src/android/media/cts/AudioRecordTest.java
+++ b/tests/tests/media/src/android/media/cts/AudioRecordTest.java
@@ -41,7 +41,9 @@ import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.PersistableBundle;
+import android.os.Process;
import android.os.SystemClock;
+import android.os.UserManager;
import android.platform.test.annotations.Presubmit;
import android.util.Log;
@@ -1629,24 +1631,55 @@ public class AudioRecordTest {
}
private static void makeMyUidStateActive() throws IOException {
- final String command = "cmd media.audio_policy set-uid-state "
- + InstrumentationRegistry.getTargetContext().getPackageName() + " active";
+ String command = String.format("cmd media.audio_policy set-uid-state %s active",
+ getContext().getPackageName());
+
+ if (!isSystemUser()) {
+ // --user parameter is not supported on all devices - only those that will run CTS in
+ // secondary users.
+ // For System User - Command defaults to system user, no need to explicitly specify.
+ // For Secondary User - Have to specify the user explicitly, otherwise the test fails.
+ command += " --user " + Process.myUserHandle().getIdentifier();
+ }
+
SystemUtil.runShellCommand(InstrumentationRegistry.getInstrumentation(), command);
}
private static void makeMyUidStateIdle() throws IOException {
- final String command = "cmd media.audio_policy set-uid-state "
- + InstrumentationRegistry.getTargetContext().getPackageName() + " idle";
+ String command = String.format("cmd media.audio_policy set-uid-state %s idle",
+ getContext().getPackageName());
+
+ if (!isSystemUser()) {
+ // --user parameter is not supported on all devices - only those that will run CTS in
+ // secondary users.
+ // For System User - Command defaults to system user, no need to explicitly specify.
+ // For Secondary User - Have to specify the user explicitly, otherwise the test fails.
+ command += " --user " + Process.myUserHandle().getIdentifier();
+ }
+
SystemUtil.runShellCommand(InstrumentationRegistry.getInstrumentation(), command);
}
private static void resetMyUidState() throws IOException {
- final String command = "cmd media.audio_policy reset-uid-state "
- + InstrumentationRegistry.getTargetContext().getPackageName();
+ String command = "cmd media.audio_policy reset-uid-state "
+ + getContext().getPackageName();
+
+ if (!isSystemUser()) {
+ // --user parameter is not supported on all devices - only those that will run CTS in
+ // secondary users.
+ // For System User - Command defaults to system user, no need to explicitly specify.
+ // For Secondary User - Have to specify the user explicitly, otherwise the test fails.
+ command += " --user " + Process.myUserHandle().getIdentifier();
+ }
+
SystemUtil.runShellCommand(InstrumentationRegistry.getInstrumentation(), command);
}
private static Context getContext() {
return InstrumentationRegistry.getInstrumentation().getTargetContext();
}
+
+ private static boolean isSystemUser() {
+ return getContext().getSystemService(UserManager.class).isSystemUser();
+ }
}
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/SubscriptionManagerTest.java b/tests/tests/telephony/current/src/android/telephony/cts/SubscriptionManagerTest.java
index 68034312b7f..51c15637bc3 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/SubscriptionManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/SubscriptionManagerTest.java
@@ -518,10 +518,6 @@ public class SubscriptionManagerTest {
changeAndVerifySubscriptionEnabledValue(mSubId, !enabled);
// Reset it back to original
changeAndVerifySubscriptionEnabledValue(mSubId, enabled);
- } else {
- boolean changeSuccessfully = executeWithShellPermissionAndDefault(false, mSm,
- (sm) -> sm.setSubscriptionEnabled(mSubId, !enabled));
- assertFalse(changeSuccessfully);
}
}
diff --git a/tests/tests/transition/res/values/styles.xml b/tests/tests/transition/res/values/styles.xml
index 00303c93609..be2272eacb8 100644
--- a/tests/tests/transition/res/values/styles.xml
+++ b/tests/tests/transition/res/values/styles.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android">
- <style name="Theme_NoSwipeDismiss">
+ <style name="Theme_NoSwipeDismiss" parent="android:Theme.DeviceDefault">
<item name="android:windowSwipeToDismiss">false</item>
</style>
</resources>