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

Commit ed11cf45 authored by Mady Mellor's avatar Mady Mellor
Browse files

Fix some issues where bubble bar wouldn't be on right side

When you switch between sides, the bar is animated between
those sides, but the location is not set. If we animated
it to the left, but still remain on the right at the end
of the drag, the location update is skipped because the
state of the location is still the same -- but visually it
isn't due to the animation.

The fix for this is to animate it back to the initial state
on release.

Another issue that existed was the dropTargetManager didn't
have onDragEnded called when the view was in the dismiss
target, which could result in incorrect state.

Flag: com.android.wm.shell.enable_bubble_to_fullscreen
Test: manual - have multiple bubbles
             - expand one, drag from the expanded view to
               opposite side, don't release, then drag to
               fullscreen
             - expand bubbles => observe they're on expected side
Bug: 403064102
Change-Id: I005d33bd9a37e9e8435b3701ec48f8735025d171
parent 620d3940
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -203,7 +203,11 @@ class BubbleBarExpandedViewDragController(
            draggedObject: MagnetizedObject<*>,
        ) {
            dragListener.onReleased(inDismiss = true)
            if (dropTargetManager != null) {
                dropTargetManager.onDragEnded()
            } else {
                pinController.onDragEnd()
            }
            dismissView.hide()
        }
    }
+11 −3
Original line number Diff line number Diff line
@@ -147,15 +147,23 @@ public class BubbleBarLayerView extends FrameLayout
                                Log.w(TAG, "dropped invalid bubble: " + mExpandedBubble);
                                return;
                            }

                            final boolean isBubbleLeft = zone instanceof DragZone.Bubble.Left;
                            final boolean isBubbleRight = zone instanceof DragZone.Bubble.Right;
                            if (!isBubbleLeft && !isBubbleRight) {
                                // If we didn't finish the "change" animation make sure to animate
                                // it back to the right spot
                                locationChangeListener.onChange(mInitialLocation);
                            }
                            if (zone instanceof DragZone.FullScreen) {
                                ((Bubble) mExpandedBubble).getTaskView().moveToFullscreen();
                                // Make sure location change listener is updated with the initial
                                // location -- even if we "switched sides" during the drag, since
                                // we've ended up in fullscreen, the location shouldn't change.
                                locationChangeListener.onRelease(mInitialLocation);
                            } else if (zone instanceof DragZone.Bubble.Left) {
                            } else if (isBubbleLeft) {
                                locationChangeListener.onRelease(BubbleBarLocation.LEFT);
                            } else if (zone instanceof DragZone.Bubble.Right) {
                            } else if (isBubbleRight) {
                                locationChangeListener.onRelease(BubbleBarLocation.RIGHT);
                            }
                        }
@@ -189,7 +197,7 @@ public class BubbleBarLayerView extends FrameLayout
                        @NonNull
                        @Override
                        public SplitScreenMode getSplitScreenMode() {
                            return SplitScreenMode.NONE;
                            return SplitScreenMode.UNSUPPORTED;
                        }
                    },
                    new DragZoneFactory.DesktopWindowModeChecker() {