Allow same displayId to override DisplayRotationCoordinator callback
There's a chance that the callback is not removed if the
onDisplayRemoved call is delayed. This can happen for exmaple if
there's an existing animation that has not finished. In this case,
let's allow the same displayId to re-register even if the previous
removal has not occurred yet.
In this case, we also now only allow removal to succeed if the
callback that's being removed matches the callback that's registered.
Without this, it's possible that the new callback is incorrectly
removed by a pending/delayed cleanup of the previous display.
Bug: 380427756
Test: atest DisplayRotationCoordinatorTests
Test: atest DisplayContentTests
Flag: EXEMPT bugfix
Change-Id: I6d6240e2ada92c8a0ca7bc50dde074b770cfa662
4 files changed