camera: Re-add micromanagement of preview metadata

 * Some devices still have issues without this fix.

Change-Id: Iae2d4410086fb38bf7f9abeee62c05cae824d436
Merge remote-tracking branch 'cm/cm-10.2' into cm-10.2
Fix build: QCOM_ICS_COMPAT
camera: bring back more of the preview metadata workaround.

Fixes issues with switching between FFC and back camera on some devices.

Change-Id: Ie2cef65263816b22e45513cfc639c32b48a49bec
Merge remote-tracking branch 'cm/cm-10.2' into cm-10.2
AudioPolicyService: Support MR1 audio_policy

Change-Id: I26abd352f327256856021b311efb1e23b46b6023
Merge remote-tracking branch 'cm/cm-10.2' into cm-10.2
Libstagefright modifications for Dolby UDC DD/DD+ Decoder support

Comprising:
Mimetype definitions
MP4 container support
MPEG2 PS/TS container and ES support
OMX Component/Codec Registration

Change-Id: Icd734d07ee85a933b1833a84cf178b2a52b78f13
libstagefright: Use proper ctts offset

Calculate ctts offset as difference between composition
time and decoding time, and avoid adding kMaxCttsOffsetTimeUs
as it increases the sample timestamp by the same amount
which leads to av sync loss.

CRs-Fixed: 524739
Change-Id: I75a1bb594536623e3a445af2ee1ceb0cf0926a6e
libmedia: Update the DSDA tone frequencies

Change the DSDA tone frequencies to 450 Hz
for Hold Recall, Local Call Waiting
and Supervisory/Local Call Hold tones.

Change-Id: I8cfffdff51c02112ec690bbb26781813c24b8e79
libstagefright: Create Extended Extractor for HEVC and AMRWB+

- Create Extended extractor when
  . Audio format is AMRWB OR
  . Default extractor not able to find any track OR
  . Default extractor finds one track and is Video OR
  . Default extractor finds one track and is neither Audio nor
    Video OR
  . Default extractor finds two or more track, and either Video
    or Audio or both tracks(s) not present OR
  . Default extractor finds both Audio and Video track found and
    Audio format is AMRWB

Change-Id: I17d56c72d8f76314be9bb7ac4fc1b7ac88f2d762
libstagefright: Add support for AC3 and EC3 playback in tunnel mode

Add support for AC3 and EC3 playback in tunnel mode

Change-Id: If5de26d3ff9e63737d6ed43b904c6094f93fbfc0
libstagefright: For interlace, set decoder in arbitrary mode

In arbitrary mode, frame parsers sends individual fields
to core. Once both the field is decoded, output done (FBD)
is sent back to client.
Default frame by frame mode will send both the fields in
a single buffer to core, which might decode only one field
or will throw up error.

CRs-Fixed: 531034
Change-Id: I31844093b6a93d3a62577fc8d799353d30573c17
libstagefright: Use software audio decoder for HEVC video contents

-Tunnel mode audio is not supported for HEVC video contents. This
 is a dsp constraint because HEVC video is decoded in DSP. Use
 software audio decoder for HEVC video content.

Change-Id: I77a30d9ce5e3aaa26389bfc0a14e2b0b2c2e7ced
libstagefright: Use appropriate reset call for amrwb decoder

-onPortFlushCompleted is calling Speech_Decode_Frame_reset
 for both AMRNB and AMRWB clips but Speech_Decode_Frame_reset
 is not used for AMRWB decoding. This is causing corruption
 of AMRWB decoder's state during seeking.
-Fix is to call pvDecoder_AmrWb_Reset during AMRWB Decoding

Change-Id: Ibf0ebc7b154ff4866211eaf178a447f96e33341c
CRs-Fixed: 534094
libstagefright: Add support for H/W AAC decoder

- Currently, only software AAC decoding is supported.
- Add support for H/W AAC decoding by including it in the
  list of available decoders and use it for decoding only
  if the property 'media.aaccodectype' is set to 0.

Change-Id: I4bb9df1bd10bd8ee91e63dadd6c473fc4e29813a
CRs-Fixed: 449145
libstagefright: ExtendedCodec for ACodec usage

 - this adds support of ExtendedCodec for using ACodec
 - adds extended CSD support on both NuPlayerDecoder
   and MediaCodec
 - arbitrary mode is made default for ACodec
Change-Id: Id046b0d4bf96f029c1b6b5d78d753073e38ac841
frameworks/av: Audio Resource Manager changes for concurrency

-Do not allow LPA/Tunnel ringtone.
-Use fast track for ringtone/enforced audible/alarm/system sound/
 notification.
-Audio Flinger changes to suspend /restore direct track
-SetParameter changes in stagefright.
-Identify usecase in stagefright framework.
-Set/reset the use case when the player/recorder instance is created
 and deleted.
-Set/reset the use case when player/recorder is paused and resumed.
-Add codec flag to differentiate music stream and ULL stream.
-Add pause/resume flag/interface to inform codec about pause/resume.
-Add a new file for concurrency changes in Audio Track.
-Add resource manager macro for audio flinger make file in the
 correct place.
-Add function to set pcm recording / pcm playback usecase for
 voip applications using audio path and also native apps which
 does not use stagefright framework.

Change-Id: I74352c6936caeb600fe3e0c1a8b2342fdb1c1d0c
libstagefright: adjust AV sync late margin based on property

- Current AV late margin is 40 ms
- Read system property media.sf.set.late.margin and if
  new AV sync late margin is set then use the same
- Max AV sync late margin allowed is 250 ms
- Min AV sync late margin is default 40 ms

Change-Id: I65cd3dce9b31b87f1488c37af9618669b29c362c
framework/av: Reduce LPA bufsize as to 128KB to save power for SA+

Root cause: SA+ bassboost takes more than two times the MIPS as NXP,
which causes normalized CPU load burst when AP is running, then firing
up 2nd core and consume more power unexpectedly.

Fix: Reducing the LPA buffer size from 256KB to 128KB will decrease the
MIPS required for each round of effect process and keeps the 2nd core
offline.

Change-Id: Ib1982dd2a7544c82971bf6b74ebc58216d247e77