Skip to content

Commit 12332e0

Browse files
Samuel TanThe Android Automerger
authored andcommitted
[DO NOT MERGE] Disallow guest user from changing Wifi settings
Disallow existing and newly created guest users from changing Wifi settings. BUG: 27411179 TEST: Flashed device, switched to existing guest user, and verified that Wifi settings are disabled. TEST: Flashed device, created new guest user, and verified that Wifi settings are disabled. Change-Id: Ia1bf4cce0369017b62f69d317c7ab2e30e3949b3
1 parent 3cd1905 commit 12332e0

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

services/core/java/com/android/server/pm/UserManagerService.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,17 @@ void systemReady() {
262262
Log.w(LOG_TAG, "Unable to notify AppOpsService of UserRestrictions");
263263
}
264264
}
265+
UserInfo currentGuestUser = null;
266+
synchronized (mPackagesLock) {
267+
currentGuestUser = findCurrentGuestUserLocked();
268+
}
269+
if (currentGuestUser != null && !hasUserRestriction(
270+
UserManager.DISALLOW_CONFIG_WIFI, currentGuestUser.id)) {
271+
// If a guest user currently exists, apply the DISALLOW_CONFIG_WIFI option
272+
// to it, in case this guest was created in a previous version where this
273+
// user restriction was not a default guest restriction.
274+
setUserRestriction(UserManager.DISALLOW_CONFIG_WIFI, true, currentGuestUser.id);
275+
}
265276
}
266277

267278
@Override
@@ -509,6 +520,7 @@ private void initDefaultGuestRestrictions() {
509520
if (mGuestRestrictions.isEmpty()) {
510521
mGuestRestrictions.putBoolean(UserManager.DISALLOW_OUTGOING_CALLS, true);
511522
mGuestRestrictions.putBoolean(UserManager.DISALLOW_SMS, true);
523+
mGuestRestrictions.putBoolean(UserManager.DISALLOW_CONFIG_WIFI, true);
512524
}
513525
}
514526

0 commit comments

Comments
 (0)