Avoid applying window config from updating persistent config

The changed global configuration will also apply to default
display. When the display is rotating, the transition will be
disturbed if the given configuration contains stale window
configuration (e.g. bounds and rotation).

Because persistent configuration only includes locale and font
scale, clear the window configuration to avoid the noise.

Bug: 196313047
Test: Back from a landscape activity to a portrait activity.
      The portrait app activity calls LocalePicker#updateLocale
      in onResume. The transition should not be flickering.
Change-Id: Ib1bea1b752eb695e26b8b0622bcf06ec01cce3e6
This commit is contained in:
Riddle Hsu
2021-09-07 23:36:37 +08:00
parent 08774f2ffc
commit b4fdc0e4ba
2 changed files with 5 additions and 1 deletions

View File

@@ -4066,6 +4066,9 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
final long origId = Binder.clearCallingIdentity();
try {
synchronized (mGlobalLock) {
// Window configuration is unrelated to persistent configuration (e.g. font scale,
// locale). Unset it to avoid affecting the current display configuration.
values.windowConfiguration.setToDefaults();
updateConfigurationLocked(values, null, false, true, userId,
false /* deferResume */);
}

View File

@@ -5693,7 +5693,8 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
final Configuration currOverrideConfig = getRequestedOverrideConfiguration();
final int currRotation = currOverrideConfig.windowConfiguration.getRotation();
final int overrideRotation = overrideConfiguration.windowConfiguration.getRotation();
if (currRotation != ROTATION_UNDEFINED && currRotation != overrideRotation) {
if (currRotation != ROTATION_UNDEFINED && overrideRotation != ROTATION_UNDEFINED
&& currRotation != overrideRotation) {
applyRotationAndFinishFixedRotation(currRotation, overrideRotation);
}
mCurrentOverrideConfigurationChanges = currOverrideConfig.diff(overrideConfiguration);