Do not allow panel expansion with bouncer over dream.
This change prevents the PanelViewController, the parent class of NotificationPanelView, from expanding on end motion when the bouncer is shown over dream. The BouncerSwipeTouchHandler now informs CentralSurfaces when the bouncer is showing over the dream. This is independent of the normal signal for bouncer showing. This prevents the panel from appearing erroneously on motion cancel during swipe down on the bouncer. This cancel comes as a result of the bouncer pilfering the touch events once the gesture has been detected. Fixed: 228347831 Test: atest BouncerSwipeTouchHandlerTest#testInformBouncerShowingOnExpand Test: atest BouncerSwipeTouchHandlerTest#testInformBouncerShowingOnCollapse Change-Id: I83a599baea904c8b1a2cea3a7c55dbe9c166c3d2
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<GestureDetector.OnGestureListener> gestureListenerCaptor =
|
||||
ArgumentCaptor.forClass(GestureDetector.OnGestureListener.class);
|
||||
|
||||
Reference in New Issue
Block a user