diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java index f9b9fa4f36..9ed7a3ff52 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarActivityContext.java @@ -1287,7 +1287,10 @@ public class TaskbarActivityContext extends BaseTaskbarContext { && !AbstractFloatingView.hasOpenView( this, TYPE_ALL & ~TYPE_TASKBAR_OVERLAY_PROXY)) { // Reverts Taskbar window to its original size - setTaskbarWindowFullscreen(false); + Runnable resetTaskbarFullscreen = () -> setTaskbarWindowFullscreen(false); + mControllers.bubbleControllers.ifPresentOrElse( + bc -> bc.dragToBubbleController.runAfterDropTargetsHidden( + resetTaskbarFullscreen), resetTaskbarFullscreen); } setAutohideSuspendFlag(FLAG_AUTOHIDE_SUSPEND_DRAGGING, isDragInProgress); diff --git a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java index 5a58a84565..ae70876b18 100644 --- a/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java +++ b/quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java @@ -132,13 +132,13 @@ public class TaskbarDragController extends DragController im public void init(TaskbarControllers controllers) { mControllers = controllers; mControllers.bubbleControllers.ifPresent( - c -> c.bubbleBarViewController.addBubbleBarDropTargets(this)); + c -> c.dragToBubbleController.addBubbleBarDropTargets(this)); } /** Called when the controller is destroyed. */ public void onDestroy() { mControllers.bubbleControllers.ifPresent( - c -> c.bubbleBarViewController.removeBubbleBarDropTargets(this)); + c -> c.dragToBubbleController.removeBubbleBarDropTargets(this)); } public void setDisallowGlobalDrag(boolean disallowGlobalDrag) { diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/DragToBubbleController.kt b/quickstep/src/com/android/launcher3/taskbar/bubbles/DragToBubbleController.kt index 01f58fe728..d6acb89c0b 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/DragToBubbleController.kt +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/DragToBubbleController.kt @@ -46,7 +46,9 @@ class DragToBubbleController( * are no drop target views currently present or being animated, the action will be executed * immediately. */ - fun runAfterDropTargetsHidden(resetTaskbarFullscreen: Runnable) {} + fun runAfterDropTargetsHidden(afterHiddenAction: Runnable) { + afterHiddenAction.run() + } override fun onDragStart(dragObject: DragObject, options: DragOptions) {} diff --git a/src/com/android/launcher3/DropTarget.java b/src/com/android/launcher3/DropTarget.java index 3b22d5caaf..e9e600728e 100644 --- a/src/com/android/launcher3/DropTarget.java +++ b/src/com/android/launcher3/DropTarget.java @@ -20,6 +20,8 @@ import android.content.Context; import android.graphics.Rect; import android.view.View; +import androidx.annotation.Nullable; + import com.android.launcher3.accessibility.DragViewStateAnnouncer; import com.android.launcher3.dagger.LauncherComponentProvider; import com.android.launcher3.dragndrop.DragOptions; @@ -147,8 +149,18 @@ public interface DropTarget { // These methods are implemented in Views void getHitRectRelativeToDragLayer(Rect outRect); - /** Returns the drop target view. By default, the implementor class is cast to the view. */ - default View getDropView() { + /** + * Returns the drop target view.
+ * + * By default, the implementor class is cast to the view.
+ * + * The returned {@link View} will be use to map touch coordinates to the view self descendant + * and set as [{@link DragObject#x DragObject.x} {@link DragObject#y DragObject.y}].
+ * + * If this method returns {@code null}, the raw touch event coordinates will be directly + * assigned to [{@link DragObject#x DragObject.x} and {@link DragObject#y DragObject.y}]. + */ + default @Nullable View getDropView() { return (View) this; } } diff --git a/src/com/android/launcher3/dragndrop/DragController.java b/src/com/android/launcher3/dragndrop/DragController.java index 415a2c6230..fa3048a997 100644 --- a/src/com/android/launcher3/dragndrop/DragController.java +++ b/src/com/android/launcher3/dragndrop/DragController.java @@ -553,7 +553,6 @@ public abstract class DragController private DropTarget findDropTarget(final int x, final int y) { mCoordinatesTemp[0] = x; mCoordinatesTemp[1] = y; - final Rect r = mRectTemp; final ArrayList dropTargets = mDropTargets; final int count = dropTargets.size(); @@ -564,8 +563,11 @@ public abstract class DragController target.getHitRectRelativeToDragLayer(r); if (r.contains(x, y)) { - mActivity.getDragLayer().mapCoordInSelfToDescendant(target.getDropView(), - mCoordinatesTemp); + View dropTargetView = target.getDropView(); + if (dropTargetView != null) { + mActivity.getDragLayer().mapCoordInSelfToDescendant(dropTargetView, + mCoordinatesTemp); + } mDragObject.x = mCoordinatesTemp[0]; mDragObject.y = mCoordinatesTemp[1]; return target;