Notification通知大致流程
App应用层:
NotificationManager.notify
–>NotificationManager.notifyAsUser()
–>INotificationManager.enqueueNotificationWithTag()
Framewrok框架中远程server进程:
NotificationManagerService.enqueueNotificationWithTag()
//将相关信息添加到StatusBarNotification对象中
–>NotificationManagerService.enqueueNotificationInternal()
//将NotificationRecord 对象添加
–>NotificationManagerService.EnqueueNotificationRunnable
–>NotificationManagerService.PostNotificationRunnable
–>NotificationManagerService.NotificationListeners.notifyPostedLocked()
–>NotificationManagerService.NotificationListeners.notifyPosted()
SystemUI.apk中:
//调用回调
NotificationListener.onNotificationPosted()
//需要更新则调用updateNotification
–>NotificationListener.NotificationEntryManager.addNotification()
->NotificationEntryManager.NotificationEntryListener.onPendingEntryAdded
/
SurfaceFlinger知识点学习.
Buffer进入到BufferQueue队列中后当BufferQueueProducer queuebuffer时会通知Consumer来消费
/
生产者 <-(dequeueBuffer)- BufferQueue 即APP侧,生产者在buffer上进行读写操作
生产者 -(enqueueBuffer)-> BufferQueue -(acquireBuffer)-> 消费者
buffer,并非大小为 width * height * bytesPerPixel, 而是 stride * height * bytesPerPixel 且 stride >= width
/
应用要进程绘制,首先要申请一块Buffer,ANativeWindow通过dequeueBuffer从BufferQueue中获取一块Buffer
App进程通过Binder线程向SurfaceFlinger进程发起dequeueBuffer请求
当新的一帧准备好后(queueBuffer),这时就要通知 Consumer去消费了,这时调用的是 BufferQueueCore::mConsumerListener -> onFrameAvailable
/
queueBuffer完成,相比dequeueBuffer,逻辑简单一些,也就是将数据传过来,封装成BufferItem,push到BufferQueueCore的mQueue中,再通过frameAvailableListener通知消费者去消费。创建Layer时,frameAvailableListener是Consumer那边设置过来。
- 生产者请求一块空闲的缓存区:dequeueBuffer()
- 生产者填充缓存区并返回给队列: queueBuffer()
- 消费者获取一块缓存区: acquireBuffer()
- 消费者使用完毕,则返回给队列: releaseBuffer()
acquireBuffer 的触发流程.:
BufferQueueConsumer::acquireBuffer <-- ConsumerBase::acquireBufferLocked <-- BufferLayerConsumer::acquireBufferLocked <-- BufferLayerConsumer::updateTexImage <-- BufferQueueLayer::updateTexImage <-- BufferLayer::latchBuffer
图片来自网络