Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3cfca38c authored by Automerger Merge Worker's avatar Automerger Merge Worker Committed by Android (Google) Code Review
Browse files

Merge "Merge "Fix lock task clearing for affiliated users" into udc-dev am:...

Merge "Merge "Fix lock task clearing for affiliated users" into udc-dev am: 029eb856 am: 26338322" into udc-d1-dev-plus-aosp
parents 15c4563c 766613d0
Loading
Loading
Loading
Loading
+28 −12
Original line number Diff line number Diff line
@@ -14957,18 +14957,34 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                    continue;
                }
                if (isPolicyEngineForFinanceFlagEnabled()) {
                    Map<EnforcingAdmin, PolicyValue<LockTaskPolicy>> policies =
                            mDevicePolicyEngine.getLocalPoliciesSetByAdmins(
                                    PolicyDefinition.LOCK_TASK, userId);
                    Set<EnforcingAdmin> admins = new HashSet<>(policies.keySet());
                    for (EnforcingAdmin admin : admins) {
                        if (admin.hasAuthority(EnforcingAdmin.DPC_AUTHORITY)) {
                            mDevicePolicyEngine.removeLocalPolicy(
                                    PolicyDefinition.LOCK_TASK, admin, userId);
                        }
                    }
                } else {
                    final List<String> lockTaskPackages = getUserData(userId).mLockTaskPackages;
                    // TODO(b/278438525): handle in the policy engine
                    if (!lockTaskPackages.isEmpty()) {
                        Slogf.d(LOG_TAG,
                            "User id " + userId + " not affiliated. Clearing lock task packages");
                                "User id " + userId
                                        + " not affiliated. Clearing lock task packages");
                        setLockTaskPackagesLocked(userId, Collections.<String>emptyList());
                    }
                    final int lockTaskFeatures = getUserData(userId).mLockTaskFeatures;
                    if (lockTaskFeatures != DevicePolicyManager.LOCK_TASK_FEATURE_NONE) {
                        Slogf.d(LOG_TAG,
                            "User id " + userId + " not affiliated. Clearing lock task features");
                    setLockTaskFeaturesLocked(userId, DevicePolicyManager.LOCK_TASK_FEATURE_NONE);
                                "User id " + userId
                                        + " not affiliated. Clearing lock task features");
                        setLockTaskFeaturesLocked(userId,
                                DevicePolicyManager.LOCK_TASK_FEATURE_NONE);
                    }
                }
            }
        });