diff options
author | Jorim Jaggi <jjaggi@google.com> | 2015-07-10 14:24:44 -0700 |
---|---|---|
committer | Jorim Jaggi <jjaggi@google.com> | 2015-07-28 23:02:54 +0000 |
commit | 0d210f6395072db4a4c53d4cb8fac4a59a3965b4 (patch) | |
tree | 7b63f0a48ec2b0fa8b25604efb17ccade833b568 /packages/Keyguard | |
parent | 751a96a040ada09199ca3356d9a515ec090d1237 (diff) | |
download | frameworks_base-0d210f6395072db4a4c53d4cb8fac4a59a3965b4.zip frameworks_base-0d210f6395072db4a4c53d4cb8fac4a59a3965b4.tar.gz frameworks_base-0d210f6395072db4a4c53d4cb8fac4a59a3965b4.tar.bz2 |
Animation for touch, wake and unlock
- Add callback to inform SysUI when the screen has been unblocked
and turned on.
- Cleanup inconsistent messaging about device interactive/screen on
and off.
- Add callbacks to inform SysUI about screen states
- Implement a quick fade for the scrim after touch, wake, and unlock.
First, start with a black scrim on top of everything, and then fade
it out.
- Make sure we play the normal unlock animation when device is pulsing
- Override navigation bar animations for touch, wake and unlock: Fade
in the same manner as the scrim.
Bug: 22571198
Bug: 21855614
Change-Id: I8ff08d72cced1e0f03c78d71ff710d8a4f6b848c
Diffstat (limited to 'packages/Keyguard')
5 files changed, 69 insertions, 38 deletions
diff --git a/packages/Keyguard/src/com/android/keyguard/CarrierText.java b/packages/Keyguard/src/com/android/keyguard/CarrierText.java index e89caf7..159ac4c 100644 --- a/packages/Keyguard/src/com/android/keyguard/CarrierText.java +++ b/packages/Keyguard/src/com/android/keyguard/CarrierText.java @@ -23,7 +23,6 @@ import java.util.Objects; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; -import android.content.res.Resources; import android.content.res.TypedArray; import android.net.ConnectivityManager; import android.net.wifi.WifiManager; @@ -59,11 +58,11 @@ public class CarrierText extends TextView { updateCarrierText(); } - public void onScreenTurnedOff(int why) { + public void onFinishedGoingToSleep(int why) { setSelected(false); }; - public void onScreenTurnedOn() { + public void onStartedWakingUp() { setSelected(true); }; }; @@ -193,8 +192,8 @@ public class CarrierText extends TextView { super.onFinishInflate(); mSeparator = getResources().getString( com.android.internal.R.string.kg_text_message_separator); - final boolean screenOn = KeyguardUpdateMonitor.getInstance(mContext).isScreenOn(); - setSelected(screenOn); // Allow marquee to work. + boolean shouldMarquee = KeyguardUpdateMonitor.getInstance(mContext).isDeviceInteractive(); + setSelected(shouldMarquee); // Allow marquee to work. } @Override diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardMessageArea.java b/packages/Keyguard/src/com/android/keyguard/KeyguardMessageArea.java index 301b171..2951af9 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardMessageArea.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardMessageArea.java @@ -58,10 +58,10 @@ class KeyguardMessageArea extends TextView implements SecurityMessageDisplay { }; private KeyguardUpdateMonitorCallback mInfoCallback = new KeyguardUpdateMonitorCallback() { - public void onScreenTurnedOff(int why) { + public void onFinishedGoingToSleep(int why) { setSelected(false); }; - public void onScreenTurnedOn() { + public void onStartedWakingUp() { setSelected(true); }; }; @@ -126,8 +126,8 @@ class KeyguardMessageArea extends TextView implements SecurityMessageDisplay { @Override protected void onFinishInflate() { - final boolean screenOn = KeyguardUpdateMonitor.getInstance(mContext).isScreenOn(); - setSelected(screenOn); // This is required to ensure marquee works + boolean shouldMarquee = KeyguardUpdateMonitor.getInstance(mContext).isDeviceInteractive(); + setSelected(shouldMarquee); // This is required to ensure marquee works } private void securityMessageChanged(CharSequence message) { diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java index 4e9621a..f95b0ae 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardStatusView.java @@ -67,12 +67,12 @@ public class KeyguardStatusView extends GridLayout { } @Override - public void onScreenTurnedOn() { + public void onStartedWakingUp() { setEnableMarquee(true); } @Override - public void onScreenTurnedOff(int why) { + public void onFinishedGoingToSleep(int why) { setEnableMarquee(false); } @@ -113,8 +113,8 @@ public class KeyguardStatusView extends GridLayout { mClockView.setShowCurrentUserTime(true); mOwnerInfo = (TextView) findViewById(R.id.owner_info); - final boolean screenOn = KeyguardUpdateMonitor.getInstance(mContext).isScreenOn(); - setEnableMarquee(screenOn); + boolean shouldMarquee = KeyguardUpdateMonitor.getInstance(mContext).isDeviceInteractive(); + setEnableMarquee(shouldMarquee); refresh(); updateOwnerInfo(); diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java index ec185eb..9df0818 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -102,6 +102,23 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { = "com.android.facelock.FACE_UNLOCK_STOPPED"; private static final String FINGERPRINT_WAKE_LOCK_NAME = "wake-and-unlock wakelock"; + /** + * 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_WAKE_TO_BOUNCER = 2; + // Callback messages private static final int MSG_TIME_UPDATE = 301; private static final int MSG_BATTERY_UPDATE = 302; @@ -117,8 +134,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { private static final int MSG_USER_SWITCH_COMPLETE = 314; private static final int MSG_USER_INFO_CHANGED = 317; private static final int MSG_REPORT_EMERGENCY_CALL_ACTION = 318; - private static final int MSG_SCREEN_TURNED_ON = 319; - private static final int MSG_SCREEN_TURNED_OFF = 320; + private static final int MSG_STARTED_WAKING_UP = 319; + private static final int MSG_FINISHED_GOING_TO_SLEEP = 320; private static final int MSG_KEYGUARD_BOUNCER_CHANGED = 322; private static final int MSG_FACE_UNLOCK_STATE_CHANGED = 327; private static final int MSG_SIM_SUBSCRIPTION_INFO_CHANGED = 328; @@ -155,6 +172,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { private boolean mSwitchingUser; + private boolean mDeviceInteractive; private boolean mScreenOn; private SubscriptionManager mSubscriptionManager; private List<SubscriptionInfo> mSubscriptionInfo; @@ -211,11 +229,11 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { case MSG_REPORT_EMERGENCY_CALL_ACTION: handleReportEmergencyCallAction(); break; - case MSG_SCREEN_TURNED_OFF: - handleScreenTurnedOff(msg.arg1); + case MSG_FINISHED_GOING_TO_SLEEP: + handleFinishedGoingToSleep(msg.arg1); break; - case MSG_SCREEN_TURNED_ON: - handleScreenTurnedOn(); + case MSG_STARTED_WAKING_UP: + handleStartedWakingUp(); break; case MSG_FACE_UNLOCK_STATE_CHANGED: handleFaceUnlockStateChanged(msg.arg1 != 0, msg.arg2); @@ -248,7 +266,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { private static int sCurrentUser; - private boolean mWakeAndUnlocking; + private int mFpWakeMode; public synchronized static void setCurrentUser(int currentUser) { sCurrentUser = currentUser; @@ -371,19 +389,21 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { if (acquireInfo != FingerprintManager.FINGERPRINT_ACQUIRED_GOOD) { return; } - if (!mScreenOn) { + if (!mDeviceInteractive && !mScreenOn) { releaseFingerprintWakeLock(); mWakeLock = mPowerManager.newWakeLock( PowerManager.PARTIAL_WAKE_LOCK, FINGERPRINT_WAKE_LOCK_NAME); mWakeLock.acquire(); - mWakeAndUnlocking = true; + mFpWakeMode = FP_WAKE_DIRECT_UNLOCK; if (DEBUG_FP_WAKELOCK) { Log.i(TAG, "fingerprint acquired, grabbing fp wakelock"); } mHandler.postDelayed(mReleaseFingerprintWakeLockRunnable, FINGERPRINT_WAKELOCK_TIMEOUT_MS); + } else if (!mDeviceInteractive) { + mFpWakeMode = FP_WAKE_WAKE_TO_BOUNCER; } else { - mWakeAndUnlocking = false; + mFpWakeMode = FP_WAKE_NONE; } } @@ -409,7 +429,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { } private void handleFingerprintAuthenticated() { - if (mWakeAndUnlocking) { + if (mFpWakeMode == FP_WAKE_WAKE_TO_BOUNCER || mFpWakeMode == FP_WAKE_DIRECT_UNLOCK) { if (DEBUG_FP_WAKELOCK) { Log.i(TAG, "fp wakelock: Authenticated, waking up..."); } @@ -428,7 +448,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { Log.d(TAG, "Fingerprint disabled by DPM for userId: " + userId); return; } - onFingerprintAuthenticated(userId, mWakeAndUnlocking); + onFingerprintAuthenticated(userId, mFpWakeMode == FP_WAKE_DIRECT_UNLOCK); } finally { setFingerprintRunningDetectionRunning(false); } @@ -749,24 +769,24 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { return sInstance; } - protected void handleScreenTurnedOn() { + protected void handleStartedWakingUp() { updateFingerprintListeningState(); final int count = mCallbacks.size(); for (int i = 0; i < count; i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { - cb.onScreenTurnedOn(); + cb.onStartedWakingUp(); } } } - protected void handleScreenTurnedOff(int arg1) { + protected void handleFinishedGoingToSleep(int arg1) { clearFingerprintRecognized(); final int count = mCallbacks.size(); for (int i = 0; i < count; i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { - cb.onScreenTurnedOff(arg1); + cb.onFinishedGoingToSleep(arg1); } } updateFingerprintListeningState(); @@ -1428,22 +1448,34 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener { // TODO: use these callbacks elsewhere in place of the existing notifyScreen*() // (KeyguardViewMediator, KeyguardHostView) + public void dispatchStartedWakingUp() { + synchronized (this) { + mDeviceInteractive = true; + } + mHandler.sendEmptyMessage(MSG_STARTED_WAKING_UP); + } + + public void dispatchFinishedGoingToSleep(int why) { + synchronized(this) { + mDeviceInteractive = false; + } + mHandler.sendMessage(mHandler.obtainMessage(MSG_FINISHED_GOING_TO_SLEEP, why, 0)); + } + public void dispatchScreenTurnedOn() { synchronized (this) { mScreenOn = true; } - mHandler.sendEmptyMessage(MSG_SCREEN_TURNED_ON); } - public void dispatchScreenTurnedOff(int why) { + public void dispatchScreenTurnedOff() { synchronized(this) { mScreenOn = false; } - mHandler.sendMessage(mHandler.obtainMessage(MSG_SCREEN_TURNED_OFF, why, 0)); } - public boolean isScreenOn() { - return mScreenOn; + public boolean isDeviceInteractive() { + return mDeviceInteractive; } /** diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java index 9fd8d30..0cdf999 100644 --- a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java +++ b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitorCallback.java @@ -148,17 +148,17 @@ public class KeyguardUpdateMonitorCallback { } /** - * Called when the screen turns on + * Called when the device has started waking up. */ - public void onScreenTurnedOn() { } + public void onStartedWakingUp() { } /** - * Called when the screen turns off + * Called when the device has finished going to sleep. * @param why either {@link WindowManagerPolicy#OFF_BECAUSE_OF_ADMIN}, * {@link WindowManagerPolicy#OFF_BECAUSE_OF_USER}, or * {@link WindowManagerPolicy#OFF_BECAUSE_OF_TIMEOUT}. */ - public void onScreenTurnedOff(int why) { } + public void onFinishedGoingToSleep(int why) { } /** * Called when trust changes for a user. |