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
diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
index 3a478c2..cc340ce 100644
--- a/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
+++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarManager.java
@@ -178,6 +178,12 @@
*/
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 @@
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 @@
displayId);
if (taskbarActivityContext != null
&& !taskbarActivityContext.isInOverview()) {
+ mShouldIgnoreNextDesktopModeChangeFromDisplayController = true;
AnimatorSet animatorSet = taskbarActivityContext.onDestroyAnimation(
TASKBAR_DESTROY_DURATION);
animatorSet.addListener(AnimatorListeners.forEndCallback(
@@ -308,11 +317,15 @@
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();
+ }
}
}