Don't add insets when a container is detached

It can happen when WM core receives a request from WM shell when
handling previous requests. The container is detached so it isn't
visible anymore and when it's attached again insets need to be updated
regardless.

Also clear mLocalInsetsSourceProviders when display changes, as they
hold references to the InsetsStateController of the previous display,
which could result in memory leaks or weird insets behaviors after
reparenting to a different display.

Bug: 238680143
Test: WM core doesn't throw this NPE anymore.
Change-Id: I9dc6e0b4ec2cca1d403f51ca361325de08421978
1 file changed