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

Commit 12df1011 authored by Hongwei Wang's avatar Hongwei Wang
Browse files

Ensure at most one pip-dismiss-overlay

PipDismissTargetHandler#init can be called multiple times, whenever a
new dismiss view (and its container) is created, remove the old one from
view hierarchy first.

Bug: 207495181
Test: manual, change wallpaper multiple times to trigger multiple init
      calls in PipDismissTargetHandler and ensures there is at most one
      pip-dismiss-overlay in the view hierarchy.
Change-Id: I4a0e058d1d002a6420974f41b94b70316d3444a3
parent 8653f2ee
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -120,6 +120,11 @@ public class PipDismissTargetHandler implements ViewTreeObserver.OnPreDrawListen
        mEnableDismissDragToEdge = res.getBoolean(R.bool.config_pipEnableDismissDragToEdge);
        mDismissAreaHeight = res.getDimensionPixelSize(R.dimen.floating_dismiss_gradient_height);

        if (mTargetViewContainer != null) {
            // init can be called multiple times, remove the old one from view hierarchy first.
            mWindowManager.removeViewImmediate(mTargetViewContainer);
        }

        mTargetView = new DismissCircleView(mContext);
        mTargetViewContainer = new FrameLayout(mContext);
        mTargetViewContainer.setBackgroundDrawable(