Don't add a dismiss target to WM if we're not in PiP.
This prevents adding dismiss-overlay window even when user never had
entered PiP mode. (e.g. booting a device)
Otherwise we re-add the same dismiss target in onConfigurationChange and
it doesn't get removed properly in onOverlayChanged that calls init().
That in turn is caused because the same View is being added twice, and
the corresponding AttachInfo is not set properly the second time, which
prevents the removal logic in init() from working correctly. It is not
set properly because the ViewRootImpl traversal didn't have a chance
to set the mAttachInfo in the first traversal, when the onOverlayChanged gets called.
Test: atest WMShellFlickerTests
Bug: 258120818
Change-Id: I9bca4d179aabe6f95d0416cd457d4707b25e113c
1 file changed