Merge "If enrolled show udfps bouncer on camera roll auth" into sc-dev

This commit is contained in:
Beverly Tai
2021-04-21 12:25:11 +00:00
committed by Android (Google) Code Review
11 changed files with 171 additions and 76 deletions

View File

@@ -2009,9 +2009,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
// TODO: Add support for multiple fingerprint sensors, b/173730729
updateUdfpsEnrolled(getCurrentUser());
boolean shouldListenForFingerprint =
isUdfpsEnrolled() ? shouldListenForUdfps() : shouldListenForFingerprint();
boolean runningOrRestarting = mFingerprintRunningState == BIOMETRIC_STATE_RUNNING
final boolean shouldListenForFingerprint = shouldListenForFingerprint(isUdfpsEnrolled());
final boolean runningOrRestarting = mFingerprintRunningState == BIOMETRIC_STATE_RUNNING
|| mFingerprintRunningState == BIOMETRIC_STATE_CANCELLING_RESTARTING;
if (runningOrRestarting && !shouldListenForFingerprint) {
stopListeningForFingerprint();
@@ -2092,28 +2091,36 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
&& !mUserHasTrust.get(getCurrentUser(), false);
}
private boolean shouldListenForFingerprint() {
final boolean allowedOnBouncer =
!(mFingerprintLockedOut && mBouncer && mCredentialAttempted);
@VisibleForTesting
protected boolean shouldListenForFingerprint(boolean isUdfps) {
final boolean shouldListenKeyguardState =
mKeyguardIsVisible
|| !mDeviceInteractive
|| (mBouncer && !mKeyguardGoingAway)
|| mGoingToSleep
|| shouldListenForFingerprintAssistant()
|| (mKeyguardOccluded && mIsDreaming)
|| (isUdfps && mKeyguardOccluded);
// Only listen if this KeyguardUpdateMonitor belongs to the primary user. There is an
// instance of KeyguardUpdateMonitor for each user but KeyguardUpdateMonitor is user-aware.
final boolean shouldListen = (mKeyguardIsVisible || !mDeviceInteractive ||
(mBouncer && !mKeyguardGoingAway) || mGoingToSleep ||
shouldListenForFingerprintAssistant() || (mKeyguardOccluded && mIsDreaming))
&& !mSwitchingUser && !isFingerprintDisabled(getCurrentUser())
&& (!mKeyguardGoingAway || !mDeviceInteractive) && mIsPrimaryUser
&& allowedOnBouncer && mBiometricEnabledForUser.get(getCurrentUser());
return shouldListen;
}
final boolean shouldListenUserState =
!mSwitchingUser
&& !isFingerprintDisabled(getCurrentUser())
&& (!mKeyguardGoingAway || !mDeviceInteractive)
&& mIsPrimaryUser
&& mBiometricEnabledForUser.get(getCurrentUser());
@VisibleForTesting
boolean shouldListenForUdfps() {
return shouldListenForFingerprint()
&& !mBouncer
&& !getUserCanSkipBouncer(getCurrentUser())
final boolean shouldListenBouncerState =
isUdfps ? !mBouncer
: !(mFingerprintLockedOut && mBouncer && mCredentialAttempted);
final boolean shouldListenUdfpsState = !isUdfps
|| (!getUserCanSkipBouncer(getCurrentUser())
&& !isEncryptedOrLockdown(getCurrentUser())
&& mStrongAuthTracker.hasUserAuthenticatedSinceBoot();
&& mStrongAuthTracker.hasUserAuthenticatedSinceBoot());
return shouldListenKeyguardState && shouldListenUserState && shouldListenBouncerState
&& shouldListenUdfpsState;
}
/**
@@ -3235,13 +3242,13 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
pw.println(" disabled(DPM)=" + isFingerprintDisabled(userId));
pw.println(" possible=" + isUnlockWithFingerprintPossible(userId));
pw.println(" listening: actual=" + mFingerprintRunningState
+ " expected=" + (shouldListenForFingerprint() ? 1 : 0));
+ " expected=" + (shouldListenForFingerprint(false) ? 1 : 0));
pw.println(" strongAuthFlags=" + Integer.toHexString(strongAuthFlags));
pw.println(" trustManaged=" + getUserTrustIsManaged(userId));
pw.println(" udfpsEnrolled=" + isUdfpsEnrolled());
pw.println(" enabledByUser=" + mBiometricEnabledForUser.get(userId));
if (isUdfpsEnrolled()) {
pw.println(" shouldListenForUdfps=" + shouldListenForUdfps());
pw.println(" shouldListenForUdfps=" + shouldListenForFingerprint(true));
pw.println(" bouncerVisible=" + mBouncer);
pw.println(" mStatusBarState="
+ StatusBarState.toShortString(mStatusBarState));

View File

@@ -165,6 +165,18 @@ abstract class UdfpsAnimationViewController<T extends UdfpsAnimationView>
mView.postInvalidate();
}
/**
* Whether to listen for touches outside of the view.
*/
boolean listenForTouchesOutsideView() {
return false;
}
/**
* Called on touches outside of the view if listenForTouchesOutsideView returns true
*/
void onTouchOutsideView() { }
private final StatusBar.ExpansionChangedListener mStatusBarExpansionChangedListener =
new StatusBar.ExpansionChangedListener() {
@Override

View File

@@ -39,6 +39,7 @@ import android.hardware.fingerprint.IUdfpsOverlayControllerCallback;
import android.media.AudioAttributes;
import android.os.Handler;
import android.os.Looper;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.SystemClock;
import android.os.Trace;
@@ -106,6 +107,7 @@ public class UdfpsController implements DozeReceiver, HbmCallback {
@NonNull private final Vibrator mVibrator;
@NonNull private final Handler mMainHandler;
@NonNull private final FalsingManager mFalsingManager;
@NonNull private final PowerManager mPowerManager;
// Currently the UdfpsController supports a single UDFPS sensor. If devices have multiple
// sensors, this, in addition to a lot of the code here, will be updated.
@VisibleForTesting final FingerprintSensorPropertiesInternal mSensorProps;
@@ -266,6 +268,9 @@ public class UdfpsController implements DozeReceiver, HbmCallback {
final boolean isFingerDown = udfpsView.isIlluminationRequested();
boolean handled = false;
switch (event.getActionMasked()) {
case MotionEvent.ACTION_OUTSIDE:
udfpsView.onTouchOutsideView();
break;
case MotionEvent.ACTION_DOWN:
// To simplify the lifecycle of the velocity tracker, make sure it's never null
// after ACTION_DOWN, and always null after ACTION_CANCEL or ACTION_UP.
@@ -332,6 +337,8 @@ public class UdfpsController implements DozeReceiver, HbmCallback {
onFingerDown((int) x, (int) y, minor, major);
Log.v(TAG, "onTouch | finger down: " + touchInfo);
mTouchLogTime = SystemClock.elapsedRealtime();
mPowerManager.userActivity(SystemClock.uptimeMillis(),
PowerManager.USER_ACTIVITY_EVENT_TOUCH, 0);
handled = true;
} else if (sinceLastLog >= MIN_TOUCH_LOG_INTERVAL) {
Log.v(TAG, "onTouch | finger move: " + touchInfo);
@@ -377,7 +384,8 @@ public class UdfpsController implements DozeReceiver, HbmCallback {
@NonNull DumpManager dumpManager,
@NonNull KeyguardUpdateMonitor keyguardUpdateMonitor,
@NonNull KeyguardViewMediator keyguardViewMediator,
@NonNull FalsingManager falsingManager) {
@NonNull FalsingManager falsingManager,
@NonNull PowerManager powerManager) {
mContext = context;
// TODO (b/185124905): inject main handler and vibrator once done prototyping
mMainHandler = new Handler(Looper.getMainLooper());
@@ -395,6 +403,7 @@ public class UdfpsController implements DozeReceiver, HbmCallback {
mKeyguardUpdateMonitor = keyguardUpdateMonitor;
mKeyguardViewMediator = keyguardViewMediator;
mFalsingManager = falsingManager;
mPowerManager = powerManager;
mSensorProps = findFirstUdfps();
// At least one UDFPS sensor exists
@@ -403,10 +412,7 @@ public class UdfpsController implements DozeReceiver, HbmCallback {
mCoreLayoutParams = new WindowManager.LayoutParams(
WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
getCoreLayoutParamFlags(),
PixelFormat.TRANSLUCENT);
mCoreLayoutParams.setTitle(TAG);
mCoreLayoutParams.setFitInsetsTypes(0);
@@ -422,6 +428,13 @@ public class UdfpsController implements DozeReceiver, HbmCallback {
context.registerReceiver(mBroadcastReceiver, filter);
}
private int getCoreLayoutParamFlags() {
return WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
| WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
}
@Nullable
private FingerprintSensorPropertiesInternal findFirstUdfps() {
for (FingerprintSensorPropertiesInternal props :
@@ -467,6 +480,11 @@ public class UdfpsController implements DozeReceiver, HbmCallback {
final int paddingX = animation != null ? animation.getPaddingX() : 0;
final int paddingY = animation != null ? animation.getPaddingY() : 0;
mCoreLayoutParams.flags = getCoreLayoutParamFlags();
if (animation.listenForTouchesOutsideView()) {
mCoreLayoutParams.flags |= WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH;
}
// Default dimensions assume portrait mode.
mCoreLayoutParams.x = mSensorProps.sensorLocationX - mSensorProps.sensorRadius - paddingX;
mCoreLayoutParams.y = mSensorProps.sensorLocationY - mSensorProps.sensorRadius - paddingY;

View File

@@ -52,12 +52,13 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
@NonNull private final KeyguardViewMediator mKeyguardViewMediator;
@Nullable private Runnable mCancelRunnable;
private boolean mShowBouncer;
private boolean mShowingUdfpsBouncer;
private boolean mQsExpanded;
private boolean mFaceDetectRunning;
private boolean mHintShown;
private boolean mTransitioningFromHome;
private int mStatusBarState;
private boolean mKeyguardIsVisible;
protected UdfpsKeyguardViewController(
@NonNull UdfpsKeyguardView view,
@@ -90,8 +91,11 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
final float dozeAmount = mStatusBarStateController.getDozeAmount();
mStatusBarStateController.addCallback(mStateListener);
mStateListener.onDozeAmountChanged(dozeAmount, dozeAmount);
mStateListener.onStateChanged(mStatusBarStateController.getState());
mAlternateAuthInterceptor.setQsExpanded(mKeyguardViewManager.isQsExpanded());
mStatusBarState = mStatusBarStateController.getState();
mQsExpanded = mKeyguardViewManager.isQsExpanded();
mKeyguardIsVisible = mKeyguardUpdateMonitor.isKeyguardVisible();
updatePauseAuth();
mKeyguardViewManager.setAlternateAuthInterceptor(mAlternateAuthInterceptor);
}
@@ -102,7 +106,6 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
mFaceDetectRunning = false;
mStatusBarStateController.removeCallback(mStateListener);
mAlternateAuthInterceptor.hideAlternateAuthBouncer();
mKeyguardViewManager.setAlternateAuthInterceptor(null);
mTransitioningFromHome = false;
@@ -115,28 +118,32 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
@Override
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
super.dump(fd, pw, args);
pw.println("mShowBouncer=" + mShowBouncer);
pw.println("mShowingUdfpsBouncer=" + mShowingUdfpsBouncer);
pw.println("mFaceDetectRunning=" + mFaceDetectRunning);
pw.println("mTransitioningFromHomeToKeyguard=" + mTransitioningFromHome);
pw.println("mStatusBarState" + StatusBarState.toShortString(mStatusBarState));
pw.println("mQsExpanded=" + mQsExpanded);
pw.println("mKeyguardVisible=" + mKeyguardIsVisible);
}
/**
* Overrides non-bouncer show logic in shouldPauseAuth to still auth.
* Overrides non-bouncer show logic in shouldPauseAuth to still show icon.
* @return whether the udfpsBouncer has been newly shown or hidden
*/
private void showBouncer(boolean show) {
if (mShowBouncer == show) {
return;
private boolean showUdfpsBouncer(boolean show) {
if (mShowingUdfpsBouncer == show) {
return false;
}
mShowBouncer = show;
mShowingUdfpsBouncer = show;
updatePauseAuth();
if (mShowBouncer) {
if (mShowingUdfpsBouncer) {
mView.animateUdfpsBouncer();
} else {
// TODO: beverlyt, we not always want to cancelPostAuthActions
mView.animateAwayUdfpsBouncer(() -> mKeyguardViewManager.cancelPostAuthActions());
}
return true;
}
/**
@@ -145,7 +152,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
* is expanded, so this can be overridden with the showBouncer method.
*/
public boolean shouldPauseAuth() {
if (mShowBouncer) {
if (mShowingUdfpsBouncer) {
return false;
}
@@ -161,9 +168,36 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
return true;
}
if (!mKeyguardIsVisible) {
return true;
}
return false;
}
@Override
public boolean listenForTouchesOutsideView() {
return true;
}
@Override
public void onTouchOutsideView() {
maybeShowInputBouncer();
}
/**
* If we were previously showing the udfps bouncer, hide it and instead show the regular
* (pin/pattern/password) bouncer.
*
* Does nothing if we weren't previously showing the udfps bouncer.
*/
private void maybeShowInputBouncer() {
if (mShowingUdfpsBouncer) {
mKeyguardViewManager.resetAlternateAuth(false);
mKeyguardViewManager.showBouncer(true);
}
}
private void cancelDelayedHint() {
if (mCancelRunnable != null) {
mCancelRunnable.run();
@@ -198,7 +232,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
new StatusBarStateController.StateListener() {
@Override
public void onDozeAmountChanged(float linear, float eased) {
if (linear != 0) showBouncer(false);
if (linear != 0) showUdfpsBouncer(false);
mView.onDozeAmountChanged(linear, eased);
if (linear == 1f) {
// transition has finished
@@ -245,33 +279,28 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
cancelDelayedHint();
}
}
public void onKeyguardVisibilityChangedRaw(boolean showing) {
mKeyguardIsVisible = showing;
updatePauseAuth();
}
};
private final StatusBarKeyguardViewManager.AlternateAuthInterceptor mAlternateAuthInterceptor =
new StatusBarKeyguardViewManager.AlternateAuthInterceptor() {
@Override
public boolean showAlternateAuthBouncer() {
if (mShowBouncer) {
return false;
}
showBouncer(true);
return true;
return showUdfpsBouncer(true);
}
@Override
public boolean hideAlternateAuthBouncer() {
if (!mShowBouncer) {
return false;
}
showBouncer(false);
return true;
return showUdfpsBouncer(false);
}
@Override
public boolean isShowingAlternateAuthBouncer() {
return mShowBouncer;
return mShowingUdfpsBouncer;
}
@Override

View File

@@ -130,6 +130,10 @@ public class UdfpsView extends FrameLayout implements DozeReceiver, UdfpsIllumin
}
}
void onTouchOutsideView() {
mAnimationViewController.onTouchOutsideView();
}
void setAnimationViewController(UdfpsAnimationViewController animationViewController) {
mAnimationViewController = animationViewController;
}

View File

@@ -417,6 +417,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
mPendingShowBouncer = true;
} else {
showBouncer();
mKeyguardViewController.notifyKeyguardAuthenticated(false /* strongAuth */);
}
Trace.endSection();
break;

View File

@@ -3473,12 +3473,6 @@ public class NotificationPanelViewController extends PanelViewController {
@Override
public boolean onTouch(View v, MotionEvent event) {
final boolean showingOrAnimatingAltAuth =
mStatusBarKeyguardViewManager.isShowingAlternateAuthOrAnimating();
if (showingOrAnimatingAltAuth && event.getAction() == MotionEvent.ACTION_DOWN) {
mStatusBarKeyguardViewManager.resetAlternateAuth();
}
if (mBlockTouches || (mQsFullyExpanded && mQs != null
&& mQs.disallowPanelTouches())) {
return false;
@@ -3536,7 +3530,7 @@ public class NotificationPanelViewController extends PanelViewController {
}
handled |= super.onTouch(v, event);
return !mDozing || mPulsing || handled || showingOrAnimatingAltAuth;
return !mDozing || mPulsing || handled;
}
};
}

View File

@@ -251,7 +251,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
}
public void setAlternateAuthInterceptor(@Nullable AlternateAuthInterceptor authInterceptor) {
final boolean newlyNull = authInterceptor == null && mAlternateAuthInterceptor != null;
mAlternateAuthInterceptor = authInterceptor;
resetAlternateAuth(newlyNull);
}
private void registerListeners() {
@@ -432,7 +434,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
} else {
showBouncerOrKeyguard(hideBouncerWhenShowing);
}
resetAlternateAuth();
resetAlternateAuth(false);
mKeyguardUpdateManager.sendKeyguardReset();
updateStates();
}
@@ -441,9 +443,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
/**
* Stop showing any alternate auth methods
*/
public void resetAlternateAuth() {
if (mAlternateAuthInterceptor != null
&& mAlternateAuthInterceptor.hideAlternateAuthBouncer()) {
public void resetAlternateAuth(boolean forceUpdateScrim) {
if ((mAlternateAuthInterceptor != null
&& mAlternateAuthInterceptor.hideAlternateAuthBouncer())
|| forceUpdateScrim) {
mStatusBar.updateScrimController();
}
}
@@ -957,6 +960,12 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
*/
public void notifyKeyguardAuthenticated(boolean strongAuth) {
mBouncer.notifyKeyguardAuthenticated(strongAuth);
if (mAlternateAuthInterceptor != null && isShowingAlternateAuthOrAnimating()) {
resetAlternateAuth(false);
executeAfterKeyguardGoneAction();
}
}
public void showBouncerMessage(String message, ColorStateList colorState) {

View File

@@ -850,7 +850,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
when(mStrongAuthTracker.hasUserAuthenticatedSinceBoot()).thenReturn(true);
// THEN we should listen for udfps
assertThat(mKeyguardUpdateMonitor.shouldListenForUdfps()).isEqualTo(true);
assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(true)).isEqualTo(true);
}
@Test
@@ -865,7 +865,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
when(mStrongAuthTracker.hasUserAuthenticatedSinceBoot()).thenReturn(false);
// THEN we shouldn't listen for udfps
assertThat(mKeyguardUpdateMonitor.shouldListenForUdfps()).isEqualTo(false);
assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(true)).isEqualTo(false);
}
@Test
@@ -880,7 +880,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
setKeyguardBouncerVisibility(true /* isVisible */);
// THEN we shouldn't listen for udfps
assertThat(mKeyguardUpdateMonitor.shouldListenForUdfps()).isEqualTo(false);
assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(true)).isEqualTo(false);
}
@Test
@@ -895,7 +895,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
KeyguardUpdateMonitor.getCurrentUser(), 0 /* flags */);
// THEN we shouldn't listen for udfps
assertThat(mKeyguardUpdateMonitor.shouldListenForUdfps()).isEqualTo(false);
assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(true)).isEqualTo(false);
}
@Test
@@ -910,7 +910,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
KeyguardUpdateMonitor.getCurrentUser(), false);
// THEN we shouldn't listen for udfps
assertThat(mKeyguardUpdateMonitor.shouldListenForUdfps()).isEqualTo(false);
assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(true)).isEqualTo(false);
}
@Test
@@ -925,7 +925,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase {
KeyguardUpdateMonitor.StrongAuthTracker.STRONG_AUTH_REQUIRED_AFTER_USER_LOCKDOWN);
// THEN we shouldn't listen for udfps
assertThat(mKeyguardUpdateMonitor.shouldListenForUdfps()).isEqualTo(false);
assertThat(mKeyguardUpdateMonitor.shouldListenForFingerprint(true)).isEqualTo(false);
}
@Test

View File

@@ -108,6 +108,8 @@ public class UdfpsControllerTest extends SysuiTestCase {
private IUdfpsOverlayControllerCallback mUdfpsOverlayControllerCallback;
@Mock
private FalsingManager mFalsingManager;
@Mock
private PowerManager mPowerManager;
private FakeExecutor mFgExecutor;
@@ -160,7 +162,8 @@ public class UdfpsControllerTest extends SysuiTestCase {
mDumpManager,
mKeyguardUpdateMonitor,
mKeyguardViewMediator,
mFalsingManager);
mFalsingManager,
mPowerManager);
verify(mFingerprintManager).setUdfpsOverlayController(mOverlayCaptor.capture());
mOverlayController = mOverlayCaptor.getValue();

View File

@@ -28,6 +28,7 @@ import android.testing.TestableLooper.RunWithLooper;
import androidx.test.filters.SmallTest;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.keyguard.KeyguardUpdateMonitorCallback;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.keyguard.KeyguardViewMediator;
@@ -81,10 +82,14 @@ public class UdfpsKeyguardViewControllerTest extends SysuiTestCase {
mAltAuthInterceptorCaptor;
private StatusBarKeyguardViewManager.AlternateAuthInterceptor mAltAuthInterceptor;
@Captor private ArgumentCaptor<KeyguardUpdateMonitorCallback> mUpdateMonitorCallbackCaptor;
private KeyguardUpdateMonitorCallback mKeyguardUpdateMonitorCallback;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
when(mKeyguardViewMediator.isAnimatingScreenOff()).thenReturn(false);
when(mKeyguardUpdateMonitor.isKeyguardVisible()).thenReturn(true);
mController = new UdfpsKeyguardViewController(
mView,
mStatusBarStateController,
@@ -158,6 +163,17 @@ public class UdfpsKeyguardViewControllerTest extends SysuiTestCase {
assertFalse(mController.shouldPauseAuth());
}
@Test
public void testShouldPauseAuthKeyguardNotVisible() {
mController.onViewAttached();
captureKeyguardUpdateMonitorCallback();
// WHEN keyguard isn't visible
mKeyguardUpdateMonitorCallback.onKeyguardVisibilityChangedRaw(false);
assertTrue(mController.shouldPauseAuth());
}
@Test
public void testShouldPauseAuthOnShadeLocked() {
mController.onViewAttached();
@@ -233,15 +249,12 @@ public class UdfpsKeyguardViewControllerTest extends SysuiTestCase {
// GIVEN view is attached, alt auth is force being shown
mController.onViewAttached();
captureStatusBarStateListeners();
captureAltAuthInterceptor();
mAltAuthInterceptor.showAlternateAuthBouncer(); // alt auth force show
// WHEN view is detached
mController.onViewDetached();
// THEN alt auth state reports not showing
assertFalse(mAltAuthInterceptor.isShowingAlternateAuthBouncer());
// THEN set alternate auth interceptor to null
verify(mStatusBarKeyguardViewManager).setAlternateAuthInterceptor(null);
}
private void sendStatusBarStateChanged(int statusBarState) {
@@ -263,4 +276,9 @@ public class UdfpsKeyguardViewControllerTest extends SysuiTestCase {
mAltAuthInterceptorCaptor.capture());
mAltAuthInterceptor = mAltAuthInterceptorCaptor.getValue();
}
private void captureKeyguardUpdateMonitorCallback() {
verify(mKeyguardUpdateMonitor).registerCallback(mUpdateMonitorCallbackCaptor.capture());
mKeyguardUpdateMonitorCallback = mUpdateMonitorCallbackCaptor.getValue();
}
}