Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d2f64548 authored by Ats Jenk's avatar Ats Jenk
Browse files

Send new bubble bar location with the drag end notification

Update Bubbles API that signals shell when dragging a bubble is done.
Include the new bubble bar location in the signal to only have one call
to shell when drag is done.

Bug: 330585402
Flag: ACONFIG com.android.wm.shell.enable_bubble_bar DEVELOPMENT
Test: drag bubble in launcher from right to left and release
Change-Id: I7cb3fa9f483965ee80f65a4a89e9e7cf8521b01d
parent 5ae0d284
Loading
Loading
Loading
Loading
+28 −6
Original line number Diff line number Diff line
@@ -1157,12 +1157,29 @@ public class BubbleController implements ConfigurationChangeListener,
    }

    /**
     * Update expanded state when a single bubble is dragged in Launcher.
     * A bubble is being dragged in Launcher.
     * Will be called only when bubble bar is expanded.
     * @param bubbleKey key of the bubble to collapse/expand
     * @param isBeingDragged whether the bubble is being dragged
     *
     * @param bubbleKey key of the bubble being dragged
     */
    public void startBubbleDrag(String bubbleKey) {
        onBubbleDrag(bubbleKey, true /* isBeingDragged */);
    }

    /**
     * A bubble is no longer being dragged in Launcher. As was released in given location.
     * Will be called only when bubble bar is expanded.
     *
     * @param bubbleKey key of the bubble being dragged
     * @param location  location where bubble was released
     */
    public void onBubbleDrag(String bubbleKey, boolean isBeingDragged) {
    public void stopBubbleDrag(String bubbleKey, BubbleBarLocation location) {
        mBubblePositioner.setBubbleBarLocation(location);
        onBubbleDrag(bubbleKey, false /* isBeingDragged */);
    }

    private void onBubbleDrag(String bubbleKey, boolean isBeingDragged) {
        // TODO(b/330585402): collapse stack if any bubble is dragged
        if (mBubbleData.getSelectedBubble() != null
                && mBubbleData.getSelectedBubble().getKey().equals(bubbleKey)) {
            // Should collapse/expand only if equals to selected bubble.
@@ -2324,8 +2341,13 @@ public class BubbleController implements ConfigurationChangeListener,
        }

        @Override
        public void onBubbleDrag(String bubbleKey, boolean isBeingDragged) {
            mMainExecutor.execute(() -> mController.onBubbleDrag(bubbleKey, isBeingDragged));
        public void startBubbleDrag(String bubbleKey) {
            mMainExecutor.execute(() -> mController.startBubbleDrag(bubbleKey));
        }

        @Override
        public void stopBubbleDrag(String bubbleKey, BubbleBarLocation location) {
            mMainExecutor.execute(() -> mController.stopBubbleDrag(bubbleKey, location));
        }

        @Override
+3 −1
Original line number Diff line number Diff line
@@ -39,11 +39,13 @@ interface IBubbles {

    oneway void collapseBubbles() = 6;

    oneway void onBubbleDrag(in String key, in boolean isBeingDragged) = 7;
    oneway void startBubbleDrag(in String key) = 7;

    oneway void showUserEducation(in int positionX, in int positionY) = 8;

    oneway void setBubbleBarLocation(in BubbleBarLocation location) = 9;

    oneway void setBubbleBarBounds(in Rect bubbleBarBounds) = 10;

    oneway void stopBubbleDrag(in String key, in BubbleBarLocation location) = 11;
}
 No newline at end of file