From 1de8bcb1e51917a301cab2ef7d276b4f9423d95f Mon Sep 17 00:00:00 2001 From: Adrian Roos Date: Wed, 19 Aug 2015 16:52:52 -0700 Subject: [PATCH] Invoke strong auth callback and default strong auth expired to true Split off from I0af11da1b7cd7c8d837bc5ba3a62ef2ffca74b1b. The initial value did not matter previously because a SystemUI crash triggered the boot logic and forced a manual entry before fingerprint works. Long term the timeout logic should be moved to StrongAuthTracker so it can be shared with the trust agent implementation (currently implemented by the trust agents themeselfes) Bug: 22846469 Bug: 22115393 Change-Id: I0af11da1b7cd7c8d837bc5ba3a62ef2ffca74b1b --- .../keyguard/KeyguardUpdateMonitor.java | 18 +++++++++--------- .../KeyguardUpdateMonitorCallback.java | 2 +- .../phone/KeyguardBottomAreaView.java | 2 +- .../statusbar/phone/KeyguardBouncer.java | 2 +- .../statusbar/phone/UnlockMethodCache.java | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java index cb39e77513e51..ead03074df443 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -182,7 +182,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { private SparseIntArray mFailedAttempts = new SparseIntArray(); /** Tracks whether strong authentication hasn't been used since quite some time per user. */ - private ArraySet mStrongAuthTimedOut = new ArraySet<>(); + private ArraySet mStrongAuthNotTimedOut = new ArraySet<>(); private final StrongAuthTracker mStrongAuthTracker = new StrongAuthTracker(); private final ArrayList> @@ -553,11 +553,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { * while and thus can't unlock with fingerprint, false otherwise */ public boolean hasFingerprintUnlockTimedOut(int userId) { - return mStrongAuthTimedOut.contains(userId); + return !mStrongAuthNotTimedOut.contains(userId); } public void reportSuccessfulStrongAuthUnlockAttempt() { - mStrongAuthTimedOut.remove(sCurrentUser); + mStrongAuthNotTimedOut.add(sCurrentUser); scheduleStrongAuthTimeout(); if (mFpm != null) { byte[] token = null; /* TODO: pass real auth token once fp HAL supports it */ @@ -572,14 +572,14 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { PendingIntent sender = PendingIntent.getBroadcast(mContext, sCurrentUser, intent, PendingIntent.FLAG_CANCEL_CURRENT); mAlarmManager.set(AlarmManager.ELAPSED_REALTIME, when, sender); - notifyStrongAuthTimedOutChanged(sCurrentUser); + notifyStrongAuthStateChanged(sCurrentUser); } - private void notifyStrongAuthTimedOutChanged(int userId) { + private void notifyStrongAuthStateChanged(int userId) { for (int i = 0; i < mCallbacks.size(); i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { - cb.onStrongAuthTimeoutExpiredChanged(userId); + cb.onStrongAuthStateChanged(userId); } } } @@ -674,8 +674,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { public void onReceive(Context context, Intent intent) { if (ACTION_STRONG_AUTH_TIMEOUT.equals(intent.getAction())) { int userId = intent.getIntExtra(USER_ID, -1); - mStrongAuthTimedOut.add(userId); - notifyStrongAuthTimedOutChanged(userId); + mStrongAuthNotTimedOut.remove(userId); + notifyStrongAuthStateChanged(userId); } } }; @@ -848,7 +848,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { @Override public void onStrongAuthRequiredChanged(int userId) { - // do something? + notifyStrongAuthStateChanged(userId); } } diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java index 7ca67b085e9a2..15ffe9f5ca7e4 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java @@ -233,5 +233,5 @@ public class KeyguardUpdateMonitorCallback { * Called when the state that the user hasn't used strong authentication since quite some time * has changed. */ - public void onStrongAuthTimeoutExpiredChanged(int userId) { } + public void onStrongAuthStateChanged(int userId) { } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java index 4da9acd563d56..579889d63edf7 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBottomAreaView.java @@ -649,7 +649,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL } @Override - public void onStrongAuthTimeoutExpiredChanged(int userId) { + public void onStrongAuthStateChanged(int userId) { mLockIcon.update(); } }; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java index 8b96e5f52ae35..893b352f479b5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java @@ -52,7 +52,7 @@ public class KeyguardBouncer { private KeyguardUpdateMonitorCallback mUpdateMonitorCallback = new KeyguardUpdateMonitorCallback() { @Override - public void onStrongAuthTimeoutExpiredChanged(int userId) { + public void onStrongAuthStateChanged(int userId) { mBouncerPromptReason = mCallback.getBouncerPromptReason(); } }; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java index 091db76b7e41b..a91cd5177cfd8 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/UnlockMethodCache.java @@ -145,7 +145,7 @@ public class UnlockMethodCache { } @Override - public void onStrongAuthTimeoutExpiredChanged(int userId) { + public void onStrongAuthStateChanged(int userId) { update(false /* updateAlways */); } };