Auto cancel biometric prompt

This commit is contained in:
M66B 2020-05-31 14:42:20 +02:00
parent 19757af886
commit 115fe43a0f
1 changed files with 14 additions and 3 deletions

View File

@ -1140,12 +1140,23 @@ public class Helper {
prompt.authenticate(info.build());
Runnable cancelPrompt = new Runnable() {
@Override
public void run() {
try {
prompt.cancelAuthentication();
} catch (Throwable ex) {
Log.e(ex);
}
}
};
handler.postDelayed(cancelPrompt, 60 * 1000L);
owner.getLifecycle().addObserver(new LifecycleObserver() {
@OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
public void onDestroy() {
prompt.cancelAuthentication();
handler.post(cancelled);
owner.getLifecycle().removeObserver(this);
handler.post(cancelPrompt);
}
});