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

Commit 06bfedbf authored by Ale Nijamkin's avatar Ale Nijamkin
Browse files

[flexiglass] Log when visibility changes were rejected

It's helpful for debugging to see when visibility changes for the scene
container were rejected because the visibility already had the new
value.

Bug: 416718983
Bug: 416718898
Test: manually verified that logcat displays visibility rejections now
Flag: com.android.systemui.scene_container
Change-Id: Ibf885a116590ce71d9b164fda259a8265dbeb1e7
parent a0a26017
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -470,11 +470,12 @@ constructor(
    fun setVisible(isVisible: Boolean, loggingReason: String) {
        val wasVisible = repository.isVisible.value
        if (wasVisible == isVisible) {
            logger.logVisibilityRejection(to = isVisible, reason = loggingReason)
            return
        }

        logger.logVisibilityChange(from = wasVisible, to = isVisible, reason = loggingReason)
        return repository.setVisible(isVisible)
        repository.setVisible(isVisible)
    }

    /**
+16 −0
Original line number Diff line number Diff line
@@ -193,6 +193,22 @@ class SceneLogger @Inject constructor(@SceneFrameworkLog private val logBuffer:
        )
    }

    fun logVisibilityRejection(to: Boolean, reason: String) {
        fun asWord(isVisible: Boolean): String {
            return if (isVisible) "visible" else "invisible"
        }

        logBuffer.log(
            tag = TAG,
            level = LogLevel.INFO,
            messageInitializer = {
                str1 = asWord(to)
                str2 = reason
            },
            messagePrinter = { "REJECTED visibility change to $str1 with reason: $str2" },
        )
    }

    fun logRemoteUserInputStarted(reason: String) {
        logBuffer.log(
            tag = TAG,