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

Commit cab2f5bd authored by Jonathan Scott's avatar Jonathan Scott
Browse files

Fix NPE when removing policies.

Test: atest
android.app.cts.ActivityManagerTest#testTimeTrackingAPI_SimpleStartExit
Fixes: 277978314

Change-Id: I305af84c0fbdffbbcb1f34b1d50ab03476a2e530
parent 54f6fb6d
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1066,6 +1066,11 @@ final class DevicePolicyEngine {
     * Removes all local policies for the provided {@code userId}.
     */
    private void removeLocalPoliciesForUser(int userId) {
        if (!mLocalPolicies.contains(userId)) {
            // No policies on user
            return;
        }

        Set<PolicyKey> localPolicies = new HashSet<>(mLocalPolicies.get(userId).keySet());
        for (PolicyKey policy : localPolicies) {
            PolicyState<?> policyState = mLocalPolicies.get(userId).get(policy);