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

Commit ae2bd286 authored by lyn's avatar lyn
Browse files

Fix NPE: hasFullScreenIntent

Clear headsUpEntryShowing on shade open so that we don't try to
update a null mEntry of the previously showing hun when shade closes

Fixes: 355355815
Test: treehugger
Flag: com.android.systemui.notification_avalanche_throttle_hun
Change-Id: I2ef7f6dfee6689c5deef6af1d4d1caa59b0efe48
parent e49f5aba
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ constructor(
                // allowed again.
                logDroppedHunsInBackground(getWaitingKeys().size)
                clearNext()
                headsUpEntryShowing = null
            }
            if (field != value) {
                field = value
@@ -215,11 +216,15 @@ constructor(
     * 2) The priority of the top HUN in the next batch Used by
     *    BaseHeadsUpManager.HeadsUpEntry.calculateFinishTime to shorten display duration.
     */
    fun getDurationMs(entry: HeadsUpEntry, autoDismissMs: Int): Int {
    fun getDurationMs(entry: HeadsUpEntry?, autoDismissMs: Int): Int {
        if (!isEnabled()) {
            // Use default duration, like we did before AvalancheController existed
            return autoDismissMs
        }
        if (entry == null) {
            // This should never happen
            return autoDismissMs
        }
        val showingList: MutableList<HeadsUpEntry> = mutableListOf()
        if (headsUpEntryShowing != null) {
            showingList.add(headsUpEntryShowing!!)
+9 −0
Original line number Diff line number Diff line
@@ -344,6 +344,15 @@ public abstract class BaseHeadsUpManager implements HeadsUpManager {
    }

    protected boolean hasFullScreenIntent(@NonNull NotificationEntry entry) {
        if (entry == null) {
            return false;
        }
        if (entry.getSbn() == null) {
            return false;
        }
        if (entry.getSbn().getNotification() == null) {
            return false;
        }
        return entry.getSbn().getNotification().fullScreenIntent != null;
    }