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

Commit b642387b authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Cleaner API for requesting locked status.

Change-Id: I1a5a6703737fb838347eaa292004430f2b9d29c3
parent 055d8396
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -28100,11 +28100,13 @@ package android.os {
    method public boolean isSystemUser();
    method public boolean isUserAGoat();
    method public boolean isUserRunning(android.os.UserHandle);
    method public boolean isUserRunningAndLocked();
    method public boolean isUserRunningAndLocked(android.os.UserHandle);
    method public boolean isUserRunningAndUnlocked();
    method public boolean isUserRunningAndUnlocked(android.os.UserHandle);
    method public deprecated boolean isUserRunningAndLocked();
    method public deprecated boolean isUserRunningAndLocked(android.os.UserHandle);
    method public deprecated boolean isUserRunningAndUnlocked();
    method public deprecated boolean isUserRunningAndUnlocked(android.os.UserHandle);
    method public boolean isUserRunningOrStopping(android.os.UserHandle);
    method public boolean isUserUnlocked();
    method public boolean isUserUnlocked(android.os.UserHandle);
    method public deprecated boolean setRestrictionsChallenge(java.lang.String);
    method public deprecated void setUserRestriction(java.lang.String, boolean);
    method public deprecated void setUserRestrictions(android.os.Bundle);
+6 −4
Original line number Diff line number Diff line
@@ -30094,11 +30094,13 @@ package android.os {
    method public boolean isSystemUser();
    method public boolean isUserAGoat();
    method public boolean isUserRunning(android.os.UserHandle);
    method public boolean isUserRunningAndLocked();
    method public boolean isUserRunningAndLocked(android.os.UserHandle);
    method public boolean isUserRunningAndUnlocked();
    method public boolean isUserRunningAndUnlocked(android.os.UserHandle);
    method public deprecated boolean isUserRunningAndLocked();
    method public deprecated boolean isUserRunningAndLocked(android.os.UserHandle);
    method public deprecated boolean isUserRunningAndUnlocked();
    method public deprecated boolean isUserRunningAndUnlocked(android.os.UserHandle);
    method public boolean isUserRunningOrStopping(android.os.UserHandle);
    method public boolean isUserUnlocked();
    method public boolean isUserUnlocked(android.os.UserHandle);
    method public deprecated boolean setRestrictionsChallenge(java.lang.String);
    method public deprecated void setUserRestriction(java.lang.String, boolean);
    method public deprecated void setUserRestrictions(android.os.Bundle);
+6 −4
Original line number Diff line number Diff line
@@ -28100,11 +28100,13 @@ package android.os {
    method public boolean isSystemUser();
    method public boolean isUserAGoat();
    method public boolean isUserRunning(android.os.UserHandle);
    method public boolean isUserRunningAndLocked();
    method public boolean isUserRunningAndLocked(android.os.UserHandle);
    method public boolean isUserRunningAndUnlocked();
    method public boolean isUserRunningAndUnlocked(android.os.UserHandle);
    method public deprecated boolean isUserRunningAndLocked();
    method public deprecated boolean isUserRunningAndLocked(android.os.UserHandle);
    method public deprecated boolean isUserRunningAndUnlocked();
    method public deprecated boolean isUserRunningAndUnlocked(android.os.UserHandle);
    method public boolean isUserRunningOrStopping(android.os.UserHandle);
    method public boolean isUserUnlocked();
    method public boolean isUserUnlocked(android.os.UserHandle);
    method public deprecated boolean setRestrictionsChallenge(java.lang.String);
    method public deprecated void setUserRestriction(java.lang.String, boolean);
    method public deprecated void setUserRestrictions(android.os.Bundle);
+31 −0
Original line number Diff line number Diff line
@@ -781,6 +781,7 @@ public class UserManager {
     * pattern or PIN), and credential-encrypted private app data storage is
     * available.
     */
    @Deprecated
    public boolean isUserRunningAndLocked() {
        return isUserRunningAndLocked(Process.myUserHandle());
    }
@@ -793,6 +794,7 @@ public class UserManager {
     *
     * @param user to retrieve the unlocked state for.
     */
    @Deprecated
    public boolean isUserRunningAndLocked(UserHandle user) {
        try {
            return ActivityManagerNative.getDefault().isUserRunning(
@@ -808,6 +810,7 @@ public class UserManager {
     * pattern or PIN), and credential-encrypted private app data storage is
     * available.
     */
    @Deprecated
    public boolean isUserRunningAndUnlocked() {
        return isUserRunningAndUnlocked(Process.myUserHandle());
    }
@@ -820,6 +823,7 @@ public class UserManager {
     *
     * @param user to retrieve the unlocked state for.
     */
    @Deprecated
    public boolean isUserRunningAndUnlocked(UserHandle user) {
        try {
            return ActivityManagerNative.getDefault().isUserRunning(
@@ -829,6 +833,33 @@ public class UserManager {
        }
    }

    /**
     * Return whether the calling user is running in an "unlocked" state. A user
     * is unlocked only after they've entered their credentials (such as a lock
     * pattern or PIN), and credential-encrypted private app data storage is
     * available.
     */
    public boolean isUserUnlocked() {
        return isUserUnlocked(Process.myUserHandle());
    }

    /**
     * Return whether the given user is running in an "unlocked" state. A user
     * is unlocked only after they've entered their credentials (such as a lock
     * pattern or PIN), and credential-encrypted private app data storage is
     * available.
     *
     * @param user to retrieve the unlocked state for.
     */
    public boolean isUserUnlocked(UserHandle user) {
        try {
            return ActivityManagerNative.getDefault().isUserRunning(
                    user.getIdentifier(), ActivityManager.FLAG_AND_UNLOCKED);
        } catch (RemoteException e) {
            return false;
        }
    }

    /**
     * Returns the UserInfo object describing a specific user.
     * Requires {@link android.Manifest.permission#MANAGE_USERS} permission.