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

Commit b997300a authored by Ats Jenk's avatar Ats Jenk Committed by Android (Google) Code Review
Browse files

Merge "Return full bubble bar bounds on display when expanded" into main

parents 9407a53a b6e47ce9
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -1109,9 +1109,8 @@ public class BubbleController implements ConfigurationChangeListener,
     * <p>This is used by external callers (launcher).
     */
    @VisibleForTesting
    public void expandStackAndSelectBubbleFromLauncher(String key, int bubbleBarOffsetX,
            int bubbleBarOffsetY) {
        mBubblePositioner.setBubbleBarPosition(bubbleBarOffsetX, bubbleBarOffsetY);
    public void expandStackAndSelectBubbleFromLauncher(String key, Rect bubbleBarBounds) {
        mBubblePositioner.setBubbleBarPosition(bubbleBarBounds);

        if (BubbleOverflow.KEY.equals(key)) {
            mBubbleData.setSelectedBubbleFromLauncher(mBubbleData.getOverflow());
@@ -2172,10 +2171,10 @@ public class BubbleController implements ConfigurationChangeListener,
        }

        @Override
        public void showBubble(String key, int bubbleBarOffsetX, int bubbleBarOffsetY) {
        public void showBubble(String key, Rect bubbleBarBounds) {
            mMainExecutor.execute(
                    () -> mController.expandStackAndSelectBubbleFromLauncher(
                            key, bubbleBarOffsetX, bubbleBarOffsetY));
                            key, bubbleBarBounds));
        }

        @Override
+8 −14
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.wm.shell.bubbles;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Insets;
import android.graphics.Point;
import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.RectF;
@@ -97,7 +96,7 @@ public class BubblePositioner {
    private PointF mRestingStackPosition;

    private boolean mShowingInBubbleBar;
    private final Point mBubbleBarPosition = new Point();
    private final Rect mBubbleBarBounds = new Rect();

    public BubblePositioner(Context context, WindowManager windowManager) {
        mContext = context;
@@ -791,15 +790,10 @@ public class BubblePositioner {
    }

    /**
     * Sets the position of the bubble bar in screen coordinates.
     *
     * @param offsetX the offset of the bubble bar from the edge of the screen on the X axis
     * @param offsetY the offset of the bubble bar from the edge of the screen on the Y axis
     * Sets the position of the bubble bar in display coordinates.
     */
    public void setBubbleBarPosition(int offsetX, int offsetY) {
        mBubbleBarPosition.set(
                getAvailableRect().width() - offsetX,
                getAvailableRect().height() + mInsets.top + mInsets.bottom - offsetY);
    public void setBubbleBarPosition(Rect bubbleBarBounds) {
        mBubbleBarBounds.set(bubbleBarBounds);
    }

    /**
@@ -820,7 +814,7 @@ public class BubblePositioner {

    /** The bottom position of the expanded view when showing above the bubble bar. */
    public int getExpandedViewBottomForBubbleBar() {
        return mBubbleBarPosition.y - mExpandedViewPadding;
        return mBubbleBarBounds.top - mExpandedViewPadding;
    }

    /**
@@ -831,9 +825,9 @@ public class BubblePositioner {
    }

    /**
     * Returns the on screen co-ordinates of the bubble bar.
     * Returns the display coordinates of the bubble bar.
     */
    public Point getBubbleBarPosition() {
        return mBubbleBarPosition;
    public Rect getBubbleBarBounds() {
        return mBubbleBarBounds;
    }
}
+2 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.wm.shell.bubbles;

import android.content.Intent;
import android.graphics.Rect;
import com.android.wm.shell.bubbles.IBubblesListener;

/**
@@ -29,7 +30,7 @@ interface IBubbles {

    oneway void unregisterBubbleListener(in IBubblesListener listener) = 2;

    oneway void showBubble(in String key, in int bubbleBarOffsetX, in int bubbleBarOffsetY) = 3;
    oneway void showBubble(in String key, in Rect bubbleBarBounds) = 3;

    oneway void removeBubble(in String key) = 4;

+4 −3
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.Point;
import android.graphics.Rect;
import android.util.Log;
import android.util.Size;
import android.view.View;
@@ -149,12 +150,12 @@ public class BubbleBarAnimationHelper {
        bbev.setVisibility(VISIBLE);

        // Set the pivot point for the scale, so the view animates out from the bubble bar.
        Point bubbleBarPosition = mPositioner.getBubbleBarPosition();
        Rect bubbleBarBounds = mPositioner.getBubbleBarBounds();
        mExpandedViewContainerMatrix.setScale(
                1f - EXPANDED_VIEW_ANIMATE_SCALE_AMOUNT,
                1f - EXPANDED_VIEW_ANIMATE_SCALE_AMOUNT,
                bubbleBarPosition.x,
                bubbleBarPosition.y);
                bubbleBarBounds.centerX(),
                bubbleBarBounds.top);

        bbev.setAnimationMatrix(mExpandedViewContainerMatrix);

+2 −1
Original line number Diff line number Diff line
@@ -2217,7 +2217,8 @@ public class BubblesTest extends SysuiTestCase {

        FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener();
        mBubbleController.registerBubbleStateListener(bubbleStateListener);
        mBubbleController.expandStackAndSelectBubbleFromLauncher(mBubbleEntry.getKey(), 500, 1000);
        mBubbleController.expandStackAndSelectBubbleFromLauncher(mBubbleEntry.getKey(),
                new Rect(500, 1000, 600, 1100));

        assertThat(mBubbleController.getLayerView().isExpanded()).isTrue();