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

Commit 46dbc811 authored by Adam Bookatz's avatar Adam Bookatz
Browse files

getUserSwitchability correct permission

The documentation didn't match the permission requirement.

Bug: 390458180
Flag: android.multiuser.get_user_switchability_permission
Test: com.android.server.pm.UserManagerTest
Change-Id: I0a7a68d154e5dfdfeb5d2bddea07fb3b389a69d4
parent 441143d1
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -456,6 +456,16 @@ flag {
    bug: "338579331"
}

flag {
  name: "get_user_switchability_permission"
  namespace: "multiuser"
  description: "Update permissions for getUserSwitchability"
  bug: "390458180"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}

flag {
    name: "restrict_quiet_mode_credential_bug_fix_to_managed_profiles"
    namespace: "profile_experiences"
+10 −1
Original line number Diff line number Diff line
@@ -2916,7 +2916,16 @@ public class UserManagerService extends IUserManager.Stub {
     * switchable.
     */
    public @UserManager.UserSwitchabilityResult int getUserSwitchability(int userId) {
        checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId, "getUserSwitchability");
        if (Flags.getUserSwitchabilityPermission()) {
            if (!hasManageUsersOrPermission(android.Manifest.permission.INTERACT_ACROSS_USERS)) {
                throw new SecurityException(
                        "You need MANAGE_USERS or INTERACT_ACROSS_USERS permission to "
                                + "getUserSwitchability");
            }
        } else {
            checkManageOrInteractPermissionIfCallerInOtherProfileGroup(userId,
                    "getUserSwitchability");
        }

        final TimingsTraceAndSlog t = new TimingsTraceAndSlog();
        t.traceBegin("getUserSwitchability-" + userId);