Merge "Make LockoutResetCallback oneway"

This commit is contained in:
Jorim Jaggi
2016-11-29 12:22:04 +00:00
committed by Android (Google) Code Review
3 changed files with 36 additions and 13 deletions

View File

@@ -26,6 +26,7 @@ import android.os.CancellationSignal;
import android.os.CancellationSignal.OnCancelListener;
import android.os.Handler;
import android.os.IBinder;
import android.os.IRemoteCallback;
import android.os.Looper;
import android.os.PowerManager;
import android.os.RemoteException;
@@ -757,20 +758,22 @@ public class FingerprintManager {
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() {
public void onLockoutReset(long deviceId, IRemoteCallback serverCallback)
throws RemoteException {
try {
final PowerManager.WakeLock wakeLock = powerManager.newWakeLock(
PowerManager.PARTIAL_WAKE_LOCK, "lockoutResetCallback");
wakeLock.acquire();
mHandler.post(() -> {
try {
callback.onLockoutReset();
} finally {
wakeLock.release();
}
}
});
});
} finally {
serverCallback.sendResult(null /* data */);
}
}
});
} catch (RemoteException e) {

View File

@@ -17,14 +17,17 @@ package android.hardware.fingerprint;
import android.hardware.fingerprint.Fingerprint;
import android.os.Bundle;
import android.os.IRemoteCallback;
import android.os.UserHandle;
/**
* Callback when lockout period expired and clients are allowed to authenticate again.
* @hide
*/
interface IFingerprintServiceLockoutResetCallback {
oneway interface IFingerprintServiceLockoutResetCallback {
/** Method is synchronous so wakelock is held when this is called from a WAKEUP alarm. */
void onLockoutReset(long deviceId);
/**
* A wakelock will be held until the reciever calls back into {@param callback}
*/
void onLockoutReset(long deviceId, IRemoteCallback callback);
}