Merge "Change the shell timeout to 45 minutes to avoid the failure of the test is not completed." into android13-tests-dev
diff --git a/apps/CameraITS/tools/run_all_tests.py b/apps/CameraITS/tools/run_all_tests.py
index ed3d50d..43031fe 100755
--- a/apps/CameraITS/tools/run_all_tests.py
+++ b/apps/CameraITS/tools/run_all_tests.py
@@ -401,7 +401,7 @@
"""
cmd = (f'adb -s {device_id} shell cmd device_state state')
result = subprocess.getoutput(cmd)
- if 'CLOSED' in result:
+ if 'CLOSE' in result:
return True
return False
@@ -539,8 +539,11 @@
device_state = 'folded' if device_folded else 'opened'
testing_folded_front_camera = (testing_foldable_device and
- device_folded and
_FRONT_CAMERA_ID in camera_id)
+ if testing_folded_front_camera:
+ if not device_folded:
+ raise AssertionError(
+ 'Device should be folded while testing folded scene.')
# Raise an assertion error if there is any camera unavailable in
# current device state. Usually scenes with suffix 'folded' will
diff --git a/apps/CameraITS/utils/camera_properties_utils.py b/apps/CameraITS/utils/camera_properties_utils.py
index 44aa510..89dbd37 100644
--- a/apps/CameraITS/utils/camera_properties_utils.py
+++ b/apps/CameraITS/utils/camera_properties_utils.py
@@ -567,7 +567,7 @@
Return:
Boolean.
"""
- return 'android.edge.availableToneMapModes' in props and mode in props[
+ return 'android.tonemap.availableToneMapModes' in props and mode in props[
'android.tonemap.availableToneMapModes']
diff --git a/apps/CtsVerifier/res/layout/ca_install_via_intent.xml b/apps/CtsVerifier/res/layout/ca_install_via_intent.xml
index 4b529d1..38d75b7 100644
--- a/apps/CtsVerifier/res/layout/ca_install_via_intent.xml
+++ b/apps/CtsVerifier/res/layout/ca_install_via_intent.xml
@@ -13,7 +13,11 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+ <LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
@@ -47,5 +51,5 @@
<include layout="@layout/pass_fail_buttons" />
-</LinearLayout>
-
+ </LinearLayout>
+</ScrollView>
diff --git a/apps/CtsVerifier/res/layout/clipboard_preview.xml b/apps/CtsVerifier/res/layout/clipboard_preview.xml
index efec118..ff9d4af 100644
--- a/apps/CtsVerifier/res/layout/clipboard_preview.xml
+++ b/apps/CtsVerifier/res/layout/clipboard_preview.xml
@@ -13,7 +13,11 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical">
+ <LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
@@ -37,4 +41,5 @@
android:layout_height="wrap_content"
android:visibility="invisible"
layout="@layout/pass_fail_buttons"/>
-</LinearLayout>
+ </LinearLayout>
+</ScrollView>
diff --git a/apps/CtsVerifier/res/layout/pass_fail_set_password_complexity.xml b/apps/CtsVerifier/res/layout/pass_fail_set_password_complexity.xml
index e8cb0ff..b8b2825 100644
--- a/apps/CtsVerifier/res/layout/pass_fail_set_password_complexity.xml
+++ b/apps/CtsVerifier/res/layout/pass_fail_set_password_complexity.xml
@@ -17,13 +17,19 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
+ <ScrollView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:fillViewport="true"
+ android:orientation="vertical">
<LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:orientation="vertical"
android:divider="@android:color/white"
- android:showDividers="middle">
+ android:showDividers="middle"
+ android:paddingBottom="30dp">
<LinearLayout android:layout_height="wrap_content"
android:layout_width="wrap_content"
@@ -83,6 +89,7 @@
</LinearLayout>
</LinearLayout>
+ </ScrollView>
<include android:layout_width="match_parent"
android:layout_height="wrap_content"
diff --git a/apps/CtsVerifier/res/layout/widget_layout.xml b/apps/CtsVerifier/res/layout/widget_layout.xml
index b0cce17..9f380c6 100644
--- a/apps/CtsVerifier/res/layout/widget_layout.xml
+++ b/apps/CtsVerifier/res/layout/widget_layout.xml
@@ -41,7 +41,7 @@
android:gravity="top|left"
android:layout_marginBottom="10dp"
android:fontFamily="sans-serif"
- android:textSize="20sp"
+ android:textSize="18sp"
android:text="@string/widget_name"
android:freezesText="true"/>
@@ -51,7 +51,7 @@
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:fontFamily="sans-serif-light"
- android:textSize="16sp"
+ android:textSize="15sp"
android:freezesText="true"/>
<TextView
@@ -61,7 +61,7 @@
android:layout_marginBottom="18dp"
android:layout_gravity="center_horizontal"
android:fontFamily="sans-serif-light"
- android:textSize="16sp"/>
+ android:textSize="15sp"/>
<ListView
android:id="@+id/list"
@@ -84,12 +84,14 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="100dp"
+ android:textSize="15sp"
android:text="@string/widget_fail" />
<Button
android:id="@+id/pass"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="100dp"
+ android:textSize="15sp"
android:text="@string/widget_pass" />
</LinearLayout>
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioDescriptorActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioDescriptorActivity.java
index 52164a5..8293816 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioDescriptorActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioDescriptorActivity.java
@@ -134,6 +134,11 @@
}
@Override
+ public boolean requiresReportLog() {
+ return true;
+ }
+
+ @Override
public void recordTestResults() {
CtsVerifierReportLog reportLog = getReportLog();
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioMicrophoneMuteToggleActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioMicrophoneMuteToggleActivity.java
index 87b5f12..dcde897 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioMicrophoneMuteToggleActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioMicrophoneMuteToggleActivity.java
@@ -147,6 +147,11 @@
}
@Override
+ public boolean requiresReportLog() {
+ return true;
+ }
+
+ @Override
public void recordTestResults() {
CtsVerifierReportLog reportLog = getReportLog();
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsTestActivity.java
index 825461f..b4903b4 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsTestActivity.java
@@ -608,8 +608,16 @@
return "Camera: " + cam + ", " + scene;
}
+ // CtsVerifier has a "Folded" toggle that selectively surfaces some tests.
+ // To separate the tests in folded and unfolded states, CtsVerifier adds a [folded]
+ // suffix to the test id in its internal database depending on the state of the "Folded"
+ // toggle button. However, CameraITS has tests that it needs to persist across both folded
+ // and unfolded states.To get the test results to persist, we need CtsVerifier to store and
+ // look up the same test id regardless of the toggle button state.
+ // TODO(b/282804139): Update CTS tests to allow activities to write tests that persist
+ // across the states
protected String testId(String cam, String scene) {
- return "Camera_ITS_" + cam + "_" + scene;
+ return "Camera_ITS_" + cam + "_" + scene + "[folded]";
}
protected boolean isFoldableDevice() {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/features/FeatureUtil.java b/apps/CtsVerifier/src/com/android/cts/verifier/features/FeatureUtil.java
index a7b58fa..9f6ea58 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/features/FeatureUtil.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/features/FeatureUtil.java
@@ -90,10 +90,52 @@
* Checks whether the device supports file transfer.
*/
public static boolean isUsbFileTransferSupported(Context context) {
- return !isWatchOrAutomotive(context);
+ return !isWatchOrAutomotive(context) && !isTelevision(context);
}
/**
+ * Checks if VPN Config is supported.
+ */
+ public static boolean isVpnConfigSupported(Context context) {
+ return !isWatch(context);
+ }
+
+ /**
+ * Checks if Disabling Keyguard is supported.
+ */
+ public static boolean isDisableKeyguardSupported(Context context) {
+ return !isWatch(context);
+ }
+
+ /**
+ * Checks if Lock Task is supported.
+ */
+ public static boolean isLockTaskSupported(Context context) {
+ return !isWatch(context) && !isTelevision(context);
+ }
+
+ /**
+ * Checks if Status Bar is supported.
+ */
+ public static boolean isStatusBarSupported(Context context) {
+ return !isWatch(context) && !isTelevision(context);
+ }
+
+ /**
+ * Checks if Data Roaming is supported.
+ */
+ public static boolean isDataRoamingSupported(Context context) {
+ PackageManager pm = context.getPackageManager();
+ return pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY) && !isWatch(context);
+ }
+
+ /**
+ * Checks is Swipe To Unlock is supported.
+ */
+ public static boolean isSwipeToUnlockSupported(Context context) {
+ return !isAutomotive(context);
+ }
+ /**
* Checks whether the device is watch .
*/
public static boolean isWatch(Context context) {
@@ -119,6 +161,14 @@
}
/**
+ * Checks whether the device is a TV
+ */
+ public static boolean isTelevision(Context context) {
+ PackageManager pm = context.getPackageManager();
+ return pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK);
+ }
+
+ /**
* Checks whether the device supports managed secondary users.
*/
public static boolean supportManagedSecondaryUsers(Context context) {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceOwnerPositiveTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceOwnerPositiveTestActivity.java
index 74ea3f0..90f432d 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceOwnerPositiveTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceOwnerPositiveTestActivity.java
@@ -355,9 +355,7 @@
}
// DISALLOW_DATA_ROAMING
- // TODO(b/189282625): replace FEATURE_WATCH with a more specific feature
- if (!packageManager.hasSystemFeature(PackageManager.FEATURE_WATCH)
- && packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+ if (FeatureUtil.isDataRoamingSupported(this)) {
adapter.add(createInteractiveTestItem(this, DISALLOW_DATA_ROAMING_ID,
R.string.device_owner_disallow_data_roaming,
R.string.device_owner_disallow_data_roaming_info,
@@ -413,7 +411,7 @@
}
// DISALLOW_USB_FILE_TRANSFER
- if (FeatureUtil.isUsbFileTransferSupported(this) && !Utils.isTV(this)) {
+ if (FeatureUtil.isUsbFileTransferSupported(this)) {
adapter.add(createInteractiveTestItem(this, DISALLOW_USB_FILE_TRANSFER_ID,
R.string.device_owner_disallow_usb_file_transfer_test,
R.string.device_owner_disallow_usb_file_transfer_test_info,
@@ -430,7 +428,7 @@
}
// DISABLE_STATUS_BAR_TEST
- if (isStatusBarEnabled()) {
+ if (FeatureUtil.isStatusBarSupported(this)) {
adapter.add(createInteractiveTestItem(this, DISABLE_STATUS_BAR_TEST_ID,
R.string.device_owner_disable_statusbar_test,
R.string.device_owner_disable_statusbar_test_info,
@@ -450,9 +448,8 @@
// Without PIN/Password watches don't have any lockscreen, so this policy isn't applicable
// setKeyguardDisabled
- if (FeatureUtil.isKeyguardShownWhenUserDoesntHaveCredentials(this) &&
- Utils.isLockscreenSupported(this) &&
- !packageManager.hasSystemFeature(PackageManager.FEATURE_WATCH)) {
+ if (FeatureUtil.isKeyguardShownWhenUserDoesntHaveCredentials(this)
+ && Utils.isLockscreenSupported(this)) {
adapter.add(createInteractiveTestItem(this, DISABLE_KEYGUARD_TEST_ID,
R.string.device_owner_disable_keyguard_test,
R.string.device_owner_disable_keyguard_test_info,
@@ -471,8 +468,7 @@
}
// setLockTaskFeatures
- // TODO(b/189282625): replace FEATURE_WATCH with a more specific feature
- if (!packageManager.hasSystemFeature(PackageManager.FEATURE_WATCH) && !Utils.isTV(this)) {
+ if (FeatureUtil.isLockTaskSupported(this)) {
final Intent lockTaskUiTestIntent = new Intent(this, LockTaskUiTestActivity.class);
lockTaskUiTestIntent.putExtra(LockTaskUiTestActivity.EXTRA_TEST_ID,
LOCK_TASK_UI_TEST_ID);
@@ -622,7 +618,8 @@
createDisableNetworkLoggingIntent())}));
// Customize lock screen message
- if (isSwipeToUnlockSupported() && Utils.isLockscreenSupported(this)) {
+ if (FeatureUtil.isSwipeToUnlockSupported(this)
+ && Utils.isLockscreenSupported(this)) {
adapter.add(TestListItem.newTest(this,
R.string.device_owner_customize_lockscreen_message,
LockscreenMessageTestActivity.class.getName(),
@@ -787,16 +784,6 @@
.putExtra(CommandReceiverActivity.EXTRA_VALUE, level);
}
- private boolean isStatusBarEnabled() {
- // Watches don't support the status bar so this is an ok proxy, but this is not the most
- // general test for that. TODO: add a test API to do a real check for status bar support.
- return !getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH)
- && !isTelevision();
- }
-
- private boolean isSwipeToUnlockSupported() {
- return !isAutomotive();
- }
private boolean isAutomotive() {
return FeatureUtil.isAutomotive(this);
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/usb/accessory/UsbAccessoryTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/usb/accessory/UsbAccessoryTestActivity.java
index 512162c..d8560fa 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/usb/accessory/UsbAccessoryTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/usb/accessory/UsbAccessoryTestActivity.java
@@ -108,6 +108,11 @@
}
@Override
+ public boolean requiresReportLog() {
+ return true;
+ }
+
+ @Override
public void onAttached(UsbAccessory accessory) {
mStatus.setText(R.string.usb_accessory_test_step2);
mProgress.setVisibility(View.VISIBLE);
diff --git a/hostsidetests/appsecurity/test-apps/ListeningPortsApp/src/android/appsecurity/cts/listeningports/ListeningPortsTest.java b/hostsidetests/appsecurity/test-apps/ListeningPortsApp/src/android/appsecurity/cts/listeningports/ListeningPortsTest.java
index aab1d9e..c0fa7f1 100644
--- a/hostsidetests/appsecurity/test-apps/ListeningPortsApp/src/android/appsecurity/cts/listeningports/ListeningPortsTest.java
+++ b/hostsidetests/appsecurity/test-apps/ListeningPortsApp/src/android/appsecurity/cts/listeningports/ListeningPortsTest.java
@@ -90,6 +90,22 @@
EXCEPTION_PATTERNS.add(":::7275"); // used by supl
}
+ private static final List<String> OEM_EXCEPTION_PATTERNS = new ArrayList<String>();
+
+ static {
+ // PTP vendor OEM service
+ OEM_EXCEPTION_PATTERNS.add("0.0.0.0:319");
+ OEM_EXCEPTION_PATTERNS.add("0.0.0.0:320");
+ }
+
+ private static boolean isOemUid(int uid) {
+ return (uid >= 2900 && uid <= 2999) || (uid >= 5000 && uid <= 5999);
+ }
+
+ private boolean isTv() {
+ return getContext().getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK);
+ }
+
/**
* Remotely accessible ports (loopback==false) are often used by
* attackers to gain unauthorized access to computers systems without
@@ -108,6 +124,8 @@
final boolean isTcp = Boolean.valueOf(testArgs.getString(IS_TCP_PARAM));
final boolean loopback = Boolean.valueOf(testArgs.getString(LOOPBACK_PARAM));
+ final boolean tv = isTv();
+
String errors = "";
List<ParsedProcEntry> entries = ParsedProcEntry.parse(procFileContents);
for (ParsedProcEntry entry : entries) {
@@ -117,6 +135,7 @@
if (isPortListening(entry.state, isTcp)
&& !(isException(addrPort) || isException(addrUid) || isException(addrPortUid))
+ && !(tv && isOemUid(entry.uid) && isOemException(addrPort))
&& (!entry.localAddress.isLoopbackAddress() ^ loopback)) {
if (isTcp && !isTcpConnectable(entry.localAddress, entry.port)) {
continue;
@@ -185,6 +204,10 @@
return isPatternMatch(EXCEPTION_PATTERNS, localAddress);
}
+ private static boolean isOemException(String localAddress) {
+ return isPatternMatch(OEM_EXCEPTION_PATTERNS, localAddress);
+ }
+
private static boolean isPatternMatch(List<String> patterns, String input) {
for (String pattern : patterns) {
pattern = Pattern.quote(pattern);
diff --git a/hostsidetests/car/OWNERS b/hostsidetests/car/OWNERS
index d4705b9..1934173 100644
--- a/hostsidetests/car/OWNERS
+++ b/hostsidetests/car/OWNERS
@@ -1,4 +1,5 @@
# Bug component: 526680
-felipeal@google.com
-gurunagarajan@google.com
-keunyoung@google.com
+ericjeong@google.com
+sgurun@google.com
+xiangw@google.com
+ycheo@google.com
diff --git a/hostsidetests/car_builtin/OWNERS b/hostsidetests/car_builtin/OWNERS
index f0afac5..1934173 100644
--- a/hostsidetests/car_builtin/OWNERS
+++ b/hostsidetests/car_builtin/OWNERS
@@ -1,4 +1,5 @@
# Bug component: 526680
-keunyoung@google.com
-felipeal@google.com
-gurunagarajan@google.com
+ericjeong@google.com
+sgurun@google.com
+xiangw@google.com
+ycheo@google.com
diff --git a/hostsidetests/dumpsys/src/android/dumpsys/cts/GfxInfoDumpsysTest.java b/hostsidetests/dumpsys/src/android/dumpsys/cts/GfxInfoDumpsysTest.java
index 173a6da..4226251 100644
--- a/hostsidetests/dumpsys/src/android/dumpsys/cts/GfxInfoDumpsysTest.java
+++ b/hostsidetests/dumpsys/src/android/dumpsys/cts/GfxInfoDumpsysTest.java
@@ -52,6 +52,9 @@
installResult);
getDevice().executeShellCommand("am start -W " + TEST_PKG);
+ // Currently "wait for launch" doesn't actually wait for the frame to be finished
+ // So do a little sleep to let things stabilize
+ Thread.sleep(500);
String frameinfo = mDevice.executeShellCommand("dumpsys gfxinfo " +
TEST_PKG + " framestats");
diff --git a/hostsidetests/theme/assets/33/520dpi.zip b/hostsidetests/theme/assets/33/520dpi.zip
new file mode 100644
index 0000000..95a5c9c
--- /dev/null
+++ b/hostsidetests/theme/assets/33/520dpi.zip
Binary files differ
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityOverlayTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityOverlayTest.java
index 6cd2b9b..8989f52 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityOverlayTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityOverlayTest.java
@@ -16,14 +16,18 @@
package android.accessibilityservice.cts;
+import static android.accessibilityservice.cts.utils.ActivityLaunchUtils.launchActivityOnSpecifiedDisplayAndWaitForItToBeOnscreen;
+
import static org.junit.Assert.assertTrue;
import android.accessibility.cts.common.AccessibilityDumpOnFailureRule;
import android.accessibility.cts.common.InstrumentedAccessibilityService;
import android.accessibility.cts.common.InstrumentedAccessibilityServiceTestRule;
import android.accessibilityservice.AccessibilityServiceInfo;
+import android.accessibilityservice.cts.activities.AccessibilityWindowQueryActivity;
import android.accessibilityservice.cts.utils.AsyncUtils;
import android.accessibilityservice.cts.utils.DisplayUtils;
+import android.app.Instrumentation;
import android.app.UiAutomation;
import android.content.Context;
import android.text.TextUtils;
@@ -36,8 +40,6 @@
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
-import com.android.compatibility.common.util.TestUtils;
-
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
@@ -52,6 +54,7 @@
@RunWith(AndroidJUnit4.class)
public class AccessibilityOverlayTest {
+ private static Instrumentation sInstrumentation;
private static UiAutomation sUiAutomation;
InstrumentedAccessibilityService mService;
@@ -69,7 +72,8 @@
@BeforeClass
public static void oneTimeSetUp() {
- sUiAutomation = InstrumentationRegistry.getInstrumentation()
+ sInstrumentation = InstrumentationRegistry.getInstrumentation();
+ sUiAutomation = sInstrumentation
.getUiAutomation(UiAutomation.FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES);
AccessibilityServiceInfo info = sUiAutomation.getServiceInfo();
info.flags |= AccessibilityServiceInfo.FLAG_RETRIEVE_INTERACTIVE_WINDOWS;
@@ -104,20 +108,16 @@
mService, false);
final int displayId = newDisplay.getDisplayId();
final String overlayTitle = "Overlay title on virtualDisplay";
- // Make sure the onDisplayAdded callback of a11y framework handled by checking if the
- // accessibilityWindowInfo list of the virtual display has been added.
- // And the a11y default token is available after the onDisplayAdded callback handled.
- TestUtils.waitUntil("AccessibilityWindowInfo list of the virtual display are not ready",
- () -> {
- final SparseArray<List<AccessibilityWindowInfo>> allWindows =
- sUiAutomation.getWindowsOnAllDisplays();
- return allWindows.get(displayId) != null;
- }
- );
- final Context newDisplayContext = mService.createDisplayContext(newDisplay);
+
+ // Create an initial activity window on the virtual display to ensure that
+ // AccessibilityWindowManager is tracking windows for the display.
+ launchActivityOnSpecifiedDisplayAndWaitForItToBeOnscreen(sInstrumentation,
+ sUiAutomation,
+ AccessibilityWindowQueryActivity.class,
+ displayId);
sUiAutomation.executeAndWaitForEvent(() -> mService.runOnServiceSync(() -> {
- addOverlayWindow(newDisplayContext, overlayTitle);
+ addOverlayWindow(mService.createDisplayContext(newDisplay), overlayTitle);
}), (event) -> findOverlayWindow(displayId) != null, AsyncUtils.DEFAULT_TIMEOUT_MS);
assertTrue(TextUtils.equals(findOverlayWindow(displayId).getTitle(), overlayTitle));
diff --git a/tests/app/src/android/app/cts/ActivityManagerMemoryClassTest.java b/tests/app/src/android/app/cts/ActivityManagerMemoryClassTest.java
index a49f4a5..f9074ee 100644
--- a/tests/app/src/android/app/cts/ActivityManagerMemoryClassTest.java
+++ b/tests/app/src/android/app/cts/ActivityManagerMemoryClassTest.java
@@ -80,6 +80,8 @@
expectedMemorySizeForWatch.put(DisplayMetrics.DENSITY_560, 112);
expectedMemorySizeForWatch.put(DisplayMetrics.DENSITY_600, 138);
expectedMemorySizeForWatch.put(DisplayMetrics.DENSITY_XXXHIGH, 154);
+ // Backport of DENSITY_520 from Android 14 to android13-tests-dev
+ expectedMemorySizeForWatch.put(520, 112);
}
static {
@@ -105,6 +107,8 @@
expectedMemorySizeForSmallNormalScreen.put(DisplayMetrics.DENSITY_560, 192);
expectedMemorySizeForSmallNormalScreen.put(DisplayMetrics.DENSITY_600, 228);
expectedMemorySizeForSmallNormalScreen.put(DisplayMetrics.DENSITY_XXXHIGH, 256);
+ // Backport of DENSITY_520 from Android 14 to android13-tests-dev
+ expectedMemorySizeForSmallNormalScreen.put(520, 192);
}
static {
@@ -130,6 +134,8 @@
expectedMemorySizeForLargeScreen.put(DisplayMetrics.DENSITY_560, 384);
expectedMemorySizeForLargeScreen.put(DisplayMetrics.DENSITY_600, 448);
expectedMemorySizeForLargeScreen.put(DisplayMetrics.DENSITY_XXXHIGH, 512);
+ // Backport of DENSITY_520 from Android 14 to android13-tests-dev
+ expectedMemorySizeForSmallNormalScreen.put(520, 192);
}
static {
@@ -155,6 +161,8 @@
expectedMemorySizeForXLargeScreen.put(DisplayMetrics.DENSITY_560, 576);
expectedMemorySizeForXLargeScreen.put(DisplayMetrics.DENSITY_600, 672);
expectedMemorySizeForXLargeScreen.put(DisplayMetrics.DENSITY_XXXHIGH, 768);
+ // Backport of DENSITY_520 from Android 14 to android13-tests-dev
+ expectedMemorySizeForXLargeScreen.put(520, 576);
}
public static Integer getExpectedMemorySize(
diff --git a/tests/autofillservice/src/android/autofillservice/cts/DuplicateIdActivityTest.java b/tests/autofillservice/src/android/autofillservice/cts/DuplicateIdActivityTest.java
index f821d68..b3f0731 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/DuplicateIdActivityTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/DuplicateIdActivityTest.java
@@ -106,6 +106,8 @@
@Test
public void testDoNotRestoreDuplicateAutofillIds() throws Exception {
assumeTrue("Rotation is supported", Helper.isRotationSupported(mContext));
+ assumeTrue("Device state is not REAR_DISPLAY",
+ !Helper.isDeviceInState(mContext, Helper.DeviceStateEnum.REAR_DISPLAY));
enableService();
diff --git a/tests/autofillservice/src/android/autofillservice/cts/SessionLifecycleTest.java b/tests/autofillservice/src/android/autofillservice/cts/SessionLifecycleTest.java
index 381eefb..adf8b1d 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/SessionLifecycleTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/SessionLifecycleTest.java
@@ -167,6 +167,8 @@
@Test
public void testDatasetAuthResponseWhileAutofilledAppIsLifecycled() throws Exception {
assumeTrue("Rotation is supported", Helper.isRotationSupported(mContext));
+ assumeTrue("Device state is not REAR_DISPLAY",
+ !Helper.isDeviceInState(mContext, Helper.DeviceStateEnum.REAR_DISPLAY));
final ActivityManager activityManager = (ActivityManager) getContext()
.getSystemService(Context.ACTIVITY_SERVICE);
assumeFalse(activityManager.isLowRamDevice());
diff --git a/tests/autofillservice/src/android/autofillservice/cts/augmented/AugmentedLoginActivityTest.java b/tests/autofillservice/src/android/autofillservice/cts/augmented/AugmentedLoginActivityTest.java
index 47db989..52cc245 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/augmented/AugmentedLoginActivityTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/augmented/AugmentedLoginActivityTest.java
@@ -162,6 +162,8 @@
@Test
@AppModeFull(reason = "testAutoFill_mainServiceReturnedNull_augmentedAutofillOneField enough")
public void testAutoFill_neitherServiceCanAutofill_thenManualRequest() throws Exception {
+ assumeTrue("Device state is not REAR_DISPLAY",
+ !Helper.isDeviceInState(mContext, Helper.DeviceStateEnum.REAR_DISPLAY));
// Set services
enableService();
enableAugmentedService();
@@ -734,6 +736,8 @@
@AppModeFull(reason = "testAutoFill_mainServiceReturnedNull_augmentedAutofillOneField enough")
public void testAugmentedAutoFill_rotateDevice() throws Exception {
assumeTrue("Rotation is supported", Helper.isRotationSupported(mContext));
+ assumeTrue("Device state is not REAR_DISPLAY",
+ !Helper.isDeviceInState(mContext, Helper.DeviceStateEnum.REAR_DISPLAY));
// Set services
enableService();
diff --git a/tests/autofillservice/src/android/autofillservice/cts/commontests/AutoFillServiceTestCase.java b/tests/autofillservice/src/android/autofillservice/cts/commontests/AutoFillServiceTestCase.java
index c1f743b..e07cdd9 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/commontests/AutoFillServiceTestCase.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/commontests/AutoFillServiceTestCase.java
@@ -25,6 +25,8 @@
import static com.android.compatibility.common.util.ShellUtils.runShellCommand;
+import static org.junit.Assume.assumeFalse;
+
import android.app.PendingIntent;
import android.autofillservice.cts.R;
import android.autofillservice.cts.activities.AbstractAutoFillActivity;
@@ -425,6 +427,9 @@
// Collapse notifications.
runShellCommand("cmd statusbar collapse");
+ assumeFalse("Device is half-folded",
+ Helper.isDeviceInState(mContext, Helper.DeviceStateEnum.HALF_FOLDED));
+
// Set orientation as portrait, otherwise some tests might fail due to elements not
// fitting in, IME orientation, etc...
mUiBot.setScreenOrientation(UiBot.PORTRAIT);
diff --git a/tests/autofillservice/src/android/autofillservice/cts/commontests/CustomDescriptionWithLinkTestCase.java b/tests/autofillservice/src/android/autofillservice/cts/commontests/CustomDescriptionWithLinkTestCase.java
index 073b6f2..9a0f2cc 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/commontests/CustomDescriptionWithLinkTestCase.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/commontests/CustomDescriptionWithLinkTestCase.java
@@ -93,6 +93,8 @@
@Test
public final void testTapLink_changeOrientationThenTapBack() throws Exception {
assumeTrue("Rotation is supported", Helper.isRotationSupported(mContext));
+ assumeTrue("Device state is not REAR_DISPLAY",
+ !Helper.isDeviceInState(mContext, Helper.DeviceStateEnum.REAR_DISPLAY));
mUiBot.assumeMinimumResolution(500);
mUiBot.setScreenOrientation(UiBot.PORTRAIT);
diff --git a/tests/autofillservice/src/android/autofillservice/cts/saveui/SimpleSaveActivityTest.java b/tests/autofillservice/src/android/autofillservice/cts/saveui/SimpleSaveActivityTest.java
index 9762456..0016540 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/saveui/SimpleSaveActivityTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/saveui/SimpleSaveActivityTest.java
@@ -286,6 +286,8 @@
@Test
public void testSave_afterRotation() throws Exception {
assumeTrue("Rotation is supported", Helper.isRotationSupported(mContext));
+ assumeTrue("Device state is not REAR_DISPLAY",
+ !Helper.isDeviceInState(mContext, Helper.DeviceStateEnum.REAR_DISPLAY));
mUiBot.setScreenOrientation(UiBot.PORTRAIT);
try {
saveTest(true);
diff --git a/tests/autofillservice/src/android/autofillservice/cts/testcore/Helper.java b/tests/autofillservice/src/android/autofillservice/cts/testcore/Helper.java
index 3a40ca9..7563718 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/testcore/Helper.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/testcore/Helper.java
@@ -48,6 +48,8 @@
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.Bitmap;
+import android.hardware.devicestate.DeviceStateManager;
+import android.hardware.devicestate.DeviceStateManager.DeviceStateCallback;
import android.icu.util.Calendar;
import android.os.Bundle;
import android.os.Environment;
@@ -92,6 +94,7 @@
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@@ -1735,6 +1738,97 @@
throw new UnsupportedOperationException("contain static methods only");
}
+ public enum DeviceStateEnum {
+ HALF_FOLDED,
+ REAR_DISPLAY
+ };
+
+ /**
+ * Test if the device is in half-folded or rear display state.
+ */
+ private static final class DeviceStateAssessor implements DeviceStateCallback {
+ DeviceStateManager mDeviceStateManager;
+ int[] mHalfFoldedStates;
+ int[] mRearDisplayStates;
+ int mCurrentState = -1;
+
+ DeviceStateAssessor(Context context) {
+ Resources systemRes = Resources.getSystem();
+ mHalfFoldedStates = getStatesFromConfig(systemRes, "config_halfFoldedDeviceStates");
+ mRearDisplayStates = getStatesFromConfig(systemRes, "config_rearDisplayDeviceStates");
+ try {
+ mDeviceStateManager = context.getSystemService(DeviceStateManager.class);
+ mDeviceStateManager.registerCallback(context.getMainExecutor(), this);
+ Log.v(TAG, "DeviceStateAssessor initialized halfFoldedStates.length="
+ + mHalfFoldedStates.length + ", readDisplayStates.length="
+ + mRearDisplayStates.length);
+ } catch (java.lang.IllegalStateException e) {
+ Log.v(TAG, "DeviceStateManager not available: cannot check for half-fold");
+ }
+ }
+
+ private int[] getStatesFromConfig(Resources systemRes, String configKey) {
+ int statesArrayIdentifier = systemRes.getIdentifier(configKey, "array", "android");
+ if (statesArrayIdentifier == 0) {
+ return new int[0];
+ } else {
+ return systemRes.getIntArray(statesArrayIdentifier);
+ }
+ }
+
+ public void onStateChanged(int state) {
+ synchronized (this) {
+ mCurrentState = state;
+ this.notify();
+ }
+ }
+
+ void close() {
+ if (mDeviceStateManager != null) {
+ mDeviceStateManager.unregisterCallback(this);
+ }
+ }
+
+ boolean isDeviceInState(DeviceStateEnum deviceState) throws InterruptedException {
+ int[] states;
+ switch(deviceState) {
+ case HALF_FOLDED:
+ states = mHalfFoldedStates;
+ break;
+ case REAR_DISPLAY:
+ states = mRearDisplayStates;
+ break;
+ default:
+ return false;
+ }
+ if (states.length == 0 || mDeviceStateManager == null) {
+ return false;
+ }
+ synchronized (this) {
+ if (mCurrentState == -1) {
+ this.wait(1000);
+ }
+ }
+ if (mCurrentState == -1) {
+ Log.w(TAG, "DeviceStateCallback not called within 1 second");
+ }
+ Log.v(TAG, "Current state=" + mCurrentState + ", states[0]="
+ + states[0]);
+ return Arrays.stream(states).anyMatch(x -> x == mCurrentState);
+ }
+ }
+
+ public static boolean isDeviceInState(Context context, DeviceStateEnum deviceState) {
+ DeviceStateAssessor deviceStateAssessor = new DeviceStateAssessor(context);
+ try {
+ return deviceStateAssessor.isDeviceInState(deviceState);
+ } catch (InterruptedException e) {
+ return false;
+ } finally {
+ deviceStateAssessor.close();
+ }
+ }
+
public static class FieldClassificationResult {
public final AutofillId id;
public final String[] categoryIds;
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/AppConfigurationTests.java b/tests/framework/base/windowmanager/src/android/server/wm/AppConfigurationTests.java
index 028db21..8227464 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/AppConfigurationTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/AppConfigurationTests.java
@@ -651,6 +651,8 @@
*/
@Test
public void testAppOrientationWhenRotating() throws Exception {
+ assumeFalse("Skipping test: square size may not have configuration change",
+ isCloseToSquareDisplay());
assumeTrue("Skipping test: no rotation support", supportsRotation());
// TODO(b/209920544) remove assumeFalse after issue fix.
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/DisplayCutoutTests.java b/tests/framework/base/windowmanager/src/android/server/wm/DisplayCutoutTests.java
index cb606d8..aa7c5f3 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/DisplayCutoutTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/DisplayCutoutTests.java
@@ -56,6 +56,7 @@
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
+import android.content.res.Configuration;
import android.graphics.Insets;
import android.graphics.Path;
import android.graphics.Rect;
@@ -63,6 +64,7 @@
import android.platform.test.annotations.Presubmit;
import android.provider.Settings;
import android.server.wm.settings.SettingsSession;
+import android.util.Size;
import android.view.DisplayCutout;
import android.view.View;
import android.view.ViewGroup;
@@ -148,12 +150,27 @@
// 16 dp with app windows/contents for the apps using DEFAULT and SHORT_EDGES.
private int mMaximumSizeForNoLetterbox;
+ private static MultiDisplayTestBase.DisplayMetricsSession sDisplayMetricsSession;
+
@BeforeClass
public static void setUpClass() {
sImmersiveModeConfirmationSetting = new SettingsSession<>(
Settings.Secure.getUriFor(IMMERSIVE_MODE_CONFIRMATIONS),
Settings.Secure::getString, Settings.Secure::putString);
sImmersiveModeConfirmationSetting.set("confirmed");
+
+ if (!ActivityManagerTestBase.isCloseToSquareDisplay(getInstrumentation().getContext())) {
+ return;
+ }
+ // If the display size is close to square, the activity bounds may be shrunk to match its
+ // requested orientation (see ActivityRecord#orientationRespectedWithInsets). Then its
+ // insets may not contain the cutout path, so resize the display to avoid the case.
+ sDisplayMetricsSession = new MultiDisplayTestBase.DisplayMetricsSession(DEFAULT_DISPLAY);
+ final Size displaySize = sDisplayMetricsSession.getDisplayMetrics().getSize();
+ final int orientation = displaySize.getHeight() <= displaySize.getWidth()
+ ? Configuration.ORIENTATION_PORTRAIT : Configuration.ORIENTATION_LANDSCAPE;
+ sDisplayMetricsSession.changeAspectRatio(1.77 /* 16:9 */, orientation);
+ getInstrumentation().getUiAutomation().syncInputTransactions();
}
@AfterClass
@@ -161,6 +178,10 @@
if (sImmersiveModeConfirmationSetting != null) {
sImmersiveModeConfirmationSetting.close();
}
+ if (sDisplayMetricsSession != null) {
+ sDisplayMetricsSession.close();
+ sDisplayMetricsSession = null;
+ }
}
@Before
diff --git a/tests/framework/base/windowmanager/util/src/android/server/wm/ActivityManagerTestBase.java b/tests/framework/base/windowmanager/util/src/android/server/wm/ActivityManagerTestBase.java
index bfb3e88..91e2960 100644
--- a/tests/framework/base/windowmanager/util/src/android/server/wm/ActivityManagerTestBase.java
+++ b/tests/framework/base/windowmanager/util/src/android/server/wm/ActivityManagerTestBase.java
@@ -1302,7 +1302,12 @@
/** Checks whether the display dimension is close to square. */
protected boolean isCloseToSquareDisplay() {
- final Resources resources = mContext.getResources();
+ return isCloseToSquareDisplay(mContext);
+ }
+
+ /** Checks whether the display dimension is close to square. */
+ public static boolean isCloseToSquareDisplay(Context context) {
+ final Resources resources = context.getResources();
final float closeToSquareMaxAspectRatio;
try {
closeToSquareMaxAspectRatio = resources.getFloat(resources.getIdentifier(
@@ -1312,7 +1317,8 @@
return false;
}
final DisplayMetrics displayMetrics = new DisplayMetrics();
- mDm.getDisplay(DEFAULT_DISPLAY).getRealMetrics(displayMetrics);
+ context.getSystemService(DisplayManager.class).getDisplay(DEFAULT_DISPLAY)
+ .getRealMetrics(displayMetrics);
final int w = displayMetrics.widthPixels;
final int h = displayMetrics.heightPixels;
final float aspectRatio = Math.max(w, h) / (float) Math.min(w, h);
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 e906720..1f532a4 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
@@ -19,6 +19,8 @@
import static android.Manifest.permission.POST_NOTIFICATIONS;
import static android.Manifest.permission.REVOKE_POST_NOTIFICATIONS_WITHOUT_KILL;
import static android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS;
+import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
+import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.app.usage.UsageStatsManager.STANDBY_BUCKET_FREQUENT;
import static android.app.usage.UsageStatsManager.STANDBY_BUCKET_NEVER;
import static android.app.usage.UsageStatsManager.STANDBY_BUCKET_RARE;
@@ -37,6 +39,7 @@
import android.Manifest;
import android.app.Activity;
import android.app.ActivityManager;
+import android.app.ActivityOptions;
import android.app.AppOpsManager;
import android.app.KeyguardManager;
import android.app.Notification;
@@ -291,10 +294,16 @@
}
private void launchSubActivity(Class<? extends Activity> clazz) {
+ launchSubActivity(clazz, WINDOWING_MODE_UNDEFINED);
+ }
+
+ private void launchSubActivity(Class<? extends Activity> clazz, int windowingMode) {
final Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setClassName(mTargetPackage, clazz.getName());
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
- mContext.startActivity(intent);
+ final ActivityOptions options = ActivityOptions.makeBasic();
+ options.setLaunchWindowingMode(windowingMode);
+ mContext.startActivity(intent, options.toBundle());
mUiDevice.wait(Until.hasObject(By.clazz(clazz)), TIMEOUT);
}
@@ -306,7 +315,13 @@
}
private void launchTestActivity(String pkgName, String className) {
- mContext.startActivity(createTestActivityIntent(pkgName, className));
+ launchTestActivity(pkgName, className, WINDOWING_MODE_UNDEFINED);
+ }
+
+ private void launchTestActivity(String pkgName, String className, int windowingMode) {
+ final ActivityOptions options = ActivityOptions.makeBasic();
+ options.setLaunchWindowingMode(windowingMode);
+ mContext.startActivity(createTestActivityIntent(pkgName, className), options.toBundle());
mUiDevice.wait(Until.hasObject(By.clazz(pkgName, className)), TIMEOUT);
}
@@ -558,37 +573,29 @@
// Activity will be paused as the activities we launch might be placed on a different
// TaskDisplayArea. Starting an activity and finishing it immediately will update the last
// background package of the UsageStatsService regardless of the HOME Activity state.
- launchTestActivity(TEST_APP_PKG, TEST_APP_CLASS_FINISH_SELF_ON_RESUME);
- launchSubActivity(Activities.ActivityOne.class);
- launchSubActivity(Activities.ActivityTwo.class);
+ // To ensure that the test is not affected by the display windowing mode, all activities are
+ // forced to launch in fullscreen mode in this test.
+ launchTestActivity(TEST_APP_PKG, TEST_APP_CLASS_FINISH_SELF_ON_RESUME,
+ WINDOWING_MODE_FULLSCREEN);
+ launchSubActivity(Activities.ActivityOne.class, WINDOWING_MODE_FULLSCREEN);
+ launchSubActivity(Activities.ActivityTwo.class, WINDOWING_MODE_FULLSCREEN);
endTime = System.currentTimeMillis();
events = mUsageStatsManager.queryAndAggregateUsageStats(
startTime, endTime);
stats = events.get(mTargetPackage);
assertEquals(startingCount + 1, stats.getAppLaunchCount());
- mUiDevice.pressHome();
- launchTestActivity(TEST_APP_PKG, TEST_APP_CLASS_FINISH_SELF_ON_RESUME);
- launchSubActivity(Activities.ActivityOne.class);
- launchSubActivity(Activities.ActivityTwo.class);
- launchSubActivity(Activities.ActivityThree.class);
+ launchTestActivity(TEST_APP_PKG, TEST_APP_CLASS_FINISH_SELF_ON_RESUME,
+ WINDOWING_MODE_FULLSCREEN);
+ launchSubActivity(Activities.ActivityOne.class, WINDOWING_MODE_FULLSCREEN);
+ launchSubActivity(Activities.ActivityTwo.class, WINDOWING_MODE_FULLSCREEN);
+ launchSubActivity(Activities.ActivityThree.class, WINDOWING_MODE_FULLSCREEN);
endTime = System.currentTimeMillis();
events = mUsageStatsManager.queryAndAggregateUsageStats(
startTime, endTime);
stats = events.get(mTargetPackage);
- // generally applicable to single screen devices
- int expectedUsageStatsIncrement = 2;
- // devices that handle Apps in a multi windowing mode are unlikely to behave as defined by
- // the single screen expectations; For example, Launcher may always be visible;
- // consequently, the expected lifecycle will not be triggered, thus resulting in improper
- // UsageStats values as expected for a single screen environment
- if (Activities.startedActivities.size() > 0 &&
- Activities.startedActivities.valueAt(0).isInMultiWindowMode()) {
- expectedUsageStatsIncrement = 1;
- }
-
- assertEquals(startingCount + expectedUsageStatsIncrement, stats.getAppLaunchCount());
+ assertEquals(startingCount + 2, stats.getAppLaunchCount());
}
@AppModeFull(reason = "No usage events access in instant apps")
diff --git a/tests/tests/car/OWNERS b/tests/tests/car/OWNERS
index cdff026..ed64942 100644
--- a/tests/tests/car/OWNERS
+++ b/tests/tests/car/OWNERS
@@ -1,6 +1,5 @@
# Bug component: 526266
-felipeal@google.com
-gurunagarajan@google.com
-keunyoung@google.com
-nicksauer@google.com
+ericjeong@google.com
sgurun@google.com
+xiangw@google.com
+ycheo@google.com
diff --git a/tests/tests/car/src/android/car/cts/CarPropertyManagerTest.java b/tests/tests/car/src/android/car/cts/CarPropertyManagerTest.java
index 0c9bcc5..962809e 100644
--- a/tests/tests/car/src/android/car/cts/CarPropertyManagerTest.java
+++ b/tests/tests/car/src/android/car/cts/CarPropertyManagerTest.java
@@ -1080,7 +1080,17 @@
// Test for continuous properties
int vehicleSpeed = VehiclePropertyIds.PERF_VEHICLE_SPEED;
- CarPropertyEventCounter speedListenerUI = new CarPropertyEventCounter();
+ CarPropertyConfig<?> carPropertyConfig = mCarPropertyManager.getCarPropertyConfig(
+ VehiclePropertyIds.PERF_VEHICLE_SPEED);
+ float secondsToMillis = 1_000;
+ long bufferMillis = 1_000; // 1 second
+ // timeoutMillis is set to the maximum expected time needed to receive the required
+ // number of PERF_VEHICLE_SPEED events for test. If the test does not receive the
+ // required number of events before the timeout expires, it fails.
+ long timeoutMillis =
+ ((long) ((1.0f / carPropertyConfig.getMinSampleRate()) * secondsToMillis
+ * UI_RATE_EVENT_COUNTER)) + bufferMillis;
+ CarPropertyEventCounter speedListenerUI = new CarPropertyEventCounter(timeoutMillis);
CarPropertyEventCounter speedListenerFast = new CarPropertyEventCounter();
assertThat(speedListenerUI.receivedEvent(vehicleSpeed)).isEqualTo(NO_EVENTS);
@@ -1090,22 +1100,22 @@
assertThat(speedListenerFast.receivedError(vehicleSpeed)).isEqualTo(NO_EVENTS);
assertThat(speedListenerFast.receivedErrorWithErrorCode(vehicleSpeed)).isEqualTo(NO_EVENTS);
+ speedListenerUI.resetCountDownLatch(UI_RATE_EVENT_COUNTER);
mCarPropertyManager.registerCallback(speedListenerUI, vehicleSpeed,
CarPropertyManager.SENSOR_RATE_UI);
mCarPropertyManager.registerCallback(speedListenerFast, vehicleSpeed,
CarPropertyManager.SENSOR_RATE_FASTEST);
- speedListenerUI.resetCountDownLatch(UI_RATE_EVENT_COUNTER);
speedListenerUI.assertOnChangeEventCalled();
+ mCarPropertyManager.unregisterCallback(speedListenerUI);
+ mCarPropertyManager.unregisterCallback(speedListenerFast);
+
assertThat(speedListenerUI.receivedEvent(vehicleSpeed)).isGreaterThan(NO_EVENTS);
- assertThat(speedListenerFast.receivedEvent(vehicleSpeed)).isGreaterThan(
+ assertThat(speedListenerFast.receivedEvent(vehicleSpeed)).isAtLeast(
speedListenerUI.receivedEvent(vehicleSpeed));
// The test did not change property values, it should not get error with error codes.
assertThat(speedListenerUI.receivedErrorWithErrorCode(vehicleSpeed)).isEqualTo(NO_EVENTS);
assertThat(speedListenerFast.receivedErrorWithErrorCode(vehicleSpeed)).isEqualTo(NO_EVENTS);
- mCarPropertyManager.unregisterCallback(speedListenerFast);
- mCarPropertyManager.unregisterCallback(speedListenerUI);
-
// Test for on_change properties
int nightMode = VehiclePropertyIds.NIGHT_MODE;
CarPropertyEventCounter nightModeListener = new CarPropertyEventCounter();
@@ -1114,7 +1124,6 @@
nightModeListener.assertOnChangeEventCalled();
assertThat(nightModeListener.receivedEvent(nightMode)).isEqualTo(1);
mCarPropertyManager.unregisterCallback(nightModeListener);
-
}
@Test
@@ -1239,6 +1248,15 @@
private final SparseArray<Integer> mErrorWithErrorCodeCounter = new SparseArray<>();
private int mCounter = FAST_OR_FASTEST_EVENT_COUNTER;
private CountDownLatch mCountDownLatch = new CountDownLatch(mCounter);
+ private final long mTimeoutMillis;
+
+ CarPropertyEventCounter(long timeoutMillis) {
+ mTimeoutMillis = timeoutMillis;
+ }
+
+ CarPropertyEventCounter() {
+ this(WAIT_CALLBACK);
+ }
public int receivedEvent(int propId) {
int val;
@@ -1295,18 +1313,19 @@
}
public void assertOnChangeEventCalled() throws InterruptedException {
- if (!mCountDownLatch.await(WAIT_CALLBACK, TimeUnit.MILLISECONDS)) {
- throw new IllegalStateException("Callback is not called:" + mCounter + "times in "
- + WAIT_CALLBACK + " ms.");
+ if (!mCountDownLatch.await(mTimeoutMillis, TimeUnit.MILLISECONDS)) {
+ throw new IllegalStateException(
+ "Callback is not called " + mCounter + "times in " + mTimeoutMillis
+ + " ms. It was only called " + (mCounter
+ - mCountDownLatch.getCount()) + " times.");
}
}
public void assertOnChangeEventNotCalled() throws InterruptedException {
// Once get an event, fail the test.
mCountDownLatch = new CountDownLatch(1);
- if (mCountDownLatch.await(WAIT_CALLBACK, TimeUnit.MILLISECONDS)) {
- throw new IllegalStateException("Callback is called in "
- + WAIT_CALLBACK + " ms.");
+ if (mCountDownLatch.await(mTimeoutMillis, TimeUnit.MILLISECONDS)) {
+ throw new IllegalStateException("Callback is called in " + mTimeoutMillis + " ms.");
}
}
diff --git a/tests/tests/car_builtin/OWNERS b/tests/tests/car_builtin/OWNERS
index a8e927d..ed64942 100644
--- a/tests/tests/car_builtin/OWNERS
+++ b/tests/tests/car_builtin/OWNERS
@@ -1,4 +1,5 @@
# Bug component: 526266
-keunyoung@google.com
-felipeal@google.com
-gurunagarajan@google.com
+ericjeong@google.com
+sgurun@google.com
+xiangw@google.com
+ycheo@google.com
diff --git a/tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java b/tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java
index 2333601..b6cd27d 100644
--- a/tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java
+++ b/tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java
@@ -17,7 +17,6 @@
package android.dpi.cts;
import android.content.Context;
-import android.content.pm.PackageManager;
import android.platform.test.annotations.Presubmit;
import android.test.AndroidTestCase;
import android.util.DisplayMetrics;
@@ -89,6 +88,8 @@
allowedDensities.add(DisplayMetrics.DENSITY_560);
allowedDensities.add(DisplayMetrics.DENSITY_600);
allowedDensities.add(DisplayMetrics.DENSITY_XXXHIGH);
+ // Backport of DENSITY_520 from Android 14 to android13-tests-dev
+ allowedDensities.add(520);
assertTrue("DisplayMetrics.DENSITY_DEVICE_STABLE must be one of the DisplayMetrics.DENSITY_* values: "
+ allowedDensities, allowedDensities.contains(DisplayMetrics.DENSITY_DEVICE_STABLE));
diff --git a/tests/tests/media/codec/src/android/media/codec/cts/MediaCodecResourceTest.java b/tests/tests/media/codec/src/android/media/codec/cts/MediaCodecResourceTest.java
index bb769ca..01e64e9 100644
--- a/tests/tests/media/codec/src/android/media/codec/cts/MediaCodecResourceTest.java
+++ b/tests/tests/media/codec/src/android/media/codec/cts/MediaCodecResourceTest.java
@@ -177,12 +177,12 @@
for (MediaCodec mediaCodec : mediaCodecList) {
mediaCodec.release();
}
- InstrumentationRegistry.getInstrumentation().getUiAutomation()
- .dropShellPermissionIdentity();
destroyHighPriorityProcess();
destroyLowPriorityProcess();
// Allow time for the codecs and other resources to be released
Thread.sleep(500);
+ InstrumentationRegistry.getInstrumentation().getUiAutomation()
+ .dropShellPermissionIdentity();
}
}
@@ -263,12 +263,12 @@
for (MediaCodec mediaCodec : mediaCodecList) {
mediaCodec.release();
}
- InstrumentationRegistry.getInstrumentation().getUiAutomation()
- .dropShellPermissionIdentity();
destroyHighPriorityProcess();
destroyLowPriorityProcess();
// Allow time for the codecs and other resources to be released
Thread.sleep(500);
+ InstrumentationRegistry.getInstrumentation().getUiAutomation()
+ .dropShellPermissionIdentity();
}
}
diff --git a/tests/tests/media/decoder/src/android/media/decoder/cts/DecoderTest.java b/tests/tests/media/decoder/src/android/media/decoder/cts/DecoderTest.java
index b9e7885..d2e5049 100644
--- a/tests/tests/media/decoder/src/android/media/decoder/cts/DecoderTest.java
+++ b/tests/tests/media/decoder/src/android/media/decoder/cts/DecoderTest.java
@@ -33,6 +33,7 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.AssetFileDescriptor;
@@ -3886,12 +3887,19 @@
assertTrue("MediaCodecPlayer.prepare() failed!", mMediaCodecPlayer.prepare());
mMediaCodecPlayer.startCodec();
+ // When video codecs are started, large chunks of contiguous physical memory need to be
+ // allocated, which, on low-RAM devices, can trigger high CPU usage for moving memory
+ // around to create contiguous space for the video decoder. This can cause an increase in
+ // startup time for playback.
+ ActivityManager activityManager = mContext.getSystemService(ActivityManager.class);
+ long firstFrameRenderedTimeoutSeconds = activityManager.isLowRamDevice() ? 3 : 1;
+
mMediaCodecPlayer.play();
sleepUntil(() ->
mMediaCodecPlayer.getCurrentPosition() > CodecState.UNINITIALIZED_TIMESTAMP
&& mMediaCodecPlayer.getTimestamp() != null
&& mMediaCodecPlayer.getTimestamp().framePosition > 0,
- Duration.ofSeconds(1));
+ Duration.ofSeconds(firstFrameRenderedTimeoutSeconds));
assertNotEquals("onFrameRendered was not called",
mMediaCodecPlayer.getVideoTimeUs(), CodecState.UNINITIALIZED_TIMESTAMP);
assertNotEquals("Audio timestamp is null", mMediaCodecPlayer.getTimestamp(), null);
diff --git a/tests/tests/permission2/res/raw/android_manifest.xml b/tests/tests/permission2/res/raw/android_manifest.xml
index c495afa..9fa4472 100644
--- a/tests/tests/permission2/res/raw/android_manifest.xml
+++ b/tests/tests/permission2/res/raw/android_manifest.xml
@@ -4686,6 +4686,12 @@
<permission android:name="android.permission.GRANT_RUNTIME_PERMISSIONS"
android:protectionLevel="signature|installer|verifier" />
+ <!-- Allows an application to launch the settings page which manages various
+ permissions.
+ @hide -->
+ <permission android:name="android.permission.LAUNCH_PERMISSION_SETTINGS"
+ android:protectionLevel="signature|privileged" />
+
<!-- @SystemApi Allows an app that has this permission and the permissions to install packages
to request certain runtime permissions to be granted at installation.
@hide -->
diff --git a/tests/tests/permission2/src/android/permission2/cts/NoReceiveSmsPermissionTest.java b/tests/tests/permission2/src/android/permission2/cts/NoReceiveSmsPermissionTest.java
index e95f53a..b6d6514 100644
--- a/tests/tests/permission2/src/android/permission2/cts/NoReceiveSmsPermissionTest.java
+++ b/tests/tests/permission2/src/android/permission2/cts/NoReceiveSmsPermissionTest.java
@@ -26,6 +26,7 @@
import android.platform.test.annotations.AppModeFull;
import android.platform.test.annotations.SystemUserOnly;
import android.telephony.SmsManager;
+import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.test.AndroidTestCase;
import android.text.TextUtils;
@@ -142,12 +143,19 @@
getContext().getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
int subscriptionId = subscription.getActiveDataSubscriptionId();
+ assertFalse("[RERUN] No active telephony subscription. Check there is one enabled.",
+ subscriptionId == SubscriptionManager.INVALID_SUBSCRIPTION_ID);
+
// get current phone number
String currentNumber = subscription.getPhoneNumber(subscriptionId);
// fallback to getActiveSubscriptionInfo if number is empty
if (TextUtils.isEmpty(currentNumber)) {
- currentNumber = subscription.getActiveSubscriptionInfo(subscriptionId).getNumber();
+ SubscriptionInfo subInfo = subscription.getActiveSubscriptionInfo(subscriptionId);
+
+ assertTrue("[RERUN] No info for the active telephony subscription.",
+ subInfo != null);
+ currentNumber = subInfo.getNumber();
}
assertFalse("[RERUN] SIM card does not provide phone number. Use a suitable SIM Card.",
diff --git a/tests/tests/permission2/src/android/permission2/cts/PermissionPolicyTest.java b/tests/tests/permission2/src/android/permission2/cts/PermissionPolicyTest.java
index 576df28..1f616a7 100644
--- a/tests/tests/permission2/src/android/permission2/cts/PermissionPolicyTest.java
+++ b/tests/tests/permission2/src/android/permission2/cts/PermissionPolicyTest.java
@@ -87,6 +87,9 @@
private static final String BIND_QUICK_SETTINGS_TILE =
"android.permission.BIND_QUICK_SETTINGS_TILE";
+ private static final String LAUNCH_PERMISSION_SETTINGS =
+ "android.permission.LAUNCH_PERMISSION_SETTINGS";
+
private static final String LOG_TAG = "PermissionProtectionTest";
private static final String PLATFORM_PACKAGE_NAME = "android";
@@ -548,6 +551,8 @@
return shoudldSkipBindOemCarService();
case RECEIVE_KEYCODE_EVENTS_PERMISSION:
return true;
+ case LAUNCH_PERMISSION_SETTINGS:
+ return true;
default:
return false;
}
diff --git a/tests/tests/provider/src/android/provider/cts/SmsBackupRestoreTest.java b/tests/tests/provider/src/android/provider/cts/SmsBackupRestoreTest.java
index 97cc62a..a804f5f 100644
--- a/tests/tests/provider/src/android/provider/cts/SmsBackupRestoreTest.java
+++ b/tests/tests/provider/src/android/provider/cts/SmsBackupRestoreTest.java
@@ -105,7 +105,8 @@
private boolean isFeatureSupported() throws Exception {
return (ProviderTestUtils.hasBackupTransport(LOCAL_BACKUP_COMPONENT, mUiAutomation)
- && mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEPHONY));
+ && mContext.getPackageManager()
+ .hasSystemFeature(PackageManager.FEATURE_TELEPHONY_MESSAGING));
}
private void clearMessages() {
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ForceDarkTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ForceDarkTests.java
index 0b29c37..38861b6 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ForceDarkTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ForceDarkTests.java
@@ -16,6 +16,7 @@
package android.uirendering.cts.testclasses;
+import android.Manifest;
import android.app.UiModeManager;
import android.content.Context;
import android.graphics.Color;
@@ -51,14 +52,19 @@
InstrumentationRegistry.getContext().getSystemService(Context.UI_MODE_SERVICE);
sPreviousUiMode = uiManager.getNightMode();
if (sPreviousUiMode != UiModeManager.MODE_NIGHT_YES) {
- SystemUtil.runShellCommand("service call uimode 4 i32 2");
+ SystemUtil.runWithShellPermissionIdentity(
+ () -> uiManager.setNightMode(UiModeManager.MODE_NIGHT_YES),
+ Manifest.permission.MODIFY_DAY_NIGHT_MODE);
}
}
@AfterClass
public static void restoreForceDarkSetting() {
+ UiModeManager uiManager = (UiModeManager)
+ InstrumentationRegistry.getContext().getSystemService(Context.UI_MODE_SERVICE);
if (sPreviousUiMode != UiModeManager.MODE_NIGHT_YES) {
- SystemUtil.runShellCommand("service call uimode 4 i32 " + sPreviousUiMode);
+ SystemUtil.runWithShellPermissionIdentity(() -> uiManager.setNightMode(sPreviousUiMode),
+ Manifest.permission.MODIFY_DAY_NIGHT_MODE);
}
}
diff --git a/tests/tests/view/AndroidManifest.xml b/tests/tests/view/AndroidManifest.xml
index ba1205e..1317289 100644
--- a/tests/tests/view/AndroidManifest.xml
+++ b/tests/tests/view/AndroidManifest.xml
@@ -306,7 +306,7 @@
android:label="HandleConfigurationActivity"
android:rotationAnimation="jumpcut"
android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize"
- android:theme="@android:style/Theme.Material.Dialog.NoActionBar"
+ android:theme="@android:style/Theme.Material.NoActionBar"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
diff --git a/tests/tests/widget/src/android/widget/cts/EditTextTest.java b/tests/tests/widget/src/android/widget/cts/EditTextTest.java
index 2370562..a92c2f0 100755
--- a/tests/tests/widget/src/android/widget/cts/EditTextTest.java
+++ b/tests/tests/widget/src/android/widget/cts/EditTextTest.java
@@ -375,7 +375,7 @@
private boolean isWatch() {
return (mActivity.getResources().getConfiguration().uiMode
- & Configuration.UI_MODE_TYPE_WATCH) == Configuration.UI_MODE_TYPE_WATCH;
+ & Configuration.UI_MODE_TYPE_MASK) == Configuration.UI_MODE_TYPE_WATCH;
}
@Test
diff --git a/tools/cts-tradefed/res/config/cts-on-gsi-on-r.xml b/tools/cts-tradefed/res/config/cts-on-gsi-on-r.xml
index aa7511f..21861a3 100644
--- a/tools/cts-tradefed/res/config/cts-on-gsi-on-r.xml
+++ b/tools/cts-tradefed/res/config/cts-on-gsi-on-r.xml
@@ -40,4 +40,19 @@
<!-- CtsCameraTestCases: b/259494877 -->
<option name="compatibility:exclude-filter" value="CtsCameraTestCases android.hardware.camera2.cts.ZoomCaptureTest#testRawZoomCapture" />
+ <!-- CtsIdentityTestCases: b/282102975: excluding tests to be disabled. -->
+ <option name="compatibility:exclude-filter" value="CtsIdentityTestCases android.security.identity.cts.AttestationTest" />
+ <option name="compatibility:exclude-filter" value="CtsIdentityTestCases android.security.identity.cts.DynamicAuthTest" />
+ <option name="compatibility:exclude-filter" value="CtsIdentityTestCases android.security.identity.cts.EphemeralKeyTest" />
+ <option name="compatibility:exclude-filter" value="CtsIdentityTestCases android.security.identity.cts.ProvisioningTest" />
+ <option name="compatibility:exclude-filter" value="CtsIdentityTestCases android.security.identity.cts.ReaderAuthTest" />
+ <option name="compatibility:exclude-filter" value="CtsIdentityTestCases android.security.identity.cts.UserAuthTest" />
+
+ <!-- CtsKeystoreTestCases: b/262010816 -->
+ <option name="compatibility:exclude-filter" value="CtsKeystoreTestCases android.keystore.cts.ECDSASignatureTest" />
+ <!-- CtsKeystoreTestCases: b/264546541 -->
+ <option name="compatibility:exclude-filter" value="CtsKeystoreTestCases android.keystore.cts.NoAttestKeyTest" />
+ <!-- CtsMediaMiscTestCases: b/261813452 -->
+ <option name="compatibility:exclude-filter" value="CtsMediaMiscTestCases android.media.misc.cts.HeifWriterTest" />
+
</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-on-gsi-on-s.xml b/tools/cts-tradefed/res/config/cts-on-gsi-on-s.xml
index 0b48b68..816e14f 100644
--- a/tools/cts-tradefed/res/config/cts-on-gsi-on-s.xml
+++ b/tools/cts-tradefed/res/config/cts-on-gsi-on-s.xml
@@ -38,4 +38,7 @@
<!-- CtsKeystoreTestCases: b/258826404 -->
<option name="compatibility:exclude-filter" value="CtsKeystoreTestCases android.keystore.cts.NoAttestKeyTest#testEcAttestKeyFail" />
+ <!-- CtsNativeMediaAAudioTestCases: b/261824947 -->
+ <option name="compatibility:exclude-filter" value="CtsNativeMediaAAudioTestCases android.nativemedia.aaudio.AAudioTests" />
+
</configuration>