Merge "DO NOT MERGE Use KeyguardStateController for #isShowing" into tm-qpr-dev

This commit is contained in:
Beverly Tai
2022-10-12 19:51:13 +00:00
committed by Android (Google) Code Review
22 changed files with 275 additions and 182 deletions

View File

@@ -3178,14 +3178,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
* Whether the keyguard is showing and not occluded. * Whether the keyguard is showing and not occluded.
*/ */
public boolean isKeyguardVisible() { public boolean isKeyguardVisible() {
return isKeyguardShowing() && !mKeyguardOccluded; return mKeyguardShowing && !mKeyguardOccluded;
}
/**
* Whether the keyguard is showing. It may still be occluded and not visible.
*/
public boolean isKeyguardShowing() {
return mKeyguardShowing;
} }
/** /**

View File

@@ -93,11 +93,6 @@ public interface KeyguardViewController {
*/ */
void setOccluded(boolean occluded, boolean animate); void setOccluded(boolean occluded, boolean animate);
/**
* @return Whether the keyguard is showing
*/
boolean isShowing();
/** /**
* Dismisses the keyguard by going to the next screen or making it gone. * Dismisses the keyguard by going to the next screen or making it gone.
*/ */

View File

@@ -219,7 +219,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
mView.animateInUdfpsBouncer(null); mView.animateInUdfpsBouncer(null);
} }
if (mKeyguardViewManager.isOccluded()) { if (mKeyguardStateController.isOccluded()) {
mKeyguardUpdateMonitor.requestFaceAuthOnOccludingApp(true); mKeyguardUpdateMonitor.requestFaceAuthOnOccludingApp(true);
} }

View File

