summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJorim Jaggi <jjaggi@google.com>2015-09-04 14:17:58 -0700
committerJorim Jaggi <jjaggi@google.com>2015-09-09 20:41:11 +0000
commit5e354223d817477efac9a6a2e3ce3d9161e046a4 (patch)
treed60fd7f5d402b7f0d7bd97e8693979dc060b9b48 /core
parentebd1465885af2a1de5a885dac791ee6184f85d7f (diff)
downloadframeworks_base-5e354223d817477efac9a6a2e3ce3d9161e046a4.zip
frameworks_base-5e354223d817477efac9a6a2e3ce3d9161e046a4.tar.gz
frameworks_base-5e354223d817477efac9a6a2e3ce3d9161e046a4.tar.bz2
Use AlarmManager for lockout reset
So the lockout reset exactly fires after 30 seconds, independent of whether the device was in deep sleep. Bug: 23668918 Change-Id: Idea1a877c395897c1fd075cf98edf41c8b1f4082
Diffstat (limited to 'core')
-rw-r--r--core/java/android/hardware/fingerprint/FingerprintManager.java11
-rw-r--r--core/java/android/hardware/fingerprint/IFingerprintServiceLockoutResetCallback.aidl4
2 files changed, 13 insertions, 2 deletions
diff --git a/core/java/android/hardware/fingerprint/FingerprintManager.java b/core/java/android/hardware/fingerprint/FingerprintManager.java
index 1f23c0a..7fef5e1 100644
--- a/core/java/android/hardware/fingerprint/FingerprintManager.java
+++ b/core/java/android/hardware/fingerprint/FingerprintManager.java
@@ -27,6 +27,7 @@ import android.os.CancellationSignal.OnCancelListener;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
+import android.os.PowerManager;
import android.os.RemoteException;
import android.os.UserHandle;
import android.security.keystore.AndroidKeyStoreProvider;
@@ -705,15 +706,23 @@ public class FingerprintManager {
public void addLockoutResetCallback(final LockoutResetCallback callback) {
if (mService != null) {
try {
+ final PowerManager powerManager = mContext.getSystemService(PowerManager.class);
mService.addLockoutResetCallback(
new IFingerprintServiceLockoutResetCallback.Stub() {
@Override
public void onLockoutReset(long deviceId) throws RemoteException {
+ final PowerManager.WakeLock wakeLock = powerManager.newWakeLock(
+ PowerManager.PARTIAL_WAKE_LOCK, "lockoutResetCallback");
+ wakeLock.acquire();
mHandler.post(new Runnable() {
@Override
public void run() {
- callback.onLockoutReset();
+ try {
+ callback.onLockoutReset();
+ } finally {
+ wakeLock.release();
+ }
}
});
}
diff --git a/core/java/android/hardware/fingerprint/IFingerprintServiceLockoutResetCallback.aidl b/core/java/android/hardware/fingerprint/IFingerprintServiceLockoutResetCallback.aidl
index c9a5d59..e027a2b 100644
--- a/core/java/android/hardware/fingerprint/IFingerprintServiceLockoutResetCallback.aidl
+++ b/core/java/android/hardware/fingerprint/IFingerprintServiceLockoutResetCallback.aidl
@@ -23,6 +23,8 @@ import android.os.UserHandle;
* Callback when lockout period expired and clients are allowed to authenticate again.
* @hide
*/
-oneway interface IFingerprintServiceLockoutResetCallback {
+interface IFingerprintServiceLockoutResetCallback {
+
+ /** Method is synchronous so wakelock is held when this is called from a WAKEUP alarm. */
void onLockoutReset(long deviceId);
}