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

Commit 27ef6808 authored by Liran Binyamin's avatar Liran Binyamin
Browse files

Get bubble bar distance from launcher

Update Bubbles AIDL interface to pass the distance between the
bubble bar and the bottom of the screen rather than the top
coordinate of the bubble bar. When the screen height changes,
launcher has a short delay and calculates the bubble bar top based
on the previous screen height. This change moves the offsetting to
the shell side.

Bug: 392893178
Flag: com.android.wm.shell.enable_bubble_bar
Test: manual
       - send some bubbles
       - launch app
       - expand
       - swipe to home
       - fold and unfold

Change-Id: Ibf6d141ac72b354c275a4b58c4618db08460e788
parent 40cd6e7f
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -222,7 +222,7 @@ class BubblePositionerTest {

        positioner.setShowingInBubbleBar(true)
        positioner.update(deviceConfig)
        positioner.bubbleBarTopOnScreen = 2500
        positioner.updateBubbleBarTopOnScreen(100)

        val spaceBetweenTopInsetAndBubbleBarInLandscape = 1680
        val expandedViewVerticalSpacing =
@@ -248,7 +248,7 @@ class BubblePositionerTest {
            )
        positioner.setShowingInBubbleBar(true)
        positioner.update(deviceConfig)
        positioner.bubbleBarTopOnScreen = 2500
        positioner.updateBubbleBarTopOnScreen(100)

        val spaceBetweenTopInsetAndBubbleBarInLandscape = 180
        val expandedViewSpacing =
@@ -681,7 +681,7 @@ class BubblePositionerTest {
        positioner.update(deviceConfig)

        val bubbleBarHeight = 100
        positioner.bubbleBarTopOnScreen = windowBounds.bottom - insets.bottom - bubbleBarHeight
        positioner.updateBubbleBarTopOnScreen(bubbleBarHeight)

        val expandedViewPadding =
            context.resources.getDimensionPixelSize(R.dimen.bubble_expanded_view_padding)
+1 −2
Original line number Diff line number Diff line
@@ -89,8 +89,7 @@ class BubbleExpandedViewPinControllerTest {
                insets = Insets.of(10, 20, 30, 40),
            )
        positioner.update(deviceConfig)
        positioner.bubbleBarTopOnScreen =
            SCREEN_HEIGHT - deviceConfig.insets.bottom - BUBBLE_BAR_HEIGHT
        positioner.updateBubbleBarTopOnScreen(BUBBLE_BAR_HEIGHT)
        controller = BubbleExpandedViewPinController(context, container, positioner)
        testListener = TestLocationChangeListener()
        controller.setListener(testListener)
+24 −18
Original line number Diff line number Diff line
@@ -1444,11 +1444,12 @@ public class BubbleController implements ConfigurationChangeListener,
     * Will be called only when bubble bar is expanded.
     *
     * @param location location where bubble was released
     * @param topOnScreen      top coordinate of the bubble bar on the screen after release
     * @param bubbleBarTopToScreenBottom the distance between the top coordinate of the bubble
     *        bar and the bottom of the screen after release
     */
    public void stopBubbleDrag(BubbleBarLocation location, int topOnScreen) {
    public void stopBubbleDrag(BubbleBarLocation location, int bubbleBarTopToScreenBottom) {
        mBubblePositioner.setBubbleBarLocation(location);
        mBubblePositioner.setBubbleBarTopOnScreen(topOnScreen);
        mBubblePositioner.updateBubbleBarTopOnScreen(bubbleBarTopToScreenBottom);
        if (mBubbleData.getSelectedBubble() != null) {
            showExpandedViewForBubbleBar();
        }
@@ -1524,8 +1525,8 @@ public class BubbleController implements ConfigurationChangeListener,
     * <p>This is used by external callers (launcher).
     */
    @VisibleForTesting
    public void expandStackAndSelectBubbleFromLauncher(String key, int topOnScreen) {
        mBubblePositioner.setBubbleBarTopOnScreen(topOnScreen);
    public void expandStackAndSelectBubbleFromLauncher(String key, int bubbleBarTopToScreenBottom) {
        mBubblePositioner.updateBubbleBarTopOnScreen(bubbleBarTopToScreenBottom);

        if (BubbleOverflow.KEY.equals(key)) {
            mBubbleData.setSelectedBubbleFromLauncher(mBubbleData.getOverflow());
@@ -3001,14 +3002,16 @@ public class BubbleController implements ConfigurationChangeListener,
        }

        @Override
        public void showBubble(String key, int topOnScreen) {
            ProtoLog.d(WM_SHELL_BUBBLES_NOISY, "IBubbles.showBubble: key=%s top=%d",
                    key, topOnScreen);
        public void showBubble(String key, int bubbleBarTopToScreenBottom) {
            ProtoLog.d(WM_SHELL_BUBBLES_NOISY,
                    "IBubbles.showBubble: key=%s bubbleBarTopToScreenBottom=%d",
                    key, bubbleBarTopToScreenBottom);
            executeRemoteCallWithTaskPermission(
                    mController,
                    "showBubble",
                    (controller) ->
                            controller.expandStackAndSelectBubbleFromLauncher(key, topOnScreen));
                            controller.expandStackAndSelectBubbleFromLauncher(
                                key, bubbleBarTopToScreenBottom));
        }

        @Override
@@ -3051,13 +3054,15 @@ public class BubbleController implements ConfigurationChangeListener,
        }

        @Override
        public void stopBubbleDrag(BubbleBarLocation location, int topOnScreen) {
            ProtoLog.d(WM_SHELL_BUBBLES_NOISY, "IBubbles.stopBubbleDrag: log=%s top=%d",
                    location, topOnScreen);
        public void stopBubbleDrag(BubbleBarLocation location, int bubbleBarTopToScreenBottom) {
            ProtoLog.d(WM_SHELL_BUBBLES_NOISY,
                    "IBubbles.stopBubbleDrag: log=%s bubbleBarTopToScreenBottom=%d",
                    location, bubbleBarTopToScreenBottom);
            executeRemoteCallWithTaskPermission(
                    mController,
                    "stopBubbleDrag",
                    (controller) -> controller.stopBubbleDrag(location, topOnScreen));
                    (controller) ->
                        controller.stopBubbleDrag(location, bubbleBarTopToScreenBottom));
        }

        @Override
@@ -3092,14 +3097,15 @@ public class BubbleController implements ConfigurationChangeListener,
        }

        @Override
        public void updateBubbleBarTopOnScreen(int topOnScreen) {
            ProtoLog.d(WM_SHELL_BUBBLES_NOISY, "IBubbles.updateBubbleBarTopOnScreen: top=%d",
                    topOnScreen);
        public void updateBubbleBarTopToScreenBottom(int bubbleBarTopToScreenBottom) {
            ProtoLog.d(WM_SHELL_BUBBLES_NOISY,
                    "IBubbles.updateBubbleBarTopOnScreen: bubbleBarTopToScreenBottom=%d",
                    bubbleBarTopToScreenBottom);
            executeRemoteCallWithTaskPermission(
                    mController,
                    "updateBubbleBarTopOnScreen",
                    "updateBubbleBarTopToScreenBottom",
                    (controller) -> {
                        mBubblePositioner.setBubbleBarTopOnScreen(topOnScreen);
                        mBubblePositioner.updateBubbleBarTopOnScreen(bubbleBarTopToScreenBottom);
                        if (mLayerView != null) mLayerView.updateExpandedView();
                    });
        }
+3 −5
Original line number Diff line number Diff line
@@ -893,11 +893,9 @@ public class BubblePositioner implements BubbleDropTargetBoundsProvider {
        return mBubbleBarLocation.isOnLeft(mDeviceConfig.isRtl());
    }

    /**
     * Set top coordinate of bubble bar on screen
     */
    public void setBubbleBarTopOnScreen(int topOnScreen) {
        mBubbleBarTopOnScreen = topOnScreen;
    /** Updates the top coordinate of bubble bar on screen. */
    public void updateBubbleBarTopOnScreen(int bubbleBarTopToScreenBottom) {
        mBubbleBarTopOnScreen = getScreenRect().bottom - bubbleBarTopToScreenBottom;
    }

    /**
+3 −3
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ interface IBubbles {

    oneway void unregisterBubbleListener(in IBubblesListener listener) = 2;

    oneway void showBubble(in String key, in int topOnScreen) = 3;
    oneway void showBubble(in String key, in int bubbleBarTopToScreenBottom) = 3;

    oneway void dragBubbleToDismiss(in String key, in long timestamp) = 4;

@@ -48,9 +48,9 @@ interface IBubbles {

    oneway void setBubbleBarLocation(in BubbleBarLocation location, in int source) = 9;

    oneway void updateBubbleBarTopOnScreen(in int topOnScreen) = 10;
    oneway void updateBubbleBarTopToScreenBottom(in int bubbleBarTopToScreenBottom) = 10;

    oneway void stopBubbleDrag(in BubbleBarLocation location, in int topOnScreen) = 11;
    oneway void stopBubbleDrag(in BubbleBarLocation location, in int bubbleBarTopToScreenBottom) = 11;

    oneway void showShortcutBubble(in ShortcutInfo info, in @nullable BubbleBarLocation location) = 12;