Fix NPE when removing policies.
Test: atest android.app.cts.ActivityManagerTest#testTimeTrackingAPI_SimpleStartExit Fixes: 277978314 Change-Id: I305af84c0fbdffbbcb1f34b1d50ab03476a2e530
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user