From e9785ac1e4b779b6119460a5cdc71bce4d6563b9 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Mon, 13 Jul 2015 15:58:59 -0700 Subject: [PATCH] Postpone call to postEnroll() until we actually leave activity. The existing code was calling postEnroll() too soon, which resulted in the inability to add more than one fingerprint. The solution is to only call postEnroll() when we're leaving the activity. Fixes bug 22438498 Change-Id: Ia134899e12b4edc9cced834e99cb2bfd2d51321f --- .../settings/fingerprint/FingerprintSettings.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/com/android/settings/fingerprint/FingerprintSettings.java b/src/com/android/settings/fingerprint/FingerprintSettings.java index 3962f224452..b070a0ae9d2 100644 --- a/src/com/android/settings/fingerprint/FingerprintSettings.java +++ b/src/com/android/settings/fingerprint/FingerprintSettings.java @@ -141,6 +141,7 @@ public class FingerprintSettings extends SubSettings { mHandler.obtainMessage(MSG_FINGER_AUTH_SUCCESS, fingerId, 0).sendToTarget(); } + @Override public void onAuthenticationFailed() { mHandler.obtainMessage(MSG_FINGER_AUTH_FAIL).sendToTarget(); }; @@ -174,6 +175,7 @@ public class FingerprintSettings extends SubSettings { } }; private final Handler mHandler = new Handler() { + @Override public void handleMessage(android.os.Message msg) { switch (msg.what) { case MSG_REFRESH_FINGERPRINT_TEMPLATES: @@ -431,8 +433,6 @@ public class FingerprintSettings extends SubSettings { ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN); } } - } else if (requestCode == ADD_FINGERPRINT_REQUEST) { - int result = mFingerprintManager.postEnroll(); } if (mToken == null) { @@ -441,6 +441,15 @@ public class FingerprintSettings extends SubSettings { } } + @Override + public void onDestroy() { + super.onDestroy(); + int result = mFingerprintManager.postEnroll(); + if (result < 0) { + Log.w(TAG, "postEnroll failed: result = " + result); + } + } + private Drawable getHighlightDrawable() { if (mHighlightDrawable == null) { final Activity activity = getActivity();