diff --git a/packages/SystemUI/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandler.java b/packages/SystemUI/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandler.java index c147fde65cf75..517fce1b16a69 100644 --- a/packages/SystemUI/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandler.java +++ b/packages/SystemUI/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandler.java @@ -144,6 +144,8 @@ public class BouncerSwipeTouchHandler implements DreamTouchHandler { private void setPanelExpansion(float expansion) { mCurrentExpansion = expansion; + mCentralSurfaces.setBouncerShowingOverDream( + mCurrentExpansion != KeyguardBouncer.EXPANSION_HIDDEN); mStatusBarKeyguardViewManager.onPanelExpansionChanged(mCurrentExpansion, false, true); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java index c77b0d6721fb6..2d3bef6319267 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java @@ -468,6 +468,7 @@ public class CentralSurfaces extends CoreStartable implements */ protected int mState; // TODO: remove this. Just use StatusBarStateController protected boolean mBouncerShowing; + private boolean mBouncerShowingOverDream; private final PhoneStatusBarPolicy mIconPolicy; @@ -3472,6 +3473,16 @@ public class CentralSurfaces extends CoreStartable implements } } + /** + * Sets whether the bouncer over dream is showing. Note that the bouncer over dream is handled + * independently of the rest of the notification panel. As a result, setting this state via + * {@link #setBouncerShowing(boolean)} leads to unintended side effects from states modified + * behind the dream. + */ + public void setBouncerShowingOverDream(boolean bouncerShowingOverDream) { + mBouncerShowingOverDream = bouncerShowingOverDream; + } + /** * Propagate the bouncer state to status bar components. * @@ -4145,7 +4156,7 @@ public class CentralSurfaces extends CoreStartable implements } public boolean isBouncerShowingOverDream() { - return isBouncerShowing() && mDreamOverlayStateController.isOverlayActive(); + return mBouncerShowingOverDream; } /** diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java index 518a9181ec985..ad304c54eee05 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelViewController.java @@ -424,6 +424,8 @@ public abstract class PanelViewController { // situations, such keeping your finger down while swiping to unlock to an app // that is locked in landscape (the rotation will cancel the touch event). expand = false; + } else if (mCentralSurfaces.isBouncerShowingOverDream()) { + expand = false; } else { // If we get a cancel, put the shade back to the state it was in when the // gesture started diff --git a/packages/SystemUI/tests/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandlerTest.java b/packages/SystemUI/tests/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandlerTest.java index e175af7a037d5..535023fa08c54 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandlerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/dreams/touch/BouncerSwipeTouchHandlerTest.java @@ -420,7 +420,31 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase { verify(mUiEventLogger).log(BouncerSwipeTouchHandler.DreamEvent.DREAM_BOUNCER_FULLY_VISIBLE); } + /** + * Ensures {@link CentralSurfaces} + */ + @Test + public void testInformBouncerShowingOnExpand() { + swipeToPosition(1f, Direction.UP, 0); + verify(mCentralSurfaces).setBouncerShowingOverDream(true); + } + + /** + * Ensures {@link CentralSurfaces} + */ + @Test + public void testInformBouncerHidingOnCollapse() { + // Must swipe up to set initial state. + swipeToPosition(1f, Direction.UP, 0); + Mockito.clearInvocations(mCentralSurfaces); + + swipeToPosition(0f, Direction.DOWN, 0); + verify(mCentralSurfaces).setBouncerShowingOverDream(false); + } + + private void swipeToPosition(float percent, Direction direction, float velocityY) { + Mockito.clearInvocations(mTouchSession); mTouchHandler.onSessionStart(mTouchSession); ArgumentCaptor gestureListenerCaptor = ArgumentCaptor.forClass(GestureDetector.OnGestureListener.class);