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

Commit 2e40d603 authored by Mady Mellor's avatar Mady Mellor
Browse files

Remove canShowAsBubbleBar and instead use isShowingAsBubbleBar

Typically we want the 'isShowing' check instead of 'canShowAs' so remove
that to avoid confusion.

Flag: com.android.wm.shell.enable_bubble_bar
Test: atest WMShellUnitTests BubbleBarLayerViewTest
Bug: 392963712
Change-Id: I63158785cd1c7ad3e9eca8534c4fa5a22a7b496b
parent c10f2ad5
Loading
Loading
Loading
Loading
+8 −11
Original line number Diff line number Diff line
@@ -588,7 +588,7 @@ 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 (canShowAsBubbleBar() && listener != null) {
        if (Flags.enableBubbleBar() && mBubblePositioner.isLargeScreen() && listener != null) {
            // Only set the listener if we can show the bubble bar.
            mBubbleStateListener = listener;
            setUpBubbleViewsForMode();
@@ -762,14 +762,11 @@ public class BubbleController implements ConfigurationChangeListener,
        }
    }

    /** Whether bubbles are showing in the bubble bar. */
    /** Whether bubbles would be shown with the bubble bar UI. */
    public boolean isShowingAsBubbleBar() {
        return canShowAsBubbleBar() && mBubbleStateListener != null;
    }

    /** Whether the current configuration supports showing as bubble bar. */
    private boolean canShowAsBubbleBar() {
        return Flags.enableBubbleBar() && mBubblePositioner.isLargeScreen();
        return Flags.enableBubbleBar()
                && mBubblePositioner.isLargeScreen()
                && mBubbleStateListener != null;
    }

    /**
@@ -778,7 +775,7 @@ public class BubbleController implements ConfigurationChangeListener,
     */
    @Nullable
    public BubbleBarLocation getBubbleBarLocation() {
        if (canShowAsBubbleBar()) {
        if (isShowingAsBubbleBar()) {
            return mBubblePositioner.getBubbleBarLocation();
        }
        return null;
@@ -789,7 +786,7 @@ public class BubbleController implements ConfigurationChangeListener,
     */
    public void setBubbleBarLocation(BubbleBarLocation bubbleBarLocation,
            @BubbleBarLocation.UpdateSource int source) {
        if (canShowAsBubbleBar()) {
        if (isShowingAsBubbleBar()) {
            BubbleBarLocation previousLocation = mBubblePositioner.getBubbleBarLocation();
            mBubblePositioner.setBubbleBarLocation(bubbleBarLocation);
            if (mLayerView != null && !mLayerView.isExpandedViewDragged()) {
@@ -841,7 +838,7 @@ public class BubbleController implements ConfigurationChangeListener,
     * {@link #setBubbleBarLocation(BubbleBarLocation, int)}.
     */
    public void animateBubbleBarLocation(BubbleBarLocation bubbleBarLocation) {
        if (canShowAsBubbleBar()) {
        if (isShowingAsBubbleBar()) {
            mBubbleStateListener.animateBubbleBarLocation(bubbleBarLocation);
        }
    }