Only set appToken.setCanTurnScreenOn to false if screen was turned on.

The appToken setCanTurnScreenOn value is used to ensure that a relayout
doesn't cause the screen to get turned on again within a single launch.
Previously, it was being set to false for the first window that called
relayout. This is incorrect since an app can have multiple windows
displayed. Only one of the windows needs to have the flag TURN_SCREEN_ON
in order to wakeup the screen.

Only set appToken setCanTurnScreenOn to false if all the conditions were
met to turn the screen on. This way if the first window doesn't have the
TURN_SCREEN_ON flag, other windows could still trigger the screen
getting turned on.

Change-Id: If8ff9ba1afb1f7f9632e8c911ed475aed531b880
Fixes: 74086704
Test: Incoming call turns screen on
Test: testPrepareWindowToDisplayDuringRelayout
Test: atest WindowManagerSmokeTest
3 files changed