Merge "Wake-and-unlock imprevements" into qt-r1-dev

This commit is contained in:
Lucas Dupin
2019-06-22 23:49:50 +00:00
committed by Android (Google) Code Review
5 changed files with 27 additions and 31 deletions

View File

@@ -83,16 +83,10 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback {
*/ */
public static final int MODE_UNLOCK = 5; public static final int MODE_UNLOCK = 5;
/**
* Mode in which fingerprint brings up the bouncer because fingerprint unlocking is currently
* not allowed.
*/
public static final int MODE_DISMISS_BOUNCER = 6;
/** /**
* Mode in which fingerprint wakes and unlocks the device from a dream. * Mode in which fingerprint wakes and unlocks the device from a dream.
*/ */
public static final int MODE_WAKE_AND_UNLOCK_FROM_DREAM = 7; public static final int MODE_WAKE_AND_UNLOCK_FROM_DREAM = 6;
/** /**
* How much faster we collapse the lockscreen when authenticating with biometric. * How much faster we collapse the lockscreen when authenticating with biometric.
@@ -283,15 +277,18 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback {
wakeUp.run(); wakeUp.run();
} }
switch (mMode) { switch (mMode) {
case MODE_DISMISS_BOUNCER: case MODE_UNLOCK:
Trace.beginSection("MODE_DISMISS"); Trace.beginSection("MODE_UNLOCK");
if (!wasDeviceInteractive) {
mPendingShowBouncer = true;
} else {
mStatusBarKeyguardViewManager.notifyKeyguardAuthenticated( mStatusBarKeyguardViewManager.notifyKeyguardAuthenticated(
false /* strongAuth */); false /* strongAuth */);
}
Trace.endSection(); Trace.endSection();
break; break;
case MODE_UNLOCK:
case MODE_SHOW_BOUNCER: case MODE_SHOW_BOUNCER:
Trace.beginSection("MODE_UNLOCK or MODE_SHOW_BOUNCER"); Trace.beginSection("MODE_SHOW_BOUNCER");
if (!wasDeviceInteractive) { if (!wasDeviceInteractive) {
mPendingShowBouncer = true; mPendingShowBouncer = true;
} else { } else {
@@ -381,6 +378,8 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback {
if (!mStatusBarKeyguardViewManager.isShowing()) { if (!mStatusBarKeyguardViewManager.isShowing()) {
return MODE_ONLY_WAKE; return MODE_ONLY_WAKE;
} else if (mDozeScrimController.isPulsing() && unlockingAllowed) { } else if (mDozeScrimController.isPulsing() && unlockingAllowed) {
// Let's not wake-up to lock screen when not bypassing, otherwise the notification
// would move as the user tried to tap it.
return faceStayingOnKeyguard ? MODE_NONE : MODE_WAKE_AND_UNLOCK_PULSING; return faceStayingOnKeyguard ? MODE_NONE : MODE_WAKE_AND_UNLOCK_PULSING;
} else if (!face && (unlockingAllowed || !mUnlockMethodCache.isMethodSecure())) { } else if (!face && (unlockingAllowed || !mUnlockMethodCache.isMethodSecure())) {
return MODE_WAKE_AND_UNLOCK; return MODE_WAKE_AND_UNLOCK;
@@ -388,9 +387,15 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback {
if (!(mDozeScrimController.isPulsing() && !unlockingAllowed)) { if (!(mDozeScrimController.isPulsing() && !unlockingAllowed)) {
Log.wtf(TAG, "Face somehow arrived when the device was not interactive"); Log.wtf(TAG, "Face somehow arrived when the device was not interactive");
} }
if (faceStayingOnKeyguard) {
// We could theoretically return MODE_NONE, but this means that the device // We could theoretically return MODE_NONE, but this means that the device
// would be not interactive, unlocked, and the user would not see the device state. // would be not interactive, unlocked, and the user would not see the device
// state.
return MODE_ONLY_WAKE; return MODE_ONLY_WAKE;
} else {
// Wake-up fading out nicely
return MODE_WAKE_AND_UNLOCK_PULSING;
}
} else { } else {
return MODE_SHOW_BOUNCER; return MODE_SHOW_BOUNCER;
} }
@@ -399,10 +404,9 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback {
return MODE_WAKE_AND_UNLOCK_FROM_DREAM; return MODE_WAKE_AND_UNLOCK_FROM_DREAM;
} }
if (mStatusBarKeyguardViewManager.isShowing()) { if (mStatusBarKeyguardViewManager.isShowing()) {
if ((mStatusBarKeyguardViewManager.isBouncerShowing() if ((mStatusBarKeyguardViewManager.isBouncerShowing())
|| mStatusBarKeyguardViewManager.isBouncerPartiallyVisible())
&& unlockingAllowed) { && unlockingAllowed) {
return MODE_DISMISS_BOUNCER; return MODE_UNLOCK;
} else if (unlockingAllowed) { } else if (unlockingAllowed) {
return faceStayingOnKeyguard ? MODE_ONLY_WAKE : MODE_UNLOCK; return faceStayingOnKeyguard ? MODE_ONLY_WAKE : MODE_UNLOCK;
} else if (face) { } else if (face) {

View File

@@ -345,11 +345,6 @@ public class KeyguardBouncer {
&& mExpansion == EXPANSION_VISIBLE && !isAnimatingAway(); && mExpansion == EXPANSION_VISIBLE && !isAnimatingAway();
} }
public boolean isPartiallyVisible() {
return (mShowingSoon || (mRoot != null && mRoot.getVisibility() == View.VISIBLE))
&& mExpansion != EXPANSION_HIDDEN && !isAnimatingAway();
}
/** /**
* @return {@code true} when bouncer's pre-hide animation already started but isn't completely * @return {@code true} when bouncer's pre-hide animation already started but isn't completely
* hidden yet, {@code false} otherwise. * hidden yet, {@code false} otherwise.

View File

@@ -452,7 +452,8 @@ public class LockIcon extends KeyguardAffordanceView implements OnUserInfoChange
private int getState() { private int getState() {
KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext); KeyguardUpdateMonitor updateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
if ((mUnlockMethodCache.canSkipBouncer() || !mKeyguardShowing) && !mSimLocked) { if ((mUnlockMethodCache.canSkipBouncer() || !mKeyguardShowing
|| mKeyguardMonitor.isKeyguardGoingAway()) && !mSimLocked) {
return STATE_LOCK_OPEN; return STATE_LOCK_OPEN;
} else if (mTransientBiometricsError) { } else if (mTransientBiometricsError) {
return STATE_BIOMETRICS_ERROR; return STATE_BIOMETRICS_ERROR;

View File

@@ -677,10 +677,6 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
return mBouncer.isShowing(); return mBouncer.isShowing();
} }
public boolean isBouncerPartiallyVisible() {
return mBouncer.isPartiallyVisible();
}
public boolean isFullscreenBouncer() { public boolean isFullscreenBouncer() {
return mBouncer.isFullscreenBouncer(); return mBouncer.isFullscreenBouncer();
} }

View File

@@ -120,7 +120,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
BiometricSourceType.FINGERPRINT); BiometricSourceType.FINGERPRINT);
verify(mStatusBarKeyguardViewManager, never()).showBouncer(anyBoolean()); verify(mStatusBarKeyguardViewManager, never()).showBouncer(anyBoolean());
verify(mStatusBarKeyguardViewManager).animateCollapsePanels(anyFloat()); verify(mStatusBarKeyguardViewManager).notifyKeyguardAuthenticated(eq(false));
} }
@Test @Test
@@ -151,7 +151,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT, mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT,
BiometricSourceType.FACE); BiometricSourceType.FACE);
verify(mStatusBarKeyguardViewManager).animateCollapsePanels(anyFloat()); verify(mStatusBarKeyguardViewManager).notifyKeyguardAuthenticated(eq(false));
} }
@Test @Test