Loading packages/SystemUI/src/com/android/systemui/shade/ShadeDisplayChangeLatencyTracker.kt +3 −3 Original line number Diff line number Diff line Loading @@ -95,7 +95,7 @@ constructor( */ @Synchronized fun onShadeDisplayChanging(displayId: Int) { previousJob?.cancel(CancellationException("New shade move in progress")) previousJob?.cancel(CancellationException("New shade move in progress to $displayId")) previousJob = bgScope.launch { onShadeDisplayChangingAsync(displayId) } } Loading @@ -109,8 +109,8 @@ constructor( val reason = when (e) { is CancellationException -> "Shade move cancelled as a new move is being done " + "before the previous one finished." "Shade move to $displayId cancelled as a new move is being done " + "before the previous one finished. Message: ${e.message}" else -> "Shade move cancelled." } Loading packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeExpandedStateInteractor.kt +13 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.shade.domain.interactor import android.util.Log import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.scene.shared.flag.SceneContainerFlag Loading @@ -25,6 +26,7 @@ import com.android.systemui.shade.shared.flag.DualShade import com.android.systemui.util.kotlin.Utils.Companion.combineState import javax.inject.Inject import kotlin.coroutines.CoroutineContext import kotlin.time.Duration import kotlin.time.Duration.Companion.seconds import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.MutableStateFlow Loading @@ -32,7 +34,7 @@ import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.first import kotlinx.coroutines.withContext import kotlinx.coroutines.withTimeout import kotlinx.coroutines.withTimeoutOrNull /** * Wrapper around [ShadeInteractor] to facilitate expansion and collapse of Notifications and quick Loading @@ -57,6 +59,8 @@ interface ShadeExpandedStateInteractor { } } private val EXPAND_COLLAPSE_TIMEOUT: Duration = 1.seconds @SysUISingleton class ShadeExpandedStateInteractorImpl @Inject Loading Loading @@ -89,7 +93,14 @@ constructor( private suspend fun StateFlow<Float>.waitUntil(f: Float, coroutineContext: CoroutineContext) { // it's important to not do this in the main thread otherwise it will block any rendering. withContext(coroutineContext) { withTimeout(1.seconds) { traceWaitForExpansion(expansion = f) { first { it == f } } } withTimeoutOrNull(EXPAND_COLLAPSE_TIMEOUT) { traceWaitForExpansion(expansion = f) { first { it == f } } } ?: Log.e( "ShadeExpStateInteractor", "Timed out after ${EXPAND_COLLAPSE_TIMEOUT.inWholeMilliseconds}ms while waiting " + "for expansion to match $f. Current one: $value", ) } } Loading Loading
packages/SystemUI/src/com/android/systemui/shade/ShadeDisplayChangeLatencyTracker.kt +3 −3 Original line number Diff line number Diff line Loading @@ -95,7 +95,7 @@ constructor( */ @Synchronized fun onShadeDisplayChanging(displayId: Int) { previousJob?.cancel(CancellationException("New shade move in progress")) previousJob?.cancel(CancellationException("New shade move in progress to $displayId")) previousJob = bgScope.launch { onShadeDisplayChangingAsync(displayId) } } Loading @@ -109,8 +109,8 @@ constructor( val reason = when (e) { is CancellationException -> "Shade move cancelled as a new move is being done " + "before the previous one finished." "Shade move to $displayId cancelled as a new move is being done " + "before the previous one finished. Message: ${e.message}" else -> "Shade move cancelled." } Loading
packages/SystemUI/src/com/android/systemui/shade/domain/interactor/ShadeExpandedStateInteractor.kt +13 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.shade.domain.interactor import android.util.Log import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.scene.shared.flag.SceneContainerFlag Loading @@ -25,6 +26,7 @@ import com.android.systemui.shade.shared.flag.DualShade import com.android.systemui.util.kotlin.Utils.Companion.combineState import javax.inject.Inject import kotlin.coroutines.CoroutineContext import kotlin.time.Duration import kotlin.time.Duration.Companion.seconds import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.MutableStateFlow Loading @@ -32,7 +34,7 @@ import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.first import kotlinx.coroutines.withContext import kotlinx.coroutines.withTimeout import kotlinx.coroutines.withTimeoutOrNull /** * Wrapper around [ShadeInteractor] to facilitate expansion and collapse of Notifications and quick Loading @@ -57,6 +59,8 @@ interface ShadeExpandedStateInteractor { } } private val EXPAND_COLLAPSE_TIMEOUT: Duration = 1.seconds @SysUISingleton class ShadeExpandedStateInteractorImpl @Inject Loading Loading @@ -89,7 +93,14 @@ constructor( private suspend fun StateFlow<Float>.waitUntil(f: Float, coroutineContext: CoroutineContext) { // it's important to not do this in the main thread otherwise it will block any rendering. withContext(coroutineContext) { withTimeout(1.seconds) { traceWaitForExpansion(expansion = f) { first { it == f } } } withTimeoutOrNull(EXPAND_COLLAPSE_TIMEOUT) { traceWaitForExpansion(expansion = f) { first { it == f } } } ?: Log.e( "ShadeExpStateInteractor", "Timed out after ${EXPAND_COLLAPSE_TIMEOUT.inWholeMilliseconds}ms while waiting " + "for expansion to match $f. Current one: $value", ) } } Loading