summaryrefslogtreecommitdiffstats
path: root/packages/Keyguard
diff options
context:
space:
mode:
authorJorim Jaggi <jjaggi@google.com>2015-08-19 01:33:52 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-08-19 01:33:52 +0000
commitf10e475d85a584e07bf74cc4d47ee4176ed543f8 (patch)
treed33189f0144e9dd71e37ae6e7050ed6c0ad1cf3b /packages/Keyguard
parent1dc1c93b9347380064c183398bb0441d99a33bf3 (diff)
parentebcd9d558f1d9e17b5b04d96b816dffb2d8c8d13 (diff)
downloadframeworks_base-f10e475d85a584e07bf74cc4d47ee4176ed543f8.zip
frameworks_base-f10e475d85a584e07bf74cc4d47ee4176ed543f8.tar.gz
frameworks_base-f10e475d85a584e07bf74cc4d47ee4176ed543f8.tar.bz2
am ebcd9d55: am 0835f33a: Merge "Improve motion for wake-and-unlocking while pulsing" into mnc-dr-dev
* commit 'ebcd9d558f1d9e17b5b04d96b816dffb2d8c8d13': Improve motion for wake-and-unlocking while pulsing
Diffstat (limited to 'packages/Keyguard')
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java110
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java20
2 files changed, 19 insertions, 111 deletions
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
index 806f280..4eb6f88 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);
}
@@ -754,7 +668,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
};
private CancellationSignal mFingerprintCancelSignal;
private FingerprintManager mFpm;
- private PowerManager.WakeLock mWakeLock;
/**
* When we receive a
@@ -916,10 +829,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
cb.onScreenTurnedOn();
}
}
- if (mFpWakeMode == FP_WAKE_DIRECT_UNLOCK) {
- notifyOnFingerprintWakeAndUnlockingFinished();
- }
- mFpWakeMode = FP_WAKE_NONE;
}
private void handleScreenTurnedOff() {
@@ -958,7 +867,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();
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
index bf9435e..7ca67b0 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java
@@ -186,23 +186,23 @@ public class KeyguardUpdateMonitorCallback {
public void onTrustGrantedWithFlags(int flags, int userId) { }
/**
- * Called when a fingerprint is recognized.
- * @param userId the user id for which the fingerprint was authenticated
- * @param wakeAndUnlocking whether the authentication woke the device up and thus we'd like to
- * dismiss the lockscreen before turning on the screen
+ * Called when a finger has been acquired.
+ * <p>
+ * It is guaranteed that either {@link #onFingerprintAuthenticated} or
+ * {@link #onFingerprintAuthFailed()} is called after this method eventually.
*/
- public void onFingerprintAuthenticated(int userId, boolean wakeAndUnlocking) { }
+ public void onFingerprintAcquired() { }
/**
- * Called when we might be starting a wake-and-unlock sequence.
+ * Called when a fingerprint couldn't be authenticated.
*/
- public void onFingerprintWakeAndUnlockingStarted() { }
+ public void onFingerprintAuthFailed() { }
/**
- * Called when we're done with the wake-and-unlock sequence. This can either happen when we
- * figure out that the fingerprint didn't match, or when the phone is fully unlocked.
+ * Called when a fingerprint is recognized.
+ * @param userId the user id for which the fingerprint was authenticated
*/
- public void onFingerprintWakeAndUnlockingFinished() { }
+ public void onFingerprintAuthenticated(int userId) { }
/**
* Called when fingerprint provides help string (e.g. "Try again")