diff options
13 files changed, 26 insertions, 376 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt index 93754fd7e778..4c9049370c41 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/data/repository/KeyguardRepositoryImplTest.kt @@ -314,16 +314,6 @@ class KeyguardRepositoryImplTest : SysuiTestCase() { } @Test - fun isActiveDreamLockscreenHosted() = - testScope.runTest { - underTest.setIsActiveDreamLockscreenHosted(true) - assertThat(underTest.isActiveDreamLockscreenHosted.value).isEqualTo(true) - - underTest.setIsActiveDreamLockscreenHosted(false) - assertThat(underTest.isActiveDreamLockscreenHosted.value).isEqualTo(false) - } - - @Test fun isUdfpsSupported() = testScope.runTest { whenever(keyguardUpdateMonitor.isUdfpsSupported).thenReturn(true) @@ -423,17 +413,17 @@ class KeyguardRepositoryImplTest : SysuiTestCase() { runCurrent() listener.onDozeTransition( DozeMachine.State.DOZE_REQUEST_PULSE, - DozeMachine.State.DOZE_PULSING + DozeMachine.State.DOZE_PULSING, ) runCurrent() listener.onDozeTransition( DozeMachine.State.DOZE_SUSPEND_TRIGGERS, - DozeMachine.State.DOZE_PULSE_DONE + DozeMachine.State.DOZE_PULSE_DONE, ) runCurrent() listener.onDozeTransition( DozeMachine.State.DOZE_AOD_PAUSING, - DozeMachine.State.DOZE_AOD_PAUSED + DozeMachine.State.DOZE_AOD_PAUSED, ) runCurrent() @@ -443,22 +433,22 @@ class KeyguardRepositoryImplTest : SysuiTestCase() { // Initial value will be UNINITIALIZED DozeTransitionModel( DozeStateModel.UNINITIALIZED, - DozeStateModel.UNINITIALIZED + DozeStateModel.UNINITIALIZED, ), DozeTransitionModel(DozeStateModel.INITIALIZED, DozeStateModel.DOZE), DozeTransitionModel(DozeStateModel.DOZE, DozeStateModel.DOZE_AOD), DozeTransitionModel(DozeStateModel.DOZE_AOD_DOCKED, DozeStateModel.FINISH), DozeTransitionModel( DozeStateModel.DOZE_REQUEST_PULSE, - DozeStateModel.DOZE_PULSING + DozeStateModel.DOZE_PULSING, ), DozeTransitionModel( DozeStateModel.DOZE_SUSPEND_TRIGGERS, - DozeStateModel.DOZE_PULSE_DONE + DozeStateModel.DOZE_PULSE_DONE, ), DozeTransitionModel( DozeStateModel.DOZE_AOD_PAUSING, - DozeStateModel.DOZE_AOD_PAUSED + DozeStateModel.DOZE_AOD_PAUSED, ), ) ) @@ -510,12 +500,7 @@ class KeyguardRepositoryImplTest : SysuiTestCase() { // consuming it should handle that properly. assertThat(values).isEqualTo(listOf(null)) - listOf( - Point(500, 500), - Point(0, 0), - null, - Point(250, 250), - ) + listOf(Point(500, 500), Point(0, 0), null, Point(250, 250)) .onEach { facePropertyRepository.setSensorLocation(it) runCurrent() @@ -551,7 +536,7 @@ class KeyguardRepositoryImplTest : SysuiTestCase() { .onEach { biometricSourceType -> underTest.setBiometricUnlockState( BiometricUnlockMode.NONE, - BiometricUnlockSource.Companion.fromBiometricSourceType(biometricSourceType) + BiometricUnlockSource.Companion.fromBiometricSourceType(biometricSourceType), ) runCurrent() } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardClockInteractorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardClockInteractorTest.kt index 48621047016b..e60d971c7289 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardClockInteractorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/keyguard/domain/interactor/KeyguardClockInteractorTest.kt @@ -173,17 +173,6 @@ class KeyguardClockInteractorTest : SysuiTestCase() { @Test @EnableSceneContainer - fun clockShouldBeCentered_sceneContainerFlagOn_splitMode_isActiveDreamLockscreenHosted_true() = - testScope.runTest { - val value by collectLastValue(underTest.clockShouldBeCentered) - kosmos.shadeRepository.setShadeLayoutWide(true) - kosmos.activeNotificationListRepository.setActiveNotifs(1) - kosmos.keyguardRepository.setIsActiveDreamLockscreenHosted(true) - assertThat(value).isTrue() - } - - @Test - @EnableSceneContainer fun clockShouldBeCentered_sceneContainerFlagOn_splitMode_hasPulsingNotifications_false() = testScope.runTest { val value by collectLastValue(underTest.clockShouldBeCentered) diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/LockscreenHostedDreamGestureListenerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/LockscreenHostedDreamGestureListenerTest.kt deleted file mode 100644 index 2ac0ed0efff4..000000000000 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/LockscreenHostedDreamGestureListenerTest.kt +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (C) 2023 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.os.PowerManager -import android.view.MotionEvent -import androidx.test.ext.junit.runners.AndroidJUnit4 -import androidx.test.filters.SmallTest -import com.android.systemui.SysuiTestCase -import com.android.systemui.bouncer.domain.interactor.PrimaryBouncerInteractor -import com.android.systemui.classifier.FalsingCollector -import com.android.systemui.keyguard.data.repository.FakeKeyguardRepository -import com.android.systemui.plugins.FalsingManager -import com.android.systemui.plugins.statusbar.StatusBarStateController -import com.android.systemui.power.data.repository.FakePowerRepository -import com.android.systemui.power.domain.interactor.PowerInteractorFactory -import com.android.systemui.statusbar.StatusBarState -import com.android.systemui.util.mockito.whenever -import com.google.common.truth.Truth -import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.test.TestScope -import kotlinx.coroutines.test.UnconfinedTestDispatcher -import kotlinx.coroutines.test.runCurrent -import kotlinx.coroutines.test.runTest -import org.junit.Before -import org.junit.Test -import org.junit.runner.RunWith -import org.mockito.ArgumentMatchers -import org.mockito.Mock -import org.mockito.Mockito.never -import org.mockito.Mockito.verify -import org.mockito.MockitoAnnotations - -@SmallTest -@OptIn(ExperimentalCoroutinesApi::class) -@RunWith(AndroidJUnit4::class) -class LockscreenHostedDreamGestureListenerTest : SysuiTestCase() { - @Mock private lateinit var falsingManager: FalsingManager - @Mock private lateinit var falsingCollector: FalsingCollector - @Mock private lateinit var statusBarStateController: StatusBarStateController - @Mock private lateinit var shadeLogger: ShadeLogger - @Mock private lateinit var primaryBouncerInteractor: PrimaryBouncerInteractor - - private val testDispatcher = UnconfinedTestDispatcher() - private val testScope = TestScope(testDispatcher) - - private lateinit var powerRepository: FakePowerRepository - private lateinit var keyguardRepository: FakeKeyguardRepository - private lateinit var underTest: LockscreenHostedDreamGestureListener - - @Before - fun setUp() { - MockitoAnnotations.initMocks(this) - - powerRepository = FakePowerRepository() - keyguardRepository = FakeKeyguardRepository() - - underTest = - LockscreenHostedDreamGestureListener( - falsingManager, - PowerInteractorFactory.create( - repository = powerRepository, - statusBarStateController = statusBarStateController, - ) - .powerInteractor, - statusBarStateController, - primaryBouncerInteractor, - keyguardRepository, - shadeLogger, - ) - whenever(statusBarStateController.state).thenReturn(StatusBarState.KEYGUARD) - whenever(primaryBouncerInteractor.isBouncerShowing()).thenReturn(false) - } - - @Test - fun testGestureDetector_onSingleTap_whileDreaming() = - testScope.runTest { - // GIVEN device dreaming and the dream is hosted in lockscreen - whenever(statusBarStateController.isDreaming).thenReturn(true) - keyguardRepository.setIsActiveDreamLockscreenHosted(true) - testScope.runCurrent() - - // GIVEN the falsing manager does NOT think the tap is a false tap - whenever(falsingManager.isFalseTap(ArgumentMatchers.anyInt())).thenReturn(false) - - // WHEN there's a tap - underTest.onSingleTapUp(upEv) - - // THEN wake up device if dreaming - Truth.assertThat(powerRepository.lastWakeWhy).isNotNull() - Truth.assertThat(powerRepository.lastWakeReason).isEqualTo(PowerManager.WAKE_REASON_TAP) - } - - @Test - fun testGestureDetector_onSingleTap_notOnKeyguard() = - testScope.runTest { - // GIVEN device dreaming and the dream is hosted in lockscreen - whenever(statusBarStateController.isDreaming).thenReturn(true) - keyguardRepository.setIsActiveDreamLockscreenHosted(true) - testScope.runCurrent() - - // GIVEN shade is open - whenever(statusBarStateController.state).thenReturn(StatusBarState.SHADE) - - // GIVEN the falsing manager does NOT think the tap is a false tap - whenever(falsingManager.isFalseTap(ArgumentMatchers.anyInt())).thenReturn(false) - - // WHEN there's a tap - underTest.onSingleTapUp(upEv) - - // THEN the falsing manager never gets a call - verify(falsingManager, never()).isFalseTap(ArgumentMatchers.anyInt()) - } - - @Test - fun testGestureDetector_onSingleTap_bouncerShown() = - testScope.runTest { - // GIVEN device dreaming and the dream is hosted in lockscreen - whenever(statusBarStateController.isDreaming).thenReturn(true) - keyguardRepository.setIsActiveDreamLockscreenHosted(true) - testScope.runCurrent() - - // GIVEN bouncer is expanded - whenever(primaryBouncerInteractor.isBouncerShowing()).thenReturn(true) - - // GIVEN the falsing manager does NOT think the tap is a false tap - whenever(falsingManager.isFalseTap(ArgumentMatchers.anyInt())).thenReturn(false) - - // WHEN there's a tap - underTest.onSingleTapUp(upEv) - - // THEN the falsing manager never gets a call - verify(falsingManager, never()).isFalseTap(ArgumentMatchers.anyInt()) - } - - @Test - fun testGestureDetector_onSingleTap_falsing() = - testScope.runTest { - // GIVEN device dreaming and the dream is hosted in lockscreen - whenever(statusBarStateController.isDreaming).thenReturn(true) - keyguardRepository.setIsActiveDreamLockscreenHosted(true) - testScope.runCurrent() - - // GIVEN the falsing manager thinks the tap is a false tap - whenever(falsingManager.isFalseTap(ArgumentMatchers.anyInt())).thenReturn(true) - - // WHEN there's a tap - underTest.onSingleTapUp(upEv) - - // THEN the device doesn't wake up - Truth.assertThat(powerRepository.lastWakeWhy).isNull() - Truth.assertThat(powerRepository.lastWakeReason).isNull() - } - - @Test - fun testSingleTap_notDreaming_noFalsingCheck() = - testScope.runTest { - // GIVEN device not dreaming with lockscreen hosted dream - whenever(statusBarStateController.isDreaming).thenReturn(false) - keyguardRepository.setIsActiveDreamLockscreenHosted(false) - testScope.runCurrent() - - // WHEN there's a tap - underTest.onSingleTapUp(upEv) - - // THEN the falsing manager never gets a call - verify(falsingManager, never()).isFalseTap(ArgumentMatchers.anyInt()) - } -} - -private val upEv = MotionEvent.obtain(0L, 0L, MotionEvent.ACTION_UP, 0f, 0f, 0) diff --git a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt index 95cd9eb4ae4b..61832875dc2e 100644 --- a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt +++ b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt @@ -165,7 +165,7 @@ object Flags { val QS_USER_DETAIL_SHORTCUT = resourceBooleanFlag( R.bool.flag_lockscreen_qs_user_detail_shortcut, - "qs_user_detail_shortcut" + "qs_user_detail_shortcut", ) // TODO(b/254512383): Tracking Bug @@ -365,11 +365,6 @@ object Flags { val ZJ_285570694_LOCKSCREEN_TRANSITION_FROM_AOD = releasedFlag("zj_285570694_lockscreen_transition_from_aod") - // 3000 - dream - // TODO(b/285059790) : Tracking Bug - @JvmField - val LOCKSCREEN_WALLPAPER_DREAM_ENABLED = unreleasedFlag("enable_lockscreen_wallpaper_dream") - // TODO(b/283447257): Tracking bug @JvmField val BIGPICTURE_NOTIFICATION_LAZY_LOADING = diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt index 821017418277..23c6a4f82e73 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/data/repository/KeyguardRepository.kt @@ -184,9 +184,6 @@ interface KeyguardRepository { /** Observable for whether the device is dreaming with an overlay, see [DreamOverlayService] */ val isDreamingWithOverlay: Flow<Boolean> - /** Observable for device dreaming state and the active dream is hosted in lockscreen */ - val isActiveDreamLockscreenHosted: StateFlow<Boolean> - /** * Observable for the amount of doze we are currently in. * @@ -308,8 +305,6 @@ interface KeyguardRepository { fun setIsDozing(isDozing: Boolean) - fun setIsActiveDreamLockscreenHosted(isLockscreenHosted: Boolean) - fun dozeTimeTick() fun showDismissibleKeyguard() @@ -637,9 +632,6 @@ constructor( private val _isQuickSettingsVisible = MutableStateFlow(false) override val isQuickSettingsVisible: Flow<Boolean> = _isQuickSettingsVisible.asStateFlow() - private val _isActiveDreamLockscreenHosted = MutableStateFlow(false) - override val isActiveDreamLockscreenHosted = _isActiveDreamLockscreenHosted.asStateFlow() - private val _shortcutAbsoluteTop = MutableStateFlow(0F) override val shortcutAbsoluteTop = _shortcutAbsoluteTop.asStateFlow() @@ -698,10 +690,6 @@ constructor( _isQuickSettingsVisible.value = isVisible } - override fun setIsActiveDreamLockscreenHosted(isLockscreenHosted: Boolean) { - _isActiveDreamLockscreenHosted.value = isLockscreenHosted - } - override fun setClockShouldBeCentered(shouldBeCentered: Boolean) { _clockShouldBeCentered.value = shouldBeCentered } diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardClockInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardClockInteractor.kt index 5b7eeddfb8e1..d18d6dce2e94 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardClockInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardClockInteractor.kt @@ -105,21 +105,13 @@ constructor( combine( shadeInteractor.isShadeLayoutWide, activeNotificationsInteractor.areAnyNotificationsPresent, - keyguardInteractor.isActiveDreamLockscreenHosted, isOnAod, headsUpNotificationInteractor.isHeadsUpOrAnimatingAway, keyguardInteractor.isDozing, - ) { - isShadeLayoutWide, - areAnyNotificationsPresent, - isActiveDreamLockscreenHosted, - isOnAod, - isHeadsUp, - isDozing -> + ) { isShadeLayoutWide, areAnyNotificationsPresent, isOnAod, isHeadsUp, isDozing -> when { !isShadeLayoutWide -> true !areAnyNotificationsPresent -> true - isActiveDreamLockscreenHosted -> true // Pulsing notification appears on the right. Move clock left to avoid overlap. isHeadsUp && isDozing -> false else -> isOnAod diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt index 6ecbc6175e40..5369b53b5f8f 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/KeyguardInteractor.kt @@ -189,9 +189,6 @@ constructor( /** Whether any dreaming is running, including the doze dream. */ val isDreamingAny: Flow<Boolean> = repository.isDreaming - /** Whether the system is dreaming and the active dream is hosted in lockscreen */ - val isActiveDreamLockscreenHosted: StateFlow<Boolean> = repository.isActiveDreamLockscreenHosted - /** Event for when the camera gesture is detected */ val onCameraLaunchDetected: Flow<CameraLaunchSourceModel> = repository.onCameraLaunchDetected.filter { it.type != CameraLaunchType.IGNORE } @@ -477,10 +474,6 @@ constructor( } } - fun setIsActiveDreamLockscreenHosted(isLockscreenHosted: Boolean) { - repository.setIsActiveDreamLockscreenHosted(isLockscreenHosted) - } - /** Sets whether quick settings or quick-quick settings is visible. */ fun setQuickSettingsVisible(isVisible: Boolean) { repository.setQuickSettingsVisible(isVisible) diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/LightRevealScrimInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/LightRevealScrimInteractor.kt index cf747c81769a..328399a0b45c 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/LightRevealScrimInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/LightRevealScrimInteractor.kt @@ -149,7 +149,6 @@ constructor( KeyguardState.DOZING -> false KeyguardState.AOD -> false KeyguardState.DREAMING -> true - KeyguardState.DREAMING_LOCKSCREEN_HOSTED -> true KeyguardState.GLANCEABLE_HUB -> true KeyguardState.ALTERNATE_BOUNCER -> true KeyguardState.PRIMARY_BOUNCER -> true diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/KeyguardState.kt b/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/KeyguardState.kt index 080ddfd18370..f0e79b8590a0 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/KeyguardState.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/shared/model/KeyguardState.kt @@ -41,12 +41,6 @@ enum class KeyguardState { */ DREAMING, /** - * A device state after the device times out, which can be from both LOCKSCREEN or GONE states. - * It is a special version of DREAMING state but not DOZING. The active dream will be windowless - * and hosted in the lockscreen. - */ - DREAMING_LOCKSCREEN_HOSTED, - /** * The device has entered a special low-power mode within SystemUI, also called the Always-on * Display (AOD). A minimal UI is presented to show critical information. If the device is in * low-power mode without a UI, then it is DOZING. @@ -125,7 +119,6 @@ enum class KeyguardState { OFF, DOZING, DREAMING, - DREAMING_LOCKSCREEN_HOSTED, AOD, ALTERNATE_BOUNCER, OCCLUDED, @@ -142,7 +135,6 @@ enum class KeyguardState { OFF, DOZING, DREAMING, - DREAMING_LOCKSCREEN_HOSTED, AOD, ALTERNATE_BOUNCER, OCCLUDED, @@ -166,7 +158,6 @@ enum class KeyguardState { OFF -> false DOZING -> false DREAMING -> false - DREAMING_LOCKSCREEN_HOSTED -> false GLANCEABLE_HUB -> true AOD -> false ALTERNATE_BOUNCER -> true diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/DeviceEntryBackgroundViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/DeviceEntryBackgroundViewModel.kt index 68244d842046..4c667c1c702d 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/DeviceEntryBackgroundViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/DeviceEntryBackgroundViewModel.kt @@ -114,7 +114,6 @@ constructor( keyguardTransitionInteractor.currentKeyguardState.replayCache.last() ) { KeyguardState.GLANCEABLE_HUB, - KeyguardState.DREAMING_LOCKSCREEN_HOSTED, KeyguardState.GONE, KeyguardState.OCCLUDED, KeyguardState.OFF, diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/DeviceEntryIconViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/DeviceEntryIconViewModel.kt index d3bb4f5d7508..f5e0c81ca9a2 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/DeviceEntryIconViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/DeviceEntryIconViewModel.kt @@ -95,11 +95,10 @@ constructor( .shareIn(scope, SharingStarted.WhileSubscribed()) .onStart { emit(initialAlphaFromKeyguardState(transitionInteractor.getCurrentState())) } private val alphaMultiplierFromShadeExpansion: Flow<Float> = - combine( - showingAlternateBouncer, + combine(showingAlternateBouncer, shadeExpansion, qsProgress) { + showingAltBouncer, shadeExpansion, - qsProgress, - ) { showingAltBouncer, shadeExpansion, qsProgress -> + qsProgress -> val interpolatedQsProgress = (qsProgress * 2).coerceIn(0f, 1f) if (showingAltBouncer) { 1f @@ -113,13 +112,9 @@ constructor( combine( burnInInteractor.deviceEntryIconXOffset, burnInInteractor.deviceEntryIconYOffset, - burnInInteractor.udfpsProgress + burnInInteractor.udfpsProgress, ) { fullyDozingBurnInX, fullyDozingBurnInY, fullyDozingBurnInProgress -> - BurnInOffsets( - fullyDozingBurnInX, - fullyDozingBurnInY, - fullyDozingBurnInProgress, - ) + BurnInOffsets(fullyDozingBurnInX, fullyDozingBurnInY, fullyDozingBurnInProgress) } private val dozeAmount: Flow<Float> = transitionInteractor.transitionValue(KeyguardState.AOD) @@ -129,22 +124,15 @@ constructor( BurnInOffsets( intEvaluator.evaluate(dozeAmount, 0, burnInOffsets.x), intEvaluator.evaluate(dozeAmount, 0, burnInOffsets.y), - floatEvaluator.evaluate(dozeAmount, 0, burnInOffsets.progress) + floatEvaluator.evaluate(dozeAmount, 0, burnInOffsets.progress), ) } val deviceEntryViewAlpha: Flow<Float> = - combine( - transitionAlpha, - alphaMultiplierFromShadeExpansion, - ) { alpha, alphaMultiplier -> + combine(transitionAlpha, alphaMultiplierFromShadeExpansion) { alpha, alphaMultiplier -> alpha * alphaMultiplier } - .stateIn( - scope = scope, - started = SharingStarted.WhileSubscribed(), - initialValue = 0f, - ) + .stateIn(scope = scope, started = SharingStarted.WhileSubscribed(), initialValue = 0f) private fun initialAlphaFromKeyguardState(keyguardState: KeyguardState): Float { return when (keyguardState) { @@ -155,11 +143,10 @@ constructor( KeyguardState.GLANCEABLE_HUB, KeyguardState.GONE, KeyguardState.OCCLUDED, - KeyguardState.DREAMING_LOCKSCREEN_HOSTED, - KeyguardState.UNDEFINED, -> 0f + KeyguardState.UNDEFINED -> 0f KeyguardState.AOD, KeyguardState.ALTERNATE_BOUNCER, - KeyguardState.LOCKSCREEN, -> 1f + KeyguardState.LOCKSCREEN -> 1f } } @@ -171,7 +158,7 @@ constructor( combine( transitionInteractor.startedKeyguardTransitionStep.sample( shadeInteractor.isAnyFullyExpanded, - ::Pair + ::Pair, ), animatedBurnInOffsets, nonAnimatedBurnInOffsets, @@ -228,10 +215,9 @@ constructor( } val iconType: Flow<DeviceEntryIconView.IconType> = - combine( - deviceEntryUdfpsInteractor.isListeningForUdfps, - isUnlocked, - ) { isListeningForUdfps, isUnlocked -> + combine(deviceEntryUdfpsInteractor.isListeningForUdfps, isUnlocked) { + isListeningForUdfps, + isUnlocked -> if (isListeningForUdfps) { if (isUnlocked) { // Don't show any UI until isUnlocked=false. This covers the case @@ -250,10 +236,7 @@ constructor( val isVisible: Flow<Boolean> = deviceEntryViewAlpha.map { it > 0f }.distinctUntilChanged() private val isInteractive: Flow<Boolean> = - combine( - iconType, - isUdfpsSupported, - ) { deviceEntryStatus, isUdfps -> + combine(iconType, isUdfpsSupported) { deviceEntryStatus, isUdfps -> when (deviceEntryStatus) { DeviceEntryIconView.IconType.LOCK -> isUdfps DeviceEntryIconView.IconType.UNLOCK -> true diff --git a/packages/SystemUI/src/com/android/systemui/shade/LockscreenHostedDreamGestureListener.kt b/packages/SystemUI/src/com/android/systemui/shade/LockscreenHostedDreamGestureListener.kt deleted file mode 100644 index 45fc68a793bd..000000000000 --- a/packages/SystemUI/src/com/android/systemui/shade/LockscreenHostedDreamGestureListener.kt +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C) 2023 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.os.PowerManager -import android.view.GestureDetector -import android.view.MotionEvent -import com.android.systemui.bouncer.domain.interactor.PrimaryBouncerInteractor -import com.android.systemui.dagger.SysUISingleton -import com.android.systemui.keyguard.data.repository.KeyguardRepository -import com.android.systemui.plugins.FalsingManager -import com.android.systemui.plugins.FalsingManager.LOW_PENALTY -import com.android.systemui.plugins.statusbar.StatusBarStateController -import com.android.systemui.power.domain.interactor.PowerInteractor -import com.android.systemui.statusbar.StatusBarState -import javax.inject.Inject - -/** - * This gestureListener will wake up by tap when the device is dreaming but not dozing, and the - * selected screensaver is hosted in lockscreen. Tap is gated by the falsing manager. - * - * Touches go through the [NotificationShadeWindowViewController]. - */ -@SysUISingleton -class LockscreenHostedDreamGestureListener -@Inject -constructor( - private val falsingManager: FalsingManager, - private val powerInteractor: PowerInteractor, - private val statusBarStateController: StatusBarStateController, - private val primaryBouncerInteractor: PrimaryBouncerInteractor, - private val keyguardRepository: KeyguardRepository, - private val shadeLogger: ShadeLogger, -) : GestureDetector.SimpleOnGestureListener() { - private val TAG = this::class.simpleName - - override fun onSingleTapUp(e: MotionEvent): Boolean { - if (shouldHandleMotionEvent()) { - if (!falsingManager.isFalseTap(LOW_PENALTY)) { - shadeLogger.d("$TAG#onSingleTapUp tap handled, requesting wakeUpIfDreaming") - powerInteractor.wakeUpIfDreaming( - "DREAMING_SINGLE_TAP", - PowerManager.WAKE_REASON_TAP - ) - } else { - shadeLogger.d("$TAG#onSingleTapUp false tap ignored") - } - return true - } - return false - } - - private fun shouldHandleMotionEvent(): Boolean { - return keyguardRepository.isActiveDreamLockscreenHosted.value && - statusBarStateController.state == StatusBarState.KEYGUARD && - !primaryBouncerInteractor.isBouncerShowing() - } -} diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt index e513e8d2a350..0e69a6722af9 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/keyguard/data/repository/FakeKeyguardRepository.kt @@ -88,9 +88,6 @@ class FakeKeyguardRepository @Inject constructor() : KeyguardRepository { private val _isDreamingWithOverlay = MutableStateFlow(false) override val isDreamingWithOverlay: Flow<Boolean> = _isDreamingWithOverlay - private val _isActiveDreamLockscreenHosted = MutableStateFlow(false) - override val isActiveDreamLockscreenHosted: StateFlow<Boolean> = _isActiveDreamLockscreenHosted - private val _dozeAmount = MutableStateFlow(0f) override val linearDozeAmount: Flow<Float> = _dozeAmount @@ -235,10 +232,6 @@ class FakeKeyguardRepository @Inject constructor() : KeyguardRepository { _isDreamingWithOverlay.value = isDreaming } - override fun setIsActiveDreamLockscreenHosted(isLockscreenHosted: Boolean) { - _isActiveDreamLockscreenHosted.value = isLockscreenHosted - } - fun setDozeAmount(dozeAmount: Float) { _dozeAmount.value = dozeAmount } |