Camera2/3: Fix deadlock when starting recording before preview.

Move 3A notification synthesis for HAL3 devices from
Camera3Device::processCaptureResult to Camera2Client's
FrameProcessor. This will ensure that calls to processCaptureResult
from HAL can never block on Camera2Client internal mutexes.

Bug: 9923891
Change-Id: I5184649bf45c0807babe6b8c0e1239e959cd3480
libstagefright: support for disabling buffer metadata

- Metada mode video recording is enabled by default.
- use setprop debug.camcorder.disablemeta 1 to disable metadata mode recording.

Change-Id: I422c49c0ace0c3a3e1f4459c7e4bf29e70af763a
libstagefright: Add support for custom LPA buffer size

 * On msm8930, during playback over A2DP with DSP Manager effects enabled,
   there's a lot of stuttering with the default buffer size. Stock kernel
   used a buffer size of 32, but that caused no audio at all in CM because
   of mismatch in buffer size between kernel and user space. So up until
   now I've been using a buffer size of 256 to get audio working at all,
   but unfortunately it causes stuttering as mentioned. Hence add support
   for a custom buffer size so we can revert to stock value used in kernel,
   and enjoy no stuttering.

Change-Id: Id4d090bc6cf90782c24f3832a35ddeca43bd72fc
libstagefright: optimize thumbnail generation path

- Checking for YUV420SP format support is not intended for software
  decoders and can be skipped. This avoids unnecessary creation of
  hardware decoders for checking supported output formats.
- Change the flag from kPreferSoftwareCodecs to kSoftwareCodecsOnly.
  This will force software codecs to be tried first and not just "prefer"
  which helps when a software codec for a particular type of codec (like
  divx) doesn't exist and avods creation of hardware codecs twice in case
  of hardware failure.

Change-Id: I682bca5b6bac5a56f46fe3655cd722fe5f08e1e6
audio: fix for deadlock issue during LPA playback

EffectModule::setEnable for LPA playback was modified to lock
AudioFligner::mLock with EffectModule::mLock held.
And at the same time ~DirectAudioTrack is trying to lock
EffectModule::mLock with AudioFlinger::mLock held and this
results in deadlock.
Fix this issue by reverting previous change and acquire
locks in certain sequence to avoid deadlock in setEnabled_l

Change-Id: Iea74eb3591a728275c655074a4d2017bd38f99ab
libstagefright: Add pause support for hardware omx component

-ADSP doesn't enter sleep state after wma playback is paused
and power suspended.
-No support for NT session pause in case of hardware component.
NT session need to be paused to put ADSP into power collapse.
-Add support of pause in stagefright to ensure device enters
suspend mode. Also add intermediate states to avoid concurrency
issues between read and pause.

Change-Id: I87b0992f3d4d580c3a68d27fbed6b65d2200dda9
CRs-Fixed: 496256
Merge "libstagefright: support for disabling buffer metadata" into cm-10.2
Merge "libstagefright: Add support for custom LPA buffer size" into cm-10.2
Merge changes I87b0992f,Iea74eb35,I682bca5b into cm-10.2

* changes:
  libstagefright: Add pause support for hardware omx component
  audio: fix for deadlock issue during LPA playback
  libstagefright: optimize thumbnail generation path
Merge remote-tracking branch 'cm/cm-10.2' into cm-10.2

Conflicts:
	media/libmediaplayerservice/StagefrightRecorder.cpp
Merge tag 'android-4.3_r3.1' of https://android.googlesource.com/platform/frameworks/av into cm-10.2

Android 4.3 Release 3.1
Merge remote-tracking branch 'cm/cm-10.2' into cm-10.2