Loading packages/SystemUI/multivalentTests/src/com/android/systemui/haptics/qs/QSLongPressEffectTest.kt +10 −0 Original line number Diff line number Diff line Loading @@ -398,6 +398,16 @@ class QSLongPressEffectTest : SysuiTestCase() { verify(controller).onTransitionAnimationCancelled(newOccludedState) } @Test fun onTileLongClick_whileIdle_performsLongClick() = testWhileInState(QSLongPressEffect.State.IDLE) { // WHEN a long-click is detected by the view val longClicks = longPressEffect.onTileLongClick() // THEN the long click is handled assertThat(longClicks).isTrue() } private fun testWithScope(initialize: Boolean = true, test: suspend TestScope.() -> Unit) = with(kosmos) { testScope.runTest { Loading packages/SystemUI/src/com/android/systemui/haptics/qs/QSLongPressEffect.kt +15 −0 Original line number Diff line number Diff line Loading @@ -215,6 +215,21 @@ constructor( return true } fun onTileLongClick(): Boolean { if (state == State.IDLE) { // This case represents a long-click detected outside of the QSLongPressEffect. This can // be due to accessibility services qsTile?.longClick(expandable) logEvent( qsTile?.tileSpec, state, "long click action triggered from OnLongClickListener", ) return true } return false } /** * Get the appropriate state for a click action. * Loading packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt +4 −1 Original line number Diff line number Diff line Loading @@ -415,7 +415,10 @@ constructor( initLongPressEffectCallback() init( { _: View -> longPressEffect.onTileClick() }, { _: View -> true }, // Haptics and long-clicks are handled by [QSLongPressEffect] { _: View -> longPressEffect.onTileLongClick() true }, // Haptics and long-clicks are handled by [QSLongPressEffect] ) } else { val expandable = Expandable.fromView(this) Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/haptics/qs/QSLongPressEffectTest.kt +10 −0 Original line number Diff line number Diff line Loading @@ -398,6 +398,16 @@ class QSLongPressEffectTest : SysuiTestCase() { verify(controller).onTransitionAnimationCancelled(newOccludedState) } @Test fun onTileLongClick_whileIdle_performsLongClick() = testWhileInState(QSLongPressEffect.State.IDLE) { // WHEN a long-click is detected by the view val longClicks = longPressEffect.onTileLongClick() // THEN the long click is handled assertThat(longClicks).isTrue() } private fun testWithScope(initialize: Boolean = true, test: suspend TestScope.() -> Unit) = with(kosmos) { testScope.runTest { Loading
packages/SystemUI/src/com/android/systemui/haptics/qs/QSLongPressEffect.kt +15 −0 Original line number Diff line number Diff line Loading @@ -215,6 +215,21 @@ constructor( return true } fun onTileLongClick(): Boolean { if (state == State.IDLE) { // This case represents a long-click detected outside of the QSLongPressEffect. This can // be due to accessibility services qsTile?.longClick(expandable) logEvent( qsTile?.tileSpec, state, "long click action triggered from OnLongClickListener", ) return true } return false } /** * Get the appropriate state for a click action. * Loading
packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt +4 −1 Original line number Diff line number Diff line Loading @@ -415,7 +415,10 @@ constructor( initLongPressEffectCallback() init( { _: View -> longPressEffect.onTileClick() }, { _: View -> true }, // Haptics and long-clicks are handled by [QSLongPressEffect] { _: View -> longPressEffect.onTileLongClick() true }, // Haptics and long-clicks are handled by [QSLongPressEffect] ) } else { val expandable = Expandable.fromView(this) Loading