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

Commit 70b67510 authored by Liran Binyamin's avatar Liran Binyamin
Browse files

Fix jank when rotating an expanded bubble

Previously we were removing all views and re-expanding the bubble after orientation changes.
That behavior also made the TaskView invisible and then visible again which triggered a SEND_TO_BACK followed by a
SEND_TO_FRONT shell transitions which caused flickering and noticeable latency before the task reappears.

This CL updates the positions and dimensions of the views without removing and readding them.

Demo: http://recall/-/bJtug1HhvXkkeA4MQvIaiP/dmFu9ca6zLPrWah7VZjmT0

Fixes: 280350168
Test: Manual
       - Add bubbles
       - Expand the stack
       - Rotate
       - Observe no jank
Change-Id: Ia3bcb4541928073dc5faae7de1088812b0c95974
parent 72c6685c
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -949,7 +949,9 @@ public class BubbleExpandedView extends LinearLayout {
        if (mTaskView != null
                && mTaskView.getVisibility() == VISIBLE
                && mTaskView.isAttachedToWindow()) {
            mTaskView.onLocationChanged();
            // post this to the looper, because if the device orientation just changed, we need to
            // let the current shell transition complete before updating the task view bounds.
            post(() -> mTaskView.onLocationChanged());
        }
        if (mIsOverflow) {
            // post this to the looper so that the view has a chance to be laid out before it can
+9 −8
Original line number Diff line number Diff line
@@ -1010,15 +1010,15 @@ public class BubbleStackView extends FrameLayout
                    }

                    if (mIsExpanded) {
                        // Re-draw bubble row and pointer for new orientation.
                        beforeExpandedViewAnimation();
                        // update the expanded view and pointer location for the new orientation.
                        hideFlyoutImmediate();
                        mExpandedViewContainer.setAlpha(0f);
                        updateExpandedView();
                        updateOverflowVisibility();
                        updatePointerPosition(false /* forIme */);
                        mExpandedAnimationController.expandFromStack(() -> {
                            afterExpandedViewAnimation();
                            mExpandedViewContainer.setVisibility(VISIBLE);
                        updatePointerPosition(false);
                        requestUpdate();
                        showManageMenu(mShowingManage);
                        } /* after */);

                        PointF p = mPositioner.getExpandedBubbleXY(getBubbleIndex(mExpandedBubble),
                                getState());
                        final float translationY = mPositioner.getExpandedViewY(mExpandedBubble,
@@ -1027,6 +1027,7 @@ public class BubbleStackView extends FrameLayout
                        mExpandedViewContainer.setTranslationY(translationY);
                        mExpandedViewContainer.setAlpha(1f);
                    }

                    removeOnLayoutChangeListener(mOrientationChangedListener);
                };
        final float maxDismissSize = getResources().getDimensionPixelSize(