From 18abe9e97ee73d8bcbb7b57a8649d2a722a4e8e6 Mon Sep 17 00:00:00 2001 From: Liran Binyamin Date: Mon, 10 Mar 2025 17:43:59 -0400 Subject: [PATCH] Pass a location when dragging bubble to fullscreen When a bubble is dragged to full screen, pass the x and y coordinates of where the bubble was released to wm shell. The coordinates are used as a starting point for expanding the full screen task. Flag: com.android.wm.shell.enable_bubble_to_fullscreen Bug: 388858013 Test: treehugger Change-Id: I28bb10bdfb00786e43b350239cfdeb3df20b4a6f --- .../taskbar/bubbles/BubbleBarViewController.java | 4 ++-- .../taskbar/bubbles/BubbleDragController.java | 12 +++++++----- quickstep/src/com/android/quickstep/SystemUiProxy.kt | 8 ++++---- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java index 277dbbf677..9144fbb10f 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java @@ -1364,12 +1364,12 @@ public class BubbleBarViewController { * Removes the bubble from the bubble bar and notifies sysui that the bubble should move to * full screen. */ - public void moveBubbleToFullscreen(@NonNull BubbleView bubbleView) { + public void moveDraggedBubbleToFullscreen(@NonNull BubbleView bubbleView, Point dropLocation) { if (bubbleView.getBubble() == null) { return; } String key = bubbleView.getBubble().getKey(); - mSystemUiProxy.moveBubbleToFullscreen(key); + mSystemUiProxy.moveDraggedBubbleToFullscreen(key, dropLocation); onBubbleDismissed(bubbleView); } diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDragController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDragController.java index f77b934373..3df10c0ce0 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDragController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDragController.java @@ -16,6 +16,7 @@ package com.android.launcher3.taskbar.bubbles; import android.annotation.SuppressLint; +import android.graphics.Point; import android.graphics.PointF; import android.view.MotionEvent; import android.view.VelocityTracker; @@ -231,13 +232,14 @@ public class BubbleDragController { } @Override - void onDragEnd() { + void onDragEnd(float x, float y) { mBubbleBarController.updateBubbleBarLocation(getBubbleBarLocationDuringDrag(), BubbleBarLocation.UpdateSource.DRAG_BUBBLE); if (BubbleAnythingFlagHelper.enableBubbleToFullscreen()) { mDropTargetManager.onDragEnded(); if (mBubbleDragZoneChangedListener.isDraggedToFullscreen()) { - mBubbleBarViewController.moveBubbleToFullscreen(bubbleView); + mBubbleBarViewController.moveDraggedBubbleToFullscreen( + bubbleView, new Point((int) x, (int) y)); } } else { mBubblePinController.setListener(null); @@ -329,7 +331,7 @@ public class BubbleDragController { } @Override - void onDragEnd() { + void onDragEnd(float x, float y) { // Make sure to update location as the first thing. Pivot update causes a relayout mBubbleBarController.updateBubbleBarLocation(getBubbleBarLocationDuringDrag(), BubbleBarLocation.UpdateSource.DRAG_BAR); @@ -428,7 +430,7 @@ public class BubbleDragController { /** * Called when the dragging interaction has ended and all the animations have completed */ - abstract void onDragEnd(); + abstract void onDragEnd(float x, float y); /** * Called when the dragged bubble is released outside of the dismiss target area and will @@ -579,7 +581,7 @@ public class BubbleDragController { Runnable onComplete = () -> { mActivity.setTaskbarWindowFullscreen(false); cleanUp(view); - onDragEnd(); + onDragEnd(event.getRawX(), event.getRawY()); }; if (mBubbleDismissController.handleTouchEvent(event)) { diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.kt b/quickstep/src/com/android/quickstep/SystemUiProxy.kt index d6f654004b..f6a09adfd1 100644 --- a/quickstep/src/com/android/quickstep/SystemUiProxy.kt +++ b/quickstep/src/com/android/quickstep/SystemUiProxy.kt @@ -690,10 +690,10 @@ class SystemUiProxy @Inject constructor(@ApplicationContext private val context: bubbles?.showDropTarget(show, bubbleBarLocation) } - /** Tells SysUI to move the bubble to full screen. */ - fun moveBubbleToFullscreen(key: String) { - executeWithErrorLog({ "Failed to call moveBubbleToFullscreen"}) { - bubbles?.moveBubbleToFullscreen(key) + /** Tells SysUI to move the dragged bubble to full screen. */ + fun moveDraggedBubbleToFullscreen(key: String, dropLocation: Point) { + executeWithErrorLog({ "Failed to call moveDraggedBubbleToFullscreen"}) { + bubbles?.moveDraggedBubbleToFullscreen(key, dropLocation) } }