Loading core/res/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -2073,6 +2073,9 @@ <!-- Maximum number of supported users --> <integer name="config_multiuserMaximumUsers">1</integer> <!-- Maximum number of users we allow to be running at a time --> <integer name="config_multiuserMaxRunningUsers">3</integer> <!-- Whether UI for multi user should be shown --> <bool name="config_enableMultiUserUI">false</bool> Loading core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -445,6 +445,7 @@ <java-symbol type="integer" name="config_soundEffectVolumeDb" /> <java-symbol type="integer" name="config_lockSoundVolumeDb" /> <java-symbol type="integer" name="config_multiuserMaximumUsers" /> <java-symbol type="integer" name="config_multiuserMaxRunningUsers" /> <java-symbol type="integer" name="config_safe_media_volume_index" /> <java-symbol type="integer" name="config_mobile_mtu" /> <java-symbol type="array" name="config_mobile_tcp_buffers" /> Loading services/core/java/com/android/server/am/ActivityManagerService.java +3 −0 Original line number Diff line number Diff line Loading @@ -13944,6 +13944,9 @@ public class ActivityManagerService extends IActivityManager.Stub com.android.internal.R.string.config_appsNotReportingCrashes)); mUserController.mUserSwitchUiEnabled = !res.getBoolean( com.android.internal.R.bool.config_customUserSwitchUi); mUserController.mMaxRunningUsers = res.getInteger( com.android.internal.R.integer.config_multiuserMaxRunningUsers); if ((globalConfig.uiMode & UI_MODE_TYPE_TELEVISION) == UI_MODE_TYPE_TELEVISION) { mFullscreenThumbnailScale = (float) res .getInteger(com.android.internal.R.integer.thumbnail_width_tv) / services/core/java/com/android/server/am/UserController.java +13 −16 Original line number Diff line number Diff line Loading @@ -117,20 +117,6 @@ import java.util.concurrent.atomic.AtomicInteger; class UserController implements Handler.Callback { private static final String TAG = TAG_WITH_CLASS_NAME ? "UserController" : TAG_AM; /** * Maximum number of users we allow to be running at a time, including the system user and * its profiles. * Note changing this to 2 is not recommended, since that would mean, if the user uses * work profile and then switch to a secondary user, then the work profile user would be killed, * which should work fine, but aggressively killing the work profile user that has just been * running could cause data loss. (Even without work profile, witching from secondary user A * to secondary user B would cause similar issues on user B.) * * TODO: Consider adding or replacing with "MAX_RUNNING_*SECONDARY*_USERS", which is the max * number of running *secondary, switchable* users. */ static final int MAX_RUNNING_USERS = 3; // Amount of time we wait for observers to handle a user switch before // giving up on them and unfreezing the screen. static final int USER_SWITCH_TIMEOUT_MS = 3 * 1000; Loading @@ -157,6 +143,17 @@ class UserController implements Handler.Callback { // when it never calls back. private static final int USER_SWITCH_CALLBACKS_TIMEOUT_MS = 5 * 1000; /** * Maximum number of users we allow to be running at a time, including system user. * * <p>This parameter only affects how many background users will be stopped when switching to a * new user. It has no impact on {@link #startUser(int, boolean)} behavior. * * <p>Note: Current and system user (and their related profiles) are never stopped when * switching users. Due to that, the actual number of running users can exceed mMaxRunningUsers */ int mMaxRunningUsers; // Lock for internal state. private final Object mLock = new Object(); Loading Loading @@ -245,7 +242,7 @@ class UserController implements Handler.Callback { finishUserBoot(uss); startProfiles(); synchronized (mLock) { stopRunningUsersLU(MAX_RUNNING_USERS); stopRunningUsersLU(mMaxRunningUsers); } } Loading Loading @@ -813,7 +810,7 @@ class UserController implements Handler.Callback { } final int profilesToStartSize = profilesToStart.size(); int i = 0; for (; i < profilesToStartSize && i < (MAX_RUNNING_USERS - 1); ++i) { for (; i < profilesToStartSize && i < (mMaxRunningUsers - 1); ++i) { startUser(profilesToStart.get(i).id, /* foreground= */ false); } if (i < profilesToStartSize) { Loading Loading
core/res/res/values/config.xml +3 −0 Original line number Diff line number Diff line Loading @@ -2073,6 +2073,9 @@ <!-- Maximum number of supported users --> <integer name="config_multiuserMaximumUsers">1</integer> <!-- Maximum number of users we allow to be running at a time --> <integer name="config_multiuserMaxRunningUsers">3</integer> <!-- Whether UI for multi user should be shown --> <bool name="config_enableMultiUserUI">false</bool> Loading
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -445,6 +445,7 @@ <java-symbol type="integer" name="config_soundEffectVolumeDb" /> <java-symbol type="integer" name="config_lockSoundVolumeDb" /> <java-symbol type="integer" name="config_multiuserMaximumUsers" /> <java-symbol type="integer" name="config_multiuserMaxRunningUsers" /> <java-symbol type="integer" name="config_safe_media_volume_index" /> <java-symbol type="integer" name="config_mobile_mtu" /> <java-symbol type="array" name="config_mobile_tcp_buffers" /> Loading
services/core/java/com/android/server/am/ActivityManagerService.java +3 −0 Original line number Diff line number Diff line Loading @@ -13944,6 +13944,9 @@ public class ActivityManagerService extends IActivityManager.Stub com.android.internal.R.string.config_appsNotReportingCrashes)); mUserController.mUserSwitchUiEnabled = !res.getBoolean( com.android.internal.R.bool.config_customUserSwitchUi); mUserController.mMaxRunningUsers = res.getInteger( com.android.internal.R.integer.config_multiuserMaxRunningUsers); if ((globalConfig.uiMode & UI_MODE_TYPE_TELEVISION) == UI_MODE_TYPE_TELEVISION) { mFullscreenThumbnailScale = (float) res .getInteger(com.android.internal.R.integer.thumbnail_width_tv) /
services/core/java/com/android/server/am/UserController.java +13 −16 Original line number Diff line number Diff line Loading @@ -117,20 +117,6 @@ import java.util.concurrent.atomic.AtomicInteger; class UserController implements Handler.Callback { private static final String TAG = TAG_WITH_CLASS_NAME ? "UserController" : TAG_AM; /** * Maximum number of users we allow to be running at a time, including the system user and * its profiles. * Note changing this to 2 is not recommended, since that would mean, if the user uses * work profile and then switch to a secondary user, then the work profile user would be killed, * which should work fine, but aggressively killing the work profile user that has just been * running could cause data loss. (Even without work profile, witching from secondary user A * to secondary user B would cause similar issues on user B.) * * TODO: Consider adding or replacing with "MAX_RUNNING_*SECONDARY*_USERS", which is the max * number of running *secondary, switchable* users. */ static final int MAX_RUNNING_USERS = 3; // Amount of time we wait for observers to handle a user switch before // giving up on them and unfreezing the screen. static final int USER_SWITCH_TIMEOUT_MS = 3 * 1000; Loading @@ -157,6 +143,17 @@ class UserController implements Handler.Callback { // when it never calls back. private static final int USER_SWITCH_CALLBACKS_TIMEOUT_MS = 5 * 1000; /** * Maximum number of users we allow to be running at a time, including system user. * * <p>This parameter only affects how many background users will be stopped when switching to a * new user. It has no impact on {@link #startUser(int, boolean)} behavior. * * <p>Note: Current and system user (and their related profiles) are never stopped when * switching users. Due to that, the actual number of running users can exceed mMaxRunningUsers */ int mMaxRunningUsers; // Lock for internal state. private final Object mLock = new Object(); Loading Loading @@ -245,7 +242,7 @@ class UserController implements Handler.Callback { finishUserBoot(uss); startProfiles(); synchronized (mLock) { stopRunningUsersLU(MAX_RUNNING_USERS); stopRunningUsersLU(mMaxRunningUsers); } } Loading Loading @@ -813,7 +810,7 @@ class UserController implements Handler.Callback { } final int profilesToStartSize = profilesToStart.size(); int i = 0; for (; i < profilesToStartSize && i < (MAX_RUNNING_USERS - 1); ++i) { for (; i < profilesToStartSize && i < (mMaxRunningUsers - 1); ++i) { startUser(profilesToStart.get(i).id, /* foreground= */ false); } if (i < profilesToStartSize) { Loading