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

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

Merge "Fade NSSL with brightness slider" into main

parents 64f38830 6ec15648
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -139,6 +139,27 @@ class KeyguardRepositoryImplTest : SysuiTestCase() {
            assertThat(underTest.bottomAreaAlpha.value).isEqualTo(1f)
        }

    @Test
    fun panelAlpha() =
        testScope.runTest {
            assertThat(underTest.panelAlpha.value).isEqualTo(1f)

            underTest.setPanelAlpha(0.1f)
            assertThat(underTest.panelAlpha.value).isEqualTo(0.1f)

            underTest.setPanelAlpha(0.2f)
            assertThat(underTest.panelAlpha.value).isEqualTo(0.2f)

            underTest.setPanelAlpha(0.3f)
            assertThat(underTest.panelAlpha.value).isEqualTo(0.3f)

            underTest.setPanelAlpha(0.5f)
            assertThat(underTest.panelAlpha.value).isEqualTo(0.5f)

            underTest.setPanelAlpha(1.0f)
            assertThat(underTest.panelAlpha.value).isEqualTo(1f)
        }

    @Test
    fun topClippingBounds() =
        testScope.runTest {
+11 −0
Original line number Diff line number Diff line
@@ -78,6 +78,8 @@ interface KeyguardRepository {

    val keyguardAlpha: StateFlow<Float>

    val panelAlpha: MutableStateFlow<Float>

    /**
     * Observable for whether the keyguard is showing.
     *
@@ -250,6 +252,9 @@ interface KeyguardRepository {
    /** Sets the current amount of alpha that should be used for rendering the keyguard. */
    fun setKeyguardAlpha(alpha: Float)

    /** Temporary shim for fading out content when the brightness slider is used */
    fun setPanelAlpha(alpha: Float)

    /** Whether the device is actively dreaming */
    fun setDreaming(isDreaming: Boolean)

@@ -338,6 +343,8 @@ constructor(
    private val _keyguardAlpha = MutableStateFlow(1f)
    override val keyguardAlpha = _keyguardAlpha.asStateFlow()

    override val panelAlpha: MutableStateFlow<Float> = MutableStateFlow(1f)

    private val _clockShouldBeCentered = MutableStateFlow(true)
    override val clockShouldBeCentered: Flow<Boolean> = _clockShouldBeCentered.asStateFlow()

@@ -659,6 +666,10 @@ constructor(
        _keyguardAlpha.value = alpha
    }

    override fun setPanelAlpha(alpha: Float) {
        panelAlpha.value = alpha
    }

    override fun setDreaming(isDreaming: Boolean) {
        this.isDreaming.value = isDreaming
    }
+8 −0
Original line number Diff line number Diff line
@@ -321,6 +321,10 @@ constructor(
    @Deprecated("Use the relevant TransitionViewModel")
    val keyguardAlpha: Flow<Float> = repository.keyguardAlpha

    /** Temporary shim for fading out content when the brightness slider is used */
    @Deprecated("SceneContainer uses NotificationStackAppearanceInteractor")
    val panelAlpha: StateFlow<Float> = repository.panelAlpha.asStateFlow()

    /**
     * When the lockscreen can be dismissed, emit an alpha value as the user swipes up. This is
     * useful just before the code commits to moving to GONE.
@@ -458,6 +462,10 @@ constructor(
        repository.setKeyguardAlpha(alpha)
    }

    fun setPanelAlpha(alpha: Float) {
        repository.setPanelAlpha(alpha)
    }

    fun setAnimateDozingTransitions(animate: Boolean) {
        repository.setAnimateDozingTransitions(animate)
    }
+8 −1
Original line number Diff line number Diff line
@@ -483,7 +483,9 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
    private float mBottomAreaShadeAlpha;
    final ValueAnimator mBottomAreaShadeAlphaAnimator;
    private final AnimatableProperty mPanelAlphaAnimator = AnimatableProperty.from("panelAlpha",
            NotificationPanelView::setPanelAlphaInternal,
            (view, alpha) -> {
                setAlphaInternal(alpha);
            },
            NotificationPanelView::getCurrentPanelAlpha,
            R.id.panel_alpha_animator_tag, R.id.panel_alpha_animator_start_tag,
            R.id.panel_alpha_animator_end_tag);
@@ -3074,6 +3076,11 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
        }
    }

    private void setAlphaInternal(float alpha) {
        mKeyguardInteractor.setPanelAlpha(alpha / 255f);
        mView.setPanelAlphaInternal(alpha);
    }

    @Override
    public void setAlphaChangeAnimationEndAction(Runnable r) {
        mPanelAlphaEndAction = r;
+4 −2
Original line number Diff line number Diff line
@@ -68,7 +68,6 @@ import com.android.systemui.classifier.Classifier;
import com.android.systemui.classifier.FalsingCollector;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.keyguard.MigrateClocksToBlueprint;
import com.android.systemui.keyguard.data.repository.KeyguardTransitionRepository;
import com.android.systemui.keyguard.shared.model.KeyguardState;
import com.android.systemui.keyguard.shared.model.TransitionStep;
@@ -1320,7 +1319,10 @@ public class NotificationStackScrollLayoutController implements Dumpable {
        updateAlpha();
    }

    void setMaxAlphaFromView(float alpha) {
    /**
     * Max alpha from the containing view. Used by brightness slider as an example.
     */
    public void setMaxAlphaFromView(float alpha) {
        mMaxAlphaFromView = alpha;
        updateAlpha();
    }
Loading