Fix deadlock in PreviewRecorder

Details:
* Prevent the possible deadlock between the main thread acquiring the lock
  and handler thread acquiring the lock. The mRecordLock cannot be held on main
  thread while handler thread is running
* Ensure the mIsRecording state is checked when the frameCapture happens.
* Remove the lock from outside of handler.post block for frame capture and clean up.

Flag: TEST_ONLY
Bug: 424088563
Change-Id: I8f0583ddcf7c39633c6c422a6f5e3c5dd5c9df7c
1 file changed