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

Commit 17d4f353 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Hit back button in overflow to collapse stack" into rvc-dev

parents ad553fb6 9f66c3b0
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -279,7 +279,8 @@ class Bubble implements BubbleViewProvider {
    /**
     * @return the display id of the virtual display on which bubble contents is drawn.
     */
    int getDisplayId() {
    @Override
    public int getDisplayId() {
        return mExpandedView != null ? mExpandedView.getVirtualDisplayId() : INVALID_DISPLAY;
    }

+6 −12
Original line number Diff line number Diff line
@@ -1175,23 +1175,17 @@ public class BubbleController implements ConfigurationController.ConfigurationLi
     * status bar, otherwise returns {@link Display#INVALID_DISPLAY}.
     */
    public int getExpandedDisplayId(Context context) {
        final Bubble bubble = getExpandedBubble(context);
        return bubble != null ? bubble.getDisplayId() : INVALID_DISPLAY;
    }

    @Nullable
    private Bubble getExpandedBubble(Context context) {
        if (mStackView == null) {
            return null;
            return INVALID_DISPLAY;
        }
        final boolean defaultDisplay = context.getDisplay() != null
                && context.getDisplay().getDisplayId() == DEFAULT_DISPLAY;
        final Bubble expandedBubble = mStackView.getExpandedBubble();
        if (defaultDisplay && expandedBubble != null && isStackExpanded()
        final BubbleViewProvider expandedViewProvider = mStackView.getExpandedBubble();
        if (defaultDisplay && expandedViewProvider != null && isStackExpanded()
                && !mNotificationShadeWindowController.getPanelExpanded()) {
            return expandedBubble;
            return expandedViewProvider.getDisplayId();
        }
        return null;
        return INVALID_DISPLAY;
    }

    @VisibleForTesting
@@ -1256,7 +1250,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi

        @Override
        public void onSingleTaskDisplayEmpty(int displayId) {
            final Bubble expandedBubble = mStackView != null
            final BubbleViewProvider expandedBubble = mStackView != null
                    ? mStackView.getExpandedBubble()
                    : null;
            int expandedId = expandedBubble != null ? expandedBubble.getDisplayId() : -1;
+4 −2
Original line number Diff line number Diff line
@@ -59,13 +59,15 @@ public class BubbleDebugConfig {
        return FORCE_SHOW_USER_EDUCATION || forceShow;
    }

    static String formatBubblesString(List<Bubble> bubbles, Bubble selected) {
    static String formatBubblesString(List<Bubble> bubbles, BubbleViewProvider selected) {
        StringBuilder sb = new StringBuilder();
        for (Bubble bubble : bubbles) {
            if (bubble == null) {
                sb.append("   <null> !!!!!\n");
            } else {
                boolean isSelected = (selected != null && bubble == selected);
                boolean isSelected = (selected != null
                        && selected.getKey() != BubbleOverflow.KEY
                        && bubble == selected);
                String arrow = isSelected ? "=>" : "  ";
                sb.append(String.format("%s Bubble{act=%12d, ongoing=%d, key=%s}\n",
                        arrow,
+12 −6
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.systemui.bubbles;

import static android.view.Display.INVALID_DISPLAY;
import static android.view.View.GONE;

import static com.android.systemui.bubbles.BadgedImageView.DEFAULT_PATH_SIZE;
@@ -45,7 +46,7 @@ public class BubbleOverflow implements BubbleViewProvider {
    public static final String KEY = "Overflow";

    private BadgedImageView mOverflowBtn;
    private BubbleExpandedView mOverflowExpandedView;
    private BubbleExpandedView mExpandedView;
    private LayoutInflater mInflater;
    private Context mContext;
    private Bitmap mIcon;
@@ -63,11 +64,11 @@ public class BubbleOverflow implements BubbleViewProvider {
    }

    void setUpOverflow(ViewGroup parentViewGroup, BubbleStackView stackView) {
        mOverflowExpandedView = (BubbleExpandedView) mInflater.inflate(
        mExpandedView = (BubbleExpandedView) mInflater.inflate(
                R.layout.bubble_expanded_view, parentViewGroup /* root */,
                false /* attachToRoot */);
        mOverflowExpandedView.setOverflow(true);
        mOverflowExpandedView.setStackView(stackView);
        mExpandedView.setOverflow(true);
        mExpandedView.setStackView(stackView);

        updateIcon(mContext, parentViewGroup);
    }
@@ -124,7 +125,7 @@ public class BubbleOverflow implements BubbleViewProvider {

    @Override
    public BubbleExpandedView getExpandedView() {
        return mOverflowExpandedView;
        return mExpandedView;
    }

    @Override
@@ -149,7 +150,7 @@ public class BubbleOverflow implements BubbleViewProvider {

    @Override
    public void setContentVisibility(boolean visible) {
        mOverflowExpandedView.setContentVisibility(visible);
        mExpandedView.setContentVisibility(visible);
    }

    @Override
@@ -167,4 +168,9 @@ public class BubbleOverflow implements BubbleViewProvider {
    public String getKey() {
        return BubbleOverflow.KEY;
    }

    @Override
    public int getDisplayId() {
        return mExpandedView != null ? mExpandedView.getVirtualDisplayId() : INVALID_DISPLAY;
    }
}
+8 −16
Original line number Diff line number Diff line
@@ -908,14 +908,8 @@ public class BubbleStackView extends FrameLayout {
     * The {@link Bubble} that is expanded, null if one does not exist.
     */
    @Nullable
    Bubble getExpandedBubble() {
        if (mExpandedBubble == null
                || (BubbleExperimentConfig.allowBubbleOverflow(mContext)
                    && mExpandedBubble.getIconView() == mBubbleOverflow.getBtn()
                    && BubbleOverflow.KEY.equals(mExpandedBubble.getKey()))) {
            return null;
        }
        return (Bubble) mExpandedBubble;
    BubbleViewProvider getExpandedBubble() {
        return mExpandedBubble;
    }

    // via BubbleData.Listener
@@ -1288,7 +1282,7 @@ public class BubbleStackView extends FrameLayout {
        if (DEBUG_BUBBLE_STACK_VIEW) {
            Log.d(TAG, "animateCollapse");
            Log.d(TAG, BubbleDebugConfig.formatBubblesString(getBubblesOnScreen(),
                    getExpandedBubble()));
                    mExpandedBubble));
        }
        updateOverflowBtnVisibility(/* apply */ false);
        mBubbleContainer.cancelAllAnimations();
@@ -1862,17 +1856,16 @@ public class BubbleStackView extends FrameLayout {
    }

    private void updatePointerPosition() {
        Bubble expandedBubble = getExpandedBubble();
        if (expandedBubble == null) {
        if (mExpandedBubble == null) {
            return;
        }
        int index = getBubbleIndex(expandedBubble);
        int index = getBubbleIndex(mExpandedBubble);
        float bubbleLeftFromScreenLeft = mExpandedAnimationController.getBubbleLeft(index);
        float halfBubble = mBubbleSize / 2f;
        float bubbleCenter = bubbleLeftFromScreenLeft + halfBubble;
        // Padding might be adjusted for insets, so get it directly from the view
        bubbleCenter -= mExpandedViewContainer.getPaddingLeft();
        expandedBubble.getExpandedView().setPointerPosition(bubbleCenter);
        mExpandedBubble.getExpandedView().setPointerPosition(bubbleCenter);
    }

    /**
@@ -1894,11 +1887,10 @@ public class BubbleStackView extends FrameLayout {
     * is between 0 and the bubble count minus 1.
     */
    int getBubbleIndex(@Nullable BubbleViewProvider provider) {
        if (provider == null || provider.getKey() == BubbleOverflow.KEY) {
        if (provider == null) {
            return 0;
        }
        Bubble b = (Bubble) provider;
        return mBubbleContainer.indexOfChild(b.getIconView());
        return mBubbleContainer.indexOfChild(provider.getIconView());
    }

    /**
Loading