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

Commit bbf6c611 authored by Samuel Tan's avatar Samuel Tan Committed by android-build-merger
Browse files

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

am: 07ece593

* commit '07ece593':
  Disallow guest user from changing Wifi settings
parents ed6825a8 07ece593
Loading
Loading
Loading
Loading
+10 −0
Original line number Original line Diff line number Diff line
@@ -387,6 +387,15 @@ public class UserManagerService extends IUserManager.Stub {
        synchronized (mRestrictionsLock) {
        synchronized (mRestrictionsLock) {
            applyUserRestrictionsLR(UserHandle.USER_SYSTEM);
            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
    @Override
@@ -828,6 +837,7 @@ public class UserManagerService extends IUserManager.Stub {
    private void initDefaultGuestRestrictions() {
    private void initDefaultGuestRestrictions() {
        synchronized (mGuestRestrictions) {
        synchronized (mGuestRestrictions) {
            if (mGuestRestrictions.isEmpty()) {
            if (mGuestRestrictions.isEmpty()) {
                mGuestRestrictions.putBoolean(UserManager.DISALLOW_CONFIG_WIFI, true);
                mGuestRestrictions.putBoolean(UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES, true);
                mGuestRestrictions.putBoolean(UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES, true);
                mGuestRestrictions.putBoolean(UserManager.DISALLOW_OUTGOING_CALLS, true);
                mGuestRestrictions.putBoolean(UserManager.DISALLOW_OUTGOING_CALLS, true);
                mGuestRestrictions.putBoolean(UserManager.DISALLOW_SMS, true);
                mGuestRestrictions.putBoolean(UserManager.DISALLOW_SMS, true);