[DO NOT MERGE] Disallow guest user from changing Wifi settings am: d8c3ca4

am: 542bb73

* commit '542bb7307b2bf3dab337b56e392b778896f88ec6':
  [DO NOT MERGE] Disallow guest user from changing Wifi settings
This commit is contained in:
Samuel Tan
2016-03-23 21:40:23 +00:00
committed by android-build-merger

View File

@@ -262,6 +262,17 @@ public class UserManagerService extends IUserManager.Stub {
Log.w(LOG_TAG, "Unable to notify AppOpsService of UserRestrictions"); Log.w(LOG_TAG, "Unable to notify AppOpsService of UserRestrictions");
} }
} }
UserInfo currentGuestUser = null;
synchronized (mPackagesLock) {
currentGuestUser = findCurrentGuestUserLocked();
}
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
@@ -509,6 +520,7 @@ public class UserManagerService extends IUserManager.Stub {
if (mGuestRestrictions.isEmpty()) { if (mGuestRestrictions.isEmpty()) {
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);
mGuestRestrictions.putBoolean(UserManager.DISALLOW_CONFIG_WIFI, true);
} }
} }