Loading packages/SystemUI/src/com/android/systemui/scene/domain/interactor/SceneInteractor.kt +67 −4 Original line number Diff line number Diff line Loading @@ -244,6 +244,7 @@ constructor( ) { val currentSceneKey = currentScene.value val resolvedScene = sceneFamilyResolvers.get()[toScene]?.resolvedScene?.value ?: toScene if ( !validateSceneChange( from = currentSceneKey, Loading Loading @@ -523,14 +524,32 @@ constructor( } if (from == to) { logger.logSceneChangeRejection( from = from, to = to, originalChangeReason = loggingReason, rejectionReason = "${from.debugName} is the same as ${to.debugName}", ) return false } if (to !in repository.allContentKeys) { logger.logSceneChangeRejection( from = from, to = to, originalChangeReason = loggingReason, rejectionReason = "${to.debugName} isn't present in allContentKeys", ) return false } if (disabledContentInteractor.isDisabled(to)) { logger.logSceneChangeRejection( from = from, to = to, originalChangeReason = loggingReason, rejectionReason = "${to.debugName} is currently disabled", ) return false } Loading Loading @@ -580,14 +599,58 @@ constructor( } if (to != null && disabledContentInteractor.isDisabled(to)) { logger.logSceneChangeRejection( from = from, to = to, originalChangeReason = loggingReason, rejectionReason = "${to.debugName} is currently disabled", ) return false } val isFromValid = (from == null) || (from in currentOverlays.value) val isToValid = (to == null) || (to !in currentOverlays.value && to in repository.allContentKeys) return when { to != null && from != null && to == from -> { logger.logSceneChangeRejection( from = from, to = to, originalChangeReason = loggingReason, rejectionReason = "${from.debugName} is the same as ${to.debugName}", ) false } return isFromValid && isToValid && from != to to != null && to !in repository.allContentKeys -> { logger.logSceneChangeRejection( from = from, to = to, originalChangeReason = loggingReason, rejectionReason = "${to.debugName} is not in allContentKeys", ) false } from != null && from !in currentOverlays.value -> { logger.logSceneChangeRejection( from = from, to = to, originalChangeReason = loggingReason, rejectionReason = "${from.debugName} is not a current overlay", ) false } to != null && to in currentOverlays.value -> { logger.logSceneChangeRejection( from = from, to = to, originalChangeReason = loggingReason, rejectionReason = "${to.debugName} is already a current overlay", ) false } else -> true } } /** Returns a flow indicating if the currently visible scene can be resolved from [family]. */ Loading packages/SystemUI/src/com/android/systemui/scene/shared/logger/SceneLogger.kt +33 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.scene.shared.logger import com.android.compose.animation.scene.ContentKey import com.android.compose.animation.scene.ObservableTransitionState import com.android.compose.animation.scene.OverlayKey import com.android.compose.animation.scene.SceneKey Loading Loading @@ -74,6 +75,38 @@ class SceneLogger @Inject constructor(@SceneFrameworkLog private val logBuffer: ) } fun logSceneChangeRejection( from: ContentKey?, to: ContentKey?, originalChangeReason: String, rejectionReason: String, ) { logBuffer.log( tag = TAG, level = LogLevel.INFO, messageInitializer = { str1 = "${from?.debugName ?: "<none>"} → ${to?.debugName ?: "<none>"}" str2 = rejectionReason str3 = originalChangeReason bool1 = to is OverlayKey }, messagePrinter = { buildString { append("REJECTED ") append( if (bool1) { "overlay " } else { "scene " } ) append("change because \"$str2\" ") append("(original change reason: \"$str3\")") } }, ) } fun logSceneTransition(transitionState: ObservableTransitionState) { when (transitionState) { is ObservableTransitionState.Transition -> { Loading Loading
packages/SystemUI/src/com/android/systemui/scene/domain/interactor/SceneInteractor.kt +67 −4 Original line number Diff line number Diff line Loading @@ -244,6 +244,7 @@ constructor( ) { val currentSceneKey = currentScene.value val resolvedScene = sceneFamilyResolvers.get()[toScene]?.resolvedScene?.value ?: toScene if ( !validateSceneChange( from = currentSceneKey, Loading Loading @@ -523,14 +524,32 @@ constructor( } if (from == to) { logger.logSceneChangeRejection( from = from, to = to, originalChangeReason = loggingReason, rejectionReason = "${from.debugName} is the same as ${to.debugName}", ) return false } if (to !in repository.allContentKeys) { logger.logSceneChangeRejection( from = from, to = to, originalChangeReason = loggingReason, rejectionReason = "${to.debugName} isn't present in allContentKeys", ) return false } if (disabledContentInteractor.isDisabled(to)) { logger.logSceneChangeRejection( from = from, to = to, originalChangeReason = loggingReason, rejectionReason = "${to.debugName} is currently disabled", ) return false } Loading Loading @@ -580,14 +599,58 @@ constructor( } if (to != null && disabledContentInteractor.isDisabled(to)) { logger.logSceneChangeRejection( from = from, to = to, originalChangeReason = loggingReason, rejectionReason = "${to.debugName} is currently disabled", ) return false } val isFromValid = (from == null) || (from in currentOverlays.value) val isToValid = (to == null) || (to !in currentOverlays.value && to in repository.allContentKeys) return when { to != null && from != null && to == from -> { logger.logSceneChangeRejection( from = from, to = to, originalChangeReason = loggingReason, rejectionReason = "${from.debugName} is the same as ${to.debugName}", ) false } return isFromValid && isToValid && from != to to != null && to !in repository.allContentKeys -> { logger.logSceneChangeRejection( from = from, to = to, originalChangeReason = loggingReason, rejectionReason = "${to.debugName} is not in allContentKeys", ) false } from != null && from !in currentOverlays.value -> { logger.logSceneChangeRejection( from = from, to = to, originalChangeReason = loggingReason, rejectionReason = "${from.debugName} is not a current overlay", ) false } to != null && to in currentOverlays.value -> { logger.logSceneChangeRejection( from = from, to = to, originalChangeReason = loggingReason, rejectionReason = "${to.debugName} is already a current overlay", ) false } else -> true } } /** Returns a flow indicating if the currently visible scene can be resolved from [family]. */ Loading
packages/SystemUI/src/com/android/systemui/scene/shared/logger/SceneLogger.kt +33 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.systemui.scene.shared.logger import com.android.compose.animation.scene.ContentKey import com.android.compose.animation.scene.ObservableTransitionState import com.android.compose.animation.scene.OverlayKey import com.android.compose.animation.scene.SceneKey Loading Loading @@ -74,6 +75,38 @@ class SceneLogger @Inject constructor(@SceneFrameworkLog private val logBuffer: ) } fun logSceneChangeRejection( from: ContentKey?, to: ContentKey?, originalChangeReason: String, rejectionReason: String, ) { logBuffer.log( tag = TAG, level = LogLevel.INFO, messageInitializer = { str1 = "${from?.debugName ?: "<none>"} → ${to?.debugName ?: "<none>"}" str2 = rejectionReason str3 = originalChangeReason bool1 = to is OverlayKey }, messagePrinter = { buildString { append("REJECTED ") append( if (bool1) { "overlay " } else { "scene " } ) append("change because \"$str2\" ") append("(original change reason: \"$str3\")") } }, ) } fun logSceneTransition(transitionState: ObservableTransitionState) { when (transitionState) { is ObservableTransitionState.Transition -> { Loading