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

Commit 9d0a0c36 authored by Jiaming Liu's avatar Jiaming Liu Committed by Android (Google) Code Review
Browse files

Merge changes Iab6deda1,Idb786cb3 into main

* changes:
  [Bubbles] Fix focus issue by removing bubble after new bubble is added
  [Bubbles] Add bugfix flag for ime flicker when switching bubbles
parents f0a03af5 60a7f36e
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -266,6 +266,16 @@ flag {
    }
}

flag {
    name: "fix_bubbles_ime_focus_flicker"
    namespace: "multitasking"
    description: "Fixes an ime flicker due to non-bubbled activity gaining focus when switching bubbles"
    bug: "416347012"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "dismiss_pip_from_lockscreen"
    namespace: "multitasking"
+39 −0
Original line number Diff line number Diff line
@@ -3836,6 +3836,14 @@ public class BubbleStackView extends FrameLayout
    }

    private void updateExpandedBubble() {
        if (Flags.fixBubblesImeFocusFlicker()) {
            updateExpandedBubbleRemoveAfterAdd();
        } else {
            updateExpandedBubbleRemoveBeforeAdd();
        }
    }

    private void updateExpandedBubbleRemoveBeforeAdd() {
        mExpandedViewContainer.removeAllViews();
        BubbleExpandedView bev = getExpandedView();
        if (mIsExpanded && bev != null) {
@@ -3857,6 +3865,37 @@ public class BubbleStackView extends FrameLayout
        }
    }

    private void updateExpandedBubbleRemoveAfterAdd() {
        BubbleExpandedView bev = getExpandedView();
        if (!mIsExpanded || bev == null) {
            mExpandedViewContainer.removeAllViews();
            return;
        }
        if (bev.getParent() == mExpandedViewContainer) {
            return;
        }
        bev.setContentVisibility(false);
        bev.setAnimating(!mIsExpansionAnimating);
        mExpandedViewContainerMatrix.setScaleX(0f);
        mExpandedViewContainerMatrix.setScaleY(0f);
        mExpandedViewContainerMatrix.setTranslate(0f, 0f);
        mExpandedViewContainer.setVisibility(View.INVISIBLE);
        mExpandedViewContainer.setAlpha(0f);
        mExpandedViewContainer.addView(bev);
        if (mIsExpansionAnimating) {
            mExpandedViewContainer.removeViews(0, mExpandedViewContainer.getChildCount() - 1);
        } else {
            mIsBubbleSwitchAnimating = true;
            mSurfaceSynchronizer.syncSurfaceAndRun(() -> {
                // Remove other bubbles from the container after the new bubble is ready, so
                // that the focus won't fall into the non-bubbled activity behind.
                mExpandedViewContainer.removeViews(
                        0, mExpandedViewContainer.getChildCount() - 1);
                post(this::animateSwitchBubbles);
            });
        }
    }

    void onManageBubbleClicked() {
        showManageMenu(true /* show */);
    }