diff --git a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/UserGridRecyclerView.java b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/UserGridRecyclerView.java index 30144524fd42c..3b482599b2a00 100644 --- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/UserGridRecyclerView.java +++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/UserGridRecyclerView.java @@ -18,6 +18,7 @@ package com.android.systemui.statusbar.car; import static android.content.DialogInterface.BUTTON_NEGATIVE; import static android.content.DialogInterface.BUTTON_POSITIVE; +import static android.os.UserManager.DISALLOW_ADD_USER; import android.app.ActivityManager; import android.app.AlertDialog; @@ -145,7 +146,8 @@ public class UserGridRecyclerView extends RecyclerView { userRecords.add(createStartGuestUserRecord()); // Add add user record if the foreground user can add users - if (mCarUserManagerHelper.canForegroundUserAddUsers()) { + UserHandle fgUserHandle = UserHandle.of(ActivityManager.getCurrentUser()); + if (!mUserManager.hasUserRestriction(DISALLOW_ADD_USER, fgUserHandle)) { userRecords.add(createAddUserRecord()); } @@ -285,7 +287,7 @@ public class UserGridRecyclerView extends RecyclerView { } private void handleAddUserClicked() { - if (mCarUserManagerHelper.isUserLimitReached()) { + if (!mUserManager.canAddMoreUsers()) { mAddUserView.setEnabled(true); showMaxUserLimitReachedDialog(); } else {