summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2011-11-14 17:45:19 -0800
committerDianne Hackborn <hackbod@google.com>2011-12-07 14:18:05 -0800
commit04ea2d98afb4f84f857dd343fd045fd636d86f54 (patch)
treef0f6f44835139763ff4c81b70b0dfc0479654179
parentd28bb28e080f1dcd27f5b4f8b697d77cac09495b (diff)
downloadframeworks_base-04ea2d98afb4f84f857dd343fd045fd636d86f54.zip
frameworks_base-04ea2d98afb4f84f857dd343fd045fd636d86f54.tar.gz
frameworks_base-04ea2d98afb4f84f857dd343fd045fd636d86f54.tar.bz2
DO NOT MERGE. Integrate from MR 1 to fix issue #5366535: Lockscreen...
...has wrong layout but corrects itself Maybe fix issue #5405788: Device continuously opening and closing... ...the "Complete action using" dialog I have never been able to reproduce this consistently, but here is another stab in the twilight. It looks like during boot we have a potential race where we could reset the config sequence number after we had gone through a config change, causing ActivityThread to ignore a following config change. Maybe this change will help. Change-Id: I7199b6de370488e8d897d6a78ff6f15624da862c
-rw-r--r--services/java/com/android/server/am/ActivityManagerService.java28
-rw-r--r--services/java/com/android/server/am/ActivityStack.java11
2 files changed, 21 insertions, 18 deletions
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 2a867af..1614c2d 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -1451,6 +1451,7 @@ public final class ActivityManagerService extends ActivityManagerNative
mConfiguration.setToDefaults();
mConfiguration.locale = Locale.getDefault();
+ mConfigurationSeq = mConfiguration.seq = 1;
mProcessStats.init();
mCompatModePackages = new CompatModePackages(this, systemDir);
@@ -2407,7 +2408,7 @@ public final class ActivityManagerService extends ActivityManagerNative
r.mayFreezeScreenLocked(r.app) ? r : null);
if (config != null) {
r.frozenBeforeDestroy = true;
- if (!updateConfigurationLocked(config, r, false)) {
+ if (!updateConfigurationLocked(config, r, false, false)) {
mMainStack.resumeTopActivityLocked(null);
}
}
@@ -3724,7 +3725,7 @@ public final class ActivityManagerService extends ActivityManagerNative
app.instrumentationClass, profileFile, profileFd, profileAutoStop,
app.instrumentationArguments, app.instrumentationWatcher, testMode,
isRestrictedBackupMode || !normalMode, app.persistent,
- mConfiguration, app.compat, getCommonServicesLocked(),
+ new Configuration(mConfiguration), app.compat, getCommonServicesLocked(),
mCoreSettingsObserver.getCoreSettingsLocked());
updateLruProcessLocked(app, false, true);
app.lastRequestedGc = app.lastLowMemory = SystemClock.uptimeMillis();
@@ -6633,8 +6634,7 @@ public final class ActivityManagerService extends ActivityManagerNative
mAlwaysFinishActivities = alwaysFinishActivities;
// This happens before any activities are started, so we can
// change mConfiguration in-place.
- mConfiguration.updateFrom(configuration);
- mConfigurationSeq = mConfiguration.seq = 1;
+ updateConfigurationLocked(configuration, null, false, true);
if (DEBUG_CONFIGURATION) Slog.v(TAG, "Initial config: " + mConfiguration);
}
}
@@ -12838,7 +12838,7 @@ public final class ActivityManagerService extends ActivityManagerNative
synchronized(this) {
final long origId = Binder.clearCallingIdentity();
- updateConfigurationLocked(values, null, true);
+ updateConfigurationLocked(values, null, true, false);
Binder.restoreCallingIdentity(origId);
}
}
@@ -12861,7 +12861,7 @@ public final class ActivityManagerService extends ActivityManagerNative
if (values != null) {
Settings.System.clearConfiguration(values);
}
- updateConfigurationLocked(values, null, false);
+ updateConfigurationLocked(values, null, false, false);
Binder.restoreCallingIdentity(origId);
}
}
@@ -12875,7 +12875,7 @@ public final class ActivityManagerService extends ActivityManagerNative
* @param persistent TODO
*/
public boolean updateConfigurationLocked(Configuration values,
- ActivityRecord starting, boolean persistent) {
+ ActivityRecord starting, boolean persistent, boolean initLocale) {
int changes = 0;
boolean kept = true;
@@ -12890,7 +12890,7 @@ public final class ActivityManagerService extends ActivityManagerNative
EventLog.writeEvent(EventLogTags.CONFIGURATION_CHANGED, changes);
- if (values.locale != null) {
+ if (values.locale != null && !initLocale) {
saveLocaleLocked(values.locale,
!values.locale.equals(mConfiguration.locale),
values.userSetLocale);
@@ -12903,10 +12903,12 @@ public final class ActivityManagerService extends ActivityManagerNative
newConfig.seq = mConfigurationSeq;
mConfiguration = newConfig;
Slog.i(TAG, "Config changed: " + newConfig);
-
+
+ final Configuration configCopy = new Configuration(mConfiguration);
+
AttributeCache ac = AttributeCache.instance();
if (ac != null) {
- ac.updateConfiguration(mConfiguration);
+ ac.updateConfiguration(configCopy);
}
// Make sure all resources in our process are updated
@@ -12916,11 +12918,11 @@ public final class ActivityManagerService extends ActivityManagerNative
// boot, where the first config change needs to guarantee
// all resources have that config before following boot
// code is executed.
- mSystemThread.applyConfigurationToResources(newConfig);
+ mSystemThread.applyConfigurationToResources(configCopy);
if (persistent && Settings.System.hasInterestingConfigurationChanges(changes)) {
Message msg = mHandler.obtainMessage(UPDATE_CONFIGURATION_MSG);
- msg.obj = new Configuration(mConfiguration);
+ msg.obj = new Configuration(configCopy);
mHandler.sendMessage(msg);
}
@@ -12930,7 +12932,7 @@ public final class ActivityManagerService extends ActivityManagerNative
if (app.thread != null) {
if (DEBUG_CONFIGURATION) Slog.v(TAG, "Sending to proc "
+ app.processName + " new config " + mConfiguration);
- app.thread.scheduleConfigurationChanged(mConfiguration);
+ app.thread.scheduleConfigurationChanged(configCopy);
}
} catch (Exception e) {
}
diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java
index 28c3bae..ecb60c7 100644
--- a/services/java/com/android/server/am/ActivityStack.java
+++ b/services/java/com/android/server/am/ActivityStack.java
@@ -529,7 +529,7 @@ final class ActivityStack {
Configuration config = mService.mWindowManager.updateOrientationFromAppTokens(
mService.mConfiguration,
r.mayFreezeScreenLocked(app) ? r : null);
- mService.updateConfigurationLocked(config, r, false);
+ mService.updateConfigurationLocked(config, r, false, false);
}
r.app = app;
@@ -591,7 +591,8 @@ final class ActivityStack {
}
}
app.thread.scheduleLaunchActivity(new Intent(r.intent), r,
- System.identityHashCode(r), r.info, mService.mConfiguration,
+ System.identityHashCode(r), r.info,
+ new Configuration(mService.mConfiguration),
r.compat, r.icicle, results, newIntents, !andResume,
mService.isNextTransitionForward(), profileFile, profileFd,
profileAutoStop);
@@ -1453,7 +1454,7 @@ final class ActivityStack {
if (config != null) {
next.frozenBeforeDestroy = true;
}
- updated = mService.updateConfigurationLocked(config, next, false);
+ updated = mService.updateConfigurationLocked(config, next, false, false);
}
}
if (!updated) {
@@ -2900,7 +2901,7 @@ final class ActivityStack {
mConfigWillChange = false;
if (DEBUG_CONFIGURATION) Slog.v(TAG,
"Updating to new configuration after starting activity.");
- mService.updateConfigurationLocked(config, null, false);
+ mService.updateConfigurationLocked(config, null, false, false);
}
Binder.restoreCallingIdentity(origId);
@@ -4171,7 +4172,7 @@ final class ActivityStack {
if (DEBUG_SWITCH) Slog.i(TAG, "Switch is restarting resumed " + r);
r.forceNewConfig = false;
r.app.thread.scheduleRelaunchActivity(r, results, newIntents,
- changes, !andResume, mService.mConfiguration);
+ changes, !andResume, new Configuration(mService.mConfiguration));
// Note: don't need to call pauseIfSleepingLocked() here, because
// the caller will only pass in 'andResume' if this activity is
// currently resumed, which implies we aren't sleeping.