DO NOT MERGE Use KeyguardStateController for #isShowing am: e6e7b75d3b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20024905 Change-Id: I05942c9ed9fe20ded368fa2ed2ddbc70fdff047e Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -3178,14 +3178,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
|
||||
* Whether the keyguard is showing and not occluded.
|
||||
*/
|
||||
public boolean isKeyguardVisible() {
|
||||
return isKeyguardShowing() && !mKeyguardOccluded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the keyguard is showing. It may still be occluded and not visible.
|
||||
*/
|
||||
public boolean isKeyguardShowing() {
|
||||
return mKeyguardShowing;
|
||||
return mKeyguardShowing && !mKeyguardOccluded;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -93,11 +93,6 @@ public interface KeyguardViewController {
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
|
||||
@@ -219,7 +219,7 @@ public class UdfpsKeyguardViewController extends UdfpsAnimationViewController<Ud
|
||||
mView.animateInUdfpsBouncer(null);
|
||||
}
|
||||
|
||||
if (mKeyguardViewManager.isOccluded()) {
|
||||
if (mKeyguardStateController.isOccluded()) {
|
||||
mKeyguardUpdateMonitor.requestFaceAuthOnOccludingApp(true);
|
||||
}
|
||||
|
||||
|
||||
@@ -666,7 +666,7 @@ class KeyguardUnlockAnimationController @Inject constructor(
|
||||
return
|
||||
}
|
||||
|
||||
if (keyguardViewController.isShowing && !playingCannedUnlockAnimation) {
|
||||
if (keyguardStateController.isShowing && !playingCannedUnlockAnimation) {
|
||||
showOrHideSurfaceIfDismissAmountThresholdsReached()
|
||||
|
||||
// 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() {
|
||||
// no-op if keyguard is not showing or animation is not enabled.
|
||||
if (!KeyguardService.sEnableRemoteKeyguardGoingAwayAnimation ||
|
||||
!keyguardViewController.isShowing) {
|
||||
!keyguardStateController.isShowing) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -849,7 +849,7 @@ class KeyguardUnlockAnimationController @Inject constructor(
|
||||
* animation.
|
||||
*/
|
||||
fun hideKeyguardViewAfterRemoteAnimation() {
|
||||
if (keyguardViewController.isShowing) {
|
||||
if (keyguardStateController.isShowing) {
|
||||
// Hide the keyguard, with no fade out since we animated it away during the unlock.
|
||||
|
||||
keyguardViewController.hide(
|
||||
|
||||
@@ -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
|
||||
// to account for the hiding animation which results in a delay and discrepancy
|
||||
// between flags
|
||||
if (mShowing && mKeyguardViewControllerLazy.get().isShowing()) {
|
||||
if (mShowing && mKeyguardStateController.isShowing()) {
|
||||
if (DEBUG) Log.d(TAG, "doKeyguard: not showing because it is already showing");
|
||||
resetStateLocked();
|
||||
return;
|
||||
|
||||
@@ -48,7 +48,6 @@ import android.view.accessibility.AccessibilityManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.android.keyguard.KeyguardViewController;
|
||||
import com.android.systemui.Dumpable;
|
||||
import com.android.systemui.accessibility.AccessibilityButtonModeObserver;
|
||||
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.statusbar.phone.BarTransitions.TransitionMode;
|
||||
import com.android.systemui.statusbar.phone.CentralSurfaces;
|
||||
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
@@ -90,7 +90,7 @@ public final class NavBarHelper implements
|
||||
private final AccessibilityManager mAccessibilityManager;
|
||||
private final Lazy<AssistManager> mAssistManagerLazy;
|
||||
private final Lazy<Optional<CentralSurfaces>> mCentralSurfacesOptionalLazy;
|
||||
private final KeyguardViewController mKeyguardViewController;
|
||||
private final KeyguardStateController mKeyguardStateController;
|
||||
private final UserTracker mUserTracker;
|
||||
private final SystemActions mSystemActions;
|
||||
private final AccessibilityButtonModeObserver mAccessibilityButtonModeObserver;
|
||||
@@ -125,7 +125,7 @@ public final class NavBarHelper implements
|
||||
OverviewProxyService overviewProxyService,
|
||||
Lazy<AssistManager> assistManagerLazy,
|
||||
Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy,
|
||||
KeyguardViewController keyguardViewController,
|
||||
KeyguardStateController keyguardStateController,
|
||||
NavigationModeController navigationModeController,
|
||||
UserTracker userTracker,
|
||||
DumpManager dumpManager) {
|
||||
@@ -134,7 +134,7 @@ public final class NavBarHelper implements
|
||||
mAccessibilityManager = accessibilityManager;
|
||||
mAssistManagerLazy = assistManagerLazy;
|
||||
mCentralSurfacesOptionalLazy = centralSurfacesOptionalLazy;
|
||||
mKeyguardViewController = keyguardViewController;
|
||||
mKeyguardStateController = keyguardStateController;
|
||||
mUserTracker = userTracker;
|
||||
mSystemActions = systemActions;
|
||||
accessibilityManager.addAccessibilityServicesStateChangeListener(this);
|
||||
@@ -326,7 +326,7 @@ public final class NavBarHelper implements
|
||||
shadeWindowView =
|
||||
mCentralSurfacesOptionalLazy.get().get().getNotificationShadeWindowView();
|
||||
}
|
||||
boolean isKeyguardShowing = mKeyguardViewController.isShowing();
|
||||
boolean isKeyguardShowing = mKeyguardStateController.isShowing();
|
||||
boolean imeVisibleOnShade = shadeWindowView != null && shadeWindowView.isAttachedToWindow()
|
||||
&& shadeWindowView.getRootWindowInsets().isVisible(WindowInsets.Type.ime());
|
||||
return imeVisibleOnShade
|
||||
|
||||
@@ -4289,7 +4289,7 @@ public final class NotificationPanelViewController extends PanelViewController {
|
||||
}
|
||||
|
||||
if (event.getActionMasked() == MotionEvent.ACTION_DOWN && isFullyExpanded()
|
||||
&& mStatusBarKeyguardViewManager.isShowing()) {
|
||||
&& mKeyguardStateController.isShowing()) {
|
||||
mStatusBarKeyguardViewManager.updateKeyguardPosition(event.getX());
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.systemui.statusbar.notification;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.util.ArraySet;
|
||||
|
||||
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.statusbar.NotificationLockscreenUserManager;
|
||||
import com.android.systemui.statusbar.StatusBarState;
|
||||
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
|
||||
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@@ -43,7 +41,6 @@ public class DynamicPrivacyController implements KeyguardStateController.Callbac
|
||||
|
||||
private boolean mLastDynamicUnlocked;
|
||||
private boolean mCacheInvalid;
|
||||
@Nullable private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
|
||||
|
||||
@Inject
|
||||
DynamicPrivacyController(NotificationLockscreenUserManager notificationLockscreenUserManager,
|
||||
@@ -100,7 +97,7 @@ public class DynamicPrivacyController implements KeyguardStateController.Callbac
|
||||
* contents aren't revealed yet?
|
||||
*/
|
||||
public boolean isInLockedDownShade() {
|
||||
if (!isStatusBarKeyguardShowing() || !mKeyguardStateController.isMethodSecure()) {
|
||||
if (!mKeyguardStateController.isShowing() || !mKeyguardStateController.isMethodSecure()) {
|
||||
return false;
|
||||
}
|
||||
int state = mStateController.getState();
|
||||
@@ -113,16 +110,7 @@ public class DynamicPrivacyController implements KeyguardStateController.Callbac
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean isStatusBarKeyguardShowing() {
|
||||
return mStatusBarKeyguardViewManager != null && mStatusBarKeyguardViewManager.isShowing();
|
||||
}
|
||||
|
||||
public void setStatusBarKeyguardViewManager(
|
||||
StatusBarKeyguardViewManager statusBarKeyguardViewManager) {
|
||||
mStatusBarKeyguardViewManager = statusBarKeyguardViewManager;
|
||||
}
|
||||
|
||||
public interface Listener {
|
||||
void onDynamicPrivacyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,7 +163,6 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
|
||||
private PowerManager.WakeLock mWakeLock;
|
||||
private final com.android.systemui.shade.ShadeController mShadeController;
|
||||
private final KeyguardUpdateMonitor mUpdateMonitor;
|
||||
private final DozeParameters mDozeParameters;
|
||||
private final KeyguardStateController mKeyguardStateController;
|
||||
private final NotificationShadeWindowController mNotificationShadeWindowController;
|
||||
private final SessionTracker mSessionTracker;
|
||||
@@ -278,7 +277,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
|
||||
KeyguardStateController keyguardStateController, Handler handler,
|
||||
KeyguardUpdateMonitor keyguardUpdateMonitor,
|
||||
@Main Resources resources,
|
||||
KeyguardBypassController keyguardBypassController, DozeParameters dozeParameters,
|
||||
KeyguardBypassController keyguardBypassController,
|
||||
MetricsLogger metricsLogger, DumpManager dumpManager,
|
||||
PowerManager powerManager,
|
||||
NotificationMediaManager notificationMediaManager,
|
||||
@@ -294,7 +293,6 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
|
||||
mPowerManager = powerManager;
|
||||
mShadeController = shadeController;
|
||||
mUpdateMonitor = keyguardUpdateMonitor;
|
||||
mDozeParameters = dozeParameters;
|
||||
mUpdateMonitor.registerCallback(this);
|
||||
mMediaManager = notificationMediaManager;
|
||||
mLatencyTracker = latencyTracker;
|
||||
@@ -552,7 +550,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
|
||||
boolean deviceDreaming = mUpdateMonitor.isDreaming();
|
||||
|
||||
if (!mUpdateMonitor.isDeviceInteractive()) {
|
||||
if (!mKeyguardViewController.isShowing()
|
||||
if (!mKeyguardStateController.isShowing()
|
||||
&& !mScreenOffAnimationController.isKeyguardShowDelayed()) {
|
||||
if (mKeyguardStateController.isUnlocked()) {
|
||||
return MODE_WAKE_AND_UNLOCK;
|
||||
@@ -569,7 +567,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
|
||||
if (unlockingAllowed && deviceDreaming) {
|
||||
return MODE_WAKE_AND_UNLOCK_FROM_DREAM;
|
||||
}
|
||||
if (mKeyguardViewController.isShowing()) {
|
||||
if (mKeyguardStateController.isShowing()) {
|
||||
if (mKeyguardViewController.bouncerIsOrWillBeShowing() && unlockingAllowed) {
|
||||
return MODE_DISMISS_BOUNCER;
|
||||
} else if (unlockingAllowed) {
|
||||
@@ -588,7 +586,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
|
||||
boolean bypass = mKeyguardBypassController.getBypassEnabled()
|
||||
|| mAuthController.isUdfpsFingerDown();
|
||||
if (!mUpdateMonitor.isDeviceInteractive()) {
|
||||
if (!mKeyguardViewController.isShowing()) {
|
||||
if (!mKeyguardStateController.isShowing()) {
|
||||
return bypass ? MODE_WAKE_AND_UNLOCK : MODE_ONLY_WAKE;
|
||||
} else if (!unlockingAllowed) {
|
||||
return bypass ? MODE_SHOW_BOUNCER : MODE_NONE;
|
||||
@@ -612,7 +610,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback imp
|
||||
if (unlockingAllowed && mKeyguardStateController.isOccluded()) {
|
||||
return MODE_UNLOCK_COLLAPSING;
|
||||
}
|
||||
if (mKeyguardViewController.isShowing()) {
|
||||
if (mKeyguardStateController.isShowing()) {
|
||||
if ((mKeyguardViewController.bouncerIsOrWillBeShowing()
|
||||
|| mKeyguardBypassController.getAltBouncerShowing()) && unlockingAllowed) {
|
||||
return MODE_DISMISS_BOUNCER;
|
||||
|
||||
@@ -363,7 +363,7 @@ public class CentralSurfacesCommandQueueCallbacks implements CommandQueue.Callba
|
||||
mKeyguardUpdateMonitor.onCameraLaunched();
|
||||
}
|
||||
|
||||
if (!mStatusBarKeyguardViewManager.isShowing()) {
|
||||
if (!mKeyguardStateController.isShowing()) {
|
||||
final Intent cameraIntent = CameraIntents.getInsecureCameraIntent(mContext);
|
||||
mCentralSurfaces.startActivityDismissingKeyguard(cameraIntent,
|
||||
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
|
||||
// app-side haptic experimentation.
|
||||
|
||||
if (!mStatusBarKeyguardViewManager.isShowing()) {
|
||||
if (!mKeyguardStateController.isShowing()) {
|
||||
mCentralSurfaces.startActivityDismissingKeyguard(emergencyIntent,
|
||||
false /* onlyProvisioned */, true /* dismissShade */,
|
||||
true /* disallowEnterPictureInPictureWhileLaunching */, null /* callback */, 0,
|
||||
|
||||
@@ -476,7 +476,6 @@ public class CentralSurfacesImpl extends CoreStartable implements
|
||||
private final KeyguardStateController mKeyguardStateController;
|
||||
private final HeadsUpManagerPhone mHeadsUpManager;
|
||||
private final StatusBarTouchableRegionManager mStatusBarTouchableRegionManager;
|
||||
private final DynamicPrivacyController mDynamicPrivacyController;
|
||||
private final FalsingCollector mFalsingCollector;
|
||||
private final FalsingManager mFalsingManager;
|
||||
private final BroadcastDispatcher mBroadcastDispatcher;
|
||||
@@ -779,7 +778,6 @@ public class CentralSurfacesImpl extends CoreStartable implements
|
||||
mHeadsUpManager = headsUpManagerPhone;
|
||||
mKeyguardIndicationController = keyguardIndicationController;
|
||||
mStatusBarTouchableRegionManager = statusBarTouchableRegionManager;
|
||||
mDynamicPrivacyController = dynamicPrivacyController;
|
||||
mFalsingCollector = falsingCollector;
|
||||
mFalsingManager = falsingManager;
|
||||
mBroadcastDispatcher = broadcastDispatcher;
|
||||
@@ -1570,7 +1568,6 @@ public class CentralSurfacesImpl extends CoreStartable implements
|
||||
.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
|
||||
mBiometricUnlockController.setKeyguardViewController(mStatusBarKeyguardViewManager);
|
||||
mRemoteInputManager.addControllerCallback(mStatusBarKeyguardViewManager);
|
||||
mDynamicPrivacyController.setStatusBarKeyguardViewManager(mStatusBarKeyguardViewManager);
|
||||
|
||||
mLightBarController.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
|
||||
// the bouncer appear animation.
|
||||
if (!mStatusBarKeyguardViewManager.isShowing()) {
|
||||
if (!mKeyguardStateController.isShowing()) {
|
||||
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,
|
||||
// we do not launch the activity until keyguard is done.
|
||||
boolean occluded = mStatusBarKeyguardViewManager.isShowing()
|
||||
&& mStatusBarKeyguardViewManager.isOccluded();
|
||||
boolean occluded = mKeyguardStateController.isShowing()
|
||||
&& mKeyguardStateController.isOccluded();
|
||||
boolean deferred = !occluded;
|
||||
executeRunnableDismissingKeyguard(runnable, cancelRunnable, dismissShadeDirectly,
|
||||
willLaunchResolverActivity, deferred /* deferred */, animate);
|
||||
@@ -2590,8 +2587,8 @@ public class CentralSurfacesImpl extends CoreStartable implements
|
||||
@Override
|
||||
public boolean onDismiss() {
|
||||
if (runnable != null) {
|
||||
if (mStatusBarKeyguardViewManager.isShowing()
|
||||
&& mStatusBarKeyguardViewManager.isOccluded()) {
|
||||
if (mKeyguardStateController.isShowing()
|
||||
&& mKeyguardStateController.isOccluded()) {
|
||||
mStatusBarKeyguardViewManager.addAfterKeyguardGoneRunnable(runnable);
|
||||
} else {
|
||||
mMainExecutor.execute(runnable);
|
||||
@@ -2685,7 +2682,7 @@ public class CentralSurfacesImpl extends CoreStartable implements
|
||||
|
||||
private void executeWhenUnlocked(OnDismissAction action, boolean requiresShadeOpen,
|
||||
boolean afterKeyguardGone) {
|
||||
if (mStatusBarKeyguardViewManager.isShowing() && requiresShadeOpen) {
|
||||
if (mKeyguardStateController.isShowing() && requiresShadeOpen) {
|
||||
mStatusBarStateController.setLeaveOpenOnKeyguardHide(true);
|
||||
}
|
||||
dismissKeyguardThenExecute(action, null /* cancelAction */,
|
||||
@@ -2709,7 +2706,7 @@ public class CentralSurfacesImpl extends CoreStartable implements
|
||||
mBiometricUnlockController.startWakeAndUnlock(
|
||||
BiometricUnlockController.MODE_WAKE_AND_UNLOCK_PULSING);
|
||||
}
|
||||
if (mStatusBarKeyguardViewManager.isShowing()) {
|
||||
if (mKeyguardStateController.isShowing()) {
|
||||
mStatusBarKeyguardViewManager.dismissWithAction(action, cancelAction,
|
||||
afterKeyguardGone);
|
||||
} else {
|
||||
@@ -2845,8 +2842,8 @@ public class CentralSurfacesImpl extends CoreStartable implements
|
||||
}
|
||||
|
||||
private void logStateToEventlog() {
|
||||
boolean isShowing = mStatusBarKeyguardViewManager.isShowing();
|
||||
boolean isOccluded = mStatusBarKeyguardViewManager.isOccluded();
|
||||
boolean isShowing = mKeyguardStateController.isShowing();
|
||||
boolean isOccluded = mKeyguardStateController.isOccluded();
|
||||
boolean isBouncerShowing = mStatusBarKeyguardViewManager.isBouncerShowing();
|
||||
boolean isSecure = mKeyguardStateController.isMethodSecure();
|
||||
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.beginSection("CentralSurfaces#updateDozingState");
|
||||
|
||||
boolean visibleNotOccluded = mStatusBarKeyguardViewManager.isShowing()
|
||||
&& !mStatusBarKeyguardViewManager.isOccluded();
|
||||
boolean keyguardVisible = mKeyguardStateController.isVisible();
|
||||
// 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.
|
||||
boolean visibleNotOccludedOrWillBe =
|
||||
visibleNotOccluded || (mDozing && mDozeParameters.shouldDelayKeyguardShow());
|
||||
boolean keyguardVisibleOrWillBe =
|
||||
keyguardVisible || (mDozing && mDozeParameters.shouldDelayKeyguardShow());
|
||||
|
||||
boolean wakeAndUnlock = mBiometricUnlockController.getMode()
|
||||
== BiometricUnlockController.MODE_WAKE_AND_UNLOCK;
|
||||
boolean animate = (!mDozing && mDozeServiceHost.shouldAnimateWakeup() && !wakeAndUnlock)
|
||||
|| (mDozing && mDozeParameters.shouldControlScreenOff()
|
||||
&& visibleNotOccludedOrWillBe);
|
||||
&& keyguardVisibleOrWillBe);
|
||||
|
||||
mNotificationPanelViewController.setDozing(mDozing, animate);
|
||||
updateQsExpansionEnabled();
|
||||
@@ -3935,11 +3931,7 @@ public class CentralSurfacesImpl extends CoreStartable implements
|
||||
|
||||
@Override
|
||||
public boolean isKeyguardShowing() {
|
||||
if (mStatusBarKeyguardViewManager == null) {
|
||||
Slog.i(TAG, "isKeyguardShowing() called before startKeyguard(), returning true");
|
||||
return true;
|
||||
}
|
||||
return mStatusBarKeyguardViewManager.isShowing();
|
||||
return mKeyguardStateController.isShowing();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -229,8 +229,6 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
private View mNotificationContainer;
|
||||
|
||||
@Nullable protected KeyguardBouncer mBouncer;
|
||||
protected boolean mShowing;
|
||||
protected boolean mOccluded;
|
||||
protected boolean mRemoteInputActive;
|
||||
private boolean mGlobalActionsVisible = false;
|
||||
private boolean mLastGlobalActionsVisible = false;
|
||||
@@ -277,10 +275,9 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
new KeyguardUpdateMonitorCallback() {
|
||||
@Override
|
||||
public void onEmergencyCallAction() {
|
||||
|
||||
// Since we won't get a setOccluded call we have to reset the view manually such that
|
||||
// the bouncer goes away.
|
||||
if (mOccluded) {
|
||||
if (mKeyguardStateController.isOccluded()) {
|
||||
reset(true /* hideBouncerWhenShowing */);
|
||||
}
|
||||
}
|
||||
@@ -479,7 +476,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
} else {
|
||||
mBouncerInteractor.setExpansion(KeyguardBouncer.EXPANSION_VISIBLE);
|
||||
}
|
||||
} else if (mShowing && !hideBouncerOverDream) {
|
||||
} else if (mKeyguardStateController.isShowing() && !hideBouncerOverDream) {
|
||||
if (!isWakeAndUnlocking()
|
||||
&& !(mBiometricUnlockController.getMode() == MODE_DISMISS_BOUNCER)
|
||||
&& !mCentralSurfaces.isInLaunchTransition()
|
||||
@@ -500,7 +497,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
mBouncerInteractor.show(/* isScrimmed= */false);
|
||||
}
|
||||
}
|
||||
} else if (!mShowing && isBouncerInTransit()) {
|
||||
} else if (!mKeyguardStateController.isShowing() && isBouncerInTransit()) {
|
||||
// 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) {
|
||||
@@ -533,9 +530,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
@Override
|
||||
public void show(Bundle options) {
|
||||
Trace.beginSection("StatusBarKeyguardViewManager#show");
|
||||
mShowing = true;
|
||||
mNotificationShadeWindowController.setKeyguardShowing(true);
|
||||
mKeyguardStateController.notifyKeyguardState(mShowing,
|
||||
mKeyguardStateController.notifyKeyguardState(true,
|
||||
mKeyguardStateController.isOccluded());
|
||||
reset(true /* hideBouncerWhenShowing */);
|
||||
SysUiStatsLog.write(SysUiStatsLog.KEYGUARD_STATE_CHANGED,
|
||||
@@ -599,7 +595,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
} else {
|
||||
mBouncerInteractor.hide();
|
||||
}
|
||||
if (mShowing) {
|
||||
if (mKeyguardStateController.isShowing()) {
|
||||
// If we were showing the bouncer and then aborting, we need to also clear out any
|
||||
// potential actions unless we actually unlocked.
|
||||
cancelPostAuthActions();
|
||||
@@ -616,7 +612,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
public void showBouncer(boolean scrimmed) {
|
||||
resetAlternateAuth(false);
|
||||
|
||||
if (mShowing && !isBouncerShowing()) {
|
||||
if (mKeyguardStateController.isShowing() && !isBouncerShowing()) {
|
||||
if (mBouncer != null) {
|
||||
mBouncer.show(false /* resetSecuritySelection */, scrimmed);
|
||||
} else {
|
||||
@@ -633,7 +629,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
|
||||
public void dismissWithAction(OnDismissAction r, Runnable cancelAction,
|
||||
boolean afterKeyguardGone, String message) {
|
||||
if (mShowing) {
|
||||
if (mKeyguardStateController.isShowing()) {
|
||||
try {
|
||||
Trace.beginSection("StatusBarKeyguardViewManager#dismissWithAction");
|
||||
cancelPendingWakeupAction();
|
||||
@@ -719,11 +715,12 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
|
||||
@Override
|
||||
public void reset(boolean hideBouncerWhenShowing) {
|
||||
if (mShowing) {
|
||||
if (mKeyguardStateController.isShowing()) {
|
||||
final boolean isOccluded = mKeyguardStateController.isOccluded();
|
||||
// Hide quick settings.
|
||||
mNotificationPanelViewController.resetViews(/* animate= */ !mOccluded);
|
||||
mNotificationPanelViewController.resetViews(/* animate= */ !isOccluded);
|
||||
// Hide bouncer and quick-quick settings.
|
||||
if (mOccluded && !mDozing) {
|
||||
if (isOccluded && !mDozing) {
|
||||
mCentralSurfaces.hideKeyguard();
|
||||
if (hideBouncerWhenShowing || needsFullscreenBouncer()) {
|
||||
hideBouncer(false /* destroyView */);
|
||||
@@ -805,7 +802,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
private void setDozing(boolean dozing) {
|
||||
if (mDozing != dozing) {
|
||||
mDozing = dozing;
|
||||
if (dozing || mBouncer.needsFullscreenBouncer() || mOccluded) {
|
||||
if (dozing || mBouncer.needsFullscreenBouncer()
|
||||
|| mKeyguardStateController.isOccluded()) {
|
||||
reset(dozing /* hideBouncerWhenShowing */);
|
||||
}
|
||||
updateStates();
|
||||
@@ -838,18 +836,23 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
|
||||
@Override
|
||||
public void setOccluded(boolean occluded, boolean animate) {
|
||||
final boolean isOccluding = !mOccluded && occluded;
|
||||
final boolean isUnOccluding = mOccluded && !occluded;
|
||||
setOccludedAndUpdateStates(occluded);
|
||||
final boolean wasOccluded = mKeyguardStateController.isOccluded();
|
||||
final boolean isOccluding = !wasOccluded && 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.KEYGUARD_STATE_CHANGED__STATE__OCCLUDED);
|
||||
if (mCentralSurfaces.isInLaunchTransition()) {
|
||||
final Runnable endRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mNotificationShadeWindowController.setKeyguardOccluded(mOccluded);
|
||||
mNotificationShadeWindowController.setKeyguardOccluded(isOccluded);
|
||||
reset(true /* hideBouncerWhenShowing */);
|
||||
}
|
||||
};
|
||||
@@ -864,19 +867,19 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
// When isLaunchingActivityOverLockscreen() is true, we know for sure that the post
|
||||
// collapse runnables will be run.
|
||||
mShadeController.get().addPostCollapseAction(() -> {
|
||||
mNotificationShadeWindowController.setKeyguardOccluded(mOccluded);
|
||||
mNotificationShadeWindowController.setKeyguardOccluded(isOccluded);
|
||||
reset(true /* hideBouncerWhenShowing */);
|
||||
});
|
||||
return;
|
||||
}
|
||||
} else if (mShowing && isUnOccluding) {
|
||||
} else if (isShowing && isUnOccluding) {
|
||||
SysUiStatsLog.write(SysUiStatsLog.KEYGUARD_STATE_CHANGED,
|
||||
SysUiStatsLog.KEYGUARD_STATE_CHANGED__STATE__SHOWN);
|
||||
}
|
||||
if (mShowing) {
|
||||
mMediaManager.updateMediaMetaData(false, animate && !mOccluded);
|
||||
if (isShowing) {
|
||||
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
|
||||
// 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.
|
||||
reset(isOccluding /* hideBouncerWhenShowing*/);
|
||||
}
|
||||
if (animate && !mOccluded && mShowing && !bouncerIsShowing()) {
|
||||
if (animate && !isOccluded && isShowing && !bouncerIsShowing()) {
|
||||
mCentralSurfaces.animateKeyguardUnoccluding();
|
||||
}
|
||||
}
|
||||
|
||||
private void setOccludedAndUpdateStates(boolean occluded) {
|
||||
mOccluded = occluded;
|
||||
updateStates();
|
||||
}
|
||||
|
||||
public boolean isOccluded() {
|
||||
return mOccluded;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startPreHideAnimation(Runnable finishRunnable) {
|
||||
if (bouncerIsShowing()) {
|
||||
@@ -930,8 +924,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
@Override
|
||||
public void hide(long startTime, long fadeoutDuration) {
|
||||
Trace.beginSection("StatusBarKeyguardViewManager#hide");
|
||||
mShowing = false;
|
||||
mKeyguardStateController.notifyKeyguardState(mShowing,
|
||||
mKeyguardStateController.notifyKeyguardState(false,
|
||||
mKeyguardStateController.isOccluded());
|
||||
launchPendingWakeupAction();
|
||||
|
||||
@@ -1080,11 +1073,6 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
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
|
||||
* is currently showing (which itself is derived from multiple states).
|
||||
@@ -1187,8 +1175,8 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
};
|
||||
|
||||
protected void updateStates() {
|
||||
boolean showing = mShowing;
|
||||
boolean occluded = mOccluded;
|
||||
boolean showing = mKeyguardStateController.isShowing();
|
||||
boolean occluded = mKeyguardStateController.isOccluded();
|
||||
boolean bouncerShowing = bouncerIsShowing();
|
||||
boolean bouncerIsOrWillBeShowing = bouncerIsOrWillBeShowing();
|
||||
boolean bouncerDismissible = !isFullscreenBouncer();
|
||||
@@ -1222,13 +1210,6 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
mNotificationShadeWindowController.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
|
||||
|| bouncerShowing != mLastBouncerShowing) {
|
||||
mKeyguardUpdateManager.sendKeyguardBouncerChanged(bouncerIsOrWillBeShowing,
|
||||
@@ -1279,12 +1260,12 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
public boolean isNavBarVisible() {
|
||||
boolean isWakeAndUnlockPulsing = mBiometricUnlockController != null
|
||||
&& mBiometricUnlockController.getMode() == MODE_WAKE_AND_UNLOCK_PULSING;
|
||||
boolean keyguardShowing = mShowing && !mOccluded;
|
||||
boolean keyguardVisible = mKeyguardStateController.isVisible();
|
||||
boolean hideWhileDozing = mDozing && !isWakeAndUnlockPulsing;
|
||||
boolean keyguardWithGestureNav = (keyguardShowing && !mDozing && !mScreenOffAnimationPlaying
|
||||
boolean keyguardWithGestureNav = (keyguardVisible && !mDozing && !mScreenOffAnimationPlaying
|
||||
|| mPulsing && !mIsDocked)
|
||||
&& mGesturalNav;
|
||||
return (!keyguardShowing && !hideWhileDozing && !mScreenOffAnimationPlaying
|
||||
return (!keyguardVisible && !hideWhileDozing && !mScreenOffAnimationPlaying
|
||||
|| bouncerIsShowing()
|
||||
|| mRemoteInputActive
|
||||
|| keyguardWithGestureNav
|
||||
@@ -1416,7 +1397,7 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
DismissWithActionRequest request = mPendingWakeupAction;
|
||||
mPendingWakeupAction = null;
|
||||
if (request != null) {
|
||||
if (mShowing) {
|
||||
if (mKeyguardStateController.isShowing()) {
|
||||
dismissWithAction(request.dismissAction, request.cancelAction,
|
||||
request.afterKeyguardGone, request.message);
|
||||
} else if (request.dismissAction != null) {
|
||||
@@ -1435,10 +1416,10 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
|
||||
public boolean bouncerNeedsScrimming() {
|
||||
// When a dream overlay is active, scrimming will cause any expansion to immediately expand.
|
||||
return (mOccluded && !mDreamOverlayStateController.isOverlayActive())
|
||||
return (mKeyguardStateController.isOccluded()
|
||||
&& !mDreamOverlayStateController.isOverlayActive())
|
||||
|| bouncerWillDismissWithAction()
|
||||
|| (bouncerIsShowing()
|
||||
&& bouncerIsScrimmed())
|
||||
|| (bouncerIsShowing() && bouncerIsScrimmed())
|
||||
|| isFullscreenBouncer();
|
||||
}
|
||||
|
||||
@@ -1457,8 +1438,6 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
|
||||
|
||||
public void dump(PrintWriter pw) {
|
||||
pw.println("StatusBarKeyguardViewManager:");
|
||||
pw.println(" mShowing: " + mShowing);
|
||||
pw.println(" mOccluded: " + mOccluded);
|
||||
pw.println(" mRemoteInputActive: " + mRemoteInputActive);
|
||||
pw.println(" mDozing: " + mDozing);
|
||||
pw.println(" mAfterKeyguardGoneAction: " + mAfterKeyguardGoneAction);
|
||||
|
||||
@@ -35,9 +35,16 @@ public interface KeyguardStateController extends CallbackController<Callback> {
|
||||
}
|
||||
|
||||
/**
|
||||
* If the lock screen is visible.
|
||||
* 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.
|
||||
* If the keyguard is visible. This is unrelated to being locked or not.
|
||||
*/
|
||||
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.
|
||||
*
|
||||
|
||||
@@ -181,6 +181,7 @@ public class KeyguardStateControllerImpl implements KeyguardStateController, Dum
|
||||
if (mShowing == showing && mOccluded == occluded) return;
|
||||
mShowing = showing;
|
||||
mOccluded = occluded;
|
||||
mKeyguardUpdateMonitor.setKeyguardShowing(showing, occluded);
|
||||
Trace.instantForTrack(Trace.TRACE_TAG_APP, "UI Events",
|
||||
"Keyguard showing: " + showing + " occluded: " + occluded);
|
||||
notifyKeyguardChanged();
|
||||
@@ -387,6 +388,8 @@ public class KeyguardStateControllerImpl implements KeyguardStateController, Dum
|
||||
@Override
|
||||
public void dump(PrintWriter pw, String[] args) {
|
||||
pw.println("KeyguardStateController:");
|
||||
pw.println(" mShowing: " + mShowing);
|
||||
pw.println(" mOccluded: " + mOccluded);
|
||||
pw.println(" mSecure: " + mSecure);
|
||||
pw.println(" mCanDismissLockScreen: " + mCanDismissLockScreen);
|
||||
pw.println(" mTrustManaged: " + mTrustManaged);
|
||||
|
||||
@@ -176,7 +176,7 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
|
||||
|
||||
// and the keyguard goes away
|
||||
mViewMediator.setShowingLocked(false);
|
||||
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(false);
|
||||
when(mKeyguardStateController.isShowing()).thenReturn(false);
|
||||
mViewMediator.mUpdateCallback.onKeyguardVisibilityChanged(false);
|
||||
|
||||
TestableLooper.get(this).processAllMessages();
|
||||
@@ -201,7 +201,7 @@ public class KeyguardViewMediatorTest extends SysuiTestCase {
|
||||
|
||||
// and the keyguard goes away
|
||||
mViewMediator.setShowingLocked(false);
|
||||
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(false);
|
||||
when(mKeyguardStateController.isShowing()).thenReturn(false);
|
||||
mViewMediator.mUpdateCallback.onKeyguardVisibilityChanged(false);
|
||||
|
||||
TestableLooper.get(this).processAllMessages();
|
||||
|
||||
@@ -39,7 +39,6 @@ import android.view.accessibility.AccessibilityManager;
|
||||
import androidx.test.filters.SmallTest;
|
||||
import androidx.test.runner.AndroidJUnit4;
|
||||
|
||||
import com.android.keyguard.KeyguardViewController;
|
||||
import com.android.systemui.SysuiTestCase;
|
||||
import com.android.systemui.accessibility.AccessibilityButtonModeObserver;
|
||||
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.settings.UserTracker;
|
||||
import com.android.systemui.statusbar.phone.CentralSurfaces;
|
||||
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -113,7 +113,7 @@ public class NavBarHelperTest extends SysuiTestCase {
|
||||
mNavBarHelper = new NavBarHelper(mContext, mAccessibilityManager,
|
||||
mAccessibilityButtonModeObserver, mAccessibilityButtonTargetObserver,
|
||||
mSystemActions, mOverviewProxyService, mAssistManagerLazy,
|
||||
() -> Optional.of(mock(CentralSurfaces.class)), mock(KeyguardViewController.class),
|
||||
() -> Optional.of(mock(CentralSurfaces.class)), mock(KeyguardStateController.class),
|
||||
mNavigationModeController, mUserTracker, mDumpManager);
|
||||
|
||||
}
|
||||
|
||||
@@ -72,7 +72,6 @@ import androidx.test.filters.SmallTest;
|
||||
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
import com.android.internal.logging.UiEventLogger;
|
||||
import com.android.keyguard.KeyguardViewController;
|
||||
import com.android.systemui.SysuiTestCase;
|
||||
import com.android.systemui.SysuiTestableContext;
|
||||
import com.android.systemui.accessibility.AccessibilityButtonModeObserver;
|
||||
@@ -194,7 +193,7 @@ public class NavigationBarTest extends SysuiTestCase {
|
||||
@Mock
|
||||
private CentralSurfaces mCentralSurfaces;
|
||||
@Mock
|
||||
private KeyguardViewController mKeyguardViewController;
|
||||
private KeyguardStateController mKeyguardStateController;
|
||||
@Mock
|
||||
private UserContextProvider mUserContextProvider;
|
||||
@Mock
|
||||
@@ -240,7 +239,7 @@ public class NavigationBarTest extends SysuiTestCase {
|
||||
mock(AccessibilityButtonTargetsObserver.class),
|
||||
mSystemActions, mOverviewProxyService,
|
||||
() -> mock(AssistManager.class), () -> Optional.of(mCentralSurfaces),
|
||||
mKeyguardViewController, mock(NavigationModeController.class),
|
||||
mKeyguardStateController, mock(NavigationModeController.class),
|
||||
mock(UserTracker.class), mock(DumpManager.class)));
|
||||
mNavigationBar = createNavBar(mContext);
|
||||
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
|
||||
// requesting IME insets visible.
|
||||
doReturn(true).when(mKeyguardViewController).isShowing();
|
||||
doReturn(true).when(mKeyguardStateController).isShowing();
|
||||
mNavigationBar.setImeWindowStatus(DEFAULT_DISPLAY, null, IME_VISIBLE,
|
||||
BACK_DISPOSITION_DEFAULT, true);
|
||||
assertFalse((mNavigationBar.getNavigationIconHints() & NAVIGATION_HINT_BACK_ALT) != 0);
|
||||
|
||||
@@ -32,7 +32,6 @@ import android.testing.TestableLooper;
|
||||
import com.android.systemui.SysuiTestCase;
|
||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
|
||||
import com.android.systemui.statusbar.phone.StatusBarKeyguardViewManager;
|
||||
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
||||
|
||||
import org.junit.Assert;
|
||||
@@ -58,8 +57,6 @@ public class DynamicPrivacyControllerTest extends SysuiTestCase {
|
||||
mDynamicPrivacyController = new DynamicPrivacyController(
|
||||
mLockScreenUserManager, mKeyguardStateController,
|
||||
mock(StatusBarStateController.class));
|
||||
mDynamicPrivacyController.setStatusBarKeyguardViewManager(
|
||||
mock(StatusBarKeyguardViewManager.class));
|
||||
mDynamicPrivacyController.addListener(mListener);
|
||||
// Disable dynamic privacy by default
|
||||
allowNotificationsInPublic(false);
|
||||
|
||||
@@ -100,8 +100,6 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
|
||||
@Mock
|
||||
private AuthController mAuthController;
|
||||
@Mock
|
||||
private DozeParameters mDozeParameters;
|
||||
@Mock
|
||||
private MetricsLogger mMetricsLogger;
|
||||
@Mock
|
||||
private NotificationMediaManager mNotificationMediaManager;
|
||||
@@ -127,7 +125,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
|
||||
public void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
TestableResources res = getContext().getOrCreateTestableResources();
|
||||
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true);
|
||||
when(mKeyguardStateController.isShowing()).thenReturn(true);
|
||||
when(mUpdateMonitor.isDeviceInteractive()).thenReturn(true);
|
||||
when(mKeyguardStateController.isFaceAuthEnabled()).thenReturn(true);
|
||||
when(mKeyguardStateController.isUnlocked()).thenReturn(false);
|
||||
@@ -139,7 +137,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
|
||||
mBiometricUnlockController = new BiometricUnlockController(mDozeScrimController,
|
||||
mKeyguardViewMediator, mScrimController, mShadeController,
|
||||
mNotificationShadeWindowController, mKeyguardStateController, mHandler,
|
||||
mUpdateMonitor, res.getResources(), mKeyguardBypassController, mDozeParameters,
|
||||
mUpdateMonitor, res.getResources(), mKeyguardBypassController,
|
||||
mMetricsLogger, mDumpManager, mPowerManager,
|
||||
mNotificationMediaManager, mWakefulnessLifecycle, mScreenLifecycle,
|
||||
mAuthController, mStatusBarStateController, mKeyguardUnlockAnimationController,
|
||||
@@ -177,7 +175,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
|
||||
public void onBiometricAuthenticated_whenFingerprintAndNotInteractive_wakeAndUnlock() {
|
||||
reset(mUpdateMonitor);
|
||||
reset(mStatusBarKeyguardViewManager);
|
||||
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true);
|
||||
when(mKeyguardStateController.isShowing()).thenReturn(true);
|
||||
when(mUpdateMonitor.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(true);
|
||||
when(mDozeScrimController.isPulsing()).thenReturn(true);
|
||||
// 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() {
|
||||
reset(mUpdateMonitor);
|
||||
reset(mStatusBarKeyguardViewManager);
|
||||
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(false);
|
||||
when(mKeyguardStateController.isShowing()).thenReturn(false);
|
||||
when(mKeyguardStateController.isUnlocked()).thenReturn(true);
|
||||
when(mUpdateMonitor.isUnlockingWithBiometricAllowed(anyBoolean())).thenReturn(true);
|
||||
when(mDozeScrimController.isPulsing()).thenReturn(false);
|
||||
|
||||
@@ -516,32 +516,32 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
|
||||
|
||||
@Test
|
||||
public void executeRunnableDismissingKeyguard_nullRunnable_showingAndOccluded() {
|
||||
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true);
|
||||
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(true);
|
||||
when(mKeyguardStateController.isShowing()).thenReturn(true);
|
||||
when(mKeyguardStateController.isOccluded()).thenReturn(true);
|
||||
|
||||
mCentralSurfaces.executeRunnableDismissingKeyguard(null, null, false, false, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void executeRunnableDismissingKeyguard_nullRunnable_showing() {
|
||||
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true);
|
||||
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false);
|
||||
when(mKeyguardStateController.isShowing()).thenReturn(true);
|
||||
when(mKeyguardStateController.isOccluded()).thenReturn(false);
|
||||
|
||||
mCentralSurfaces.executeRunnableDismissingKeyguard(null, null, false, false, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void executeRunnableDismissingKeyguard_nullRunnable_notShowing() {
|
||||
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(false);
|
||||
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false);
|
||||
when(mKeyguardStateController.isShowing()).thenReturn(false);
|
||||
when(mKeyguardStateController.isOccluded()).thenReturn(false);
|
||||
|
||||
mCentralSurfaces.executeRunnableDismissingKeyguard(null, null, false, false, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void executeRunnableDismissingKeyguard_dreaming_notShowing() throws RemoteException {
|
||||
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(false);
|
||||
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false);
|
||||
when(mKeyguardStateController.isShowing()).thenReturn(false);
|
||||
when(mKeyguardStateController.isOccluded()).thenReturn(false);
|
||||
when(mKeyguardUpdateMonitor.isDreaming()).thenReturn(true);
|
||||
|
||||
mCentralSurfaces.executeRunnableDismissingKeyguard(() -> {},
|
||||
@@ -555,8 +555,8 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
|
||||
|
||||
@Test
|
||||
public void executeRunnableDismissingKeyguard_notDreaming_notShowing() throws RemoteException {
|
||||
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(false);
|
||||
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false);
|
||||
when(mKeyguardStateController.isShowing()).thenReturn(false);
|
||||
when(mKeyguardStateController.isOccluded()).thenReturn(false);
|
||||
when(mKeyguardUpdateMonitor.isDreaming()).thenReturn(false);
|
||||
|
||||
mCentralSurfaces.executeRunnableDismissingKeyguard(() -> {},
|
||||
@@ -571,10 +571,10 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
|
||||
@Test
|
||||
public void lockscreenStateMetrics_notShowing() {
|
||||
// uninteresting state, except that fingerprint must be non-zero
|
||||
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false);
|
||||
when(mKeyguardStateController.isOccluded()).thenReturn(false);
|
||||
when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true);
|
||||
// interesting state
|
||||
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(false);
|
||||
when(mKeyguardStateController.isShowing()).thenReturn(false);
|
||||
when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(false);
|
||||
when(mKeyguardStateController.isMethodSecure()).thenReturn(false);
|
||||
mCentralSurfaces.onKeyguardViewManagerStatesUpdated();
|
||||
@@ -589,10 +589,10 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
|
||||
@Test
|
||||
public void lockscreenStateMetrics_notShowing_secure() {
|
||||
// uninteresting state, except that fingerprint must be non-zero
|
||||
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false);
|
||||
when(mKeyguardStateController.isOccluded()).thenReturn(false);
|
||||
when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true);
|
||||
// interesting state
|
||||
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(false);
|
||||
when(mKeyguardStateController.isShowing()).thenReturn(false);
|
||||
when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(false);
|
||||
when(mKeyguardStateController.isMethodSecure()).thenReturn(true);
|
||||
|
||||
@@ -608,10 +608,10 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
|
||||
@Test
|
||||
public void lockscreenStateMetrics_isShowing() {
|
||||
// uninteresting state, except that fingerprint must be non-zero
|
||||
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false);
|
||||
when(mKeyguardStateController.isOccluded()).thenReturn(false);
|
||||
when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true);
|
||||
// interesting state
|
||||
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true);
|
||||
when(mKeyguardStateController.isShowing()).thenReturn(true);
|
||||
when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(false);
|
||||
when(mKeyguardStateController.isMethodSecure()).thenReturn(false);
|
||||
|
||||
@@ -627,10 +627,10 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
|
||||
@Test
|
||||
public void lockscreenStateMetrics_isShowing_secure() {
|
||||
// uninteresting state, except that fingerprint must be non-zero
|
||||
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false);
|
||||
when(mKeyguardStateController.isOccluded()).thenReturn(false);
|
||||
when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true);
|
||||
// interesting state
|
||||
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true);
|
||||
when(mKeyguardStateController.isShowing()).thenReturn(true);
|
||||
when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(false);
|
||||
when(mKeyguardStateController.isMethodSecure()).thenReturn(true);
|
||||
|
||||
@@ -646,10 +646,10 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
|
||||
@Test
|
||||
public void lockscreenStateMetrics_isShowingBouncer() {
|
||||
// uninteresting state, except that fingerprint must be non-zero
|
||||
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(false);
|
||||
when(mKeyguardStateController.isOccluded()).thenReturn(false);
|
||||
when(mKeyguardStateController.canDismissLockScreen()).thenReturn(true);
|
||||
// interesting state
|
||||
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true);
|
||||
when(mKeyguardStateController.isShowing()).thenReturn(true);
|
||||
when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(true);
|
||||
when(mKeyguardStateController.isMethodSecure()).thenReturn(true);
|
||||
|
||||
@@ -1053,9 +1053,9 @@ public class CentralSurfacesImplTest extends SysuiTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void startActivityDismissingKeyguard_isShowingandIsOccluded() {
|
||||
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true);
|
||||
when(mStatusBarKeyguardViewManager.isOccluded()).thenReturn(true);
|
||||
public void startActivityDismissingKeyguard_isShowingAndIsOccluded() {
|
||||
when(mKeyguardStateController.isShowing()).thenReturn(true);
|
||||
when(mKeyguardStateController.isOccluded()).thenReturn(true);
|
||||
mCentralSurfaces.startActivityDismissingKeyguard(
|
||||
new Intent(),
|
||||
/* onlyProvisioned = */false,
|
||||
|
||||
@@ -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) {
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@ import static org.mockito.Mockito.clearInvocations;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.reset;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
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.PanelExpansionStateManager;
|
||||
import com.android.systemui.statusbar.policy.ConfigurationController;
|
||||
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
||||
import com.android.systemui.unfold.SysUIUnfoldComponent;
|
||||
|
||||
import com.google.common.truth.Truth;
|
||||
@@ -94,7 +94,6 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
|
||||
|
||||
@Mock private ViewMediatorCallback mViewMediatorCallback;
|
||||
@Mock private LockPatternUtils mLockPatternUtils;
|
||||
@Mock private KeyguardStateController mKeyguardStateController;
|
||||
@Mock private CentralSurfaces mCentralSurfaces;
|
||||
@Mock private ViewGroup mContainer;
|
||||
@Mock private NotificationPanelViewController mNotificationPanelView;
|
||||
@@ -123,6 +122,8 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
|
||||
|
||||
private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
|
||||
private KeyguardBouncer.BouncerExpansionCallback mBouncerExpansionCallback;
|
||||
private FakeKeyguardStateController mKeyguardStateController =
|
||||
spy(new FakeKeyguardStateController());
|
||||
|
||||
@Mock private ViewRootImpl mViewRootImpl;
|
||||
@Mock private WindowOnBackInvokedDispatcher mOnBackInvokedDispatcher;
|
||||
@@ -180,7 +181,6 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
|
||||
mBiometricUnlockController,
|
||||
mNotificationContainer,
|
||||
mBypassController);
|
||||
when(mKeyguardStateController.isOccluded()).thenReturn(false);
|
||||
mStatusBarKeyguardViewManager.show(null);
|
||||
ArgumentCaptor<KeyguardBouncer.BouncerExpansionCallback> callbackArgumentCaptor =
|
||||
ArgumentCaptor.forClass(KeyguardBouncer.BouncerExpansionCallback.class);
|
||||
@@ -253,7 +253,7 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
|
||||
|
||||
@Test
|
||||
public void onPanelExpansionChanged_showsBouncerWhenSwiping() {
|
||||
when(mKeyguardStateController.canDismissLockScreen()).thenReturn(false);
|
||||
mKeyguardStateController.setCanDismissLockScreen(false);
|
||||
mStatusBarKeyguardViewManager.onPanelExpansionChanged(EXPANSION_EVENT);
|
||||
verify(mBouncer).show(eq(false), eq(false));
|
||||
|
||||
@@ -340,13 +340,12 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setOccluded_onKeyguardOccludedChangedCalledCorrectly() {
|
||||
public void setOccluded_onKeyguardOccludedChangedCalled() {
|
||||
clearInvocations(mKeyguardStateController);
|
||||
clearInvocations(mKeyguardUpdateMonitor);
|
||||
|
||||
// Should be false to start, so no invocations
|
||||
mStatusBarKeyguardViewManager.setOccluded(false /* occluded */, false /* animated */);
|
||||
verify(mKeyguardStateController, never()).notifyKeyguardState(anyBoolean(), anyBoolean());
|
||||
verify(mKeyguardStateController).notifyKeyguardState(true, false);
|
||||
|
||||
clearInvocations(mKeyguardUpdateMonitor);
|
||||
clearInvocations(mKeyguardStateController);
|
||||
@@ -357,8 +356,8 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
|
||||
clearInvocations(mKeyguardUpdateMonitor);
|
||||
clearInvocations(mKeyguardStateController);
|
||||
|
||||
mStatusBarKeyguardViewManager.setOccluded(true /* occluded */, false /* animated */);
|
||||
verify(mKeyguardStateController, never()).notifyKeyguardState(anyBoolean(), anyBoolean());
|
||||
mStatusBarKeyguardViewManager.setOccluded(false /* occluded */, false /* animated */);
|
||||
verify(mKeyguardStateController).notifyKeyguardState(true, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -426,7 +425,7 @@ public class StatusBarKeyguardViewManagerTest extends SysuiTestCase {
|
||||
when(mAlternateAuthInterceptor.isShowingAlternateAuthBouncer()).thenReturn(true);
|
||||
assertTrue(
|
||||
"Is showing not accurate when alternative auth showing",
|
||||
mStatusBarKeyguardViewManager.isShowing());
|
||||
mStatusBarKeyguardViewManager.isBouncerShowing());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user