Fix FD leak for anon_inode:sync_file
The leaked file descriptor is a fence, created by dupFromAidl() within AidlCameraDeviceSession::RequestStreamBuffers(). This function duplicates the information to newly created HAL buffers.
When it's time for the buffers to be returned (typically at the end of the capture session) within AidlCameraDeviceSession::ReturnStreamBuffers(), HAL buffers are converted back to Aidl buffers. In the original code, a new fence is directly created for the acquire_fence related to Aidl buffers, leading to the duplicated one without any calls to close it.
In this update, the behavior of acquire_fence is aligned with release_fence. We apply makeToAidlIfNotNull() to assign back to the related Aidl buffers, ensuring they are later successfully closed in the framework layer.
Bug: 328671068
Test: android.hardware.cts.CameraGLTest#testCameraToSurfaceTextureMetadata
Change-Id: I888222b1df57c4bafb65e2ddf5447c01b108f83d
1 file changed