Merge "Add bouncer state to KeyguardStateController; disable smartspace transition if bouncer is showing." into tm-dev
This commit is contained in:
@@ -75,12 +75,6 @@ public interface ViewMediatorCallback {
|
|||||||
*/
|
*/
|
||||||
void playTrustedSound();
|
void playTrustedSound();
|
||||||
|
|
||||||
/**
|
|
||||||
* When the bouncer is shown or hides
|
|
||||||
* @param shown
|
|
||||||
*/
|
|
||||||
void onBouncerVisiblityChanged(boolean shown);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if the screen is on
|
* @return true if the screen is on
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -813,6 +813,11 @@ class KeyguardUnlockAnimationController @Inject constructor(
|
|||||||
return false
|
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
|
// 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
|
// dismiss. In this case, the smartspace swiped away with the rest of the keyguard, so don't
|
||||||
// do the shared element transition.
|
// do the shared element transition.
|
||||||
|
|||||||
@@ -778,16 +778,6 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
|
|||||||
mKeyguardViewControllerLazy.get().onCancelClicked();
|
mKeyguardViewControllerLazy.get().onCancelClicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBouncerVisiblityChanged(boolean shown) {
|
|
||||||
synchronized (KeyguardViewMediator.this) {
|
|
||||||
if (shown) {
|
|
||||||
mPendingPinLock = false;
|
|
||||||
}
|
|
||||||
adjustStatusBarLocked(shown, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void playTrustedSound() {
|
public void playTrustedSound() {
|
||||||
KeyguardViewMediator.this.playTrustedSound();
|
KeyguardViewMediator.this.playTrustedSound();
|
||||||
@@ -989,6 +979,19 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
|
|||||||
private DozeParameters mDozeParameters;
|
private DozeParameters mDozeParameters;
|
||||||
|
|
||||||
private final KeyguardStateController mKeyguardStateController;
|
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 Lazy<KeyguardUnlockAnimationController> mKeyguardUnlockAnimationControllerLazy;
|
||||||
private final InteractionJankMonitor mInteractionJankMonitor;
|
private final InteractionJankMonitor mInteractionJankMonitor;
|
||||||
private boolean mWallpaperSupportsAmbientMode;
|
private boolean mWallpaperSupportsAmbientMode;
|
||||||
@@ -1059,6 +1062,7 @@ public class KeyguardViewMediator extends CoreStartable implements Dumpable,
|
|||||||
statusBarStateController.addCallback(this);
|
statusBarStateController.addCallback(this);
|
||||||
|
|
||||||
mKeyguardStateController = keyguardStateController;
|
mKeyguardStateController = keyguardStateController;
|
||||||
|
keyguardStateController.addCallback(mKeyguardStateControllerCallback);
|
||||||
mKeyguardUnlockAnimationControllerLazy = keyguardUnlockAnimationControllerLazy;
|
mKeyguardUnlockAnimationControllerLazy = keyguardUnlockAnimationControllerLazy;
|
||||||
mScreenOffAnimationController = screenOffAnimationController;
|
mScreenOffAnimationController = screenOffAnimationController;
|
||||||
mInteractionJankMonitor = interactionJankMonitor;
|
mInteractionJankMonitor = interactionJankMonitor;
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ public class KeyguardBouncer {
|
|||||||
DejankUtils.postAfterTraversal(mShowRunnable);
|
DejankUtils.postAfterTraversal(mShowRunnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
mCallback.onBouncerVisiblityChanged(true /* shown */);
|
mKeyguardStateController.notifyBouncerShowing(true /* showing */);
|
||||||
dispatchStartingToShow();
|
dispatchStartingToShow();
|
||||||
} finally {
|
} finally {
|
||||||
Trace.endSection();
|
Trace.endSection();
|
||||||
@@ -334,7 +334,7 @@ public class KeyguardBouncer {
|
|||||||
}
|
}
|
||||||
mIsScrimmed = false;
|
mIsScrimmed = false;
|
||||||
mFalsingCollector.onBouncerHidden();
|
mFalsingCollector.onBouncerHidden();
|
||||||
mCallback.onBouncerVisiblityChanged(false /* shown */);
|
mKeyguardStateController.notifyBouncerShowing(false /* showing */);
|
||||||
cancelShowRunnable();
|
cancelShowRunnable();
|
||||||
if (mKeyguardViewController != null) {
|
if (mKeyguardViewController != null) {
|
||||||
mKeyguardViewController.cancelDismissAction();
|
mKeyguardViewController.cancelDismissAction();
|
||||||
|
|||||||
@@ -45,6 +45,11 @@ public interface KeyguardStateController extends CallbackController<Callback> {
|
|||||||
*/
|
*/
|
||||||
boolean isShowing();
|
boolean isShowing();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the bouncer (PIN/password entry) is currently visible.
|
||||||
|
*/
|
||||||
|
boolean isBouncerShowing();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If swiping up will unlock without asking for a password.
|
* If swiping up will unlock without asking for a password.
|
||||||
* @see #isUnlocked()
|
* @see #isUnlocked()
|
||||||
@@ -186,6 +191,8 @@ public interface KeyguardStateController extends CallbackController<Callback> {
|
|||||||
default void notifyKeyguardDoneFading() {}
|
default void notifyKeyguardDoneFading() {}
|
||||||
/** **/
|
/** **/
|
||||||
default void notifyKeyguardState(boolean showing, boolean occluded) {}
|
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
|
* 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() {}
|
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.
|
* Triggered when the device was just unlocked and the lock screen is being dismissed.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ public class KeyguardStateControllerImpl implements KeyguardStateController, Dum
|
|||||||
|
|
||||||
private boolean mCanDismissLockScreen;
|
private boolean mCanDismissLockScreen;
|
||||||
private boolean mShowing;
|
private boolean mShowing;
|
||||||
|
private boolean mBouncerShowing;
|
||||||
private boolean mSecure;
|
private boolean mSecure;
|
||||||
private boolean mOccluded;
|
private boolean mOccluded;
|
||||||
|
|
||||||
@@ -152,6 +153,11 @@ public class KeyguardStateControllerImpl implements KeyguardStateController, Dum
|
|||||||
return mShowing;
|
return mShowing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBouncerShowing() {
|
||||||
|
return mBouncerShowing;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isMethodSecure() {
|
public boolean isMethodSecure() {
|
||||||
return mSecure;
|
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
|
@Override
|
||||||
public void notifyPanelFlingEnd() {
|
public void notifyPanelFlingEnd() {
|
||||||
mFlingingToDismissKeyguard = false;
|
mFlingingToDismissKeyguard = false;
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ public class KeyguardBouncerTest extends SysuiTestCase {
|
|||||||
@Test
|
@Test
|
||||||
public void testShow_notifiesVisibility() {
|
public void testShow_notifiesVisibility() {
|
||||||
mBouncer.show(true);
|
mBouncer.show(true);
|
||||||
verify(mViewMediatorCallback).onBouncerVisiblityChanged(eq(true));
|
verify(mKeyguardStateController).notifyBouncerShowing(eq(true));
|
||||||
verify(mExpansionCallback).onStartingToShow();
|
verify(mExpansionCallback).onStartingToShow();
|
||||||
|
|
||||||
// Not called again when visible
|
// Not called again when visible
|
||||||
@@ -238,7 +238,7 @@ public class KeyguardBouncerTest extends SysuiTestCase {
|
|||||||
@Test
|
@Test
|
||||||
public void testHide_notifiesVisibility() {
|
public void testHide_notifiesVisibility() {
|
||||||
mBouncer.hide(false);
|
mBouncer.hide(false);
|
||||||
verify(mViewMediatorCallback).onBouncerVisiblityChanged(eq(false));
|
verify(mKeyguardStateController).notifyBouncerShowing(eq(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -48,6 +48,11 @@ public class FakeKeyguardStateController implements KeyguardStateController {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBouncerShowing() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canDismissLockScreen() {
|
public boolean canDismissLockScreen() {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user