NotificationManagerService启动(“Notifications 通知”拆解)
android12-release
应用侧一般导入NotificationCompat
Jetpack: androidx.core.app.NotificationCompat
、androidx.core.app.NotificationManagerCompat
实质:对mNotificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE)封装
NotificationManagerService启动
frameworks/base/services/java/com/android/server/SystemServer.java
- NotificationManagerService依赖于StorageManagerService
publishBinderService
将Context.NOTIFICATION_SERVICE
添加到ServiceManager.java
t.traceBegin("StartNotificationManager");
mSystemServiceManager.startService(NotificationManagerService.class);
SystemNotificationChannels.removeDeprecated(context);
SystemNotificationChannels.createAll(context);
notification = INotificationManager.Stub.asInterface(
ServiceManager.getService(Context.NOTIFICATION_SERVICE));
t.traceEnd();