Fix SoundPool.play() looping regression in 4.3 DO NOT MERGE

The change I7370d6e59a7ef26dfb284a8b058d5ab2e0a42ccf caused a regression
in SoundPool looping when using SoundPool's streaming implementation.
This reverts a portion of that change.

Bug: https://code.google.com/p/android/issues/detail?id=58113
Bug: 10171337
Change-Id: I8af0dc8683a7c7f225c80f0eb4d39770667b52e5
libmedia: Featurize QCOM's VOIP feature

 * Not all targets will support this.

Change-Id: I89a444c9ac8be3dfcaeedb599179e31383fdfec2
audioflinger: Fix for race conditions in direct audio track

-Issue: Mediaserver crash is observed in direct track functions.
-Rootcause: Between write and flush functions, write and destructor
effectpool buffers are accessed without any synchronization that
might lead to operations on null buffers and cause crash.
-Fix: Use mEffectLock to synchronize access of effectpool buffers.

CRs-Fixed: 515107
cherrypicked from Ib071361c65b390f9486c0a080a9391f176392b30

Change-Id: Id9e14a054d699ec803e23619ef475696b0021d4f
Fix typo

Change-Id: I179187b33f666dff88b57a4c24d7507eee0219cd
Signed-off-by: Rohan Mathur <rohanmathur34@gmail.com>
Camera: QCOM legacy definitions,HTC cam switch,NO_UPDATE_PREVIEW

Updating Camera parameters, and service with several
compatibility patches:

1., QCOM legacy CameraParameters and functions:
Adding these will make ICS qcomm camera blobs work on JB 4.3.
Use BOARD_USES_QCOM_LEGACY_CAM_PARAMS := true in BoardConfig
to use this.

Also fixes the problem of legacy qcom
camera blobs with recent libcameraservice QCOM_HARDWARE changes,
where the orientation is messed up on first
preview: the fix is leaving out setPreviewWindow(window) for
legacy qcomm cam blobs.

2., Also adding NO_UPDATE_PREVIEW flag for legacy purposes.

3., Adding adding the set orientation patch:
Always set buffers orientation when setting the qcom camera preview window
Fixes the rotated preview on TouchPad
https://github.com/CyanogenMod/android_frameworks_base/commit/1a8e41a3c7434737db89b604352575f8b3109e7a

4., camera: Full support for HTC camera switch

5., Adding more parameters for HTC Explorer

Change-Id: I2bfc72b8ef027665356788f1db7f96b31d037dbe
Camera: Fix deadlock due to mLock in pcb and takepicture

In non-zsl case of takepicture, we do streamoff for preview
stream which is waiting on preview callback thread to exit.
By that time the lock has already been acquired by takePicture.
So preivew callback will not exit until it acquires lock and
takePicture cannot continue until PCB call back is returned.
Fix: Avoid the mLock at services when both Preview cb &
Compressed cb are enabled.

Change-Id: I61ffa60af34a3fc19b8f45c119535243b53c7d3c
Camera: Disable TakePicture related messages in stopPreview,stopRecording

This change fixes the race condition and avoid the deadlock
in abnormal snapshot stop I.e, Observed DeadLock when Data
or Notify Callbacks is sent to App after StopPreview is
triggered and so disabling the corresponding take picture messages.

Change-Id: Ifc20e495091c75cc718c24d29db3334fbf7ceb07
audioflinger: Fix to prevent deadlock in AudioEffects

-Write is blocked waiting for effect chain lock and this causes
decoder thread to wait indefintely.
-Sometimes it is observed that effectschain is locked before
mLPAEffectChain is initialized and but unlocking is skipped if
mLPAEffectChain is initialized in between.Due to this LPA
silence and framework reboot issues are observed as
applyEffectsOn() cannot acquire lock to progress further.
-Use flag to check if all effects have been locked and unlock
accordingly to prevent the deadlock scenario.

Change-Id: Iaedb03c05406e79ef0eadbf2ae4681ba9fe0f3c3
CRs-Fixed: 524759

Conflicts:
	services/audioflinger/Threads.cpp
libstagefright: Reset the decoder while performing seek

-Observed noise when seeking to beginning of file for the recorded
AMR clip.
-While performing seek, the AMR decoder states are not being reset.
In AMR decoder, the current frame output is predicted using the states
from previous frame. If these states are not cleared, it might cause
noise when seek is performed.
-Fixed by resetting the decoder when seek is issued and port flush
completion is notified to the decoder.

CRs-Fixed: 500851
Change-Id: Ia8480b88521abc09c8b01d6052df4730a0359518
LPAPlayer: Update condition to ignore seek

- Reject seek if the new seek time is greater than the current
  position and within an empirical limit (default 60ms).
- This limit must be measured for each target. CRs-Fixed: 453067

Change-Id: I4eec9c139a261c9e246986a74f25114d24987547
Revert "audioflinger: Fix buffer size for VOIP"

This reverts commit f16d2ca71b6006aacf758b85ceac2f6314185725.
audioflinger: Use channel count for buffer size calculation

- For VOIP(hangout) usecase, when the ringtone is played,
  application sets flag as VOIP and the channel as stereo.
  But , on the server (audioflinger) side , the channel
  was always considered as MONO. This was leading to a
  corruption of the Cblk.
- Added changes to consider channel count in allocating the
  buffer size.

CRs-Fixed: 523984 522525

Change-Id: I160d7cf7855161efa201a86846aec67cb24d35dd
libstagefright: support media-legacy usage

Change-Id: Ibcac0333ed4f79d71b38c26eba8cc665f2532cd0
libmediaplayerservice: fix for media-legacy usage

Change-Id: Idc6b0d9e976ece23d73ef81cebf72c4e6905647a