Merge "Makes DPM.getLogoutUser() and clearLogoutUser() system APIs."

This commit is contained in:
Felipe Leme
2022-01-24 23:37:53 +00:00
committed by Android (Google) Code Review
2 changed files with 10 additions and 3 deletions

View File

@@ -63,6 +63,8 @@ package android.app.admin {
public class DevicePolicyManager {
method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public void acknowledgeNewUserDisclaimer();
method @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public void clearLogoutUser();
method @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_USERS) public android.os.UserHandle getLogoutUser();
field public static final String ACTION_SHOW_NEW_USER_DISCLAIMER = "android.app.action.SHOW_NEW_USER_DISCLAIMER";
}

View File

@@ -10019,14 +10019,17 @@ public class DevicePolicyManager {
/**
* Gets the user a {@link #logoutUser(ComponentName)} call would switch to,
* or {@link UserHandle#USER_NULL} if the current user is not in a session.
* or {@code null} if the current user is not in a session.
*
* @hide
*/
@RequiresPermission(android.Manifest.permission.MANAGE_USERS)
public @UserIdInt int getLogoutUserId() {
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
public @Nullable UserHandle getLogoutUser() {
// TODO(b/214336184): add CTS test
try {
return mService.getLogoutUserId();
int userId = mService.getLogoutUserId();
return userId == UserHandle.USER_NULL ? null : UserHandle.of(userId);
} catch (RemoteException re) {
throw re.rethrowFromSystemServer();
}
@@ -10040,7 +10043,9 @@ public class DevicePolicyManager {
* @hide
*/
@RequiresPermission(android.Manifest.permission.MANAGE_USERS)
@SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
public void clearLogoutUser() {
// TODO(b/214336184): add CTS test
try {
mService.clearLogoutUser();
} catch (RemoteException re) {