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

Commit c84e940c authored by Jovana Knezevic's avatar Jovana Knezevic Committed by Android (Google) Code Review
Browse files

Merge "User switcher in now checks for whether the user can switch to other users."

parents 6af8d347 2baf8d68
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -98,6 +98,13 @@ public class UserGridRecyclerView extends PagedListView implements

    private List<UserRecord> createUserRecords(List<UserInfo> userInfoList) {
        List<UserRecord> userRecords = new ArrayList<>();

        // If the foreground user CANNOT switch to other users, only display the foreground user.
        if (!mCarUserManagerHelper.canForegroundUserSwitchUsers()) {
            userRecords.add(createForegroundUserRecord());
            return userRecords;
        }

        for (UserInfo userInfo : userInfoList) {
            if (userInfo.isGuest()) {
                // Don't display guests in the switcher.
@@ -122,6 +129,11 @@ public class UserGridRecyclerView extends PagedListView implements
        return userRecords;
    }

    private UserRecord createForegroundUserRecord() {
        return new UserRecord(mCarUserManagerHelper.getCurrentForegroundUserInfo(),
                false /* isStartGuestSession */, false /* isAddUser */, true /* isForeground */);
    }

    /**
     * Create guest user record
     */