Merge "HDMICEC: Start cec-client as TV for non-TV tests"
diff --git a/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTest.java b/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTest.java
index 8aed0cf..354bf5b 100644
--- a/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTest.java
+++ b/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTest.java
@@ -441,17 +441,25 @@
mActivity.startActivityForResult(intent, REQUEST_CODE);
// Look around, we should be able to see both DocumentsProviders and
- // other GET_CONTENT sources. If the DocumentsProvider and GetContent
- // root has the same package, they will be combined as one root item.
+ // other GET_CONTENT sources.
mDevice.waitForIdle();
assertTrue("CtsLocal root", findRoot("CtsLocal").exists());
assertTrue("CtsCreate root", findRoot("CtsCreate").exists());
- assertFalse("CtsGetContent root", findRoot("CtsGetContent").exists());
+ // Find and click GetContent item.
+ UiObject getContentRoot = findRoot("CtsGetContent");
mDevice.waitForIdle();
- // Both CtsLocal and CtsLocal have action icon and have the same action.
- findActionIcon("CtsCreate");
- findActionIcon("CtsLocal").click();
+ if (getContentRoot.exists()) {
+ // Case 1: GetContent is presented as an independent root item.
+ findRoot("CtsGetContent").click();
+ } else {
+ // Case 2: GetContent is presented as an action icon next to the DocumentsProvider root
+ // from the same package.
+ // In this case, both CtsLocal and CtsLocal have action icon and have the same action.
+ findActionIcon("CtsCreate");
+ findActionIcon("CtsLocal").click();
+ }
+
Result result = mActivity.getResult();
assertEquals("ReSuLt", result.data.getAction());
}
diff --git a/tests/tests/app.usage/src/android/app/usage/cts/UsageReportingTest.java b/tests/tests/app.usage/src/android/app/usage/cts/UsageReportingTest.java
index ebb5d11..0681f4e 100644
--- a/tests/tests/app.usage/src/android/app/usage/cts/UsageReportingTest.java
+++ b/tests/tests/app.usage/src/android/app/usage/cts/UsageReportingTest.java
@@ -313,10 +313,12 @@
mUsageStatsManager.reportUsageStop(activity0, TOKEN_0);
assertAppOrTokenUsed(mFullToken0, true);
- // Send the device to sleep to get onStop called for the token reporting activities.
- mUiDevice.sleep();
- Thread.sleep(1000);
- assertAppOrTokenUsed(mFullToken0, false);
+ // Send the device to keyguard to get onStop called for the token reporting activities.
+ try (final LockScreenSession lockScreenSession = new LockScreenSession()) {
+ lockScreenSession.gotoKeyguard();
+ Thread.sleep(1000);
+ assertAppOrTokenUsed(mFullToken0, false);
+ }
}
@Test
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/SignalStrengthTest.java b/tests/tests/telephony/current/src/android/telephony/cts/SignalStrengthTest.java
index 4cbe6ad..785916f 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/SignalStrengthTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/SignalStrengthTest.java
@@ -19,6 +19,7 @@
import static androidx.test.InstrumentationRegistry.getContext;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -73,7 +74,7 @@
}
@Test
- public void testSignalStrength() throws Throwable {
+ public void testSignalStrength() {
if (!mPm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
Log.d(TAG, "Skipping test that requires FEATURE_TELEPHONY");
return;
@@ -91,7 +92,10 @@
long curTime = SystemClock.elapsedRealtime();
assertTrue("Invalid timestamp in SignalStrength: " + ss.getTimestampMillis(),
ss.getTimestampMillis() > 0 && ss.getTimestampMillis() <= curTime);
- Log.d(TAG, "Timestamp of SignalStrength: " + Long.toString(ss.getTimestampMillis()));
+ Log.d(TAG, "Timestamp of SignalStrength: " + ss.getTimestampMillis());
+
+ SignalStrength copy = new SignalStrength(ss);
+ assertEquals(ss, copy);
List<CellSignalStrength> signalStrengths = ss.getCellSignalStrengths();
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java b/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
index 5253fab..cd87449 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
@@ -2974,6 +2974,17 @@
assertTrue(isDataConnectionAvailable);
}
+ @Test
+ public void testGetCdmaEnhancedRoamingIndicatorDisplayNumber() {
+ int index = mTelephonyManager.getCdmaEnhancedRoamingIndicatorDisplayNumber();
+ int phoneType = mTelephonyManager.getPhoneType();
+ if (phoneType == TelephonyManager.PHONE_TYPE_CDMA) {
+ assertTrue(index >= 0 && index <= 255);
+ } else {
+ assertEquals(-1, index);
+ }
+ }
+
private void disableNrDualConnectivity() {
ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(
mTelephonyManager,
@@ -3019,6 +3030,58 @@
}
@Test
+ public void testCdmaRoamingMode() {
+ if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+ return;
+ }
+
+ // Save state
+ int cdmaRoamingMode = ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
+ TelephonyManager::getCdmaRoamingMode);
+
+ ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
+ tm -> tm.setCdmaRoamingMode(TelephonyManager.CDMA_ROAMING_MODE_HOME));
+ assertEquals(TelephonyManager.CDMA_ROAMING_MODE_HOME,
+ (int) ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
+ TelephonyManager::getCdmaRoamingMode));
+ ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
+ tm -> tm.setCdmaRoamingMode(TelephonyManager.CDMA_ROAMING_MODE_AFFILIATED));
+ assertEquals(TelephonyManager.CDMA_ROAMING_MODE_AFFILIATED,
+ (int) ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
+ TelephonyManager::getCdmaRoamingMode));
+
+ // Reset state
+ ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
+ tm -> tm.setCdmaRoamingMode(cdmaRoamingMode));
+ }
+
+ @Test
+ public void testCdmaSubscriptionMode() {
+ if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+ return;
+ }
+
+ // Save state
+ int cdmaSubscriptionMode = ShellIdentityUtils.invokeMethodWithShellPermissions(
+ mTelephonyManager, TelephonyManager::getCdmaSubscriptionMode);
+
+ ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
+ tm -> tm.setCdmaSubscriptionMode(TelephonyManager.CDMA_SUBSCRIPTION_NV));
+ assertEquals(TelephonyManager.CDMA_SUBSCRIPTION_NV,
+ (int) ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
+ TelephonyManager::getCdmaSubscriptionMode));
+ ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
+ tm -> tm.setCdmaSubscriptionMode(TelephonyManager.CDMA_SUBSCRIPTION_RUIM_SIM));
+ assertEquals(TelephonyManager.CDMA_SUBSCRIPTION_RUIM_SIM,
+ (int) ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
+ TelephonyManager::getCdmaSubscriptionMode));
+
+ // Reset state
+ ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
+ tm -> tm.setCdmaRoamingMode(cdmaSubscriptionMode));
+ }
+
+ @Test
public void testGetCarrierBandwidth() {
if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
return;