@@ -666,7 +666,7 @@ class KeyguardUnlockAnimationController @Inject constructor(
return return
} }
if (keyguardViewController.isShowing && !playingCannedUnlockAnimation) { if (keyguardStateController.isShowing && !playingCannedUnlockAnimation) {
showOrHideSurfaceIfDismissAmountThresholdsReached() showOrHideSurfaceIfDismissAmountThresholdsReached()
// If the surface is visible or it's about to be, start updating its appearance to // If the surface is visible or it's about to be, start updating its appearance to
@@ -726,7 +726,7 @@ class KeyguardUnlockAnimationController @Inject constructor(
private fun finishKeyguardExitRemoteAnimationIfReachThreshold() { private fun finishKeyguardExitRemoteAnimationIfReachThreshold() {
// no-op if keyguard is not showing or animation is not enabled. // no-op if keyguard is not showing or animation is not enabled.
if (!KeyguardService.sEnableRemoteKeyguardGoingAwayAnimation || if (!KeyguardService.sEnableRemoteKeyguardGoingAwayAnimation ||
!keyguardViewController.isShowing) { !keyguardStateController.isShowing) {
return return
} }
@@ -849,7 +849,7 @@ class KeyguardUnlockAnimationController @Inject constructor(
* animation. * animation.
*/ */
fun hideKeyguardViewAfterRemoteAnimation() { fun hideKeyguardViewAfterRemoteAnimation() {
if (keyguardViewController.isShowing) { if (keyguardStateController.isShowing) {
// Hide the keyguard, with no fade out since we animated it away during the unlock. // Hide the keyguard, with no fade out since we animated it away during the unlock.
keyguardViewController.hide( keyguardViewController.hide(

View File

@@ -1881,7 +1881,7 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
// if the keyguard is already showing, don't bother. check flags in both files // if the keyguard is already showing, don't bother. check flags in both files
// to account for the hiding animation which results in a delay and discrepancy // to account for the hiding animation which results in a delay and discrepancy
// between flags // between flags
if (mShowing && mKeyguardViewControllerLazy.get().isShowing()) { if (mShowing && mKeyguardStateController.isShowing()) {
if (DEBUG) Log.d(TAG, "doKeyguard: not showing because it is already showing"); if (DEBUG) Log.d(TAG, "doKeyguard: not showing because it is already showing");
resetStateLocked(); resetStateLocked();
return; return;

View File

@@ -48,7 +48,6 @@ import android.view.accessibility.AccessibilityManager;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import com.android.keyguard.KeyguardViewController;
import com.android.systemui.Dumpable; import com.android.systemui.Dumpable;
import com.android.systemui.accessibility.AccessibilityButtonModeObserver; import com.android.systemui.accessibility.AccessibilityButtonModeObserver;
import com.android.systemui.accessibility.AccessibilityButtonTargetsObserver; import com.android.systemui.accessibility.AccessibilityButtonTargetsObserver;
@@ -61,6 +60,7 @@ import com.android.systemui.settings.UserTracker;
import com.android.systemui.shared.system.QuickStepContract; import com.android.systemui.shared.system.QuickStepContract;
import com.android.systemui.statusbar.phone.BarTransitions.TransitionMode; import com.android.systemui.statusbar.phone.BarTransitions.TransitionMode;
import com.android.systemui.statusbar.phone.CentralSurfaces; import com.android.systemui.statusbar.phone.CentralSurfaces;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.ArrayList; import java.util.ArrayList;
@@ -90,7 +90,7 @@ public final class NavBarHelper implements
private final AccessibilityManager mAccessibilityManager; private final AccessibilityManager mAccessibilityManager;
private final Lazy<AssistManager> mAssistManagerLazy; private final Lazy<AssistManager> mAssistManagerLazy;
private final Lazy<Optional<CentralSurfaces>> mCentralSurfacesOptionalLazy; private final Lazy<Optional<CentralSurfaces>> mCentralSurfacesOptionalLazy;
private final KeyguardViewController mKeyguardViewController; private final KeyguardStateController mKeyguardStateController;
private final UserTracker mUserTracker; private final UserTracker mUserTracker;
private final SystemActions mSystemActions; private final SystemActions mSystemActions;
private final AccessibilityButtonModeObserver mAccessibilityButtonModeObserver; private final AccessibilityButtonModeObserver mAccessibilityButtonModeObserver;
@@ -125,7 +125,7 @@ public final class NavBarHelper implements
OverviewProxyService overviewProxyService, OverviewProxyService overviewProxyService,
Lazy<AssistManager> assistManagerLazy, Lazy<AssistManager> assistManagerLazy,
Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy, Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy,
KeyguardViewController keyguardViewController, KeyguardStateController keyguardStateController,
NavigationModeController navigationModeController, NavigationModeController navigationModeController,
UserTracker userTracker, UserTracker userTracker,
DumpManager dumpManager) { DumpManager dumpManager) {
@@ -134,7 +134,7 @@ public final class NavBarHelper implements
mAccessibilityManager = accessibilityManager; mAccessibilityManager = accessibilityManager;
mAssistManagerLazy = assistManagerLazy; mAssistManagerLazy = assistManagerLazy;
mCentralSurfacesOptionalLazy = centralSurfacesOptionalLazy; mCentralSurfacesOptionalLazy = centralSurfacesOptionalLazy;
mKeyguardViewController = keyguardViewController; mKeyguardStateController = keyguardStateController;
mUserTracker = userTracker; mUserTracker = userTracker;
mSystemActions = systemActions; mSystemActions = systemActions;
accessibilityManager.addAccessibilityServicesStateChangeListener(this); accessibilityManager.addAccessibilityServicesStateChangeListener(this);
@@ -326,7 +326,7 @@ public final class NavBarHelper implements
shadeWindowView = shadeWindowView =
mCentralSurfacesOptionalLazy.get().get().getNotificationShadeWindowView(); mCentralSurfacesOptionalLazy.get().get().getNotificationShadeWindowView();
} }
boolean isKeyguardShowing = mKeyguardViewController.isShowing(); boolean isKeyguardShowing = mKeyguardStateController.isShowing();
boolean imeVisibleOnShade = shadeWindowView != null && shadeWindowView.isAttachedToWindow() boolean imeVisibleOnShade = shadeWindowView != null && shadeWindowView.isAttachedToWindow()
&& shadeWindowView.getRootWindowInsets().isVisible(WindowInsets.Type.ime()); && shadeWindowView.getRootWindowInsets().isVisible(WindowInsets.Type.ime());
return imeVisibleOnShade return imeVisibleOnShade

View File

@@ -4289,7 +4289,7 @@ public final class NotificationPanelViewController extends PanelViewController {
} }
if (event.getActionMasked() == MotionEvent.ACTION_DOWN && isFullyExpanded() if (event.getActionMasked() == MotionEvent.ACTION_DOWN && isFullyExpanded()
&& mStatusBarKeyguardViewManager.isShowing()) { && mKeyguardStateController.isShowing()) {
mStatusBarKeyguardViewManager.updateKeyguardPosition(event.getX()); mStatusBarKeyguardViewManager.updateKeyguardPosition(event.getX());
} }

View File

@@ -16,7 +16,6 @@
package com.android.systemui.statusbar.notification; package com.android.systemui.statusbar.notification;
import android.annotation.Nullable;
import android.util.ArraySet; import android.util.ArraySet;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
@@ -25,7 +24,6 @@ import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.NotificationLockscreenUserManager;
import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.statusbar.policy.KeyguardStateController;
import javax.inject.Inject; import javax.inject.Inject;
@@ -43,7 +41,6 @@ public class DynamicPrivacyController implements KeyguardStateController.Callbac
private boolean mLastDynamicUnlocked; private boolean mLastDynamicUnlocked;
private boolean mCacheInvalid; private boolean mCacheInvalid;
@Nullable private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
@Inject @Inject
DynamicPrivacyController(NotificationLockscreenUserManager notificationLockscreenUserManager, DynamicPrivacyController(NotificationLockscreenUserManager notificationLockscreenUserManager,
@@ -100,7 +97,7 @@ public class DynamicPrivacyController implements KeyguardStateController.Callbac
* contents aren't revealed yet? * contents aren't revealed yet?
*/ */
public boolean isInLockedDownShade() { public boolean isInLockedDownShade() {
if (!isStatusBarKeyguardShowing() || !mKeyguardStateController.isMethodSecure()) { if (!mKeyguardStateController.isShowing() || !mKeyguardStateController.isMethodSecure()) {
return false; return false;
} }
int state = mStateController.getState(); int state = mStateController.getState();
@@ -113,15 +110,6 @@ public class DynamicPrivacyController implements KeyguardStateController.Callbac
return true; return true;
} }
private boolean isStatusBarKeyguardShowing() {
return mStatusBarKeyguardViewManager != null && mStatusBarKeyguardViewManager.isShowing();
}
public void setStatusBarKeyguardViewManager(
StatusBarKeyguardViewManager statusBarKeyguardViewManager) {
mStatusBarKeyguardViewManager = statusBarKeyguardViewManager;
}
public interface Listener { public interface Listener {
void onDynamicPrivacyChanged(); void onDynamicPrivacyChanged();
} }

View File

@@ -163,7 +163,6 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
private PowerManager.WakeLock mWakeLock; private PowerManager.WakeLock mWakeLock;
private final com.android.systemui.shade.ShadeController mShadeController; private final com.android.systemui.shade.ShadeController mShadeController;
private final KeyguardUpdateMonitor mUpdateMonitor; private final KeyguardUpdateMonitor mUpdateMonitor;
private final DozeParameters mDozeParameters;
private final KeyguardStateController mKeyguardStateController; private final KeyguardStateController mKeyguardStateController;
private final NotificationShadeWindowController mNotificationShadeWindowController; private final NotificationShadeWindowController mNotificationShadeWindowController;
private final SessionTracker mSessionTracker; private final SessionTracker mSessionTracker;
@@ -278,7 +277,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
KeyguardStateController keyguardStateController, Handler handler, KeyguardStateController keyguardStateController, Handler handler,
KeyguardUpdateMonitor keyguardUpdateMonitor, KeyguardUpdateMonitor keyguardUpdateMonitor,
@Main Resources resources, @Main Resources resources,
KeyguardBypassController keyguardBypassController, DozeParameters dozeParameters, KeyguardBypassController keyguardBypassController,
MetricsLogger metricsLogger, DumpManager dumpManager, MetricsLogger metricsLogger, DumpManager dumpManager,
PowerManager powerManager, PowerManager powerManager,
NotificationMediaManager notificationMediaManager, NotificationMediaManager notificationMediaManager,
@@ -294,7 +293,6 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
mPowerManager = powerManager; mPowerManager = powerManager;
mShadeController = shadeController; mShadeController = shadeController;
mUpdateMonitor = keyguardUpdateMonitor; mUpdateMonitor = keyguardUpdateMonitor;
mDozeParameters = dozeParameters;
mUpdateMonitor.registerCallback(this); mUpdateMonitor.registerCallback(this);
mMediaManager = notificationMediaManager; mMediaManager = notificationMediaManager;
mLatencyTracker = latencyTracker; mLatencyTracker = latencyTracker;
@@ -552,7 +550,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
boolean deviceDreaming = mUpdateMonitor.isDreaming(); boolean deviceDreaming = mUpdateMonitor.isDreaming();
if (!mUpdateMonitor.isDeviceInteractive()) { if (!mUpdateMonitor.isDeviceInteractive()) {
if (!mKeyguardViewController.isShowing() if (!mKeyguardStateController.isShowing()
&& !mScreenOffAnimationController.isKeyguardShowDelayed()) { && !mScreenOffAnimationController.isKeyguardShowDelayed()) {
if (mKeyguardStateController.isUnlocked()) { if (mKeyguardStateController.isUnlocked()) {
return MODE_WAKE_AND_UNLOCK; return MODE_WAKE_AND_UNLOCK;
@@ -569,7 +567,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
if (unlockingAllowed && deviceDreaming) { if (unlockingAllowed && deviceDreaming) {
return MODE_WAKE_AND_UNLOCK_FROM_DREAM; return MODE_WAKE_AND_UNLOCK_FROM_DREAM;
} }
if (mKeyguardViewController.isShowing()) { if (mKeyguardStateController.isShowing()) {
if (mKeyguardViewController.bouncerIsOrWillBeShowing() && unlockingAllowed) { if (mKeyguardViewController.bouncerIsOrWillBeShowing() && unlockingAllowed) {
return MODE_DISMISS_BOUNCER; return MODE_DISMISS_BOUNCER;
} else if (unlockingAllowed) { } else if (unlockingAllowed) {
@@ -588,7 +586,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
boolean bypass = mKeyguardBypassController.getBypassEnabled() boolean bypass = mKeyguardBypassController.getBypassEnabled()
|| mAuthController.isUdfpsFingerDown(); || mAuthController.isUdfpsFingerDown();
if (!mUpdateMonitor.isDeviceInteractive()) { if (!mUpdateMonitor.isDeviceInteractive()) {
if (!mKeyguardViewController.isShowing()) { if (!mKeyguardStateController.isShowing()) {
return bypass ? MODE_WAKE_AND_UNLOCK : MODE_ONLY_WAKE; return bypass ? MODE_WAKE_AND_UNLOCK : MODE_ONLY_WAKE;
} else if (!unlockingAllowed) { } else if (!unlockingAllowed) {
return bypass ? MODE_SHOW_BOUNCER : MODE_NONE; return bypass ? MODE_SHOW_BOUNCER : MODE_NONE;
@@ -612,7 +610,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
if (unlockingAllowed && mKeyguardStateController.isOccluded()) { if (unlockingAllowed && mKeyguardStateController.isOccluded()) {
return MODE_UNLOCK_COLLAPSING; return MODE_UNLOCK_COLLAPSING;
} }
if (mKeyguardViewController.isShowing()) { if (mKeyguardStateController.isShowing()) {
if ((mKeyguardViewController.bouncerIsOrWillBeShowing() if ((mKeyguardViewController.bouncerIsOrWillBeShowing()
|| mKeyguardBypassController.getAltBouncerShowing()) && unlockingAllowed) { || mKeyguardBypassController.getAltBouncerShowing()) && unlockingAllowed) {
return MODE_DISMISS_BOUNCER; return MODE_DISMISS_BOUNCER;

View File

@@ -363,7 +363,7 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba
mKeyguardUpdateMonitor.onCameraLaunched(); mKeyguardUpdateMonitor.onCameraLaunched();
} }
if (!mStatusBarKeyguardViewManager.isShowing()) { if (!mKeyguardStateController.isShowing()) {
final Intent cameraIntent = CameraIntents.getInsecureCameraIntent(mContext); final Intent cameraIntent = CameraIntents.getInsecureCameraIntent(mContext);
mCentralSurfaces.startActivityDismissingKeyguard(cameraIntent, mCentralSurfaces.startActivityDismissingKeyguard(cameraIntent,
false /* onlyProvisioned */, true /* dismissShade */, false /* onlyProvisioned */, true /* dismissShade */,
@@ -420,7 +420,7 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba
// TODO(b/169087248) Possibly add haptics here for emergency action. Currently disabled for // TODO(b/169087248) Possibly add haptics here for emergency action. Currently disabled for
// app-side haptic experimentation. // app-side haptic experimentation.
if (!mStatusBarKeyguardViewManager.isShowing()) { if (!mKeyguardStateController.isShowing()) {
mCentralSurfaces.startActivityDismissingKeyguard(emergencyIntent, mCentralSurfaces.startActivityDismissingKeyguard(emergencyIntent,
false /* onlyProvisioned */, true /* dismissShade */, false /* onlyProvisioned */, true /* dismissShade */,
true /* disallowEnterPictureInPictureWhileLaunching */, null /* callback */, 0, true /* disallowEnterPictureInPictureWhileLaunching */, null /* callback */, 0,

View File

@@ -476,7 +476,6 @@ public class CentralSurfacesImpl extends CoreStartable implements
private final KeyguardStateController mKeyguardStateController; private final KeyguardStateController mKeyguardStateController;
private final HeadsUpManagerPhone mHeadsUpManager; private final HeadsUpManagerPhone mHeadsUpManager;
private final StatusBarTouchableRegionManager mStatusBarTouchableRegionManager; private final StatusBarTouchableRegionManager mStatusBarTouchableRegionManager;
private final DynamicPrivacyController mDynamicPrivacyController;
private final FalsingCollector mFalsingCollector; private final FalsingCollector mFalsingCollector;
private final FalsingManager mFalsingManager; private final FalsingManager mFalsingManager;
private final BroadcastDispatcher mBroadcastDispatcher; private final BroadcastDispatcher mBroadcastDispatcher;
@@ -779,7 +778,6 @@ public class CentralSurfacesImpl extends CoreStartable implements
mHeadsUpManager = headsUpManagerPhone; mHeadsUpManager = headsUpManagerPhone;
mKeyguardIndicationController = keyguardIndicationController; mKeyguardIndicationController = keyguardIndicationController;
mStatusBarTouchableRegionManager = statusBarTouchableRegionManager; mStatusBarTouchableRegionManager = statusBarTouchableRegionManager;
mDynamicPrivacyController = dynamicPrivacyController;
mFalsingCollector = falsingCollector; mFalsingCollector = falsingCollector;
mFalsingManager = falsingManager; mFalsingManager = falsingManager;
mBroadcastDispatcher = broadcastDispatcher; mBroadcastDispatcher = broadcastDispatcher;
@@ -1570,7 +1568,6 @@ public class CentralSurfacesImpl extends CoreStartable implements
.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager); .setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
mBiometricUnlockController.setKeyguardViewController(mStatusBarKeyguardViewManager); mBiometricUnlockController.setKeyguardViewController(mStatusBarKeyguardViewManager);
mRemoteInputManager.addControllerCallback(mStatusBarKeyguardViewManager); mRemoteInputManager.addControllerCallback(mStatusBarKeyguardViewManager);
mDynamicPrivacyController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
mLightBarController.setBiometricUnlockController(mBiometricUnlockController); mLightBarController.setBiometricUnlockController(mBiometricUnlockController);
mMediaManager.setBiometricUnlockController(mBiometricUnlockController); mMediaManager.setBiometricUnlockController(mBiometricUnlockController);
@@ -2082,7 +2079,7 @@ public class CentralSurfacesImpl extends CoreStartable implements
// Trimming will happen later if Keyguard is showing - doing it here might cause a jank in // Trimming will happen later if Keyguard is showing - doing it here might cause a jank in
// the bouncer appear animation. // the bouncer appear animation.
if (!mStatusBarKeyguardViewManager.isShowing()) { if (!mKeyguardStateController.isShowing()) {
WindowManagerGlobal.getInstance().trimMemory(ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN); WindowManagerGlobal.getInstance().trimMemory(ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN);
} }
} }
@@ -2519,8 +2516,8 @@ public class CentralSurfacesImpl extends CoreStartable implements
}; };
// Do not deferKeyguard when occluded because, when keyguard is occluded, // Do not deferKeyguard when occluded because, when keyguard is occluded,
// we do not launch the activity until keyguard is done. // we do not launch the activity until keyguard is done.
boolean occluded = mStatusBarKeyguardViewManager.isShowing() boolean occluded = mKeyguardStateController.isShowing()
&& mStatusBarKeyguardViewManager.isOccluded(); && mKeyguardStateController.isOccluded();
boolean deferred = !occluded; boolean deferred = !occluded;
executeRunnableDismissingKeyguard(runnable, cancelRunnable, dismissShadeDirectly, executeRunnableDismissingKeyguard(runnable, cancelRunnable, dismissShadeDirectly,
willLaunchResolverActivity, deferred /* deferred */, animate); willLaunchResolverActivity, deferred /* deferred */, animate);
@@ -2590,8 +2587,8 @@ public class CentralSurfacesImpl extends CoreStartable implements
@Override @Override
public boolean onDismiss() { public boolean onDismiss() {
if (runnable != null) { if (runnable != null) {
if (mStatusBarKeyguardViewManager.isShowing() if (mKeyguardStateController.isShowing()
&& mStatusBarKeyguardViewManager.isOccluded()) { && mKeyguardStateController.isOccluded()) {
mStatusBarKeyguardViewManager.addAfterKeyguardGoneRunnable(runnable); mStatusBarKeyguardViewManager.addAfterKeyguardGoneRunnable(runnable);
} else { } else {
mMainExecutor.execute(runnable); mMainExecutor.execute(runnable);
@@ -2685,7 +2682,7 @@ public class CentralSurfacesImpl extends CoreStartable implements
private void executeWhenUnlocked(OnDismissAction action, boolean requiresShadeOpen, private void executeWhenUnlocked(OnDismissAction action, boolean requiresShadeOpen,
boolean afterKeyguardGone) { boolean afterKeyguardGone) {
if (mStatusBarKeyguardViewManager.isShowing() && requiresShadeOpen) { if (mKeyguardStateController.isShowing() && requiresShadeOpen) {
mStatusBarStateController.setLeaveOpenOnKeyguardHide(true); mStatusBarStateController.setLeaveOpenOnKeyguardHide(true);
} }
dismissKeyguardThenExecute(action, null /* cancelAction */, dismissKeyguardThenExecute(action, null /* cancelAction */,
@@ -2709,7 +2706,7 @@ public class CentralSurfacesImpl extends CoreStartable implements
mBiometricUnlockController.startWakeAndUnlock( mBiometricUnlockController.startWakeAndUnlock(
BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING); BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING);
} }
if (mStatusBarKeyguardViewManager.isShowing()) { if (mKeyguardStateController.isShowing()) {
mStatusBarKeyguardViewManager.dismissWithAction(action, cancelAction, mStatusBarKeyguardViewManager.dismissWithAction(action, cancelAction,
afterKeyguardGone); afterKeyguardGone);
} else { } else {
@@ -2845,8 +2842,8 @@ public class CentralSurfacesImpl extends CoreStartable implements
} }
private void logStateToEventlog() { private void logStateToEventlog() {
boolean isShowing = mStatusBarKeyguardViewManager.isShowing(); boolean isShowing = mKeyguardStateController.isShowing();
boolean isOccluded = mStatusBarKeyguardViewManager.isOccluded(); boolean isOccluded = mKeyguardStateController.isOccluded();
boolean isBouncerShowing = mStatusBarKeyguardViewManager.isBouncerShowing(); boolean isBouncerShowing = mStatusBarKeyguardViewManager.isBouncerShowing();
boolean isSecure = mKeyguardStateController.isMethodSecure(); boolean isSecure = mKeyguardStateController.isMethodSecure();
boolean unlocked = mKeyguardStateController.canDismissLockScreen(); boolean unlocked = mKeyguardStateController.canDismissLockScreen();
@@ -3242,18 +3239,17 @@ public class CentralSurfacesImpl extends CoreStartable implements
Trace.traceCounter(Trace.TRACE_TAG_APP, "dozing", mDozing ? 1 : 0); Trace.traceCounter(Trace.TRACE_TAG_APP, "dozing", mDozing ? 1 : 0);
Trace.beginSection("CentralSurfaces#updateDozingState"); Trace.beginSection("CentralSurfaces#updateDozingState");
boolean visibleNotOccluded = mStatusBarKeyguardViewManager.isShowing() boolean keyguardVisible = mKeyguardStateController.isVisible();
&& !mStatusBarKeyguardViewManager.isOccluded();
// If we're dozing and we'll be animating the screen off, the keyguard isn't currently // If we're dozing and we'll be animating the screen off, the keyguard isn't currently
// visible but will be shortly for the animation, so we should proceed as if it's visible. // visible but will be shortly for the animation, so we should proceed as if it's visible.
boolean visibleNotOccludedOrWillBe = boolean keyguardVisibleOrWillBe =
visibleNotOccluded || (mDozing && mDozeParameters.shouldDelayKeyguardShow()); keyguardVisible || (mDozing && mDozeParameters.shouldDelayKeyguardShow());
boolean wakeAndUnlock = mBiometricUnlockController.getMode() boolean wakeAndUnlock = mBiometricUnlockController.getMode()
== BiometricUnlockController.MODE_WAKE_AND_UNLOCK; == BiometricUnlockController.MODE_WAKE_AND_UNLOCK;
boolean animate = (!mDozing && mDozeServiceHost.shouldAnimateWakeup() && !wakeAndUnlock) boolean animate = (!mDozing && mDozeServiceHost.shouldAnimateWakeup() && !wakeAndUnlock)
|| (mDozing && mDozeParameters.shouldControlScreenOff() || (mDozing && mDozeParameters.shouldControlScreenOff()
&& visibleNotOccludedOrWillBe); && keyguardVisibleOrWillBe);
mNotificationPanelViewController.setDozing(mDozing, animate); mNotificationPanelViewController.setDozing(mDozing, animate);
updateQsExpansionEnabled(); updateQsExpansionEnabled();
@@ -3934,11 +3930,7 @@ public class CentralSurfacesImpl extends CoreStartable implements
@Override @Override
public boolean isKeyguardShowing() { public boolean isKeyguardShowing() {
if (mStatusBarKeyguardViewManager == null) { return mKeyguardStateController.isShowing();
Slog.i(TAG, "isKeyguardShowing() called before startKeyguard(), returning true");
return true;
}
return mStatusBarKeyguardViewManager.isShowing();
} }
@Override @Override

View File

@@ -229,8 +229,6 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
private View mNotificationContainer; private View mNotificationContainer;
@Nullable protected KeyguardBouncer mBouncer; @Nullable protected KeyguardBouncer mBouncer;
protected boolean mShowing;
protected boolean mOccluded;
protected boolean mRemoteInputActive; protected boolean mRemoteInputActive;
private boolean mGlobalActionsVisible = false; private boolean mGlobalActionsVisible = false;
private boolean mLastGlobalActionsVisible = false; private boolean mLastGlobalActionsVisible = false;
@@ -277,10 +275,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
new KeyguardUpdateMonitorCallback() { new KeyguardUpdateMonitorCallback() {
@Override @Override
public void onEmergencyCallAction() { public void onEmergencyCallAction() {
// Since we won't get a setOccluded call we have to reset the view manually such that // Since we won't get a setOccluded call we have to reset the view manually such that
// the bouncer goes away. // the bouncer goes away.
if (mOccluded) { if (mKeyguardStateController.isOccluded()) {
reset(true /* hideBouncerWhenShowing */); reset(true /* hideBouncerWhenShowing */);
} }
} }
@@ -479,7 +476,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
} else { } else {
mBouncerInteractor.setExpansion(KeyguardBouncer.EXPANSION_VISIBLE); mBouncerInteractor.setExpansion(KeyguardBouncer.EXPANSION_VISIBLE);
} }
} else if (mShowing && !hideBouncerOverDream) { } else if (mKeyguardStateController.isShowing() && !hideBouncerOverDream) {
if (!isWakeAndUnlocking() if (!isWakeAndUnlocking()
&& !(mBiometricUnlockController.getMode() == MODE_DISMISS_BOUNCER) && !(mBiometricUnlockController.getMode() == MODE_DISMISS_BOUNCER)
&& !mCentralSurfaces.isInLaunchTransition() && !mCentralSurfaces.isInLaunchTransition()
@@ -500,7 +497,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
mBouncerInteractor.show(/* isScrimmed= */false); mBouncerInteractor.show(/* isScrimmed= */false);
} }
} }
} else if (!mShowing && isBouncerInTransit()) { } else if (!mKeyguardStateController.isShowing() && isBouncerInTransit()) {
// Keyguard is not visible anymore, but expansion animation was still running. // Keyguard is not visible anymore, but expansion animation was still running.
// We need to hide the bouncer, otherwise it will be stuck in transit. // We need to hide the bouncer, otherwise it will be stuck in transit.
if (mBouncer != null) { if (mBouncer != null) {
@@ -533,9 +530,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
@Override @Override
public void show(Bundle options) { public void show(Bundle options) {
Trace.beginSection("StatusBarKeyguardViewManager#show"); Trace.beginSection("StatusBarKeyguardViewManager#show");
mShowing = true;
mNotificationShadeWindowController.setKeyguardShowing(true); mNotificationShadeWindowController.setKeyguardShowing(true);
mKeyguardStateController.notifyKeyguardState(mShowing, mKeyguardStateController.notifyKeyguardState(true,
mKeyguardStateController.isOccluded()); mKeyguardStateController.isOccluded());
reset(true /* hideBouncerWhenShowing */); reset(true /* hideBouncerWhenShowing */);
SysUiStatsLog.write(SysUiStatsLog.KEYGUARD_STATE_CHANGED, SysUiStatsLog.write(SysUiStatsLog.KEYGUARD_STATE_CHANGED,
@@ -599,7 +595,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
} else { } else {
mBouncerInteractor.hide(); mBouncerInteractor.hide();
} }
if (mShowing) { if (mKeyguardStateController.isShowing()) {
// If we were showing the bouncer and then aborting, we need to also clear out any // If we were showing the bouncer and then aborting, we need to also clear out any
// potential actions unless we actually unlocked. // potential actions unless we actually unlocked.
cancelPostAuthActions(); cancelPostAuthActions();
@@ -616,7 +612,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
public void showBouncer(boolean scrimmed) { public void showBouncer(boolean scrimmed) {
resetAlternateAuth(false); resetAlternateAuth(false);
if (mShowing && !isBouncerShowing()) { if (mKeyguardStateController.isShowing() && !isBouncerShowing()) {
if (mBouncer != null) { if (mBouncer != null) {
mBouncer.show(false /* resetSecuritySelection */, scrimmed); mBouncer.show(false /* resetSecuritySelection */, scrimmed);
} else { } else {
@@ -633,7 +629,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
public void dismissWithAction(OnDismissAction r, Runnable cancelAction, public void dismissWithAction(OnDismissAction r, Runnable cancelAction,
boolean afterKeyguardGone, String message) { boolean afterKeyguardGone, String message) {
if (mShowing) { if (mKeyguardStateController.isShowing()) {
try { try {
Trace.beginSection("StatusBarKeyguardViewManager#dismissWithAction"); Trace.beginSection("StatusBarKeyguardViewManager#dismissWithAction");
cancelPendingWakeupAction(); cancelPendingWakeupAction();
@@ -719,11 +715,12 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
@Override @Override
public void reset(boolean hideBouncerWhenShowing) { public void reset(boolean hideBouncerWhenShowing) {
if (mShowing) { if (mKeyguardStateController.isShowing()) {
final boolean isOccluded = mKeyguardStateController.isOccluded();
// Hide quick settings. // Hide quick settings.
mNotificationPanelViewController.resetViews(/* animate= */ !mOccluded); mNotificationPanelViewController.resetViews(/* animate= */ !isOccluded);
// Hide bouncer and quick-quick settings. // Hide bouncer and quick-quick settings.
if (mOccluded && !mDozing) { if (isOccluded && !mDozing) {
mCentralSurfaces.hideKeyguard(); mCentralSurfaces.hideKeyguard();
if (hideBouncerWhenShowing || needsFullscreenBouncer()) { if (hideBouncerWhenShowing || needsFullscreenBouncer()) {
hideBouncer(false /* destroyView */); hideBouncer(false /* destroyView */);
@@ -805,7 +802,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
private void setDozing(boolean dozing) { private void setDozing(boolean dozing) {
if (mDozing != dozing) { if (mDozing != dozing) {
mDozing = dozing; mDozing = dozing;
if (dozing || mBouncer.needsFullscreenBouncer() || mOccluded) { if (dozing || mBouncer.needsFullscreenBouncer()
|| mKeyguardStateController.isOccluded()) {
reset(dozing /* hideBouncerWhenShowing */); reset(dozing /* hideBouncerWhenShowing */);
} }
updateStates(); updateStates();
@@ -838,18 +836,23 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
@Override @Override
public void setOccluded(boolean occluded, boolean animate) { public void setOccluded(boolean occluded, boolean animate) {
final boolean isOccluding = !mOccluded && occluded; final boolean wasOccluded = mKeyguardStateController.isOccluded();
final boolean isUnOccluding = mOccluded && !occluded; final boolean isOccluding = !wasOccluded && occluded;
setOccludedAndUpdateStates(occluded); final boolean isUnOccluding = wasOccluded && !occluded;
mKeyguardStateController.notifyKeyguardState(
mKeyguardStateController.isShowing(), occluded);
updateStates();
final boolean isShowing = mKeyguardStateController.isShowing();
final boolean isOccluded = mKeyguardStateController.isOccluded();
if (mShowing && isOccluding) { if (isShowing && isOccluding) {
SysUiStatsLog.write(SysUiStatsLog.KEYGUARD_STATE_CHANGED, SysUiStatsLog.write(SysUiStatsLog.KEYGUARD_STATE_CHANGED,
SysUiStatsLog.KEYGUARD_STATE_CHANGED__STATE__OCCLUDED); SysUiStatsLog.KEYGUARD_STATE_CHANGED__STATE__OCCLUDED);
if (mCentralSurfaces.isInLaunchTransition()) { if (mCentralSurfaces.isInLaunchTransition()) {
final Runnable endRunnable = new Runnable() { final Runnable endRunnable = new Runnable() {
@Override @Override
public void run() { public void run() {
mNotificationShadeWindowController.setKeyguardOccluded(mOccluded); mNotificationShadeWindowController.setKeyguardOccluded(isOccluded);
reset(true /* hideBouncerWhenShowing */); reset(true /* hideBouncerWhenShowing */);
} }
}; };
@@ -864,19 +867,19 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
// When isLaunchingActivityOverLockscreen() is true, we know for sure that the post // When isLaunchingActivityOverLockscreen() is true, we know for sure that the post
// collapse runnables will be run. // collapse runnables will be run.
mShadeController.get().addPostCollapseAction(() -> { mShadeController.get().addPostCollapseAction(() -> {
mNotificationShadeWindowController.setKeyguardOccluded(mOccluded); mNotificationShadeWindowController.setKeyguardOccluded(isOccluded);
reset(true /* hideBouncerWhenShowing */); reset(true /* hideBouncerWhenShowing */);
}); });
return; return;
} }
} else if (mShowing && isUnOccluding) { } else if (isShowing && isUnOccluding) {
SysUiStatsLog.write(SysUiStatsLog.KEYGUARD_STATE_CHANGED, SysUiStatsLog.write(SysUiStatsLog.KEYGUARD_STATE_CHANGED,
SysUiStatsLog.KEYGUARD_STATE_CHANGED__STATE__SHOWN); SysUiStatsLog.KEYGUARD_STATE_CHANGED__STATE__SHOWN);
} }
if (mShowing) { if (isShowing) {
mMediaManager.updateMediaMetaData(false, animate && !mOccluded); mMediaManager.updateMediaMetaData(false, animate && !isOccluded);
} }
mNotificationShadeWindowController.setKeyguardOccluded(mOccluded); mNotificationShadeWindowController.setKeyguardOccluded(isOccluded);
// setDozing(false) will call reset once we stop dozing. Also, if we're going away, there's // setDozing(false) will call reset once we stop dozing. Also, if we're going away, there's
// no need to reset the keyguard views as we'll be gone shortly. Resetting now could cause // no need to reset the keyguard views as we'll be gone shortly. Resetting now could cause
@@ -886,20 +889,11 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
// by a FLAG_DISMISS_KEYGUARD_ACTIVITY. // by a FLAG_DISMISS_KEYGUARD_ACTIVITY.
reset(isOccluding /* hideBouncerWhenShowing*/); reset(isOccluding /* hideBouncerWhenShowing*/);
} }
if (animate && !mOccluded && mShowing && !bouncerIsShowing()) { if (animate && !isOccluded && isShowing && !bouncerIsShowing()) {
mCentralSurfaces.animateKeyguardUnoccluding(); mCentralSurfaces.animateKeyguardUnoccluding();
} }
} }
private void setOccludedAndUpdateStates(boolean occluded) {
mOccluded = occluded;
updateStates();
}
public boolean isOccluded() {
return mOccluded;
}
@Override @Override
public void startPreHideAnimation(Runnable finishRunnable) { public void startPreHideAnimation(Runnable finishRunnable) {
if (bouncerIsShowing()) { if (bouncerIsShowing()) {
@@ -930,8 +924,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
@Override @Override
public void hide(long startTime, long fadeoutDuration) { public void hide(long startTime, long fadeoutDuration) {
Trace.beginSection("StatusBarKeyguardViewManager#hide"); Trace.beginSection("StatusBarKeyguardViewManager#hide");
mShowing = false; mKeyguardStateController.notifyKeyguardState(false,
mKeyguardStateController.notifyKeyguardState(mShowing,
mKeyguardStateController.isOccluded()); mKeyguardStateController.isOccluded());
launchPendingWakeupAction(); launchPendingWakeupAction();
@@ -1080,11 +1073,6 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
KeyguardUpdateMonitor.getCurrentUser()) != KeyguardSecurityModel.SecurityMode.None; KeyguardUpdateMonitor.getCurrentUser()) != KeyguardSecurityModel.SecurityMode.None;
} }
@Override
public boolean isShowing() {
return mShowing;
}
/** /**
* Returns whether a back invocation can be handled, which depends on whether the keyguard * Returns whether a back invocation can be handled, which depends on whether the keyguard
* is currently showing (which itself is derived from multiple states). * is currently showing (which itself is derived from multiple states).
@@ -1187,8 +1175,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
}; };
protected void updateStates() { protected void updateStates() {
boolean showing = mShowing; boolean showing = mKeyguardStateController.isShowing();
boolean occluded = mOccluded; boolean occluded = mKeyguardStateController.isOccluded();
boolean bouncerShowing = bouncerIsShowing(); boolean bouncerShowing = bouncerIsShowing();
boolean bouncerIsOrWillBeShowing = bouncerIsOrWillBeShowing(); boolean bouncerIsOrWillBeShowing = bouncerIsOrWillBeShowing();
boolean bouncerDismissible = !isFullscreenBouncer(); boolean bouncerDismissible = !isFullscreenBouncer();
@@ -1222,13 +1210,6 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
mNotificationShadeWindowController.setBouncerShowing(bouncerShowing); mNotificationShadeWindowController.setBouncerShowing(bouncerShowing);
mCentralSurfaces.setBouncerShowing(bouncerShowing); mCentralSurfaces.setBouncerShowing(bouncerShowing);
} }
if (occluded != mLastOccluded || mFirstUpdate) {
mKeyguardStateController.notifyKeyguardState(showing, occluded);
}
if (occluded != mLastOccluded || mShowing != showing || mFirstUpdate) {
mKeyguardUpdateManager.setKeyguardShowing(showing, occluded);
}
if (bouncerIsOrWillBeShowing != mLastBouncerIsOrWillBeShowing || mFirstUpdate if (bouncerIsOrWillBeShowing != mLastBouncerIsOrWillBeShowing || mFirstUpdate
|| bouncerShowing != mLastBouncerShowing) { || bouncerShowing != mLastBouncerShowing) {
mKeyguardUpdateManager.sendKeyguardBouncerChanged(bouncerIsOrWillBeShowing, mKeyguardUpdateManager.sendKeyguardBouncerChanged(bouncerIsOrWillBeShowing,
@@ -1279,12 +1260,12 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
public boolean isNavBarVisible() { public boolean isNavBarVisible() {
boolean isWakeAndUnlockPulsing = mBiometricUnlockController != null boolean isWakeAndUnlockPulsing = mBiometricUnlockController != null
&& mBiometricUnlockController.getMode() == MODE_WAKE_AND_UNLOCK_PULSING; && mBiometricUnlockController.getMode() == MODE_WAKE_AND_UNLOCK_PULSING;
boolean keyguardShowing = mShowing && !mOccluded; boolean keyguardVisible = mKeyguardStateController.isVisible();
boolean hideWhileDozing = mDozing && !isWakeAndUnlockPulsing; boolean hideWhileDozing = mDozing && !isWakeAndUnlockPulsing;
boolean keyguardWithGestureNav = (keyguardShowing && !mDozing && !mScreenOffAnimationPlaying boolean keyguardWithGestureNav = (keyguardVisible && !mDozing && !mScreenOffAnimationPlaying
|| mPulsing && !mIsDocked) || mPulsing && !mIsDocked)
&& mGesturalNav; && mGesturalNav;
return (!keyguardShowing && !hideWhileDozing && !mScreenOffAnimationPlaying return (!keyguardVisible && !hideWhileDozing && !mScreenOffAnimationPlaying
|| bouncerIsShowing() || bouncerIsShowing()
|| mRemoteInputActive || mRemoteInputActive
|| keyguardWithGestureNav || keyguardWithGestureNav
@@ -1416,7 +1397,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
DismissWithActionRequest request = mPendingWakeupAction; DismissWithActionRequest request = mPendingWakeupAction;
mPendingWakeupAction = null; mPendingWakeupAction = null;
if (request != null) { if (request != null) {
if (mShowing) { if (mKeyguardStateController.isShowing()) {
dismissWithAction(request.dismissAction, request.cancelAction, dismissWithAction(request.dismissAction, request.cancelAction,
request.afterKeyguardGone, request.message); request.afterKeyguardGone, request.message);
} else if (request.dismissAction != null) { } else if (request.dismissAction != null) {
@@ -1435,10 +1416,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
public boolean bouncerNeedsScrimming() { public boolean bouncerNeedsScrimming() {
// When a dream overlay is active, scrimming will cause any expansion to immediately expand. // When a dream overlay is active, scrimming will cause any expansion to immediately expand.
return (mOccluded && !mDreamOverlayStateController.isOverlayActive()) return (mKeyguardStateController.isOccluded()
&& !mDreamOverlayStateController.isOverlayActive())
|| bouncerWillDismissWithAction() || bouncerWillDismissWithAction()
|| (bouncerIsShowing() || (bouncerIsShowing() && bouncerIsScrimmed())
&& bouncerIsScrimmed())
|| isFullscreenBouncer(); || isFullscreenBouncer();
} }
@@ -1457,8 +1438,6 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
public void dump(PrintWriter pw) { public void dump(PrintWriter pw) {
pw.println("StatusBarKeyguardViewManager:"); pw.println("StatusBarKeyguardViewManager:");
pw.println(" mShowing: " + mShowing);
pw.println(" mOccluded: " + mOccluded);
pw.println(" mRemoteInputActive: " + mRemoteInputActive); pw.println(" mRemoteInputActive: " + mRemoteInputActive);
pw.println(" mDozing: " + mDozing); pw.println(" mDozing: " + mDozing);
pw.println(" mAfterKeyguardGoneAction: " + mAfterKeyguardGoneAction); pw.println(" mAfterKeyguardGoneAction: " + mAfterKeyguardGoneAction);

View File

@@ -35,9 +35,16 @@ public interface KeyguardStateController extends CallbackController<Callback> {
} }
/** /**
* If the lock screen is visible. * If the keyguard is visible. This is unrelated to being locked or not.
* The keyguard is also visible when the device is asleep or in always on mode, except when */
* the screen timed out and the user can unlock by quickly pressing power. default boolean isVisible() {
return isShowing() && !isOccluded();
}
/**
* If the keyguard is showing. This includes when it's occluded by an activity, and when
* the device is asleep or in always on mode, except when the screen timed out and the user
* can unlock by quickly pressing power.
* *
* This is unrelated to being locked or not. * This is unrelated to being locked or not.
* *

View File

@@ -181,6 +181,7 @@ public class KeyguardStateControllerImpl implements KeyguardStateController, Dum
if (mShowing == showing && mOccluded == occluded) return; if (mShowing == showing && mOccluded == occluded) return;
mShowing = showing; mShowing = showing;
mOccluded = occluded; mOccluded = occluded;
mKeyguardUpdateMonitor.setKeyguardShowing(showing, occluded);
Trace.instantForTrack(Trace.TRACE_TAG_APP, "UI Events", Trace.instantForTrack(Trace.TRACE_TAG_APP, "UI Events",
"Keyguard showing: " + showing + " occluded: " + occluded); "Keyguard showing: " + showing + " occluded: " + occluded);
notifyKeyguardChanged(); notifyKeyguardChanged();
@@ -387,6 +388,8 @@ public class KeyguardStateControllerImpl implements KeyguardStateController, Dum
@Override @Override
public void dump(PrintWriter pw, String[] args) { public void dump(PrintWriter pw, String[] args) {
pw.println("KeyguardStateController:"); pw.println("KeyguardStateController:");
pw.println(" mShowing: " + mShowing);
pw.println(" mOccluded: " + mOccluded);
pw.println(" mSecure: " + mSecure); pw.println(" mSecure: " + mSecure);
pw.println(" mCanDismissLockScreen: " + mCanDismissLockScreen); pw.println(" mCanDismissLockScreen: " + mCanDismissLockScreen);
pw.println(" mTrustManaged: " + mTrustManaged); pw.println(" mTrustManaged: " + mTrustManaged);

View File

@@ -176,7 +176,7 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
// and the keyguard goes away // and the keyguard goes away
mViewMediator.setShowingLocked(false); mViewMediator.setShowingLocked(false);
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(false); when(mKeyguardStateController.isShowing()).thenReturn(false);
mViewMediator.mUpdateCallback.onKeyguardVisibilityChanged(false); mViewMediator.mUpdateCallback.onKeyguardVisibilityChanged(false);
TestableLooper.get(this).processAllMessages(); TestableLooper.get(this).processAllMessages();
@@ -201,7 +201,7 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
// and the keyguard goes away // and the keyguard goes away
mViewMediator.setShowingLocked(false); mViewMediator.setShowingLocked(false);
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(false); when(mKeyguardStateController.isShowing()).thenReturn(false);
mViewMediator.mUpdateCallback.onKeyguardVisibilityChanged(false); mViewMediator.mUpdateCallback.onKeyguardVisibilityChanged(false);
TestableLooper.get(this).processAllMessages(); TestableLooper.get(this).processAllMessages();

View File

@@ -39,7 +39,6 @@ import android.view.accessibility.AccessibilityManager;
import androidx.test.filters.SmallTest; import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4; import androidx.test.runner.AndroidJUnit4;
import com.android.keyguard.KeyguardViewController;
import com.android.systemui.SysuiTestCase; import com.android.systemui.SysuiTestCase;
import com.android.systemui.accessibility.AccessibilityButtonModeObserver; import com.android.systemui.accessibility.AccessibilityButtonModeObserver;
import com.android.systemui.accessibility.AccessibilityButtonTargetsObserver; import com.android.systemui.accessibility.AccessibilityButtonTargetsObserver;
@@ -49,6 +48,7 @@ import com.android.systemui.dump.DumpManager;
import com.android.systemui.recents.OverviewProxyService; import com.android.systemui.recents.OverviewProxyService;
import com.android.systemui.settings.UserTracker; import com.android.systemui.settings.UserTracker;
import com.android.systemui.statusbar.phone.CentralSurfaces; import com.android.systemui.statusbar.phone.CentralSurfaces;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@@ -113,7 +113,7 @@ public class NavBarHelperTest extends SysuiTestCase {
mNavBarHelper = new NavBarHelper(mContext, mAccessibilityManager, mNavBarHelper = new NavBarHelper(mContext, mAccessibilityManager,
mAccessibilityButtonModeObserver, mAccessibilityButtonTargetObserver, mAccessibilityButtonModeObserver, mAccessibilityButtonTargetObserver,
mSystemActions, mOverviewProxyService, mAssistManagerLazy, mSystemActions, mOverviewProxyService, mAssistManagerLazy,
() -> Optional.of(mock(CentralSurfaces.class)), mock(KeyguardViewController.class), () -> Optional.of(mock(CentralSurfaces.class)), mock(KeyguardStateController.class),
mNavigationModeController, mUserTracker, mDumpManager); mNavigationModeController, mUserTracker, mDumpManager);
} }

View File

@@ -72,7 +72,6 @@ import androidx.test.filters.SmallTest;
import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.UiEventLogger; import com.android.internal.logging.UiEventLogger;
import com.android.keyguard.KeyguardViewController;
import com.android.systemui.SysuiTestCase; import com.android.systemui.SysuiTestCase;
import com.android.systemui.SysuiTestableContext; import com.android.systemui.SysuiTestableContext;
import com.android.systemui.accessibility.AccessibilityButtonModeObserver; import com.android.systemui.accessibility.AccessibilityButtonModeObserver;
@@ -194,7 +193,7 @@ public class NavigationBarTest extends SysuiTestCase {
@Mock @Mock
private CentralSurfaces mCentralSurfaces; private CentralSurfaces mCentralSurfaces;
@Mock @Mock
private KeyguardViewController mKeyguardViewController; private KeyguardStateController mKeyguardStateController;
@Mock @Mock
private UserContextProvider mUserContextProvider; private UserContextProvider mUserContextProvider;
@Mock @Mock
@@ -240,7 +239,7 @@ public class NavigationBarTest extends SysuiTestCase {
mock(AccessibilityButtonTargetsObserver.class), mock(AccessibilityButtonTargetsObserver.class),
mSystemActions, mOverviewProxyService, mSystemActions, mOverviewProxyService,
() -> mock(AssistManager.class), () -> Optional.of(mCentralSurfaces), () -> mock(AssistManager.class), () -> Optional.of(mCentralSurfaces),
mKeyguardViewController, mock(NavigationModeController.class), mKeyguardStateController, mock(NavigationModeController.class),
mock(UserTracker.class), mock(DumpManager.class))); mock(UserTracker.class), mock(DumpManager.class)));
mNavigationBar = createNavBar(mContext); mNavigationBar = createNavBar(mContext);
mExternalDisplayNavigationBar = createNavBar(mSysuiTestableContextExternal); mExternalDisplayNavigationBar = createNavBar(mSysuiTestableContextExternal);
@@ -380,7 +379,7 @@ public class NavigationBarTest extends SysuiTestCase {
// Verify navbar didn't alter and showing back icon when the keyguard is showing without // Verify navbar didn't alter and showing back icon when the keyguard is showing without
// requesting IME insets visible. // requesting IME insets visible.
doReturn(true).when(mKeyguardViewController).isShowing(); doReturn(true).when(mKeyguardStateController).isShowing();
mNavigationBar.setImeWindowStatus(DEFAULT_DISPLAY, null, IME_VISIBLE, mNavigationBar.setImeWindowStatus(DEFAULT_DISPLAY, null, IME_VISIBLE,
BACK_DISPOSITION_DEFAULT, true); BACK_DISPOSITION_DEFAULT, true);
assertFalse((mNavigationBar.getNavigationIconHints() & NAVIGATION_HINT_BACK_ALT) != 0); assertFalse((mNavigationBar.getNavigationIconHints() & NAVIGATION_HINT_BACK_ALT) != 0);

View File

@@ -32,7 +32,6 @@ import android.testing.TestableLooper;
import com.android.systemui.SysuiTestCase; import com.android.systemui.SysuiTestCase;
import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.NotificationLockscreenUserManager; import com.android.systemui.statusbar.NotificationLockscreenUserManager;
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
import com.android.systemui.statusbar.policy.KeyguardStateController; import com.android.systemui.statusbar.policy.KeyguardStateController;
import org.junit.Assert; import org.junit.Assert;
@@ -58,8 +57,6 @@ public class DynamicPrivacyControllerTest extends SysuiTestCase {
mDynamicPrivacyController = new DynamicPrivacyController( mDynamicPrivacyController = new DynamicPrivacyController(
mLockScreenUserManager, mKeyguardStateController, mLockScreenUserManager, mKeyguardStateController,
mock(StatusBarStateController.class)); mock(StatusBarStateController.class));
mDynamicPrivacyController.setStatusBarKeyguardViewManager(
mock(StatusBarKeyguardViewManager.class));
mDynamicPrivacyController.addListener(mListener); mDynamicPrivacyController.addListener(mListener);
// Disable dynamic privacy by default // Disable dynamic privacy by default
allowNotificationsInPublic(false); allowNotificationsInPublic(false);

View File

@@ -100,8 +100,6 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
@Mock @Mock
private AuthController mAuthController; private AuthController mAuthController;
@Mock @Mock
private DozeParameters mDozeParameters;
@Mock
private MetricsLogger mMetricsLogger; private MetricsLogger mMetricsLogger;
@Mock @Mock
private NotificationMediaManager mNotificationMediaManager; private NotificationMediaManager mNotificationMediaManager;
@@ -127,7 +125,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
public void setUp() { public void setUp() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
TestableResources res = getContext().getOrCreateTestableResources(); TestableResources res = getContext().getOrCreateTestableResources();
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true); when(mKeyguardStateController.isShowing()).thenReturn(true);
when(mUpdateMonitor.isDeviceInteractive()).thenReturn(true); when(mUpdateMonitor.isDeviceInteractive()).thenReturn(true);
when(mKeyguardStateController.isFaceAuthEnabled()).thenReturn(true); when(mKeyguardStateController.isFaceAuthEnabled()).thenReturn(true);
when(mKeyguardStateController.isUnlocked()).thenReturn(false); when(mKeyguardStateController.isUnlocked()).thenReturn(false);
@@ -139,7 +137,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
mBiometricUnlockController = new BiometricUnlockController(mDozeScrimController, mBiometricUnlockController = new BiometricUnlockController(mDozeScrimController,
mKeyguardViewMediator, mScrimController, mShadeController, mKeyguardViewMediator, mScrimController, mShadeController,
mNotificationShadeWindowController, mKeyguardStateController, mHandler, mNotificationShadeWindowController, mKeyguardStateController, mHandler,
mUpdateMonitor, res.getResources(), mKeyguardBypassController, mDozeParameters, mUpdateMonitor, res.getResources(), mKeyguardBypassController,
mMetricsLogger, mDumpManager, mPowerManager, mMetricsLogger, mDumpManager, mPowerManager,
mNotificationMediaManager, mWakefulnessLifecycle, mScreenLifecycle, mNotificationMediaManager, mWakefulnessLifecycle, mScreenLifecycle,
mAuthController, mStatusBarStateController, mKeyguardUnlockAnimationController, mAuthController, mStatusBarStateController, mKeyguardUnlockAnimationController,
@@ -177,7 +175,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
public void onBiometricAuthenticated_whenFingerprintAndNotInteractive_wakeAndUnlock() { public void onBiometricAuthenticated_whenFingerprintAndNotInteractive_wakeAndUnlock() {
reset(mUpdateMonitor); reset(mUpdateMonitor);
reset(mStatusBarKeyguardViewManager); reset(mStatusBarKeyguardViewManager);
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true); when(mKeyguardStateController.isShowing()).thenReturn(true);
when(mUpdateMonitor.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(true); when(mUpdateMonitor.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(true);
when(mDozeScrimController.isPulsing()).thenReturn(true); when(mDozeScrimController.isPulsing()).thenReturn(true);
// the value of isStrongBiometric doesn't matter here since we only care about the returned // the value of isStrongBiometric doesn't matter here since we only care about the returned
@@ -194,7 +192,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
public void onBiometricAuthenticated_whenDeviceIsAlreadyUnlocked_wakeAndUnlock() { public void onBiometricAuthenticated_whenDeviceIsAlreadyUnlocked_wakeAndUnlock() {
reset(mUpdateMonitor); reset(mUpdateMonitor);
reset(mStatusBarKeyguardViewManager); reset(mStatusBarKeyguardViewManager);
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(false); when(mKeyguardStateController.isShowing()).thenReturn(false);
when(mKeyguardStateController.isUnlocked()).thenReturn(true); when(mKeyguardStateController.isUnlocked()).thenReturn(true);
when(mUpdateMonitor.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(true); when(mUpdateMonitor.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(true);
when(mDozeScrimController.isPulsing()).thenReturn(false); when(mDozeScrimController.isPulsing()).thenReturn(false);

View File

@@ -516,32 +516,32 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
@Test @Test
public void executeRunnableDismissingKeyguard_nullRunnable_showingAndOccluded() { public void executeRunnableDismissingKeyguard_nullRunnable_showingAndOccluded() {
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true); when(mKeyguardStateController.isShowing()).thenReturn(true);
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(true); when(mKeyguardStateController.isOccluded()).thenReturn(true);
mCentralSurfaces.executeRunnableDismissingKeyguard(null, null, false, false, false); mCentralSurfaces.executeRunnableDismissingKeyguard(null, null, false, false, false);
} }
@Test @Test
public void executeRunnableDismissingKeyguard_nullRunnable_showing() { public void executeRunnableDismissingKeyguard_nullRunnable_showing() {
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true); when(mKeyguardStateController.isShowing()).thenReturn(true);
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false); when(mKeyguardStateController.isOccluded()).thenReturn(false);
mCentralSurfaces.executeRunnableDismissingKeyguard(null, null, false, false, false); mCentralSurfaces.executeRunnableDismissingKeyguard(null, null, false, false, false);
} }
@Test @Test
public void executeRunnableDismissingKeyguard_nullRunnable_notShowing() { public void executeRunnableDismissingKeyguard_nullRunnable_notShowing() {
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(false); when(mKeyguardStateController.isShowing()).thenReturn(false);
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false); when(mKeyguardStateController.isOccluded()).thenReturn(false);
mCentralSurfaces.executeRunnableDismissingKeyguard(null, null, false, false, false); mCentralSurfaces.executeRunnableDismissingKeyguard(null, null, false, false, false);
} }
@Test @Test
public void executeRunnableDismissingKeyguard_dreaming_notShowing() throws RemoteException { public void executeRunnableDismissingKeyguard_dreaming_notShowing() throws RemoteException {
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(false); when(mKeyguardStateController.isShowing()).thenReturn(false);
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false); when(mKeyguardStateController.isOccluded()).thenReturn(false);
when(mKeyguardUpdateMonitor.isDreaming()).thenReturn(true); when(mKeyguardUpdateMonitor.isDreaming()).thenReturn(true);
mCentralSurfaces.executeRunnableDismissingKeyguard(() -> {}, mCentralSurfaces.executeRunnableDismissingKeyguard(() -> {},
@@ -555,8 +555,8 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
@Test @Test
public void executeRunnableDismissingKeyguard_notDreaming_notShowing() throws RemoteException { public void executeRunnableDismissingKeyguard_notDreaming_notShowing() throws RemoteException {
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(false); when(mKeyguardStateController.isShowing()).thenReturn(false);
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false); when(mKeyguardStateController.isOccluded()).thenReturn(false);
when(mKeyguardUpdateMonitor.isDreaming()).thenReturn(false); when(mKeyguardUpdateMonitor.isDreaming()).thenReturn(false);
mCentralSurfaces.executeRunnableDismissingKeyguard(() -> {}, mCentralSurfaces.executeRunnableDismissingKeyguard(() -> {},
@@ -571,10 +571,10 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
@Test @Test
public void lockscreenStateMetrics_notShowing() { public void lockscreenStateMetrics_notShowing() {
// uninteresting state, except that fingerprint must be non-zero // uninteresting state, except that fingerprint must be non-zero
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false); when(mKeyguardStateController.isOccluded()).thenReturn(false);
when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true); when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true);
// interesting state // interesting state
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(false); when(mKeyguardStateController.isShowing()).thenReturn(false);
when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(false); when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(false);
when(mKeyguardStateController.isMethodSecure()).thenReturn(false); when(mKeyguardStateController.isMethodSecure()).thenReturn(false);
mCentralSurfaces.onKeyguardViewManagerStatesUpdated(); mCentralSurfaces.onKeyguardViewManagerStatesUpdated();
@@ -589,10 +589,10 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
@Test @Test
public void lockscreenStateMetrics_notShowing_secure() { public void lockscreenStateMetrics_notShowing_secure() {
// uninteresting state, except that fingerprint must be non-zero // uninteresting state, except that fingerprint must be non-zero
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false); when(mKeyguardStateController.isOccluded()).thenReturn(false);
when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true); when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true);
// interesting state // interesting state
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(false); when(mKeyguardStateController.isShowing()).thenReturn(false);
when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(false); when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(false);
when(mKeyguardStateController.isMethodSecure()).thenReturn(true); when(mKeyguardStateController.isMethodSecure()).thenReturn(true);
@@ -608,10 +608,10 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
@Test @Test
public void lockscreenStateMetrics_isShowing() { public void lockscreenStateMetrics_isShowing() {
// uninteresting state, except that fingerprint must be non-zero // uninteresting state, except that fingerprint must be non-zero
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false); when(mKeyguardStateController.isOccluded()).thenReturn(false);
when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true); when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true);
// interesting state // interesting state
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true); when(mKeyguardStateController.isShowing()).thenReturn(true);
when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(false); when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(false);
when(mKeyguardStateController.isMethodSecure()).thenReturn(false); when(mKeyguardStateController.isMethodSecure()).thenReturn(false);
@@ -627,10 +627,10 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
@Test @Test
public void lockscreenStateMetrics_isShowing_secure() { public void lockscreenStateMetrics_isShowing_secure() {
// uninteresting state, except that fingerprint must be non-zero // uninteresting state, except that fingerprint must be non-zero
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false); when(mKeyguardStateController.isOccluded()).thenReturn(false);
when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true); when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true);
// interesting state // interesting state
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true); when(mKeyguardStateController.isShowing()).thenReturn(true);
when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(false); when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(false);
when(mKeyguardStateController.isMethodSecure()).thenReturn(true); when(mKeyguardStateController.isMethodSecure()).thenReturn(true);
@@ -646,10 +646,10 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
@Test @Test
public void lockscreenStateMetrics_isShowingBouncer() { public void lockscreenStateMetrics_isShowingBouncer() {
// uninteresting state, except that fingerprint must be non-zero // uninteresting state, except that fingerprint must be non-zero
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false); when(mKeyguardStateController.isOccluded()).thenReturn(false);
when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true); when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true);
// interesting state // interesting state
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true); when(mKeyguardStateController.isShowing()).thenReturn(true);
when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(true); when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(true);
when(mKeyguardStateController.isMethodSecure()).thenReturn(true); when(mKeyguardStateController.isMethodSecure()).thenReturn(true);
@@ -1053,9 +1053,9 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
} }
@Test @Test
public void startActivityDismissingKeyguard_isShowingandIsOccluded() { public void startActivityDismissingKeyguard_isShowingAndIsOccluded() {
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true); when(mKeyguardStateController.isShowing()).thenReturn(true);
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(true); when(mKeyguardStateController.isOccluded()).thenReturn(true);
mCentralSurfaces.startActivityDismissingKeyguard( mCentralSurfaces.startActivityDismissingKeyguard(
new Intent(), new Intent(),
/* onlyProvisioned = */false, /* onlyProvisioned = */false,

View File

@@ -0,0 +1,145 @@
/*
* Copyright (C) 2022 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.systemui.statusbar.phone;
import com.android.systemui.statusbar.policy.KeyguardStateController;
/**
* Mock implementation of KeyguardStateController which tracks showing and occluded states
* based on {@link #notifyKeyguardState(boolean showing, boolean occluded)}}.
*/
public class FakeKeyguardStateController implements KeyguardStateController {
private boolean mShowing;
private boolean mOccluded;
private boolean mCanDismissLockScreen;
@Override
public void notifyKeyguardState(boolean showing, boolean occluded) {
mShowing = showing;
mOccluded = occluded;
}
@Override
public boolean isShowing() {
return mShowing;
}
@Override
public boolean isOccluded() {
return mOccluded;
}
public void setCanDismissLockScreen(boolean canDismissLockScreen) {
mCanDismissLockScreen = canDismissLockScreen;
}
@Override
public boolean canDismissLockScreen() {
return mCanDismissLockScreen;
}
@Override
public boolean isBouncerShowing() {
return false;
}
@Override
public boolean isKeyguardScreenRotationAllowed() {
return false;
}
@Override
public boolean isMethodSecure() {
return true;
}
@Override
public boolean isTrusted() {
return false;
}
@Override
public boolean isKeyguardGoingAway() {
return false;
}
@Override
public boolean isKeyguardFadingAway() {
return false;
}
@Override
public boolean isLaunchTransitionFadingAway() {
return false;
}
@Override
public long getKeyguardFadingAwayDuration() {
return 0;
}
@Override
public long getKeyguardFadingAwayDelay() {
return 0;
}
@Override
public long calculateGoingToFullShadeDelay() {
return 0;
}
@Override
public float getDismissAmount() {
return 0f;
}
@Override
public boolean isDismissingFromSwipe() {
return false;
}
@Override
public boolean isFlingingToDismissKeyguard() {
return false;
}
@Override
public boolean isFlingingToDismissKeyguardDuringSwipeGesture() {
return false;
}
@Override
public boolean isSnappingKeyguardBackAfterSwipe() {
return false;
}
@Override
public void notifyPanelFlingStart(boolean dismiss) {
}
@Override
public void notifyPanelFlingEnd() {
}
@Override
public void addCallback(Callback listener) {
}
@Override
public void removeCallback(Callback listener) {
}
}

View File

@@ -28,6 +28,7 @@ import static org.mockito.Mockito.clearInvocations;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never; import static org.mockito.Mockito.never;
import static org.mockito.Mockito.reset; import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@@ -68,7 +69,6 @@ import com.android.systemui.statusbar.SysuiStatusBarStateController;
import com.android.systemui.statusbar.phone.panelstate.PanelExpansionChangeEvent; import com.android.systemui.statusbar.phone.panelstate.PanelExpansionChangeEvent;
import com.android.systemui.statusbar.phone.panelstate.PanelExpansionStateManager; import com.android.systemui.statusbar.phone.panelstate.PanelExpansionStateManager;
import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.unfold.SysUIUnfoldComponent; import com.android.systemui.unfold.SysUIUnfoldComponent;
import com.google.common.truth.Truth; import com.google.common.truth.Truth;
@@ -94,7 +94,6 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
@Mock private ViewMediatorCallback mViewMediatorCallback; @Mock private ViewMediatorCallback mViewMediatorCallback;
@Mock private LockPatternUtils mLockPatternUtils; @Mock private LockPatternUtils mLockPatternUtils;
@Mock private KeyguardStateController mKeyguardStateController;
@Mock private CentralSurfaces mCentralSurfaces; @Mock private CentralSurfaces mCentralSurfaces;
@Mock private ViewGroup mContainer; @Mock private ViewGroup mContainer;
@Mock private NotificationPanelViewController mNotificationPanelView; @Mock private NotificationPanelViewController mNotificationPanelView;
@@ -123,6 +122,8 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager; private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
private KeyguardBouncer.BouncerExpansionCallback mBouncerExpansionCallback; private KeyguardBouncer.BouncerExpansionCallback mBouncerExpansionCallback;
private FakeKeyguardStateController mKeyguardStateController =
spy(new FakeKeyguardStateController());
@Mock private ViewRootImpl mViewRootImpl; @Mock private ViewRootImpl mViewRootImpl;
@Mock private WindowOnBackInvokedDispatcher mOnBackInvokedDispatcher; @Mock private WindowOnBackInvokedDispatcher mOnBackInvokedDispatcher;
@@ -180,7 +181,6 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
mBiometricUnlockController, mBiometricUnlockController,
mNotificationContainer, mNotificationContainer,
mBypassController); mBypassController);
when(mKeyguardStateController.isOccluded()).thenReturn(false);
mStatusBarKeyguardViewManager.show(null); mStatusBarKeyguardViewManager.show(null);
ArgumentCaptor<KeyguardBouncer.BouncerExpansionCallback> callbackArgumentCaptor = ArgumentCaptor<KeyguardBouncer.BouncerExpansionCallback> callbackArgumentCaptor =
ArgumentCaptor.forClass(KeyguardBouncer.BouncerExpansionCallback.class); ArgumentCaptor.forClass(KeyguardBouncer.BouncerExpansionCallback.class);
@@ -253,7 +253,7 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
@Test @Test
public void onPanelExpansionChanged_showsBouncerWhenSwiping() { public void onPanelExpansionChanged_showsBouncerWhenSwiping() {
when(mKeyguardStateController.canDismissLockScreen()).thenReturn(false); mKeyguardStateController.setCanDismissLockScreen(false);
mStatusBarKeyguardViewManager.onPanelExpansionChanged(EXPANSION_EVENT); mStatusBarKeyguardViewManager.onPanelExpansionChanged(EXPANSION_EVENT);
verify(mBouncer).show(eq(false), eq(false)); verify(mBouncer).show(eq(false), eq(false));
@@ -340,13 +340,12 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
} }
@Test @Test
public void setOccluded_onKeyguardOccludedChangedCalledCorrectly() { public void setOccluded_onKeyguardOccludedChangedCalled() {
clearInvocations(mKeyguardStateController); clearInvocations(mKeyguardStateController);
clearInvocations(mKeyguardUpdateMonitor); clearInvocations(mKeyguardUpdateMonitor);
// Should be false to start, so no invocations
mStatusBarKeyguardViewManager.setOccluded(false /* occluded */, false /* animated */); mStatusBarKeyguardViewManager.setOccluded(false /* occluded */, false /* animated */);
verify(mKeyguardStateController, never()).notifyKeyguardState(anyBoolean(), anyBoolean()); verify(mKeyguardStateController).notifyKeyguardState(true, false);
clearInvocations(mKeyguardUpdateMonitor); clearInvocations(mKeyguardUpdateMonitor);
clearInvocations(mKeyguardStateController); clearInvocations(mKeyguardStateController);
@@ -357,8 +356,8 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
clearInvocations(mKeyguardUpdateMonitor); clearInvocations(mKeyguardUpdateMonitor);
clearInvocations(mKeyguardStateController); clearInvocations(mKeyguardStateController);
mStatusBarKeyguardViewManager.setOccluded(true /* occluded */, false /* animated */); mStatusBarKeyguardViewManager.setOccluded(false /* occluded */, false /* animated */);
verify(mKeyguardStateController, never()).notifyKeyguardState(anyBoolean(), anyBoolean()); verify(mKeyguardStateController).notifyKeyguardState(true, false);
} }
@Test @Test
@@ -426,7 +425,7 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
when(mAlternateAuthInterceptor.isShowingAlternateAuthBouncer()).thenReturn(true); when(mAlternateAuthInterceptor.isShowingAlternateAuthBouncer()).thenReturn(true);
assertTrue( assertTrue(
"Is showing not accurate when alternative auth showing", "Is showing not accurate when alternative auth showing",
mStatusBarKeyguardViewManager.isShowing()); mStatusBarKeyguardViewManager.isBouncerShowing());
} }
@Test @Test