diff options
| author | 2024-06-27 17:21:50 +0000 | |
|---|---|---|
| committer | 2024-06-27 17:21:50 +0000 | |
| commit | 6df90fc40c803d7c563ab7954a116e7a0537334c (patch) | |
| tree | 524ea457cd1d35ace0d629e94d60ca9a546e32e3 | |
| parent | 691986df2bbf138335c9a0c457f21d2402b33c16 (diff) | |
| parent | fc0667437b38c680e3312f4dcc9f1afefcff3503 (diff) | |
Merge changes from topic "flexiglass-long-press-rename" into main
* changes:
[flexiglass] Renames KeyguardLongPress<*>
[flexiglass] Wake up from AOD when lockscreen tapped.
27 files changed, 221 insertions, 95 deletions
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/LockscreenLongPress.kt b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/LockscreenLongPress.kt index 4555f13a1a2c..c34fb38f8558 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/LockscreenLongPress.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/LockscreenLongPress.kt @@ -19,9 +19,10 @@ package com.android.systemui.keyguard.ui.composable import androidx.compose.foundation.ExperimentalFoundationApi -import androidx.compose.foundation.combinedClickable import androidx.compose.foundation.gestures.awaitEachGesture import androidx.compose.foundation.gestures.awaitFirstDown +import androidx.compose.foundation.gestures.detectTapGestures +import androidx.compose.foundation.indication import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.BoxScope @@ -33,12 +34,14 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.geometry.Rect import androidx.compose.ui.input.pointer.pointerInput import androidx.lifecycle.compose.collectAsStateWithLifecycle -import com.android.systemui.keyguard.ui.viewmodel.KeyguardLongPressViewModel +import com.android.systemui.communal.ui.compose.extensions.detectLongPressGesture +import com.android.systemui.keyguard.ui.viewmodel.KeyguardTouchHandlingViewModel /** Container for lockscreen content that handles long-press to bring up the settings menu. */ @Composable +// TODO(b/344879669): now that it's more generic than long-press, rename it. fun LockscreenLongPress( - viewModel: KeyguardLongPressViewModel, + viewModel: KeyguardTouchHandlingViewModel, modifier: Modifier = Modifier, content: @Composable BoxScope.(onSettingsMenuPlaces: (coordinates: Rect?) -> Unit) -> Unit, ) { @@ -50,14 +53,17 @@ fun LockscreenLongPress( Box( modifier = modifier - .combinedClickable( - enabled = isEnabled, - onLongClick = viewModel::onLongPress, - onClick = {}, - interactionSource = interactionSource, - // Passing null for the indication removes the ripple effect. - indication = null, - ) + .pointerInput(isEnabled) { + if (isEnabled) { + detectLongPressGesture { viewModel.onLongPress() } + } + } + .pointerInput(Unit) { + detectTapGestures( + onTap = { viewModel.onClick(it.x, it.y) }, + onDoubleTap = { viewModel.onDoubleClick() }, + ) + } .pointerInput(settingsMenuBounds) { awaitEachGesture { val pointerInputChange = awaitFirstDown() @@ -65,7 +71,9 @@ fun LockscreenLongPress( viewModel.onTouchedOutside() } } - }, + } + // Passing null for the indication removes the ripple effect. + .indication(interactionSource, null) ) { content(setSettingsMenuBounds) } diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/CommunalBlueprint.kt b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/CommunalBlueprint.kt index 6b210af1308d..210ca69e6fd3 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/CommunalBlueprint.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/CommunalBlueprint.kt @@ -43,7 +43,7 @@ constructor( @Composable override fun SceneScope.Content(modifier: Modifier) { LockscreenLongPress( - viewModel = viewModel.longPress, + viewModel = viewModel.touchHandling, modifier = modifier, ) { _ -> Box(modifier.background(Color.Black)) { diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/DefaultBlueprint.kt b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/DefaultBlueprint.kt index a39fa64dd45b..0a4c6fd21922 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/DefaultBlueprint.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/DefaultBlueprint.kt @@ -72,7 +72,7 @@ constructor( val unfoldTranslations by viewModel.unfoldTranslations.collectAsStateWithLifecycle() LockscreenLongPress( - viewModel = viewModel.longPress, + viewModel = viewModel.touchHandling, modifier = modifier, ) { onSettingsMenuPlaced -> Layout( diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/ShortcutsBesideUdfpsBlueprint.kt b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/ShortcutsBesideUdfpsBlueprint.kt index c83f62c4281c..065f2a2172b1 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/ShortcutsBesideUdfpsBlueprint.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/blueprint/ShortcutsBesideUdfpsBlueprint.kt @@ -74,7 +74,7 @@ constructor( val unfoldTranslations by viewModel.unfoldTranslations.collectAsStateWithLifecycle() LockscreenLongPress( - viewModel = viewModel.longPress, + viewModel = viewModel.touchHandling, modifier = modifier, ) { onSettingsMenuPlaced -> Layout( diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/SettingsMenuSection.kt b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/SettingsMenuSection.kt index 44b0535efb57..15032e00e6f7 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/SettingsMenuSection.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/SettingsMenuSection.kt @@ -30,8 +30,8 @@ import androidx.compose.ui.unit.toSize import androidx.compose.ui.viewinterop.AndroidView import androidx.core.view.isVisible import com.android.systemui.keyguard.ui.binder.KeyguardSettingsViewBinder -import com.android.systemui.keyguard.ui.viewmodel.KeyguardLongPressViewModel import com.android.systemui.keyguard.ui.viewmodel.KeyguardSettingsMenuViewModel +import com.android.systemui.keyguard.ui.viewmodel.KeyguardTouchHandlingViewModel import com.android.systemui.plugins.ActivityStarter import com.android.systemui.res.R import com.android.systemui.statusbar.VibratorHelper @@ -42,7 +42,7 @@ class SettingsMenuSection @Inject constructor( private val viewModel: KeyguardSettingsMenuViewModel, - private val longPressViewModel: KeyguardLongPressViewModel, + private val touchHandlingViewModel: KeyguardTouchHandlingViewModel, private val vibratorHelper: VibratorHelper, private val activityStarter: ActivityStarter, ) { @@ -69,7 +69,7 @@ constructor( KeyguardSettingsViewBinder.bind( view = this, viewModel = viewModel, - longPressViewModel = longPressViewModel, + touchHandlingViewModel = touchHandlingViewModel, rootViewModel = null, vibratorHelper = vibratorHelper, activityStarter = activityStarter, diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardLongPressInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTouchHandlingInteractorTest.kt index 9d34903d544d..96b4b4325408 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardLongPressInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardTouchHandlingInteractorTest.kt @@ -32,6 +32,7 @@ import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepos import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.kosmos.testScope import com.android.systemui.res.R +import com.android.systemui.shade.pulsingGestureListener import com.android.systemui.statusbar.policy.AccessibilityManagerWrapper import com.android.systemui.testKosmos import com.android.systemui.util.mockito.mock @@ -53,14 +54,14 @@ import org.mockito.MockitoAnnotations @OptIn(ExperimentalCoroutinesApi::class) @SmallTest @RunWith(AndroidJUnit4::class) -class KeyguardLongPressInteractorTest : SysuiTestCase() { +class KeyguardTouchHandlingInteractorTest : SysuiTestCase() { private val kosmos = testKosmos().apply { this.accessibilityManagerWrapper = mock<AccessibilityManagerWrapper>() this.uiEventLogger = mock<UiEventLoggerFake>() } - private lateinit var underTest: KeyguardLongPressInteractor + private lateinit var underTest: KeyguardTouchHandlingInteractor private val logger = kosmos.uiEventLogger private val testScope = kosmos.testScope @@ -209,7 +210,7 @@ class KeyguardLongPressInteractorTest : SysuiTestCase() { underTest.onLongPress() assertThat(isMenuVisible).isTrue() - advanceTimeBy(KeyguardLongPressInteractor.DEFAULT_POPUP_AUTO_HIDE_TIMEOUT_MS) + advanceTimeBy(KeyguardTouchHandlingInteractor.DEFAULT_POPUP_AUTO_HIDE_TIMEOUT_MS) assertThat(isMenuVisible).isFalse() } @@ -224,11 +225,11 @@ class KeyguardLongPressInteractorTest : SysuiTestCase() { assertThat(isMenuVisible).isTrue() underTest.onMenuTouchGestureStarted() - advanceTimeBy(KeyguardLongPressInteractor.DEFAULT_POPUP_AUTO_HIDE_TIMEOUT_MS) + advanceTimeBy(KeyguardTouchHandlingInteractor.DEFAULT_POPUP_AUTO_HIDE_TIMEOUT_MS) assertThat(isMenuVisible).isTrue() underTest.onMenuTouchGestureEnded(/* isClick= */ false) - advanceTimeBy(KeyguardLongPressInteractor.DEFAULT_POPUP_AUTO_HIDE_TIMEOUT_MS) + advanceTimeBy(KeyguardTouchHandlingInteractor.DEFAULT_POPUP_AUTO_HIDE_TIMEOUT_MS) assertThat(isMenuVisible).isFalse() } @@ -241,7 +242,7 @@ class KeyguardLongPressInteractorTest : SysuiTestCase() { underTest.onLongPress() verify(logger) - .log(KeyguardLongPressInteractor.LogEvents.LOCK_SCREEN_LONG_PRESS_POPUP_SHOWN) + .log(KeyguardTouchHandlingInteractor.LogEvents.LOCK_SCREEN_LONG_PRESS_POPUP_SHOWN) } @Test @@ -254,7 +255,7 @@ class KeyguardLongPressInteractorTest : SysuiTestCase() { underTest.onMenuTouchGestureEnded(/* isClick= */ true) verify(logger) - .log(KeyguardLongPressInteractor.LogEvents.LOCK_SCREEN_LONG_PRESS_POPUP_CLICKED) + .log(KeyguardTouchHandlingInteractor.LogEvents.LOCK_SCREEN_LONG_PRESS_POPUP_CLICKED) } @Test @@ -288,7 +289,7 @@ class KeyguardLongPressInteractorTest : SysuiTestCase() { // This needs to be re-created for each test outside of kosmos since the flag values are // read during initialization to set up flows. Maybe there is a better way to handle that. underTest = - KeyguardLongPressInteractor( + KeyguardTouchHandlingInteractor( appContext = mContext, scope = testScope.backgroundScope, transitionInteractor = kosmos.keyguardTransitionInteractor, @@ -300,7 +301,8 @@ class KeyguardLongPressInteractorTest : SysuiTestCase() { set(Flags.LOCK_SCREEN_LONG_PRESS_DIRECT_TO_WPP, isOpenWppDirectlyEnabled) }, broadcastDispatcher = fakeBroadcastDispatcher, - accessibilityManager = kosmos.accessibilityManagerWrapper + accessibilityManager = kosmos.accessibilityManagerWrapper, + pulsingGestureListener = kosmos.pulsingGestureListener, ) setUpState() } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenSceneViewModelTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenSceneViewModelTest.kt index 11e9fa77d9bf..4eb146dbbaba 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenSceneViewModelTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenSceneViewModelTest.kt @@ -267,8 +267,8 @@ class LockscreenSceneViewModelTest : SysuiTestCase() { applicationScope = testScope.backgroundScope, deviceEntryInteractor = kosmos.deviceEntryInteractor, communalInteractor = kosmos.communalInteractor, - longPress = - KeyguardLongPressViewModel( + touchHandling = + KeyguardTouchHandlingViewModel( interactor = mock(), ), notifications = kosmos.notificationsPlaceholderViewModel, diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/SceneFrameworkIntegrationTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/SceneFrameworkIntegrationTest.kt index 9e4a34999a4b..cb4d96fa735f 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/SceneFrameworkIntegrationTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/scene/SceneFrameworkIntegrationTest.kt @@ -48,7 +48,7 @@ import com.android.systemui.deviceentry.domain.interactor.deviceEntryInteractor import com.android.systemui.flags.EnableSceneContainer import com.android.systemui.flags.Flags import com.android.systemui.flags.fakeFeatureFlagsClassic -import com.android.systemui.keyguard.ui.viewmodel.KeyguardLongPressViewModel +import com.android.systemui.keyguard.ui.viewmodel.KeyguardTouchHandlingViewModel import com.android.systemui.keyguard.ui.viewmodel.LockscreenSceneViewModel import com.android.systemui.kosmos.testScope import com.android.systemui.power.domain.interactor.PowerInteractor.Companion.setAsleepForTest @@ -147,8 +147,8 @@ class SceneFrameworkIntegrationTest : SysuiTestCase() { applicationScope = testScope.backgroundScope, deviceEntryInteractor = deviceEntryInteractor, communalInteractor = communalInteractor, - longPress = - KeyguardLongPressViewModel( + touchHandling = + KeyguardTouchHandlingViewModel( interactor = mock(), ), notifications = kosmos.notificationsPlaceholderViewModel, diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardLongPressInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardTouchHandlingInteractor.kt index bb6215a8b215..7a06d2fe9254 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardLongPressInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardTouchHandlingInteractor.kt @@ -32,6 +32,7 @@ import com.android.systemui.flags.Flags import com.android.systemui.keyguard.data.repository.KeyguardRepository import com.android.systemui.keyguard.shared.model.KeyguardState import com.android.systemui.res.R +import com.android.systemui.shade.PulsingGestureListener import com.android.systemui.statusbar.policy.AccessibilityManagerWrapper import javax.inject.Inject import kotlinx.coroutines.CoroutineScope @@ -51,10 +52,10 @@ import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.launch -/** Business logic for use-cases related to the keyguard long-press feature. */ +/** Business logic for use-cases related to top-level touch handling in the lock screen. */ @OptIn(ExperimentalCoroutinesApi::class) @SysUISingleton -class KeyguardLongPressInteractor +class KeyguardTouchHandlingInteractor @Inject constructor( @Application private val appContext: Context, @@ -65,6 +66,7 @@ constructor( private val featureFlags: FeatureFlags, broadcastDispatcher: BroadcastDispatcher, private val accessibilityManager: AccessibilityManagerWrapper, + private val pulsingGestureListener: PulsingGestureListener, ) { /** Whether the long-press handling feature should be enabled. */ val isLongPressHandlingEnabled: StateFlow<Boolean> = @@ -166,6 +168,16 @@ constructor( _shouldOpenSettings.value = false } + /** Notifies that the lockscreen has been clicked at position [x], [y]. */ + fun onClick(x: Float, y: Float) { + pulsingGestureListener.onSingleTapUp(x, y) + } + + /** Notifies that the lockscreen has been double clicked. */ + fun onDoubleClick() { + pulsingGestureListener.onDoubleTapEvent() + } + private fun showSettings() { _shouldOpenSettings.value = true } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardLongPressViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardLongPressViewBinder.kt index 09fe067f7724..057b4f9a671d 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardLongPressViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardLongPressViewBinder.kt @@ -22,7 +22,7 @@ import androidx.lifecycle.Lifecycle import androidx.lifecycle.repeatOnLifecycle import com.android.app.tracing.coroutines.launch import com.android.systemui.common.ui.view.LongPressHandlingView -import com.android.systemui.keyguard.ui.viewmodel.KeyguardLongPressViewModel +import com.android.systemui.keyguard.ui.viewmodel.KeyguardTouchHandlingViewModel import com.android.systemui.lifecycle.repeatWhenAttached import com.android.systemui.plugins.FalsingManager @@ -39,7 +39,7 @@ object KeyguardLongPressViewBinder { @JvmStatic fun bind( view: LongPressHandlingView, - viewModel: KeyguardLongPressViewModel, + viewModel: KeyguardTouchHandlingViewModel, onSingleTap: () -> Unit, falsingManager: FalsingManager, ) { diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardSettingsViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardSettingsViewBinder.kt index fa5756522a6a..4150ceb8aa31 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardSettingsViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardSettingsViewBinder.kt @@ -26,9 +26,9 @@ import com.android.app.tracing.coroutines.launch import com.android.systemui.animation.ActivityTransitionAnimator import com.android.systemui.common.ui.binder.IconViewBinder import com.android.systemui.common.ui.binder.TextViewBinder -import com.android.systemui.keyguard.ui.viewmodel.KeyguardLongPressViewModel import com.android.systemui.keyguard.ui.viewmodel.KeyguardRootViewModel import com.android.systemui.keyguard.ui.viewmodel.KeyguardSettingsMenuViewModel +import com.android.systemui.keyguard.ui.viewmodel.KeyguardTouchHandlingViewModel import com.android.systemui.keyguard.util.WallpaperPickerIntentUtils import com.android.systemui.keyguard.util.WallpaperPickerIntentUtils.LAUNCH_SOURCE_KEYGUARD import com.android.systemui.lifecycle.repeatWhenAttached @@ -44,7 +44,7 @@ object KeyguardSettingsViewBinder { fun bind( view: View, viewModel: KeyguardSettingsMenuViewModel, - longPressViewModel: KeyguardLongPressViewModel, + touchHandlingViewModel: KeyguardTouchHandlingViewModel, rootViewModel: KeyguardRootViewModel?, vibratorHelper: VibratorHelper, activityStarter: ActivityStarter @@ -97,7 +97,7 @@ object KeyguardSettingsViewBinder { val hitRect = Rect() view.getHitRect(hitRect) if (!hitRect.contains(point.x, point.y)) { - longPressViewModel.onTouchedOutside() + touchHandlingViewModel.onTouchedOutside() } } } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultSettingsPopupMenuSection.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultSettingsPopupMenuSection.kt index 32e76d0b24ff..5cd5172d1851 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultSettingsPopupMenuSection.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/view/layout/sections/DefaultSettingsPopupMenuSection.kt @@ -34,9 +34,9 @@ import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.keyguard.KeyguardBottomAreaRefactor import com.android.systemui.keyguard.shared.model.KeyguardSection import com.android.systemui.keyguard.ui.binder.KeyguardSettingsViewBinder -import com.android.systemui.keyguard.ui.viewmodel.KeyguardLongPressViewModel import com.android.systemui.keyguard.ui.viewmodel.KeyguardRootViewModel import com.android.systemui.keyguard.ui.viewmodel.KeyguardSettingsMenuViewModel +import com.android.systemui.keyguard.ui.viewmodel.KeyguardTouchHandlingViewModel import com.android.systemui.plugins.ActivityStarter import com.android.systemui.res.R import com.android.systemui.statusbar.VibratorHelper @@ -48,7 +48,7 @@ class DefaultSettingsPopupMenuSection constructor( @Main private val resources: Resources, private val keyguardSettingsMenuViewModel: KeyguardSettingsMenuViewModel, - private val keyguardLongPressViewModel: KeyguardLongPressViewModel, + private val keyguardTouchHandlingViewModel: KeyguardTouchHandlingViewModel, private val keyguardRootViewModel: KeyguardRootViewModel, private val vibratorHelper: VibratorHelper, private val activityStarter: ActivityStarter, @@ -76,7 +76,7 @@ constructor( KeyguardSettingsViewBinder.bind( constraintLayout.requireViewById<View>(R.id.keyguard_settings_button), keyguardSettingsMenuViewModel, - keyguardLongPressViewModel, + keyguardTouchHandlingViewModel, keyguardRootViewModel, vibratorHelper, activityStarter, diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModel.kt index 3e6f8e68891a..6fe51ae885be 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModel.kt @@ -44,7 +44,7 @@ constructor( private val quickAffordanceInteractor: KeyguardQuickAffordanceInteractor, private val bottomAreaInteractor: KeyguardBottomAreaInteractor, private val burnInHelperWrapper: BurnInHelperWrapper, - private val longPressViewModel: KeyguardLongPressViewModel, + private val keyguardTouchHandlingViewModel: KeyguardTouchHandlingViewModel, val settingsMenuViewModel: KeyguardSettingsMenuViewModel, ) { data class PreviewMode( @@ -162,7 +162,7 @@ constructor( * the lock screen settings menu item pop-up. */ fun onTouchedOutsideLockScreenSettingsMenu() { - longPressViewModel.onTouchedOutside() + keyguardTouchHandlingViewModel.onTouchedOutside() } private fun button( diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardSettingsMenuViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardSettingsMenuViewModel.kt index 66ceded2040d..36a342b13df7 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardSettingsMenuViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardSettingsMenuViewModel.kt @@ -17,10 +17,10 @@ package com.android.systemui.keyguard.ui.viewmodel -import com.android.systemui.res.R import com.android.systemui.common.shared.model.Icon import com.android.systemui.common.shared.model.Text -import com.android.systemui.keyguard.domain.interactor.KeyguardLongPressInteractor +import com.android.systemui.keyguard.domain.interactor.KeyguardTouchHandlingInteractor +import com.android.systemui.res.R import javax.inject.Inject import kotlinx.coroutines.flow.Flow @@ -28,7 +28,7 @@ import kotlinx.coroutines.flow.Flow class KeyguardSettingsMenuViewModel @Inject constructor( - private val interactor: KeyguardLongPressInteractor, + private val interactor: KeyguardTouchHandlingInteractor, ) { val isVisible: Flow<Boolean> = interactor.isMenuVisible val shouldOpenSettings: Flow<Boolean> = interactor.shouldOpenSettings diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardLongPressViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardTouchHandlingViewModel.kt index c73931a12455..f1cbf256a00f 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardLongPressViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardTouchHandlingViewModel.kt @@ -18,16 +18,16 @@ package com.android.systemui.keyguard.ui.viewmodel import com.android.systemui.dagger.SysUISingleton -import com.android.systemui.keyguard.domain.interactor.KeyguardLongPressInteractor +import com.android.systemui.keyguard.domain.interactor.KeyguardTouchHandlingInteractor import javax.inject.Inject import kotlinx.coroutines.flow.Flow -/** Models UI state to support the lock screen long-press feature. */ +/** Models UI state to support top-level touch handling in the lock screen. */ @SysUISingleton -class KeyguardLongPressViewModel +class KeyguardTouchHandlingViewModel @Inject constructor( - private val interactor: KeyguardLongPressInteractor, + private val interactor: KeyguardTouchHandlingInteractor, ) { /** Whether the long-press handling feature should be enabled. */ @@ -45,4 +45,14 @@ constructor( fun onTouchedOutside() { interactor.onTouchedOutside() } + + /** Notifies that the lockscreen has been clicked at position [x], [y]. */ + fun onClick(x: Float, y: Float) { + interactor.onClick(x, y) + } + + /** Notifies that the lockscreen has been double clicked. */ + fun onDoubleClick() { + interactor.onDoubleClick() + } } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModel.kt index b33eaa2c691b..1de0abeb931b 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModel.kt @@ -44,7 +44,7 @@ constructor( clockInteractor: KeyguardClockInteractor, private val interactor: KeyguardBlueprintInteractor, private val authController: AuthController, - val longPress: KeyguardLongPressViewModel, + val touchHandling: KeyguardTouchHandlingViewModel, val shadeInteractor: ShadeInteractor, @Application private val applicationScope: CoroutineScope, unfoldTransitionInteractor: UnfoldTransitionInteractor, diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenSceneViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenSceneViewModel.kt index 10cfd6ba44d8..630dcca56dd9 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenSceneViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenSceneViewModel.kt @@ -53,7 +53,7 @@ constructor( deviceEntryInteractor: DeviceEntryInteractor, communalInteractor: CommunalInteractor, shadeInteractor: ShadeInteractor, - val longPress: KeyguardLongPressViewModel, + val touchHandling: KeyguardTouchHandlingViewModel, val notifications: NotificationsPlaceholderViewModel, ) { val destinationScenes: StateFlow<Map<UserAction, UserActionResult>> = diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java index 8265cee8843e..16d10abb7d99 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java @@ -148,7 +148,7 @@ import com.android.systemui.keyguard.ui.viewmodel.DreamingToLockscreenTransition import com.android.systemui.keyguard.ui.viewmodel.GoneToDreamingLockscreenHostedTransitionViewModel; import com.android.systemui.keyguard.ui.viewmodel.GoneToDreamingTransitionViewModel; import com.android.systemui.keyguard.ui.viewmodel.KeyguardBottomAreaViewModel; -import com.android.systemui.keyguard.ui.viewmodel.KeyguardLongPressViewModel; +import com.android.systemui.keyguard.ui.viewmodel.KeyguardTouchHandlingViewModel; import com.android.systemui.keyguard.ui.viewmodel.LockscreenToDreamingTransitionViewModel; import com.android.systemui.keyguard.ui.viewmodel.LockscreenToOccludedTransitionViewModel; import com.android.systemui.keyguard.ui.viewmodel.OccludedToLockscreenTransitionViewModel; @@ -775,7 +775,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump @Main CoroutineDispatcher mainDispatcher, KeyguardTransitionInteractor keyguardTransitionInteractor, DumpManager dumpManager, - KeyguardLongPressViewModel keyguardLongPressViewModel, + KeyguardTouchHandlingViewModel keyguardTouchHandlingViewModel, KeyguardInteractor keyguardInteractor, ActivityStarter activityStarter, SharedNotificationContainerInteractor sharedNotificationContainerInteractor, @@ -970,7 +970,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump mKeyguardClockInteractor = keyguardClockInteractor; KeyguardLongPressViewBinder.bind( mView.requireViewById(R.id.keyguard_long_press), - keyguardLongPressViewModel, + keyguardTouchHandlingViewModel, () -> { onEmptySpaceClick(); return Unit.INSTANCE; diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java index 47fd494e9e53..1c223db33fe7 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowViewController.java @@ -369,7 +369,9 @@ public class NotificationShadeWindowViewController implements Dumpable { } mFalsingCollector.onTouchEvent(ev); - mPulsingWakeupGestureHandler.onTouchEvent(ev); + if (!SceneContainerFlag.isEnabled()) { + mPulsingWakeupGestureHandler.onTouchEvent(ev); + } if (!SceneContainerFlag.isEnabled() && mGlanceableHubContainerController.onTouchEvent(ev)) { diff --git a/packages/SystemUI/src/com/android/systemui/shade/PulsingGestureListener.kt b/packages/SystemUI/src/com/android/systemui/shade/PulsingGestureListener.kt index fe4832f0895b..062327dc2acf 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/PulsingGestureListener.kt +++ b/packages/SystemUI/src/com/android/systemui/shade/PulsingGestureListener.kt @@ -47,17 +47,19 @@ import javax.inject.Inject * display state, wake-ups are handled by [com.android.systemui.doze.DozeSensors]. */ @SysUISingleton -class PulsingGestureListener @Inject constructor( - private val falsingManager: FalsingManager, - private val dockManager: DockManager, - private val powerInteractor: PowerInteractor, - private val ambientDisplayConfiguration: AmbientDisplayConfiguration, - private val statusBarStateController: StatusBarStateController, - private val shadeLogger: ShadeLogger, - private val dozeInteractor: DozeInteractor, - userTracker: UserTracker, - tunerService: TunerService, - dumpManager: DumpManager +class PulsingGestureListener +@Inject +constructor( + private val falsingManager: FalsingManager, + private val dockManager: DockManager, + private val powerInteractor: PowerInteractor, + private val ambientDisplayConfiguration: AmbientDisplayConfiguration, + private val statusBarStateController: StatusBarStateController, + private val shadeLogger: ShadeLogger, + private val dozeInteractor: DozeInteractor, + userTracker: UserTracker, + tunerService: TunerService, + dumpManager: DumpManager ) : GestureDetector.SimpleOnGestureListener(), Dumpable { private var doubleTapEnabled = false private var singleTapEnabled = false @@ -66,21 +68,27 @@ class PulsingGestureListener @Inject constructor( val tunable = Tunable { key: String?, _: String? -> when (key) { Settings.Secure.DOZE_DOUBLE_TAP_GESTURE -> - doubleTapEnabled = ambientDisplayConfiguration.doubleTapGestureEnabled( - userTracker.userId) + doubleTapEnabled = + ambientDisplayConfiguration.doubleTapGestureEnabled(userTracker.userId) Settings.Secure.DOZE_TAP_SCREEN_GESTURE -> - singleTapEnabled = ambientDisplayConfiguration.tapGestureEnabled( - userTracker.userId) + singleTapEnabled = + ambientDisplayConfiguration.tapGestureEnabled(userTracker.userId) } } - tunerService.addTunable(tunable, - Settings.Secure.DOZE_DOUBLE_TAP_GESTURE, - Settings.Secure.DOZE_TAP_SCREEN_GESTURE) + tunerService.addTunable( + tunable, + Settings.Secure.DOZE_DOUBLE_TAP_GESTURE, + Settings.Secure.DOZE_TAP_SCREEN_GESTURE + ) dumpManager.registerDumpable(this) } override fun onSingleTapUp(e: MotionEvent): Boolean { + return onSingleTapUp(e.x, e.y) + } + + fun onSingleTapUp(x: Float, y: Float): Boolean { val isNotDocked = !dockManager.isDocked shadeLogger.logSingleTapUp(statusBarStateController.isDozing, singleTapEnabled, isNotDocked) if (statusBarStateController.isDozing && singleTapEnabled && isNotDocked) { @@ -89,11 +97,13 @@ class PulsingGestureListener @Inject constructor( shadeLogger.logSingleTapUpFalsingState(proximityIsNotNear, isNotAFalseTap) if (proximityIsNotNear && isNotAFalseTap) { shadeLogger.d("Single tap handled, requesting centralSurfaces.wakeUpIfDozing") - dozeInteractor.setLastTapToWakePosition(Point(e.x.toInt(), e.y.toInt())) + dozeInteractor.setLastTapToWakePosition(Point(x.toInt(), y.toInt())) powerInteractor.wakeUpIfDozing("PULSING_SINGLE_TAP", PowerManager.WAKE_REASON_TAP) } + return true } + shadeLogger.d("onSingleTapUp event ignored") return false } @@ -103,10 +113,18 @@ class PulsingGestureListener @Inject constructor( * motion events for a double tap. */ override fun onDoubleTapEvent(e: MotionEvent): Boolean { + if (e.actionMasked != MotionEvent.ACTION_UP) { + return false + } + + return onDoubleTapEvent() + } + + fun onDoubleTapEvent(): Boolean { // React to the [MotionEvent.ACTION_UP] event after double tap is detected. Falsing // checks MUST be on the ACTION_UP event. - if (e.actionMasked == MotionEvent.ACTION_UP && - statusBarStateController.isDozing && + if ( + statusBarStateController.isDozing && (doubleTapEnabled || singleTapEnabled) && !falsingManager.isProximityNear && !falsingManager.isFalseDoubleTap @@ -114,6 +132,7 @@ class PulsingGestureListener @Inject constructor( powerInteractor.wakeUpIfDozing("PULSING_DOUBLE_TAP", PowerManager.WAKE_REASON_TAP) return true } + return false } diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModelTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModelTest.kt index bdc5fc34158f..49a72e208464 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModelTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBottomAreaViewModelTest.kt @@ -46,8 +46,8 @@ import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository import com.android.systemui.keyguard.data.repository.KeyguardQuickAffordanceRepository import com.android.systemui.keyguard.domain.interactor.KeyguardBottomAreaInteractor import com.android.systemui.keyguard.domain.interactor.KeyguardInteractorFactory -import com.android.systemui.keyguard.domain.interactor.KeyguardLongPressInteractor import com.android.systemui.keyguard.domain.interactor.KeyguardQuickAffordanceInteractor +import com.android.systemui.keyguard.domain.interactor.KeyguardTouchHandlingInteractor import com.android.systemui.keyguard.domain.interactor.keyguardTransitionInteractor import com.android.systemui.keyguard.shared.quickaffordance.ActivationState import com.android.systemui.keyguard.shared.quickaffordance.KeyguardQuickAffordancePosition @@ -58,6 +58,7 @@ import com.android.systemui.scene.domain.interactor.sceneInteractor import com.android.systemui.settings.UserFileManager import com.android.systemui.settings.UserTracker import com.android.systemui.shade.domain.interactor.shadeInteractor +import com.android.systemui.shade.pulsingGestureListener import com.android.systemui.shared.keyguard.shared.model.KeyguardQuickAffordanceSlots import com.android.systemui.statusbar.policy.AccessibilityManagerWrapper import com.android.systemui.statusbar.policy.KeyguardStateController @@ -211,8 +212,8 @@ class KeyguardBottomAreaViewModelTest(flags: FlagsParameterization) : SysuiTestC dumpManager = mock(), userHandle = UserHandle.SYSTEM, ) - val keyguardLongPressInteractor = - KeyguardLongPressInteractor( + val keyguardTouchHandlingInteractor = + KeyguardTouchHandlingInteractor( appContext = mContext, scope = testScope.backgroundScope, transitionInteractor = kosmos.keyguardTransitionInteractor, @@ -221,6 +222,7 @@ class KeyguardBottomAreaViewModelTest(flags: FlagsParameterization) : SysuiTestC featureFlags = featureFlags, broadcastDispatcher = broadcastDispatcher, accessibilityManager = accessibilityManager, + pulsingGestureListener = kosmos.pulsingGestureListener, ) underTest = KeyguardBottomAreaViewModel( @@ -246,13 +248,13 @@ class KeyguardBottomAreaViewModelTest(flags: FlagsParameterization) : SysuiTestC ), bottomAreaInteractor = KeyguardBottomAreaInteractor(repository = repository), burnInHelperWrapper = burnInHelperWrapper, - longPressViewModel = - KeyguardLongPressViewModel( - interactor = keyguardLongPressInteractor, + keyguardTouchHandlingViewModel = + KeyguardTouchHandlingViewModel( + interactor = keyguardTouchHandlingInteractor, ), settingsMenuViewModel = KeyguardSettingsMenuViewModel( - interactor = keyguardLongPressInteractor, + interactor = keyguardTouchHandlingInteractor, ), ) } diff --git a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java index 15c4bfce0a04..e7ca091aaf4c 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java @@ -111,7 +111,7 @@ import com.android.systemui.keyguard.ui.viewmodel.DreamingToLockscreenTransition import com.android.systemui.keyguard.ui.viewmodel.GoneToDreamingLockscreenHostedTransitionViewModel; import com.android.systemui.keyguard.ui.viewmodel.GoneToDreamingTransitionViewModel; import com.android.systemui.keyguard.ui.viewmodel.KeyguardBottomAreaViewModel; -import com.android.systemui.keyguard.ui.viewmodel.KeyguardLongPressViewModel; +import com.android.systemui.keyguard.ui.viewmodel.KeyguardTouchHandlingViewModel; import com.android.systemui.keyguard.ui.viewmodel.LockscreenToDreamingTransitionViewModel; import com.android.systemui.keyguard.ui.viewmodel.LockscreenToOccludedTransitionViewModel; import com.android.systemui.keyguard.ui.viewmodel.OccludedToLockscreenTransitionViewModel; @@ -334,7 +334,7 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { @Mock protected PrimaryBouncerToGoneTransitionViewModel mPrimaryBouncerToGoneTransitionViewModel; @Mock protected KeyguardTransitionInteractor mKeyguardTransitionInteractor; - @Mock protected KeyguardLongPressViewModel mKeyuardLongPressViewModel; + @Mock protected KeyguardTouchHandlingViewModel mKeyuardTouchHandlingViewModel; @Mock protected AlternateBouncerInteractor mAlternateBouncerInteractor; @Mock protected MotionEvent mDownMotionEvent; @Mock protected CoroutineDispatcher mMainDispatcher; @@ -755,7 +755,7 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { mMainDispatcher, mKeyguardTransitionInteractor, mDumpManager, - mKeyuardLongPressViewModel, + mKeyuardTouchHandlingViewModel, mKeyguardInteractor, mActivityStarter, mSharedNotificationContainerInteractor, diff --git a/packages/SystemUI/tests/utils/src/android/hardware/display/AmbientDisplayConfigurationKosmos.kt b/packages/SystemUI/tests/utils/src/android/hardware/display/AmbientDisplayConfigurationKosmos.kt new file mode 100644 index 000000000000..3f3c30f0faec --- /dev/null +++ b/packages/SystemUI/tests/utils/src/android/hardware/display/AmbientDisplayConfigurationKosmos.kt @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.display + +import android.content.applicationContext +import com.android.systemui.kosmos.Kosmos +import com.android.systemui.kosmos.Kosmos.Fixture + +val Kosmos.ambientDisplayConfiguration by Fixture { + FakeAmbientDisplayConfiguration(applicationContext) +} diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardLongPressInteractorKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardLongPressInteractorKosmos.kt index c06f833c9e96..73799b63a6fc 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardLongPressInteractorKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/domain/interactor/KeyguardLongPressInteractorKosmos.kt @@ -24,10 +24,11 @@ import com.android.systemui.flags.featureFlagsClassic import com.android.systemui.keyguard.data.repository.keyguardRepository import com.android.systemui.kosmos.Kosmos import com.android.systemui.kosmos.applicationCoroutineScope +import com.android.systemui.shade.pulsingGestureListener -val Kosmos.keyguardLongPressInteractor by +val Kosmos.keyguardTouchHandlingInteractor by Kosmos.Fixture { - KeyguardLongPressInteractor( + KeyguardTouchHandlingInteractor( appContext = applicationContext, scope = applicationCoroutineScope, transitionInteractor = keyguardTransitionInteractor, @@ -36,5 +37,6 @@ val Kosmos.keyguardLongPressInteractor by featureFlags = featureFlagsClassic, broadcastDispatcher = broadcastDispatcher, accessibilityManager = accessibilityManagerWrapper, + pulsingGestureListener = pulsingGestureListener, ) } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardLongPressViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardLongPressViewModelKosmos.kt index 3c9846acf28c..281d7b051d50 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardLongPressViewModelKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardLongPressViewModelKosmos.kt @@ -16,12 +16,12 @@ package com.android.systemui.keyguard.ui.viewmodel -import com.android.systemui.keyguard.domain.interactor.keyguardLongPressInteractor +import com.android.systemui.keyguard.domain.interactor.keyguardTouchHandlingInteractor import com.android.systemui.kosmos.Kosmos -val Kosmos.keyguardLongPressViewModel by +val Kosmos.keyguardTouchHandlingViewModel by Kosmos.Fixture { - KeyguardLongPressViewModel( - interactor = keyguardLongPressInteractor, + KeyguardTouchHandlingViewModel( + interactor = keyguardTouchHandlingInteractor, ) } diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModelKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModelKosmos.kt index 30a4f21b67f5..24e47b0af3fa 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModelKosmos.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/ui/viewmodel/LockscreenContentViewModelKosmos.kt @@ -30,7 +30,7 @@ val Kosmos.lockscreenContentViewModel by clockInteractor = keyguardClockInteractor, interactor = keyguardBlueprintInteractor, authController = authController, - longPress = keyguardLongPressViewModel, + touchHandling = keyguardTouchHandlingViewModel, shadeInteractor = shadeInteractor, applicationScope = applicationCoroutineScope, unfoldTransitionInteractor = unfoldTransitionInteractor, diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/shade/PulsingGestureListenerKosmos.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/shade/PulsingGestureListenerKosmos.kt new file mode 100644 index 000000000000..4fc22289585f --- /dev/null +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/shade/PulsingGestureListenerKosmos.kt @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.systemui.shade + +import android.hardware.display.ambientDisplayConfiguration +import com.android.systemui.classifier.falsingManager +import com.android.systemui.dock.dockManager +import com.android.systemui.dump.dumpManager +import com.android.systemui.keyguard.domain.interactor.dozeInteractor +import com.android.systemui.kosmos.Kosmos +import com.android.systemui.kosmos.Kosmos.Fixture +import com.android.systemui.plugins.statusbar.statusBarStateController +import com.android.systemui.power.domain.interactor.powerInteractor +import com.android.systemui.settings.userTracker +import com.android.systemui.util.mockito.mock + +val Kosmos.pulsingGestureListener by Fixture { + PulsingGestureListener( + falsingManager = falsingManager, + dockManager = dockManager, + powerInteractor = powerInteractor, + ambientDisplayConfiguration = ambientDisplayConfiguration, + statusBarStateController = statusBarStateController, + shadeLogger = mock(), + dozeInteractor = dozeInteractor, + userTracker = userTracker, + tunerService = mock(), + dumpManager = dumpManager, + ) +} |