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

Commit f23b5d3d authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "API to determine user locked/unlocked state."

parents a864049a 0825ab28
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -28060,6 +28060,7 @@ package android.os {
    method public boolean isUserAGoat();
    method public boolean isUserRunning(android.os.UserHandle);
    method public boolean isUserRunningOrStopping(android.os.UserHandle);
    method public boolean isUserRunningUnlocked(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);
+1 −0
Original line number Diff line number Diff line
@@ -30043,6 +30043,7 @@ package android.os {
    method public boolean isUserAGoat();
    method public boolean isUserRunning(android.os.UserHandle);
    method public boolean isUserRunningOrStopping(android.os.UserHandle);
    method public boolean isUserRunningUnlocked(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);
+1 −0
Original line number Diff line number Diff line
@@ -28060,6 +28060,7 @@ package android.os {
    method public boolean isUserAGoat();
    method public boolean isUserRunning(android.os.UserHandle);
    method public boolean isUserRunningOrStopping(android.os.UserHandle);
    method public boolean isUserRunningUnlocked(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);
+2 −0
Original line number Diff line number Diff line
@@ -3096,6 +3096,8 @@ public class ActivityManager {
    public static final int FLAG_OR_STOPPED = 1 << 0;
    /** {@hide} */
    public static final int FLAG_AND_LOCKED = 1 << 1;
    /** {@hide} */
    public static final int FLAG_AND_UNLOCKED = 1 << 2;

    /**
     * Return whether the given user is actively running.  This means that
+17 −0
Original line number Diff line number Diff line
@@ -754,6 +754,23 @@ public class UserManager {
        }
    }

    /**
     * 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 isUserRunningUnlocked(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.
Loading