diff options
| author | Jorim Jaggi <jjaggi@google.com> | 2015-08-17 17:38:58 -0700 |
|---|---|---|
| committer | Jorim Jaggi <jjaggi@google.com> | 2015-08-18 17:57:10 -0700 |
| commit | 83eb6bb5d83d3994a3750b566a2109a049ab1388 (patch) | |
| tree | 69a25df5abc37ef4261c9d2a4e3bf50c8f9a156b /packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java | |
| parent | 007f0e8f207d3d6d2f47d725b72459edf317cce9 (diff) | |
| download | frameworks_base-83eb6bb5d83d3994a3750b566a2109a049ab1388.zip frameworks_base-83eb6bb5d83d3994a3750b566a2109a049ab1388.tar.gz frameworks_base-83eb6bb5d83d3994a3750b566a2109a049ab1388.tar.bz2 | |
Improve motion for wake-and-unlocking while pulsing
- Move all fingerprint related to logic in on central class in
SystemUI that knows all the state of the UI so there is exactly ONE
place in which we decide what to do when we acquire a fingerprint.
- When pulsing and we get a valid finger, we fade the contents of the
Keyguard out and fade the scrim out almost the same way as we would do
in a normal wake-and-unlock sequence.
- Hide shadows while dozing, so we don't see the artifacts when we fade
the dozed Keyguard out.
Bug: 23225107
Change-Id: I82f78e61f2530cf7d507ade80f6f0a340c082567
Diffstat (limited to 'packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java')
| -rw-r--r-- | packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java | 110 |
1 files changed, 9 insertions, 101 deletions
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java index 80b6f28..e2349e7 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -94,15 +94,12 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { private static final String TAG = "KeyguardUpdateMonitor"; private static final boolean DEBUG = KeyguardConstants.DEBUG; private static final boolean DEBUG_SIM_STATES = KeyguardConstants.DEBUG_SIM_STATES; - private static final boolean DEBUG_FP_WAKELOCK = KeyguardConstants.DEBUG_FP_WAKELOCK; private static final int LOW_BATTERY_THRESHOLD = 20; - private static final long FINGERPRINT_WAKELOCK_TIMEOUT_MS = 15 * 1000; private static final String ACTION_FACE_UNLOCK_STARTED = "com.android.facelock.FACE_UNLOCK_STARTED"; private static final String ACTION_FACE_UNLOCK_STOPPED = "com.android.facelock.FACE_UNLOCK_STOPPED"; - private static final String FINGERPRINT_WAKE_LOCK_NAME = "wake-and-unlock wakelock"; private static final String ACTION_STRONG_AUTH_TIMEOUT = "com.android.systemui.ACTION_STRONG_AUTH_TIMEOUT"; @@ -111,29 +108,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { private static final String PERMISSION_SELF = "com.android.systemui.permission.SELF"; /** - * Mode in which we don't need to wake up the device when we get a fingerprint. - */ - private static final int FP_WAKE_NONE = 0; - - /** - * Mode in which we wake up the device, and directly dismiss Keyguard. Active when we acquire - * a fingerprint while the screen is off and the device was sleeping. - */ - private static final int FP_WAKE_DIRECT_UNLOCK = 1; - - /** - * Mode in which we wake up the device, but play the normal dismiss animation. Active when we - * acquire a fingerprint pulsing in doze mode. - * */ - private static final int FP_WAKE_TO_BOUNCER = 2; - - /** - * Mode in which we only wake up the device, and keyguard was not showing when we acquired a - * fingerprint. - * */ - private static final int FP_ONLY_WAKE = 3; - - /** * Milliseconds after unlocking with fingerprint times out, i.e. the user has to use a * strong auth method like password, PIN or pattern. */ @@ -202,7 +176,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { private List<SubscriptionInfo> mSubscriptionInfo; private boolean mFingerprintDetectionRunning; private TrustManager mTrustManager; - private PowerManager mPowerManager; private final Handler mHandler = new Handler() { @Override @@ -398,22 +371,23 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { } } - private void onFingerprintAuthenticated(int userId, boolean wakeAndUnlocking) { + private void onFingerprintAuthenticated(int userId) { mUserFingerprintAuthenticated.put(userId, true); for (int i = 0; i < mCallbacks.size(); i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { - cb.onFingerprintAuthenticated(userId, wakeAndUnlocking); + cb.onFingerprintAuthenticated(userId); } } } private void handleFingerprintAuthFailed() { - if (mFpWakeMode == FP_WAKE_DIRECT_UNLOCK) { - notifyOnFingerprintWakeAndUnlockingFinished(); + for (int i = 0; i < mCallbacks.size(); i++) { + KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); + if (cb != null) { + cb.onFingerprintAuthFailed(); + } } - mFpWakeMode = FP_WAKE_NONE; - releaseFingerprintWakeLock(); handleFingerprintHelp(-1, mContext.getString(R.string.fingerprint_not_recognized)); } @@ -421,75 +395,15 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { if (acquireInfo != FingerprintManager.FINGERPRINT_ACQUIRED_GOOD) { return; } - if (!mDeviceInteractive && !mScreenOn) { - releaseFingerprintWakeLock(); - mWakeLock = mPowerManager.newWakeLock( - PowerManager.PARTIAL_WAKE_LOCK, FINGERPRINT_WAKE_LOCK_NAME); - mWakeLock.acquire(); - mFpWakeMode = mKeyguardIsVisible ? FP_WAKE_DIRECT_UNLOCK : FP_ONLY_WAKE; - if (DEBUG_FP_WAKELOCK) { - Log.i(TAG, "fingerprint acquired, grabbing fp wakelock"); - } - mHandler.postDelayed(mReleaseFingerprintWakeLockRunnable, - FINGERPRINT_WAKELOCK_TIMEOUT_MS); - if (mFpWakeMode == FP_WAKE_DIRECT_UNLOCK) { - notifyOnFingerprintWakeAndUnlockingStarted(); - } - } else if (!mDeviceInteractive) { - mFpWakeMode = FP_WAKE_TO_BOUNCER; - } else { - mFpWakeMode = FP_WAKE_NONE; - } - } - - private void notifyOnFingerprintWakeAndUnlockingStarted() { for (int i = 0; i < mCallbacks.size(); i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { - cb.onFingerprintWakeAndUnlockingStarted(); + cb.onFingerprintAcquired(); } } } - private void notifyOnFingerprintWakeAndUnlockingFinished() { - for (int i = 0; i < mCallbacks.size(); i++) { - KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); - if (cb != null) { - cb.onFingerprintWakeAndUnlockingFinished(); - } - } - } - - private final Runnable mReleaseFingerprintWakeLockRunnable = new Runnable() { - @Override - public void run() { - if (DEBUG_FP_WAKELOCK) { - Log.i(TAG, "fp wakelock: TIMEOUT!!"); - } - releaseFingerprintWakeLock(); - } - }; - - private void releaseFingerprintWakeLock() { - if (mWakeLock != null) { - mHandler.removeCallbacks(mReleaseFingerprintWakeLockRunnable); - if (DEBUG_FP_WAKELOCK) { - Log.i(TAG, "releasing fp wakelock"); - } - mWakeLock.release(); - mWakeLock = null; - } - } - private void handleFingerprintAuthenticated() { - if (mFpWakeMode == FP_WAKE_TO_BOUNCER || mFpWakeMode == FP_WAKE_DIRECT_UNLOCK - || mFpWakeMode == FP_ONLY_WAKE) { - if (DEBUG_FP_WAKELOCK) { - Log.i(TAG, "fp wakelock: Authenticated, waking up..."); - } - mPowerManager.wakeUp(SystemClock.uptimeMillis()); - } - releaseFingerprintWakeLock(); try { final int userId; try { @@ -502,7 +416,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { Log.d(TAG, "Fingerprint disabled by DPM for userId: " + userId); return; } - onFingerprintAuthenticated(userId, mFpWakeMode == FP_WAKE_DIRECT_UNLOCK); + onFingerprintAuthenticated(userId); } finally { setFingerprintRunningDetectionRunning(false); } @@ -752,7 +666,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { }; private CancellationSignal mFingerprintCancelSignal; private FingerprintManager mFpm; - private PowerManager.WakeLock mWakeLock; /** * When we receive a @@ -915,10 +828,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { cb.onScreenTurnedOn(); } } - if (mFpWakeMode == FP_WAKE_DIRECT_UNLOCK) { - notifyOnFingerprintWakeAndUnlockingFinished(); - } - mFpWakeMode = FP_WAKE_NONE; } private void handleScreenTurnedOff() { @@ -957,7 +866,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { private KeyguardUpdateMonitor(Context context) { mContext = context; mSubscriptionManager = SubscriptionManager.from(context); - mPowerManager = context.getSystemService(PowerManager.class); mAlarmManager = context.getSystemService(AlarmManager.class); mDeviceProvisioned = isDeviceProvisionedInSettingsDb(); |
