From d5e116a750795c6d39344cd02601c30c6a9bd8e7 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Tue, 14 Sep 2021 17:48:14 -0700 Subject: [PATCH] Don't set Taskbar window to non-fullscreen while folder animates closed Test: Open an app, open a folder in taskbar, and drag an app from the folder. Ensure the folder close animation plays completely. Fixes: 199954907 Change-Id: I1caec4ef24b5325724d74f10ddbeae6ef8f9e959 --- .../taskbar/TaskbarDragLayerController.java | 2 +- .../launcher3/AbstractFloatingView.java | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java index b7c5db2f17..3df75c2987 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragLayerController.java @@ -155,7 +155,7 @@ public class TaskbarDragLayerController { * Called when a child is removed from TaskbarDragLayer. */ public void onDragLayerViewRemoved() { - if (AbstractFloatingView.getOpenView(mActivity, TYPE_ALL) == null) { + if (AbstractFloatingView.getAnyView(mActivity, TYPE_ALL) == null) { mActivity.setTaskbarWindowFullscreen(false); } } diff --git a/src/com/android/launcher3/AbstractFloatingView.java b/src/com/android/launcher3/AbstractFloatingView.java index e080537293..e3cfb59b60 100644 --- a/src/com/android/launcher3/AbstractFloatingView.java +++ b/src/com/android/launcher3/AbstractFloatingView.java @@ -195,10 +195,24 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch } /** - * Returns a view matching FloatingViewType + * Returns a view matching FloatingViewType and {@link #isOpen()} == true. */ public static T getOpenView( ActivityContext activity, @FloatingViewType int type) { + return getView(activity, type, true /* mustBeOpen */); + } + + /** + * Returns a view matching FloatingViewType, and {@link #isOpen()} may be false (if animating + * closed). + */ + public static T getAnyView( + ActivityContext activity, @FloatingViewType int type) { + return getView(activity, type, false /* mustBeOpen */); + } + + private static T getView( + ActivityContext activity, @FloatingViewType int type, boolean mustBeOpen) { BaseDragLayer dragLayer = activity.getDragLayer(); if (dragLayer == null) return null; // Iterate in reverse order. AbstractFloatingView is added later to the dragLayer, @@ -207,7 +221,7 @@ public abstract class AbstractFloatingView extends LinearLayout implements Touch View child = dragLayer.getChildAt(i); if (child instanceof AbstractFloatingView) { AbstractFloatingView view = (AbstractFloatingView) child; - if (view.isOfType(type) && view.isOpen()) { + if (view.isOfType(type) && (!mustBeOpen || view.isOpen())) { return (T) view; } }