summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authortomnatan <tomnatan@google.com>2021-07-01 14:47:17 +0000
committerTom Natan <tomnatan@google.com>2021-07-02 12:25:59 +0000
commit4d859f35bc67da7f8a1baecca51c2f32d46885e3 (patch)
treec5b93b604347eaf49f9c6909fdc8d96b170df511 /tests
parentde8ea692b1c58cb19c7fb94ce1aa5bf9299187b3 (diff)
Handle multiple users when adding and rechecking overrides.
This is important for multi-user devices that have different applications or versions installed for each user. Bug: 190483583 Test: atest FrameworksServicesTests:CompatConfigTest Test: atest FrameworksServicesTests:OverrideValidatorImplTest Test: atest FrameworksServicesTests:PlatformCompatTest Test: atest PlatformCompatGating:PlatformCompatPermissionsTest Change-Id: I74c061001efbbd9699087e603a580cb2538891ec
Diffstat (limited to 'tests')
-rw-r--r--tests/PlatformCompatGating/src/com/android/tests/gating/PlatformCompatPermissionsTest.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/PlatformCompatGating/src/com/android/tests/gating/PlatformCompatPermissionsTest.java b/tests/PlatformCompatGating/src/com/android/tests/gating/PlatformCompatPermissionsTest.java
index 9b9e5815a588..060133df0a40 100644
--- a/tests/PlatformCompatGating/src/com/android/tests/gating/PlatformCompatPermissionsTest.java
+++ b/tests/PlatformCompatGating/src/com/android/tests/gating/PlatformCompatPermissionsTest.java
@@ -16,6 +16,7 @@
package com.android.tests.gating;
+import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
import static android.Manifest.permission.LOG_COMPAT_CHANGE;
import static android.Manifest.permission.OVERRIDE_COMPAT_CHANGE_CONFIG;
import static android.Manifest.permission.READ_COMPAT_CHANGE_CONFIG;
@@ -261,13 +262,15 @@ public final class PlatformCompatPermissionsTest {
public void clearOverrides_noOverridesPermission_throwsSecurityException()
throws Throwable {
thrown.expect(SecurityException.class);
+ mUiAutomation.adoptShellPermissionIdentity(INTERACT_ACROSS_USERS_FULL);
mPlatformCompat.clearOverrides("foo.bar");
}
@Test
public void clearOverrides_overridesPermission_noThrow()
throws Throwable {
- mUiAutomation.adoptShellPermissionIdentity(OVERRIDE_COMPAT_CHANGE_CONFIG);
+ mUiAutomation.adoptShellPermissionIdentity(OVERRIDE_COMPAT_CHANGE_CONFIG,
+ INTERACT_ACROSS_USERS_FULL);
mPlatformCompat.clearOverrides("foo.bar");
}
@@ -276,13 +279,15 @@ public final class PlatformCompatPermissionsTest {
public void clearOverridesForTest_noOverridesPermission_throwsSecurityException()
throws Throwable {
thrown.expect(SecurityException.class);
+ mUiAutomation.adoptShellPermissionIdentity(INTERACT_ACROSS_USERS_FULL);
mPlatformCompat.clearOverridesForTest("foo.bar");
}
@Test
public void clearOverridesForTest_overridesPermission_noThrow()
throws Throwable {
- mUiAutomation.adoptShellPermissionIdentity(OVERRIDE_COMPAT_CHANGE_CONFIG);
+ mUiAutomation.adoptShellPermissionIdentity(OVERRIDE_COMPAT_CHANGE_CONFIG,
+ INTERACT_ACROSS_USERS_FULL);
mPlatformCompat.clearOverridesForTest("foo.bar");
}
@@ -291,13 +296,15 @@ public final class PlatformCompatPermissionsTest {
public void clearOverride_noOverridesPermission_throwsSecurityException()
throws Throwable {
thrown.expect(SecurityException.class);
+ mUiAutomation.adoptShellPermissionIdentity(INTERACT_ACROSS_USERS_FULL);
mPlatformCompat.clearOverride(1, "foo.bar");
}
@Test
public void clearOverride_overridesPermission_noThrow()
throws Throwable {
- mUiAutomation.adoptShellPermissionIdentity(OVERRIDE_COMPAT_CHANGE_CONFIG);
+ mUiAutomation.adoptShellPermissionIdentity(OVERRIDE_COMPAT_CHANGE_CONFIG,
+ INTERACT_ACROSS_USERS_FULL);
mPlatformCompat.clearOverride(1, "foo.bar");
}