From 8fc585ff6bc6ed826a8873bb1b2870f0cbb57226 Mon Sep 17 00:00:00 2001 From: Brian Isganitis Date: Wed, 19 Mar 2025 15:01:55 -0400 Subject: [PATCH] Perform system actions on focused display. Flag: EXEMPT bugfix Fix: 401575811 Test: go/testedequals Change-Id: I29743c98499d04f080f2628b7db7f123ec396585 --- .../com/android/launcher3/taskbar/TaskbarManager.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java index 1521715ce0..bfe05df547 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java @@ -554,8 +554,7 @@ public class TaskbarManager { */ private void showTaskbarFromBroadcast(Intent intent) { debugPrimaryTaskbar("destroyTaskbarForDisplay"); - // TODO: make this code displayId specific - TaskbarActivityContext taskbar = getTaskbarForDisplay(getDefaultDisplayId()); + TaskbarActivityContext taskbar = getTaskbarForDisplay(getFocusedDisplayId()); if (ACTION_SHOW_TASKBAR.equals(intent.getAction()) && taskbar != null) { taskbar.showTaskbarFromBroadcast(); } @@ -575,7 +574,7 @@ public class TaskbarManager { * Toggles All Apps for Taskbar or Launcher depending on the current state. */ public void toggleAllAppsSearch() { - TaskbarActivityContext taskbar = getTaskbarForDisplay(getDefaultDisplayId()); + TaskbarActivityContext taskbar = getTaskbarForDisplay(getFocusedDisplayId()); if (taskbar == null) { // Home All Apps should be toggled from this class, because the controllers are not // initialized when Taskbar is disabled (i.e. TaskbarActivityContext is null). @@ -1670,6 +1669,10 @@ public class TaskbarManager { return mBaseContext.getDisplayId(); } + private int getFocusedDisplayId() { + return SystemUiProxy.INSTANCE.get(mBaseContext).getFocusState().getFocusedDisplayId(); + } + /** * Logs debug information about the TaskbarManager for primary display. * @param debugReason A string describing the reason for the debug log.