@@ -1479,6 +1479,7 @@ private ActivityManagerService() {
14791479
14801480 mConfiguration.setToDefaults();
14811481 mConfiguration.locale = Locale.getDefault();
1482+ mConfigurationSeq = mConfiguration.seq = 1;
14821483 mProcessStats.init();
14831484
14841485 mCompatModePackages = new CompatModePackages(this, systemDir);
@@ -2436,7 +2437,7 @@ public void setRequestedOrientation(IBinder token,
24362437 r.mayFreezeScreenLocked(r.app) ? r.appToken : null);
24372438 if (config != null) {
24382439 r.frozenBeforeDestroy = true;
2439- if (!updateConfigurationLocked(config, r, false)) {
2440+ if (!updateConfigurationLocked(config, r, false, false )) {
24402441 mMainStack.resumeTopActivityLocked(null);
24412442 }
24422443 }
@@ -3797,7 +3798,7 @@ private final boolean attachApplicationLocked(IApplicationThread thread,
37973798 app.instrumentationClass, profileFile, profileFd, profileAutoStop,
37983799 app.instrumentationArguments, app.instrumentationWatcher, testMode,
37993800 isRestrictedBackupMode || !normalMode, app.persistent,
3800- mConfiguration, app.compat, getCommonServicesLocked(),
3801+ new Configuration( mConfiguration) , app.compat, getCommonServicesLocked(),
38013802 mCoreSettingsObserver.getCoreSettingsLocked());
38023803 updateLruProcessLocked(app, false, true);
38033804 app.lastRequestedGc = app.lastLowMemory = SystemClock.uptimeMillis();
@@ -6707,8 +6708,7 @@ private void retrieveSettings() {
67076708 mAlwaysFinishActivities = alwaysFinishActivities;
67086709 // This happens before any activities are started, so we can
67096710 // change mConfiguration in-place.
6710- mConfiguration.updateFrom(configuration);
6711- mConfigurationSeq = mConfiguration.seq = 1;
6711+ updateConfigurationLocked(configuration, null, false, true);
67126712 if (DEBUG_CONFIGURATION) Slog.v(TAG, "Initial config: " + mConfiguration);
67136713 }
67146714 }
@@ -12934,7 +12934,7 @@ public void updatePersistentConfiguration(Configuration values) {
1293412934
1293512935 synchronized(this) {
1293612936 final long origId = Binder.clearCallingIdentity();
12937- updateConfigurationLocked(values, null, true);
12937+ updateConfigurationLocked(values, null, true, false );
1293812938 Binder.restoreCallingIdentity(origId);
1293912939 }
1294012940 }
@@ -12957,7 +12957,7 @@ public void updateConfiguration(Configuration values) {
1295712957 if (values != null) {
1295812958 Settings.System.clearConfiguration(values);
1295912959 }
12960- updateConfigurationLocked(values, null, false);
12960+ updateConfigurationLocked(values, null, false, false );
1296112961 Binder.restoreCallingIdentity(origId);
1296212962 }
1296312963 }
@@ -12971,7 +12971,7 @@ public void updateConfiguration(Configuration values) {
1297112971 * @param persistent TODO
1297212972 */
1297312973 public boolean updateConfigurationLocked(Configuration values,
12974- ActivityRecord starting, boolean persistent) {
12974+ ActivityRecord starting, boolean persistent, boolean initLocale ) {
1297512975 int changes = 0;
1297612976
1297712977 boolean kept = true;
@@ -12986,7 +12986,7 @@ public boolean updateConfigurationLocked(Configuration values,
1298612986
1298712987 EventLog.writeEvent(EventLogTags.CONFIGURATION_CHANGED, changes);
1298812988
12989- if (values.locale != null) {
12989+ if (values.locale != null && !initLocale ) {
1299012990 saveLocaleLocked(values.locale,
1299112991 !values.locale.equals(mConfiguration.locale),
1299212992 values.userSetLocale);
@@ -12999,10 +12999,12 @@ public boolean updateConfigurationLocked(Configuration values,
1299912999 newConfig.seq = mConfigurationSeq;
1300013000 mConfiguration = newConfig;
1300113001 Slog.i(TAG, "Config changed: " + newConfig);
13002-
13002+
13003+ final Configuration configCopy = new Configuration(mConfiguration);
13004+
1300313005 AttributeCache ac = AttributeCache.instance();
1300413006 if (ac != null) {
13005- ac.updateConfiguration(mConfiguration );
13007+ ac.updateConfiguration(configCopy );
1300613008 }
1300713009
1300813010 // Make sure all resources in our process are updated
@@ -13012,11 +13014,11 @@ public boolean updateConfigurationLocked(Configuration values,
1301213014 // boot, where the first config change needs to guarantee
1301313015 // all resources have that config before following boot
1301413016 // code is executed.
13015- mSystemThread.applyConfigurationToResources(newConfig );
13017+ mSystemThread.applyConfigurationToResources(configCopy );
1301613018
1301713019 if (persistent && Settings.System.hasInterestingConfigurationChanges(changes)) {
1301813020 Message msg = mHandler.obtainMessage(UPDATE_CONFIGURATION_MSG);
13019- msg.obj = new Configuration(mConfiguration );
13021+ msg.obj = new Configuration(configCopy );
1302013022 mHandler.sendMessage(msg);
1302113023 }
1302213024
@@ -13026,7 +13028,7 @@ public boolean updateConfigurationLocked(Configuration values,
1302613028 if (app.thread != null) {
1302713029 if (DEBUG_CONFIGURATION) Slog.v(TAG, "Sending to proc "
1302813030 + app.processName + " new config " + mConfiguration);
13029- app.thread.scheduleConfigurationChanged(mConfiguration );
13031+ app.thread.scheduleConfigurationChanged(configCopy );
1303013032 }
1303113033 } catch (Exception e) {
1303213034 }
0 commit comments