From 9205db6d3660cc7a43293fd6c7a4abc2a1e81d02 Mon Sep 17 00:00:00 2001 From: Jagrut Desai Date: Mon, 14 Apr 2025 13:28:53 -0700 Subject: [PATCH] Fix Taskbar issue with Multi Desks Test: Manual, Presubmit Bug: 408236390 Bug: 408059650 Flag: EXEMPT bugfix Change-Id: Iadd79fb1504e2183fee52cc0871fc27613482e2a --- .../DesktopVisibilityController.kt | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.kt b/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.kt index 07e6cf700c..3a9a18aeb7 100644 --- a/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.kt +++ b/quickstep/src/com/android/launcher3/statehandlers/DesktopVisibilityController.kt @@ -583,9 +583,6 @@ constructor( return } - val wasInDeskAndNotInOverview = isInDesktopModeAndNotInOverview(displayId) - val wasInDesk = isInDesktopMode(displayId) - getDisplayDeskConfig(displayId)?.also { check(oldActiveDesk == it.activeDeskId) { "Mismatch between the Shell's oldActiveDesk: $oldActiveDesk, and Launcher's: ${it.activeDeskId}" @@ -600,18 +597,20 @@ constructor( notifyOnActiveDeskChanged(displayId, newActiveDesk, oldActiveDesk) } - if (wasInDeskAndNotInOverview != isInDesktopModeAndNotInOverview(displayId)) { - notifyIsInDesktopModeChanged(displayId, !wasInDeskAndNotInOverview) - } - - val isInDesk = isInDesktopMode(displayId) - if (wasInDesk != isInDesk) { + if ( + (newActiveDesk == INACTIVE_DESK_ID || oldActiveDesk == INACTIVE_DESK_ID) && + !launcherAnimationRunning + ) { val duration = context.resources.getInteger(R.integer.to_desktop_animation_duration_ms) - if (isInDesk) { + if (oldActiveDesk == INACTIVE_DESK_ID && newActiveDesk != INACTIVE_DESK_ID) { notifyTaskbarDesktopModeListenersForEntry(duration) - } else { + } else if (newActiveDesk == INACTIVE_DESK_ID && oldActiveDesk != INACTIVE_DESK_ID) { notifyTaskbarDesktopModeListenersForExit(duration) + } else { + // do nothing because user switch between two desktop. } + } else { + isNotifyingDesktopVisibilityPending = true } }