Merge "Fix issue where auth wouldn't be triggered"
This commit is contained in:
committed by
Android (Google) Code Review
commit
8bd248acfc
@@ -205,6 +205,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
||||
private boolean mKeyguardGoingAway;
|
||||
private boolean mGoingToSleep;
|
||||
private boolean mBouncer;
|
||||
private boolean mAuthInterruptActive;
|
||||
private boolean mBootCompleted;
|
||||
private boolean mNeedsSlowUnlockTransition;
|
||||
private boolean mHasLockscreenWallpaper;
|
||||
@@ -1565,10 +1566,15 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
||||
}
|
||||
|
||||
/**
|
||||
* Request passive authentication, when sensors detect that a user might be present.
|
||||
* Called whenever passive authentication is requested or aborted by a sensor.
|
||||
* @param active If the interrupt started or ended.
|
||||
*/
|
||||
public void onAuthInterruptDetected() {
|
||||
if (DEBUG) Log.d(TAG, "onAuthInterruptDetected()");
|
||||
public void onAuthInterruptDetected(boolean active) {
|
||||
if (DEBUG) Log.d(TAG, "onAuthInterruptDetected(" + active + ")");
|
||||
if (mAuthInterruptActive == active) {
|
||||
return;
|
||||
}
|
||||
mAuthInterruptActive = active;
|
||||
updateFaceListeningState();
|
||||
}
|
||||
|
||||
@@ -1612,7 +1618,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
||||
final boolean awakeKeyguard = mKeyguardIsVisible && mDeviceInteractive && !mGoingToSleep;
|
||||
final int user = getCurrentUser();
|
||||
|
||||
return (mBouncer || awakeKeyguard || shouldListenForFaceAssistant())
|
||||
return (mBouncer || mAuthInterruptActive || awakeKeyguard || shouldListenForFaceAssistant())
|
||||
&& !mSwitchingUser && !getUserCanSkipBouncer(user) && !isFaceDisabled(user)
|
||||
&& !mKeyguardGoingAway && !mFaceLockedOut && mFaceSettingEnabledForUser
|
||||
&& mUserManager.isUserUnlocked(user);
|
||||
|
||||
@@ -3895,11 +3895,7 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
return;
|
||||
}
|
||||
|
||||
if (mKeyguardUpdateMonitor != null
|
||||
&& reason == DozeLog.PULSE_REASON_SENSOR_WAKE_LOCK_SCREEN) {
|
||||
mKeyguardUpdateMonitor.onAuthInterruptDetected();
|
||||
}
|
||||
|
||||
boolean passiveAuthInterrupt = reason == DozeLog.PULSE_REASON_SENSOR_WAKE_LOCK_SCREEN;
|
||||
// Set the state to pulsing, so ScrimController will know what to do once we ask it to
|
||||
// execute the transition. The pulse callback will then be invoked when the scrims
|
||||
// are black, indicating that StatusBar is ready to present the rest of the UI.
|
||||
@@ -3925,6 +3921,9 @@ public class StatusBar extends SystemUI implements DemoMode,
|
||||
mNotificationPanel.setPulsing(pulsing);
|
||||
mVisualStabilityManager.setPulsing(pulsing);
|
||||
mIgnoreTouchWhilePulsing = false;
|
||||
if (mKeyguardUpdateMonitor != null && passiveAuthInterrupt) {
|
||||
mKeyguardUpdateMonitor.onAuthInterruptDetected(pulsing /* active */);
|
||||
}
|
||||
updateScrimController();
|
||||
}
|
||||
}, reason);
|
||||
|
||||
@@ -655,13 +655,19 @@ public class StatusBarTest extends SysuiTestCase {
|
||||
DozeLog.REASON_SENSOR_DOUBLE_TAP,
|
||||
DozeLog.REASON_SENSOR_TAP));
|
||||
|
||||
doAnswer(invocation -> {
|
||||
DozeHost.PulseCallback callback = invocation.getArgument(0);
|
||||
callback.onPulseStarted();
|
||||
return null;
|
||||
}).when(mDozeScrimController).pulse(any(), anyInt());
|
||||
|
||||
for (int i = 0; i < DozeLog.REASONS; i++) {
|
||||
reset(mKeyguardUpdateMonitor);
|
||||
mStatusBar.mDozeServiceHost.pulseWhileDozing(mock(DozeHost.PulseCallback.class), i);
|
||||
if (reasonsWantingAuth.contains(i)) {
|
||||
verify(mKeyguardUpdateMonitor).onAuthInterruptDetected();
|
||||
verify(mKeyguardUpdateMonitor).onAuthInterruptDetected(eq(true));
|
||||
} else if (reasonsSkippingAuth.contains(i) || reasonsThatDontPulse.contains(i)) {
|
||||
verify(mKeyguardUpdateMonitor, never()).onAuthInterruptDetected();
|
||||
verify(mKeyguardUpdateMonitor, never()).onAuthInterruptDetected(eq(true));
|
||||
} else {
|
||||
throw new AssertionError("Reason " + i + " isn't specified as wanting or skipping"
|
||||
+ " passive auth. Please consider how this pulse reason should behave.");
|
||||
|
||||
Reference in New Issue
Block a user