Merge "Maybe fix issue #5405788: Device continuously opening and closing..." into ics-mr1
This commit is contained in:
committed by
Android (Google) Code Review
commit
f10a536460
@ -1479,6 +1479,7 @@ public final class ActivityManagerService extends ActivityManagerNative
|
||||
|
||||
mConfiguration.setToDefaults();
|
||||
mConfiguration.locale = Locale.getDefault();
|
||||
mConfigurationSeq = mConfiguration.seq = 1;
|
||||
mProcessStats.init();
|
||||
|
||||
mCompatModePackages = new CompatModePackages(this, systemDir);
|
||||
@ -2436,7 +2437,7 @@ public final class ActivityManagerService extends ActivityManagerNative
|
||||
r.mayFreezeScreenLocked(r.app) ? r.appToken : null);
|
||||
if (config != null) {
|
||||
r.frozenBeforeDestroy = true;
|
||||
if (!updateConfigurationLocked(config, r, false)) {
|
||||
if (!updateConfigurationLocked(config, r, false, false)) {
|
||||
mMainStack.resumeTopActivityLocked(null);
|
||||
}
|
||||
}
|
||||
@ -3797,7 +3798,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();
|
||||
@ -6707,8 +6708,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);
|
||||
}
|
||||
}
|
||||
@ -12934,7 +12934,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);
|
||||
}
|
||||
}
|
||||
@ -12957,7 +12957,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);
|
||||
}
|
||||
}
|
||||
@ -12971,7 +12971,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;
|
||||
@ -12986,7 +12986,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);
|
||||
@ -12999,10 +12999,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
|
||||
@ -13012,11 +13014,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);
|
||||
}
|
||||
|
||||
@ -13026,7 +13028,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) {
|
||||
}
|
||||
|
@ -528,7 +528,7 @@ final class ActivityStack {
|
||||
Configuration config = mService.mWindowManager.updateOrientationFromAppTokens(
|
||||
mService.mConfiguration,
|
||||
r.mayFreezeScreenLocked(app) ? r.appToken : null);
|
||||
mService.updateConfigurationLocked(config, r, false);
|
||||
mService.updateConfigurationLocked(config, r, false, false);
|
||||
}
|
||||
|
||||
r.app = app;
|
||||
@ -590,7 +590,8 @@ final class ActivityStack {
|
||||
}
|
||||
}
|
||||
app.thread.scheduleLaunchActivity(new Intent(r.intent), r.appToken,
|
||||
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);
|
||||
@ -1460,7 +1461,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) {
|
||||
@ -2917,7 +2918,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);
|
||||
@ -4190,7 +4191,7 @@ final class ActivityStack {
|
||||
if (DEBUG_SWITCH) Slog.i(TAG, "Switch is restarting resumed " + r);
|
||||
r.forceNewConfig = false;
|
||||
r.app.thread.scheduleRelaunchActivity(r.appToken, 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.
|
||||
|
Reference in New Issue
Block a user