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

Commit b88bc152 authored by Chandru S's avatar Chandru S Committed by Android (Google) Code Review
Browse files

Merge "Lower logging level and minor type change" into main

parents a08a0293 43c0f9cd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ class WindowRootViewModelTest : SysuiTestCase() {

            assertThat(blurRadius).isEqualTo(0f)

            kosmos.windowRootViewBlurRepository.blurRequestedByShade.value = 60
            kosmos.windowRootViewBlurRepository.blurRequestedByShade.value = 60.0f
            runCurrent()

            assertThat(blurRadius).isEqualTo(0f)
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow

class NoopWindowRootViewBlurRepository @Inject constructor() : WindowRootViewBlurRepository {
    override val blurRequestedByShade: MutableStateFlow<Int> = MutableStateFlow(0)
    override val blurRequestedByShade: MutableStateFlow<Float> = MutableStateFlow(0.0f)
    override val scaleRequestedByShade: MutableStateFlow<Float> = MutableStateFlow(1.0f)
    override val isBlurSupported: StateFlow<Boolean> = MutableStateFlow(false)
    override var blurAppliedListener: BlurAppliedListener? = null
+2 −2
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ typealias BlurAppliedListener = Consumer<Int>

/** Repository that maintains state for the window blur effect. */
interface WindowRootViewBlurRepository {
    val blurRequestedByShade: MutableStateFlow<Int>
    val blurRequestedByShade: MutableStateFlow<Float>

    val scaleRequestedByShade: MutableStateFlow<Float>

@@ -76,7 +76,7 @@ constructor(

    override val trackingShadeMotion = MutableStateFlow(false)

    override val blurRequestedByShade = MutableStateFlow(0)
    override val blurRequestedByShade = MutableStateFlow(0.0f)

    override val scaleRequestedByShade = MutableStateFlow(1.0f)

+2 −2
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@ constructor(
    val isBlurCurrentlySupported: StateFlow<Boolean> = repository.isBlurSupported

    /** Radius of blur to be applied on the window root view. */
    val blurRadiusRequestedByShade: StateFlow<Int> = repository.blurRequestedByShade.asStateFlow()
    val blurRadiusRequestedByShade: StateFlow<Float> = repository.blurRequestedByShade.asStateFlow()

    /** Scale factor to apply to content underneath blurs on the window root view. */
    val blurScaleRequestedByShade: StateFlow<Float> = repository.scaleRequestedByShade.asStateFlow()
@@ -121,7 +121,7 @@ constructor(
        if (communalInteractor.isCommunalBlurring.value) {
            return false
        }
        repository.blurRequestedByShade.value = blurRadius
        repository.blurRequestedByShade.value = blurRadius.toFloat()
        repository.scaleRequestedByShade.value = blurScale
        return true
    }
+2 −5
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.merge
import kotlinx.coroutines.flow.onEach

@@ -62,9 +61,7 @@ constructor(
        listOf(
                *bouncerBlurRadiusFlows.toTypedArray(),
                *glanceableHubBlurRadiusFlows.toTypedArray(),
                blurInteractor.blurRadiusRequestedByShade
                    .map { it.toFloat() }
                    .logIfPossible("ShadeBlur"),
                blurInteractor.blurRadiusRequestedByShade.logIfPossible("ShadeBlur"),
            )
            .merge()

@@ -135,7 +132,7 @@ constructor(

    private companion object {
        const val TAG = "WindowRootViewModel"
        val isLoggable = Log.isLoggable(TAG, Log.VERBOSE) || Build.isDebuggable()
        val isLoggable = Log.isLoggable(TAG, Log.VERBOSE) || Build.IS_ENG

        fun <T> Flow<T>.logIfPossible(loggingInfo: String): Flow<T> {
            return onEach { if (isLoggable) Log.v(TAG, "$loggingInfo $it") }
Loading