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

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

Merge "Fix NPE: hasFullScreenIntent" into main

parents a3292406 ae2bd286
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ constructor(
                // allowed again.
                logDroppedHunsInBackground(getWaitingKeys().size)
                clearNext()
                headsUpEntryShowing = null
            }
            if (field != value) {
                field = value
@@ -226,11 +227,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;
    }