Android的上层程序刷新的时候,对应的native层的surface中的buffer数据会被改变。
这里的surface对应的是BufferQueueProducer,当上层绘制完成之后,会调用到surface.cpp中的unlockAndPost()函数:
status_t Surface::unlockAndPost()
{
if (mLockedBuffer == 0) {
ALOGE("Surface::unlockAndPost failed, no locked buffer");
return INVALID_OPERATION;
}
int fd = -1;
status_t err = mLockedBuffer->unlockAsync(&fd);
ALOGE_IF(err, "failed unlocking buffer (%p)"