Camera: Avoid possible deadlock during R&C updates
Rotate and crop updates in the legacy shim layer are
synchronized via the 'mBinderSerializationLock'.
The binder thread that does this will also acquire
the camera service lock. However there might another
thread that is in the middle of a client disconnect
and already owns 'mBinderSerializationLock'. The second
thread will also try to acquire the camera service lock
as shown below and this can result in a deadlock.
Avoid this by using a dedicated lock for the rotate and
crop updates instead of 'mBinderSerializationLock'.
Thread 2:
android::CameraService::removeByClient
..
android::Camera2Client::disconnect()
Thread 1:
android::Camera2Client::setRotateAndCropOverride
android::CameraService::notifyDisplayConfigurationChange
Bug: 233752445
Test: Camera CTS
Change-Id: I3d37f0f6034e929a0bf3321ba122fffbd21fa923
2 files changed