summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ayush Sharma <ayushsha@google.com> 2021-12-23 16:02:52 +0000
committer Ayush Sharma <ayushsha@google.com> 2022-01-19 09:51:52 +0000
commitaa8c5e8f733f6911ebef1ef73dbcc9aa7cac6cbd (patch)
treee68c469d6a94bfac1af4b8e0e020c849c24c1c72
parent9a533b7e448d0da2d2cb65ae52264fed0f6cf1b3 (diff)
Return PO or DO for POLICY_SUSPEND_PACKAGES
For suspended packages workflow we used to return PO or DO for admin support intent, which changed as part of fixing this bug : b/192245204 and now we are returning null. So to revert to original behavior returning PO or DO for POLICY_SUSPEND_PACKAGES case. Bug: 210792656 Test: atest MixedDeviceOwnerTest#testCreateAdminSupportIntent atest MixedProfileOwnerTest#testCreateAdminSupportIntent atest MixedManagedProfileOwnerTest#testCreateAdminSupportIntent atest DevicePolicyManagerTest#testCreateAdminSupportIntent atest com.android.cts.devicepolicy.MixedDeviceOwnerTest#testSuspendPackage Change-Id: Ice96fe5eb81b9049791b060287f0aea527868539 Merged-In: Ice96fe5eb81b9049791b060287f0aea527868539 (cherry picked from commit 97cfbb90bcb0a3cf9eb3ba47f49fc5b4dc92a532)
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 99e28d101496..99c1ff1bc2d5 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -13023,12 +13023,17 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
/**
* @param restriction The restriction enforced by admin. It could be any user restriction or
- * policy like {@link DevicePolicyManager#POLICY_DISABLE_CAMERA} and
- * {@link DevicePolicyManager#POLICY_DISABLE_SCREEN_CAPTURE}.
+ * policy like {@link DevicePolicyManager#POLICY_DISABLE_CAMERA},
+ * {@link DevicePolicyManager#POLICY_DISABLE_SCREEN_CAPTURE} and {@link
+ * DevicePolicyManager#POLICY_SUSPEND_PACKAGES}.
*/
private Bundle getEnforcingAdminAndUserDetailsInternal(int userId, String restriction) {
Bundle result = null;
- if (restriction == null) {
+
+ // For POLICY_SUSPEND_PACKAGES return PO or DO to keep the behavior same as
+ // before the bug fix for b/192245204.
+ if (restriction == null || DevicePolicyManager.POLICY_SUSPEND_PACKAGES.equals(
+ restriction)) {
ComponentName profileOwner = mOwners.getProfileOwnerComponent(userId);
if (profileOwner != null) {
result = new Bundle();