Notifications通知到SystemUI(“Notifications 通知”拆解)
android12-release
APP请求系统通知(“Notifications 通知”拆解)
SystemUI启动,及其SystemUIService启动
SystemUIService中StatusBar注册NotificationListener
com.android.systemui.statusbar.phone.StatusBar
SystemUI传递过来的Context
frameworks/base/core/java/android/service/notification/NotificationListenerService.java
mSystemContext = context
: SystemUI传递过来的ContextgetNotificationInterface
获取NotificationListenerService接口代理,经过binder调用mHandler = new MyHandler(context.getMainLooper())
这个MyHandler运行在SystemUI进程noMan.registerListener
向system_server进程中的NotificationListenerService注册监听器;- APP请求系统通知(“Notifications 通知”拆解) 是NotificationListenerWrapper.onNotificationPosted过程是运行在SystemUI进程(即调用NotificationListenerService中NotificationListenerWrapper实例对象的onNotificationPosted())
NotificationEntryManager.java:SystemUI显示/更新Notification
APP请求系统通知(“Notifications 通知”拆解)通知到SystemUI监听
frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/NotificationListener.java
frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java中注册