Fix WindowContext is removed unexpectedly
Previously WindowContext is removed if the associated WindowContainer
is removed. However, it causes an issue that WindowContext is removed
unexpectedly after the last window is removed by WM#removeView().
When the last view is removed, WMS will remove the WindowToken
in postWindowRemoveCleanupLocked(), and if the WindowToken is created
by WindowContext, the associated WindowContext is also removed
unexpectedly.
This CL makes WindowContext switch back to listen to the previous
DisplayArea if the last window is removed.
Test: atest WindowContextListenerControllerTests
Bug: 185460076
Change-Id: I9c1d0c15c77bbfb3662355f8c72f0d8c70ed6748
2 files changed