summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2025-03-18 07:20:01 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2025-03-18 07:20:01 -0700
commit23d852dead2aac9172bf7e184f04c1f895823cff (patch)
tree356b8c7afa9e0547a07bbbae8c90c89f9630088a
parentce2a0d132b47d6f6339c2cc2cc3848e33f4624d3 (diff)
parent101e73a1cf001cae9a4b5be681a28357ea9cc39f (diff)
Merge "Move the shade if expanded from mouse click on the the side statusbar chips" into main
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewController.kt16
-rw-r--r--packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewControllerTest.kt45
2 files changed, 58 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewController.kt
index caf8a43b2aaf..67a7eee2977a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewController.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewController.kt
@@ -104,6 +104,7 @@ private constructor(
// intercepted. See [View.OnTouchEvent]
if (event.source == InputDevice.SOURCE_MOUSE) {
if (event.action == MotionEvent.ACTION_UP) {
+ dispatchEventToShadeDisplayPolicy(event)
v.performClick()
shadeController.animateExpandShade()
}
@@ -113,6 +114,15 @@ private constructor(
}
}
+ private fun dispatchEventToShadeDisplayPolicy(event: MotionEvent) {
+ if (ShadeWindowGoesAround.isEnabled) {
+ // Notify the shade display policy that the status bar was touched. This may cause
+ // the shade to change display if the touch was in a display different than the shade
+ // one.
+ lazyStatusBarShadeDisplayPolicy.get().onStatusBarTouched(event, mView.width)
+ }
+ }
+
private val configurationListener =
object : ConfigurationController.ConfigurationListener {
override fun onDensityOrFontScaleChanged() {
@@ -232,9 +242,6 @@ private constructor(
!upOrCancel || shadeController.isExpandedVisible,
)
}
- if (ShadeWindowGoesAround.isEnabled && event.action == MotionEvent.ACTION_DOWN) {
- lazyStatusBarShadeDisplayPolicy.get().onStatusBarTouched(event, mView.width)
- }
}
private fun addDarkReceivers() {
@@ -249,6 +256,9 @@ private constructor(
inner class PhoneStatusBarViewTouchHandler : Gefingerpoken {
override fun onInterceptTouchEvent(event: MotionEvent): Boolean {
+ if (event.action == MotionEvent.ACTION_DOWN) {
+ dispatchEventToShadeDisplayPolicy(event)
+ }
return if (Flags.statusBarSwipeOverChip()) {
shadeViewController.handleExternalInterceptTouch(event)
} else {
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewControllerTest.kt
index 68f66611c981..574b2c010a37 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewControllerTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/PhoneStatusBarViewControllerTest.kt
@@ -471,6 +471,51 @@ class PhoneStatusBarViewControllerTest : SysuiTestCase() {
}
@Test
+ @EnableFlags(ShadeWindowGoesAround.FLAG_NAME)
+ fun onTouch_withMouseOnEndSideIcons_flagOn_propagatedToShadeDisplayPolicy() {
+ val view = createViewMock()
+ InstrumentationRegistry.getInstrumentation().runOnMainSync {
+ controller = createAndInitController(view)
+ }
+ val event = getActionUpEventFromSource(InputDevice.SOURCE_MOUSE)
+
+ val statusContainer = view.requireViewById<View>(R.id.system_icons)
+ statusContainer.dispatchTouchEvent(event)
+
+ verify(statusBarTouchShadeDisplayPolicy).onStatusBarTouched(eq(event), any())
+ }
+
+ @Test
+ @EnableFlags(ShadeWindowGoesAround.FLAG_NAME)
+ fun onTouch_withMouseOnStartSideIcons_flagOn_propagatedToShadeDisplayPolicy() {
+ val view = createViewMock()
+ InstrumentationRegistry.getInstrumentation().runOnMainSync {
+ controller = createAndInitController(view)
+ }
+ val event = getActionUpEventFromSource(InputDevice.SOURCE_MOUSE)
+
+ val statusContainer = view.requireViewById<View>(R.id.status_bar_start_side_content)
+ statusContainer.dispatchTouchEvent(event)
+
+ verify(statusBarTouchShadeDisplayPolicy).onStatusBarTouched(eq(event), any())
+ }
+
+ @Test
+ @DisableFlags(ShadeWindowGoesAround.FLAG_NAME)
+ fun onTouch_withMouseOnSystemIcons_flagOff_notPropagatedToShadeDisplayPolicy() {
+ val view = createViewMock()
+ InstrumentationRegistry.getInstrumentation().runOnMainSync {
+ controller = createAndInitController(view)
+ }
+ val event = getActionUpEventFromSource(InputDevice.SOURCE_MOUSE)
+
+ val statusContainer = view.requireViewById<View>(R.id.system_icons)
+ statusContainer.dispatchTouchEvent(event)
+
+ verify(statusBarTouchShadeDisplayPolicy, never()).onStatusBarTouched(eq(event), any())
+ }
+
+ @Test
fun shadeIsExpandedOnStatusIconMouseClick() {
val view = createViewMock()
InstrumentationRegistry.getInstrumentation().runOnMainSync {