summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Bryce Lee <brycelee@google.com> 2024-05-03 02:41:45 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-05-03 02:41:45 +0000
commitf524cbac52c3e656c4903ee6c9bd21b598348520 (patch)
tree53b4ac2b7b893704c2b491e3a7165e6d0043caa3
parent0a3e45a437d0906248c17366d99dc1a1f3af21ed (diff)
parent19f1e289a409190c1b05b4e0691e2aaee39755fe (diff)
Merge "Do not modify notification shade plugin state." into main
-rw-r--r--packages/SystemUI/aconfig/systemui.aconfig10
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/ambient/touch/BouncerSwipeTouchHandlerTest.java28
-rw-r--r--packages/SystemUI/src/com/android/systemui/ambient/touch/BouncerSwipeTouchHandler.java11
3 files changed, 47 insertions, 2 deletions
diff --git a/packages/SystemUI/aconfig/systemui.aconfig b/packages/SystemUI/aconfig/systemui.aconfig
index e7226b00d241..24d6413a0856 100644
--- a/packages/SystemUI/aconfig/systemui.aconfig
+++ b/packages/SystemUI/aconfig/systemui.aconfig
@@ -838,3 +838,13 @@ flag {
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 33952683d514..630bcd6beacc 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.ArgumentMatchers.eq;
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 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase {
* 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 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase {
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 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase {
}
@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 @@ public class BouncerSwipeTouchHandlerTest extends SysuiTestCase {
}
@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 85aeb27261aa..019f498a01f8 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 @@ public class BouncerSwipeTouchHandler implements TouchHandler {
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 @@ public class BouncerSwipeTouchHandler implements TouchHandler {
}
mScrimManager.removeCallback(mScrimManagerCallback);
mCapture = null;
- mNotificationShadeWindowController.setForcePluginOpen(false, this);
+
+ if (!Flags.communalBouncerDoNotModifyPluginOpen()) {
+ mNotificationShadeWindowController.setForcePluginOpen(false, this);
+ }
});
session.registerGestureListener(mOnGestureListener);