Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cbc67df4 authored by Felipe Leme's avatar Felipe Leme
Browse files

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

They're used by CarService, which cannot use hidden APIs anymore.

Test: m update-api
Bug: 214336184
CTS-Coverage-Bug: 214336184

Change-Id: I7d11f0a2b75fa8b87a5a71d43ffc7adb8e84bc9c
parent e490dfa3
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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";
  }

+8 −3
Original line number Diff line number Diff line
@@ -9864,14 +9864,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();
        }
@@ -9885,7 +9888,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) {