CameraHal: Avoid deadlocks when re-using a tapout

- Locking inside 'takePicture()' is sometimes possible
  when re-using the same SurfaceTexture. This is due
  to the blocking nature of the dequeue call inside
  'BufferSourceAdapter::handleFrameReturn()' which
  does acquire 'mLock' upon entering. The solution
  is to handle this particular case by reusing the
  buffers that were previously allocated and avoiding
  any calls to the Adapter which might try to lock
  'mLock'.

Change-Id: I6c4e49fd84df2659c0466b6f89c88916f93a6b8d
Signed-off-by: Emilian Peev <epeev@mm-sol.com>
Signed-off-by: Vladimir Petrov <vppetrov@mm-sol.com>
2 files changed