User-selectable camera click sound [3/3]: (stock(bloop)/realistic/disabled)

Originally: Option to disable camera sounds (3/3) by Jonathan Steadman

Change-Id: Iff4eb5ca7dd13038bf852a76d0c605814864497a
Signed-off-by: nuclearmistake <nuclearmistake@gmail.com>
Merge remote branch 'cm/cm-11.0'
Merge remote branch 'cm/cm-11.0'
Merge branch 'master', remote branch 'cm/cm-11.0'
[2/3] av: Audio Themes Support

On the Java side, Android has support for both a
Video Record Start sound, and a different Video
Record Stop sound. However, this part here only
supports one video recording sound.
We added support for RECORDING_STOP sound (by default,
the same as RECORDING).

PS1: added back media file and add separate condition for check  User-selectable camera click sound

Change-Id: Iaebddd8ebf8b21633e802589a4a6175492df8f29

Conflicts:

	services/camera/libcameraservice/CameraService.cpp

Signed-off-by: hany <hany.alsamman@gmail.com>
Merge remote branch 'cm/cm-11.0'
Merge remote branch 'cm/cm-11.0'
Merge remote branch 'cm/cm-11.0'
mediaserver: conditionally launch ListenService

Conditionally instantiate ListenService from MediaService.
ListenServiceruns as a singleton in its own thread that calls
AudioHAL which in turn accesses Listen Driver. It is the entry
point from Application processes that want so execute Listen
commands and receive Voice detection events. It manages Listen
application resources and global states across all Listen
applications.

ListenService is similar to AudioFlinger. That is why it is
instantiated from MediaServer. Listenservice talks to AudioHAL
to deal with concurrent usage of mic.

Change-Id: I71c346bb16e0ed3a7aae9c908e03c7f1c694fe0a
Merge remote branch 'cm/cm-11.0'
Merge remote branch 'cm/cm-11.0'
Merge remote branch 'cm/cm-11.0'
audio: Add support for tunnel mode recording and compress voip

- Use modulo operator for common block buffer handling. Common block
  size is rounded to power of two. This limitation is avoided with
  modulo operator.
- Add support for tunnel mode recording
- Add support for compress voip

Change-Id: I95cdfff729affd784141487521c9f2f714221d11

audio: check audio mode to enable voice path for VoIP apps

- Add check for MODE_IN_COMMUNICATION to enable voice path
for VoIP applications

Change-Id: Ib603c6321c935d3b1313c2841b09eea932aa13f3

audio: Restrict opening of voip direct output to one instance

Avoid opening of voip direct output track if it is already in use
by another voip application.

Change-Id: I740bbb9e7153c8871c296f1ec5d8d68997391779

audio: check voip input sample rate to allow voip direct output

It is possible that some voip applications request different sample
rates for input and output streams. Avoid opening of voip direct
output if the voip input is already opened with a different sample
rate.

Change-Id: I5669e2a0880ffed0c10cde21da8994c2b47e1878
CRs-fixed: 601785
AudioFlinger: Remove unwanted update of track generation

PlaybackThread::threadLoop unncessarily updates the track generation
before waiting for a pending aync write. This is unncessary and
leads to excess calls to the power manager service for updating
uids.

Change-Id: I1284d79da3be6495acb19a97c81b3ab8db6dbb12
(cherry picked from commit f10fdf3ac4aced7d64bd0d1f05cc886271436685)
(cherry picked from commit 48568df4edf4d9b98c4d05bcfae3770c91f3be7f)
AudioTrack: Fix for race condition

This fixes a race condition between releaseBuffer and flush.

An AudioTrack::releaseBuffer() can be delayed (pre-empted) by
AudioTrack::pause/flush() and ServerProxy::obtainBuffer() calls leading
to a situation where an incorrect position is copied to the cblk

<<Change to be tested>>

Change-Id: I70074d4824ba8c7fa86c9f9ef8cc182de9172ab9
(cherry picked from commit ec237ff01ca194bf0e29933f916a30b8f83c8ace)
(cherry picked from commit 6984cd7b9e99ffa48872cf9316c68d5ae51ad3c5)
Merge remote branch 'cm/cm-11.0'
Merge remote branch 'cm/cm-11.0'
Merge remote branch 'cm/cm-11.0'
Merge remote branch 'cm/cm-11.0'
Merge remote branch 'cm/cm-11.0'