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

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

Merge "Revert "Reduce continuations for bottom area"" into main

parents 2ac3682e bcb70d42
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -350,7 +350,7 @@ class KeyguardQuickAffordanceInteractorTest : SysuiTestCase() {
        }

    @Test
    fun quickAffordance_doNotSendUpdatesWhileShadeExpandingAndStillHidden() =
    fun quickAffordance_updateOncePerShadeExpansion() =
        testScope.runTest {
            val shadeExpansion = MutableStateFlow(0f)
            whenever(shadeInteractor.anyExpansion).thenReturn(shadeExpansion)
@@ -365,9 +365,7 @@ class KeyguardQuickAffordanceInteractorTest : SysuiTestCase() {
                shadeExpansion.value = i / 10f
            }

            assertThat(collectedValue[0])
                .isInstanceOf(KeyguardQuickAffordanceModel.Hidden::class.java)
            assertThat(collectedValue.size).isEqualTo(initialSize)
            assertThat(collectedValue.size).isEqualTo(initialSize + 1)
        }

    @Test
+7 −9
Original line number Diff line number Diff line
@@ -19,11 +19,10 @@ package com.android.systemui.dock
import com.android.systemui.common.coroutine.ConflatedCallbackFlow
import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.distinctUntilChanged

/**
 * Retrieves whether or not the device is docked according to DockManager. Emits a starting value of
 * isDocked.
 * Retrieves whether or not the device is docked according to DockManager. Emits a starting value
 *  of isDocked.
 */
fun DockManager.retrieveIsDocked(): Flow<Boolean> =
    ConflatedCallbackFlow.conflatedCallbackFlow {
@@ -33,4 +32,3 @@ fun DockManager.retrieveIsDocked(): Flow<Boolean> =

        awaitClose { removeListener(callback) }
    }
 No newline at end of file
        .distinctUntilChanged()
+25 −27
Original line number Diff line number Diff line
@@ -116,8 +116,7 @@ constructor(
                            is ObservableTransitionState.Idle ->
                                it.currentScene == Scenes.Lockscreen
                            is ObservableTransitionState.Transition ->
                                    it.fromScene == Scenes.Lockscreen ||
                                        it.toScene == Scenes.Lockscreen
                                it.fromScene == Scenes.Lockscreen || it.toScene == Scenes.Lockscreen
                        }
                    }
                    .distinctUntilChanged()
@@ -133,7 +132,6 @@ constructor(
                KeyguardQuickAffordanceModel.Hidden
            }
        }
            .distinctUntilChanged()
    }

    /**
+1 −1
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ object KeyguardIndicationAreaBinder {
        val configurationBasedDimensions = MutableStateFlow(loadFromResources(view))
        val disposableHandle =
            view.repeatWhenAttached {
                repeatOnLifecycle(Lifecycle.State.CREATED) {
                repeatOnLifecycle(Lifecycle.State.STARTED) {
                    launch("$TAG#viewModel.alpha") {
                        // Do not independently apply alpha, as [KeyguardRootViewModel] should work
                        // for this and all its children
+4 −7
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@ import androidx.core.view.isVisible
import androidx.core.view.updateLayoutParams
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.repeatOnLifecycle
import com.android.app.tracing.coroutines.launch
import com.android.settingslib.Utils
import com.android.systemui.animation.Expandable
import com.android.systemui.animation.view.LaunchableImageView
@@ -81,8 +80,8 @@ object KeyguardQuickAffordanceViewBinder {
        val configurationBasedDimensions = MutableStateFlow(loadFromResources(view))
        val disposableHandle =
            view.repeatWhenAttached {
                repeatOnLifecycle(Lifecycle.State.CREATED) {
                    launch("$TAG#viewModel.collect") {
                repeatOnLifecycle(Lifecycle.State.STARTED) {
                    launch {
                        viewModel.collect { buttonModel ->
                            updateButton(
                                view = button,
@@ -94,7 +93,7 @@ object KeyguardQuickAffordanceViewBinder {
                        }
                    }

                    launch("$TAG#updateButtonAlpha") {
                    launch {
                        updateButtonAlpha(
                            view = button,
                            viewModel = viewModel,
@@ -102,7 +101,7 @@ object KeyguardQuickAffordanceViewBinder {
                        )
                    }

                    launch("$TAG#configurationBasedDimensions") {
                    launch {
                        configurationBasedDimensions.collect { dimensions ->
                            button.updateLayoutParams<ViewGroup.LayoutParams> {
                                width = dimensions.buttonSizePx.width
@@ -324,6 +323,4 @@ object KeyguardQuickAffordanceViewBinder {
    private data class ConfigurationBasedDimensions(
        val buttonSizePx: Size,
    )

    private const val TAG = "KeyguardQuickAffordanceViewBinder"
}
Loading