diff options
| author | 2018-08-09 12:59:50 -0700 | |
|---|---|---|
| committer | 2018-08-23 23:34:15 +0000 | |
| commit | 2baf8d6855dc38c8dd41eea8ba6208ee2d52ae04 (patch) | |
| tree | 0d9f9672afb27ba7085c56f7b617159fd50199d4 | |
| parent | b64490ed860656577d6d6130ef1dcca1e48ca80a (diff) | |
User switcher in now checks for whether the user can switch to other
users.
If a user is not allowed to switch to other users, they will only see themselves
in the switcher.
Change-Id: I0f92696e8500298bfce023ff67953d110c86edf1
Fixes:110900364
Fixes:110697332
Test: Manual in mojave in both users with and without switch restriction
(cherry picked from commit 9973fffba735fcaa4e3703b8d8fd5be4e33f6284)
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/car/UserGridRecyclerView.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/car/UserGridRecyclerView.java b/packages/SystemUI/src/com/android/systemui/statusbar/car/UserGridRecyclerView.java index da6401c2d62a..67e512cf23f9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/car/UserGridRecyclerView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/car/UserGridRecyclerView.java @@ -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 */ |