Loading services/core/java/com/android/server/am/ActivityManagerService.java +32 −10 Original line number Diff line number Diff line Loading @@ -1586,7 +1586,8 @@ public final class ActivityManagerService extends ActivityManagerNative switch (msg.what) { case UPDATE_CONFIGURATION_MSG: { final ContentResolver resolver = mContext.getContentResolver(); Settings.System.putConfiguration(resolver, (Configuration) msg.obj); Settings.System.putConfigurationForUser(resolver, (Configuration) msg.obj, msg.arg1); } break; case GC_BACKGROUND_PROCESSES_MSG: { synchronized (ActivityManagerService.this) { Loading Loading @@ -4121,7 +4122,7 @@ public final class ActivityManagerService extends ActivityManagerNative mConfiguration, r.mayFreezeScreenLocked(r.app) ? r.appToken : null); if (config != null) { r.frozenBeforeDestroy = true; if (!updateConfigurationLocked(config, r, false, false)) { if (!updateConfigurationLocked(config, r, false)) { mStackSupervisor.resumeTopActivitiesLocked(); } } Loading Loading @@ -11250,7 +11251,7 @@ public final class ActivityManagerService extends ActivityManagerNative mAlwaysFinishActivities = alwaysFinishActivities; // This happens before any activities are started, so we can // change mConfiguration in-place. updateConfigurationLocked(configuration, null, false, true); updateConfigurationLocked(configuration, null, true); if (DEBUG_CONFIGURATION) Slog.v(TAG_CONFIGURATION, "Initial config: " + mConfiguration); } Loading Loading @@ -16981,6 +16982,7 @@ public final class ActivityManagerService extends ActivityManagerNative return ci; } @Override public void updatePersistentConfiguration(Configuration values) { enforceCallingPermission(android.Manifest.permission.CHANGE_CONFIGURATION, "updateConfiguration()"); Loading @@ -16990,9 +16992,11 @@ public final class ActivityManagerService extends ActivityManagerNative throw new NullPointerException("Configuration must not be null"); } int userId = UserHandle.getCallingUserId(); synchronized(this) { final long origId = Binder.clearCallingIdentity(); updateConfigurationLocked(values, null, true, false); updateConfigurationLocked(values, null, false, true, userId); Binder.restoreCallingIdentity(origId); } } Loading @@ -17015,21 +17019,30 @@ public final class ActivityManagerService extends ActivityManagerNative if (values != null) { Settings.System.clearConfiguration(values); } updateConfigurationLocked(values, null, false, false); updateConfigurationLocked(values, null, false); Binder.restoreCallingIdentity(origId); } } boolean updateConfigurationLocked(Configuration values, ActivityRecord starting, boolean initLocale) { // pass UserHandle.USER_NULL as userId because we don't persist configuration for any user return updateConfigurationLocked(values, starting, initLocale, false, UserHandle.USER_NULL); } /** * Do either or both things: (1) change the current configuration, and (2) * make sure the given activity is running with the (now) current * configuration. Returns true if the activity has been left running, or * false if <var>starting</var> is being destroyed to match the new * configuration. * @param persistent TODO * * @param userId is only used when persistent parameter is set to true to persist configuration * for that particular user */ boolean updateConfigurationLocked(Configuration values, ActivityRecord starting, boolean persistent, boolean initLocale) { ActivityRecord starting, boolean initLocale, boolean persistent, int userId) { int changes = 0; if (values != null) { Loading Loading @@ -17081,6 +17094,7 @@ public final class ActivityManagerService extends ActivityManagerNative if (persistent && Settings.System.hasInterestingConfigurationChanges(changes)) { Message msg = mHandler.obtainMessage(UPDATE_CONFIGURATION_MSG); msg.obj = new Configuration(configCopy); msg.arg1 = userId; mHandler.sendMessage(msg); } Loading Loading @@ -19502,6 +19516,7 @@ public final class ActivityManagerService extends ActivityManagerNative if (foreground) { mCurrentUserId = userId; updateUserConfigurationLocked(); mTargetUserId = UserHandle.USER_NULL; // reset, mCurrentUserId has caught up updateCurrentProfileIdsLocked(); mWindowManager.setCurrentUser(userId, mCurrentProfileIds); Loading Loading @@ -19586,7 +19601,7 @@ public final class ActivityManagerService extends ActivityManagerNative if (foreground) { if (!uss.initializing) { moveUserToForeground(uss, oldUserId, userId); moveUserToForegroundLocked(uss, oldUserId, userId); } } else { mStackSupervisor.startBackgroundUserLocked(userId, uss); Loading Loading @@ -19728,14 +19743,14 @@ public final class ActivityManagerService extends ActivityManagerNative void onUserInitialized(UserStartedState uss, boolean foreground, int oldUserId, int newUserId) { synchronized (this) { if (foreground) { moveUserToForeground(uss, oldUserId, newUserId); moveUserToForegroundLocked(uss, oldUserId, newUserId); } } completeSwitchAndInitalize(uss, newUserId, true, false); } void moveUserToForeground(UserStartedState uss, int oldUserId, int newUserId) { void moveUserToForegroundLocked(UserStartedState uss, int oldUserId, int newUserId) { boolean homeInFront = mStackSupervisor.switchUserLocked(newUserId, uss); if (homeInFront) { startHomeActivityLocked(newUserId, "moveUserToFroreground"); Loading @@ -19747,6 +19762,13 @@ public final class ActivityManagerService extends ActivityManagerNative sendUserSwitchBroadcastsLocked(oldUserId, newUserId); } private void updateUserConfigurationLocked() { Configuration configuration = new Configuration(mConfiguration); Settings.System.getConfigurationForUser(mContext.getContentResolver(), configuration, mCurrentUserId); updateConfigurationLocked(configuration, null, false); } void continueUserSwitch(UserStartedState uss, int oldUserId, int newUserId) { completeSwitchAndInitalize(uss, newUserId, false, true); } services/core/java/com/android/server/am/ActivityStack.java +1 −1 Original line number Diff line number Diff line Loading @@ -1883,7 +1883,7 @@ final class ActivityStack { if (config != null) { next.frozenBeforeDestroy = true; } notUpdated = !mService.updateConfigurationLocked(config, next, false, false); notUpdated = !mService.updateConfigurationLocked(config, next, false); } if (notUpdated) { Loading services/core/java/com/android/server/am/ActivityStackSupervisor.java +2 −2 Original line number Diff line number Diff line Loading @@ -1028,7 +1028,7 @@ public final class ActivityStackSupervisor implements DisplayListener { stack.mConfigWillChange = false; if (DEBUG_CONFIGURATION) Slog.v(TAG_CONFIGURATION, "Updating to new configuration after starting activity."); mService.updateConfigurationLocked(config, null, false, false); mService.updateConfigurationLocked(config, null, false); } if (outResult != null) { Loading Loading @@ -1166,7 +1166,7 @@ public final class ActivityStackSupervisor implements DisplayListener { Configuration config = mWindowManager.updateOrientationFromAppTokens( mService.mConfiguration, r.mayFreezeScreenLocked(app) ? r.appToken : null); mService.updateConfigurationLocked(config, r, false, false); mService.updateConfigurationLocked(config, r, false); } r.app = app; Loading Loading
services/core/java/com/android/server/am/ActivityManagerService.java +32 −10 Original line number Diff line number Diff line Loading @@ -1586,7 +1586,8 @@ public final class ActivityManagerService extends ActivityManagerNative switch (msg.what) { case UPDATE_CONFIGURATION_MSG: { final ContentResolver resolver = mContext.getContentResolver(); Settings.System.putConfiguration(resolver, (Configuration) msg.obj); Settings.System.putConfigurationForUser(resolver, (Configuration) msg.obj, msg.arg1); } break; case GC_BACKGROUND_PROCESSES_MSG: { synchronized (ActivityManagerService.this) { Loading Loading @@ -4121,7 +4122,7 @@ public final class ActivityManagerService extends ActivityManagerNative mConfiguration, r.mayFreezeScreenLocked(r.app) ? r.appToken : null); if (config != null) { r.frozenBeforeDestroy = true; if (!updateConfigurationLocked(config, r, false, false)) { if (!updateConfigurationLocked(config, r, false)) { mStackSupervisor.resumeTopActivitiesLocked(); } } Loading Loading @@ -11250,7 +11251,7 @@ public final class ActivityManagerService extends ActivityManagerNative mAlwaysFinishActivities = alwaysFinishActivities; // This happens before any activities are started, so we can // change mConfiguration in-place. updateConfigurationLocked(configuration, null, false, true); updateConfigurationLocked(configuration, null, true); if (DEBUG_CONFIGURATION) Slog.v(TAG_CONFIGURATION, "Initial config: " + mConfiguration); } Loading Loading @@ -16981,6 +16982,7 @@ public final class ActivityManagerService extends ActivityManagerNative return ci; } @Override public void updatePersistentConfiguration(Configuration values) { enforceCallingPermission(android.Manifest.permission.CHANGE_CONFIGURATION, "updateConfiguration()"); Loading @@ -16990,9 +16992,11 @@ public final class ActivityManagerService extends ActivityManagerNative throw new NullPointerException("Configuration must not be null"); } int userId = UserHandle.getCallingUserId(); synchronized(this) { final long origId = Binder.clearCallingIdentity(); updateConfigurationLocked(values, null, true, false); updateConfigurationLocked(values, null, false, true, userId); Binder.restoreCallingIdentity(origId); } } Loading @@ -17015,21 +17019,30 @@ public final class ActivityManagerService extends ActivityManagerNative if (values != null) { Settings.System.clearConfiguration(values); } updateConfigurationLocked(values, null, false, false); updateConfigurationLocked(values, null, false); Binder.restoreCallingIdentity(origId); } } boolean updateConfigurationLocked(Configuration values, ActivityRecord starting, boolean initLocale) { // pass UserHandle.USER_NULL as userId because we don't persist configuration for any user return updateConfigurationLocked(values, starting, initLocale, false, UserHandle.USER_NULL); } /** * Do either or both things: (1) change the current configuration, and (2) * make sure the given activity is running with the (now) current * configuration. Returns true if the activity has been left running, or * false if <var>starting</var> is being destroyed to match the new * configuration. * @param persistent TODO * * @param userId is only used when persistent parameter is set to true to persist configuration * for that particular user */ boolean updateConfigurationLocked(Configuration values, ActivityRecord starting, boolean persistent, boolean initLocale) { ActivityRecord starting, boolean initLocale, boolean persistent, int userId) { int changes = 0; if (values != null) { Loading Loading @@ -17081,6 +17094,7 @@ public final class ActivityManagerService extends ActivityManagerNative if (persistent && Settings.System.hasInterestingConfigurationChanges(changes)) { Message msg = mHandler.obtainMessage(UPDATE_CONFIGURATION_MSG); msg.obj = new Configuration(configCopy); msg.arg1 = userId; mHandler.sendMessage(msg); } Loading Loading @@ -19502,6 +19516,7 @@ public final class ActivityManagerService extends ActivityManagerNative if (foreground) { mCurrentUserId = userId; updateUserConfigurationLocked(); mTargetUserId = UserHandle.USER_NULL; // reset, mCurrentUserId has caught up updateCurrentProfileIdsLocked(); mWindowManager.setCurrentUser(userId, mCurrentProfileIds); Loading Loading @@ -19586,7 +19601,7 @@ public final class ActivityManagerService extends ActivityManagerNative if (foreground) { if (!uss.initializing) { moveUserToForeground(uss, oldUserId, userId); moveUserToForegroundLocked(uss, oldUserId, userId); } } else { mStackSupervisor.startBackgroundUserLocked(userId, uss); Loading Loading @@ -19728,14 +19743,14 @@ public final class ActivityManagerService extends ActivityManagerNative void onUserInitialized(UserStartedState uss, boolean foreground, int oldUserId, int newUserId) { synchronized (this) { if (foreground) { moveUserToForeground(uss, oldUserId, newUserId); moveUserToForegroundLocked(uss, oldUserId, newUserId); } } completeSwitchAndInitalize(uss, newUserId, true, false); } void moveUserToForeground(UserStartedState uss, int oldUserId, int newUserId) { void moveUserToForegroundLocked(UserStartedState uss, int oldUserId, int newUserId) { boolean homeInFront = mStackSupervisor.switchUserLocked(newUserId, uss); if (homeInFront) { startHomeActivityLocked(newUserId, "moveUserToFroreground"); Loading @@ -19747,6 +19762,13 @@ public final class ActivityManagerService extends ActivityManagerNative sendUserSwitchBroadcastsLocked(oldUserId, newUserId); } private void updateUserConfigurationLocked() { Configuration configuration = new Configuration(mConfiguration); Settings.System.getConfigurationForUser(mContext.getContentResolver(), configuration, mCurrentUserId); updateConfigurationLocked(configuration, null, false); } void continueUserSwitch(UserStartedState uss, int oldUserId, int newUserId) { completeSwitchAndInitalize(uss, newUserId, false, true); }
services/core/java/com/android/server/am/ActivityStack.java +1 −1 Original line number Diff line number Diff line Loading @@ -1883,7 +1883,7 @@ final class ActivityStack { if (config != null) { next.frozenBeforeDestroy = true; } notUpdated = !mService.updateConfigurationLocked(config, next, false, false); notUpdated = !mService.updateConfigurationLocked(config, next, false); } if (notUpdated) { Loading
services/core/java/com/android/server/am/ActivityStackSupervisor.java +2 −2 Original line number Diff line number Diff line Loading @@ -1028,7 +1028,7 @@ public final class ActivityStackSupervisor implements DisplayListener { stack.mConfigWillChange = false; if (DEBUG_CONFIGURATION) Slog.v(TAG_CONFIGURATION, "Updating to new configuration after starting activity."); mService.updateConfigurationLocked(config, null, false, false); mService.updateConfigurationLocked(config, null, false); } if (outResult != null) { Loading Loading @@ -1166,7 +1166,7 @@ public final class ActivityStackSupervisor implements DisplayListener { Configuration config = mWindowManager.updateOrientationFromAppTokens( mService.mConfiguration, r.mayFreezeScreenLocked(app) ? r.appToken : null); mService.updateConfigurationLocked(config, r, false, false); mService.updateConfigurationLocked(config, r, false); } r.app = app; Loading