Merge commit 'e2522466552f9c6b7fcea866709710f53aa1f2a8' into froyo-plus-aosp * commit 'e2522466552f9c6b7fcea866709710f53aa1f2a8': Fix issue #2547337: switching night modes
This commit is contained in:
@@ -484,6 +484,7 @@ class UiModeManagerService extends IUiModeManager.Stub {
|
|||||||
Intent intent = new Intent(Intent.ACTION_MAIN);
|
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||||
intent.addCategory(Intent.CATEGORY_HOME);
|
intent.addCategory(Intent.CATEGORY_HOME);
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
mHoldingConfiguration = false;
|
||||||
updateConfigurationLocked(false);
|
updateConfigurationLocked(false);
|
||||||
ActivityManagerNative.getDefault().startActivityWithConfig(
|
ActivityManagerNative.getDefault().startActivityWithConfig(
|
||||||
null, intent, null, null, 0, null, null, 0, false, false,
|
null, intent, null, null, 0, null, null, 0, false, false,
|
||||||
|
|||||||
@@ -3670,6 +3670,8 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
|
|||||||
}
|
}
|
||||||
|
|
||||||
mConfigWillChange = config != null && mConfiguration.diff(config) != 0;
|
mConfigWillChange = config != null && mConfiguration.diff(config) != 0;
|
||||||
|
if (DEBUG_CONFIGURATION) Slog.v(TAG,
|
||||||
|
"Starting activity when config will change = " + mConfigWillChange);
|
||||||
|
|
||||||
final long origId = Binder.clearCallingIdentity();
|
final long origId = Binder.clearCallingIdentity();
|
||||||
|
|
||||||
@@ -3678,13 +3680,16 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
|
|||||||
resultTo, resultWho, requestCode, callingPid, callingUid,
|
resultTo, resultWho, requestCode, callingPid, callingUid,
|
||||||
onlyIfNeeded, componentSpecified);
|
onlyIfNeeded, componentSpecified);
|
||||||
|
|
||||||
if (config != null && mConfigWillChange) {
|
if (mConfigWillChange) {
|
||||||
// If the caller also wants to switch to a new configuration,
|
// If the caller also wants to switch to a new configuration,
|
||||||
// do so now. This allows a clean switch, as we are waiting
|
// do so now. This allows a clean switch, as we are waiting
|
||||||
// for the current activity to pause (so we will not destroy
|
// for the current activity to pause (so we will not destroy
|
||||||
// it), and have not yet started the next activity.
|
// it), and have not yet started the next activity.
|
||||||
enforceCallingPermission(android.Manifest.permission.CHANGE_CONFIGURATION,
|
enforceCallingPermission(android.Manifest.permission.CHANGE_CONFIGURATION,
|
||||||
"updateConfiguration()");
|
"updateConfiguration()");
|
||||||
|
mConfigWillChange = false;
|
||||||
|
if (DEBUG_CONFIGURATION) Slog.v(TAG,
|
||||||
|
"Updating to new configuration after starting activity.");
|
||||||
updateConfigurationLocked(config, null);
|
updateConfigurationLocked(config, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -13493,7 +13498,7 @@ public final class ActivityManagerService extends ActivityManagerNative implemen
|
|||||||
*/
|
*/
|
||||||
private final boolean ensureActivityConfigurationLocked(HistoryRecord r,
|
private final boolean ensureActivityConfigurationLocked(HistoryRecord r,
|
||||||
int globalChanges) {
|
int globalChanges) {
|
||||||
if (!mConfigWillChange) {
|
if (mConfigWillChange) {
|
||||||
if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Slog.v(TAG,
|
if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Slog.v(TAG,
|
||||||
"Skipping config check (will change): " + r);
|
"Skipping config check (will change): " + r);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user