diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java index f3cbdb5a2a..e8f7a00637 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java @@ -559,8 +559,7 @@ public class TaskbarManager implements DisplayDecorationListener { */ 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(); } @@ -580,7 +579,7 @@ public class TaskbarManager implements DisplayDecorationListener { * 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). @@ -1682,6 +1681,10 @@ public class TaskbarManager implements DisplayDecorationListener { return mPrimaryDisplayId; } + 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.