Notification framework层的处理流程分析
google了一段时间发现没人写notification在framework中具体怎么实现的,感到很奇怪,是我搜索有问题?哎,不管了,反正工作需要,自己琢磨琢磨吧。
相关文件:
framework/base/core/java/android/app/NotificationManager.java
framework/base/services/java/com/android/server/NotificationManagerService.java{@hide} extends INotificationManager.Stub
framework/base/services/java/com/android/server/StatusBarManagerService.java extends IStatusBarService.Stub
framework/base/core/java/com/android/internal/statusbar/StatusBarNotification implements Parcelable
framework/base/core/java/com/android/internal/statusbar/IStatusBar.aidl
framework/base/core/java/com/android/internal/statusbar/IStatusBarService.aidl
framework/base/core/java/com/android/internal/statusbar/StatusBarNotification.aidl
framework/base/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java extends Service implements CommandQueue.Callbacks
framework/base/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java extends IStatusBar.Stub
1>.系统启动的时候:framework/base/services/java/com/android/server/SystemServer.java中:
Java代码
try {
Slog.i(TAG, "Status Bar");
statusBar = new StatusBarManagerService(context);
ServiceManager.addService(Context.STATUS_BAR_SERVICE, statusBar);
} catch (Throwable e) {
Slog.e(TAG, "Failure starting StatusBarManagerService", e);
}
try {
Slog.i(TAG, "Notification Manager");
notification = new NotificationManagerService(context, statusBar, lights);
ServiceManager.addService(Context.NOTIFICATION_SERVICE, notification);
} catch (Throwable e) {
Slog.e(TAG, "Failure starting Notification Manager", e);
}
注册状态栏管理和通知管理这两个服务。
2>.在StatusBarManagerService.java中,有addNotification,removeNotification,updateNotification等方法用于管理传递给他的通知对象。这个类是一些管理方法,实际执行相关动作的是在IStatusBar.java里面,这个是framework/base/core/java/com/android/internal/statusbar/IStatusBar.aidl自动生成的用于IPC的类。
相关新闻>>
- 发表评论
-
- 最新评论 更多>>