Merge "Update AppOpsService to remove user state after the user is removed."

This commit is contained in:
Sudheer Shanka
2016-09-28 16:15:46 +00:00
committed by Android (Google) Code Review

View File

@@ -2277,6 +2277,16 @@ public class AppOpsService extends IAppOpsService.Stub {
ClientRestrictionState opRestrictions = mOpUserRestrictions.valueAt(i);
opRestrictions.removeUser(userHandle);
}
removeUidsForUserLocked(userHandle);
}
}
private void removeUidsForUserLocked(int userHandle) {
for (int i = mUidStates.size() - 1; i >= 0; --i) {
final int uid = mUidStates.keyAt(i);
if (UserHandle.getUserId(uid) == userHandle) {
mUidStates.removeAt(i);
}
}
}
@@ -2396,6 +2406,12 @@ public class AppOpsService extends IAppOpsService.Stub {
perUserExcludedPackages = null;
}
}
if (perUserRestrictions != null) {
perUserRestrictions.remove(userId);
if (perUserRestrictions.size() <= 0) {
perUserRestrictions = null;
}
}
}
public boolean isDefault() {