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

Commit 07ece593 authored by Samuel Tan's avatar Samuel Tan Committed by Android (Google) Code Review
Browse files

Merge "Disallow guest user from changing Wifi settings" into nyc-dev

parents aaa72564 d9453b8b
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -387,6 +387,15 @@ public class UserManagerService extends IUserManager.Stub {
        synchronized (mRestrictionsLock) {
            applyUserRestrictionsLR(UserHandle.USER_SYSTEM);
        }

        UserInfo currentGuestUser = findCurrentGuestUser();
        if (currentGuestUser != null && !hasUserRestriction(
                UserManager.DISALLOW_CONFIG_WIFI, currentGuestUser.id)) {
            // If a guest user currently exists, apply the DISALLOW_CONFIG_WIFI option
            // to it, in case this guest was created in a previous version where this
            // user restriction was not a default guest restriction.
            setUserRestriction(UserManager.DISALLOW_CONFIG_WIFI, true, currentGuestUser.id);
        }
    }

    @Override
@@ -828,6 +837,7 @@ public class UserManagerService extends IUserManager.Stub {
    private void initDefaultGuestRestrictions() {
        synchronized (mGuestRestrictions) {
            if (mGuestRestrictions.isEmpty()) {
                mGuestRestrictions.putBoolean(UserManager.DISALLOW_CONFIG_WIFI, true);
                mGuestRestrictions.putBoolean(UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES, true);
                mGuestRestrictions.putBoolean(UserManager.DISALLOW_OUTGOING_CALLS, true);
                mGuestRestrictions.putBoolean(UserManager.DISALLOW_SMS, true);