commit | 8bbe97b71cfb528070a1a64f6db629659c8ad367 | [log] [tgz] |
---|---|---|
author | Valentin Iftime <valiiftime@google.com> | Tue Apr 07 17:35:38 2020 +0200 |
committer | Valentin Iftime <valiiftime@google.com> | Tue Apr 07 17:35:38 2020 +0200 |
tree | eb9e6cd12b69b871b7a1a71dd0af1b705834c3f1 | |
parent | 326f8ff35bb6c0379cf08eaa0af91c95a9d3ac68 [diff] |
Check for managed_users feature In tests that use managed profiles (CrossProfileAppsPermissionHostSideTest). managed_users feature is required by UserManagerService: https://source.corp.google.com/android/frameworks/base/services/core/java/com/android/server/pm/UserManagerService.java;l=2230 Test: run cts -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.CrossProfileAppsPermissionHostSideTest Bug: 149827369 Change-Id: I01733f3cf4cbef870cf23ad21231b334765439d8
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseDevicePolicyTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseDevicePolicyTest.java index 516c6ee..2942a89 100644 --- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseDevicePolicyTest.java +++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseDevicePolicyTest.java
@@ -156,6 +156,9 @@ /** Whether multi-user is supported. */ protected boolean mSupportsMultiUser; + /** Whether managed profiles are supported. */ + protected boolean mHasManagedUserFeature; + /** Whether file-based encryption (FBE) is supported. */ protected boolean mSupportsFbe; @@ -179,6 +182,7 @@ mHasFeature = mHasFeature && hasDeviceFeature("android.software.device_admin"); } mSupportsMultiUser = getMaxNumberOfUsersSupported() > 1; + mHasManagedUserFeature = hasDeviceFeature("android.software.managed_users"); mSupportsFbe = hasDeviceFeature("android.software.file_based_encryption"); mHasTelephony = hasDeviceFeature("android.hardware.telephony"); mFixedPackages = getDevice().getInstalledPackageNames();
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/CrossProfileAppsPermissionHostSideTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/CrossProfileAppsPermissionHostSideTest.java index f94955c..667cca7 100644 --- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/CrossProfileAppsPermissionHostSideTest.java +++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/CrossProfileAppsPermissionHostSideTest.java
@@ -60,7 +60,7 @@ @Override public void setUp() throws Exception { super.setUp(); - assumeTrue(mSupportsMultiUser); + assumeTrue(mSupportsMultiUser && mHasManagedUserFeature); } @Test
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/UserRestrictionsTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/UserRestrictionsTest.java index 4abfe45..90dbed9 100644 --- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/UserRestrictionsTest.java +++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/UserRestrictionsTest.java
@@ -43,13 +43,11 @@ private boolean mRemoveOwnerInTearDown; private int mDeviceOwnerUserId; - private boolean mHasManagedUserFeature; @Override public void setUp() throws Exception { super.setUp(); - mHasManagedUserFeature = hasDeviceFeature("android.software.managed_users"); mRemoveOwnerInTearDown = false; mDeviceOwnerUserId = mPrimaryUserId; }