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

Commit 87d29a6c authored by Lyn's avatar Lyn Committed by Lyn Han
Browse files

Fix HUN hiding and collapsing when cycling out

Bug: 336562983
Test: send two HUNs in fast succession
    => HUN does not hide, does not collapse when cycling out
Change-Id: I1987e03abfa2c8b98fcff0e0249cbfeee0300e60
parent c286eecc
Loading
Loading
Loading
Loading
+20 −11
Original line number Diff line number Diff line
@@ -30,7 +30,9 @@ import javax.inject.Inject
 * succession, by delaying visual listener side effects and removal handling from BaseHeadsUpManager
 */
@SysUISingleton
class AvalancheController @Inject constructor(
class AvalancheController
@Inject
constructor(
    dumpManager: DumpManager,
) : Dumpable {

@@ -79,7 +81,7 @@ class AvalancheController @Inject constructor(
        val fn = "[$label] => AvalancheController.update [${getKey(entry)}]"
        if (entry == null) {
            log { "Entry is NULL, stop update." }
            return;
            return
        }
        if (debug) {
            debugRunnableLabelMap[runnable] = label
@@ -142,9 +144,12 @@ class AvalancheController @Inject constructor(
        } else if (isShowing(entry)) {
            log { "$fn => [remove showing ${getKey(entry)}]" }
            previousHunKey = getKey(headsUpEntryShowing)

            // Show the next HUN before removing this one, so that we don't tell listeners
            // onHeadsUpPinnedModeChanged, which causes
            // NotificationPanelViewController.updateTouchableRegion to hide the window while the
            // HUN is animating out, resulting in a flicker.
            showNext()
            runnable.run()
            showNextAfterRemove()
        } else {
            log { "$fn => [removing untracked ${getKey(entry)}]" }
        }
@@ -247,7 +252,7 @@ class AvalancheController @Inject constructor(
        }
    }

    private fun showNextAfterRemove() {
    private fun showNext() {
        log { "SHOW NEXT" }
        headsUpEntryShowing = null

@@ -301,10 +306,14 @@ class AvalancheController @Inject constructor(
    }

    private fun logState(reason: String) {
        log { "\n================================================================================="}
        log {
            "\n================================================================================="
        }
        log { "STATE $reason" }
        log { getStateStr() }
        log { "=================================================================================\n"}
        log {
            "=================================================================================\n"
        }
    }

    private val dropSetStr: String