From 8dc98766beea54ab46711d9246a2ed098c74b645 Mon Sep 17 00:00:00 2001 From: Peter Kalauskas Date: Wed, 21 Jul 2021 11:55:51 -0700 Subject: [PATCH] Fix bug that caused task to show behind keyguard Move guest recreation into the user switch BroadcastReceiver to avoid lock contention that caused UI bugs in keyguard. Test: With config_guestUserAutoCreated=true, switch to guest, then select reset guest. Ensure that keyguard renders correctly for the owner. Fixes: 193933686 Change-Id: I95ed36dbd2c361312c044dec63a06f1711419131 --- .../statusbar/policy/UserSwitcherController.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java index 4e921a036b367..c94eaeda39069 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/UserSwitcherController.java @@ -539,6 +539,13 @@ public class UserSwitcherController implements Dumpable { mSecondaryUser = userInfo.id; } unpauseRefreshUsers = true; + if (mGuestUserAutoCreated) { + // Guest user must be scheduled for creation AFTER switching to the target user. + // This avoids lock contention which will produce UX bugs on the keyguard + // (b/193933686). + // TODO(b/191067027): Move guest user recreation to system_server + guaranteeGuestPresent(); + } } else if (Intent.ACTION_USER_INFO_CHANGED.equals(intent.getAction())) { forcePictureLoadForId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, UserHandle.USER_NULL); @@ -670,10 +677,6 @@ public class UserSwitcherController implements Dumpable { switchToUserId(newGuestId); mUserManager.removeUser(currentUser.id); } else { - if (mGuestUserAutoCreated) { - // TODO(b/191067027): Move guest recreation to system_server - scheduleGuestCreation(); - } switchToUserId(targetUserId); mUserManager.removeUser(currentUser.id); }