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

Commit dedd3f0f authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[flexiglass] Log when visibility changes were rejected" into main

parents 05a5e0f0 06bfedbf
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,