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

Commit e77046ae authored by Mady Mellor's avatar Mady Mellor Committed by Automerger Merge Worker
Browse files

Merge "Add a sysui state for manage menu being expanded" into sc-v2-dev am: a80ecceb

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15910586

Change-Id: I0d2ccfefc13c227f6f3997c404ef2053f2b47cd4
parents d1a1fd29 a80ecceb
Loading
Loading
Loading
Loading
+7 −8
Original line number Diff line number Diff line
@@ -120,8 +120,6 @@ public class BubbleStackView extends FrameLayout

    private static final int EXPANDED_VIEW_ALPHA_ANIMATION_DURATION = 150;

    private static final int MANAGE_MENU_SCRIM_ANIM_DURATION = 150;

    private static final float SCRIM_ALPHA = 0.6f;

    /**
@@ -894,6 +892,7 @@ public class BubbleStackView extends FrameLayout
                        updatePointerPosition(false /* forIme */);
                        mExpandedAnimationController.expandFromStack(() -> {
                            afterExpandedViewAnimation();
                            showManageMenu(mShowingManage);
                        } /* after */);
                        final float translationY = mPositioner.getExpandedViewY(mExpandedBubble,
                                getBubbleIndex(mExpandedBubble));
@@ -1253,9 +1252,6 @@ public class BubbleStackView extends FrameLayout
        mRelativeStackPositionBeforeRotation = new RelativeStackPosition(
                mPositioner.getRestingPosition(),
                mStackAnimationController.getAllowableStackPositionRegion());
        mManageMenu.setVisibility(View.INVISIBLE);
        mShowingManage = false;

        addOnLayoutChangeListener(mOrientationChangedListener);
        hideFlyoutImmediate();
    }
@@ -2555,16 +2551,19 @@ public class BubbleStackView extends FrameLayout
        invalidate();
    }

    private void showManageMenu(boolean show) {
    /** Hide or show the manage menu for the currently expanded bubble. */
    @VisibleForTesting
    public void showManageMenu(boolean show) {
        mShowingManage = show;

        // This should not happen, since the manage menu is only visible when there's an expanded
        // bubble. If we end up in this state, just hide the menu immediately.
        if (mExpandedBubble == null || mExpandedBubble.getExpandedView() == null) {
            mManageMenu.setVisibility(View.INVISIBLE);
            mManageMenuScrim.setVisibility(INVISIBLE);
            mBubbleController.getSysuiProxy().onManageMenuExpandChanged(false /* show */);
            return;
        }

        if (show) {
            mManageMenuScrim.setVisibility(VISIBLE);
            mManageMenuScrim.setTranslationZ(mManageMenu.getElevation() - 1f);
@@ -2576,8 +2575,8 @@ public class BubbleStackView extends FrameLayout
            }
        };

        mBubbleController.getSysuiProxy().onManageMenuExpandChanged(show);
        mManageMenuScrim.animate()
                .setDuration(MANAGE_MENU_SCRIM_ANIM_DURATION)
                .setInterpolator(show ? ALPHA_IN : ALPHA_OUT)
                .alpha(show ? SCRIM_ALPHA : 0f)
                .withEndAction(endAction)
+2 −0
Original line number Diff line number Diff line
@@ -284,6 +284,8 @@ public interface Bubbles {

        void onStackExpandChanged(boolean shouldExpand);

        void onManageMenuExpandChanged(boolean menuExpanded);

        void onUnbubbleConversation(String key);
    }
}
+6 −1
Original line number Diff line number Diff line
@@ -118,6 +118,8 @@ public class QuickStepContract {
    public static final int SYSUI_STATE_DEVICE_DOZING = 1 << 21;
    // The home feature is disabled (either by SUW/SysUI/device policy)
    public static final int SYSUI_STATE_BACK_DISABLED = 1 << 22;
    // The bubble stack is expanded AND the mange menu for bubbles is expanded on top of it.
    public static final int SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED = 1 << 23;

    @Retention(RetentionPolicy.SOURCE)
    @IntDef({SYSUI_STATE_SCREEN_PINNING,
@@ -142,7 +144,8 @@ public class QuickStepContract {
            SYSUI_STATE_MAGNIFICATION_OVERLAP,
            SYSUI_STATE_IME_SWITCHER_SHOWING,
            SYSUI_STATE_DEVICE_DOZING,
            SYSUI_STATE_BACK_DISABLED
            SYSUI_STATE_BACK_DISABLED,
            SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED
    })
    public @interface SystemUiStateFlags {}

@@ -174,6 +177,8 @@ public class QuickStepContract {
        str.add((flags & SYSUI_STATE_IME_SWITCHER_SHOWING) != 0 ? "ime_switcher_showing" : "");
        str.add((flags & SYSUI_STATE_DEVICE_DOZING) != 0 ? "device_dozing" : "");
        str.add((flags & SYSUI_STATE_BACK_DISABLED) != 0 ? "back_disabled" : "");
        str.add((flags & SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED) != 0
                ? "bubbles_mange_menu_expanded" : "");
        return str.toString();
    }

+14 −0
Original line number Diff line number Diff line
@@ -377,9 +377,23 @@ public class BubblesManager implements Dumpable {
                sysuiMainExecutor.execute(() -> {
                    sysUiState.setFlag(QuickStepContract.SYSUI_STATE_BUBBLES_EXPANDED, shouldExpand)
                            .commitUpdate(mContext.getDisplayId());
                    if (!shouldExpand) {
                        sysUiState.setFlag(
                                QuickStepContract.SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED,
                                false).commitUpdate(mContext.getDisplayId());
                    }
                });
            }

            @Override
            public void onManageMenuExpandChanged(boolean menuExpanded) {
                sysuiMainExecutor.execute(() -> {
                    sysUiState.setFlag(QuickStepContract.SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED,
                            menuExpanded).commitUpdate(mContext.getDisplayId());
                });
            }


            @Override
            public void onUnbubbleConversation(String key) {
                sysuiMainExecutor.execute(() -> {
+2 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.view.Display.DEFAULT_DISPLAY;

import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BOUNCER_SHOWING;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BUBBLES_EXPANDED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_GLOBAL_ACTIONS_SHOWING;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_ONE_HANDED_ACTIVE;
@@ -101,6 +102,7 @@ public final class WMShell extends SystemUI
                    | SYSUI_STATE_BOUNCER_SHOWING
                    | SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED
                    | SYSUI_STATE_BUBBLES_EXPANDED
                    | SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED
                    | SYSUI_STATE_QUICK_SETTINGS_EXPANDED;

    // Shell interfaces
Loading