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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章