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

Commit f86c140b authored by Matt Pietal's avatar Matt Pietal Committed by Android (Google) Code Review
Browse files

Merge "Clip keyguard root view as the shade expands" into main

parents aad8a989 d317ebc5
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -138,6 +138,18 @@ class KeyguardRepositoryImplTest : SysuiTestCase() {
            assertThat(underTest.bottomAreaAlpha.value).isEqualTo(1f)
        }

    @Test
    fun topClippingBounds() =
        testScope.runTest {
            assertThat(underTest.topClippingBounds.value).isNull()

            underTest.topClippingBounds.value = 50
            assertThat(underTest.topClippingBounds.value).isEqualTo(50)

            underTest.topClippingBounds.value = 500
            assertThat(underTest.topClippingBounds.value).isEqualTo(500)
        }

    @Test
    fun clockPosition() =
        testScope.runTest {
+16 −3
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import com.android.systemui.Flags.FLAG_NEW_AOD_TRANSITION
import com.android.systemui.SysuiTestCase
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.deviceentry.data.repository.fakeDeviceEntryRepository
import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository
import com.android.systemui.keyguard.data.repository.fakeKeyguardTransitionRepository
import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.keyguard.shared.model.TransitionState
@@ -54,13 +55,12 @@ class KeyguardRootViewModelTest : SysuiTestCase() {
    private val kosmos = testKosmos()
    private val testScope = kosmos.testScope
    private val keyguardTransitionRepository = kosmos.fakeKeyguardTransitionRepository
    private val keyguardRepository = kosmos.fakeKeyguardRepository
    private val screenOffAnimationController = kosmos.screenOffAnimationController
    private val deviceEntryRepository = kosmos.fakeDeviceEntryRepository
    private val notificationsKeyguardInteractor = kosmos.notificationsKeyguardInteractor
    private val dozeParameters = kosmos.dozeParameters
    private val underTest by lazy {
        kosmos.keyguardRootViewModel
    }
    private val underTest by lazy { kosmos.keyguardRootViewModel }

    @Before
    fun setUp() {
@@ -206,6 +206,19 @@ class KeyguardRootViewModelTest : SysuiTestCase() {
            assertThat(isVisible?.isAnimating).isEqualTo(false)
        }

    @Test
    fun topClippingBounds() =
        testScope.runTest {
            val topClippingBounds by collectLastValue(underTest.topClippingBounds)
            assertThat(topClippingBounds).isNull()

            keyguardRepository.topClippingBounds.value = 50
            assertThat(topClippingBounds).isEqualTo(50)

            keyguardRepository.topClippingBounds.value = 1000
            assertThat(topClippingBounds).isEqualTo(1000)
        }

    @Test
    fun alpha_glanceableHubOpen_isZero() =
        testScope.runTest {
+6 −2
Original line number Diff line number Diff line
@@ -477,9 +477,13 @@ public class KeyguardClockSwitch extends RelativeLayout {
    public void dump(PrintWriter pw, String[] args) {
        pw.println("KeyguardClockSwitch:");
        pw.println("  mSmallClockFrame = " + mSmallClockFrame);
        if (mSmallClockFrame != null) {
            pw.println("  mSmallClockFrame.alpha = " + mSmallClockFrame.getAlpha());
        }
        pw.println("  mLargeClockFrame = " + mLargeClockFrame);
        if (mLargeClockFrame != null) {
            pw.println("  mLargeClockFrame.alpha = " + mLargeClockFrame.getAlpha());
        }
        pw.println("  mStatusArea = " + mStatusArea);
        pw.println("  mDisplayedClockSize = " + mDisplayedClockSize);
    }
+5 −0
Original line number Diff line number Diff line
@@ -132,6 +132,9 @@ interface KeyguardRepository {
     */
    val isDozing: StateFlow<Boolean>

    /** Keyguard can be clipped at the top as the shade is dragged */
    val topClippingBounds: MutableStateFlow<Int?>

    /**
     * Observable for whether the device is dreaming.
     *
@@ -326,6 +329,8 @@ constructor(
    private val _clockShouldBeCentered = MutableStateFlow(true)
    override val clockShouldBeCentered: Flow<Boolean> = _clockShouldBeCentered.asStateFlow()

    override val topClippingBounds = MutableStateFlow<Int?>(null)

    override val isKeyguardShowing: Flow<Boolean> =
        conflatedCallbackFlow {
                val callback =
+12 −0
Original line number Diff line number Diff line
@@ -171,6 +171,14 @@ constructor(
    /** Whether the keyguard is going away. */
    val isKeyguardGoingAway: Flow<Boolean> = repository.isKeyguardGoingAway

    /** Keyguard can be clipped at the top as the shade is dragged */
    val topClippingBounds: Flow<Int?> =
        combine(configurationInteractor.onAnyConfigurationChange, repository.topClippingBounds) {
            _,
            topClippingBounds ->
            topClippingBounds
        }

    /** Last point that [KeyguardRootView] view was tapped */
    val lastRootViewTapPosition: Flow<Point?> = repository.lastRootViewTapPosition.asStateFlow()

@@ -328,6 +336,10 @@ constructor(
        repository.keyguardDoneAnimationsFinished()
    }

    fun setTopClippingBounds(top: Int?) {
        repository.topClippingBounds.value = top
    }

    companion object {
        private const val TAG = "KeyguardInteractor"
    }
Loading