Separates current process user and foreground user
User switcher wrongly called methods on the current process user,
which is always User 0 for SysUI.
Instead, user switcher requires knowledge about foreground user.
The process of user switching = changing the foreground
user.
Split tests between unit and robolectric.
Robolectric tests enable shadowing ActivityManager and UserHandle.
Fixes:77485524
Test: Unit and robolectric tests.
Change-Id: I20cc32f132ce48b4507a6907bdc9d103c04f4a30
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 e09a360..9c9d3ee 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/car/UserGridRecyclerView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/car/UserGridRecyclerView.java
@@ -109,12 +109,12 @@
}
// Add guest user record if the current user is not a guest
- if (!mUserManagerHelper.isGuestUser()) {
+ if (!mUserManagerHelper.foregroundUserIsGuestUser()) {
userRecords.add(addGuestUserRecord());
}
// Add add user record if the current user can add users
- if (mUserManagerHelper.canAddUsers()) {
+ if (mUserManagerHelper.foregroundUserCanAddUsers()) {
userRecords.add(addUserRecord());
}