libstagefright: Adding a work around for SurfaceMediaSource

- Do not stop on first call to onBuffersReleased, which presumably
  will be called when producer calls setBufferCount on BufferQueue.
- Do not flush the buffers when stop is issued via onBuffersReleased
  (producer calls disconnect on BufferQueue), instead flush when reset
  is called.

Change-Id: I91448bc87563f2245ad9c9c7150b82c358bfe9e2
CRs-Fixed: 387181
libstagefright: Fix to free buffers in error scenarios

    o MediaBuffer objects are not freed if component transition from IDLE->EXECUTING
      or EXECUTING->LOADED fails (or if the OMX_CmdComplete messages are dropped
      due to an earlier error)
    o Additionally with native buffers, the corresponding ANativeWindowBuffers are not
      cancelled back in the above scenarios.

Change-Id: Icdee687dab4883639f49ba0b38d6c80d7013873b
libstagefright: Accept vendor specific NV12 colorformat from component

Accept OMX_QCOM_COLOR_FormatYUV420PackedSemiPlanar32m color format which
is NV12 + 32 aligned stride and slice.  This different from vanilla NV12
which is 16 aligned.

Change-Id: Id6cd4295c7710b3f33ef082e3b644732fd85e3fb
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
libstagefright: Add flag to use MM heap for SurfaceMediaSource

 * Older QCOM camera drivers need to use the MM heap for effects
   recording. Add a a flag to enable this.

Change-Id: I4f78c3b370ba1ef7b6a0c567de0a211e85e8a2d0
frameworks/av: Use software decoders for LPA clips

Use software decoders for aac and mp3 LPA clips

Change-Id: I0310e128505ff383138c6a7dcb934ae64e86d6bd
audioflinger:  Avoid deadlock for sound recording - LPA concurrency.

-Rapid button press will cause next clip playback. If next clip is lpa
 clip, opening lpa clip triggers set parameter. The set parameter would
 acquire flinger lock and wait for completion. The wait can only be
 signalled from checkForNewParameters_l() in threadloop but the record
 thread loop will be blocked on processConfigEvents() on audio flinger
 lock resulting in deadlock and record failure.
-Release the lock before setParameter on threadbase is called to avoid
 the deadlock scenario.

Change-Id: Ib165210d16bcf661b6aa56aac1529375087e4e4e
CRs-Fixed: 390918
libstagefright: Fix crash during next clip playback

-Decoder/Extractor thread and reset was not synchronized and this
 resulting in write being called during destruction of session out.
-This causes crash during continuous next clip playback.

Change-Id: Id0c953541f2ba74b2321b16636852cbe59c4cdcb
CRs-Fixed: 392250
libstagefright: Pass aligned width to color convert routine

- NV12Tile requires aligned buffer sizes.
  The size passed was un-aligned.

Change-Id: I0d6c618aab7588998ef0e9cfa3fb8a51d9bce93a
AudioFlinger: Disable AUDIO_WATCHDOG to reduce high audio power

- AudioWatchDog daemon wakes up the app processor every 50ms.
  This causes audio power to increase by ~3.5-4mA.
- Disable AUDIO_WATCHDOG to reduce high audio power.

CRs-fixed: 386481

Change-Id: Id8f038bd082b9aa711411db33c5302e1d12cadd6
camera: remove redundant QCOM_HARDWARE ifdefs

Change-Id: I9bccd7cb2fd3a7a7b3bda8002cf57ad21ce6b37e
camera: add missing symbols for HTC 8660 camera HAL

Forward port of patch from HTC 8660 missing symbols patch from ICS.

Change-Id: I9ed27e3bc1b0d63c437b3cf9518b36e0da546e81
libstagefright: Enable suspension policy

- ADSP doesn't enter suspend state after audio playback.
- No support for suspension policy in stagefright.
- Enable suspension policy in stagefright to allow
  component to move into suspend mode.

CRs-fixed: 386381
(cherry picked from commit 735bc83e32e64af25a6163c07e2039eb4354ff00)

Change-Id: If32bfc63bbb25563e14b128712cc90639b15dc5b
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
CameraParameters: Underp non-qcom hardware

Move setPostviewSize to QCOM_HARDWARE

Change-Id: I830d1385be0e784f9fcb6dc40f014bea36b4b65b
fixup for non QCOM targets

*potential memory leaks in MediaPlayerService
*fix ifdef placement in AudioTrack
*duplicate entry in MPEG4Extractor
*(int)mChannelCount == mReqChannelCount being checked twice in AudioFlinger
*pLatencyMs not getting assigned in AudioFlinger
*CAMERA_MSG_FOCUS_MOVE was lost in CameraService

Change-Id: I349a25078148d25f43bf5666fe04b84017b7daa7
Revert "camera: Set the min undequeued buffer count to 2 for camera"

This reverts commit 7420c848844b0e68d26137e683994e68f722fb3b.
AudioFlinger: mOutput->stream->get_latency must be inside mLock scope

Otherwise lock-ups during simultaneous playback of multiple
audio streams can happen.

Change-Id: Idd392761e50c1754f9740b7151fc90396542b909
i9300: Enable back forgotten ISO modes (1/2)

Change-Id: Icefcd8dee6848e684b6c0c191ee485ed973e4ce8
camera: Full support for HTC camera switch

* Adds the changes for using the "htcwc" switch.
* ICS commit: https://github.com/CyanogenMod/android_frameworks_base/commit/6fa3953df37f6744af7c777f4ac803d4df44af33

Change-Id: I845d628106e386608590df7a1ed4f635f655f140
framework/av: Fix AudioFlinger create track failure

- AudioFlinger track creation fails after mediaserver crash
- Mediaplayer doesn't register for new sessionId value if
  mediaserver crashes during a song switch of music player
  and it uses the old sessionId though sessionId values are
  reset by AudioFlinger.
  AudioFlinger assigns the same sessionId to Tone Generator
  and since strategies of these two session differ it would
  result in track creation failure.
- Fix this issue by registering for new sessionId for
  mediaplayer if mediaserver crashes in idle state

Change-Id: Icc8d204bec5d2fa97db17a7319904baa29115b19
audoflinger: Add A2DP Notifications.

LPAPlayer needs A2DP Notifications to support LPA over BT-A2DP
devices.

Change-Id: Ib43231fd51070059cbe876ec54ee7c542bf2caa3