Only testManagedProfile properties on devices that support them
Not all devices or user types support having managed profiles. The goal of this particular test is to test the properties of a managed profile (if created), not to enforce their support.
Change-Id: Ibf1c5d05d47b92cfde092007ce43785a81e1a9af
Test: atest UserManagerTest
Fixes: 227008463
diff --git a/tests/tests/multiuser/src/android/multiuser/cts/UserManagerTest.java b/tests/tests/multiuser/src/android/multiuser/cts/UserManagerTest.java
index 6061f4a..6e22c52 100644
--- a/tests/tests/multiuser/src/android/multiuser/cts/UserManagerTest.java
+++ b/tests/tests/multiuser/src/android/multiuser/cts/UserManagerTest.java
@@ -179,7 +179,7 @@
}
@Test
- @SystemUserOnly(reason = "Profiles are only supported on system user.")
+ @RequireFeature(FEATURE_MANAGED_USERS)
@EnsureHasPermission({CREATE_USERS, QUERY_USERS})
public void testManagedProfile() throws Exception {
UserHandle userHandle = null;
@@ -187,7 +187,9 @@
try {
userHandle = mUserManager.createProfile(
"Managed profile", UserManager.USER_TYPE_PROFILE_MANAGED, new HashSet<>());
- assertThat(userHandle).isNotNull();
+
+ // Not all devices and user types support managed profiles; skip if this one doesn't.
+ assumeTrue("Couldn't create a managed profile", userHandle != null);
final UserManager umOfProfile = sContext
.createPackageContextAsUser("android", 0, userHandle)