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

Commit 05445443 authored by Aaron Liu's avatar Aaron Liu
Browse files

Remove setalpha(0f) from reset.

Reset has too many callers for different reasons. It is extremely frail
and is causing the user switcher to disappear for various reasons.
Largely the user switcher disappears when switching users in the bouncer
and persisting the bouncer.

Fixes: 290355544
Test: Get multiple users and switch users with bouncer user switcher on.
Test: close and open bouncer scrimmed to see that the userswitcher does
not flicker.

Change-Id: I313240f1c594d5df6071b0dc6a7099496990e274
parent e8610d73
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -676,6 +676,14 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
        mSecurityViewFlipperController.reset();
    }

    /** Prepares views in the bouncer before starting appear animation. */
    public void prepareToShow() {
        View bouncerUserSwitcher = mView.findViewById(R.id.keyguard_bouncer_user_switcher);
        if (bouncerUserSwitcher != null) {
            bouncerUserSwitcher.setAlpha(0f);
        }
    }

    @Override
    public void onResume(int reason) {
        if (DEBUG) Log.d(TAG, "screen on, instance " + Integer.toHexString(hashCode()));
+2 −0
Original line number Diff line number Diff line
@@ -120,6 +120,8 @@ object KeyguardBouncerViewBinder {
                        viewModel.isShowing.collect { isShowing ->
                            view.visibility = if (isShowing) View.VISIBLE else View.INVISIBLE
                            if (isShowing) {
                                // Reset security container because these views are not reinflated.
                                securityContainerController.prepareToShow()
                                securityContainerController.reinflateViewFlipper {
                                    // Reset Security Container entirely.
                                    securityContainerController.onBouncerVisibilityChanged(
+12 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.testing.TestableResources
import android.view.Gravity
import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.View
import android.view.WindowInsetsController
import android.widget.FrameLayout
import androidx.test.filters.SmallTest
@@ -80,6 +81,7 @@ import org.mockito.Captor
import org.mockito.Mock
import org.mockito.Mockito.atLeastOnce
import org.mockito.Mockito.clearInvocations
import org.mockito.Mockito.mock
import org.mockito.Mockito.never
import org.mockito.Mockito.spy
import org.mockito.Mockito.verify
@@ -772,6 +774,16 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() {
            verify(viewMediatorCallback).keyguardDone(anyBoolean(), anyInt())
        }

    @Test
    fun testResetUserSwitcher() {
        val userSwitcher = mock(View::class.java)
        whenever(view.findViewById<View>(R.id.keyguard_bouncer_user_switcher))
            .thenReturn(userSwitcher)

        underTest.prepareToShow()
        verify(userSwitcher).setAlpha(0f)
    }

    private val registeredSwipeListener: KeyguardSecurityContainer.SwipeListener
        get() {
            underTest.onViewAttached()