Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 95f2cf67 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Merge cherrypicks of ['googleplex-android-review.googlesource.com/29482266',...

Merge cherrypicks of ['googleplex-android-review.googlesource.com/29482266', 'googleplex-android-review.googlesource.com/29585216', 'googleplex-android-review.googlesource.com/29692708', 'googleplex-android-review.googlesource.com/29692454', 'googleplex-android-review.googlesource.com/29752423', 'googleplex-android-review.googlesource.com/29754214', 'googleplex-android-review.googlesource.com/29755470', 'googleplex-android-review.googlesource.com/29521246', 'googleplex-android-review.googlesource.com/29782146', 'googleplex-android-review.googlesource.com/29778605'] into 24Q4-release.

Change-Id: Ic1ba67186e149d78d0695de1b1f53b47fd8865fd
parents 6e18b388 a9bd641e
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ class DreamOverlayCallbackControllerTest : SysuiTestCase() {

        // Adding twice should not invoke twice
        reset(callback)
        underTest.onStartDream()
        underTest.addCallback(callback)
        underTest.onWakeUp()
        verify(callback, times(1)).onWakeUp()
@@ -67,6 +68,19 @@ class DreamOverlayCallbackControllerTest : SysuiTestCase() {
        verify(callback, never()).onWakeUp()
    }

    @Test
    fun onWakeUp_multipleCalls() {
        underTest.onStartDream()
        assertThat(underTest.isDreaming).isEqualTo(true)

        underTest.addCallback(callback)
        underTest.onWakeUp()
        underTest.onWakeUp()
        underTest.onWakeUp()
        verify(callback, times(1)).onWakeUp()
        assertThat(underTest.isDreaming).isEqualTo(false)
    }

    @Test
    fun onStartDreamInvokesCallback() {
        underTest.addCallback(callback)
+3 −0
Original line number Diff line number Diff line
@@ -712,6 +712,9 @@ class DreamOverlayServiceTest : SysuiTestCase() {

        // Verify DreamOverlayContainerViewController is destroyed.
        verify(mDreamOverlayContainerViewController).destroy()

        // DreamOverlay callback receives onWakeUp.
        verify(mDreamOverlayCallbackController).onWakeUp()
    }

    @Test
+8 −5
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import org.mockito.Mockito.clearInvocations
import org.mockito.Mockito.never
import org.mockito.Mockito.verify
import org.mockito.junit.MockitoJUnit
import org.mockito.kotlin.isNull

@ExperimentalCoroutinesApi
@SmallTest
@@ -96,7 +97,7 @@ class KeyguardKeyEventInteractorTest : SysuiTestCase() {
            .sendVolumeKeyEvent(
                eq(actionDownVolumeDownKeyEvent),
                eq(AudioManager.USE_DEFAULT_STREAM_TYPE),
                eq(true)
                eq(true),
            )

        assertThat(underTest.dispatchKeyEvent(actionDownVolumeUpKeyEvent)).isTrue()
@@ -104,7 +105,7 @@ class KeyguardKeyEventInteractorTest : SysuiTestCase() {
            .sendVolumeKeyEvent(
                eq(actionDownVolumeUpKeyEvent),
                eq(AudioManager.USE_DEFAULT_STREAM_TYPE),
                eq(true)
                eq(true),
            )
    }

@@ -117,7 +118,7 @@ class KeyguardKeyEventInteractorTest : SysuiTestCase() {
            .sendVolumeKeyEvent(
                eq(actionDownVolumeDownKeyEvent),
                eq(AudioManager.USE_DEFAULT_STREAM_TYPE),
                eq(true)
                eq(true),
            )

        assertThat(underTest.dispatchKeyEvent(actionDownVolumeUpKeyEvent)).isFalse()
@@ -125,7 +126,7 @@ class KeyguardKeyEventInteractorTest : SysuiTestCase() {
            .sendVolumeKeyEvent(
                eq(actionDownVolumeUpKeyEvent),
                eq(AudioManager.USE_DEFAULT_STREAM_TYPE),
                eq(true)
                eq(true),
            )
    }

@@ -135,7 +136,9 @@ class KeyguardKeyEventInteractorTest : SysuiTestCase() {
        whenever(statusBarStateController.state).thenReturn(StatusBarState.SHADE_LOCKED)
        whenever(statusBarKeyguardViewManager.shouldDismissOnMenuPressed()).thenReturn(true)

        verifyActionUpCollapsesTheShade(KeyEvent.KEYCODE_MENU)
        val actionUpMenuKeyEvent = KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_MENU)
        assertThat(underTest.dispatchKeyEvent(actionUpMenuKeyEvent)).isTrue()
        verify(statusBarKeyguardViewManager).dismissWithAction(any(), isNull(), eq(false))
    }

    @Test
+8 −18
Original line number Diff line number Diff line
@@ -188,17 +188,6 @@ class KeyguardRootViewModelTest(flags: FlagsParameterization) : SysuiTestCase()
            assertThat(isVisible?.isAnimating).isFalse()
        }

    @Test
    fun iconContainer_isVisible_bypassEnabled() =
        testScope.runTest {
            val isVisible by collectLastValue(underTest.isNotifIconContainerVisible)
            runCurrent()
            deviceEntryRepository.setBypassEnabled(true)
            runCurrent()

            assertThat(isVisible?.value).isTrue()
        }

    @Test
    fun iconContainer_isNotVisible_pulseExpanding_notBypassing() =
        testScope.runTest {
@@ -288,22 +277,23 @@ class KeyguardRootViewModelTest(flags: FlagsParameterization) : SysuiTestCase()
        }

    @Test
    fun iconContainer_isNotVisible_bypassDisabled_onLockscreen() =
    fun iconContainer_isNotVisible_notifsFullyHiddenThenVisible_bypassEnabled() =
        testScope.runTest {
            val isVisible by collectLastValue(underTest.isNotifIconContainerVisible)
            runCurrent()
            keyguardTransitionRepository.sendTransitionSteps(
                from = KeyguardState.AOD,
                to = KeyguardState.LOCKSCREEN,
                testScope,
            )
            notificationsKeyguardInteractor.setPulseExpanding(false)
            deviceEntryRepository.setBypassEnabled(false)
            deviceEntryRepository.setBypassEnabled(true)
            whenever(dozeParameters.alwaysOn).thenReturn(true)
            whenever(dozeParameters.displayNeedsBlanking).thenReturn(false)
            notificationsKeyguardInteractor.setNotificationsFullyHidden(true)
            runCurrent()

            assertThat(isVisible?.value).isTrue()
            assertThat(isVisible?.isAnimating).isTrue()

            notificationsKeyguardInteractor.setNotificationsFullyHidden(false)
            runCurrent()

            assertThat(isVisible?.value).isFalse()
            assertThat(isVisible?.isAnimating).isTrue()
        }
+4 −2
Original line number Diff line number Diff line
@@ -39,9 +39,11 @@ class DreamOverlayCallbackController @Inject constructor() :
    }

    fun onWakeUp() {
        if (isDreaming) {
            isDreaming = false
            callbacks.forEach { it.onWakeUp() }
        }
    }

    fun onStartDream() {
        isDreaming = true
Loading