zl程序教程

您现在的位置是:首页 >  移动开发

当前栏目

Android 4.4 如何禁止显示通知

Android 如何 通知 4.4
2023-09-14 09:04:18 时间

代码路径:
frameworks/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
在PhoneStatusBar.java文件中addNotification()就是显示通知信息,如果想禁止显示通知就可以在这里添加变量控制返回

private static final boolean NOTIFICATION = false;
public void addNotification(IBinder key, StatusBarNotification notification) {
if (DEBUG) Log.d(TAG, “addNotification score=” + notification.getScore() +" , StatusBarNotification = " + notification +
" , notification icon = " + notification.getNotification().icon);
if(!NOTIFICATION){
return;
}
Entry shadeEntry = createNotificationViews(key, notification);
if (shadeEntry == null) {
return;
}
if (mUseHeadsUp && shouldInterrupt(notification)) {
if (DEBUG) Log.d(TAG, “launching notification in heads up mode”);
Entry interruptionCandidate = new Entry(key,