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

Commit 96fbd4bf authored by Yining Liu's avatar Yining Liu Committed by Android (Google) Code Review
Browse files

Merge "Fix the regression of Avalanche Notification when QS panel expanded" into main

parents aa97cd9d d8d69bd2
Loading
Loading
Loading
Loading
+17 −11
Original line number Diff line number Diff line
@@ -37,7 +37,8 @@ import javax.inject.Inject
@SysUISingleton
class AvalancheController
@Inject
constructor(dumpManager: DumpManager,
constructor(
    dumpManager: DumpManager,
    private val uiEventLogger: UiEventLogger,
    @Background private val bgHandler: Handler
) : Dumpable {
@@ -53,6 +54,9 @@ constructor(dumpManager: DumpManager,
                logDroppedHunsInBackground(getWaitingKeys().size)
                clearNext()
            }
            if (field != value) {
                field = value
            }
        }

    // HUN showing right now, in the floating state where full shade is hidden, on launcher or AOD
@@ -110,7 +114,7 @@ constructor(dumpManager: DumpManager,
            log { "Runnable is NULL, stop update." }
            return
        }
        if (!NotificationThrottleHun.isEnabled) {
        if (!isEnabled()) {
            runnable.run()
            return
        }
@@ -170,7 +174,7 @@ constructor(dumpManager: DumpManager,
            log { "Runnable is NULL, stop delete." }
            return
        }
        if (!NotificationThrottleHun.isEnabled) {
        if (!isEnabled()) {
            runnable.run()
            return
        }
@@ -356,12 +360,14 @@ constructor(dumpManager: DumpManager,
    }

    private fun logDroppedHunsInBackground(numDropped: Int) {
        bgHandler.post(Runnable {
        bgHandler.post(
            Runnable {
                // Do this in the background to avoid missing frames when closing the shade
                for (n in 1..numDropped) {
                    uiEventLogger.log(ThrottleEvent.AVALANCHE_THROTTLING_HUN_DROPPED)
                }
        })
            }
        )
    }

    fun clearNext() {