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

am: 4a08215328

Change-Id: I77ee856726f9e3ce932115c77733c405e55a2bf9
This commit is contained in:
Lucas Dupin
2019-06-22 17:25:22 -07:00
committed by android-build-merger
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;
/**
* 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.
*/
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.
@@ -283,15 +277,18 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback {
wakeUp.run();
}
switch (mMode) {
case MODE_DISMISS_BOUNCER:
Trace.beginSection("MODE_DISMISS");
mStatusBarKeyguardViewManager.notifyKeyguardAuthenticated(
false /* strongAuth */);
case MODE_UNLOCK:
Trace.beginSection("MODE_UNLOCK");
if (!wasDeviceInteractive) {
mPendingShowBouncer = true;
} else {
mStatusBarKeyguardViewManager.notifyKeyguardAuthenticated(
false /* strongAuth */);
}
Trace.endSection();
break;
case MODE_UNLOCK:
case MODE_SHOW_BOUNCER:
Trace.beginSection("MODE_UNLOCK or MODE_SHOW_BOUNCER");
Trace.beginSection("MODE_SHOW_BOUNCER");
if (!wasDeviceInteractive) {
mPendingShowBouncer = true;
} else {
@@ -381,6 +378,8 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback {
if (!mStatusBarKeyguardViewManager.isShowing()) {
return MODE_ONLY_WAKE;
} 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;
} else if (!face && (unlockingAllowed || !mUnlockMethodCache.isMethodSecure())) {
return MODE_WAKE_AND_UNLOCK;
@@ -388,9 +387,15 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback {
if (!(mDozeScrimController.isPulsing() && !unlockingAllowed)) {
Log.wtf(TAG, "Face somehow arrived when the device was not interactive");
}
// 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.
return MODE_ONLY_WAKE;
if (faceStayingOnKeyguard) {
// 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.
return MODE_ONLY_WAKE;
} else {
// Wake-up fading out nicely
return MODE_WAKE_AND_UNLOCK_PULSING;
}
} else {
return MODE_SHOW_BOUNCER;
}
@@ -399,10 +404,9 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback {
return MODE_WAKE_AND_UNLOCK_FROM_DREAM;
}
if (mStatusBarKeyguardViewManager.isShowing()) {
if ((mStatusBarKeyguardViewManager.isBouncerShowing()
|| mStatusBarKeyguardViewManager.isBouncerPartiallyVisible())
if ((mStatusBarKeyguardViewManager.isBouncerShowing())
&& unlockingAllowed) {
return MODE_DISMISS_BOUNCER;
return MODE_UNLOCK;
} else if (unlockingAllowed) {
return faceStayingOnKeyguard ? MODE_ONLY_WAKE : MODE_UNLOCK;
} else if (face) {

View File

@@ -345,11 +345,6 @@ public class KeyguardBouncer {
&& 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
* hidden yet, {@code false} otherwise.

View File

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

View File

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

View File

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