Use the TaskFragment override screenLayout for fix rotation

Or the screenLayout that caulated from DisplayContent could be
different from the actual screenLayout of the Activity after
display rotated.

Bug: 235917242
Test: atest AppConfigurationTests#testAppOrientationRequestConfigChanges
Change-Id: I62c6c6b1ce5df69d2a26984f97330f60a35d87d7
This commit is contained in:
Louis Chang
2022-06-16 09:40:14 +00:00
parent 3845cbd933
commit 268e1abce0

View File

@@ -448,8 +448,14 @@ class WindowToken extends WindowContainer<WindowState> {
if (mFixedRotationTransformState != null) {
mFixedRotationTransformState.disassociate(this);
}
// TODO(b/233855302): Remove TaskFragment override if the DisplayContent uses the same
// bounds for screenLayout calculation.
final Configuration overrideConfig = new Configuration(config);
overrideConfig.screenLayout = TaskFragment.computeScreenLayoutOverride(
overrideConfig.screenLayout, overrideConfig.screenWidthDp,
overrideConfig.screenHeightDp);
mFixedRotationTransformState = new FixedRotationTransformState(info, displayFrames,
new Configuration(config), mDisplayContent.getRotation());
overrideConfig, mDisplayContent.getRotation());
mFixedRotationTransformState.mAssociatedTokens.add(this);
mDisplayContent.getDisplayPolicy().simulateLayoutDisplay(displayFrames);
onFixedRotationStatePrepared();