Do not modify notification shade plugin state.
This change removes logic from the BouncerSwipeTouchHandler
where the notification shade plugin state was being forced open
on the beginning of a touch session.
Test: atest BouncerSwipeTouchHandlerTest
Flag: ACONFIG com.android.systemui.communal_bouncer_do_not_modify_plugin_open disabled
Fixes: 338252661
Change-Id: I7146d3ffcfd7f0eed71ae2404c0fdf0a6975072c
diff --git a/packages/SystemUI/aconfig/systemui.aconfig b/packages/SystemUI/aconfig/systemui.aconfig
index b3aa7e1..451e98e 100644
--- a/packages/SystemUI/aconfig/systemui.aconfig
+++ b/packages/SystemUI/aconfig/systemui.aconfig
@@ -852,3 +852,13 @@
purpose: PURPOSE_BUGFIX
}
}
+
+flag {
+ name: "communal_bouncer_do_not_modify_plugin_open"
+ namespace: "systemui"
+ description: "do not modify notification shade when handling bouncer expansion."
+ bug: "338252661"
+ metadata {
+ purpose: PURPOSE_BUGFIX
+ }
+}
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/ambient/touch/BouncerSwipeTouchHandlerTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/ambient/touch/BouncerSwipeTouchHandlerTest.java
index 3395268..630bcd6 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/ambient/touch/BouncerSwipeTouchHandlerTest.java
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/ambient/touch/BouncerSwipeTouchHandlerTest.java
@@ -24,6 +24,7 @@
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
import android.animation.AnimatorListenerAdapter;
@@ -163,6 +164,7 @@
* Ensures expansion only happens when touch down happens in valid part of the screen.
*/
@Test
+ @DisableFlags(Flags.FLAG_COMMUNAL_BOUNCER_DO_NOT_MODIFY_PLUGIN_OPEN)
public void testSessionStart() {
mTouchHandler.getTouchInitiationRegion(SCREEN_BOUNDS, mRegion, null);
@@ -193,7 +195,31 @@
2)).isTrue();
}
+
+ /**
+ * Ensures expansion only happens when touch down happens in valid part of the screen.
+ */
@Test
+ @EnableFlags(Flags.FLAG_COMMUNAL_BOUNCER_DO_NOT_MODIFY_PLUGIN_OPEN)
+ public void testSessionStart_doesNotModifyNotificationShadeWindow() {
+ mTouchHandler.getTouchInitiationRegion(SCREEN_BOUNDS, mRegion, null);
+
+ verify(mRegion).union(mRectCaptor.capture());
+ final Rect bounds = mRectCaptor.getValue();
+
+ final Rect expected = new Rect();
+
+ expected.set(0, Math.round(SCREEN_HEIGHT_PX * (1 - TOUCH_REGION)), SCREEN_WIDTH_PX,
+ SCREEN_HEIGHT_PX);
+
+ assertThat(bounds).isEqualTo(expected);
+
+ mTouchHandler.onSessionStart(mTouchSession);
+ verifyNoMoreInteractions(mNotificationShadeWindowController);
+ }
+
+ @Test
+ @DisableFlags(Flags.FLAG_COMMUNAL_BOUNCER_DO_NOT_MODIFY_PLUGIN_OPEN)
public void testSwipeUp_whenBouncerInitiallyShowing_reduceHeightWithExclusionRects() {
mTouchHandler.getTouchInitiationRegion(SCREEN_BOUNDS, mRegion,
new Rect(0, 0, SCREEN_WIDTH_PX, SCREEN_HEIGHT_PX));
@@ -213,6 +239,7 @@
}
@Test
+ @DisableFlags(Flags.FLAG_COMMUNAL_BOUNCER_DO_NOT_MODIFY_PLUGIN_OPEN)
public void testSwipeUp_exclusionRectAtTop_doesNotIntersectGestureArea() {
mTouchHandler.getTouchInitiationRegion(SCREEN_BOUNDS, mRegion,
new Rect(0, 0, SCREEN_WIDTH_PX, SCREEN_HEIGHT_PX / 4));
@@ -228,6 +255,7 @@
}
@Test
+ @DisableFlags(Flags.FLAG_COMMUNAL_BOUNCER_DO_NOT_MODIFY_PLUGIN_OPEN)
public void testSwipeUp_exclusionRectBetweenNormalAndMinimumSwipeArea() {
final int normalSwipeAreaTop = SCREEN_HEIGHT_PX
- Math.round(SCREEN_HEIGHT_PX * TOUCH_REGION);
diff --git a/packages/SystemUI/src/com/android/systemui/ambient/touch/BouncerSwipeTouchHandler.java b/packages/SystemUI/src/com/android/systemui/ambient/touch/BouncerSwipeTouchHandler.java
index 85aeb27..019f498 100644
--- a/packages/SystemUI/src/com/android/systemui/ambient/touch/BouncerSwipeTouchHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/ambient/touch/BouncerSwipeTouchHandler.java
@@ -254,7 +254,11 @@
mVelocityTracker = mVelocityTrackerFactory.obtain();
mTouchSession = session;
mVelocityTracker.clear();
- mNotificationShadeWindowController.setForcePluginOpen(true, this);
+
+ if (!Flags.communalBouncerDoNotModifyPluginOpen()) {
+ mNotificationShadeWindowController.setForcePluginOpen(true, this);
+ }
+
mScrimManager.addCallback(mScrimManagerCallback);
mCurrentScrimController = mScrimManager.getCurrentController();
@@ -265,7 +269,10 @@
}
mScrimManager.removeCallback(mScrimManagerCallback);
mCapture = null;
- mNotificationShadeWindowController.setForcePluginOpen(false, this);
+
+ if (!Flags.communalBouncerDoNotModifyPluginOpen()) {
+ mNotificationShadeWindowController.setForcePluginOpen(false, this);
+ }
});
session.registerGestureListener(mOnGestureListener);