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

Commit 6fb979f4 authored by Julia Tuttle's avatar Julia Tuttle
Browse files

Add logReason to visual interruption decisions

This will let callers (like HeadsUpCoordinator) include the reason for
decisions in their logs while maintaining the simple two- or three-state
decision output.

Bug: 261728888
Test: builds
Change-Id: Ic85985a893b9e326a6178342546077d7c0daaf71
parent 0fe4eb97
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -36,6 +36,8 @@ class NotificationInterruptStateProviderWrapper(
        SHOULD_INTERRUPT(shouldInterrupt = true),
        SHOULD_NOT_INTERRUPT(shouldInterrupt = false);

        override val logReason = "unknown"

        companion object {
            fun of(booleanDecision: Boolean) =
                if (booleanDecision) SHOULD_INTERRUPT else SHOULD_NOT_INTERRUPT
@@ -49,6 +51,7 @@ class NotificationInterruptStateProviderWrapper(
    ) : FullScreenIntentDecision {
        override val shouldInterrupt = originalDecision.shouldLaunch
        override val wouldInterruptWithoutDnd = originalDecision == NO_FSI_SUPPRESSED_ONLY_BY_DND
        override val logReason = originalDecision.name
    }

    override fun addSuppressor(suppressor: NotificationInterruptSuppressor) {
+3 −0
Original line number Diff line number Diff line
@@ -32,9 +32,12 @@ interface VisualInterruptionDecisionProvider {
     * full-screen intent decisions.
     *
     * @property[shouldInterrupt] whether a visual interruption should be triggered
     * @property[logReason] a log-friendly string explaining the reason for the decision; should be
     *   used *only* for logging, not decision-making
     */
    interface Decision {
        val shouldInterrupt: Boolean
        val logReason: String
    }

    /**