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

Commit 64b7087f authored by Lyn Han's avatar Lyn Han Committed by Android (Google) Code Review
Browse files

Merge changes I3ec31b66,I5071fa68 into main

* changes:
  Make VisualInterruptionFilter reason immutable and override in subclass
  Rename allow to calculateState since it no longer returns boolean
parents 0002b8ec daab0e8d
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -238,6 +238,9 @@ class AvalancheSuppressor(
    ) {
    val TAG = "AvalancheSuppressor"

    override var reason: String = "avalanche"
        protected set

    enum class State {
        ALLOW_CONVERSATION_AFTER_AVALANCHE,
        ALLOW_HIGH_PRIORITY_CONVERSATION_ANY_TIME,
@@ -252,13 +255,13 @@ class AvalancheSuppressor(
    override fun shouldSuppress(entry: NotificationEntry): Boolean {
        val timeSinceAvalanche = systemClock.currentTimeMillis() - avalancheProvider.startTime
        val isActive = timeSinceAvalanche < avalancheProvider.timeoutMs
        val state = allow(entry)
        val state = calculateState(entry)
        val suppress = isActive && state == State.SUPPRESS
        reason = "avalanche suppress=$suppress isActive=$isActive state=$state"
        return suppress
    }

    fun allow(entry: NotificationEntry): State  {
    private fun calculateState(entry: NotificationEntry): State  {
        if (
            entry.ranking.isConversation &&
                entry.sbn.notification.`when` > avalancheProvider.startTime
+1 −1
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ abstract class VisualInterruptionCondition(
/** A reason why visual interruptions might be suppressed based on the notification. */
abstract class VisualInterruptionFilter(
    override val types: Set<VisualInterruptionType>,
    override var reason: String,
    override val reason: String,
    override val uiEventId: UiEventEnum? = null,
    override val eventLogData: EventLogData? = null
) : VisualInterruptionSuppressor {