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

Commit da0b1682 authored by Amith Yamasani's avatar Amith Yamasani
Browse files

Fix parsing bug that affects reading back guest restrictions

Now it remembers guest default restrictions across reboots.

Bug: 18477780
Change-Id: I3a2c0d47825c8fcfc69edf791ddd6329e23ee04b
parent 5d3d53aa
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -224,6 +224,7 @@ public class UserManagerService extends IUserManager.Stub {
                        |FileUtils.S_IROTH|FileUtils.S_IXOTH,
                        -1, -1);
                mUserListFile = new File(mUsersDir, USER_LIST_FILENAME);
                initDefaultGuestRestrictions();
                readUserListLocked();
                // Prune out any partially created/partially removed users.
                ArrayList<UserInfo> partials = new ArrayList<UserInfo>();
@@ -469,7 +470,7 @@ public class UserManagerService extends IUserManager.Stub {
    private void initDefaultGuestRestrictions() {
        if (mGuestRestrictions.isEmpty()) {
            mGuestRestrictions.putBoolean(UserManager.DISALLOW_OUTGOING_CALLS, true);
            writeUserListLocked();
            mGuestRestrictions.putBoolean(UserManager.DISALLOW_SMS, true);
        }
    }

@@ -653,9 +654,16 @@ public class UserManagerService extends IUserManager.Stub {
                            }
                        }
                    } else if (name.equals(TAG_GUEST_RESTRICTIONS)) {
                        mGuestRestrictions.clear();
                        while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
                                && type != XmlPullParser.END_TAG) {
                            if (type == XmlPullParser.START_TAG) {
                                if (parser.getName().equals(TAG_RESTRICTIONS)) {
                                    readRestrictionsLocked(parser, mGuestRestrictions);
                                }
                                break;
                            }
                        }
                    }
                }
            }
            updateUserIdsLocked();