Merge "Add bouncer state to KeyguardStateController; disable smartspace transition if bouncer is showing." into tm-dev

This commit is contained in:
Josh Tsuji
2022-05-04 20:26:27 +00:00
committed by Android (Google) Code Review
8 changed files with 55 additions and 20 deletions

View File

@@ -75,12 +75,6 @@ public interface ViewMediatorCallback {
*/
void playTrustedSound();
/**
* When the bouncer is shown or hides
* @param shown
*/
void onBouncerVisiblityChanged(boolean shown);
/**
* @return true if the screen is on
*/

View File

@@ -813,6 +813,11 @@ class KeyguardUnlockAnimationController @Inject constructor(
return false
}
// The smartspace is not visible if the bouncer is showing, so don't shared element it.
if (keyguardStateController.isBouncerShowing) {
return false
}
// We started to swipe to dismiss, but now we're doing a fling animation to complete the
// dismiss. In this case, the smartspace swiped away with the rest of the keyguard, so don't
// do the shared element transition.

View File

@@ -778,16 +778,6 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
mKeyguardViewControllerLazy.get().onCancelClicked();
}
@Override
public void onBouncerVisiblityChanged(boolean shown) {
synchronized (KeyguardViewMediator.this) {
if (shown) {
mPendingPinLock = false;
}
adjustStatusBarLocked(shown, false);
}
}
@Override
public void playTrustedSound() {
KeyguardViewMediator.this.playTrustedSound();
@@ -989,6 +979,19 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
private DozeParameters mDozeParameters;
private final KeyguardStateController mKeyguardStateController;
private final KeyguardStateController.Callback mKeyguardStateControllerCallback =
new KeyguardStateController.Callback() {
@Override
public void onBouncerShowingChanged() {
synchronized (KeyguardViewMediator.this) {
if (mKeyguardStateController.isBouncerShowing()) {
mPendingPinLock = false;
}
adjustStatusBarLocked(mKeyguardStateController.isBouncerShowing(), false);
}
}
};
private final Lazy<KeyguardUnlockAnimationController> mKeyguardUnlockAnimationControllerLazy;
private final InteractionJankMonitor mInteractionJankMonitor;
private boolean mWallpaperSupportsAmbientMode;
@@ -1059,6 +1062,7 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
statusBarStateController.addCallback(this);
mKeyguardStateController = keyguardStateController;
keyguardStateController.addCallback(mKeyguardStateControllerCallback);
mKeyguardUnlockAnimationControllerLazy = keyguardUnlockAnimationControllerLazy;
mScreenOffAnimationController = screenOffAnimationController;
mInteractionJankMonitor = interactionJankMonitor;

View File

@@ -220,7 +220,7 @@ public class KeyguardBouncer {
DejankUtils.postAfterTraversal(mShowRunnable);
}
mCallback.onBouncerVisiblityChanged(true /* shown */);
mKeyguardStateController.notifyBouncerShowing(true /* showing */);
dispatchStartingToShow();
} finally {
Trace.endSection();
@@ -334,7 +334,7 @@ public class KeyguardBouncer {
}
mIsScrimmed = false;
mFalsingCollector.onBouncerHidden();
mCallback.onBouncerVisiblityChanged(false /* shown */);
mKeyguardStateController.notifyBouncerShowing(false /* showing */);
cancelShowRunnable();
if (mKeyguardViewController != null) {
mKeyguardViewController.cancelDismissAction();

View File

@@ -45,6 +45,11 @@ public interface KeyguardStateController extends CallbackController<Callback> {
*/
boolean isShowing();
/**
* Whether the bouncer (PIN/password entry) is currently visible.
*/
boolean isBouncerShowing();
/**
* If swiping up will unlock without asking for a password.
* @see #isUnlocked()
@@ -186,6 +191,8 @@ public interface KeyguardStateController extends CallbackController<Callback> {
default void notifyKeyguardDoneFading() {}
/** **/
default void notifyKeyguardState(boolean showing, boolean occluded) {}
/** **/
default void notifyBouncerShowing(boolean showing) {}
/**
* Updates the keyguard state to reflect that it's in the process of being dismissed, either by
@@ -230,6 +237,11 @@ public interface KeyguardStateController extends CallbackController<Callback> {
*/
default void onKeyguardShowingChanged() {}
/**
* Called when the bouncer (PIN/password entry) is shown or hidden.
*/
default void onBouncerShowingChanged() {}
/**
* Triggered when the device was just unlocked and the lock screen is being dismissed.
*/

View File

@@ -63,6 +63,7 @@ public class KeyguardStateControllerImpl implements KeyguardStateController, Dum
private boolean mCanDismissLockScreen;
private boolean mShowing;
private boolean mBouncerShowing;
private boolean mSecure;
private boolean mOccluded;
@@ -152,6 +153,11 @@ public class KeyguardStateControllerImpl implements KeyguardStateController, Dum
return mShowing;
}
@Override
public boolean isBouncerShowing() {
return mBouncerShowing;
}
@Override
public boolean isMethodSecure() {
return mSecure;
@@ -327,6 +333,15 @@ public class KeyguardStateControllerImpl implements KeyguardStateController, Dum
}
}
@Override
public void notifyBouncerShowing(boolean showing) {
if (mBouncerShowing != showing) {
mBouncerShowing = showing;
new ArrayList<>(mCallbacks).forEach(Callback::onBouncerShowingChanged);
}
}
@Override
public void notifyPanelFlingEnd() {
mFlingingToDismissKeyguard = false;

View File

@@ -160,7 +160,7 @@ public class KeyguardBouncerTest extends SysuiTestCase {
@Test
public void testShow_notifiesVisibility() {
mBouncer.show(true);
verify(mViewMediatorCallback).onBouncerVisiblityChanged(eq(true));
verify(mKeyguardStateController).notifyBouncerShowing(eq(true));
verify(mExpansionCallback).onStartingToShow();
// Not called again when visible
@@ -238,7 +238,7 @@ public class KeyguardBouncerTest extends SysuiTestCase {
@Test
public void testHide_notifiesVisibility() {
mBouncer.hide(false);
verify(mViewMediatorCallback).onBouncerVisiblityChanged(eq(false));
verify(mKeyguardStateController).notifyBouncerShowing(eq(false));
}
@Test

View File

@@ -48,6 +48,11 @@ public class FakeKeyguardStateController implements KeyguardStateController {
return false;
}
@Override
public boolean isBouncerShowing() {
return false;
}
@Override
public boolean canDismissLockScreen() {
return false;