Clear fixed rotation for app no longer changes rotation

For example: launch a landscape activity while device is portrait,
and then launch another portrait activity before previous transition
is done. If the landscape activity is destroyed before sending the
fixed rotation adjustment for restoration, the adjustment is always
retained by client side app. That causes the Display objects
associated with application Resources always return rotation from
the adjustment.

This change clear the rotated state immediately when the top app
has changed to the one that won't rotate the display. So the previous
activity can receive the adjustment for restoration in time.

Also simply a bit for the path of clearing fixed rotation state to
avoid sending duplicated adjustments.

Bug: 177390830
Test: DisplayContentTests#testClearIntermediateFixedRotation

Change-Id: Ic13dff8b7a23a6022201a8fe7a981bb511b6e856
3 files changed