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

Commit 32d0aba7 authored by Mady Mellor's avatar Mady Mellor Committed by Android (Google) Code Review
Browse files

Merge "Allow bubble bar to show on phones if the flag is enabled" into main

parents e1bd9bff d37b9486
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -595,7 +595,10 @@ public class BubbleController implements ConfigurationChangeListener,
     * <p>If bubble bar is supported, bubble views will be updated to switch to bar mode.
     */
    public void registerBubbleStateListener(Bubbles.BubbleStateListener listener) {
        if (Flags.enableBubbleBar() && mBubblePositioner.isLargeScreen() && listener != null) {
        final boolean bubbleBarAllowed = Flags.enableBubbleBar()
                && (mBubblePositioner.isLargeScreen() || Flags.enableBubbleBarOnPhones())
                && listener != null;
        if (bubbleBarAllowed) {
            // Only set the listener if we can show the bubble bar.
            mBubbleStateListener = listener;
            setUpBubbleViewsForMode();
@@ -772,7 +775,7 @@ public class BubbleController implements ConfigurationChangeListener,
    /** Whether bubbles would be shown with the bubble bar UI. */
    public boolean isShowingAsBubbleBar() {
        return Flags.enableBubbleBar()
                && mBubblePositioner.isLargeScreen()
                && (mBubblePositioner.isLargeScreen() || Flags.enableBubbleBarOnPhones())
                && mBubbleStateListener != null;
    }

+11 −5
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import androidx.annotation.VisibleForTesting;

import com.android.internal.protolog.ProtoLog;
import com.android.launcher3.icons.IconNormalizer;
import com.android.wm.shell.Flags;
import com.android.wm.shell.R;
import com.android.wm.shell.shared.bubbles.BubbleBarLocation;
import com.android.wm.shell.shared.bubbles.BubbleDropTargetBoundsProvider;
@@ -906,7 +907,7 @@ public class BubblePositioner implements BubbleDropTargetBoundsProvider {
        if (isOverflow) {
            return mOverflowHeight;
        } else {
            return getBubbleBarExpandedViewHeightForLandscape();
            return getBubbleBarExpandedViewHeight();
        }
    }

@@ -927,18 +928,23 @@ public class BubblePositioner implements BubbleDropTargetBoundsProvider {
     * |      bottom inset ↕  |   ↓
     * |----------------------| --- mScreenRect.bottom
     */
    private int getBubbleBarExpandedViewHeightForLandscape() {
    private int getBubbleBarExpandedViewHeight() {
        int heightOfBubbleBarContainer =
                mScreenRect.height() - getExpandedViewBottomForBubbleBar();
        int expandedViewHeight;
        if (Flags.enableBubbleBarOnPhones() && !mDeviceConfig.isLargeScreen()) {
            // we're on a phone, use the max / height
            expandedViewHeight = Math.max(mScreenRect.width(), mScreenRect.height());
        } else {
            // getting landscape height from screen rect
        int expandedViewHeight = Math.min(mScreenRect.width(), mScreenRect.height());
            expandedViewHeight = Math.min(mScreenRect.width(), mScreenRect.height());
        }
        expandedViewHeight -= heightOfBubbleBarContainer; /* removing bubble container height */
        expandedViewHeight -= mInsets.top; /* removing top inset */
        expandedViewHeight -= mExpandedViewPadding; /* removing spacing */
        return expandedViewHeight;
    }


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