Loading core/api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -2073,6 +2073,7 @@ package android.os { method @NonNull @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS}) public java.util.List<android.content.pm.UserInfo> getUsers(boolean, boolean, boolean); method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS}) public boolean hasBaseUserRestriction(@NonNull String, @NonNull android.os.UserHandle); method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS}) public boolean isUserTypeEnabled(@NonNull String); method public boolean isVisibleBackgroundUsersOnDefaultDisplaySupported(); method public boolean isVisibleBackgroundUsersSupported(); method @NonNull @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS}) public android.content.pm.UserInfo preCreateUser(@NonNull String) throws android.os.UserManager.UserOperationException; } Loading core/java/android/os/UserManager.java +23 −0 Original line number Diff line number Diff line Loading @@ -2975,6 +2975,29 @@ public class UserManager { return isVisibleBackgroundUsersEnabled(); } /** * @hide */ public static boolean isVisibleBackgroundUsersOnDefaultDisplayEnabled() { return SystemProperties.getBoolean("fw.visible_bg_users_on_default_display", Resources.getSystem() .getBoolean(R.bool.config_multiuserVisibleBackgroundUsersOnDefaultDisplay)); } /** * Returns whether the device allows (full) users to be started in background visible in the * {@link android.view.Display#DEFAULT_DISPLAY default display}. * * @return {@code false} for most devices, except passenger-only automotive build (i.e., when * Android runs in a separate system in the back seat to manage the passenger displays). * * @hide */ @TestApi public boolean isVisibleBackgroundUsersOnDefaultDisplaySupported() { return isVisibleBackgroundUsersOnDefaultDisplayEnabled(); } /** * Checks if the user is visible at the moment. * Loading core/res/res/values/config.xml +5 −0 Original line number Diff line number Diff line Loading @@ -2735,6 +2735,11 @@ Should be false for most devices, except automotive vehicle with passenger displays. --> <bool name="config_multiuserVisibleBackgroundUsers">false</bool> <!-- Whether the device allows users to start in background visible on the default display. Should be false for most devices, except passenger-only automotive build (i.e., when Android runs in a separate system in the back seat to manage the passenger displays) --> <bool name="config_multiuserVisibleBackgroundUsersOnDefaultDisplay">false</bool> <!-- Whether to automatically switch to the designated Dock User (the user chosen for displaying dreams, etc.) after a timeout when the device is docked. --> <bool name="config_enableTimeoutToDockUserWhenDocked">false</bool> Loading core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -473,6 +473,7 @@ <java-symbol type="integer" name="config_multiuserMaxRunningUsers" /> <java-symbol type="bool" name="config_multiuserDelayUserDataLocking" /> <java-symbol type="bool" name="config_multiuserVisibleBackgroundUsers" /> <java-symbol type="bool" name="config_multiuserVisibleBackgroundUsersOnDefaultDisplay" /> <java-symbol type="bool" name="config_enableTimeoutToDockUserWhenDocked" /> <java-symbol type="integer" name="config_userTypePackageWhitelistMode"/> <java-symbol type="xml" name="config_user_types" /> Loading services/core/java/com/android/server/am/ActivityManagerService.java +15 −8 Original line number Diff line number Diff line Loading @@ -18974,14 +18974,20 @@ public class ActivityManagerService extends IActivityManager.Stub return null; } // Starts with all displays but DEFAULT_DISPLAY int[] displayIds = new int[allDisplays.length - 1]; boolean allowOnDefaultDisplay = UserManager .isVisibleBackgroundUsersOnDefaultDisplayEnabled(); int displaysSize = allDisplays.length; if (!allowOnDefaultDisplay) { displaysSize--; } int[] displayIds = new int[displaysSize]; // TODO(b/247592632): check for other properties like isSecure or proper display type int numberValidDisplays = 0; for (Display display : allDisplays) { int displayId = display.getDisplayId(); if (display.isValid() && displayId != Display.DEFAULT_DISPLAY) { // TODO(b/247592632): check other properties like isSecure or proper display type if (display.isValid() && (allowOnDefaultDisplay || displayId != Display.DEFAULT_DISPLAY)) { displayIds[numberValidDisplays++] = displayId; } } Loading @@ -18993,14 +18999,15 @@ public class ActivityManagerService extends IActivityManager.Stub // STOPSHIP: if not removed, it should at least be unit tested String testingProp = "fw.display_ids_for_starting_users_for_testing_purposes"; int displayId = SystemProperties.getInt(testingProp, Display.DEFAULT_DISPLAY); if (displayId != Display.DEFAULT_DISPLAY && displayId > 0) { Slogf.w(TAG, "getSecondaryDisplayIdsForStartingBackgroundUsers(): no valid " if (allowOnDefaultDisplay && displayId == Display.DEFAULT_DISPLAY || displayId > 0) { Slogf.w(TAG, "getDisplayIdsForStartingVisibleBackgroundUsers(): no valid " + "display found, but returning %d as set by property %s", displayId, testingProp); return new int[] { displayId }; } Slogf.e(TAG, "getDisplayIdsForStartingBackgroundUsers(): no valid display on %s", Arrays.toString(allDisplays)); Slogf.e(TAG, "getDisplayIdsForStartingVisibleBackgroundUsers(): no valid display" + " on %s", Arrays.toString(allDisplays)); return null; } Loading
core/api/test-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -2073,6 +2073,7 @@ package android.os { method @NonNull @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS}) public java.util.List<android.content.pm.UserInfo> getUsers(boolean, boolean, boolean); method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS}) public boolean hasBaseUserRestriction(@NonNull String, @NonNull android.os.UserHandle); method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS}) public boolean isUserTypeEnabled(@NonNull String); method public boolean isVisibleBackgroundUsersOnDefaultDisplaySupported(); method public boolean isVisibleBackgroundUsersSupported(); method @NonNull @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS}) public android.content.pm.UserInfo preCreateUser(@NonNull String) throws android.os.UserManager.UserOperationException; } Loading
core/java/android/os/UserManager.java +23 −0 Original line number Diff line number Diff line Loading @@ -2975,6 +2975,29 @@ public class UserManager { return isVisibleBackgroundUsersEnabled(); } /** * @hide */ public static boolean isVisibleBackgroundUsersOnDefaultDisplayEnabled() { return SystemProperties.getBoolean("fw.visible_bg_users_on_default_display", Resources.getSystem() .getBoolean(R.bool.config_multiuserVisibleBackgroundUsersOnDefaultDisplay)); } /** * Returns whether the device allows (full) users to be started in background visible in the * {@link android.view.Display#DEFAULT_DISPLAY default display}. * * @return {@code false} for most devices, except passenger-only automotive build (i.e., when * Android runs in a separate system in the back seat to manage the passenger displays). * * @hide */ @TestApi public boolean isVisibleBackgroundUsersOnDefaultDisplaySupported() { return isVisibleBackgroundUsersOnDefaultDisplayEnabled(); } /** * Checks if the user is visible at the moment. * Loading
core/res/res/values/config.xml +5 −0 Original line number Diff line number Diff line Loading @@ -2735,6 +2735,11 @@ Should be false for most devices, except automotive vehicle with passenger displays. --> <bool name="config_multiuserVisibleBackgroundUsers">false</bool> <!-- Whether the device allows users to start in background visible on the default display. Should be false for most devices, except passenger-only automotive build (i.e., when Android runs in a separate system in the back seat to manage the passenger displays) --> <bool name="config_multiuserVisibleBackgroundUsersOnDefaultDisplay">false</bool> <!-- Whether to automatically switch to the designated Dock User (the user chosen for displaying dreams, etc.) after a timeout when the device is docked. --> <bool name="config_enableTimeoutToDockUserWhenDocked">false</bool> Loading
core/res/res/values/symbols.xml +1 −0 Original line number Diff line number Diff line Loading @@ -473,6 +473,7 @@ <java-symbol type="integer" name="config_multiuserMaxRunningUsers" /> <java-symbol type="bool" name="config_multiuserDelayUserDataLocking" /> <java-symbol type="bool" name="config_multiuserVisibleBackgroundUsers" /> <java-symbol type="bool" name="config_multiuserVisibleBackgroundUsersOnDefaultDisplay" /> <java-symbol type="bool" name="config_enableTimeoutToDockUserWhenDocked" /> <java-symbol type="integer" name="config_userTypePackageWhitelistMode"/> <java-symbol type="xml" name="config_user_types" /> Loading
services/core/java/com/android/server/am/ActivityManagerService.java +15 −8 Original line number Diff line number Diff line Loading @@ -18974,14 +18974,20 @@ public class ActivityManagerService extends IActivityManager.Stub return null; } // Starts with all displays but DEFAULT_DISPLAY int[] displayIds = new int[allDisplays.length - 1]; boolean allowOnDefaultDisplay = UserManager .isVisibleBackgroundUsersOnDefaultDisplayEnabled(); int displaysSize = allDisplays.length; if (!allowOnDefaultDisplay) { displaysSize--; } int[] displayIds = new int[displaysSize]; // TODO(b/247592632): check for other properties like isSecure or proper display type int numberValidDisplays = 0; for (Display display : allDisplays) { int displayId = display.getDisplayId(); if (display.isValid() && displayId != Display.DEFAULT_DISPLAY) { // TODO(b/247592632): check other properties like isSecure or proper display type if (display.isValid() && (allowOnDefaultDisplay || displayId != Display.DEFAULT_DISPLAY)) { displayIds[numberValidDisplays++] = displayId; } } Loading @@ -18993,14 +18999,15 @@ public class ActivityManagerService extends IActivityManager.Stub // STOPSHIP: if not removed, it should at least be unit tested String testingProp = "fw.display_ids_for_starting_users_for_testing_purposes"; int displayId = SystemProperties.getInt(testingProp, Display.DEFAULT_DISPLAY); if (displayId != Display.DEFAULT_DISPLAY && displayId > 0) { Slogf.w(TAG, "getSecondaryDisplayIdsForStartingBackgroundUsers(): no valid " if (allowOnDefaultDisplay && displayId == Display.DEFAULT_DISPLAY || displayId > 0) { Slogf.w(TAG, "getDisplayIdsForStartingVisibleBackgroundUsers(): no valid " + "display found, but returning %d as set by property %s", displayId, testingProp); return new int[] { displayId }; } Slogf.e(TAG, "getDisplayIdsForStartingBackgroundUsers(): no valid display on %s", Arrays.toString(allDisplays)); Slogf.e(TAG, "getDisplayIdsForStartingVisibleBackgroundUsers(): no valid display" + " on %s", Arrays.toString(allDisplays)); return null; }