Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f881d267 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Reduce unnecessary config change when setting locale

The caller may only set the config fields that it request to change.
And the non-screen-layout-direction bits should be only computed by
display (DisplayContent#computeScreenConfiguration). Otherwise
when applying global config to default display, it will lead to an
unnecessary extra change CONFIG_SCREEN_LAYOUT which increase the
latency of changing locale.

Bug: 430213501
Flag: EXEMPT bugfix
Test: Change locale from Settings. The event log should only
      contain one configuration_changed.

Change-Id: I020ef69edb5b90cf1ea9937ffc438191036fcd8c
parent aa878a5a
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -5019,6 +5019,13 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
                // Window configuration is unrelated to persistent configuration (e.g. font scale,
                // locale). Unset it to avoid affecting the current display configuration.
                values.windowConfiguration.setToDefaults();
                // A locale change may set layout direction (Configuration#setLocales()) without
                // including other screen layout bits, so preserve it to avoid extra config change.
                if (values.userSetLocale && values.screenLayout
                        == (values.screenLayout & Configuration.SCREENLAYOUT_LAYOUTDIR_MASK)) {
                    values.screenLayout |= (getGlobalConfiguration().screenLayout
                            & ~Configuration.SCREENLAYOUT_LAYOUTDIR_MASK);
                }
                updateConfigurationLocked(values, false /* initLocale */, true /* persistent */,
                        userId);
            }