Loading core/api/current.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -32263,6 +32263,7 @@ package android.os { method @RequiresPermission(anyOf={"android.permission.MANAGE_USERS", "android.permission.INTERACT_ACROSS_USERS"}, conditional=true) public boolean isUserRunningOrStopping(android.os.UserHandle); method @RequiresPermission(anyOf={"android.permission.MANAGE_USERS", "android.permission.INTERACT_ACROSS_USERS"}, conditional=true) public boolean isUserRunningOrStopping(android.os.UserHandle); method public boolean isUserUnlocked(); method public boolean isUserUnlocked(); method @RequiresPermission(anyOf={"android.permission.MANAGE_USERS", "android.permission.INTERACT_ACROSS_USERS"}, conditional=true) public boolean isUserUnlocked(android.os.UserHandle); method @RequiresPermission(anyOf={"android.permission.MANAGE_USERS", "android.permission.INTERACT_ACROSS_USERS"}, conditional=true) public boolean isUserUnlocked(android.os.UserHandle); method public boolean isUserVisible(); method @RequiresPermission(anyOf={"android.permission.MANAGE_USERS", "android.permission.MODIFY_QUIET_MODE"}, conditional=true) public boolean requestQuietModeEnabled(boolean, @NonNull android.os.UserHandle); method @RequiresPermission(anyOf={"android.permission.MANAGE_USERS", "android.permission.MODIFY_QUIET_MODE"}, conditional=true) public boolean requestQuietModeEnabled(boolean, @NonNull android.os.UserHandle); method public boolean requestQuietModeEnabled(boolean, @NonNull android.os.UserHandle, int); method public boolean requestQuietModeEnabled(boolean, @NonNull android.os.UserHandle, int); method @Deprecated public boolean setRestrictionsChallenge(String); method @Deprecated public boolean setRestrictionsChallenge(String); core/java/android/os/IUserManager.aidl +1 −0 Original line number Original line Diff line number Diff line Loading @@ -125,6 +125,7 @@ interface IUserManager { boolean isUserUnlocked(int userId); boolean isUserUnlocked(int userId); boolean isUserRunning(int userId); boolean isUserRunning(int userId); boolean isUserForeground(int userId); boolean isUserForeground(int userId); boolean isUserVisible(int userId); boolean isUserNameSet(int userId); boolean isUserNameSet(int userId); boolean hasRestrictedProfiles(int userId); boolean hasRestrictedProfiles(int userId); boolean requestQuietModeEnabled(String callingPackage, boolean enableQuietMode, int userId, in IntentSender target, int flags); boolean requestQuietModeEnabled(String callingPackage, boolean enableQuietMode, int userId, in IntentSender target, int flags); Loading core/java/android/os/UserManager.java +24 −0 Original line number Original line Diff line number Diff line Loading @@ -2857,6 +2857,30 @@ public class UserManager { return isUsersOnSecondaryDisplaysEnabled(); return isUsersOnSecondaryDisplaysEnabled(); } } /** * Checks if the user is visible at the moment. * * <p>Roughly speaking, a "visible user" is a user that can present UI on at least one display. * It includes: * * <ol> * <li>The current foreground user in the main display. * <li>Current background users in secondary displays (for example, passenger users on * automotive, using the display associated with their seats). * <li>Profile users (in the running / started state) of other visible users. * </ol> * * @return whether the user is visible at the moment, as defined above. */ @UserHandleAware public boolean isUserVisible() { try { return mService.isUserVisible(mUserId); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** /** * Return whether the context user is running in an "unlocked" state. * Return whether the context user is running in an "unlocked" state. * <p> * <p> Loading services/core/java/com/android/server/pm/UserManagerService.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -1654,6 +1654,12 @@ public class UserManagerService extends IUserManager.Stub { return currentUser == userId; return currentUser == userId; } } @Override public boolean isUserVisible(@UserIdInt int userId) { // TODO(b/239824814): implement other cases like bg user, profile, user on secondary display return isUserForeground(userId); } @Override @Override public @NonNull String getUserName() { public @NonNull String getUserName() { final int callingUid = Binder.getCallingUid(); final int callingUid = Binder.getCallingUid(); Loading Loading
core/api/current.txt +1 −0 Original line number Original line Diff line number Diff line Loading @@ -32263,6 +32263,7 @@ package android.os { method @RequiresPermission(anyOf={"android.permission.MANAGE_USERS", "android.permission.INTERACT_ACROSS_USERS"}, conditional=true) public boolean isUserRunningOrStopping(android.os.UserHandle); method @RequiresPermission(anyOf={"android.permission.MANAGE_USERS", "android.permission.INTERACT_ACROSS_USERS"}, conditional=true) public boolean isUserRunningOrStopping(android.os.UserHandle); method public boolean isUserUnlocked(); method public boolean isUserUnlocked(); method @RequiresPermission(anyOf={"android.permission.MANAGE_USERS", "android.permission.INTERACT_ACROSS_USERS"}, conditional=true) public boolean isUserUnlocked(android.os.UserHandle); method @RequiresPermission(anyOf={"android.permission.MANAGE_USERS", "android.permission.INTERACT_ACROSS_USERS"}, conditional=true) public boolean isUserUnlocked(android.os.UserHandle); method public boolean isUserVisible(); method @RequiresPermission(anyOf={"android.permission.MANAGE_USERS", "android.permission.MODIFY_QUIET_MODE"}, conditional=true) public boolean requestQuietModeEnabled(boolean, @NonNull android.os.UserHandle); method @RequiresPermission(anyOf={"android.permission.MANAGE_USERS", "android.permission.MODIFY_QUIET_MODE"}, conditional=true) public boolean requestQuietModeEnabled(boolean, @NonNull android.os.UserHandle); method public boolean requestQuietModeEnabled(boolean, @NonNull android.os.UserHandle, int); method public boolean requestQuietModeEnabled(boolean, @NonNull android.os.UserHandle, int); method @Deprecated public boolean setRestrictionsChallenge(String); method @Deprecated public boolean setRestrictionsChallenge(String);
core/java/android/os/IUserManager.aidl +1 −0 Original line number Original line Diff line number Diff line Loading @@ -125,6 +125,7 @@ interface IUserManager { boolean isUserUnlocked(int userId); boolean isUserUnlocked(int userId); boolean isUserRunning(int userId); boolean isUserRunning(int userId); boolean isUserForeground(int userId); boolean isUserForeground(int userId); boolean isUserVisible(int userId); boolean isUserNameSet(int userId); boolean isUserNameSet(int userId); boolean hasRestrictedProfiles(int userId); boolean hasRestrictedProfiles(int userId); boolean requestQuietModeEnabled(String callingPackage, boolean enableQuietMode, int userId, in IntentSender target, int flags); boolean requestQuietModeEnabled(String callingPackage, boolean enableQuietMode, int userId, in IntentSender target, int flags); Loading
core/java/android/os/UserManager.java +24 −0 Original line number Original line Diff line number Diff line Loading @@ -2857,6 +2857,30 @@ public class UserManager { return isUsersOnSecondaryDisplaysEnabled(); return isUsersOnSecondaryDisplaysEnabled(); } } /** * Checks if the user is visible at the moment. * * <p>Roughly speaking, a "visible user" is a user that can present UI on at least one display. * It includes: * * <ol> * <li>The current foreground user in the main display. * <li>Current background users in secondary displays (for example, passenger users on * automotive, using the display associated with their seats). * <li>Profile users (in the running / started state) of other visible users. * </ol> * * @return whether the user is visible at the moment, as defined above. */ @UserHandleAware public boolean isUserVisible() { try { return mService.isUserVisible(mUserId); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } } /** /** * Return whether the context user is running in an "unlocked" state. * Return whether the context user is running in an "unlocked" state. * <p> * <p> Loading
services/core/java/com/android/server/pm/UserManagerService.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -1654,6 +1654,12 @@ public class UserManagerService extends IUserManager.Stub { return currentUser == userId; return currentUser == userId; } } @Override public boolean isUserVisible(@UserIdInt int userId) { // TODO(b/239824814): implement other cases like bg user, profile, user on secondary display return isUserForeground(userId); } @Override @Override public @NonNull String getUserName() { public @NonNull String getUserName() { final int callingUid = Binder.getCallingUid(); final int callingUid = Binder.getCallingUid(); Loading