From 50eb8e78f15e548e1d42c9aa3e706a214146a089 Mon Sep 17 00:00:00 2001 From: Ats Jenk Date: Tue, 14 May 2024 13:32:35 -0700 Subject: [PATCH] Rename removeBubble method to clarify it is for dismissing via drag The removeBubble method was only used for dismissing a bubble via drag in Launcher. Renaming the method to indicate it is only for this purpose. This allows us to reduce remote calls from launcher to shell when a bubble is dismissed via drag. Otherwise we would need to make two calls, one for removing a bubble and other for stopping the drag. As shell keeps track of drag status in launcher for hiding the expanded view. Also removing the bubble key from remote call to shell to signal drag has finished. The bubble key was not used. Bug: 330585402 Flag: ACONFIG com.android.wm.shell.enable_bubble_bar DEVELOPMENT Test: drag a bubble that is not expanded to dismiss target, previously expanded bubble should expand again Change-Id: I57484aa3a2c0585ff7c3974d9f0d19dc1ab9dbd2 --- .../bubbles/BubbleBarViewController.java | 8 ++--- .../taskbar/bubbles/BubbleDragController.java | 2 +- .../com/android/quickstep/SystemUiProxy.java | 31 +++++++++---------- 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java index fbdb2ed4e3..c6607e4c46 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java @@ -506,12 +506,10 @@ public class BubbleBarViewController { /** * Notifies SystemUI to expand the selected bubble when the bubble is released. - * @param bubbleView dragged bubble view */ - public void onDragRelease(@NonNull BubbleView bubbleView, BubbleBarLocation location) { - if (bubbleView.getBubble() == null) return; + public void onDragRelease(BubbleBarLocation location) { // TODO(b/330585402): send new bubble bar bounds to shell for the animation - mSystemUiProxy.stopBubbleDrag(bubbleView.getBubble().getKey(), location); + mSystemUiProxy.stopBubbleDrag(location); } /** @@ -556,7 +554,7 @@ public class BubbleBarViewController { * @param bubble dismissed bubble item */ public void onDismissBubbleWhileDragging(@NonNull BubbleBarItem bubble) { - mSystemUiProxy.removeBubble(bubble.getKey()); + mSystemUiProxy.dragBubbleToDismiss(bubble.getKey()); } /** diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDragController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDragController.java index f4b393add3..604ae89284 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDragController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleDragController.java @@ -113,7 +113,7 @@ public class BubbleDragController { @Override protected void onDragRelease() { mBubblePinController.onDragEnd(); - mBubbleBarViewController.onDragRelease(bubbleView, mReleasedLocation); + mBubbleBarViewController.onDragRelease(mReleasedLocation); } @Override diff --git a/quickstep/src/com/android/quickstep/SystemUiProxy.java b/quickstep/src/com/android/quickstep/SystemUiProxy.java index 4d3fe41f5d..377120fd74 100644 --- a/quickstep/src/com/android/quickstep/SystemUiProxy.java +++ b/quickstep/src/com/android/quickstep/SystemUiProxy.java @@ -759,19 +759,6 @@ public class SystemUiProxy implements ISystemUiProxy, NavHandle, SafeCloseable { } } - /** - * Tells SysUI to remove the bubble with the provided key. - * @param key the key of the bubble to show. - */ - public void removeBubble(String key) { - if (mBubbles == null) return; - try { - mBubbles.removeBubble(key); - } catch (RemoteException e) { - Log.w(TAG, "Failed call removeBubble"); - } - } - /** * Tells SysUI to remove all bubbles. */ @@ -814,18 +801,30 @@ public class SystemUiProxy implements ISystemUiProxy, NavHandle, SafeCloseable { /** * Tells SysUI when the bubble stops being dragged. * Should be called only when the bubble bar is expanded. - * @param bubbleKey key of the bubble being dragged * @param location location of the bubble bar */ - public void stopBubbleDrag(@Nullable String bubbleKey, BubbleBarLocation location) { + public void stopBubbleDrag(BubbleBarLocation location) { if (mBubbles == null) return; try { - mBubbles.stopBubbleDrag(bubbleKey, location); + mBubbles.stopBubbleDrag(location); } catch (RemoteException e) { Log.w(TAG, "Failed call stopBubbleDrag"); } } + /** + * Tells SysUI to dismiss the bubble with the provided key. + * @param key the key of the bubble to dismiss. + */ + public void dragBubbleToDismiss(String key) { + if (mBubbles == null) return; + try { + mBubbles.dragBubbleToDismiss(key); + } catch (RemoteException e) { + Log.w(TAG, "Failed call dragBubbleToDismiss"); + } + } + /** * Tells SysUI to show user education relative to the reference point provided. * @param position the bubble bar top center position in Screen coordinates.