Loading core/java/android/app/admin/DevicePolicyManager.java +15 −1 Original line number Original line Diff line number Diff line Loading @@ -1826,9 +1826,23 @@ public class DevicePolicyManager { * this method; if it has not, a security exception will be thrown. * this method; if it has not, a security exception will be thrown. */ */ public int getCurrentFailedPasswordAttempts() { public int getCurrentFailedPasswordAttempts() { return getCurrentFailedPasswordAttempts(myUserId()); } /** * Retrieve the number of times the given user has failed at entering a * password since that last successful password entry. * * <p>The calling device admin must have requested * {@link DeviceAdminInfo#USES_POLICY_WATCH_LOGIN} to be able to call this method; if it has * not and it is not the system uid, a security exception will be thrown. * * @hide */ public int getCurrentFailedPasswordAttempts(int userHandle) { if (mService != null) { if (mService != null) { try { try { return mService.getCurrentFailedPasswordAttempts(myUserId(), mParentInstance); return mService.getCurrentFailedPasswordAttempts(userHandle, mParentInstance); } catch (RemoteException e) { } catch (RemoteException e) { Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); } } Loading core/java/com/android/internal/widget/LockPatternUtils.java +9 −0 Original line number Original line Diff line number Diff line Loading @@ -283,6 +283,15 @@ public class LockPatternUtils { getTrustManager().reportUnlockAttempt(true /* authenticated */, userId); getTrustManager().reportUnlockAttempt(true /* authenticated */, userId); } } public int getCurrentFailedPasswordAttempts(int userId) { return getDevicePolicyManager().getCurrentFailedPasswordAttempts(userId); } public int getMaximumFailedPasswordsForWipe(int userId) { return getDevicePolicyManager().getMaximumFailedPasswordsForWipe( null /* componentName */, userId); } /** /** * Check to see if a pattern matches the saved pattern. * Check to see if a pattern matches the saved pattern. * If pattern matches, return an opaque attestation that the challenge * If pattern matches, return an opaque attestation that the challenge Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +7 −4 Original line number Original line Diff line number Diff line Loading @@ -3524,11 +3524,14 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { @Override @Override public int getCurrentFailedPasswordAttempts(int userHandle, boolean parent) { public int getCurrentFailedPasswordAttempts(int userHandle, boolean parent) { enforceFullCrossUsersPermission(userHandle); synchronized (this) { synchronized (this) { if (!isCallerWithSystemUid()) { // This API can only be called by an active device admin, // This API can only be called by an active device admin, // so try to retrieve it to check that the caller is one. // so try to retrieve it to check that the caller is one. getActiveAdminForCallerLocked( getActiveAdminForCallerLocked( null, DeviceAdminInfo.USES_POLICY_WATCH_LOGIN, parent); null, DeviceAdminInfo.USES_POLICY_WATCH_LOGIN, parent); } DevicePolicyData policy = getUserDataUnchecked(getCredentialOwner(userHandle, parent)); DevicePolicyData policy = getUserDataUnchecked(getCredentialOwner(userHandle, parent)); Loading Loading
core/java/android/app/admin/DevicePolicyManager.java +15 −1 Original line number Original line Diff line number Diff line Loading @@ -1826,9 +1826,23 @@ public class DevicePolicyManager { * this method; if it has not, a security exception will be thrown. * this method; if it has not, a security exception will be thrown. */ */ public int getCurrentFailedPasswordAttempts() { public int getCurrentFailedPasswordAttempts() { return getCurrentFailedPasswordAttempts(myUserId()); } /** * Retrieve the number of times the given user has failed at entering a * password since that last successful password entry. * * <p>The calling device admin must have requested * {@link DeviceAdminInfo#USES_POLICY_WATCH_LOGIN} to be able to call this method; if it has * not and it is not the system uid, a security exception will be thrown. * * @hide */ public int getCurrentFailedPasswordAttempts(int userHandle) { if (mService != null) { if (mService != null) { try { try { return mService.getCurrentFailedPasswordAttempts(myUserId(), mParentInstance); return mService.getCurrentFailedPasswordAttempts(userHandle, mParentInstance); } catch (RemoteException e) { } catch (RemoteException e) { Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, e); } } Loading
core/java/com/android/internal/widget/LockPatternUtils.java +9 −0 Original line number Original line Diff line number Diff line Loading @@ -283,6 +283,15 @@ public class LockPatternUtils { getTrustManager().reportUnlockAttempt(true /* authenticated */, userId); getTrustManager().reportUnlockAttempt(true /* authenticated */, userId); } } public int getCurrentFailedPasswordAttempts(int userId) { return getDevicePolicyManager().getCurrentFailedPasswordAttempts(userId); } public int getMaximumFailedPasswordsForWipe(int userId) { return getDevicePolicyManager().getMaximumFailedPasswordsForWipe( null /* componentName */, userId); } /** /** * Check to see if a pattern matches the saved pattern. * Check to see if a pattern matches the saved pattern. * If pattern matches, return an opaque attestation that the challenge * If pattern matches, return an opaque attestation that the challenge Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +7 −4 Original line number Original line Diff line number Diff line Loading @@ -3524,11 +3524,14 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { @Override @Override public int getCurrentFailedPasswordAttempts(int userHandle, boolean parent) { public int getCurrentFailedPasswordAttempts(int userHandle, boolean parent) { enforceFullCrossUsersPermission(userHandle); synchronized (this) { synchronized (this) { if (!isCallerWithSystemUid()) { // This API can only be called by an active device admin, // This API can only be called by an active device admin, // so try to retrieve it to check that the caller is one. // so try to retrieve it to check that the caller is one. getActiveAdminForCallerLocked( getActiveAdminForCallerLocked( null, DeviceAdminInfo.USES_POLICY_WATCH_LOGIN, parent); null, DeviceAdminInfo.USES_POLICY_WATCH_LOGIN, parent); } DevicePolicyData policy = getUserDataUnchecked(getCredentialOwner(userHandle, parent)); DevicePolicyData policy = getUserDataUnchecked(getCredentialOwner(userHandle, parent)); Loading