From d59150eca6d7c0d0ea8a3fcba2a1add4beb36f05 Mon Sep 17 00:00:00 2001 From: Ilya Matyukhin Date: Thu, 30 May 2019 11:37:15 -0700 Subject: [PATCH] Add generateChallenge() in onResume() Fixes: 133498264 Fixes: 133440610 Test: open FaceSettings from Settings with and without an enrolled face Test: open FaceSettings from the notification that asks to re-enroll Change-Id: I80ca7644f96a538614962232fb3951d1a91d87c7 --- .../biometrics/face/FaceSettings.java | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/src/com/android/settings/biometrics/face/FaceSettings.java b/src/com/android/settings/biometrics/face/FaceSettings.java index 48370d9fb78..05e37781c70 100644 --- a/src/com/android/settings/biometrics/face/FaceSettings.java +++ b/src/com/android/settings/biometrics/face/FaceSettings.java @@ -145,7 +145,11 @@ public class FaceSettings extends DashboardFragment { if (savedInstanceState != null) { mToken = savedInstanceState.getByteArray(KEY_TOKEN); } + } + @Override + public void onResume() { + super.onResume(); if (mToken == null) { final long challenge = mFaceManager.generateChallenge(); ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(getActivity(), this); @@ -155,13 +159,7 @@ public class FaceSettings extends DashboardFragment { Log.e(TAG, "Password not set"); finish(); } - } - } - - @Override - public void onResume() { - super.onResume(); - if (mToken != null) { + } else { mAttentionController.setToken(mToken); mEnrollController.setToken(mToken); } @@ -196,13 +194,12 @@ public class FaceSettings extends DashboardFragment { } @Override - public void onDestroy() { - super.onDestroy(); - if (getActivity().isFinishing()) { - final int result = mFaceManager.revokeChallenge(); - if (result < 0) { - Log.w(TAG, "revokeChallenge failed, result: " + result); - } + public void onStop() { + super.onStop(); + mToken = null; + final int result = mFaceManager.revokeChallenge(); + if (result < 0) { + Log.w(TAG, "revokeChallenge failed, result: " + result); } }