不積跬步無以至千里
一.前摘
測試這兩天提了一個鬧鐘通知的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