Clear mGuestRestrictions before loading from disk

Only guest user restrictions that are set to true are saved in
writeUserListLP. When loading <guestRestrictions>, they are applied
on top of mGuestRestrictions filled with default values.
Restrictions set to false are reset and this was causing the issue.

Bug: 33250860
Test: Manual
Change-Id: I6e5c792a3adcf2116bb26fd5feba551d7edcb28e
This commit is contained in:
Fyodor Kupolov
2017-03-15 17:09:04 -07:00
parent 352b0f05cb
commit eafee02fdc
2 changed files with 3 additions and 2 deletions

View File

@@ -1810,8 +1810,8 @@ public class UserManagerService extends IUserManager.Stub {
if (type == XmlPullParser.START_TAG) {
if (parser.getName().equals(TAG_RESTRICTIONS)) {
synchronized (mGuestRestrictions) {
mGuestRestrictions.putAll(
UserRestrictionsUtils.readRestrictions(parser));
UserRestrictionsUtils
.readRestrictions(parser, mGuestRestrictions);
}
}
break;

View File

@@ -207,6 +207,7 @@ public class UserRestrictionsUtils {
}
public static void readRestrictions(XmlPullParser parser, Bundle restrictions) {
restrictions.clear();
for (String key : USER_RESTRICTIONS) {
final String value = parser.getAttributeValue(null, key);
if (value != null) {