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

Commit 307a7974 authored by Liran Binyamin's avatar Liran Binyamin
Browse files

Fix blank Bubbles related to unfold transition

Clean up a pending unfold transition from TaskViewTransitions when
it is consumed by a different handler.

Also only notify bubbles and queue the unfold transition when bubbles
are expanded.

Bug: 418131777
Flag: com.android.wm.shell.enable_bubble_bar
Test: atest BubbleTransitionsTest
Test: manual
       - expand floating bubble on a foldable
       - attach a magnetic charger
       - expand bubbles and verify expanded view is displayed
Change-Id: I6ee14b8c7c29474905335191527b9acd00ec4567
parent 08d0feb9
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -708,7 +708,6 @@ public class Bubble implements BubbleViewProvider {
    /**
     * Sets the current bubble-transition that is coordinating a change in this bubble.
     */
    @VisibleForTesting
    public void setPreparingTransition(BubbleTransitions.BubbleTransition transit) {
        ProtoLog.d(WM_SHELL_BUBBLES_NOISY, "setPreparingTransition: transit=%s", transit);
        mPreparingTransition = transit;
+3 −1
Original line number Diff line number Diff line
@@ -213,7 +213,8 @@ public class BubbleTransitions {
        // we only do this when switching from floating bubbles to bar bubbles so guard this with
        // the bubble bar flag, but once these are combined we should be able to remove this.
        if (com.android.wm.shell.Flags.enableBubbleBar()
                && mBubbleData.getSelectedBubble() instanceof Bubble) {
                && mBubbleData.getSelectedBubble() instanceof Bubble
                && mBubbleData.isExpanded()) {
            ProtoLog.d(
                    WM_SHELL_BUBBLES, "notifyUnfoldTransitionStarting transition=%s", transition);
            Bubble bubble = (Bubble) mBubbleData.getSelectedBubble();
@@ -1703,6 +1704,7 @@ public class BubbleTransitions {
        public void onTransitionConsumed(@NonNull IBinder transition, boolean aborted,
                @Nullable SurfaceControl.Transaction finishTransaction) {
            if (!aborted) return;
            mBubble.setPreparingTransition(null);
            mTransition = null;
            mTaskViewTransitions.onExternalDone(transition);
        }
+1 −0
Original line number Diff line number Diff line
@@ -627,6 +627,7 @@ class DefaultMixedTransition extends DefaultMixedHandler.MixedTransition {
                mLeftoversHandler.onTransitionConsumed(transition, aborted, finishT);
                break;
            case TYPE_UNFOLD:
                mBubbleTransitions.notifyUnfoldTransitionFinished(transition);
                mUnfoldHandler.onTransitionConsumed(transition, aborted, finishT);
                break;
            case TYPE_OPEN_IN_DESKTOP:
+14 −0
Original line number Diff line number Diff line
@@ -662,6 +662,7 @@ public class BubbleTransitionsTest extends ShellTestCase {
        setupBubble();
        final IBinder unfoldTransition = mock(IBinder.class);
        when(mBubbleData.getSelectedBubble()).thenReturn(mBubble);
        when(mBubbleData.isExpanded()).thenReturn(true);
        mBubbleTransitions.notifyUnfoldTransitionStarting(unfoldTransition);

        assertThat(mTaskViewTransitions.hasPending()).isTrue();
@@ -677,6 +678,18 @@ public class BubbleTransitionsTest extends ShellTestCase {
        assertThat(mTaskViewTransitions.hasPending()).isFalse();
    }

    @Test
    @EnableFlags(FLAG_ENABLE_BUBBLE_BAR)
    public void notifyUnfoldTransitionStarting_bubblesCollapsed_doesNotEnqueueExternal() {
        setupBubble();
        final IBinder unfoldTransition = mock(IBinder.class);
        when(mBubbleData.getSelectedBubble()).thenReturn(mBubble);
        when(mBubbleData.isExpanded()).thenReturn(false);
        mBubbleTransitions.notifyUnfoldTransitionStarting(unfoldTransition);

        assertThat(mTaskViewTransitions.hasPending()).isFalse();
    }

    @Test
    @DisableFlags(FLAG_ENABLE_BUBBLE_BAR)
    public void notifyUnfoldTransitionStarting_bubbleBarDisabled() {
@@ -694,6 +707,7 @@ public class BubbleTransitionsTest extends ShellTestCase {
        setupBubble();
        final IBinder unfoldTransition = mock(IBinder.class);
        when(mBubbleData.getSelectedBubble()).thenReturn(mBubble);
        when(mBubbleData.isExpanded()).thenReturn(true);
        mBubbleTransitions.notifyUnfoldTransitionStarting(unfoldTransition);

        assertThat(mTaskViewTransitions.hasPending()).isTrue();