diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-07-01 11:03:37 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-07-01 11:03:37 +0000 |
commit | a9b799933ac0ac3bb88ad4006de45b3bae2f8042 (patch) | |
tree | 7202999aec5ac445f91059eb86296629df59d82e | |
parent | c3946c3d4860ffcca3d8afb30b5411b2df3f0a15 (diff) | |
parent | a66f5945146dd7a0b94884f76a90a9eb225f7d99 (diff) | |
download | cts-android11-d2-release.tar.gz |
Merge cherrypicks of [15172584, 15172286, 15172594, 15172385, 15172631, 15172632, 15172633, 15172634, 15171221, 15171222, 15171223, 15171541, 15171542, 15171668, 15172342, 15170823, 15170824, 15170825, 15170826, 15170827, 15170828, 15170829, 15172650, 15172651, 15172652, 15172653, 15172654, 15172655, 15172656, 15172657, 15172658, 15172659, 15172660, 15172661, 15172386, 15172387, 15172388, 15172389, 15172670, 15172553, 15172589, 15172343, 15172617, 15172618, 15172619, 15172620, 15172690, 15172691, 15172692, 15172693, 15172694, 15172695, 15172696, 15172697, 15171708, 15171709, 15172554, 15172555, 15172710, 15172621, 15172635, 15172636, 15172698, 15172699, 15172700, 15171543, 15172701, 15172702, 15172703, 15172704, 15171669, 15172622] into rvc-d2-releaseandroid-11.0.0_r48android-11.0.0_r47android-11.0.0_r45android-11.0.0_r44android11-d2-release
Change-Id: I0586760f97d114d725b052bbfe0478d6a99a7310
2 files changed, 49 insertions, 9 deletions
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 106434f20f4..98f4ad1e3aa 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 @@ -140,6 +140,13 @@ public class DocumentsClientTest extends DocumentsClientTestCase { assertTrue(title.waitForExists(TIMEOUT)); } + private String getDeviceName() { + final String deviceName = Settings.Global.getString( + mActivity.getContentResolver(), Settings.Global.DEVICE_NAME); + // Device name should always be set. In case it isn't, fall back to "Internal Storage" + return !TextUtils.isEmpty(deviceName) ? deviceName : "Internal Storage"; + } + public void testOpenSimple() throws Exception { if (!supportedHardware()) return; @@ -371,6 +378,16 @@ public class DocumentsClientTest extends DocumentsClientTestCase { // save button is disabled for the storage root assertFalse(findSaveButton().isEnabled()); + // We should always have Android directory available + findDocument("Android").click(); + mDevice.waitForIdle(); + + // save button is disabled for Android folder + assertFalse(findSaveButton().isEnabled()); + + findRoot(getDeviceName()).click(); + mDevice.waitForIdle(); + try { findDocument("Download").click(); mDevice.waitForIdle(); @@ -409,6 +426,16 @@ public class DocumentsClientTest extends DocumentsClientTestCase { // save button is enabled for for the storage root assertTrue(findSaveButton().isEnabled()); + // We should always have Android directory available + findDocument("Android").click(); + mDevice.waitForIdle(); + + // save button is enabled for Android folder + assertTrue(findSaveButton().isEnabled()); + + findRoot(getDeviceName()).click(); + mDevice.waitForIdle(); + try { findDocument("Download").click(); mDevice.waitForIdle(); @@ -702,15 +729,8 @@ public class DocumentsClientTest extends DocumentsClientTestCase { mActivity.startActivityForResult(intent, REQUEST_CODE); mDevice.waitForIdle(); - final String deviceName = Settings.Global.getString( - mActivity.getContentResolver(), Settings.Global.DEVICE_NAME); - - // Device name should always be set. In case it isn't, though, - // fall back to "Internal Storage". - final String title = !TextUtils.isEmpty(deviceName) ? deviceName : "Internal Storage"; - // assert the default root is internal storage root - assertToolbarTitleEquals(title); + assertToolbarTitleEquals(getDeviceName()); // no Downloads root assertFalse(findRoot("Downloads").exists()); 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 86371fdc559..02df1b0a156 100644 --- a/tests/tests/telephony/current/src/android/telephony/cts/SubscriptionManagerTest.java +++ b/tests/tests/telephony/current/src/android/telephony/cts/SubscriptionManagerTest.java @@ -571,9 +571,23 @@ public class SubscriptionManagerTest { List<SubscriptionInfo> infoList = mSm.getSubscriptionsInGroup(uuid); assertNotNull(infoList); assertEquals(1, infoList.size()); + assertNull(infoList.get(0).getGroupUuid()); + + infoList = ShellIdentityUtils.invokeMethodWithShellPermissions(mSm, + (sm) -> sm.getSubscriptionsInGroup(uuid)); + assertNotNull(infoList); + assertEquals(1, infoList.size()); assertEquals(uuid, infoList.get(0).getGroupUuid()); - List<SubscriptionInfo> availableInfoList = mSm.getAvailableSubscriptionInfoList(); + List<SubscriptionInfo> availableInfoList; + try { + mSm.getAvailableSubscriptionInfoList(); + fail("SecurityException should be thrown without READ_PRIVILEGED_PHONE_STATE"); + } catch (SecurityException ex) { + // Ignore + } + availableInfoList = ShellIdentityUtils.invokeMethodWithShellPermissions(mSm, + (sm) -> sm.getAvailableSubscriptionInfoList()); if (availableInfoList.size() > 1) { List<Integer> availableSubGroup = availableInfoList.stream() .map(info -> info.getSubscriptionId()) @@ -615,6 +629,12 @@ public class SubscriptionManagerTest { List<SubscriptionInfo> infoList = mSm.getSubscriptionsInGroup(uuid); assertNotNull(infoList); assertEquals(1, infoList.size()); + assertNull(infoList.get(0).getGroupUuid()); + + infoList = ShellIdentityUtils.invokeMethodWithShellPermissions(mSm, + (sm) -> sm.getSubscriptionsInGroup(uuid)); + assertNotNull(infoList); + assertEquals(1, infoList.size()); assertEquals(uuid, infoList.get(0).getGroupUuid()); // Remove from subscription group with current sub Id. |