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

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

Revert "Reduce continuations for bottom area"

This reverts commit 17d40048.

Reason for revert: b/343692887

Change-Id: Ie79fc9c9f0fa17ab1188dd19a9ae9b64f5bdade2
parent 17d40048
Loading
Loading
Loading
Loading
+2 −4
Original line number Original line Diff line number Diff line
@@ -350,7 +350,7 @@ class KeyguardQuickAffordanceInteractorTest : SysuiTestCase() {
        }
        }


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


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


    @Test
    @Test
+7 −9
Original line number Original line Diff line number Diff line
@@ -19,11 +19,10 @@ package com.android.systemui.dock
import com.android.systemui.common.coroutine.ConflatedCallbackFlow
import com.android.systemui.common.coroutine.ConflatedCallbackFlow
import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.flow.Flow
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
 * Retrieves whether or not the device is docked according to DockManager. Emits a starting value
 * isDocked.
 *  of isDocked.
 */
 */
fun DockManager.retrieveIsDocked(): Flow<Boolean> =
fun DockManager.retrieveIsDocked(): Flow<Boolean> =
    ConflatedCallbackFlow.conflatedCallbackFlow {
    ConflatedCallbackFlow.conflatedCallbackFlow {
@@ -33,4 +32,3 @@ fun DockManager.retrieveIsDocked(): Flow<Boolean> =


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


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


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


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

    private const val TAG = "KeyguardQuickAffordanceViewBinder"
}
}
Loading