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

Commit 10e56aca authored by Aaron Liu's avatar Aaron Liu
Browse files

[Bouncer] ensure that bouncer expansion callback..

Will accept setVisibilityChanged#isNotVisible. When dream appears, for whatever
reason, expansion is set to 0 which is BOUNCER_VISIBLE. This propagates
FULLY_SHOWN to callback listeners (for both with feature flag off and
on). In the same code path, bouncer#hide is called. The difference
between the old bouncer and the new bouncer is that visibility was
conflated so because the bouncer was already invisible, we did not
propagate this data to the callback listener that visibility is hidden.

I have separated this callback from when we set visibility with the
actual state flow. Instead,
call setVisibiltyChanged whenever show() or hide() is called for the
interactor.

Fixes: b/259081158
Test: Added a unit test.
Test: Set screen saver and show screen saver when charging. Open screen
saver a bunch of times from unlocked state and locked state to observe
that touches are not lost. I have observed the bug behavior without my change.

Change-Id: I56d535c0422337f09f009960d8e4117ec30ae9c1
parent 94ae2f13
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.os.Handler
import android.os.Trace
import android.os.UserHandle
import android.os.UserManager
import android.view.View
import com.android.keyguard.KeyguardSecurityModel
import com.android.keyguard.KeyguardUpdateMonitor
import com.android.systemui.DejankUtils
@@ -84,6 +85,7 @@ constructor(
            )
        )
        repository.setPrimaryShowingSoon(false)
        primaryBouncerCallbackInteractor.dispatchVisibilityChanged(View.VISIBLE)
    }

    val keyguardAuthenticated: Flow<Boolean> = repository.keyguardAuthenticated.filterNotNull()
@@ -182,6 +184,7 @@ constructor(
        repository.setPrimaryVisible(false)
        repository.setPrimaryHide(true)
        repository.setPrimaryShow(null)
        primaryBouncerCallbackInteractor.dispatchVisibilityChanged(View.INVISIBLE)
        Trace.endSection()
    }

@@ -276,11 +279,6 @@ constructor(
        repository.setShowMessage(null)
    }

    /** Notify that view visibility has changed. */
    fun notifyBouncerVisibilityHasChanged(visibility: Int) {
        primaryBouncerCallbackInteractor.dispatchVisibilityChanged(visibility)
    }

    /** Notify that the resources have been updated */
    fun notifyUpdatedResources() {
        repository.setResourceUpdateRequests(false)
+0 −1
Original line number Diff line number Diff line
@@ -152,7 +152,6 @@ object KeyguardBouncerViewBinder {
                            val visibility = if (isVisible) View.VISIBLE else View.INVISIBLE
                            view.visibility = visibility
                            hostViewController.onBouncerVisibilityChanged(visibility)
                            viewModel.notifyBouncerVisibilityHasChanged(visibility)
                        }
                    }

+0 −4
Original line number Diff line number Diff line
@@ -72,10 +72,6 @@ constructor(
    /** Observe whether screen is turned off. */
    val screenTurnedOff: Flow<Unit> = interactor.screenTurnedOff

    /** Notify that view visibility has changed. */
    fun notifyBouncerVisibilityHasChanged(visibility: Int) {
        return interactor.notifyBouncerVisibilityHasChanged(visibility)
    }
    /** Observe whether we want to update resources. */
    fun notifyUpdateResources() {
        interactor.notifyUpdatedResources()
+3 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.keyguard.domain.interactor
import android.os.Looper
import android.testing.AndroidTestingRunner
import android.testing.TestableLooper.RunWithLooper
import android.view.View
import androidx.test.filters.SmallTest
import com.android.keyguard.KeyguardSecurityModel
import com.android.keyguard.KeyguardUpdateMonitor
@@ -106,6 +107,7 @@ class PrimaryBouncerInteractorTest : SysuiTestCase() {
        verify(repository).setPrimaryVisible(true)
        verify(repository).setPrimaryShow(any(KeyguardBouncerModel::class.java))
        verify(repository).setPrimaryShowingSoon(false)
        verify(mPrimaryBouncerCallbackInteractor).dispatchVisibilityChanged(View.VISIBLE)
    }

    @Test
@@ -129,6 +131,7 @@ class PrimaryBouncerInteractorTest : SysuiTestCase() {
        verify(repository).setPrimaryVisible(false)
        verify(repository).setPrimaryHide(true)
        verify(repository).setPrimaryShow(null)
        verify(mPrimaryBouncerCallbackInteractor).dispatchVisibilityChanged(View.INVISIBLE)
    }

    @Test
+1 −1

File changed.

Contains only whitespace changes.