NotificationManagerService启动(“Notifications 通知”拆解)

Posted xhBruce

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了NotificationManagerService启动(“Notifications 通知”拆解)相关的知识,希望对你有一定的参考价值。

NotificationManagerService启动(“Notifications 通知”拆解)

android12-release


应用侧一般导入NotificationCompat

Jetpack: androidx.core.app.NotificationCompatandroidx.core.app.NotificationManagerCompat
实质:对mNotificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE)封装

NotificationManagerService启动

frameworks/base/services/java/com/android/server/SystemServer.java

  • NotificationManagerService依赖于StorageManagerService
  • publishBinderServiceContext.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();

以上是关于NotificationManagerService启动(“Notifications 通知”拆解)的主要内容,如果未能解决你的问题,请参考以下文章