From bf0727b60dafbae363708a9c83d238afbb3bfe25 Mon Sep 17 00:00:00 2001 From: Jagrut Desai Date: Wed, 5 Mar 2025 10:39:08 -0800 Subject: [PATCH] Fix Taskbar not present in Desktop Mode after unlocking The problem: with taskbar animation for Desktop mode we were checking, if we are already in DW then don't recreate taskbar. This was put in as condition so where DisplayController Info change we don't recreate twice. first being from transilition listerners and second being form info change in display controller. The solution: Ignore the info change listener when there is already ongoing recreation is in progress. Test: Presubmit Bug: 399826787 Flag: EXEMPT bugfix Change-Id: Ib86e79b3b4c86e515e44d1d1dd7ca98ed694c365 --- .../launcher3/taskbar/TaskbarManager.java | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java index 3a478c2426..cc340ce7fe 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java @@ -178,6 +178,12 @@ public class TaskbarManager { */ private final RecreationListener mRecreationListener = new RecreationListener(); + // Currently, there is a duplicative call to recreate taskbars when user enter/exit Desktop + // Mode upon getting transition callback from shell side. So, we make sure that if taskbar is + // already in recreate process due to transition callback, don't recreate for + // DisplayInfoChangeListener. + private boolean mShouldIgnoreNextDesktopModeChangeFromDisplayController = false; + private class RecreationListener implements DisplayController.DisplayInfoChangeListener { @Override public void onDisplayInfoChanged(Context context, DisplayController.Info info, int flags) { @@ -206,10 +212,12 @@ public class TaskbarManager { if ((flags & CHANGE_SHOW_LOCKED_TASKBAR) != 0) { recreateTaskbars(); } else if ((flags & CHANGE_DESKTOP_MODE) != 0) { + if (mShouldIgnoreNextDesktopModeChangeFromDisplayController) { + mShouldIgnoreNextDesktopModeChangeFromDisplayController = false; + return; + } // Only Handles Special Exit Cases for Desktop Mode Taskbar Recreation. if (taskbarActivityContext != null - && !DesktopVisibilityController.INSTANCE.get(taskbarActivityContext) - .isInDesktopMode() && !DisplayController.showLockedTaskbarOnHome(context)) { recreateTaskbars(); } @@ -292,6 +300,7 @@ public class TaskbarManager { displayId); if (taskbarActivityContext != null && !taskbarActivityContext.isInOverview()) { + mShouldIgnoreNextDesktopModeChangeFromDisplayController = true; AnimatorSet animatorSet = taskbarActivityContext.onDestroyAnimation( TASKBAR_DESTROY_DURATION); animatorSet.addListener(AnimatorListeners.forEndCallback( @@ -308,11 +317,15 @@ public class TaskbarManager { int displayId = mTaskbars.keyAt(taskbarIndex); TaskbarActivityContext taskbarActivityContext = getTaskbarForDisplay( displayId); - AnimatorSet animatorSet = taskbarActivityContext.onDestroyAnimation( - TASKBAR_DESTROY_DURATION); - animatorSet.addListener(AnimatorListeners.forEndCallback( - () -> recreateTaskbarForDisplay(getDefaultDisplayId(), duration))); - animatorSet.start(); + if (taskbarActivityContext != null) { + mShouldIgnoreNextDesktopModeChangeFromDisplayController = true; + AnimatorSet animatorSet = taskbarActivityContext.onDestroyAnimation( + TASKBAR_DESTROY_DURATION); + animatorSet.addListener(AnimatorListeners.forEndCallback( + () -> recreateTaskbarForDisplay(getDefaultDisplayId(), + duration))); + animatorSet.start(); + } } }