Synchronize device state update and display update callbacks

Adds a call from DisplayManager to WindowManager
that notifies WindowManager just before applying
the device state to the displays.

This is needed so we can guarantee the order of the
callbacks on the WindowManager side: now the device
state callback should be always executed before
display change callbacks.

This should fix race conditions in
PhysicalDisplaySwitchTransitionLauncher where
sometimes mIsFolded wasn't updated before
display switch and DisplayRotation where seems
like we could have a similar issue.

Test: atest DisplayManagerServiceTest
Test: manual fold/unfolds
Bug: 278040168
Change-Id: I82e297309125d8fda2e3ea3687971d345db2c0cd
9 files changed