[go: nahoru, domu]

login: do not propagate OnFocusPod mid login

After User A types a password and starts login, there is
enough time for the user to click on login pod for User B.
This requests WallpaperController to show the wallpaper for
User B, and ColorPaletteController to show colors for User B.
While in SessionState::LOGGED_IN_NOT_ACTIVE, do not propagate
OnFocusPod so that wallpaper and colors are not changed to the
settings for a different user.

Bug: b:308840749
Test: login as A, click as quickly as possible on B
Change-Id: I4acb61db0e159fa4c40496da04305fd0a645fbb7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5008922
Reviewed-by: Denis Kuznetsov <antrim@chromium.org>
Commit-Queue: Jeffrey Young <cowmoo@google.com>
Cr-Commit-Position: refs/heads/main@{#1221167}
diff --git a/ash/login/login_screen_controller.cc b/ash/login/login_screen_controller.cc
index 24aa91b..73257425 100644
--- a/ash/login/login_screen_controller.cc
+++ b/ash/login/login_screen_controller.cc
@@ -195,6 +195,12 @@
 }
 
 void LoginScreenController::OnFocusPod(const AccountId& account_id) {
+  session_manager::SessionState session_state =
+      Shell::Get()->session_controller()->GetSessionState();
+  if (session_state == session_manager::SessionState::LOGGED_IN_NOT_ACTIVE) {
+    // b/308840749 do not propagate OnFocusPod while a user is mid login.
+    return;
+  }
   GetModel()->NotifyFocusPod(account_id);
   if (!client_) {
     return;