Skip to content
Commit 6231472f authored by Emilian Peev's avatar Emilian Peev
Browse files

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
parent ae41acbe
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment