Mark TaskbarOverlayProxyView closed sooner
Marks TaskbarOverlayProxyView closed earlier in handleClose, before
removing it as a view from the drag layer. BaseDragLayer expects that a
floating view is closed by the time it gets removed, and asynchronously
issues another close call if this is not the case as a workaround.
Marking the proxy view closed sooner also reduces chances of reentrant
close call while handling current close.
Bug: 368119679
Test: Opening/closing all apps, folders, KQS
Flag: com.android.launcher3.taskbar_overflow
Change-Id: I33ccb82ebd7e967f2e47f38db3e41527dad9d573
diff --git a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayController.java b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayController.java
index 7eb34a5..79cb748 100644
--- a/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayController.java
+++ b/quickstep/src/com/android/launcher3/taskbar/overlay/TaskbarOverlayController.java
@@ -35,6 +35,7 @@
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.DeviceProfile;
+import com.android.launcher3.Flags;
import com.android.launcher3.taskbar.TaskbarActivityContext;
import com.android.launcher3.taskbar.TaskbarControllers;
import com.android.systemui.shared.system.TaskStackChangeListener;
@@ -216,6 +217,13 @@
@Override
protected void handleClose(boolean animate) {
if (!mIsOpen) return;
+ if (Flags.taskbarOverflow()) {
+ // Mark the view closed before attempting to remove it, so the drag layer does not
+ // schedule another call to close. Needed for taskbar overflow in case the KQS
+ // view shown for taskbar overflow needs to be reshown - delayed close call would
+ // would result in reshown KQS view getting hidden.
+ mIsOpen = false;
+ }
mTaskbarContext.getDragLayer().removeView(this);
Optional.ofNullable(mOverlayContext).ifPresent(c -> {
if (canCloseWindow()) {