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
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user