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 fb1870a6ea42e..7500bcd9b8f75 100644 --- a/packages/CarSystemUI/src/com/android/systemui/statusbar/car/UserGridRecyclerView.java +++ b/packages/CarSystemUI/src/com/android/systemui/statusbar/car/UserGridRecyclerView.java @@ -296,14 +296,42 @@ public class UserGridRecyclerView extends RecyclerView { } } + /** + * Get the maximum number of real (non-guest, non-managed profile) users that can be created + * on the device. This is a dynamic value and it decreases with the increase of the number + * of managed profiles on the device. + * + *
It excludes system user in headless system user model.
+ *
+ * @return Maximum number of real users that can be created.
+ */
+ private int getMaxSupportedRealUsers() {
+ int maxSupportedUsers = UserManager.getMaxSupportedUsers();
+ if (UserManager.isHeadlessSystemUserMode()) {
+ maxSupportedUsers -= 1;
+ }
+
+ List