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

Commit 0e6ba4ff authored by Aaron Liu's avatar Aaron Liu
Browse files

Do not set alpha to 1f when bouncer shows

Alpha here was set to 1f everytime the bouncer shows to ensure that the
bouncer shows every time. This has caused issues with the introduction
of a material U background color for the bouncer. We had bugs where the bouncer alpha was 0, which is why alpha is set to 1f here.
Looking at it further, setExpansion is not called in the cases that
expansion is already 0f. This is because we were not setting the panel
expansion to HIDDEN (1f) anytime we hide the bouncer.

Fixes: 281024571
Test: Simpin/Simpuk
Test: password, pattern, pin scrimmed and track
Test: Testing auth and then power off and on and going back to scrimmed
bouncer and tracked bouncer.

Change-Id: I572280daef98da64045e12508a6efd60141a42b6
parent ef9b2174
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -599,7 +599,6 @@ public class KeyguardSecurityContainer extends ConstraintLayout {
     */
    public void startAppearAnimation(SecurityMode securityMode) {
        setTranslationY(0f);
        setAlpha(1f);
        updateChildren(0 /* translationY */, 1f /* alpha */);
        mViewMode.startAppearAnimation(securityMode);
    }
+1 −2
Original line number Diff line number Diff line
@@ -674,7 +674,6 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard

    public void startAppearAnimation() {
        if (mCurrentSecurityMode != SecurityMode.None) {
            setAlpha(1f);
            mView.startAppearAnimation(mCurrentSecurityMode);
            getCurrentSecurityController(controller -> controller.startAppearAnimation());
        }
@@ -1112,7 +1111,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
     */
    public void setExpansion(float fraction) {
        float scaledFraction = BouncerPanelExpansionCalculator.showBouncerProgress(fraction);
        mView.setAlpha(MathUtils.constrain(1 - scaledFraction, 0f, 1f));
        setAlpha(MathUtils.constrain(1 - scaledFraction, 0f, 1f));
        mView.setTranslationY(scaledFraction * mTranslationY);
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ import com.android.systemui.keyguard.data.BouncerView
import com.android.systemui.keyguard.data.repository.KeyguardBouncerRepository
import com.android.systemui.keyguard.data.repository.TrustRepository
import com.android.systemui.keyguard.shared.constants.KeyguardBouncerConstants
import com.android.systemui.keyguard.shared.constants.KeyguardBouncerConstants.EXPANSION_HIDDEN
import com.android.systemui.keyguard.shared.model.BouncerShowMessageModel
import com.android.systemui.plugins.ActivityStarter
import com.android.systemui.shared.system.SysUiStatsLog
@@ -183,6 +184,7 @@ constructor(
        cancelShowRunnable()
        repository.setPrimaryShowingSoon(false)
        repository.setPrimaryShow(false)
        repository.setPanelExpansion(EXPANSION_HIDDEN)
        primaryBouncerCallbackInteractor.dispatchVisibilityChanged(View.INVISIBLE)
        Trace.endSection()
    }
+9 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.keyguard;

import static com.android.keyguard.KeyguardSecurityContainer.MODE_DEFAULT;
import static com.android.keyguard.KeyguardSecurityContainer.MODE_ONE_HANDED;
import static com.android.systemui.keyguard.shared.constants.KeyguardBouncerConstants.EXPANSION_VISIBLE;

import static com.google.common.truth.Truth.assertThat;

@@ -685,6 +686,14 @@ public class KeyguardSecurityContainerControllerTest extends SysuiTestCase {
        verify(mSideFpsController).hide(SideFpsUiRequestSource.PRIMARY_BOUNCER);
    }

    @Test
    public void setExpansion_setsAlpha() {
        mKeyguardSecurityContainerController.setExpansion(EXPANSION_VISIBLE);

        verify(mView).setAlpha(1f);
        verify(mView).setTranslationY(0f);
    }

    private KeyguardSecurityContainer.SwipeListener getRegisteredSwipeListener() {
        mKeyguardSecurityContainerController.onViewAttached();
        verify(mView).setSwipeListener(mSwipeListenerArgumentCaptor.capture());
+1 −0
Original line number Diff line number Diff line
@@ -154,6 +154,7 @@ class PrimaryBouncerInteractorTest : SysuiTestCase() {
        verify(repository).setPrimaryShow(false)
        verify(mPrimaryBouncerCallbackInteractor).dispatchVisibilityChanged(View.INVISIBLE)
        verify(repository).setPrimaryStartDisappearAnimation(null)
        verify(repository).setPanelExpansion(EXPANSION_HIDDEN)
    }

    @Test