diff options
author | 2022-11-08 20:59:15 +0000 | |
---|---|---|
committer | 2022-11-08 20:59:15 +0000 | |
commit | 89fdd9d1864fa9bc2ae6739b39d0522fcc1b1a6f (patch) | |
tree | 47b66bf1e620b2b22de9eff93c098524ccbf2a54 | |
parent | 081329e121874c0c97bafc1fd966dba02367f6bf (diff) | |
parent | 991093d15ebe9d25c7064d5b9906a7e940fb7222 (diff) |
Merge "DO NOT MERGE Update naming for the AlternateBouncer" into tm-qpr-dev-plus-aosp
45 files changed, 788 insertions, 751 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index 1bb83f44ce6c..47ea8784aae8 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -314,8 +314,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab private boolean mCredentialAttempted; private boolean mKeyguardGoingAway; private boolean mGoingToSleep; - private boolean mBouncerFullyShown; - private boolean mBouncerIsOrWillBeShowing; + private boolean mPrimaryBouncerFullyShown; + private boolean mPrimaryBouncerIsOrWillBeShowing; private boolean mUdfpsBouncerShowing; private boolean mAuthInterruptActive; private boolean mNeedsSlowUnlockTransition; @@ -1664,8 +1664,9 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab public void onAuthenticationFailed() { String reason = mKeyguardBypassController.canBypass() ? "bypass" - : mUdfpsBouncerShowing ? "udfpsBouncer" : - mBouncerFullyShown ? "bouncer" : "udfpsFpDown"; + : mUdfpsBouncerShowing ? "udfpsBouncer" + : mPrimaryBouncerFullyShown ? "bouncer" + : "udfpsFpDown"; requestActiveUnlock( ActiveUnlockConfig.ACTIVE_UNLOCK_REQUEST_ORIGIN.BIOMETRIC_FAIL, "faceFailure-" + reason); @@ -2057,7 +2058,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab handleKeyguardReset(); break; case MSG_KEYGUARD_BOUNCER_CHANGED: - handleKeyguardBouncerChanged(msg.arg1, msg.arg2); + handlePrimaryBouncerChanged(msg.arg1, msg.arg2); break; case MSG_REPORT_EMERGENCY_CALL_ACTION: handleReportEmergencyCallAction(); @@ -2526,7 +2527,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab requestOrigin, extraReason, canFaceBypass || mUdfpsBouncerShowing - || mBouncerFullyShown + || mPrimaryBouncerFullyShown || mAuthController.isUdfpsFingerDown()); } @@ -2547,7 +2548,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab private boolean shouldTriggerActiveUnlock() { // Triggers: final boolean triggerActiveUnlockForAssistant = shouldTriggerActiveUnlockForAssistant(); - final boolean awakeKeyguard = mBouncerFullyShown || mUdfpsBouncerShowing + final boolean awakeKeyguard = mPrimaryBouncerFullyShown || mUdfpsBouncerShowing || (isKeyguardVisible() && !mGoingToSleep && mStatusBarState != StatusBarState.SHADE_LOCKED); @@ -2626,7 +2627,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab final boolean shouldListenKeyguardState = isKeyguardVisible() || !mDeviceInteractive - || (mBouncerIsOrWillBeShowing && !mKeyguardGoingAway) + || (mPrimaryBouncerIsOrWillBeShowing && !mKeyguardGoingAway) || mGoingToSleep || shouldListenForFingerprintAssistant || (mKeyguardOccluded && mIsDreaming) @@ -2645,8 +2646,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab && mIsPrimaryUser && biometricEnabledForUser; - final boolean shouldListenBouncerState = - !(mFingerprintLockedOut && mBouncerIsOrWillBeShowing && mCredentialAttempted); + final boolean shouldListenBouncerState = !(mFingerprintLockedOut + && mPrimaryBouncerIsOrWillBeShowing && mCredentialAttempted); final boolean isEncryptedOrLockdownForUser = isEncryptedOrLockdown(user); @@ -2671,7 +2672,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab user, shouldListen, biometricEnabledForUser, - mBouncerIsOrWillBeShowing, + mPrimaryBouncerIsOrWillBeShowing, userCanSkipBouncer, mCredentialAttempted, mDeviceInteractive, @@ -2728,7 +2729,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab // Scan even when encrypted or timeout to show a preemptive bouncer when bypassing. // Lock-down mode shouldn't scan, since it is more explicit. boolean strongAuthAllowsScanning = (!isEncryptedOrTimedOut || canBypass - && !mBouncerFullyShown); + && !mPrimaryBouncerFullyShown); // If the device supports face detection (without authentication) and bypass is enabled, // allow face scanning to happen if the device is in lockdown mode. @@ -2749,7 +2750,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab // 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 = - (mBouncerFullyShown + (mPrimaryBouncerFullyShown || mAuthInterruptActive || mOccludingAppRequestingFace || awakeKeyguard @@ -2776,7 +2777,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab mAuthInterruptActive, becauseCannotSkipBouncer, biometricEnabledForUser, - mBouncerFullyShown, + mPrimaryBouncerFullyShown, faceAuthenticated, faceDisabledForUser, isFaceLockedOut(), @@ -3306,17 +3307,19 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab /** * Handle {@link #MSG_KEYGUARD_BOUNCER_CHANGED} * - * @see #sendKeyguardBouncerChanged(boolean, boolean) + * @see #sendPrimaryBouncerChanged(boolean, boolean) */ - private void handleKeyguardBouncerChanged(int bouncerIsOrWillBeShowing, int bouncerFullyShown) { + private void handlePrimaryBouncerChanged(int primaryBouncerIsOrWillBeShowing, + int primaryBouncerFullyShown) { Assert.isMainThread(); - final boolean wasBouncerIsOrWillBeShowing = mBouncerIsOrWillBeShowing; - final boolean wasBouncerFullyShown = mBouncerFullyShown; - mBouncerIsOrWillBeShowing = bouncerIsOrWillBeShowing == 1; - mBouncerFullyShown = bouncerFullyShown == 1; - mLogger.logKeyguardBouncerChanged(mBouncerIsOrWillBeShowing, mBouncerFullyShown); - - if (mBouncerFullyShown) { + final boolean wasPrimaryBouncerIsOrWillBeShowing = mPrimaryBouncerIsOrWillBeShowing; + final boolean wasPrimaryBouncerFullyShown = mPrimaryBouncerFullyShown; + mPrimaryBouncerIsOrWillBeShowing = primaryBouncerIsOrWillBeShowing == 1; + mPrimaryBouncerFullyShown = primaryBouncerFullyShown == 1; + mLogger.logPrimaryKeyguardBouncerChanged(mPrimaryBouncerIsOrWillBeShowing, + mPrimaryBouncerFullyShown); + + if (mPrimaryBouncerFullyShown) { // If the bouncer is shown, always clear this flag. This can happen in the following // situations: 1) Default camera with SHOW_WHEN_LOCKED is not chosen yet. 2) Secure // camera requests dismiss keyguard (tapping on photos for example). When these happen, @@ -3326,18 +3329,18 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab mCredentialAttempted = false; } - if (wasBouncerIsOrWillBeShowing != mBouncerIsOrWillBeShowing) { + if (wasPrimaryBouncerIsOrWillBeShowing != mPrimaryBouncerIsOrWillBeShowing) { for (int i = 0; i < mCallbacks.size(); i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { - cb.onKeyguardBouncerStateChanged(mBouncerIsOrWillBeShowing); + cb.onKeyguardBouncerStateChanged(mPrimaryBouncerIsOrWillBeShowing); } } updateFingerprintListeningState(BIOMETRIC_ACTION_UPDATE); } - if (wasBouncerFullyShown != mBouncerFullyShown) { - if (mBouncerFullyShown) { + if (wasPrimaryBouncerFullyShown != mPrimaryBouncerFullyShown) { + if (mPrimaryBouncerFullyShown) { requestActiveUnlock( ActiveUnlockConfig.ACTIVE_UNLOCK_REQUEST_ORIGIN.UNLOCK_INTENT, "bouncerFullyShown"); @@ -3345,7 +3348,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab for (int i = 0; i < mCallbacks.size(); i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { - cb.onKeyguardBouncerFullyShowingChanged(mBouncerFullyShown); + cb.onKeyguardBouncerFullyShowingChanged(mPrimaryBouncerFullyShown); } } updateFaceListeningState(BIOMETRIC_ACTION_UPDATE, @@ -3496,14 +3499,15 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab } /** - * @see #handleKeyguardBouncerChanged(int, int) + * @see #handlePrimaryBouncerChanged(int, int) */ - public void sendKeyguardBouncerChanged(boolean bouncerIsOrWillBeShowing, - boolean bouncerFullyShown) { - mLogger.logSendKeyguardBouncerChanged(bouncerIsOrWillBeShowing, bouncerFullyShown); + public void sendPrimaryBouncerChanged(boolean primaryBouncerIsOrWillBeShowing, + boolean primaryBouncerFullyShown) { + mLogger.logSendPrimaryBouncerChanged(primaryBouncerIsOrWillBeShowing, + primaryBouncerFullyShown); Message message = mHandler.obtainMessage(MSG_KEYGUARD_BOUNCER_CHANGED); - message.arg1 = bouncerIsOrWillBeShowing ? 1 : 0; - message.arg2 = bouncerFullyShown ? 1 : 0; + message.arg1 = primaryBouncerIsOrWillBeShowing ? 1 : 0; + message.arg2 = primaryBouncerFullyShown ? 1 : 0; message.sendToTarget(); } @@ -3863,7 +3867,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab if (isUdfpsSupported()) { pw.println(" udfpsEnrolled=" + isUdfpsEnrolled()); pw.println(" shouldListenForUdfps=" + shouldListenForFingerprint(true)); - pw.println(" mBouncerIsOrWillBeShowing=" + mBouncerIsOrWillBeShowing); + pw.println(" mPrimaryBouncerIsOrWillBeShowing=" + + mPrimaryBouncerIsOrWillBeShowing); pw.println(" mStatusBarState=" + StatusBarState.toString(mStatusBarState)); pw.println(" mUdfpsBouncerShowing=" + mUdfpsBouncerShowing); } else if (isSfpsSupported()) { @@ -3893,7 +3898,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab pw.println(" mFaceLockedOutPermanent=" + mFaceLockedOutPermanent); pw.println(" enabledByUser=" + mBiometricEnabledForUser.get(userId)); pw.println(" mSecureCameraLaunched=" + mSecureCameraLaunched); - pw.println(" mBouncerFullyShown=" + mBouncerFullyShown); + pw.println(" mPrimaryBouncerFullyShown=" + mPrimaryBouncerFullyShown); pw.println(" mNeedsSlowUnlockTransition=" + mNeedsSlowUnlockTransition); } mListenModels.print(pw); diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardViewController.java index 90f0446ee34d..6c3c246e7fb9 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardViewController.java @@ -50,16 +50,11 @@ public interface KeyguardViewController { /** * Resets the state of Keyguard View. - * @param hideBouncerWhenShowing + * @param hideBouncerWhenShowing when true, hides the primary and alternate bouncers if showing. */ void reset(boolean hideBouncerWhenShowing); /** - * Stop showing any alternate auth methods. - */ - void resetAlternateAuth(boolean forceUpdateScrim); - - /** * Called when the device started going to sleep. */ default void onStartedGoingToSleep() {}; @@ -156,20 +151,24 @@ public interface KeyguardViewController { void notifyKeyguardAuthenticated(boolean strongAuth); /** - * Shows the Bouncer. - * + * Shows the primary bouncer. + */ + void showPrimaryBouncer(boolean scrimmed); + + /** + * When the primary bouncer is fully visible or is showing but animation didn't finish yet. */ - void showBouncer(boolean scrimmed); + boolean primaryBouncerIsOrWillBeShowing(); /** - * Returns {@code true} when the bouncer is currently showing + * Returns {@code true} when the primary bouncer or alternate bouncer is currently showing */ boolean isBouncerShowing(); /** - * When bouncer is fully visible or it is showing but animation didn't finish yet. + * Stop showing the alternate bouncer, if showing. */ - boolean bouncerIsOrWillBeShowing(); + void hideAlternateBouncer(boolean forceUpdateScrim); // TODO: Deprecate registerStatusBar in KeyguardViewController interface. It is currently // only used for testing purposes in StatusBarKeyguardViewManager, and it prevents us from diff --git a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java index c7cc05971513..dd6a1bd457b8 100644 --- a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java @@ -699,7 +699,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme "lock-screen-lock-icon-longpress", TOUCH_VIBRATION_ATTRIBUTES); - mKeyguardViewController.showBouncer(/* scrim */ true); + mKeyguardViewController.showPrimaryBouncer(/* scrim */ true); } diff --git a/packages/SystemUI/src/com/android/keyguard/logging/KeyguardUpdateMonitorLogger.kt b/packages/SystemUI/src/com/android/keyguard/logging/KeyguardUpdateMonitorLogger.kt index 6276142d605f..81b8dfed36a8 100644 --- a/packages/SystemUI/src/com/android/keyguard/logging/KeyguardUpdateMonitorLogger.kt +++ b/packages/SystemUI/src/com/android/keyguard/logging/KeyguardUpdateMonitorLogger.kt @@ -166,13 +166,16 @@ class KeyguardUpdateMonitorLogger @Inject constructor( { "Previously active sub id $int1 is now invalid, will remove" }) } - fun logKeyguardBouncerChanged(bouncerIsOrWillBeShowing: Boolean, bouncerFullyShown: Boolean) { + fun logPrimaryKeyguardBouncerChanged( + primaryBouncerIsOrWillBeShowing: Boolean, + primaryBouncerFullyShown: Boolean + ) { logBuffer.log(TAG, DEBUG, { - bool1 = bouncerIsOrWillBeShowing - bool2 = bouncerFullyShown + bool1 = primaryBouncerIsOrWillBeShowing + bool2 = primaryBouncerFullyShown }, { - "handleKeyguardBouncerChanged " + - "bouncerIsOrWillBeShowing=$bool1 bouncerFullyShowing=$bool2" + "handlePrimaryBouncerChanged " + + "primaryBouncerIsOrWillBeShowing=$bool1 primaryBouncerFullyShown=$bool2" }) } @@ -229,16 +232,16 @@ class KeyguardUpdateMonitorLogger @Inject constructor( { "Retrying fingerprint attempt: $int1" }) } - fun logSendKeyguardBouncerChanged( - bouncerIsOrWillBeShowing: Boolean, - bouncerFullyShown: Boolean, + fun logSendPrimaryBouncerChanged( + primaryBouncerIsOrWillBeShowing: Boolean, + primaryBouncerFullyShown: Boolean, ) { logBuffer.log(TAG, DEBUG, { - bool1 = bouncerIsOrWillBeShowing - bool2 = bouncerFullyShown + bool1 = primaryBouncerIsOrWillBeShowing + bool2 = primaryBouncerFullyShown }, { - "sendKeyguardBouncerChanged bouncerIsOrWillBeShowing=$bool1 " + - "bouncerFullyShown=$bool2" + "sendPrimaryBouncerChanged primaryBouncerIsOrWillBeShowing=$bool1 " + + "primaryBouncerFullyShown=$bool2" }) } diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java index 71711a20c020..bc10868e36c8 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java @@ -67,7 +67,7 @@ import com.android.systemui.doze.DozeReceiver; import com.android.systemui.dump.DumpManager; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.keyguard.ScreenLifecycle; -import com.android.systemui.keyguard.domain.interactor.BouncerInteractor; +import com.android.systemui.keyguard.domain.interactor.PrimaryBouncerInteractor; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.shade.ShadeExpansionStateManager; @@ -140,7 +140,7 @@ public class UdfpsController implements DozeReceiver, Dumpable { @NonNull private final LatencyTracker mLatencyTracker; @VisibleForTesting @NonNull final BiometricDisplayListener mOrientationListener; @NonNull private final ActivityLaunchAnimator mActivityLaunchAnimator; - @NonNull private final BouncerInteractor mBouncerInteractor; + @NonNull private final PrimaryBouncerInteractor mPrimaryBouncerInteractor; // 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. @@ -229,7 +229,7 @@ public class UdfpsController implements DozeReceiver, Dumpable { mUdfpsDisplayMode, requestId, reason, callback, (view, event, fromUdfpsView) -> onTouch(requestId, event, fromUdfpsView), mActivityLaunchAnimator, mFeatureFlags, - mBouncerInteractor))); + mPrimaryBouncerInteractor))); } @Override @@ -320,14 +320,14 @@ public class UdfpsController implements DozeReceiver, Dumpable { if (!mOverlayParams.equals(overlayParams)) { mOverlayParams = overlayParams; - final boolean wasShowingAltAuth = mKeyguardViewManager.isShowingAlternateAuth(); + final boolean wasShowingAltAuth = mKeyguardViewManager.isShowingAlternateBouncer(); // When the bounds change it's always necessary to re-create the overlay's window with // new LayoutParams. If the overlay needs to be shown, this will re-create and show the // overlay with the updated LayoutParams. Otherwise, the overlay will remain hidden. redrawOverlay(); if (wasShowingAltAuth) { - mKeyguardViewManager.showGenericBouncer(true); + mKeyguardViewManager.showBouncer(true); } } } @@ -626,7 +626,7 @@ public class UdfpsController implements DozeReceiver, Dumpable { @NonNull ActivityLaunchAnimator activityLaunchAnimator, @NonNull Optional<AlternateUdfpsTouchProvider> alternateTouchProvider, @NonNull @BiometricsBackground Executor biometricsExecutor, - @NonNull BouncerInteractor bouncerInteractor) { + @NonNull PrimaryBouncerInteractor primaryBouncerInteractor) { mContext = context; mExecution = execution; mVibrator = vibrator; @@ -643,6 +643,7 @@ public class UdfpsController implements DozeReceiver, Dumpable { mDumpManager = dumpManager; mDialogManager = dialogManager; mKeyguardUpdateMonitor = keyguardUpdateMonitor; + mFeatureFlags = featureFlags; mFalsingManager = falsingManager; mPowerManager = powerManager; mAccessibilityManager = accessibilityManager; @@ -664,8 +665,7 @@ public class UdfpsController implements DozeReceiver, Dumpable { false /* resetLockoutRequiresHardwareAuthToken */); mBiometricExecutor = biometricsExecutor; - mFeatureFlags = featureFlags; - mBouncerInteractor = bouncerInteractor; + mPrimaryBouncerInteractor = primaryBouncerInteractor; mDumpManager.registerDumpable(TAG, this); @@ -757,8 +757,8 @@ public class UdfpsController implements DozeReceiver, Dumpable { onFingerUp(mOverlay.getRequestId(), oldView); } final boolean removed = mOverlay.hide(); - if (mKeyguardViewManager.isShowingAlternateAuth()) { - mKeyguardViewManager.resetAlternateAuth(true); + if (mKeyguardViewManager.isShowingAlternateBouncer()) { + mKeyguardViewManager.hideAlternateBouncer(true); } Log.v(TAG, "hideUdfpsOverlay | removing window: " + removed); } else { @@ -798,7 +798,7 @@ public class UdfpsController implements DozeReceiver, Dumpable { Log.v(TAG, "aod lock icon long-press rejected by the falsing manager."); return; } - mKeyguardViewManager.showBouncer(true); + mKeyguardViewManager.showPrimaryBouncer(true); // play the same haptic as the LockIconViewController longpress mVibrator.vibrate( diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsControllerOverlay.kt b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsControllerOverlay.kt index d70861ac5f19..0bb24f8663ec 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsControllerOverlay.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsControllerOverlay.kt @@ -49,7 +49,7 @@ import com.android.systemui.R import com.android.systemui.animation.ActivityLaunchAnimator import com.android.systemui.dump.DumpManager import com.android.systemui.flags.FeatureFlags -import com.android.systemui.keyguard.domain.interactor.BouncerInteractor +import com.android.systemui.keyguard.domain.interactor.PrimaryBouncerInteractor import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.shade.ShadeExpansionStateManager import com.android.systemui.statusbar.LockscreenShadeTransitionController @@ -95,7 +95,7 @@ class UdfpsControllerOverlay @JvmOverloads constructor( private val onTouch: (View, MotionEvent, Boolean) -> Boolean, private val activityLaunchAnimator: ActivityLaunchAnimator, private val featureFlags: FeatureFlags, - private val bouncerInteractor: BouncerInteractor, + private val primaryBouncerInteractor: PrimaryBouncerInteractor, private val isDebuggable: Boolean = Build.IS_DEBUGGABLE ) { /** The view, when [isShowing], or null. */ @@ -252,7 +252,7 @@ class UdfpsControllerOverlay @JvmOverloads constructor( controller, activityLaunchAnimator, featureFlags, - bouncerInteractor + primaryBouncerInteractor ) } REASON_AUTH_BP -> { diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.kt b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.kt index 5bae2dc502d6..91967f95c861 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsKeyguardViewController.kt @@ -31,7 +31,7 @@ import com.android.systemui.animation.Interpolators import com.android.systemui.dump.DumpManager import com.android.systemui.flags.FeatureFlags import com.android.systemui.flags.Flags -import com.android.systemui.keyguard.domain.interactor.BouncerInteractor +import com.android.systemui.keyguard.domain.interactor.PrimaryBouncerInteractor import com.android.systemui.lifecycle.repeatWhenAttached import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.shade.ShadeExpansionListener @@ -40,9 +40,9 @@ import com.android.systemui.statusbar.LockscreenShadeTransitionController import com.android.systemui.statusbar.StatusBarState import com.android.systemui.statusbar.notification.stack.StackStateAnimator import com.android.systemui.statusbar.phone.KeyguardBouncer -import com.android.systemui.statusbar.phone.KeyguardBouncer.BouncerExpansionCallback +import com.android.systemui.statusbar.phone.KeyguardBouncer.PrimaryBouncerExpansionCallback import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager -import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager.AlternateAuthInterceptor +import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager.AlternateBouncer import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager.KeyguardViewManagerCallback import com.android.systemui.statusbar.phone.SystemUIDialogManager import com.android.systemui.statusbar.phone.UnlockedScreenOffAnimationController @@ -73,7 +73,7 @@ constructor( private val udfpsController: UdfpsController, private val activityLaunchAnimator: ActivityLaunchAnimator, featureFlags: FeatureFlags, - private val bouncerInteractor: BouncerInteractor + private val primaryBouncerInteractor: PrimaryBouncerInteractor ) : UdfpsAnimationViewController<UdfpsKeyguardView>( view, @@ -146,8 +146,8 @@ constructor( } } - private val bouncerExpansionCallback: BouncerExpansionCallback = - object : BouncerExpansionCallback { + private val mPrimaryBouncerExpansionCallback: PrimaryBouncerExpansionCallback = + object : PrimaryBouncerExpansionCallback { override fun onExpansionChanged(expansion: Float) { inputBouncerHiddenAmount = expansion updateAlpha() @@ -180,7 +180,7 @@ constructor( private val shadeExpansionListener = ShadeExpansionListener { (fraction) -> panelExpansionFraction = - if (keyguardViewManager.isBouncerInTransit) { + if (keyguardViewManager.isPrimaryBouncerInTransit) { aboutToShowBouncerProgress(fraction) } else { fraction @@ -237,17 +237,17 @@ constructor( } } - private val alternateAuthInterceptor: AlternateAuthInterceptor = - object : AlternateAuthInterceptor { - override fun showAlternateAuthBouncer(): Boolean { + private val mAlternateBouncer: AlternateBouncer = + object : AlternateBouncer { + override fun showAlternateBouncer(): Boolean { return showUdfpsBouncer(true) } - override fun hideAlternateAuthBouncer(): Boolean { + override fun hideAlternateBouncer(): Boolean { return showUdfpsBouncer(false) } - override fun isShowingAlternateAuthBouncer(): Boolean { + override fun isShowingAlternateBouncer(): Boolean { return showingUdfpsBouncer } @@ -268,7 +268,7 @@ constructor( override fun onInit() { super.onInit() - keyguardViewManager.setAlternateAuthInterceptor(alternateAuthInterceptor) + keyguardViewManager.setAlternateBouncer(mAlternateBouncer) } init { @@ -285,7 +285,7 @@ constructor( @VisibleForTesting internal suspend fun listenForBouncerExpansion(scope: CoroutineScope): Job { return scope.launch { - bouncerInteractor.bouncerExpansion.collect { bouncerExpansion: Float -> + primaryBouncerInteractor.bouncerExpansion.collect { bouncerExpansion: Float -> inputBouncerExpansion = bouncerExpansion updateAlpha() updatePauseAuth() @@ -306,10 +306,10 @@ constructor( qsExpansion = keyguardViewManager.qsExpansion keyguardViewManager.addCallback(statusBarKeyguardViewManagerCallback) if (!isModernBouncerEnabled) { - val bouncer = keyguardViewManager.bouncer + val bouncer = keyguardViewManager.primaryBouncer bouncer?.expansion?.let { - bouncerExpansionCallback.onExpansionChanged(it) - bouncer.addBouncerExpansionCallback(bouncerExpansionCallback) + mPrimaryBouncerExpansionCallback.onExpansionChanged(it) + bouncer.addBouncerExpansionCallback(mPrimaryBouncerExpansionCallback) } updateBouncerHiddenAmount() } @@ -319,7 +319,7 @@ constructor( view.updatePadding() updateAlpha() updatePauseAuth() - keyguardViewManager.setAlternateAuthInterceptor(alternateAuthInterceptor) + keyguardViewManager.setAlternateBouncer(mAlternateBouncer) lockScreenShadeTransitionController.udfpsKeyguardViewController = this activityLaunchAnimator.addListener(activityLaunchAnimatorListener) } @@ -329,7 +329,7 @@ constructor( faceDetectRunning = false keyguardStateController.removeCallback(keyguardStateControllerCallback) statusBarStateController.removeCallback(stateListener) - keyguardViewManager.removeAlternateAuthInterceptor(alternateAuthInterceptor) + keyguardViewManager.removeAlternateAuthInterceptor(mAlternateBouncer) keyguardUpdateMonitor.requestFaceAuthOnOccludingApp(false) configurationController.removeCallback(configurationListener) shadeExpansionStateManager.removeExpansionListener(shadeExpansionListener) @@ -339,7 +339,9 @@ constructor( activityLaunchAnimator.removeListener(activityLaunchAnimatorListener) keyguardViewManager.removeCallback(statusBarKeyguardViewManagerCallback) if (!isModernBouncerEnabled) { - keyguardViewManager.bouncer?.removeBouncerExpansionCallback(bouncerExpansionCallback) + keyguardViewManager.primaryBouncer?.removeBouncerExpansionCallback( + mPrimaryBouncerExpansionCallback + ) } } @@ -442,7 +444,7 @@ constructor( return if (isModernBouncerEnabled) { inputBouncerExpansion == 1f } else { - keyguardViewManager.isBouncerShowing && !keyguardViewManager.isShowingAlternateAuth + keyguardViewManager.isBouncerShowing && !keyguardViewManager.isShowingAlternateBouncer } } @@ -462,7 +464,7 @@ constructor( */ private fun maybeShowInputBouncer() { if (showingUdfpsBouncer && hasUdfpsBouncerShownWithMinTime()) { - keyguardViewManager.showBouncer(true) + keyguardViewManager.showPrimaryBouncer(true) } } @@ -535,8 +537,8 @@ constructor( if (isModernBouncerEnabled) { return } - val altBouncerShowing = keyguardViewManager.isShowingAlternateAuth - if (altBouncerShowing || !keyguardViewManager.bouncerIsOrWillBeShowing()) { + val altBouncerShowing = keyguardViewManager.isShowingAlternateBouncer + if (altBouncerShowing || !keyguardViewManager.primaryBouncerIsOrWillBeShowing()) { inputBouncerHiddenAmount = 1f } else if (keyguardViewManager.isBouncerShowing) { // input bouncer is fully showing diff --git a/packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayContainerViewController.java b/packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayContainerViewController.java index d0d01846c3d9..5c6d24813570 100644 --- a/packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayContainerViewController.java +++ b/packages/SystemUI/src/com/android/systemui/dreams/DreamOverlayContainerViewController.java @@ -35,7 +35,7 @@ import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.dreams.complication.ComplicationHostViewController; import com.android.systemui.dreams.dagger.DreamOverlayComponent; import com.android.systemui.dreams.dagger.DreamOverlayModule; -import com.android.systemui.keyguard.domain.interactor.BouncerCallbackInteractor; +import com.android.systemui.keyguard.domain.interactor.PrimaryBouncerCallbackInteractor; import com.android.systemui.statusbar.BlurUtils; import com.android.systemui.statusbar.phone.KeyguardBouncer; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; @@ -76,14 +76,14 @@ public class DreamOverlayContainerViewController extends ViewController<DreamOve // Main thread handler used to schedule periodic tasks (e.g. burn-in protection updates). private final Handler mHandler; private final int mDreamOverlayMaxTranslationY; - private final BouncerCallbackInteractor mBouncerCallbackInteractor; + private final PrimaryBouncerCallbackInteractor mPrimaryBouncerCallbackInteractor; private long mJitterStartTimeMillis; private boolean mBouncerAnimating; - private final KeyguardBouncer.BouncerExpansionCallback mBouncerExpansionCallback = - new KeyguardBouncer.BouncerExpansionCallback() { + private final KeyguardBouncer.PrimaryBouncerExpansionCallback mBouncerExpansionCallback = + new KeyguardBouncer.PrimaryBouncerExpansionCallback() { @Override public void onStartingToShow() { @@ -136,7 +136,7 @@ public class DreamOverlayContainerViewController extends ViewController<DreamOve @Named(DreamOverlayModule.BURN_IN_PROTECTION_UPDATE_INTERVAL) long burnInProtectionUpdateInterval, @Named(DreamOverlayModule.MILLIS_UNTIL_FULL_JITTER) long millisUntilFullJitter, - BouncerCallbackInteractor bouncerCallbackInteractor, + PrimaryBouncerCallbackInteractor primaryBouncerCallbackInteractor, DreamOverlayAnimationsController animationsController, DreamOverlayStateController stateController) { super(containerView); @@ -160,7 +160,7 @@ public class DreamOverlayContainerViewController extends ViewController<DreamOve mMaxBurnInOffset = maxBurnInOffset; mBurnInProtectionUpdateInterval = burnInProtectionUpdateInterval; mMillisUntilFullJitter = millisUntilFullJitter; - mBouncerCallbackInteractor = bouncerCallbackInteractor; + mPrimaryBouncerCallbackInteractor = primaryBouncerCallbackInteractor; } @Override @@ -173,11 +173,11 @@ public class DreamOverlayContainerViewController extends ViewController<DreamOve protected void onViewAttached() { mJitterStartTimeMillis = System.currentTimeMillis(); mHandler.postDelayed(this::updateBurnInOffsets, mBurnInProtectionUpdateInterval); - final KeyguardBouncer bouncer = mStatusBarKeyguardViewManager.getBouncer(); + final KeyguardBouncer bouncer = mStatusBarKeyguardViewManager.getPrimaryBouncer(); if (bouncer != null) { bouncer.addBouncerExpansionCallback(mBouncerExpansionCallback); } - mBouncerCallbackInteractor.addBouncerExpansionCallback(mBouncerExpansionCallback); + mPrimaryBouncerCallbackInteractor.addBouncerExpansionCallback(mBouncerExpansionCallback); // Start dream entry animations. Skip animations for low light clock. if (!mStateController.isLowLightActive()) { @@ -188,11 +188,11 @@ public class DreamOverlayContainerViewController extends ViewController<DreamOve @Override protected void onViewDetached() { mHandler.removeCallbacks(this::updateBurnInOffsets); - final KeyguardBouncer bouncer = mStatusBarKeyguardViewManager.getBouncer(); + final KeyguardBouncer bouncer = mStatusBarKeyguardViewManager.getPrimaryBouncer(); if (bouncer != null) { bouncer.removeBouncerExpansionCallback(mBouncerExpansionCallback); } - mBouncerCallbackInteractor.removeBouncerExpansionCallback(mBouncerExpansionCallback); + mPrimaryBouncerCallbackInteractor.removeBouncerExpansionCallback(mBouncerExpansionCallback); mDreamOverlayAnimationsController.cancelRunningEntryAnimations(); } diff --git a/packages/SystemUI/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandler.java b/packages/SystemUI/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandler.java index 0dba4ff84c99..92cdcf99f013 100644 --- a/packages/SystemUI/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandler.java +++ b/packages/SystemUI/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandler.java @@ -116,7 +116,7 @@ public class BouncerSwipeTouchHandler implements DreamTouchHandler { if (mCapture) { // Since the user is dragging the bouncer up, set scrimmed to false. - mStatusBarKeyguardViewManager.showBouncer(false); + mStatusBarKeyguardViewManager.showPrimaryBouncer(false); } } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardBouncerRepository.kt b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardBouncerRepository.kt index 0046256c677b..d4514c5cb7aa 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardBouncerRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardBouncerRepository.kt @@ -28,7 +28,7 @@ import javax.inject.Inject import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow -/** Encapsulates app state for the lock screen bouncer. */ +/** Encapsulates app state for the lock screen primary and alternate bouncer. */ @SysUISingleton class KeyguardBouncerRepository @Inject @@ -36,12 +36,24 @@ constructor( private val viewMediatorCallback: ViewMediatorCallback, keyguardUpdateMonitor: KeyguardUpdateMonitor, ) { - var bouncerPromptReason: Int? = null - /** Determines if we want to instantaneously show the bouncer instead of translating. */ - private val _isScrimmed = MutableStateFlow(false) - val isScrimmed = _isScrimmed.asStateFlow() + /** Values associated with the PrimaryBouncer (pin/pattern/password) input. */ + private val _primaryBouncerVisible = MutableStateFlow(false) + val primaryBouncerVisible = _primaryBouncerVisible.asStateFlow() + private val _primaryBouncerShow = MutableStateFlow<KeyguardBouncerModel?>(null) + val primaryBouncerShow = _primaryBouncerShow.asStateFlow() + private val _primaryBouncerShowingSoon = MutableStateFlow(false) + val primaryBouncerShowingSoon = _primaryBouncerShowingSoon.asStateFlow() + private val _primaryBouncerHide = MutableStateFlow(false) + val primaryBouncerHide = _primaryBouncerHide.asStateFlow() + private val _primaryBouncerStartingToHide = MutableStateFlow(false) + val primaryBouncerStartingToHide = _primaryBouncerStartingToHide.asStateFlow() + private val _primaryBouncerDisappearAnimation = MutableStateFlow<Runnable?>(null) + val primaryBouncerStartingDisappearAnimation = _primaryBouncerDisappearAnimation.asStateFlow() + /** Determines if we want to instantaneously show the primary bouncer instead of translating. */ + private val _primaryBouncerScrimmed = MutableStateFlow(false) + val primaryBouncerScrimmed = _primaryBouncerScrimmed.asStateFlow() /** - * Set how much of the panel is showing on the screen. + * Set how much of the notification panel is showing on the screen. * ``` * 0f = panel fully hidden = bouncer fully showing * 1f = panel fully showing = bouncer fully hidden @@ -49,31 +61,21 @@ constructor( */ private val _panelExpansionAmount = MutableStateFlow(KeyguardBouncer.EXPANSION_HIDDEN) val panelExpansionAmount = _panelExpansionAmount.asStateFlow() - private val _isVisible = MutableStateFlow(false) - val isVisible = _isVisible.asStateFlow() - private val _show = MutableStateFlow<KeyguardBouncerModel?>(null) - val show = _show.asStateFlow() - private val _showingSoon = MutableStateFlow(false) - val showingSoon = _showingSoon.asStateFlow() - private val _hide = MutableStateFlow(false) - val hide = _hide.asStateFlow() - private val _startingToHide = MutableStateFlow(false) - val startingToHide = _startingToHide.asStateFlow() - private val _disappearAnimation = MutableStateFlow<Runnable?>(null) - val startingDisappearAnimation = _disappearAnimation.asStateFlow() private val _keyguardPosition = MutableStateFlow(0f) val keyguardPosition = _keyguardPosition.asStateFlow() - private val _resourceUpdateRequests = MutableStateFlow(false) - val resourceUpdateRequests = _resourceUpdateRequests.asStateFlow() - private val _showMessage = MutableStateFlow<BouncerShowMessageModel?>(null) - val showMessage = _showMessage.asStateFlow() + private val _onScreenTurnedOff = MutableStateFlow(false) + val onScreenTurnedOff = _onScreenTurnedOff.asStateFlow() + private val _isBackButtonEnabled = MutableStateFlow<Boolean?>(null) + val isBackButtonEnabled = _isBackButtonEnabled.asStateFlow() private val _keyguardAuthenticated = MutableStateFlow<Boolean?>(null) /** Determines if user is already unlocked */ val keyguardAuthenticated = _keyguardAuthenticated.asStateFlow() - private val _isBackButtonEnabled = MutableStateFlow<Boolean?>(null) - val isBackButtonEnabled = _isBackButtonEnabled.asStateFlow() - private val _onScreenTurnedOff = MutableStateFlow(false) - val onScreenTurnedOff = _onScreenTurnedOff.asStateFlow() + + var bouncerPromptReason: Int? = null + private val _showMessage = MutableStateFlow<BouncerShowMessageModel?>(null) + val showMessage = _showMessage.asStateFlow() + private val _resourceUpdateRequests = MutableStateFlow(false) + val resourceUpdateRequests = _resourceUpdateRequests.asStateFlow() val bouncerErrorMessage: CharSequence? get() = viewMediatorCallback.consumeCustomMessage() @@ -95,36 +97,36 @@ constructor( keyguardUpdateMonitor.registerCallback(callback) } - fun setScrimmed(isScrimmed: Boolean) { - _isScrimmed.value = isScrimmed + fun setPrimaryScrimmed(isScrimmed: Boolean) { + _primaryBouncerScrimmed.value = isScrimmed } - fun setPanelExpansion(panelExpansion: Float) { - _panelExpansionAmount.value = panelExpansion + fun setPrimaryVisible(isVisible: Boolean) { + _primaryBouncerVisible.value = isVisible } - fun setVisible(isVisible: Boolean) { - _isVisible.value = isVisible + fun setPrimaryShow(keyguardBouncerModel: KeyguardBouncerModel?) { + _primaryBouncerShow.value = keyguardBouncerModel } - fun setShow(keyguardBouncerModel: KeyguardBouncerModel?) { - _show.value = keyguardBouncerModel + fun setPrimaryShowingSoon(showingSoon: Boolean) { + _primaryBouncerShowingSoon.value = showingSoon } - fun setShowingSoon(showingSoon: Boolean) { - _showingSoon.value = showingSoon + fun setPrimaryHide(hide: Boolean) { + _primaryBouncerHide.value = hide } - fun setHide(hide: Boolean) { - _hide.value = hide + fun setPrimaryStartingToHide(startingToHide: Boolean) { + _primaryBouncerStartingToHide.value = startingToHide } - fun setStartingToHide(startingToHide: Boolean) { - _startingToHide.value = startingToHide + fun setPrimaryStartDisappearAnimation(runnable: Runnable?) { + _primaryBouncerDisappearAnimation.value = runnable } - fun setStartDisappearAnimation(runnable: Runnable?) { - _disappearAnimation.value = runnable + fun setPanelExpansion(panelExpansion: Float) { + _panelExpansionAmount.value = panelExpansion } fun setKeyguardPosition(keyguardPosition: Float) { diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/BouncerCallbackInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerCallbackInteractor.kt index 10c7a3774e09..c5e49c61e581 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/BouncerCallbackInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerCallbackInteractor.kt @@ -24,9 +24,9 @@ import javax.inject.Inject /** Interactor to add and remove callbacks for the bouncer. */ @SysUISingleton -class BouncerCallbackInteractor @Inject constructor() { +class PrimaryBouncerCallbackInteractor @Inject constructor() { private var resetCallbacks = ListenerSet<KeyguardBouncer.KeyguardResetCallback>() - private var expansionCallbacks = ArrayList<KeyguardBouncer.BouncerExpansionCallback>() + private var expansionCallbacks = ArrayList<KeyguardBouncer.PrimaryBouncerExpansionCallback>() /** Add a KeyguardResetCallback. */ fun addKeyguardResetCallback(callback: KeyguardBouncer.KeyguardResetCallback) { resetCallbacks.addIfAbsent(callback) @@ -38,7 +38,7 @@ class BouncerCallbackInteractor @Inject constructor() { } /** Adds a callback to listen to bouncer expansion updates. */ - fun addBouncerExpansionCallback(callback: KeyguardBouncer.BouncerExpansionCallback) { + fun addBouncerExpansionCallback(callback: KeyguardBouncer.PrimaryBouncerExpansionCallback) { if (!expansionCallbacks.contains(callback)) { expansionCallbacks.add(callback) } @@ -48,7 +48,7 @@ class BouncerCallbackInteractor @Inject constructor() { * Removes a previously added callback. If the callback was never added, this method does * nothing. */ - fun removeBouncerExpansionCallback(callback: KeyguardBouncer.BouncerExpansionCallback) { + fun removeBouncerExpansionCallback(callback: KeyguardBouncer.PrimaryBouncerExpansionCallback) { expansionCallbacks.remove(callback) } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/BouncerInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractor.kt index dbb0352c2187..c22f4e7a2634 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/BouncerInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractor.kt @@ -44,24 +44,27 @@ import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.map -/** Encapsulates business logic for interacting with the lock-screen bouncer. */ +/** + * Encapsulates business logic for interacting with the lock-screen primary (pin/pattern/password) + * bouncer. + */ @SysUISingleton -class BouncerInteractor +class PrimaryBouncerInteractor @Inject constructor( private val repository: KeyguardBouncerRepository, - private val bouncerView: BouncerView, + private val primaryBouncerView: BouncerView, @Main private val mainHandler: Handler, private val keyguardStateController: KeyguardStateController, private val keyguardSecurityModel: KeyguardSecurityModel, - private val callbackInteractor: BouncerCallbackInteractor, + private val primaryBouncerCallbackInteractor: PrimaryBouncerCallbackInteractor, private val falsingCollector: FalsingCollector, private val dismissCallbackRegistry: DismissCallbackRegistry, keyguardBypassController: KeyguardBypassController, keyguardUpdateMonitor: KeyguardUpdateMonitor, ) { /** Whether we want to wait for face auth. */ - private val bouncerFaceDelay = + private val primaryBouncerFaceDelay = keyguardStateController.isFaceAuthEnabled && !keyguardUpdateMonitor.getCachedIsUnlockWithFingerprintPossible( KeyguardUpdateMonitor.getCurrentUser() @@ -70,38 +73,39 @@ constructor( !keyguardUpdateMonitor.userNeedsStrongAuth() && !keyguardBypassController.bypassEnabled - /** Runnable to show the bouncer. */ + /** Runnable to show the primary bouncer. */ val showRunnable = Runnable { - repository.setVisible(true) - repository.setShow( + repository.setPrimaryVisible(true) + repository.setPrimaryShow( KeyguardBouncerModel( promptReason = repository.bouncerPromptReason ?: 0, errorMessage = repository.bouncerErrorMessage, expansionAmount = repository.panelExpansionAmount.value ) ) - repository.setShowingSoon(false) + repository.setPrimaryShowingSoon(false) } val keyguardAuthenticated: Flow<Boolean> = repository.keyguardAuthenticated.filterNotNull() val screenTurnedOff: Flow<Unit> = repository.onScreenTurnedOff.filter { it }.map {} - val show: Flow<KeyguardBouncerModel> = repository.show.filterNotNull() - val hide: Flow<Unit> = repository.hide.filter { it }.map {} - val startingToHide: Flow<Unit> = repository.startingToHide.filter { it }.map {} - val isVisible: Flow<Boolean> = repository.isVisible + val show: Flow<KeyguardBouncerModel> = repository.primaryBouncerShow.filterNotNull() + val hide: Flow<Unit> = repository.primaryBouncerHide.filter { it }.map {} + val startingToHide: Flow<Unit> = repository.primaryBouncerStartingToHide.filter { it }.map {} + val isVisible: Flow<Boolean> = repository.primaryBouncerVisible val isBackButtonEnabled: Flow<Boolean> = repository.isBackButtonEnabled.filterNotNull() val showMessage: Flow<BouncerShowMessageModel> = repository.showMessage.filterNotNull() val startingDisappearAnimation: Flow<Runnable> = - repository.startingDisappearAnimation.filterNotNull() + repository.primaryBouncerStartingDisappearAnimation.filterNotNull() val resourceUpdateRequests: Flow<Boolean> = repository.resourceUpdateRequests.filter { it } val keyguardPosition: Flow<Float> = repository.keyguardPosition val panelExpansionAmount: Flow<Float> = repository.panelExpansionAmount /** 0f = bouncer fully hidden. 1f = bouncer fully visible. */ - val bouncerExpansion: Flow<Float> = // - combine(repository.panelExpansionAmount, repository.isVisible) { expansionAmount, isVisible - -> - if (isVisible) { - 1f - expansionAmount + val bouncerExpansion: Flow<Float> = + combine(repository.panelExpansionAmount, repository.primaryBouncerVisible) { + panelExpansion, + primaryBouncerVisible -> + if (primaryBouncerVisible) { + 1f - panelExpansion } else { 0f } @@ -116,13 +120,14 @@ constructor( repository.setShowMessage(null) repository.setOnScreenTurnedOff(false) repository.setKeyguardAuthenticated(null) - repository.setHide(false) - repository.setStartingToHide(false) + repository.setPrimaryHide(false) + repository.setPrimaryStartingToHide(false) val resumeBouncer = - (repository.isVisible.value || repository.showingSoon.value) && needsFullscreenBouncer() + (repository.primaryBouncerVisible.value || + repository.primaryBouncerShowingSoon.value) && needsFullscreenBouncer() - if (!resumeBouncer && repository.show.value != null) { + if (!resumeBouncer && repository.primaryBouncerShow.value != null) { // If bouncer is visible, the bouncer is already showing. return } @@ -134,29 +139,29 @@ constructor( } Trace.beginSection("KeyguardBouncer#show") - repository.setScrimmed(isScrimmed) + repository.setPrimaryScrimmed(isScrimmed) if (isScrimmed) { setPanelExpansion(KeyguardBouncer.EXPANSION_VISIBLE) } if (resumeBouncer) { - bouncerView.delegate?.resume() + primaryBouncerView.delegate?.resume() // Bouncer is showing the next security screen and we just need to prompt a resume. return } - if (bouncerView.delegate?.showNextSecurityScreenOrFinish() == true) { + if (primaryBouncerView.delegate?.showNextSecurityScreenOrFinish() == true) { // Keyguard is done. return } - repository.setShowingSoon(true) - if (bouncerFaceDelay) { + repository.setPrimaryShowingSoon(true) + if (primaryBouncerFaceDelay) { mainHandler.postDelayed(showRunnable, 1200L) } else { DejankUtils.postAfterTraversal(showRunnable) } keyguardStateController.notifyBouncerShowing(true) - callbackInteractor.dispatchStartingToShow() + primaryBouncerCallbackInteractor.dispatchStartingToShow() Trace.endSection() } @@ -174,10 +179,10 @@ constructor( falsingCollector.onBouncerHidden() keyguardStateController.notifyBouncerShowing(false /* showing */) cancelShowRunnable() - repository.setShowingSoon(false) - repository.setVisible(false) - repository.setHide(true) - repository.setShow(null) + repository.setPrimaryShowingSoon(false) + repository.setPrimaryVisible(false) + repository.setPrimaryHide(true) + repository.setPrimaryShow(null) Trace.endSection() } @@ -191,7 +196,7 @@ constructor( fun setPanelExpansion(expansion: Float) { val oldExpansion = repository.panelExpansionAmount.value val expansionChanged = oldExpansion != expansion - if (repository.startingDisappearAnimation.value == null) { + if (repository.primaryBouncerStartingDisappearAnimation.value == null) { repository.setPanelExpansion(expansion) } @@ -200,25 +205,25 @@ constructor( oldExpansion != KeyguardBouncer.EXPANSION_VISIBLE ) { falsingCollector.onBouncerShown() - callbackInteractor.dispatchFullyShown() + primaryBouncerCallbackInteractor.dispatchFullyShown() } else if ( expansion == KeyguardBouncer.EXPANSION_HIDDEN && oldExpansion != KeyguardBouncer.EXPANSION_HIDDEN ) { - repository.setVisible(false) - repository.setShow(null) + repository.setPrimaryVisible(false) + repository.setPrimaryShow(null) falsingCollector.onBouncerHidden() - DejankUtils.postAfterTraversal { callbackInteractor.dispatchReset() } - callbackInteractor.dispatchFullyHidden() + DejankUtils.postAfterTraversal { primaryBouncerCallbackInteractor.dispatchReset() } + primaryBouncerCallbackInteractor.dispatchFullyHidden() } else if ( expansion != KeyguardBouncer.EXPANSION_VISIBLE && oldExpansion == KeyguardBouncer.EXPANSION_VISIBLE ) { - callbackInteractor.dispatchStartingToHide() - repository.setStartingToHide(true) + primaryBouncerCallbackInteractor.dispatchStartingToHide() + repository.setPrimaryStartingToHide(true) } if (expansionChanged) { - callbackInteractor.dispatchExpansionChanged(expansion) + primaryBouncerCallbackInteractor.dispatchExpansionChanged(expansion) } } @@ -236,7 +241,7 @@ constructor( onDismissAction: ActivityStarter.OnDismissAction?, cancelAction: Runnable? ) { - bouncerView.delegate?.setDismissAction(onDismissAction, cancelAction) + primaryBouncerView.delegate?.setDismissAction(onDismissAction, cancelAction) } /** Update the resources of the views. */ @@ -266,7 +271,7 @@ constructor( /** Notify that view visibility has changed. */ fun notifyBouncerVisibilityHasChanged(visibility: Int) { - callbackInteractor.dispatchVisibilityChanged(visibility) + primaryBouncerCallbackInteractor.dispatchVisibilityChanged(visibility) } /** Notify that the resources have been updated */ @@ -283,38 +288,39 @@ constructor( fun startDisappearAnimation(runnable: Runnable) { val finishRunnable = Runnable { runnable.run() - repository.setStartDisappearAnimation(null) + repository.setPrimaryStartDisappearAnimation(null) } - repository.setStartDisappearAnimation(finishRunnable) + repository.setPrimaryStartDisappearAnimation(finishRunnable) } /** Returns whether bouncer is fully showing. */ fun isFullyShowing(): Boolean { - return (repository.showingSoon.value || repository.isVisible.value) && + return (repository.primaryBouncerShowingSoon.value || + repository.primaryBouncerVisible.value) && repository.panelExpansionAmount.value == KeyguardBouncer.EXPANSION_VISIBLE && - repository.startingDisappearAnimation.value == null + repository.primaryBouncerStartingDisappearAnimation.value == null } /** Returns whether bouncer is scrimmed. */ fun isScrimmed(): Boolean { - return repository.isScrimmed.value + return repository.primaryBouncerScrimmed.value } /** If bouncer expansion is between 0f and 1f non-inclusive. */ fun isInTransit(): Boolean { - return repository.showingSoon.value || + return repository.primaryBouncerShowingSoon.value || repository.panelExpansionAmount.value != KeyguardBouncer.EXPANSION_HIDDEN && repository.panelExpansionAmount.value != KeyguardBouncer.EXPANSION_VISIBLE } /** Return whether bouncer is animating away. */ fun isAnimatingAway(): Boolean { - return repository.startingDisappearAnimation.value != null + return repository.primaryBouncerStartingDisappearAnimation.value != null } /** Return whether bouncer will dismiss with actions */ fun willDismissWithAction(): Boolean { - return bouncerView.delegate?.willDismissWithActions() == true + return primaryBouncerView.delegate?.willDismissWithActions() == true } /** Returns whether the bouncer should be full screen. */ diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBouncerViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBouncerViewModel.kt index 9a9284371074..07816001f45c 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBouncerViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBouncerViewModel.kt @@ -19,7 +19,7 @@ package com.android.systemui.keyguard.ui.viewmodel import android.view.View import com.android.systemui.keyguard.data.BouncerView import com.android.systemui.keyguard.data.BouncerViewDelegate -import com.android.systemui.keyguard.domain.interactor.BouncerInteractor +import com.android.systemui.keyguard.domain.interactor.PrimaryBouncerInteractor import com.android.systemui.keyguard.shared.model.BouncerShowMessageModel import com.android.systemui.keyguard.shared.model.KeyguardBouncerModel import com.android.systemui.statusbar.phone.KeyguardBouncer.EXPANSION_VISIBLE @@ -34,7 +34,7 @@ class KeyguardBouncerViewModel @Inject constructor( private val view: BouncerView, - private val interactor: BouncerInteractor, + private val interactor: PrimaryBouncerInteractor, ) { /** Observe on bouncer expansion amount. */ val bouncerExpansionAmount: Flow<Float> = interactor.panelExpansionAmount diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanelController.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanelController.java index abc0adecbfeb..64962b495c96 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/QSPanelController.java +++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanelController.java @@ -237,7 +237,7 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> { * @return if bouncer is in transit */ public boolean isBouncerInTransit() { - return mStatusBarKeyguardViewManager.isBouncerInTransit(); + return mStatusBarKeyguardViewManager.isPrimaryBouncerInTransit(); } } diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java index ac15c462535c..c157564fee48 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java @@ -4661,7 +4661,7 @@ public final class NotificationPanelViewController { mUpdateFlingVelocity = vel; } } else if (!mCentralSurfaces.isBouncerShowing() - && !mStatusBarKeyguardViewManager.isShowingAlternateAuth() + && !mStatusBarKeyguardViewManager.isShowingAlternateBouncer() && !mKeyguardStateController.isKeyguardGoingAway()) { onEmptySpaceClick(); onTrackingStopped(true); @@ -6045,7 +6045,7 @@ public final class NotificationPanelViewController { == AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD.getId() || action == AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_UP.getId()) { - mStatusBarKeyguardViewManager.showBouncer(true); + mStatusBarKeyguardViewManager.showPrimaryBouncer(true); return true; } return super.performAccessibilityAction(host, action, args); diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java index 1e63b2dd134f..bb67280c07b8 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java @@ -284,7 +284,7 @@ public class NotificationShadeWindowViewController { return true; } - if (mStatusBarKeyguardViewManager.isShowingAlternateAuth()) { + if (mStatusBarKeyguardViewManager.isShowingAlternateBouncer()) { // capture all touches if the alt auth bouncer is showing return true; } @@ -322,7 +322,7 @@ public class NotificationShadeWindowViewController { handled = !mService.isPulsing(); } - if (mStatusBarKeyguardViewManager.isShowingAlternateAuth()) { + if (mStatusBarKeyguardViewManager.isShowingAlternateBouncer()) { // eat the touch handled = true; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java index f2b86035200b..3670d0987a03 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java @@ -925,7 +925,7 @@ public class KeyguardIndicationController { } if (mStatusBarKeyguardViewManager.isBouncerShowing()) { - if (mStatusBarKeyguardViewManager.isShowingAlternateAuth()) { + if (mStatusBarKeyguardViewManager.isShowingAlternateBouncer()) { return; // udfps affordance is highlighted, no need to show action to unlock } else if (mKeyguardUpdateMonitor.isFaceEnrolled()) { String message = mContext.getString(R.string.keyguard_retry); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/dagger/CentralSurfacesDependenciesModule.java b/packages/SystemUI/src/com/android/systemui/statusbar/dagger/CentralSurfacesDependenciesModule.java index eacb18e3c50c..14d0d7e032d5 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/dagger/CentralSurfacesDependenciesModule.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/dagger/CentralSurfacesDependenciesModule.java @@ -300,7 +300,7 @@ public interface CentralSurfacesDependenciesModule { @Override public boolean isShowingAlternateAuthOnUnlock() { - return statusBarKeyguardViewManager.get().shouldShowAltAuth(); + return statusBarKeyguardViewManager.get().canShowAlternateBouncer(); } }; return new DialogLaunchAnimator(callback, interactionJankMonitor); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java index b2628e40e77e..6f4d6d944033 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/AmbientState.java @@ -719,7 +719,7 @@ public class AmbientState implements Dumpable { */ public boolean isBouncerInTransit() { return mStatusBarKeyguardViewManager != null - && mStatusBarKeyguardViewManager.isBouncerInTransit(); + && mStatusBarKeyguardViewManager.isPrimaryBouncerInTransit(); } /** diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java index 6e68079706f4..f72f1bcdcb1b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/BiometricUnlockController.java @@ -480,7 +480,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp break; case MODE_SHOW_BOUNCER: Trace.beginSection("MODE_SHOW_BOUNCER"); - mKeyguardViewController.showBouncer(true); + mKeyguardViewController.showPrimaryBouncer(true); Trace.endSection(); break; case MODE_WAKE_AND_UNLOCK_FROM_DREAM: @@ -560,7 +560,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp return MODE_WAKE_AND_UNLOCK_FROM_DREAM; } if (mKeyguardStateController.isShowing()) { - if (mKeyguardViewController.bouncerIsOrWillBeShowing() && unlockingAllowed) { + if (mKeyguardViewController.primaryBouncerIsOrWillBeShowing() && unlockingAllowed) { return MODE_DISMISS_BOUNCER; } else if (unlockingAllowed) { return MODE_UNLOCK_COLLAPSING; @@ -603,7 +603,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp return MODE_UNLOCK_COLLAPSING; } if (mKeyguardStateController.isShowing()) { - if ((mKeyguardViewController.bouncerIsOrWillBeShowing() + if ((mKeyguardViewController.primaryBouncerIsOrWillBeShowing() || mKeyguardBypassController.getAltBouncerShowing()) && unlockingAllowed) { return MODE_DISMISS_BOUNCER; } else if (unlockingAllowed && (bypass || mAuthController.isUdfpsFingerDown())) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java index dc370821dc95..33d4d8387712 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java @@ -456,7 +456,11 @@ public interface CentralSurfaces extends Dumpable, ActivityStarter, LifecycleOwn void setTransitionToFullShadeProgress(float transitionToFullShadeProgress); - void setBouncerHiddenFraction(float expansion); + /** + * Sets the amount of progress to the bouncer being fully hidden/visible. 1 means the bouncer + * is fully hidden, while 0 means the bouncer is visible. + */ + void setPrimaryBouncerHiddenFraction(float expansion); @VisibleForTesting void updateScrimController(); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java index 6e9b02a43ded..cc4b7eb1d66b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java @@ -3322,9 +3322,9 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { // lock screen where users can use the UDFPS affordance to enter the device mStatusBarKeyguardViewManager.reset(true); } else if (mState == StatusBarState.KEYGUARD - && !mStatusBarKeyguardViewManager.bouncerIsOrWillBeShowing() + && !mStatusBarKeyguardViewManager.primaryBouncerIsOrWillBeShowing() && isKeyguardSecure()) { - mStatusBarKeyguardViewManager.showGenericBouncer(true /* scrimmed */); + mStatusBarKeyguardViewManager.showBouncer(true /* scrimmed */); } } } @@ -3806,7 +3806,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { * is fully hidden, while 0 means the bouncer is visible. */ @Override - public void setBouncerHiddenFraction(float expansion) { + public void setPrimaryBouncerHiddenFraction(float expansion) { mScrimController.setBouncerHiddenFraction(expansion); } @@ -3828,7 +3828,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { mNotificationPanelViewController.isLaunchingAffordanceWithPreview(); mScrimController.setLaunchingAffordanceWithPreview(launchingAffordanceWithPreview); - if (mStatusBarKeyguardViewManager.isShowingAlternateAuth()) { + if (mStatusBarKeyguardViewManager.isShowingAlternateBouncer()) { if (mState == StatusBarState.SHADE || mState == StatusBarState.SHADE_LOCKED || mTransitionToFullShadeProgress > 0f) { mScrimController.transitionTo(ScrimState.AUTH_SCRIMMED_SHADE); @@ -3839,7 +3839,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { // Bouncer needs the front scrim when it's on top of an activity, // tapping on a notification, editing QS or being dismissed by // FLAG_DISMISS_KEYGUARD_ACTIVITY. - ScrimState state = mStatusBarKeyguardViewManager.bouncerNeedsScrimming() + ScrimState state = mStatusBarKeyguardViewManager.primaryBouncerNeedsScrimming() ? ScrimState.BOUNCER_SCRIMMED : ScrimState.BOUNCER; mScrimController.transitionTo(state); } else if (launchingAffordanceWithPreview) { @@ -4148,7 +4148,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces { */ @Override public boolean isBouncerShowingScrimmed() { - return isBouncerShowing() && mStatusBarKeyguardViewManager.bouncerNeedsScrimming(); + return isBouncerShowing() && mStatusBarKeyguardViewManager.primaryBouncerNeedsScrimming(); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java index b2a9509a03b7..532b8b839fdc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBouncer.java @@ -55,13 +55,13 @@ import java.util.List; import javax.inject.Inject; /** - * A class which manages the bouncer on the lockscreen. + * A class which manages the primary (pin/pattern/password) bouncer on the lockscreen. * @deprecated Use KeyguardBouncerRepository */ @Deprecated public class KeyguardBouncer { - private static final String TAG = "KeyguardBouncer"; + private static final String TAG = "PrimaryKeyguardBouncer"; static final long BOUNCER_FACE_DELAY = 1200; public static final float ALPHA_EXPANSION_THRESHOLD = 0.95f; /** @@ -78,7 +78,7 @@ public class KeyguardBouncer { private final FalsingCollector mFalsingCollector; private final DismissCallbackRegistry mDismissCallbackRegistry; private final Handler mHandler; - private final List<BouncerExpansionCallback> mExpansionCallbacks = new ArrayList<>(); + private final List<PrimaryBouncerExpansionCallback> mExpansionCallbacks = new ArrayList<>(); private final KeyguardUpdateMonitor mKeyguardUpdateMonitor; private final KeyguardStateController mKeyguardStateController; private final KeyguardSecurityModel mKeyguardSecurityModel; @@ -126,7 +126,7 @@ public class KeyguardBouncer { private KeyguardBouncer(Context context, ViewMediatorCallback callback, ViewGroup container, DismissCallbackRegistry dismissCallbackRegistry, FalsingCollector falsingCollector, - BouncerExpansionCallback expansionCallback, + PrimaryBouncerExpansionCallback expansionCallback, KeyguardStateController keyguardStateController, KeyguardUpdateMonitor keyguardUpdateMonitor, KeyguardBypassController keyguardBypassController, @Main Handler handler, @@ -571,37 +571,37 @@ public class KeyguardBouncer { } private void dispatchFullyShown() { - for (BouncerExpansionCallback callback : mExpansionCallbacks) { + for (PrimaryBouncerExpansionCallback callback : mExpansionCallbacks) { callback.onFullyShown(); } } private void dispatchStartingToHide() { - for (BouncerExpansionCallback callback : mExpansionCallbacks) { + for (PrimaryBouncerExpansionCallback callback : mExpansionCallbacks) { callback.onStartingToHide(); } } private void dispatchStartingToShow() { - for (BouncerExpansionCallback callback : mExpansionCallbacks) { + for (PrimaryBouncerExpansionCallback callback : mExpansionCallbacks) { callback.onStartingToShow(); } } private void dispatchFullyHidden() { - for (BouncerExpansionCallback callback : mExpansionCallbacks) { + for (PrimaryBouncerExpansionCallback callback : mExpansionCallbacks) { callback.onFullyHidden(); } } private void dispatchExpansionChanged() { - for (BouncerExpansionCallback callback : mExpansionCallbacks) { + for (PrimaryBouncerExpansionCallback callback : mExpansionCallbacks) { callback.onExpansionChanged(mExpansion); } } private void dispatchVisibilityChanged() { - for (BouncerExpansionCallback callback : mExpansionCallbacks) { + for (PrimaryBouncerExpansionCallback callback : mExpansionCallbacks) { callback.onVisibilityChanged(mContainer.getVisibility() == View.VISIBLE); } } @@ -647,7 +647,7 @@ public class KeyguardBouncer { /** * Adds a callback to listen to bouncer expansion updates. */ - public void addBouncerExpansionCallback(BouncerExpansionCallback callback) { + public void addBouncerExpansionCallback(PrimaryBouncerExpansionCallback callback) { if (!mExpansionCallbacks.contains(callback)) { mExpansionCallbacks.add(callback); } @@ -657,11 +657,14 @@ public class KeyguardBouncer { * Removes a previously added callback. If the callback was never added, this methood * does nothing. */ - public void removeBouncerExpansionCallback(BouncerExpansionCallback callback) { + public void removeBouncerExpansionCallback(PrimaryBouncerExpansionCallback callback) { mExpansionCallbacks.remove(callback); } - public interface BouncerExpansionCallback { + /** + * Callback updated when the primary bouncer's show and hide states change. + */ + public interface PrimaryBouncerExpansionCallback { /** * Invoked when the bouncer expansion reaches {@link KeyguardBouncer#EXPANSION_VISIBLE}. * This is NOT called each time the bouncer is shown, but rather only when the fully @@ -745,7 +748,7 @@ public class KeyguardBouncer { * Construct a KeyguardBouncer that will exist in the given container. */ public KeyguardBouncer create(ViewGroup container, - BouncerExpansionCallback expansionCallback) { + PrimaryBouncerExpansionCallback expansionCallback) { return new KeyguardBouncer(mContext, mCallback, container, mDismissCallbackRegistry, mFalsingCollector, expansionCallback, mKeyguardStateController, mKeyguardUpdateMonitor, diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java index e744c7932c47..86e27aba65f0 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ScrimController.java @@ -913,7 +913,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump if (mQsExpansion > 0) { behindAlpha = MathUtils.lerp(behindAlpha, mDefaultScrimAlpha, mQsExpansion); float tintProgress = mQsExpansion; - if (mStatusBarKeyguardViewManager.isBouncerInTransit()) { + if (mStatusBarKeyguardViewManager.isPrimaryBouncerInTransit()) { // this is case of - on lockscreen - going from expanded QS to bouncer. // Because mQsExpansion is already interpolated and transition between tints // is too slow, we want to speed it up and make it more aligned to bouncer @@ -1096,7 +1096,7 @@ public class ScrimController implements ViewTreeObserver.OnPreDrawListener, Dump } private float getInterpolatedFraction() { - if (mStatusBarKeyguardViewManager.isBouncerInTransit()) { + if (mStatusBarKeyguardViewManager.isPrimaryBouncerInTransit()) { return BouncerPanelExpansionCalculator .aboutToShowBouncerProgress(mPanelExpansionFraction); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java index 9e2821806693..56fb337e5b4f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java @@ -60,8 +60,8 @@ import com.android.systemui.dreams.DreamOverlayStateController; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.flags.Flags; import com.android.systemui.keyguard.data.BouncerView; -import com.android.systemui.keyguard.domain.interactor.BouncerCallbackInteractor; -import com.android.systemui.keyguard.domain.interactor.BouncerInteractor; +import com.android.systemui.keyguard.domain.interactor.PrimaryBouncerCallbackInteractor; +import com.android.systemui.keyguard.domain.interactor.PrimaryBouncerInteractor; import com.android.systemui.navigationbar.NavigationBarView; import com.android.systemui.navigationbar.NavigationModeController; import com.android.systemui.plugins.statusbar.StatusBarStateController; @@ -78,7 +78,7 @@ import com.android.systemui.statusbar.RemoteInputController; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.SysuiStatusBarStateController; import com.android.systemui.statusbar.notification.ViewGroupFadeHelper; -import com.android.systemui.statusbar.phone.KeyguardBouncer.BouncerExpansionCallback; +import com.android.systemui.statusbar.phone.KeyguardBouncer.PrimaryBouncerExpansionCallback; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.unfold.FoldAodAnimationController; @@ -135,62 +135,63 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb @Nullable private final FoldAodAnimationController mFoldAodAnimationController; private KeyguardMessageAreaController<AuthKeyguardMessageArea> mKeyguardMessageAreaController; - private final BouncerCallbackInteractor mBouncerCallbackInteractor; - private final BouncerInteractor mBouncerInteractor; - private final BouncerView mBouncerView; + private final PrimaryBouncerCallbackInteractor mPrimaryBouncerCallbackInteractor; + private final PrimaryBouncerInteractor mPrimaryBouncerInteractor; + private final BouncerView mPrimaryBouncerView; private final Lazy<com.android.systemui.shade.ShadeController> mShadeController; - private final BouncerExpansionCallback mExpansionCallback = new BouncerExpansionCallback() { - private boolean mBouncerAnimating; + private final PrimaryBouncerExpansionCallback mExpansionCallback = + new PrimaryBouncerExpansionCallback() { + private boolean mPrimaryBouncerAnimating; - @Override - public void onFullyShown() { - mBouncerAnimating = false; - updateStates(); - } + @Override + public void onFullyShown() { + mPrimaryBouncerAnimating = false; + updateStates(); + } - @Override - public void onStartingToHide() { - mBouncerAnimating = true; - updateStates(); - } + @Override + public void onStartingToHide() { + mPrimaryBouncerAnimating = true; + updateStates(); + } - @Override - public void onStartingToShow() { - mBouncerAnimating = true; - updateStates(); - } + @Override + public void onStartingToShow() { + mPrimaryBouncerAnimating = true; + updateStates(); + } - @Override - public void onFullyHidden() { - mBouncerAnimating = false; - } + @Override + public void onFullyHidden() { + mPrimaryBouncerAnimating = false; + } - @Override - public void onExpansionChanged(float expansion) { - if (mBouncerAnimating) { - mCentralSurfaces.setBouncerHiddenFraction(expansion); + @Override + public void onExpansionChanged(float expansion) { + if (mPrimaryBouncerAnimating) { + mCentralSurfaces.setPrimaryBouncerHiddenFraction(expansion); + } } - } - @Override - public void onVisibilityChanged(boolean isVisible) { - mCentralSurfaces - .setBouncerShowingOverDream( - isVisible && mDreamOverlayStateController.isOverlayActive()); + @Override + public void onVisibilityChanged(boolean isVisible) { + mCentralSurfaces.setBouncerShowingOverDream( + isVisible && mDreamOverlayStateController.isOverlayActive()); - if (!isVisible) { - mCentralSurfaces.setBouncerHiddenFraction(KeyguardBouncer.EXPANSION_HIDDEN); - } + if (!isVisible) { + mCentralSurfaces.setPrimaryBouncerHiddenFraction( + KeyguardBouncer.EXPANSION_HIDDEN); + } - /* Register predictive back callback when keyguard becomes visible, and unregister - when it's hidden. */ - if (isVisible) { - registerBackCallback(); - } else { - unregisterBackCallback(); + /* Register predictive back callback when keyguard becomes visible, and unregister + when it's hidden. */ + if (isVisible) { + registerBackCallback(); + } else { + unregisterBackCallback(); + } } - } }; private final OnBackInvokedCallback mOnBackInvokedCallback = () -> { @@ -223,7 +224,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb private View mNotificationContainer; - @Nullable protected KeyguardBouncer mBouncer; + @Nullable protected KeyguardBouncer mPrimaryBouncer; protected boolean mRemoteInputActive; private boolean mGlobalActionsVisible = false; private boolean mLastGlobalActionsVisible = false; @@ -236,8 +237,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb protected boolean mFirstUpdate = true; protected boolean mLastShowing; protected boolean mLastOccluded; - private boolean mLastBouncerShowing; - private boolean mLastBouncerIsOrWillBeShowing; + private boolean mLastPrimaryBouncerShowing; + private boolean mLastPrimaryBouncerIsOrWillBeShowing; private boolean mLastBouncerDismissible; protected boolean mLastRemoteInputActive; private boolean mLastDozing; @@ -265,7 +266,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb private final LatencyTracker mLatencyTracker; private final KeyguardSecurityModel mKeyguardSecurityModel; private KeyguardBypassController mBypassController; - @Nullable private AlternateAuthInterceptor mAlternateAuthInterceptor; + @Nullable private AlternateBouncer mAlternateBouncer; private final KeyguardUpdateMonitorCallback mUpdateMonitorCallback = new KeyguardUpdateMonitorCallback() { @@ -300,9 +301,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb LatencyTracker latencyTracker, KeyguardSecurityModel keyguardSecurityModel, FeatureFlags featureFlags, - BouncerCallbackInteractor bouncerCallbackInteractor, - BouncerInteractor bouncerInteractor, - BouncerView bouncerView) { + PrimaryBouncerCallbackInteractor primaryBouncerCallbackInteractor, + PrimaryBouncerInteractor primaryBouncerInteractor, + BouncerView primaryBouncerView) { mContext = context; mViewMediatorCallback = callback; mLockPatternUtils = lockPatternUtils; @@ -320,9 +321,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb mShadeController = shadeController; mLatencyTracker = latencyTracker; mKeyguardSecurityModel = keyguardSecurityModel; - mBouncerCallbackInteractor = bouncerCallbackInteractor; - mBouncerInteractor = bouncerInteractor; - mBouncerView = bouncerView; + mPrimaryBouncerCallbackInteractor = primaryBouncerCallbackInteractor; + mPrimaryBouncerInteractor = primaryBouncerInteractor; + mPrimaryBouncerView = primaryBouncerView; mFoldAodAnimationController = sysUIUnfoldComponent .map(SysUIUnfoldComponent::getFoldAodAnimationController).orElse(null); mIsModernBouncerEnabled = featureFlags.isEnabled(Flags.MODERN_BOUNCER); @@ -340,9 +341,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb ViewGroup container = mCentralSurfaces.getBouncerContainer(); if (mIsModernBouncerEnabled) { - mBouncerCallbackInteractor.addBouncerExpansionCallback(mExpansionCallback); + mPrimaryBouncerCallbackInteractor.addBouncerExpansionCallback(mExpansionCallback); } else { - mBouncer = mKeyguardBouncerFactory.create(container, mExpansionCallback); + mPrimaryBouncer = mKeyguardBouncerFactory.create(container, mExpansionCallback); } mNotificationPanelViewController = notificationPanelViewController; if (shadeExpansionStateManager != null) { @@ -361,20 +362,20 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb * Sets the given alt auth interceptor to null if it's the current auth interceptor. Else, * does nothing. */ - public void removeAlternateAuthInterceptor(@NonNull AlternateAuthInterceptor authInterceptor) { - if (Objects.equals(mAlternateAuthInterceptor, authInterceptor)) { - mAlternateAuthInterceptor = null; - resetAlternateAuth(true); + public void removeAlternateAuthInterceptor(@NonNull AlternateBouncer authInterceptor) { + if (Objects.equals(mAlternateBouncer, authInterceptor)) { + mAlternateBouncer = null; + hideAlternateBouncer(true); } } /** * Sets a new alt auth interceptor. */ - public void setAlternateAuthInterceptor(@NonNull AlternateAuthInterceptor authInterceptor) { - if (!Objects.equals(mAlternateAuthInterceptor, authInterceptor)) { - mAlternateAuthInterceptor = authInterceptor; - resetAlternateAuth(false); + public void setAlternateBouncer(@NonNull AlternateBouncer authInterceptor) { + if (!Objects.equals(mAlternateBouncer, authInterceptor)) { + mAlternateBouncer = authInterceptor; + hideAlternateBouncer(false); } } @@ -458,48 +459,48 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb if (mDozing && !mPulsing) { return; } else if (mNotificationPanelViewController.isUnlockHintRunning()) { - if (mBouncer != null) { - mBouncer.setExpansion(KeyguardBouncer.EXPANSION_HIDDEN); + if (mPrimaryBouncer != null) { + mPrimaryBouncer.setExpansion(KeyguardBouncer.EXPANSION_HIDDEN); } else { - mBouncerInteractor.setPanelExpansion(KeyguardBouncer.EXPANSION_HIDDEN); + mPrimaryBouncerInteractor.setPanelExpansion(KeyguardBouncer.EXPANSION_HIDDEN); } } else if (mStatusBarStateController.getState() == StatusBarState.SHADE_LOCKED) { // Don't expand to the bouncer. Instead transition back to the lock screen (see // CentralSurfaces#showBouncerOrLockScreenIfKeyguard) return; - } else if (bouncerNeedsScrimming()) { - if (mBouncer != null) { - mBouncer.setExpansion(KeyguardBouncer.EXPANSION_VISIBLE); + } else if (primaryBouncerNeedsScrimming()) { + if (mPrimaryBouncer != null) { + mPrimaryBouncer.setExpansion(KeyguardBouncer.EXPANSION_VISIBLE); } else { - mBouncerInteractor.setPanelExpansion(KeyguardBouncer.EXPANSION_VISIBLE); + mPrimaryBouncerInteractor.setPanelExpansion(KeyguardBouncer.EXPANSION_VISIBLE); } } else if (mKeyguardStateController.isShowing() && !hideBouncerOverDream) { if (!isWakeAndUnlocking() && !(mBiometricUnlockController.getMode() == MODE_DISMISS_BOUNCER) && !isUnlockCollapsing()) { - if (mBouncer != null) { - mBouncer.setExpansion(fraction); + if (mPrimaryBouncer != null) { + mPrimaryBouncer.setExpansion(fraction); } else { - mBouncerInteractor.setPanelExpansion(fraction); + mPrimaryBouncerInteractor.setPanelExpansion(fraction); } } if (fraction != KeyguardBouncer.EXPANSION_HIDDEN && tracking && !mKeyguardStateController.canDismissLockScreen() - && !bouncerIsShowing() + && !primaryBouncerIsShowing() && !bouncerIsAnimatingAway()) { - if (mBouncer != null) { - mBouncer.show(false /* resetSecuritySelection */, false /* scrimmed */); + if (mPrimaryBouncer != null) { + mPrimaryBouncer.show(false /* resetSecuritySelection */, false /* scrimmed */); } else { - mBouncerInteractor.show(/* isScrimmed= */false); + mPrimaryBouncerInteractor.show(/* isScrimmed= */false); } } - } else if (!mKeyguardStateController.isShowing() && isBouncerInTransit()) { + } else if (!mKeyguardStateController.isShowing() && isPrimaryBouncerInTransit()) { // Keyguard is not visible anymore, but expansion animation was still running. // We need to hide the bouncer, otherwise it will be stuck in transit. - if (mBouncer != null) { - mBouncer.setExpansion(KeyguardBouncer.EXPANSION_HIDDEN); + if (mPrimaryBouncer != null) { + mPrimaryBouncer.setExpansion(KeyguardBouncer.EXPANSION_HIDDEN); } else { - mBouncerInteractor.setPanelExpansion(KeyguardBouncer.EXPANSION_HIDDEN); + mPrimaryBouncerInteractor.setPanelExpansion(KeyguardBouncer.EXPANSION_HIDDEN); } } else if (mPulsing && fraction == KeyguardBouncer.EXPANSION_VISIBLE) { // Panel expanded while pulsing but didn't translate the bouncer (because we are @@ -543,17 +544,17 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb if (needsFullscreenBouncer() && !mDozing) { // The keyguard might be showing (already). So we need to hide it. mCentralSurfaces.hideKeyguard(); - if (mBouncer != null) { - mBouncer.show(true /* resetSecuritySelection */); + if (mPrimaryBouncer != null) { + mPrimaryBouncer.show(true /* resetSecuritySelection */); } else { - mBouncerInteractor.show(true); + mPrimaryBouncerInteractor.show(true); } } else { mCentralSurfaces.showKeyguard(); if (hideBouncerWhenShowing) { hideBouncer(false /* destroyView */); - if (mBouncer != null) { - mBouncer.prepare(); + if (mPrimaryBouncer != null) { + mPrimaryBouncer.prepare(); } } } @@ -561,23 +562,25 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb } /** - * If applicable, shows the alternate authentication bouncer. Else, shows the input - * (pin/password/pattern) bouncer. - * @param scrimmed true when the input bouncer should show scrimmed, false when the user will be - * dragging it and translation should be deferred {@see KeyguardBouncer#show(boolean, boolean)} + * + * If possible, shows the alternate bouncer. Else, shows the primary (pin/pattern/password) + * bouncer. + * @param scrimmed true when the primary bouncer should show scrimmed, + * false when the user will be dragging it and translation should be deferred + * {@see KeyguardBouncer#show(boolean, boolean)} */ - public void showGenericBouncer(boolean scrimmed) { - if (shouldShowAltAuth()) { - updateAlternateAuthShowing(mAlternateAuthInterceptor.showAlternateAuthBouncer()); + public void showBouncer(boolean scrimmed) { + if (canShowAlternateBouncer()) { + updateAlternateBouncerShowing(mAlternateBouncer.showAlternateBouncer()); return; } - showBouncer(scrimmed); + showPrimaryBouncer(scrimmed); } - /** Whether we should show the alternate authentication instead of the traditional bouncer. */ - public boolean shouldShowAltAuth() { - return mAlternateAuthInterceptor != null + /** Whether we can show the alternate bouncer instead of the primary bouncer. */ + public boolean canShowAlternateBouncer() { + return mAlternateBouncer != null && mKeyguardUpdateManager.isUnlockingWithBiometricAllowed(true); } @@ -586,10 +589,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb */ @VisibleForTesting void hideBouncer(boolean destroyView) { - if (mBouncer != null) { - mBouncer.hide(destroyView); + if (mPrimaryBouncer != null) { + mPrimaryBouncer.hide(destroyView); } else { - mBouncerInteractor.hide(); + mPrimaryBouncerInteractor.hide(); } if (mKeyguardStateController.isShowing()) { // If we were showing the bouncer and then aborting, we need to also clear out any @@ -600,19 +603,19 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb } /** - * Shows the keyguard input bouncer - the password challenge on the lock screen + * Shows the primary bouncer - the pin/pattern/password challenge on the lock screen. * * @param scrimmed true when the bouncer should show scrimmed, false when the user will be * dragging it and translation should be deferred {@see KeyguardBouncer#show(boolean, boolean)} */ - public void showBouncer(boolean scrimmed) { - resetAlternateAuth(false); + public void showPrimaryBouncer(boolean scrimmed) { + hideAlternateBouncer(false); if (mKeyguardStateController.isShowing() && !isBouncerShowing()) { - if (mBouncer != null) { - mBouncer.show(false /* resetSecuritySelection */, scrimmed); + if (mPrimaryBouncer != null) { + mPrimaryBouncer.show(false /* resetSecuritySelection */, scrimmed); } else { - mBouncerInteractor.show(scrimmed); + mPrimaryBouncerInteractor.show(scrimmed); } } updateStates(); @@ -644,42 +647,41 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb // If there is an an alternate auth interceptor (like the UDFPS), show that one // instead of the bouncer. - if (shouldShowAltAuth()) { + if (canShowAlternateBouncer()) { if (!afterKeyguardGone) { - if (mBouncer != null) { - mBouncer.setDismissAction(mAfterKeyguardGoneAction, + if (mPrimaryBouncer != null) { + mPrimaryBouncer.setDismissAction(mAfterKeyguardGoneAction, mKeyguardGoneCancelAction); } else { - mBouncerInteractor.setDismissAction(mAfterKeyguardGoneAction, + mPrimaryBouncerInteractor.setDismissAction(mAfterKeyguardGoneAction, mKeyguardGoneCancelAction); } mAfterKeyguardGoneAction = null; mKeyguardGoneCancelAction = null; } - updateAlternateAuthShowing( - mAlternateAuthInterceptor.showAlternateAuthBouncer()); + updateAlternateBouncerShowing(mAlternateBouncer.showAlternateBouncer()); return; } if (afterKeyguardGone) { // we'll handle the dismiss action after keyguard is gone, so just show the // bouncer - if (mBouncer != null) { - mBouncer.show(false /* resetSecuritySelection */); + if (mPrimaryBouncer != null) { + mPrimaryBouncer.show(false /* resetSecuritySelection */); } else { - mBouncerInteractor.show(/* isScrimmed= */true); + mPrimaryBouncerInteractor.show(/* isScrimmed= */true); } } else { // after authentication success, run dismiss action with the option to defer // hiding the keyguard based on the return value of the OnDismissAction - if (mBouncer != null) { - mBouncer.showWithDismissAction(mAfterKeyguardGoneAction, + if (mPrimaryBouncer != null) { + mPrimaryBouncer.showWithDismissAction(mAfterKeyguardGoneAction, mKeyguardGoneCancelAction); } else { - mBouncerInteractor.setDismissAction( + mPrimaryBouncerInteractor.setDismissAction( mAfterKeyguardGoneAction, mKeyguardGoneCancelAction); - mBouncerInteractor.show(/* isScrimmed= */true); + mPrimaryBouncerInteractor.show(/* isScrimmed= */true); } // bouncer will handle the dismiss action, so we no longer need to track it here mAfterKeyguardGoneAction = null; @@ -724,28 +726,28 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb } else { showBouncerOrKeyguard(hideBouncerWhenShowing); } - resetAlternateAuth(false); + hideAlternateBouncer(false); mKeyguardUpdateManager.sendKeyguardReset(); updateStates(); } } @Override - public void resetAlternateAuth(boolean forceUpdateScrim) { - final boolean updateScrim = (mAlternateAuthInterceptor != null - && mAlternateAuthInterceptor.hideAlternateAuthBouncer()) + public void hideAlternateBouncer(boolean forceUpdateScrim) { + final boolean updateScrim = (mAlternateBouncer != null + && mAlternateBouncer.hideAlternateBouncer()) || forceUpdateScrim; - updateAlternateAuthShowing(updateScrim); + updateAlternateBouncerShowing(updateScrim); } - private void updateAlternateAuthShowing(boolean updateScrim) { - final boolean isShowingAltAuth = isShowingAlternateAuth(); + private void updateAlternateBouncerShowing(boolean updateScrim) { + final boolean isShowingAlternateBouncer = isShowingAlternateBouncer(); if (mKeyguardMessageAreaController != null) { - mKeyguardMessageAreaController.setIsVisible(isShowingAltAuth); + mKeyguardMessageAreaController.setIsVisible(isShowingAlternateBouncer); mKeyguardMessageAreaController.setMessage(""); } - mBypassController.setAltBouncerShowing(isShowingAltAuth); - mKeyguardUpdateManager.setUdfpsBouncerShowing(isShowingAltAuth); + mBypassController.setAltBouncerShowing(isShowingAlternateBouncer); + mKeyguardUpdateManager.setUdfpsBouncerShowing(isShowingAlternateBouncer); if (updateScrim) { mCentralSurfaces.updateScrimController(); @@ -782,10 +784,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb @Override public void onFinishedGoingToSleep() { - if (mBouncer != null) { - mBouncer.onScreenTurnedOff(); + if (mPrimaryBouncer != null) { + mPrimaryBouncer.onScreenTurnedOff(); } else { - mBouncerInteractor.onScreenTurnedOff(); + mPrimaryBouncerInteractor.onScreenTurnedOff(); } } @@ -870,18 +872,18 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb // by a FLAG_DISMISS_KEYGUARD_ACTIVITY. reset(isOccluding /* hideBouncerWhenShowing*/); } - if (animate && !isOccluded && isShowing && !bouncerIsShowing()) { + if (animate && !isOccluded && isShowing && !primaryBouncerIsShowing()) { mCentralSurfaces.animateKeyguardUnoccluding(); } } @Override public void startPreHideAnimation(Runnable finishRunnable) { - if (bouncerIsShowing()) { - if (mBouncer != null) { - mBouncer.startPreHideAnimation(finishRunnable); + if (primaryBouncerIsShowing()) { + if (mPrimaryBouncer != null) { + mPrimaryBouncer.startPreHideAnimation(finishRunnable); } else { - mBouncerInteractor.startDisappearAnimation(finishRunnable); + mPrimaryBouncerInteractor.startDisappearAnimation(finishRunnable); } mNotificationPanelViewController.startBouncerPreHideAnimation(); @@ -994,13 +996,13 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb updateResources(); return; } - boolean wasShowing = bouncerIsShowing(); - boolean wasScrimmed = bouncerIsScrimmed(); + boolean wasShowing = primaryBouncerIsShowing(); + boolean wasScrimmed = primaryBouncerIsScrimmed(); hideBouncer(true /* destroyView */); - mBouncer.prepare(); + mPrimaryBouncer.prepare(); - if (wasShowing) showBouncer(wasScrimmed); + if (wasShowing) showPrimaryBouncer(wasScrimmed); } public void onKeyguardFadedAway() { @@ -1045,8 +1047,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb * WARNING: This method might cause Binder calls. */ public boolean isSecure() { - if (mBouncer != null) { - return mBouncer.isSecure(); + if (mPrimaryBouncer != null) { + return mPrimaryBouncer.isSecure(); } return mKeyguardSecurityModel.getSecurityMode( @@ -1060,7 +1062,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb * @return whether a back press can be handled right now. */ public boolean canHandleBackPressed() { - return bouncerIsShowing(); + return primaryBouncerIsShowing(); } /** @@ -1073,7 +1075,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb mCentralSurfaces.endAffordanceLaunch(); // The second condition is for SIM card locked bouncer - if (bouncerIsScrimmed() && !needsFullscreenBouncer()) { + if (primaryBouncerIsScrimmed() && !needsFullscreenBouncer()) { hideBouncer(false); updateStates(); } else { @@ -1094,27 +1096,27 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb @Override public boolean isBouncerShowing() { - return bouncerIsShowing() || isShowingAlternateAuth(); + return primaryBouncerIsShowing() || isShowingAlternateBouncer(); } @Override - public boolean bouncerIsOrWillBeShowing() { - return isBouncerShowing() || isBouncerInTransit(); + public boolean primaryBouncerIsOrWillBeShowing() { + return isBouncerShowing() || isPrimaryBouncerInTransit(); } public boolean isFullscreenBouncer() { - if (mBouncerView.getDelegate() != null) { - return mBouncerView.getDelegate().isFullScreenBouncer(); + if (mPrimaryBouncerView.getDelegate() != null) { + return mPrimaryBouncerView.getDelegate().isFullScreenBouncer(); } - return mBouncer != null && mBouncer.isFullscreenBouncer(); + return mPrimaryBouncer != null && mPrimaryBouncer.isFullscreenBouncer(); } /** * Clear out any potential actions that were saved to run when the device is unlocked */ public void cancelPostAuthActions() { - if (bouncerIsOrWillBeShowing()) { - return; // allow bouncer to trigger saved actions + if (primaryBouncerIsOrWillBeShowing()) { + return; // allow the primary bouncer to trigger saved actions } mAfterKeyguardGoneAction = null; mDismissActionWillAnimateOnKeyguard = false; @@ -1153,25 +1155,25 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb } boolean showing = mKeyguardStateController.isShowing(); boolean occluded = mKeyguardStateController.isOccluded(); - boolean bouncerShowing = bouncerIsShowing(); - boolean bouncerIsOrWillBeShowing = bouncerIsOrWillBeShowing(); - boolean bouncerDismissible = !isFullscreenBouncer(); + boolean primaryBouncerShowing = primaryBouncerIsShowing(); + boolean primaryBouncerIsOrWillBeShowing = primaryBouncerIsOrWillBeShowing(); + boolean primaryBouncerDismissible = !isFullscreenBouncer(); boolean remoteInputActive = mRemoteInputActive; - if ((bouncerDismissible || !showing || remoteInputActive) != - (mLastBouncerDismissible || !mLastShowing || mLastRemoteInputActive) + if ((primaryBouncerDismissible || !showing || remoteInputActive) + != (mLastBouncerDismissible || !mLastShowing || mLastRemoteInputActive) || mFirstUpdate) { - if (bouncerDismissible || !showing || remoteInputActive) { - if (mBouncer != null) { - mBouncer.setBackButtonEnabled(true); + if (primaryBouncerDismissible || !showing || remoteInputActive) { + if (mPrimaryBouncer != null) { + mPrimaryBouncer.setBackButtonEnabled(true); } else { - mBouncerInteractor.setBackButtonEnabled(true); + mPrimaryBouncerInteractor.setBackButtonEnabled(true); } } else { - if (mBouncer != null) { - mBouncer.setBackButtonEnabled(false); + if (mPrimaryBouncer != null) { + mPrimaryBouncer.setBackButtonEnabled(false); } else { - mBouncerInteractor.setBackButtonEnabled(false); + mPrimaryBouncerInteractor.setBackButtonEnabled(false); } } } @@ -1182,23 +1184,23 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb updateNavigationBarVisibility(navBarVisible); } - if (bouncerShowing != mLastBouncerShowing || mFirstUpdate) { - mNotificationShadeWindowController.setBouncerShowing(bouncerShowing); - mCentralSurfaces.setBouncerShowing(bouncerShowing); + if (primaryBouncerShowing != mLastPrimaryBouncerShowing || mFirstUpdate) { + mNotificationShadeWindowController.setBouncerShowing(primaryBouncerShowing); + mCentralSurfaces.setBouncerShowing(primaryBouncerShowing); } - if (bouncerIsOrWillBeShowing != mLastBouncerIsOrWillBeShowing || mFirstUpdate - || bouncerShowing != mLastBouncerShowing) { - mKeyguardUpdateManager.sendKeyguardBouncerChanged(bouncerIsOrWillBeShowing, - bouncerShowing); + if (primaryBouncerIsOrWillBeShowing != mLastPrimaryBouncerIsOrWillBeShowing || mFirstUpdate + || primaryBouncerShowing != mLastPrimaryBouncerShowing) { + mKeyguardUpdateManager.sendPrimaryBouncerChanged(primaryBouncerIsOrWillBeShowing, + primaryBouncerShowing); } mFirstUpdate = false; mLastShowing = showing; mLastGlobalActionsVisible = mGlobalActionsVisible; mLastOccluded = occluded; - mLastBouncerShowing = bouncerShowing; - mLastBouncerIsOrWillBeShowing = bouncerIsOrWillBeShowing; - mLastBouncerDismissible = bouncerDismissible; + mLastPrimaryBouncerShowing = primaryBouncerShowing; + mLastPrimaryBouncerIsOrWillBeShowing = primaryBouncerIsOrWillBeShowing; + mLastBouncerDismissible = primaryBouncerDismissible; mLastRemoteInputActive = remoteInputActive; mLastDozing = mDozing; mLastPulsing = mPulsing; @@ -1242,7 +1244,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb || mPulsing && !mIsDocked) && mGesturalNav; return (!keyguardVisible && !hideWhileDozing && !mScreenOffAnimationPlaying - || bouncerIsShowing() + || primaryBouncerIsShowing() || mRemoteInputActive || keyguardWithGestureNav || mGlobalActionsVisible); @@ -1258,32 +1260,32 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb && !mLastScreenOffAnimationPlaying || mLastPulsing && !mLastIsDocked) && mLastGesturalNav; return (!keyguardShowing && !hideWhileDozing && !mLastScreenOffAnimationPlaying - || mLastBouncerShowing || mLastRemoteInputActive || keyguardWithGestureNav + || mLastPrimaryBouncerShowing || mLastRemoteInputActive || keyguardWithGestureNav || mLastGlobalActionsVisible); } public boolean shouldDismissOnMenuPressed() { - if (mBouncerView.getDelegate() != null) { - return mBouncerView.getDelegate().shouldDismissOnMenuPressed(); + if (mPrimaryBouncerView.getDelegate() != null) { + return mPrimaryBouncerView.getDelegate().shouldDismissOnMenuPressed(); } - return mBouncer != null && mBouncer.shouldDismissOnMenuPressed(); + return mPrimaryBouncer != null && mPrimaryBouncer.shouldDismissOnMenuPressed(); } public boolean interceptMediaKey(KeyEvent event) { - if (mBouncerView.getDelegate() != null) { - return mBouncerView.getDelegate().interceptMediaKey(event); + if (mPrimaryBouncerView.getDelegate() != null) { + return mPrimaryBouncerView.getDelegate().interceptMediaKey(event); } - return mBouncer != null && mBouncer.interceptMediaKey(event); + return mPrimaryBouncer != null && mPrimaryBouncer.interceptMediaKey(event); } /** * @return true if the pre IME back event should be handled */ public boolean dispatchBackKeyEventPreIme() { - if (mBouncerView.getDelegate() != null) { - return mBouncerView.getDelegate().dispatchBackKeyEventPreIme(); + if (mPrimaryBouncerView.getDelegate() != null) { + return mPrimaryBouncerView.getDelegate().dispatchBackKeyEventPreIme(); } - return mBouncer != null && mBouncer.dispatchBackKeyEventPreIme(); + return mPrimaryBouncer != null && mPrimaryBouncer.dispatchBackKeyEventPreIme(); } public void readyForKeyguardDone() { @@ -1329,29 +1331,29 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb * fingerprint. */ public void notifyKeyguardAuthenticated(boolean strongAuth) { - if (mBouncer != null) { - mBouncer.notifyKeyguardAuthenticated(strongAuth); + if (mPrimaryBouncer != null) { + mPrimaryBouncer.notifyKeyguardAuthenticated(strongAuth); } else { - mBouncerInteractor.notifyKeyguardAuthenticated(strongAuth); + mPrimaryBouncerInteractor.notifyKeyguardAuthenticated(strongAuth); } - if (mAlternateAuthInterceptor != null && isShowingAlternateAuth()) { - resetAlternateAuth(false); + if (mAlternateBouncer != null && isShowingAlternateBouncer()) { + hideAlternateBouncer(false); executeAfterKeyguardGoneAction(); } } /** Display security message to relevant KeyguardMessageArea. */ public void setKeyguardMessage(String message, ColorStateList colorState) { - if (isShowingAlternateAuth()) { + if (isShowingAlternateBouncer()) { if (mKeyguardMessageAreaController != null) { mKeyguardMessageAreaController.setMessage(message); } } else { - if (mBouncer != null) { - mBouncer.showMessage(message, colorState); + if (mPrimaryBouncer != null) { + mPrimaryBouncer.showMessage(message, colorState); } else { - mBouncerInteractor.showMessage(message, colorState); + mPrimaryBouncerInteractor.showMessage(message, colorState); } } } @@ -1390,12 +1392,15 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb } } - public boolean bouncerNeedsScrimming() { + /** + * Whether the primary bouncer requires scrimming. + */ + public boolean primaryBouncerNeedsScrimming() { // When a dream overlay is active, scrimming will cause any expansion to immediately expand. return (mKeyguardStateController.isOccluded() && !mDreamOverlayStateController.isOverlayActive()) - || bouncerWillDismissWithAction() - || (bouncerIsShowing() && bouncerIsScrimmed()) + || primaryBouncerWillDismissWithAction() + || (primaryBouncerIsShowing() && primaryBouncerIsScrimmed()) || isFullscreenBouncer(); } @@ -1405,10 +1410,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb * configuration. */ public void updateResources() { - if (mBouncer != null) { - mBouncer.updateResources(); + if (mPrimaryBouncer != null) { + mPrimaryBouncer.updateResources(); } else { - mBouncerInteractor.updateResources(); + mPrimaryBouncerInteractor.updateResources(); } } @@ -1420,19 +1425,20 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb pw.println(" mAfterKeyguardGoneRunnables: " + mAfterKeyguardGoneRunnables); pw.println(" mPendingWakeupAction: " + mPendingWakeupAction); pw.println(" isBouncerShowing(): " + isBouncerShowing()); - pw.println(" bouncerIsOrWillBeShowing(): " + bouncerIsOrWillBeShowing()); + pw.println(" bouncerIsOrWillBeShowing(): " + primaryBouncerIsOrWillBeShowing()); pw.println(" Registered KeyguardViewManagerCallbacks:"); for (KeyguardViewManagerCallback callback : mCallbacks) { pw.println(" " + callback); } - if (mBouncer != null) { - mBouncer.dump(pw); + if (mPrimaryBouncer != null) { + pw.println("PrimaryBouncer:"); + mPrimaryBouncer.dump(pw); } - if (mAlternateAuthInterceptor != null) { - pw.println("AltAuthInterceptor: "); - mAlternateAuthInterceptor.dump(pw); + if (mAlternateBouncer != null) { + pw.println("AlternateBouncer:"); + mAlternateBouncer.dump(pw); } } @@ -1480,13 +1486,12 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb } @Nullable - public KeyguardBouncer getBouncer() { - return mBouncer; + public KeyguardBouncer getPrimaryBouncer() { + return mPrimaryBouncer; } - public boolean isShowingAlternateAuth() { - return mAlternateAuthInterceptor != null - && mAlternateAuthInterceptor.isShowingAlternateAuthBouncer(); + public boolean isShowingAlternateBouncer() { + return mAlternateBouncer != null && mAlternateBouncer.isShowingAlternateBouncer(); } /** @@ -1500,10 +1505,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb /** Update keyguard position based on a tapped X coordinate. */ public void updateKeyguardPosition(float x) { - if (mBouncer != null) { - mBouncer.updateKeyguardPosition(x); + if (mPrimaryBouncer != null) { + mPrimaryBouncer.updateKeyguardPosition(x); } else { - mBouncerInteractor.setKeyguardPosition(x); + mPrimaryBouncerInteractor.setKeyguardPosition(x); } } @@ -1535,41 +1540,41 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb */ public void requestFp(boolean request, int udfpsColor) { mKeyguardUpdateManager.requestFingerprintAuthOnOccludingApp(request); - if (mAlternateAuthInterceptor != null) { - mAlternateAuthInterceptor.requestUdfps(request, udfpsColor); + if (mAlternateBouncer != null) { + mAlternateBouncer.requestUdfps(request, udfpsColor); } } /** * Returns if bouncer expansion is between 0 and 1 non-inclusive. */ - public boolean isBouncerInTransit() { - if (mBouncer != null) { - return mBouncer.inTransit(); + public boolean isPrimaryBouncerInTransit() { + if (mPrimaryBouncer != null) { + return mPrimaryBouncer.inTransit(); } else { - return mBouncerInteractor.isInTransit(); + return mPrimaryBouncerInteractor.isInTransit(); } } /** * Returns if bouncer is showing */ - public boolean bouncerIsShowing() { - if (mBouncer != null) { - return mBouncer.isShowing(); + public boolean primaryBouncerIsShowing() { + if (mPrimaryBouncer != null) { + return mPrimaryBouncer.isShowing(); } else { - return mBouncerInteractor.isFullyShowing(); + return mPrimaryBouncerInteractor.isFullyShowing(); } } /** * Returns if bouncer is scrimmed */ - public boolean bouncerIsScrimmed() { - if (mBouncer != null) { - return mBouncer.isScrimmed(); + public boolean primaryBouncerIsScrimmed() { + if (mPrimaryBouncer != null) { + return mPrimaryBouncer.isScrimmed(); } else { - return mBouncerInteractor.isScrimmed(); + return mPrimaryBouncerInteractor.isScrimmed(); } } @@ -1577,10 +1582,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb * Returns if bouncer is animating away */ public boolean bouncerIsAnimatingAway() { - if (mBouncer != null) { - return mBouncer.isAnimatingAway(); + if (mPrimaryBouncer != null) { + return mPrimaryBouncer.isAnimatingAway(); } else { - return mBouncerInteractor.isAnimatingAway(); + return mPrimaryBouncerInteractor.isAnimatingAway(); } } @@ -1588,11 +1593,11 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb /** * Returns if bouncer will dismiss with action */ - public boolean bouncerWillDismissWithAction() { - if (mBouncer != null) { - return mBouncer.willDismissWithAction(); + public boolean primaryBouncerWillDismissWithAction() { + if (mPrimaryBouncer != null) { + return mPrimaryBouncer.willDismissWithAction(); } else { - return mBouncerInteractor.willDismissWithAction(); + return mPrimaryBouncerInteractor.willDismissWithAction(); } } @@ -1607,26 +1612,26 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb } /** - * Delegate used to send show/reset events to an alternate authentication method instead of the - * regular pin/pattern/password bouncer. + * Delegate used to send show and hide events to an alternate authentication method instead of + * the regular pin/pattern/password bouncer. */ - public interface AlternateAuthInterceptor { + public interface AlternateBouncer { /** * Show alternate authentication bouncer. * @return whether alternate auth method was newly shown */ - boolean showAlternateAuthBouncer(); + boolean showAlternateBouncer(); /** * Hide alternate authentication bouncer * @return whether the alternate auth method was newly hidden */ - boolean hideAlternateAuthBouncer(); + boolean hideAlternateBouncer(); /** * @return true if the alternate auth bouncer is showing */ - boolean isShowingAlternateAuthBouncer(); + boolean isShowingAlternateBouncer(); /** * Use when an app occluding the keyguard would like to give the user ability to @@ -1638,7 +1643,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb void requestUdfps(boolean requestUdfps, int color); /** - * print information for the alternate auth interceptor registered + * print information for the alternate bouncer registered */ void dump(PrintWriter pw); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java index 70af77e1eb36..8a49850b1822 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallback.java @@ -133,7 +133,7 @@ public class StatusBarRemoteInputCallback implements Callback, Callbacks, if (!row.isPinned()) { mStatusBarStateController.setLeaveOpenOnKeyguardHide(true); } - mStatusBarKeyguardViewManager.showGenericBouncer(true /* scrimmed */); + mStatusBarKeyguardViewManager.showBouncer(true /* scrimmed */); mPendingRemoteInputView = clicked; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialogManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialogManager.java index e7d9221ac861..678c2d972e2d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialogManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/SystemUIDialogManager.java @@ -87,7 +87,7 @@ public class SystemUIDialogManager implements Dumpable { private void updateDialogListeners() { if (shouldHideAffordance()) { - mKeyguardViewController.resetAlternateAuth(true); + mKeyguardViewController.hideAlternateBouncer(true); } for (Listener listener : mListeners) { diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java index 9c14ee610b25..c6200daca6f6 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java @@ -629,7 +629,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { @Test public void testNoStartAuthenticate_whenAboutToShowBouncer() { - mKeyguardUpdateMonitor.sendKeyguardBouncerChanged( + mKeyguardUpdateMonitor.sendPrimaryBouncerChanged( /* bouncerIsOrWillBeShowing */ true, /* bouncerFullyShown */ false); verify(mFaceManager, never()).authenticate(any(), any(), any(), any(), anyInt(), @@ -1852,7 +1852,7 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { } private void setKeyguardBouncerVisibility(boolean isVisible) { - mKeyguardUpdateMonitor.sendKeyguardBouncerChanged(isVisible, isVisible); + mKeyguardUpdateMonitor.sendPrimaryBouncerChanged(isVisible, isVisible); mTestableLooper.processAllMessages(); } diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerOverlayTest.kt b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerOverlayTest.kt index c2d73b9787c2..53bc2c231d0c 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerOverlayTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerOverlayTest.kt @@ -43,7 +43,7 @@ import com.android.systemui.SysuiTestCase import com.android.systemui.animation.ActivityLaunchAnimator import com.android.systemui.dump.DumpManager import com.android.systemui.flags.FeatureFlags -import com.android.systemui.keyguard.domain.interactor.BouncerInteractor +import com.android.systemui.keyguard.domain.interactor.PrimaryBouncerInteractor import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.shade.ShadeExpansionStateManager import com.android.systemui.statusbar.LockscreenShadeTransitionController @@ -106,7 +106,7 @@ class UdfpsControllerOverlayTest : SysuiTestCase() { @Mock private lateinit var udfpsEnrollView: UdfpsEnrollView @Mock private lateinit var activityLaunchAnimator: ActivityLaunchAnimator @Mock private lateinit var featureFlags: FeatureFlags - @Mock private lateinit var bouncerInteractor: BouncerInteractor + @Mock private lateinit var mPrimaryBouncerInteractor: PrimaryBouncerInteractor @Captor private lateinit var layoutParamsCaptor: ArgumentCaptor<WindowManager.LayoutParams> private val onTouch = { _: View, _: MotionEvent, _: Boolean -> true } @@ -141,7 +141,7 @@ class UdfpsControllerOverlayTest : SysuiTestCase() { configurationController, systemClock, keyguardStateController, unlockedScreenOffAnimationController, udfpsDisplayMode, REQUEST_ID, reason, controllerCallback, onTouch, activityLaunchAnimator, featureFlags, - bouncerInteractor, isDebuggable + mPrimaryBouncerInteractor, isDebuggable ) block() } diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerTest.java index aa14a4021438..1b5f9b6d45cd 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerTest.java @@ -73,7 +73,7 @@ import com.android.systemui.animation.ActivityLaunchAnimator; import com.android.systemui.dump.DumpManager; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.keyguard.ScreenLifecycle; -import com.android.systemui.keyguard.domain.interactor.BouncerInteractor; +import com.android.systemui.keyguard.domain.interactor.PrimaryBouncerInteractor; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.shade.ShadeExpansionStateManager; @@ -192,7 +192,7 @@ public class UdfpsControllerTest extends SysuiTestCase { @Mock private AlternateUdfpsTouchProvider mAlternateTouchProvider; @Mock - private BouncerInteractor mBouncerInteractor; + private PrimaryBouncerInteractor mPrimaryBouncerInteractor; // Capture listeners so that they can be used to send events @Captor @@ -291,7 +291,7 @@ public class UdfpsControllerTest extends SysuiTestCase { mActivityLaunchAnimator, Optional.of(mAlternateTouchProvider), mBiometricsExecutor, - mBouncerInteractor); + mPrimaryBouncerInteractor); verify(mFingerprintManager).setUdfpsOverlayController(mOverlayCaptor.capture()); mOverlayController = mOverlayCaptor.getValue(); verify(mScreenLifecycle).addObserver(mScreenObserverCaptor.capture()); @@ -405,14 +405,14 @@ public class UdfpsControllerTest extends SysuiTestCase { // GIVEN overlay was showing and the udfps bouncer is showing mOverlayController.showUdfpsOverlay(TEST_REQUEST_ID, mOpticalProps.sensorId, BiometricOverlayConstants.REASON_AUTH_KEYGUARD, mUdfpsOverlayControllerCallback); - when(mStatusBarKeyguardViewManager.isShowingAlternateAuth()).thenReturn(true); + when(mStatusBarKeyguardViewManager.isShowingAlternateBouncer()).thenReturn(true); // WHEN the overlay is hidden mOverlayController.hideUdfpsOverlay(mOpticalProps.sensorId); mFgExecutor.runAllReady(); // THEN the udfps bouncer is reset - verify(mStatusBarKeyguardViewManager).resetAlternateAuth(eq(true)); + verify(mStatusBarKeyguardViewManager).hideAlternateBouncer(eq(true)); } @Test diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerBaseTest.java index e5c7a42c06a6..75629f451526 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerBaseTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerBaseTest.java @@ -30,7 +30,7 @@ import com.android.systemui.dump.DumpManager; import com.android.systemui.flags.FakeFeatureFlags; import com.android.systemui.flags.Flags; import com.android.systemui.keyguard.KeyguardViewMediator; -import com.android.systemui.keyguard.domain.interactor.BouncerInteractor; +import com.android.systemui.keyguard.domain.interactor.PrimaryBouncerInteractor; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.shade.ShadeExpansionChangeEvent; import com.android.systemui.shade.ShadeExpansionListener; @@ -72,7 +72,7 @@ public class UdfpsKeyguardViewControllerBaseTest extends SysuiTestCase { protected @Mock UdfpsController mUdfpsController; protected @Mock ActivityLaunchAnimator mActivityLaunchAnimator; protected @Mock KeyguardBouncer mBouncer; - protected @Mock BouncerInteractor mBouncerInteractor; + protected @Mock PrimaryBouncerInteractor mPrimaryBouncerInteractor; protected FakeFeatureFlags mFeatureFlags = new FakeFeatureFlags(); protected FakeSystemClock mSystemClock = new FakeSystemClock(); @@ -86,9 +86,9 @@ public class UdfpsKeyguardViewControllerBaseTest extends SysuiTestCase { private @Captor ArgumentCaptor<ShadeExpansionListener> mExpansionListenerCaptor; protected List<ShadeExpansionListener> mExpansionListeners; - private @Captor ArgumentCaptor<StatusBarKeyguardViewManager.AlternateAuthInterceptor> - mAltAuthInterceptorCaptor; - protected StatusBarKeyguardViewManager.AlternateAuthInterceptor mAltAuthInterceptor; + private @Captor ArgumentCaptor<StatusBarKeyguardViewManager.AlternateBouncer> + mAlternateBouncerCaptor; + protected StatusBarKeyguardViewManager.AlternateBouncer mAlternateBouncer; private @Captor ArgumentCaptor<KeyguardStateController.Callback> mKeyguardStateControllerCallbackCaptor; @@ -131,9 +131,9 @@ public class UdfpsKeyguardViewControllerBaseTest extends SysuiTestCase { } protected void captureAltAuthInterceptor() { - verify(mStatusBarKeyguardViewManager).setAlternateAuthInterceptor( - mAltAuthInterceptorCaptor.capture()); - mAltAuthInterceptor = mAltAuthInterceptorCaptor.getValue(); + verify(mStatusBarKeyguardViewManager).setAlternateBouncer( + mAlternateBouncerCaptor.capture()); + mAlternateBouncer = mAlternateBouncerCaptor.getValue(); } protected void captureKeyguardStateControllerCallback() { @@ -149,7 +149,7 @@ public class UdfpsKeyguardViewControllerBaseTest extends SysuiTestCase { protected UdfpsKeyguardViewController createUdfpsKeyguardViewController( boolean useModernBouncer) { mFeatureFlags.set(Flags.MODERN_BOUNCER, useModernBouncer); - when(mStatusBarKeyguardViewManager.getBouncer()).thenReturn( + when(mStatusBarKeyguardViewManager.getPrimaryBouncer()).thenReturn( useModernBouncer ? null : mBouncer); return new UdfpsKeyguardViewController( mView, @@ -167,6 +167,6 @@ public class UdfpsKeyguardViewControllerBaseTest extends SysuiTestCase { mUdfpsController, mActivityLaunchAnimator, mFeatureFlags, - mBouncerInteractor); + mPrimaryBouncerInteractor); } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerTest.java index 55b61948ee45..16728b6f2ab9 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerTest.java @@ -46,9 +46,9 @@ import org.mockito.Captor; @RunWith(AndroidTestingRunner.class) @RunWithLooper public class UdfpsKeyguardViewControllerTest extends UdfpsKeyguardViewControllerBaseTest { - private @Captor ArgumentCaptor<KeyguardBouncer.BouncerExpansionCallback> + private @Captor ArgumentCaptor<KeyguardBouncer.PrimaryBouncerExpansionCallback> mBouncerExpansionCallbackCaptor; - private KeyguardBouncer.BouncerExpansionCallback mBouncerExpansionCallback; + private KeyguardBouncer.PrimaryBouncerExpansionCallback mBouncerExpansionCallback; @Override public UdfpsKeyguardViewController createUdfpsKeyguardViewController() { @@ -63,7 +63,7 @@ public class UdfpsKeyguardViewControllerTest extends UdfpsKeyguardViewController captureBouncerExpansionCallback(); when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(true); - when(mStatusBarKeyguardViewManager.bouncerIsOrWillBeShowing()).thenReturn(true); + when(mStatusBarKeyguardViewManager.primaryBouncerIsOrWillBeShowing()).thenReturn(true); mBouncerExpansionCallback.onVisibilityChanged(true); assertTrue(mController.shouldPauseAuth()); @@ -239,13 +239,13 @@ public class UdfpsKeyguardViewControllerTest extends UdfpsKeyguardViewController sendStatusBarStateChanged(StatusBarState.SHADE_LOCKED); assertTrue(mController.shouldPauseAuth()); - mAltAuthInterceptor.showAlternateAuthBouncer(); // force show + mAlternateBouncer.showAlternateBouncer(); // force show assertFalse(mController.shouldPauseAuth()); - assertTrue(mAltAuthInterceptor.isShowingAlternateAuthBouncer()); + assertTrue(mAlternateBouncer.isShowingAlternateBouncer()); - mAltAuthInterceptor.hideAlternateAuthBouncer(); // stop force show + mAlternateBouncer.hideAlternateBouncer(); // stop force show assertTrue(mController.shouldPauseAuth()); - assertFalse(mAltAuthInterceptor.isShowingAlternateAuthBouncer()); + assertFalse(mAlternateBouncer.isShowingAlternateBouncer()); } @Test @@ -258,7 +258,7 @@ public class UdfpsKeyguardViewControllerTest extends UdfpsKeyguardViewController mController.onViewDetached(); // THEN remove alternate auth interceptor - verify(mStatusBarKeyguardViewManager).removeAlternateAuthInterceptor(mAltAuthInterceptor); + verify(mStatusBarKeyguardViewManager).removeAlternateAuthInterceptor(mAlternateBouncer); } @Test @@ -268,14 +268,15 @@ public class UdfpsKeyguardViewControllerTest extends UdfpsKeyguardViewController captureAltAuthInterceptor(); // GIVEN udfps bouncer isn't showing - mAltAuthInterceptor.hideAlternateAuthBouncer(); + mAlternateBouncer.hideAlternateBouncer(); // WHEN touch is observed outside the view mController.onTouchOutsideView(); // THEN bouncer / alt auth methods are never called + verify(mStatusBarKeyguardViewManager, never()).showPrimaryBouncer(anyBoolean()); verify(mStatusBarKeyguardViewManager, never()).showBouncer(anyBoolean()); - verify(mStatusBarKeyguardViewManager, never()).resetAlternateAuth(anyBoolean()); + verify(mStatusBarKeyguardViewManager, never()).hideAlternateBouncer(anyBoolean()); } @Test @@ -285,32 +286,33 @@ public class UdfpsKeyguardViewControllerTest extends UdfpsKeyguardViewController captureAltAuthInterceptor(); // GIVEN udfps bouncer is showing - mAltAuthInterceptor.showAlternateAuthBouncer(); + mAlternateBouncer.showAlternateBouncer(); // WHEN touch is observed outside the view 200ms later (just within threshold) mSystemClock.advanceTime(200); mController.onTouchOutsideView(); // THEN bouncer / alt auth methods are never called because not enough time has passed + verify(mStatusBarKeyguardViewManager, never()).showPrimaryBouncer(anyBoolean()); verify(mStatusBarKeyguardViewManager, never()).showBouncer(anyBoolean()); - verify(mStatusBarKeyguardViewManager, never()).resetAlternateAuth(anyBoolean()); + verify(mStatusBarKeyguardViewManager, never()).hideAlternateBouncer(anyBoolean()); } @Test - public void testShowingUdfpsBouncerOnTouchOutsideAboveThreshold_showInputBouncer() { + public void testShowingUdfpsBouncerOnTouchOutsideAboveThreshold_showPrimaryBouncer() { // GIVEN view is attached mController.onViewAttached(); captureAltAuthInterceptor(); // GIVEN udfps bouncer is showing - mAltAuthInterceptor.showAlternateAuthBouncer(); + mAlternateBouncer.showAlternateBouncer(); // WHEN touch is observed outside the view 205ms later mSystemClock.advanceTime(205); mController.onTouchOutsideView(); // THEN show the bouncer - verify(mStatusBarKeyguardViewManager).showBouncer(eq(true)); + verify(mStatusBarKeyguardViewManager).showPrimaryBouncer(eq(true)); } @Test @@ -341,7 +343,7 @@ public class UdfpsKeyguardViewControllerTest extends UdfpsKeyguardViewController when(mResourceContext.getString(anyInt())).thenReturn("test string"); // WHEN status bar expansion is 0 but udfps bouncer is requested - mAltAuthInterceptor.showAlternateAuthBouncer(); + mAlternateBouncer.showAlternateBouncer(); // THEN alpha is 255 verify(mView).setUnpausedAlpha(255); @@ -372,7 +374,7 @@ public class UdfpsKeyguardViewControllerTest extends UdfpsKeyguardViewController captureKeyguardStateControllerCallback(); captureAltAuthInterceptor(); updateStatusBarExpansion(1f, true); - mAltAuthInterceptor.showAlternateAuthBouncer(); + mAlternateBouncer.showAlternateBouncer(); reset(mView); // WHEN we're transitioning to the full shade diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerWithCoroutinesTest.kt b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerWithCoroutinesTest.kt index 7b1976811868..68e744e53843 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerWithCoroutinesTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsKeyguardViewControllerWithCoroutinesTest.kt @@ -25,8 +25,8 @@ import com.android.systemui.classifier.FalsingCollector import com.android.systemui.keyguard.DismissCallbackRegistry import com.android.systemui.keyguard.data.BouncerView import com.android.systemui.keyguard.data.repository.KeyguardBouncerRepository -import com.android.systemui.keyguard.domain.interactor.BouncerCallbackInteractor -import com.android.systemui.keyguard.domain.interactor.BouncerInteractor +import com.android.systemui.keyguard.domain.interactor.PrimaryBouncerCallbackInteractor +import com.android.systemui.keyguard.domain.interactor.PrimaryBouncerInteractor import com.android.systemui.statusbar.StatusBarState import com.android.systemui.statusbar.phone.KeyguardBouncer import com.android.systemui.statusbar.phone.KeyguardBypassController @@ -59,14 +59,14 @@ class UdfpsKeyguardViewControllerWithCoroutinesTest : UdfpsKeyguardViewControlle } override fun createUdfpsKeyguardViewController(): UdfpsKeyguardViewController? { - mBouncerInteractor = - BouncerInteractor( + mPrimaryBouncerInteractor = + PrimaryBouncerInteractor( keyguardBouncerRepository, mock(BouncerView::class.java), mock(Handler::class.java), mKeyguardStateController, mock(KeyguardSecurityModel::class.java), - mock(BouncerCallbackInteractor::class.java), + mock(PrimaryBouncerCallbackInteractor::class.java), mock(FalsingCollector::class.java), mock(DismissCallbackRegistry::class.java), mock(KeyguardBypassController::class.java), @@ -86,7 +86,7 @@ class UdfpsKeyguardViewControllerWithCoroutinesTest : UdfpsKeyguardViewControlle // WHEN the bouncer expansion is VISIBLE val job = mController.listenForBouncerExpansion(this) - keyguardBouncerRepository.setVisible(true) + keyguardBouncerRepository.setPrimaryVisible(true) keyguardBouncerRepository.setPanelExpansion(KeyguardBouncer.EXPANSION_VISIBLE) yield() diff --git a/packages/SystemUI/tests/src/com/android/systemui/dreams/DreamOverlayContainerViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/dreams/DreamOverlayContainerViewControllerTest.java index c234178f8af3..517804db2a70 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/dreams/DreamOverlayContainerViewControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/dreams/DreamOverlayContainerViewControllerTest.java @@ -36,10 +36,10 @@ import androidx.test.filters.SmallTest; import com.android.keyguard.BouncerPanelExpansionCalculator; import com.android.systemui.SysuiTestCase; import com.android.systemui.dreams.complication.ComplicationHostViewController; -import com.android.systemui.keyguard.domain.interactor.BouncerCallbackInteractor; +import com.android.systemui.keyguard.domain.interactor.PrimaryBouncerCallbackInteractor; import com.android.systemui.statusbar.BlurUtils; import com.android.systemui.statusbar.phone.KeyguardBouncer; -import com.android.systemui.statusbar.phone.KeyguardBouncer.BouncerExpansionCallback; +import com.android.systemui.statusbar.phone.KeyguardBouncer.PrimaryBouncerExpansionCallback; import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager; import org.junit.Before; @@ -90,7 +90,7 @@ public class DreamOverlayContainerViewControllerTest extends SysuiTestCase { ViewRootImpl mViewRoot; @Mock - BouncerCallbackInteractor mBouncerCallbackInteractor; + PrimaryBouncerCallbackInteractor mPrimaryBouncerCallbackInteractor; @Mock DreamOverlayAnimationsController mAnimationsController; @@ -106,7 +106,7 @@ public class DreamOverlayContainerViewControllerTest extends SysuiTestCase { when(mDreamOverlayContainerView.getResources()).thenReturn(mResources); when(mDreamOverlayContainerView.getViewTreeObserver()).thenReturn(mViewTreeObserver); - when(mStatusBarKeyguardViewManager.getBouncer()).thenReturn(mBouncer); + when(mStatusBarKeyguardViewManager.getPrimaryBouncer()).thenReturn(mBouncer); when(mDreamOverlayContainerView.getViewRootImpl()).thenReturn(mViewRoot); mController = new DreamOverlayContainerViewController( @@ -121,7 +121,7 @@ public class DreamOverlayContainerViewControllerTest extends SysuiTestCase { MAX_BURN_IN_OFFSET, BURN_IN_PROTECTION_UPDATE_INTERVAL, MILLIS_UNTIL_FULL_JITTER, - mBouncerCallbackInteractor, + mPrimaryBouncerCallbackInteractor, mAnimationsController, mStateController); } @@ -167,8 +167,8 @@ public class DreamOverlayContainerViewControllerTest extends SysuiTestCase { @Test public void testBouncerAnimation_doesNotApply() { - final ArgumentCaptor<BouncerExpansionCallback> bouncerExpansionCaptor = - ArgumentCaptor.forClass(BouncerExpansionCallback.class); + final ArgumentCaptor<PrimaryBouncerExpansionCallback> bouncerExpansionCaptor = + ArgumentCaptor.forClass(PrimaryBouncerExpansionCallback.class); mController.onViewAttached(); verify(mBouncer).addBouncerExpansionCallback(bouncerExpansionCaptor.capture()); @@ -178,8 +178,8 @@ public class DreamOverlayContainerViewControllerTest extends SysuiTestCase { @Test public void testBouncerAnimation_updateBlur() { - final ArgumentCaptor<BouncerExpansionCallback> bouncerExpansionCaptor = - ArgumentCaptor.forClass(BouncerExpansionCallback.class); + final ArgumentCaptor<PrimaryBouncerExpansionCallback> bouncerExpansionCaptor = + ArgumentCaptor.forClass(PrimaryBouncerExpansionCallback.class); mController.onViewAttached(); verify(mBouncer).addBouncerExpansionCallback(bouncerExpansionCaptor.capture()); diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/BouncerCallbackInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerCallbackInteractorTest.kt index 3a61c57d086f..db9c4e713e37 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/BouncerCallbackInteractorTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerCallbackInteractorTest.kt @@ -30,57 +30,61 @@ import org.mockito.MockitoAnnotations @SmallTest @RunWith(JUnit4::class) -class BouncerCallbackInteractorTest : SysuiTestCase() { - private val bouncerCallbackInteractor = BouncerCallbackInteractor() - @Mock private lateinit var bouncerExpansionCallback: KeyguardBouncer.BouncerExpansionCallback +class PrimaryBouncerCallbackInteractorTest : SysuiTestCase() { + private val mPrimaryBouncerCallbackInteractor = PrimaryBouncerCallbackInteractor() + @Mock + private lateinit var mPrimaryBouncerExpansionCallback: + KeyguardBouncer.PrimaryBouncerExpansionCallback @Mock private lateinit var keyguardResetCallback: KeyguardBouncer.KeyguardResetCallback @Before fun setup() { MockitoAnnotations.initMocks(this) - bouncerCallbackInteractor.addBouncerExpansionCallback(bouncerExpansionCallback) - bouncerCallbackInteractor.addKeyguardResetCallback(keyguardResetCallback) + mPrimaryBouncerCallbackInteractor.addBouncerExpansionCallback( + mPrimaryBouncerExpansionCallback + ) + mPrimaryBouncerCallbackInteractor.addKeyguardResetCallback(keyguardResetCallback) } @Test fun testOnFullyShown() { - bouncerCallbackInteractor.dispatchFullyShown() - verify(bouncerExpansionCallback).onFullyShown() + mPrimaryBouncerCallbackInteractor.dispatchFullyShown() + verify(mPrimaryBouncerExpansionCallback).onFullyShown() } @Test fun testOnFullyHidden() { - bouncerCallbackInteractor.dispatchFullyHidden() - verify(bouncerExpansionCallback).onFullyHidden() + mPrimaryBouncerCallbackInteractor.dispatchFullyHidden() + verify(mPrimaryBouncerExpansionCallback).onFullyHidden() } @Test fun testOnExpansionChanged() { - bouncerCallbackInteractor.dispatchExpansionChanged(5f) - verify(bouncerExpansionCallback).onExpansionChanged(5f) + mPrimaryBouncerCallbackInteractor.dispatchExpansionChanged(5f) + verify(mPrimaryBouncerExpansionCallback).onExpansionChanged(5f) } @Test fun testOnVisibilityChanged() { - bouncerCallbackInteractor.dispatchVisibilityChanged(View.INVISIBLE) - verify(bouncerExpansionCallback).onVisibilityChanged(false) + mPrimaryBouncerCallbackInteractor.dispatchVisibilityChanged(View.INVISIBLE) + verify(mPrimaryBouncerExpansionCallback).onVisibilityChanged(false) } @Test fun testOnStartingToHide() { - bouncerCallbackInteractor.dispatchStartingToHide() - verify(bouncerExpansionCallback).onStartingToHide() + mPrimaryBouncerCallbackInteractor.dispatchStartingToHide() + verify(mPrimaryBouncerExpansionCallback).onStartingToHide() } @Test fun testOnStartingToShow() { - bouncerCallbackInteractor.dispatchStartingToShow() - verify(bouncerExpansionCallback).onStartingToShow() + mPrimaryBouncerCallbackInteractor.dispatchStartingToShow() + verify(mPrimaryBouncerExpansionCallback).onStartingToShow() } @Test fun testOnKeyguardReset() { - bouncerCallbackInteractor.dispatchReset() + mPrimaryBouncerCallbackInteractor.dispatchReset() verify(keyguardResetCallback).onKeyguardReset() } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/BouncerInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractorTest.kt index 5743b2f03d3a..c85f7b9e6885 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/BouncerInteractorTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractorTest.kt @@ -53,59 +53,59 @@ import org.mockito.MockitoAnnotations @SmallTest @RunWithLooper(setAsMainLooper = true) @RunWith(AndroidTestingRunner::class) -class BouncerInteractorTest : SysuiTestCase() { +class PrimaryBouncerInteractorTest : SysuiTestCase() { @Mock(answer = Answers.RETURNS_DEEP_STUBS) private lateinit var repository: KeyguardBouncerRepository @Mock(answer = Answers.RETURNS_DEEP_STUBS) private lateinit var bouncerView: BouncerView @Mock private lateinit var bouncerViewDelegate: BouncerViewDelegate @Mock private lateinit var keyguardStateController: KeyguardStateController @Mock private lateinit var keyguardSecurityModel: KeyguardSecurityModel - @Mock private lateinit var bouncerCallbackInteractor: BouncerCallbackInteractor + @Mock private lateinit var mPrimaryBouncerCallbackInteractor: PrimaryBouncerCallbackInteractor @Mock private lateinit var falsingCollector: FalsingCollector @Mock private lateinit var dismissCallbackRegistry: DismissCallbackRegistry @Mock private lateinit var keyguardBypassController: KeyguardBypassController @Mock private lateinit var keyguardUpdateMonitor: KeyguardUpdateMonitor private val mainHandler = FakeHandler(Looper.getMainLooper()) - private lateinit var bouncerInteractor: BouncerInteractor + private lateinit var mPrimaryBouncerInteractor: PrimaryBouncerInteractor @Before fun setUp() { MockitoAnnotations.initMocks(this) DejankUtils.setImmediate(true) - bouncerInteractor = - BouncerInteractor( + mPrimaryBouncerInteractor = + PrimaryBouncerInteractor( repository, bouncerView, mainHandler, keyguardStateController, keyguardSecurityModel, - bouncerCallbackInteractor, + mPrimaryBouncerCallbackInteractor, falsingCollector, dismissCallbackRegistry, keyguardBypassController, keyguardUpdateMonitor, ) - `when`(repository.startingDisappearAnimation.value).thenReturn(null) - `when`(repository.show.value).thenReturn(null) + `when`(repository.primaryBouncerStartingDisappearAnimation.value).thenReturn(null) + `when`(repository.primaryBouncerShow.value).thenReturn(null) `when`(bouncerView.delegate).thenReturn(bouncerViewDelegate) } @Test fun testShow_isScrimmed() { - bouncerInteractor.show(true) + mPrimaryBouncerInteractor.show(true) verify(repository).setShowMessage(null) verify(repository).setOnScreenTurnedOff(false) verify(repository).setKeyguardAuthenticated(null) - verify(repository).setHide(false) - verify(repository).setStartingToHide(false) - verify(repository).setScrimmed(true) + verify(repository).setPrimaryHide(false) + verify(repository).setPrimaryStartingToHide(false) + verify(repository).setPrimaryScrimmed(true) verify(repository).setPanelExpansion(EXPANSION_VISIBLE) - verify(repository).setShowingSoon(true) + verify(repository).setPrimaryShowingSoon(true) verify(keyguardStateController).notifyBouncerShowing(true) - verify(bouncerCallbackInteractor).dispatchStartingToShow() - verify(repository).setVisible(true) - verify(repository).setShow(any(KeyguardBouncerModel::class.java)) - verify(repository).setShowingSoon(false) + verify(mPrimaryBouncerCallbackInteractor).dispatchStartingToShow() + verify(repository).setPrimaryVisible(true) + verify(repository).setPrimaryShow(any(KeyguardBouncerModel::class.java)) + verify(repository).setPrimaryShowingSoon(false) } @Test @@ -117,60 +117,60 @@ class BouncerInteractorTest : SysuiTestCase() { fun testShow_keyguardIsDone() { `when`(bouncerView.delegate?.showNextSecurityScreenOrFinish()).thenReturn(true) verify(keyguardStateController, never()).notifyBouncerShowing(true) - verify(bouncerCallbackInteractor, never()).dispatchStartingToShow() + verify(mPrimaryBouncerCallbackInteractor, never()).dispatchStartingToShow() } @Test fun testHide() { - bouncerInteractor.hide() + mPrimaryBouncerInteractor.hide() verify(falsingCollector).onBouncerHidden() verify(keyguardStateController).notifyBouncerShowing(false) - verify(repository).setShowingSoon(false) - verify(repository).setVisible(false) - verify(repository).setHide(true) - verify(repository).setShow(null) + verify(repository).setPrimaryShowingSoon(false) + verify(repository).setPrimaryVisible(false) + verify(repository).setPrimaryHide(true) + verify(repository).setPrimaryShow(null) } @Test fun testExpansion() { `when`(repository.panelExpansionAmount.value).thenReturn(0.5f) - bouncerInteractor.setPanelExpansion(0.6f) + mPrimaryBouncerInteractor.setPanelExpansion(0.6f) verify(repository).setPanelExpansion(0.6f) - verify(bouncerCallbackInteractor).dispatchExpansionChanged(0.6f) + verify(mPrimaryBouncerCallbackInteractor).dispatchExpansionChanged(0.6f) } @Test fun testExpansion_fullyShown() { `when`(repository.panelExpansionAmount.value).thenReturn(0.5f) - `when`(repository.startingDisappearAnimation.value).thenReturn(null) - bouncerInteractor.setPanelExpansion(EXPANSION_VISIBLE) + `when`(repository.primaryBouncerStartingDisappearAnimation.value).thenReturn(null) + mPrimaryBouncerInteractor.setPanelExpansion(EXPANSION_VISIBLE) verify(falsingCollector).onBouncerShown() - verify(bouncerCallbackInteractor).dispatchFullyShown() + verify(mPrimaryBouncerCallbackInteractor).dispatchFullyShown() } @Test fun testExpansion_fullyHidden() { `when`(repository.panelExpansionAmount.value).thenReturn(0.5f) - `when`(repository.startingDisappearAnimation.value).thenReturn(null) - bouncerInteractor.setPanelExpansion(EXPANSION_HIDDEN) - verify(repository).setVisible(false) - verify(repository).setShow(null) + `when`(repository.primaryBouncerStartingDisappearAnimation.value).thenReturn(null) + mPrimaryBouncerInteractor.setPanelExpansion(EXPANSION_HIDDEN) + verify(repository).setPrimaryVisible(false) + verify(repository).setPrimaryShow(null) verify(falsingCollector).onBouncerHidden() - verify(bouncerCallbackInteractor).dispatchReset() - verify(bouncerCallbackInteractor).dispatchFullyHidden() + verify(mPrimaryBouncerCallbackInteractor).dispatchReset() + verify(mPrimaryBouncerCallbackInteractor).dispatchFullyHidden() } @Test fun testExpansion_startingToHide() { `when`(repository.panelExpansionAmount.value).thenReturn(EXPANSION_VISIBLE) - bouncerInteractor.setPanelExpansion(0.1f) - verify(repository).setStartingToHide(true) - verify(bouncerCallbackInteractor).dispatchStartingToHide() + mPrimaryBouncerInteractor.setPanelExpansion(0.1f) + verify(repository).setPrimaryStartingToHide(true) + verify(mPrimaryBouncerCallbackInteractor).dispatchStartingToHide() } @Test fun testShowMessage() { - bouncerInteractor.showMessage("abc", null) + mPrimaryBouncerInteractor.showMessage("abc", null) verify(repository).setShowMessage(BouncerShowMessageModel("abc", null)) } @@ -178,100 +178,100 @@ class BouncerInteractorTest : SysuiTestCase() { fun testDismissAction() { val onDismissAction = mock(ActivityStarter.OnDismissAction::class.java) val cancelAction = mock(Runnable::class.java) - bouncerInteractor.setDismissAction(onDismissAction, cancelAction) + mPrimaryBouncerInteractor.setDismissAction(onDismissAction, cancelAction) verify(bouncerViewDelegate).setDismissAction(onDismissAction, cancelAction) } @Test fun testUpdateResources() { - bouncerInteractor.updateResources() + mPrimaryBouncerInteractor.updateResources() verify(repository).setResourceUpdateRequests(true) } @Test fun testNotifyKeyguardAuthenticated() { - bouncerInteractor.notifyKeyguardAuthenticated(true) + mPrimaryBouncerInteractor.notifyKeyguardAuthenticated(true) verify(repository).setKeyguardAuthenticated(true) } @Test fun testOnScreenTurnedOff() { - bouncerInteractor.onScreenTurnedOff() + mPrimaryBouncerInteractor.onScreenTurnedOff() verify(repository).setOnScreenTurnedOff(true) } @Test fun testSetKeyguardPosition() { - bouncerInteractor.setKeyguardPosition(0f) + mPrimaryBouncerInteractor.setKeyguardPosition(0f) verify(repository).setKeyguardPosition(0f) } @Test fun testNotifyKeyguardAuthenticatedHandled() { - bouncerInteractor.notifyKeyguardAuthenticatedHandled() + mPrimaryBouncerInteractor.notifyKeyguardAuthenticatedHandled() verify(repository).setKeyguardAuthenticated(null) } @Test fun testNotifyUpdatedResources() { - bouncerInteractor.notifyUpdatedResources() + mPrimaryBouncerInteractor.notifyUpdatedResources() verify(repository).setResourceUpdateRequests(false) } @Test fun testSetBackButtonEnabled() { - bouncerInteractor.setBackButtonEnabled(true) + mPrimaryBouncerInteractor.setBackButtonEnabled(true) verify(repository).setIsBackButtonEnabled(true) } @Test fun testStartDisappearAnimation() { val runnable = mock(Runnable::class.java) - bouncerInteractor.startDisappearAnimation(runnable) - verify(repository).setStartDisappearAnimation(any(Runnable::class.java)) + mPrimaryBouncerInteractor.startDisappearAnimation(runnable) + verify(repository).setPrimaryStartDisappearAnimation(any(Runnable::class.java)) } @Test fun testIsFullShowing() { - `when`(repository.isVisible.value).thenReturn(true) + `when`(repository.primaryBouncerVisible.value).thenReturn(true) `when`(repository.panelExpansionAmount.value).thenReturn(EXPANSION_VISIBLE) - `when`(repository.startingDisappearAnimation.value).thenReturn(null) - assertThat(bouncerInteractor.isFullyShowing()).isTrue() - `when`(repository.isVisible.value).thenReturn(false) - assertThat(bouncerInteractor.isFullyShowing()).isFalse() + `when`(repository.primaryBouncerStartingDisappearAnimation.value).thenReturn(null) + assertThat(mPrimaryBouncerInteractor.isFullyShowing()).isTrue() + `when`(repository.primaryBouncerVisible.value).thenReturn(false) + assertThat(mPrimaryBouncerInteractor.isFullyShowing()).isFalse() } @Test fun testIsScrimmed() { - `when`(repository.isScrimmed.value).thenReturn(true) - assertThat(bouncerInteractor.isScrimmed()).isTrue() - `when`(repository.isScrimmed.value).thenReturn(false) - assertThat(bouncerInteractor.isScrimmed()).isFalse() + `when`(repository.primaryBouncerScrimmed.value).thenReturn(true) + assertThat(mPrimaryBouncerInteractor.isScrimmed()).isTrue() + `when`(repository.primaryBouncerScrimmed.value).thenReturn(false) + assertThat(mPrimaryBouncerInteractor.isScrimmed()).isFalse() } @Test fun testIsInTransit() { - `when`(repository.showingSoon.value).thenReturn(true) - assertThat(bouncerInteractor.isInTransit()).isTrue() - `when`(repository.showingSoon.value).thenReturn(false) - assertThat(bouncerInteractor.isInTransit()).isFalse() + `when`(repository.primaryBouncerShowingSoon.value).thenReturn(true) + assertThat(mPrimaryBouncerInteractor.isInTransit()).isTrue() + `when`(repository.primaryBouncerShowingSoon.value).thenReturn(false) + assertThat(mPrimaryBouncerInteractor.isInTransit()).isFalse() `when`(repository.panelExpansionAmount.value).thenReturn(0.5f) - assertThat(bouncerInteractor.isInTransit()).isTrue() + assertThat(mPrimaryBouncerInteractor.isInTransit()).isTrue() } @Test fun testIsAnimatingAway() { - `when`(repository.startingDisappearAnimation.value).thenReturn(Runnable {}) - assertThat(bouncerInteractor.isAnimatingAway()).isTrue() - `when`(repository.startingDisappearAnimation.value).thenReturn(null) - assertThat(bouncerInteractor.isAnimatingAway()).isFalse() + `when`(repository.primaryBouncerStartingDisappearAnimation.value).thenReturn(Runnable {}) + assertThat(mPrimaryBouncerInteractor.isAnimatingAway()).isTrue() + `when`(repository.primaryBouncerStartingDisappearAnimation.value).thenReturn(null) + assertThat(mPrimaryBouncerInteractor.isAnimatingAway()).isFalse() } @Test fun testWillDismissWithAction() { `when`(bouncerViewDelegate.willDismissWithActions()).thenReturn(true) - assertThat(bouncerInteractor.willDismissWithAction()).isTrue() + assertThat(mPrimaryBouncerInteractor.willDismissWithAction()).isTrue() `when`(bouncerViewDelegate.willDismissWithActions()).thenReturn(false) - assertThat(bouncerInteractor.willDismissWithAction()).isFalse() + assertThat(mPrimaryBouncerInteractor.willDismissWithAction()).isFalse() } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelControllerTest.kt index 3c867ab32725..9f28708a388e 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/QSPanelControllerTest.kt @@ -64,7 +64,7 @@ class QSPanelControllerTest : SysuiTestCase() { whenever(brightnessSliderFactory.create(any(), any())).thenReturn(brightnessSlider) whenever(brightnessControllerFactory.create(any())).thenReturn(brightnessController) whenever(qsPanel.resources).thenReturn(mContext.orCreateTestableResources.resources) - whenever(statusBarKeyguardViewManager.isBouncerInTransit()).thenReturn(false) + whenever(statusBarKeyguardViewManager.isPrimaryBouncerInTransit()).thenReturn(false) whenever(qsPanel.setListening(anyBoolean())).then { whenever(qsPanel.isListening).thenReturn(it.getArgument(0)) } @@ -116,9 +116,9 @@ class QSPanelControllerTest : SysuiTestCase() { @Test fun testIsBouncerInTransit() { - whenever(statusBarKeyguardViewManager.isBouncerInTransit()).thenReturn(true) + whenever(statusBarKeyguardViewManager.isPrimaryBouncerInTransit()).thenReturn(true) assertThat(controller.isBouncerInTransit()).isEqualTo(true) - whenever(statusBarKeyguardViewManager.isBouncerInTransit()).thenReturn(false) + whenever(statusBarKeyguardViewManager.isPrimaryBouncerInTransit()).thenReturn(false) assertThat(controller.isBouncerInTransit()).isEqualTo(false) } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java index c98c1f2bc97e..fb2046d39f9b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerTest.java @@ -854,7 +854,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_FORWARD.getId(), null); - verify(mStatusBarKeyguardViewManager).showBouncer(true); + verify(mStatusBarKeyguardViewManager).showPrimaryBouncer(true); } @Test @@ -864,7 +864,7 @@ public class NotificationPanelViewControllerTest extends SysuiTestCase { AccessibilityNodeInfo.AccessibilityAction.ACTION_SCROLL_UP.getId(), null); - verify(mStatusBarKeyguardViewManager).showBouncer(true); + verify(mStatusBarKeyguardViewManager).showPrimaryBouncer(true); } @Test diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.java index a4a7995ae3c8..a6c80ab649e5 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationShadeWindowViewTest.java @@ -152,7 +152,7 @@ public class NotificationShadeWindowViewTest extends SysuiTestCase { // WHEN showing alt auth, not dozing, drag down helper doesn't want to intercept when(mStatusBarStateController.isDozing()).thenReturn(false); - when(mStatusBarKeyguardViewManager.isShowingAlternateAuth()).thenReturn(true); + when(mStatusBarKeyguardViewManager.isShowingAlternateBouncer()).thenReturn(true); when(mDragDownHelper.onInterceptTouchEvent(any())).thenReturn(false); // THEN we should intercept touch @@ -165,7 +165,7 @@ public class NotificationShadeWindowViewTest extends SysuiTestCase { // WHEN not showing alt auth, not dozing, drag down helper doesn't want to intercept when(mStatusBarStateController.isDozing()).thenReturn(false); - when(mStatusBarKeyguardViewManager.isShowingAlternateAuth()).thenReturn(false); + when(mStatusBarKeyguardViewManager.isShowingAlternateBouncer()).thenReturn(false); when(mDragDownHelper.onInterceptTouchEvent(any())).thenReturn(false); // THEN we shouldn't intercept touch @@ -178,7 +178,7 @@ public class NotificationShadeWindowViewTest extends SysuiTestCase { // WHEN showing alt auth, not dozing, drag down helper doesn't want to intercept when(mStatusBarStateController.isDozing()).thenReturn(false); - when(mStatusBarKeyguardViewManager.isShowingAlternateAuth()).thenReturn(true); + when(mStatusBarKeyguardViewManager.isShowingAlternateBouncer()).thenReturn(true); when(mDragDownHelper.onInterceptTouchEvent(any())).thenReturn(false); // THEN we should handle the touch diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt index 40aec82f5a85..743e7d69cfc0 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackScrollAlgorithmTest.kt @@ -118,7 +118,7 @@ class StackScrollAlgorithmTest : SysuiTestCase() { @Test fun resetViewStates_expansionChanging_notificationBecomesTransparent() { - whenever(mStatusBarKeyguardViewManager.isBouncerInTransit).thenReturn(false) + whenever(mStatusBarKeyguardViewManager.isPrimaryBouncerInTransit).thenReturn(false) resetViewStates_expansionChanging_notificationAlphaUpdated( expansionFraction = 0.25f, expectedAlpha = 0.0f @@ -127,7 +127,7 @@ class StackScrollAlgorithmTest : SysuiTestCase() { @Test fun resetViewStates_expansionChangingWhileBouncerInTransit_viewBecomesTransparent() { - whenever(mStatusBarKeyguardViewManager.isBouncerInTransit).thenReturn(true) + whenever(mStatusBarKeyguardViewManager.isPrimaryBouncerInTransit).thenReturn(true) resetViewStates_expansionChanging_notificationAlphaUpdated( expansionFraction = 0.85f, expectedAlpha = 0.0f @@ -136,7 +136,7 @@ class StackScrollAlgorithmTest : SysuiTestCase() { @Test fun resetViewStates_expansionChanging_notificationAlphaUpdated() { - whenever(mStatusBarKeyguardViewManager.isBouncerInTransit).thenReturn(false) + whenever(mStatusBarKeyguardViewManager.isPrimaryBouncerInTransit).thenReturn(false) resetViewStates_expansionChanging_notificationAlphaUpdated( expansionFraction = 0.6f, expectedAlpha = getContentAlpha(0.6f) @@ -145,7 +145,7 @@ class StackScrollAlgorithmTest : SysuiTestCase() { @Test fun resetViewStates_expansionChangingWhileBouncerInTransit_notificationAlphaUpdated() { - whenever(mStatusBarKeyguardViewManager.isBouncerInTransit).thenReturn(true) + whenever(mStatusBarKeyguardViewManager.isPrimaryBouncerInTransit).thenReturn(true) resetViewStates_expansionChanging_notificationAlphaUpdated( expansionFraction = 0.95f, expectedAlpha = aboutToShowBouncerProgress(0.95f) diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java index b17747ad2d92..75a3b21724ef 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/BiometricsUnlockControllerTest.java @@ -147,24 +147,24 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { } @Test - public void onBiometricAuthenticated_whenFingerprintAndBiometricsDisallowed_showBouncer() { + public void onBiometricAuthenticated_fingerprintAndBiometricsDisallowed_showPrimaryBouncer() { when(mUpdateMonitor.isUnlockingWithBiometricAllowed(true /* isStrongBiometric */)) .thenReturn(false); mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT, BiometricSourceType.FINGERPRINT, true /* isStrongBiometric */); - verify(mStatusBarKeyguardViewManager).showBouncer(anyBoolean()); + verify(mStatusBarKeyguardViewManager).showPrimaryBouncer(anyBoolean()); verify(mStatusBarKeyguardViewManager, never()).notifyKeyguardAuthenticated(anyBoolean()); assertThat(mBiometricUnlockController.getMode()) .isEqualTo(BiometricUnlockController.MODE_SHOW_BOUNCER); } @Test - public void onBiometricAuthenticated_whenFingerprint_nonStrongBioDisallowed_showBouncer() { + public void onBiometricAuthenticated_fingerprint_nonStrongBioDisallowed_showPrimaryBouncer() { when(mUpdateMonitor.isUnlockingWithBiometricAllowed(false /* isStrongBiometric */)) .thenReturn(false); mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT, BiometricSourceType.FINGERPRINT, false /* isStrongBiometric */); - verify(mStatusBarKeyguardViewManager).showBouncer(anyBoolean()); + verify(mStatusBarKeyguardViewManager).showPrimaryBouncer(anyBoolean()); assertThat(mBiometricUnlockController.getMode()) .isEqualTo(BiometricUnlockController.MODE_SHOW_BOUNCER); assertThat(mBiometricUnlockController.getBiometricType()) @@ -214,7 +214,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT, BiometricSourceType.FINGERPRINT, true /* isStrongBiometric */); - verify(mStatusBarKeyguardViewManager, never()).showBouncer(anyBoolean()); + verify(mStatusBarKeyguardViewManager, never()).showPrimaryBouncer(anyBoolean()); verify(mStatusBarKeyguardViewManager).notifyKeyguardAuthenticated(eq(false)); assertThat(mBiometricUnlockController.getMode()) .isEqualTo(BiometricUnlockController.MODE_UNLOCK_COLLAPSING); @@ -223,7 +223,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { @Test public void onBiometricAuthenticated_whenFingerprintOnBouncer_dismissBouncer() { when(mUpdateMonitor.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(true); - when(mStatusBarKeyguardViewManager.bouncerIsOrWillBeShowing()).thenReturn(true); + when(mStatusBarKeyguardViewManager.primaryBouncerIsOrWillBeShowing()).thenReturn(true); // the value of isStrongBiometric doesn't matter here since we only care about the returned // value of isUnlockingWithBiometricAllowed() mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT, @@ -283,7 +283,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { } @Test - public void onBiometricAuthenticated_whenFace_andBypass_encrypted_showBouncer() { + public void onBiometricAuthenticated_whenFace_andBypass_encrypted_showPrimaryBouncer() { reset(mUpdateMonitor); when(mKeyguardBypassController.getBypassEnabled()).thenReturn(true); mBiometricUnlockController.setKeyguardViewController(mStatusBarKeyguardViewManager); @@ -294,7 +294,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT, BiometricSourceType.FACE, true /* isStrongBiometric */); - verify(mStatusBarKeyguardViewManager).showBouncer(anyBoolean()); + verify(mStatusBarKeyguardViewManager).showPrimaryBouncer(anyBoolean()); assertThat(mBiometricUnlockController.getMode()) .isEqualTo(BiometricUnlockController.MODE_SHOW_BOUNCER); } @@ -330,7 +330,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT, BiometricSourceType.FACE, true /* isStrongBiometric */); - verify(mStatusBarKeyguardViewManager, never()).showBouncer(anyBoolean()); + verify(mStatusBarKeyguardViewManager, never()).showPrimaryBouncer(anyBoolean()); verify(mShadeController, never()).animateCollapsePanels(anyInt(), anyBoolean(), anyBoolean(), anyFloat()); assertThat(mBiometricUnlockController.getMode()) @@ -340,7 +340,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { @Test public void onBiometricAuthenticated_whenFaceOnBouncer_dismissBouncer() { when(mUpdateMonitor.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(true); - when(mStatusBarKeyguardViewManager.bouncerIsOrWillBeShowing()).thenReturn(true); + when(mStatusBarKeyguardViewManager.primaryBouncerIsOrWillBeShowing()).thenReturn(true); // the value of isStrongBiometric doesn't matter here since we only care about the returned // value of isUnlockingWithBiometricAllowed() mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT, @@ -360,7 +360,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { when(mKeyguardBypassController.getBypassEnabled()).thenReturn(true); when(mKeyguardBypassController.onBiometricAuthenticated(any(), anyBoolean())) .thenReturn(true); - when(mStatusBarKeyguardViewManager.bouncerIsOrWillBeShowing()).thenReturn(true); + when(mStatusBarKeyguardViewManager.primaryBouncerIsOrWillBeShowing()).thenReturn(true); // the value of isStrongBiometric doesn't matter here since we only care about the returned // value of isUnlockingWithBiometricAllowed() mBiometricUnlockController.onBiometricAuthenticated(UserHandle.USER_CURRENT, @@ -389,23 +389,23 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase { } @Test - public void onUdfpsConsecutivelyFailedThreeTimes_showBouncer() { + public void onUdfpsConsecutivelyFailedThreeTimes_showPrimaryBouncer() { // GIVEN UDFPS is supported when(mUpdateMonitor.isUdfpsSupported()).thenReturn(true); // WHEN udfps fails once - then don't show the bouncer yet mBiometricUnlockController.onBiometricAuthFailed(BiometricSourceType.FINGERPRINT); - verify(mStatusBarKeyguardViewManager, never()).showBouncer(anyBoolean()); + verify(mStatusBarKeyguardViewManager, never()).showPrimaryBouncer(anyBoolean()); // WHEN udfps fails the second time - then don't show the bouncer yet mBiometricUnlockController.onBiometricAuthFailed(BiometricSourceType.FINGERPRINT); - verify(mStatusBarKeyguardViewManager, never()).showBouncer(anyBoolean()); + verify(mStatusBarKeyguardViewManager, never()).showPrimaryBouncer(anyBoolean()); // WHEN udpfs fails the third time mBiometricUnlockController.onBiometricAuthFailed(BiometricSourceType.FINGERPRINT); // THEN show the bouncer - verify(mStatusBarKeyguardViewManager).showBouncer(true); + verify(mStatusBarKeyguardViewManager).showPrimaryBouncer(true); } @Test diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java index ab209d130b2f..d3b541899635 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/KeyguardBouncerTest.java @@ -58,7 +58,7 @@ import com.android.systemui.SysuiTestCase; import com.android.systemui.classifier.FalsingCollector; import com.android.systemui.keyguard.DismissCallbackRegistry; import com.android.systemui.plugins.ActivityStarter.OnDismissAction; -import com.android.systemui.statusbar.phone.KeyguardBouncer.BouncerExpansionCallback; +import com.android.systemui.statusbar.phone.KeyguardBouncer.PrimaryBouncerExpansionCallback; import com.android.systemui.statusbar.policy.KeyguardStateController; import org.junit.Assert; @@ -86,7 +86,7 @@ public class KeyguardBouncerTest extends SysuiTestCase { @Mock private KeyguardHostViewController mKeyguardHostViewController; @Mock - private BouncerExpansionCallback mExpansionCallback; + private KeyguardBouncer.PrimaryBouncerExpansionCallback mExpansionCallback; @Mock private KeyguardUpdateMonitor mKeyguardUpdateMonitor; @Mock @@ -476,7 +476,8 @@ public class KeyguardBouncerTest extends SysuiTestCase { mBouncer.ensureView(); mBouncer.setExpansion(0.5f); - final BouncerExpansionCallback callback = mock(BouncerExpansionCallback.class); + final PrimaryBouncerExpansionCallback callback = + mock(PrimaryBouncerExpansionCallback.class); mBouncer.addBouncerExpansionCallback(callback); mBouncer.setExpansion(EXPANSION_HIDDEN); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java index 696775a24074..df48e1d43584 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/ScrimControllerTest.java @@ -1308,7 +1308,7 @@ public class ScrimControllerTest extends SysuiTestCase { @Test public void qsExpansion_BehindTint_shadeLocked_bouncerActive_usesBouncerProgress() { - when(mStatusBarKeyguardViewManager.isBouncerInTransit()).thenReturn(true); + when(mStatusBarKeyguardViewManager.isPrimaryBouncerInTransit()).thenReturn(true); // clipping doesn't change tested logic but allows to assert scrims more in line with // their expected large screen behaviour mScrimController.setClipsQsScrim(false); @@ -1324,7 +1324,7 @@ public class ScrimControllerTest extends SysuiTestCase { @Test public void expansionNotificationAlpha_shadeLocked_bouncerActive_usesBouncerInterpolator() { - when(mStatusBarKeyguardViewManager.isBouncerInTransit()).thenReturn(true); + when(mStatusBarKeyguardViewManager.isPrimaryBouncerInTransit()).thenReturn(true); mScrimController.transitionTo(SHADE_LOCKED); @@ -1340,7 +1340,7 @@ public class ScrimControllerTest extends SysuiTestCase { @Test public void expansionNotificationAlpha_shadeLocked_bouncerNotActive_usesShadeInterpolator() { - when(mStatusBarKeyguardViewManager.isBouncerInTransit()).thenReturn(false); + when(mStatusBarKeyguardViewManager.isPrimaryBouncerInTransit()).thenReturn(false); mScrimController.transitionTo(SHADE_LOCKED); @@ -1355,7 +1355,7 @@ public class ScrimControllerTest extends SysuiTestCase { @Test public void notificationAlpha_unnocclusionAnimating_bouncerActive_usesKeyguardNotifAlpha() { - when(mStatusBarKeyguardViewManager.isBouncerInTransit()).thenReturn(true); + when(mStatusBarKeyguardViewManager.isPrimaryBouncerInTransit()).thenReturn(true); mScrimController.setClipsQsScrim(true); mScrimController.transitionTo(ScrimState.KEYGUARD); @@ -1377,7 +1377,7 @@ public class ScrimControllerTest extends SysuiTestCase { @Test public void notificationAlpha_unnocclusionAnimating_bouncerNotActive_usesKeyguardNotifAlpha() { - when(mStatusBarKeyguardViewManager.isBouncerInTransit()).thenReturn(false); + when(mStatusBarKeyguardViewManager.isPrimaryBouncerInTransit()).thenReturn(false); mScrimController.transitionTo(ScrimState.KEYGUARD); mScrimController.setUnocclusionAnimationRunning(true); @@ -1398,7 +1398,7 @@ public class ScrimControllerTest extends SysuiTestCase { @Test public void notificationAlpha_inKeyguardState_bouncerActive_usesInvertedBouncerInterpolator() { - when(mStatusBarKeyguardViewManager.isBouncerInTransit()).thenReturn(true); + when(mStatusBarKeyguardViewManager.isPrimaryBouncerInTransit()).thenReturn(true); mScrimController.setClipsQsScrim(true); mScrimController.transitionTo(ScrimState.KEYGUARD); @@ -1418,7 +1418,7 @@ public class ScrimControllerTest extends SysuiTestCase { @Test public void notificationAlpha_inKeyguardState_bouncerNotActive_usesInvertedShadeInterpolator() { - when(mStatusBarKeyguardViewManager.isBouncerInTransit()).thenReturn(false); + when(mStatusBarKeyguardViewManager.isPrimaryBouncerInTransit()).thenReturn(false); mScrimController.setClipsQsScrim(true); mScrimController.transitionTo(ScrimState.KEYGUARD); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java index ec8d71136452..49c3a2128bd7 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManagerTest.java @@ -56,8 +56,8 @@ import com.android.systemui.dreams.DreamOverlayStateController; import com.android.systemui.flags.FeatureFlags; import com.android.systemui.keyguard.data.BouncerView; import com.android.systemui.keyguard.data.BouncerViewDelegate; -import com.android.systemui.keyguard.domain.interactor.BouncerCallbackInteractor; -import com.android.systemui.keyguard.domain.interactor.BouncerInteractor; +import com.android.systemui.keyguard.domain.interactor.PrimaryBouncerCallbackInteractor; +import com.android.systemui.keyguard.domain.interactor.PrimaryBouncerInteractor; import com.android.systemui.navigationbar.NavigationModeController; import com.android.systemui.plugins.ActivityStarter.OnDismissAction; import com.android.systemui.shade.NotificationPanelViewController; @@ -105,8 +105,8 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { @Mock private KeyguardBouncer.Factory mKeyguardBouncerFactory; @Mock private KeyguardMessageAreaController.Factory mKeyguardMessageAreaFactory; @Mock private KeyguardMessageAreaController mKeyguardMessageAreaController; - @Mock private KeyguardBouncer mBouncer; - @Mock private StatusBarKeyguardViewManager.AlternateAuthInterceptor mAlternateAuthInterceptor; + @Mock private KeyguardBouncer mPrimaryBouncer; + @Mock private StatusBarKeyguardViewManager.AlternateBouncer mAlternateBouncer; @Mock private KeyguardMessageArea mKeyguardMessageArea; @Mock private ShadeController mShadeController; @Mock private SysUIUnfoldComponent mSysUiUnfoldComponent; @@ -114,13 +114,13 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { @Mock private LatencyTracker mLatencyTracker; @Mock private FeatureFlags mFeatureFlags; @Mock private KeyguardSecurityModel mKeyguardSecurityModel; - @Mock private BouncerCallbackInteractor mBouncerCallbackInteractor; - @Mock private BouncerInteractor mBouncerInteractor; + @Mock private PrimaryBouncerCallbackInteractor mPrimaryBouncerCallbackInteractor; + @Mock private PrimaryBouncerInteractor mPrimaryBouncerInteractor; @Mock private BouncerView mBouncerView; @Mock private BouncerViewDelegate mBouncerViewDelegate; private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager; - private KeyguardBouncer.BouncerExpansionCallback mBouncerExpansionCallback; + private KeyguardBouncer.PrimaryBouncerExpansionCallback mBouncerExpansionCallback; private FakeKeyguardStateController mKeyguardStateController = spy(new FakeKeyguardStateController()); @@ -134,8 +134,9 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { public void setUp() { MockitoAnnotations.initMocks(this); when(mKeyguardBouncerFactory.create( - any(ViewGroup.class), any(KeyguardBouncer.BouncerExpansionCallback.class))) - .thenReturn(mBouncer); + any(ViewGroup.class), + any(KeyguardBouncer.PrimaryBouncerExpansionCallback.class))) + .thenReturn(mPrimaryBouncer); when(mCentralSurfaces.getBouncerContainer()).thenReturn(mContainer); when(mContainer.findViewById(anyInt())).thenReturn(mKeyguardMessageArea); when(mKeyguardMessageAreaFactory.create(any(KeyguardMessageArea.class))) @@ -163,8 +164,8 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { mLatencyTracker, mKeyguardSecurityModel, mFeatureFlags, - mBouncerCallbackInteractor, - mBouncerInteractor, + mPrimaryBouncerCallbackInteractor, + mPrimaryBouncerInteractor, mBouncerView) { @Override public ViewRootImpl getViewRootImpl() { @@ -181,8 +182,8 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { mNotificationContainer, mBypassController); mStatusBarKeyguardViewManager.show(null); - ArgumentCaptor<KeyguardBouncer.BouncerExpansionCallback> callbackArgumentCaptor = - ArgumentCaptor.forClass(KeyguardBouncer.BouncerExpansionCallback.class); + ArgumentCaptor<KeyguardBouncer.PrimaryBouncerExpansionCallback> callbackArgumentCaptor = + ArgumentCaptor.forClass(KeyguardBouncer.PrimaryBouncerExpansionCallback.class); verify(mKeyguardBouncerFactory).create(any(ViewGroup.class), callbackArgumentCaptor.capture()); mBouncerExpansionCallback = callbackArgumentCaptor.getValue(); @@ -194,86 +195,86 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { Runnable cancelAction = () -> {}; mStatusBarKeyguardViewManager.dismissWithAction( action, cancelAction, false /* afterKeyguardGone */); - verify(mBouncer).showWithDismissAction(eq(action), eq(cancelAction)); + verify(mPrimaryBouncer).showWithDismissAction(eq(action), eq(cancelAction)); } @Test public void showBouncer_onlyWhenShowing() { mStatusBarKeyguardViewManager.hide(0 /* startTime */, 0 /* fadeoutDuration */); - mStatusBarKeyguardViewManager.showBouncer(true /* scrimmed */); - verify(mBouncer, never()).show(anyBoolean(), anyBoolean()); - verify(mBouncer, never()).show(anyBoolean()); + mStatusBarKeyguardViewManager.showPrimaryBouncer(true /* scrimmed */); + verify(mPrimaryBouncer, never()).show(anyBoolean(), anyBoolean()); + verify(mPrimaryBouncer, never()).show(anyBoolean()); } @Test public void showBouncer_notWhenBouncerAlreadyShowing() { mStatusBarKeyguardViewManager.hide(0 /* startTime */, 0 /* fadeoutDuration */); - when(mBouncer.isSecure()).thenReturn(true); - mStatusBarKeyguardViewManager.showBouncer(true /* scrimmed */); - verify(mBouncer, never()).show(anyBoolean(), anyBoolean()); - verify(mBouncer, never()).show(anyBoolean()); + when(mPrimaryBouncer.isSecure()).thenReturn(true); + mStatusBarKeyguardViewManager.showPrimaryBouncer(true /* scrimmed */); + verify(mPrimaryBouncer, never()).show(anyBoolean(), anyBoolean()); + verify(mPrimaryBouncer, never()).show(anyBoolean()); } @Test public void showBouncer_showsTheBouncer() { - mStatusBarKeyguardViewManager.showBouncer(true /* scrimmed */); - verify(mBouncer).show(anyBoolean(), eq(true)); + mStatusBarKeyguardViewManager.showPrimaryBouncer(true /* scrimmed */); + verify(mPrimaryBouncer).show(anyBoolean(), eq(true)); } @Test public void onPanelExpansionChanged_neverHidesScrimmedBouncer() { - when(mBouncer.isShowing()).thenReturn(true); - when(mBouncer.isScrimmed()).thenReturn(true); + when(mPrimaryBouncer.isShowing()).thenReturn(true); + when(mPrimaryBouncer.isScrimmed()).thenReturn(true); mStatusBarKeyguardViewManager.onPanelExpansionChanged(EXPANSION_EVENT); - verify(mBouncer).setExpansion(eq(KeyguardBouncer.EXPANSION_VISIBLE)); + verify(mPrimaryBouncer).setExpansion(eq(KeyguardBouncer.EXPANSION_VISIBLE)); } @Test public void onPanelExpansionChanged_neverShowsDuringHintAnimation() { when(mNotificationPanelView.isUnlockHintRunning()).thenReturn(true); mStatusBarKeyguardViewManager.onPanelExpansionChanged(EXPANSION_EVENT); - verify(mBouncer).setExpansion(eq(KeyguardBouncer.EXPANSION_HIDDEN)); + verify(mPrimaryBouncer).setExpansion(eq(KeyguardBouncer.EXPANSION_HIDDEN)); } @Test public void onPanelExpansionChanged_propagatesToBouncer() { mStatusBarKeyguardViewManager.onPanelExpansionChanged(EXPANSION_EVENT); - verify(mBouncer).setExpansion(eq(0.5f)); + verify(mPrimaryBouncer).setExpansion(eq(0.5f)); } @Test public void onPanelExpansionChanged_hideBouncer_afterKeyguardHidden() { mStatusBarKeyguardViewManager.hide(0, 0); - when(mBouncer.inTransit()).thenReturn(true); + when(mPrimaryBouncer.inTransit()).thenReturn(true); mStatusBarKeyguardViewManager.onPanelExpansionChanged(EXPANSION_EVENT); - verify(mBouncer).setExpansion(eq(KeyguardBouncer.EXPANSION_HIDDEN)); + verify(mPrimaryBouncer).setExpansion(eq(KeyguardBouncer.EXPANSION_HIDDEN)); } @Test public void onPanelExpansionChanged_showsBouncerWhenSwiping() { mKeyguardStateController.setCanDismissLockScreen(false); mStatusBarKeyguardViewManager.onPanelExpansionChanged(EXPANSION_EVENT); - verify(mBouncer).show(eq(false), eq(false)); + verify(mPrimaryBouncer).show(eq(false), eq(false)); // But not when it's already visible - reset(mBouncer); - when(mBouncer.isShowing()).thenReturn(true); + reset(mPrimaryBouncer); + when(mPrimaryBouncer.isShowing()).thenReturn(true); mStatusBarKeyguardViewManager.onPanelExpansionChanged(EXPANSION_EVENT); - verify(mBouncer, never()).show(eq(false), eq(false)); + verify(mPrimaryBouncer, never()).show(eq(false), eq(false)); // Or animating away - reset(mBouncer); - when(mBouncer.isAnimatingAway()).thenReturn(true); + reset(mPrimaryBouncer); + when(mPrimaryBouncer.isAnimatingAway()).thenReturn(true); mStatusBarKeyguardViewManager.onPanelExpansionChanged(EXPANSION_EVENT); - verify(mBouncer, never()).show(eq(false), eq(false)); + verify(mPrimaryBouncer, never()).show(eq(false), eq(false)); } @Test public void onPanelExpansionChanged_neverTranslatesBouncerWhenOccluded() { mStatusBarKeyguardViewManager.setOccluded(true /* occluded */, false /* animate */); mStatusBarKeyguardViewManager.onPanelExpansionChanged(EXPANSION_EVENT); - verify(mBouncer, never()).setExpansion(eq(0.5f)); + verify(mPrimaryBouncer, never()).setExpansion(eq(0.5f)); } @Test @@ -285,7 +286,7 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { /* fraction= */ KeyguardBouncer.EXPANSION_VISIBLE, /* expanded= */ true, /* tracking= */ false)); - verify(mBouncer, never()).setExpansion(anyFloat()); + verify(mPrimaryBouncer, never()).setExpansion(anyFloat()); } @Test @@ -302,7 +303,7 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { /* fraction= */ KeyguardBouncer.EXPANSION_VISIBLE, /* expanded= */ true, /* tracking= */ false)); - verify(mBouncer, never()).setExpansion(anyFloat()); + verify(mPrimaryBouncer, never()).setExpansion(anyFloat()); } @Test @@ -313,7 +314,7 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { /* fraction= */ KeyguardBouncer.EXPANSION_VISIBLE, /* expanded= */ true, /* tracking= */ false)); - verify(mBouncer, never()).setExpansion(anyFloat()); + verify(mPrimaryBouncer, never()).setExpansion(anyFloat()); } @Test @@ -321,7 +322,7 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { mStatusBarKeyguardViewManager.setOccluded(false /* occluded */, true /* animated */); verify(mCentralSurfaces).animateKeyguardUnoccluding(); - when(mBouncer.isShowing()).thenReturn(true); + when(mPrimaryBouncer.isShowing()).thenReturn(true); clearInvocations(mCentralSurfaces); mStatusBarKeyguardViewManager.setOccluded(false /* occluded */, true /* animated */); verify(mCentralSurfaces, never()).animateKeyguardUnoccluding(); @@ -372,7 +373,7 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { mStatusBarKeyguardViewManager.dismissWithAction( action, cancelAction, true /* afterKeyguardGone */); - when(mBouncer.isShowing()).thenReturn(false); + when(mPrimaryBouncer.isShowing()).thenReturn(false); mStatusBarKeyguardViewManager.hideBouncer(true); mStatusBarKeyguardViewManager.hide(0, 30); verify(action, never()).onDismiss(); @@ -386,7 +387,7 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { mStatusBarKeyguardViewManager.dismissWithAction( action, cancelAction, true /* afterKeyguardGone */); - when(mBouncer.isShowing()).thenReturn(false); + when(mPrimaryBouncer.isShowing()).thenReturn(false); mStatusBarKeyguardViewManager.hideBouncer(true); verify(action, never()).onDismiss(); @@ -407,9 +408,9 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { @Test public void testShowing_whenAlternateAuthShowing() { - mStatusBarKeyguardViewManager.setAlternateAuthInterceptor(mAlternateAuthInterceptor); - when(mBouncer.isShowing()).thenReturn(false); - when(mAlternateAuthInterceptor.isShowingAlternateAuthBouncer()).thenReturn(true); + mStatusBarKeyguardViewManager.setAlternateBouncer(mAlternateBouncer); + when(mPrimaryBouncer.isShowing()).thenReturn(false); + when(mAlternateBouncer.isShowingAlternateBouncer()).thenReturn(true); assertTrue( "Is showing not accurate when alternative auth showing", mStatusBarKeyguardViewManager.isBouncerShowing()); @@ -417,93 +418,93 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { @Test public void testWillBeShowing_whenAlternateAuthShowing() { - mStatusBarKeyguardViewManager.setAlternateAuthInterceptor(mAlternateAuthInterceptor); - when(mBouncer.isShowing()).thenReturn(false); - when(mAlternateAuthInterceptor.isShowingAlternateAuthBouncer()).thenReturn(true); + mStatusBarKeyguardViewManager.setAlternateBouncer(mAlternateBouncer); + when(mPrimaryBouncer.isShowing()).thenReturn(false); + when(mAlternateBouncer.isShowingAlternateBouncer()).thenReturn(true); assertTrue( "Is or will be showing not accurate when alternative auth showing", - mStatusBarKeyguardViewManager.bouncerIsOrWillBeShowing()); + mStatusBarKeyguardViewManager.primaryBouncerIsOrWillBeShowing()); } @Test - public void testHideAltAuth_onShowBouncer() { + public void testHideAlternateBouncer_onShowBouncer() { // GIVEN alt auth is showing - mStatusBarKeyguardViewManager.setAlternateAuthInterceptor(mAlternateAuthInterceptor); - when(mBouncer.isShowing()).thenReturn(false); - when(mAlternateAuthInterceptor.isShowingAlternateAuthBouncer()).thenReturn(true); - reset(mAlternateAuthInterceptor); + mStatusBarKeyguardViewManager.setAlternateBouncer(mAlternateBouncer); + when(mPrimaryBouncer.isShowing()).thenReturn(false); + when(mAlternateBouncer.isShowingAlternateBouncer()).thenReturn(true); + reset(mAlternateBouncer); // WHEN showBouncer is called - mStatusBarKeyguardViewManager.showBouncer(true); + mStatusBarKeyguardViewManager.showPrimaryBouncer(true); // THEN alt bouncer should be hidden - verify(mAlternateAuthInterceptor).hideAlternateAuthBouncer(); + verify(mAlternateBouncer).hideAlternateBouncer(); } @Test public void testBouncerIsOrWillBeShowing_whenBouncerIsInTransit() { - when(mBouncer.isShowing()).thenReturn(false); - when(mBouncer.inTransit()).thenReturn(true); + when(mPrimaryBouncer.isShowing()).thenReturn(false); + when(mPrimaryBouncer.inTransit()).thenReturn(true); assertTrue( "Is or will be showing should be true when bouncer is in transit", - mStatusBarKeyguardViewManager.bouncerIsOrWillBeShowing()); + mStatusBarKeyguardViewManager.primaryBouncerIsOrWillBeShowing()); } @Test public void testShowAltAuth_unlockingWithBiometricNotAllowed() { // GIVEN alt auth exists, unlocking with biometric isn't allowed - mStatusBarKeyguardViewManager.setAlternateAuthInterceptor(mAlternateAuthInterceptor); - when(mBouncer.isShowing()).thenReturn(false); + mStatusBarKeyguardViewManager.setAlternateBouncer(mAlternateBouncer); + when(mPrimaryBouncer.isShowing()).thenReturn(false); when(mKeyguardUpdateMonitor.isUnlockingWithBiometricAllowed(anyBoolean())) .thenReturn(false); // WHEN showGenericBouncer is called final boolean scrimmed = true; - mStatusBarKeyguardViewManager.showGenericBouncer(scrimmed); + mStatusBarKeyguardViewManager.showBouncer(scrimmed); // THEN regular bouncer is shown - verify(mBouncer).show(anyBoolean(), eq(scrimmed)); - verify(mAlternateAuthInterceptor, never()).showAlternateAuthBouncer(); + verify(mPrimaryBouncer).show(anyBoolean(), eq(scrimmed)); + verify(mAlternateBouncer, never()).showAlternateBouncer(); } @Test - public void testShowAltAuth_unlockingWithBiometricAllowed() { + public void testShowAlternateBouncer_unlockingWithBiometricAllowed() { // GIVEN alt auth exists, unlocking with biometric is allowed - mStatusBarKeyguardViewManager.setAlternateAuthInterceptor(mAlternateAuthInterceptor); - when(mBouncer.isShowing()).thenReturn(false); + mStatusBarKeyguardViewManager.setAlternateBouncer(mAlternateBouncer); + when(mPrimaryBouncer.isShowing()).thenReturn(false); when(mKeyguardUpdateMonitor.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(true); // WHEN showGenericBouncer is called - mStatusBarKeyguardViewManager.showGenericBouncer(true); + mStatusBarKeyguardViewManager.showBouncer(true); // THEN alt auth bouncer is shown - verify(mAlternateAuthInterceptor).showAlternateAuthBouncer(); - verify(mBouncer, never()).show(anyBoolean(), anyBoolean()); + verify(mAlternateBouncer).showAlternateBouncer(); + verify(mPrimaryBouncer, never()).show(anyBoolean(), anyBoolean()); } @Test public void testUpdateResources_delegatesToBouncer() { mStatusBarKeyguardViewManager.updateResources(); - verify(mBouncer).updateResources(); + verify(mPrimaryBouncer).updateResources(); } @Test public void updateKeyguardPosition_delegatesToBouncer() { mStatusBarKeyguardViewManager.updateKeyguardPosition(1.0f); - verify(mBouncer).updateKeyguardPosition(1.0f); + verify(mPrimaryBouncer).updateKeyguardPosition(1.0f); } @Test public void testIsBouncerInTransit() { - when(mBouncer.inTransit()).thenReturn(true); - Truth.assertThat(mStatusBarKeyguardViewManager.isBouncerInTransit()).isTrue(); - when(mBouncer.inTransit()).thenReturn(false); - Truth.assertThat(mStatusBarKeyguardViewManager.isBouncerInTransit()).isFalse(); - mBouncer = null; - Truth.assertThat(mStatusBarKeyguardViewManager.isBouncerInTransit()).isFalse(); + when(mPrimaryBouncer.inTransit()).thenReturn(true); + Truth.assertThat(mStatusBarKeyguardViewManager.isPrimaryBouncerInTransit()).isTrue(); + when(mPrimaryBouncer.inTransit()).thenReturn(false); + Truth.assertThat(mStatusBarKeyguardViewManager.isPrimaryBouncerInTransit()).isFalse(); + mPrimaryBouncer = null; + Truth.assertThat(mStatusBarKeyguardViewManager.isPrimaryBouncerInTransit()).isFalse(); } private static ShadeExpansionChangeEvent expansionEvent( @@ -534,7 +535,7 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { eq(OnBackInvokedDispatcher.PRIORITY_OVERLAY), mOnBackInvokedCallback.capture()); - when(mBouncer.isShowing()).thenReturn(true); + when(mPrimaryBouncer.isShowing()).thenReturn(true); when(mCentralSurfaces.shouldKeyguardHideImmediately()).thenReturn(true); /* invoke the back callback directly */ mOnBackInvokedCallback.getValue().onBackInvoked(); @@ -567,6 +568,6 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase { public void flag_off_DoesNotCallBouncerInteractor() { when(mFeatureFlags.isEnabled(MODERN_BOUNCER)).thenReturn(false); mStatusBarKeyguardViewManager.hideBouncer(false); - verify(mBouncerInteractor, never()).hide(); + verify(mPrimaryBouncerInteractor, never()).hide(); } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java index c3a7e65f4697..613238f7752e 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/StatusBarRemoteInputCallbackTest.java @@ -99,6 +99,6 @@ public class StatusBarRemoteInputCallbackTest extends SysuiTestCase { mRemoteInputCallback.onLockedRemoteInput( mock(ExpandableNotificationRow.class), mock(View.class)); - verify(mStatusBarKeyguardViewManager).showGenericBouncer(true); + verify(mStatusBarKeyguardViewManager).showBouncer(true); } }
\ No newline at end of file |