SystemUI 應用的通知設置了懸浮通知幾秒後消失

不積跬步無以至千里

一.前摘

         測試這兩天提了一個鬧鐘通知的bug,描述是:鬧鐘響鈴,出現小卡片,等待5S左右,隱藏。而鬧鐘的同事說它已經設置了鬧鐘一直顯示的屬性,以及設置鬧鐘的fullscreenIntent,讓我們SystemUI模塊查看是否有問題?

二.分析

懸浮通知的顯示流程簡介

app/src/com/android/systemui/statusbar/AlertingNotificationManager.java

1.顯示懸浮通知

/**
     * Called when posting a new notification that should alert the user and appear on screen.
     * Adds the notification to be managed.
     * @param entry entry to show
     */
    public void showNotification(@NonNull NotificationEntry entry) {
        if (Log.isLoggable(TAG, Log.VERBOSE)) {
            Log.v(TAG, "showNotification");
        }
        addAlertEntry(entry);
        updateNotification(entry.key, true /* alert */);
        entry.setInterruption();
    }

2.addAlertEntry方法

/**
     * Add a new entry and begin managing it
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章