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
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user