Loading packages/SystemUI/multivalentTests/src/com/android/systemui/haptics/qs/QSLongPressEffectTest.kt +7 −12 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.animation.ActivityTransitionAnimator import com.android.systemui.classifier.falsingManager import com.android.systemui.haptics.vibratorHelper import com.android.systemui.kosmos.testScope import com.android.systemui.qs.qsTileFactory Loading Loading @@ -73,7 +72,6 @@ class QSLongPressEffectTest : SysuiTestCase() { QSLongPressEffect( vibratorHelper, kosmos.keyguardStateController, kosmos.falsingManager, ) longPressEffect.callback = callback longPressEffect.qsTile = qsTile Loading Loading @@ -304,13 +302,12 @@ class QSLongPressEffectTest : SysuiTestCase() { } @Test fun getStateForClick_withFalseTapWhenLocked_returnsIdle() { fun getStateForClick_whenKeyguardsIsShowing_returnsIdle() { // GIVEN an active tile qsTile.state?.state = Tile.STATE_ACTIVE // GIVEN that the device is locked and a false tap is detected whenever(kosmos.keyguardStateController.isUnlocked).thenReturn(false) kosmos.falsingManager.setFalseTap(true) // GIVEN that the keyguard is showing whenever(kosmos.keyguardStateController.isShowing).thenReturn(true) // WHEN determining the state of a click action val clickState = longPressEffect.getStateForClick() Loading @@ -324,9 +321,8 @@ class QSLongPressEffectTest : SysuiTestCase() { // GIVEN an active tile qsTile.state?.state = Tile.STATE_ACTIVE // GIVEN that the device is locked and a false tap is not detected whenever(kosmos.keyguardStateController.isUnlocked).thenReturn(false) kosmos.falsingManager.setFalseTap(false) // GIVEN that the keyguard is not showing whenever(kosmos.keyguardStateController.isShowing).thenReturn(false) // WHEN determining the state of a click action val clickState = longPressEffect.getStateForClick() Loading @@ -340,9 +336,8 @@ class QSLongPressEffectTest : SysuiTestCase() { // GIVEN that the tile is null longPressEffect.qsTile = null // GIVEN that the device is locked and a false tap is not detected whenever(kosmos.keyguardStateController.isUnlocked).thenReturn(false) kosmos.falsingManager.setFalseTap(false) // GIVEN that the keyguard is not showing whenever(kosmos.keyguardStateController.isShowing).thenReturn(false) // WHEN determining the state of a click action val clickState = longPressEffect.getStateForClick() Loading packages/SystemUI/src/com/android/systemui/haptics/qs/QSLongPressEffect.kt +1 −6 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ import com.android.systemui.animation.DelegateTransitionAnimatorController import com.android.systemui.animation.DialogCuj import com.android.systemui.animation.DialogTransitionAnimator import com.android.systemui.animation.Expandable import com.android.systemui.plugins.FalsingManager import com.android.systemui.plugins.qs.QSTile import com.android.systemui.statusbar.VibratorHelper import com.android.systemui.statusbar.policy.KeyguardStateController Loading @@ -48,7 +47,6 @@ class QSLongPressEffect constructor( private val vibratorHelper: VibratorHelper?, private val keyguardStateController: KeyguardStateController, private val falsingManager: FalsingManager, ) { var effectDuration = 0 Loading Loading @@ -195,11 +193,8 @@ constructor( @VisibleForTesting fun getStateForClick(): State { val isTileUnavailable = qsTile?.state?.state == Tile.STATE_UNAVAILABLE val isFalseTapWhileLocked = !keyguardStateController.isUnlocked && falsingManager.isFalseTap(FalsingManager.LOW_PENALTY) val handlesLongClick = qsTile?.state?.handlesLongClick == true return if (isTileUnavailable || isFalseTapWhileLocked || !handlesLongClick) { return if (isTileUnavailable || !handlesLongClick || keyguardStateController.isShowing) { // The click event will not perform an action that resets the state. Therefore, this is // the last opportunity to reset the state back to IDLE. State.IDLE Loading packages/SystemUI/tests/utils/src/com/android/systemui/haptics/qs/QSLongPressEffectKosmos.kt +1 −2 Original line number Diff line number Diff line Loading @@ -16,10 +16,9 @@ package com.android.systemui.haptics.qs import com.android.systemui.classifier.falsingManager import com.android.systemui.haptics.vibratorHelper import com.android.systemui.kosmos.Kosmos import com.android.systemui.statusbar.policy.keyguardStateController val Kosmos.qsLongPressEffect by Kosmos.Fixture { QSLongPressEffect(vibratorHelper, keyguardStateController, falsingManager) } Kosmos.Fixture { QSLongPressEffect(vibratorHelper, keyguardStateController) } Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/haptics/qs/QSLongPressEffectTest.kt +7 −12 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.animation.ActivityTransitionAnimator import com.android.systemui.classifier.falsingManager import com.android.systemui.haptics.vibratorHelper import com.android.systemui.kosmos.testScope import com.android.systemui.qs.qsTileFactory Loading Loading @@ -73,7 +72,6 @@ class QSLongPressEffectTest : SysuiTestCase() { QSLongPressEffect( vibratorHelper, kosmos.keyguardStateController, kosmos.falsingManager, ) longPressEffect.callback = callback longPressEffect.qsTile = qsTile Loading Loading @@ -304,13 +302,12 @@ class QSLongPressEffectTest : SysuiTestCase() { } @Test fun getStateForClick_withFalseTapWhenLocked_returnsIdle() { fun getStateForClick_whenKeyguardsIsShowing_returnsIdle() { // GIVEN an active tile qsTile.state?.state = Tile.STATE_ACTIVE // GIVEN that the device is locked and a false tap is detected whenever(kosmos.keyguardStateController.isUnlocked).thenReturn(false) kosmos.falsingManager.setFalseTap(true) // GIVEN that the keyguard is showing whenever(kosmos.keyguardStateController.isShowing).thenReturn(true) // WHEN determining the state of a click action val clickState = longPressEffect.getStateForClick() Loading @@ -324,9 +321,8 @@ class QSLongPressEffectTest : SysuiTestCase() { // GIVEN an active tile qsTile.state?.state = Tile.STATE_ACTIVE // GIVEN that the device is locked and a false tap is not detected whenever(kosmos.keyguardStateController.isUnlocked).thenReturn(false) kosmos.falsingManager.setFalseTap(false) // GIVEN that the keyguard is not showing whenever(kosmos.keyguardStateController.isShowing).thenReturn(false) // WHEN determining the state of a click action val clickState = longPressEffect.getStateForClick() Loading @@ -340,9 +336,8 @@ class QSLongPressEffectTest : SysuiTestCase() { // GIVEN that the tile is null longPressEffect.qsTile = null // GIVEN that the device is locked and a false tap is not detected whenever(kosmos.keyguardStateController.isUnlocked).thenReturn(false) kosmos.falsingManager.setFalseTap(false) // GIVEN that the keyguard is not showing whenever(kosmos.keyguardStateController.isShowing).thenReturn(false) // WHEN determining the state of a click action val clickState = longPressEffect.getStateForClick() Loading
packages/SystemUI/src/com/android/systemui/haptics/qs/QSLongPressEffect.kt +1 −6 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ import com.android.systemui.animation.DelegateTransitionAnimatorController import com.android.systemui.animation.DialogCuj import com.android.systemui.animation.DialogTransitionAnimator import com.android.systemui.animation.Expandable import com.android.systemui.plugins.FalsingManager import com.android.systemui.plugins.qs.QSTile import com.android.systemui.statusbar.VibratorHelper import com.android.systemui.statusbar.policy.KeyguardStateController Loading @@ -48,7 +47,6 @@ class QSLongPressEffect constructor( private val vibratorHelper: VibratorHelper?, private val keyguardStateController: KeyguardStateController, private val falsingManager: FalsingManager, ) { var effectDuration = 0 Loading Loading @@ -195,11 +193,8 @@ constructor( @VisibleForTesting fun getStateForClick(): State { val isTileUnavailable = qsTile?.state?.state == Tile.STATE_UNAVAILABLE val isFalseTapWhileLocked = !keyguardStateController.isUnlocked && falsingManager.isFalseTap(FalsingManager.LOW_PENALTY) val handlesLongClick = qsTile?.state?.handlesLongClick == true return if (isTileUnavailable || isFalseTapWhileLocked || !handlesLongClick) { return if (isTileUnavailable || !handlesLongClick || keyguardStateController.isShowing) { // The click event will not perform an action that resets the state. Therefore, this is // the last opportunity to reset the state back to IDLE. State.IDLE Loading
packages/SystemUI/tests/utils/src/com/android/systemui/haptics/qs/QSLongPressEffectKosmos.kt +1 −2 Original line number Diff line number Diff line Loading @@ -16,10 +16,9 @@ package com.android.systemui.haptics.qs import com.android.systemui.classifier.falsingManager import com.android.systemui.haptics.vibratorHelper import com.android.systemui.kosmos.Kosmos import com.android.systemui.statusbar.policy.keyguardStateController val Kosmos.qsLongPressEffect by Kosmos.Fixture { QSLongPressEffect(vibratorHelper, keyguardStateController, falsingManager) } Kosmos.Fixture { QSLongPressEffect(vibratorHelper, keyguardStateController) }