Resolve size compatibility bounds by original display attributes

Previously, the rotation of bounds is simulated by swapping the width
and height, and also adjust the insets in app bounds. But it is still
not accurate enough because the decors can be moved or resized according
to rotation.

Now the activity bounds are computed as it is in a pseudo display that
provides the same size and insets information as the original display
where the activity launched.

This change also handles a special case for task level letterboxing.
The container bounds for activity is also calculated as the task,
so the activity can always best fit in the parent when the orientation
is changed.

Fixes: 130417317
Bug: 112288258
Test: atest ActivityRecordTests TaskRecordTests
Test: atest SizeCompatModeActivityControllerTest
Test: Enable fully gestural navigation and launch camera.
      The restart button should not show after rotating screen.

Change-Id: Ifbb31f9ee84723c85bd4cbc03abd8cdf70fee6af
9 files changed