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

Commit d317ebc5 authored by Matt Pietal's avatar Matt Pietal
Browse files

Clip keyguard root view as the shade expands

This should prevent keyguard content from being visible under or above
the shade. Future flexiglass work should fix this completely with
correct z-ordering, but the existing implementation with shared scrims
can result in overlapping rendering.

Test: manual, expand/collpase shade in all orientations and with
splitshade
Test: atest KeyguardRepositoryImplTest KeyguardRootViewModelTest
ScrimControllerTest
Flag: ACONFIG com.android.systemui.keyguard_shade_migration_nssl
DEVELOPMENT

Change-Id: If5e7b40b0ca7565947bf1c695c14fb08995e547e
parent e21c60f2
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