Camera: Avoid holding locks during extension initialization
Holding the interface lock while initializing the extension is not really necessary and can potentially result in a deadlock in case of failure where callbacks try to close the camera capture session in the handler thread, and another thread tries to close the camera device acquiring the interface lock there: Thread1: CameraDeviceImpl.close() acquire the device interface lock release advanced extension try to acquire the extension characteristics lock Thread2: InitializationSessionHandler.onFailure() while holding the extension characteristics lock mCaptureSession.close() try to acquire the device interface lock Additionally re-use the device interface lock for the extension session synchronization. There is no real need to use a separate lock which complicates the lock acquire order. Bug: 270276341 Test: atest -c -d cts/tests/camera/src/android/hardware/camera2/cts/CameraExtensionSessionTest.java Change-Id: Ice808c8d5538e3adb3220d7ea51dea4b14cc2f44
Loading
Please register or sign in to comment