appop: protect mediaserver with OP_RECORD_AUDIO op check.

Some apps could use a binder to direct link to the mediaserver, bypassing
the android media framework security. Add an internal check to createTrack and openRecord
mediaserver's methods to protect them from undesired access.

Thanks to Blackphone for discovery and contribute this patch.

Change-Id: I12601d19ee093cf4c76ebf3a96aa63f6562dafac
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
libaudioflinger: add stock resampler in pcm offload path

- when samplerate changes in b\w playback, resampler should be plugged-in
  so that the o\p sample rate remains the same to h\w
- this resampler is only enabled on 16 bit PCM path, when channel count is
  <= 2 and channel count doesn't change mid-stream
- once the sample rate resets to original\initial sample rate, resampling
  should not be done
- by default this feature is disabled

Change-Id: Ic27bbf9174d0a83297ebc4418eebdc8850272a6b
frameworks/av: Add output close in AudioTrack destructor for offload case

Close audio output handle inside AudioTrack destructor for
offload case to make output handle close/open independent of
each other and support multiple concurrent offload plyabck
session.
This is controlled runtime based on system property:
audio.offload.multiple.enabled

Change-Id: I98b3a6fe03bfddca2ed01a2adc5a33e4ad540e67
stagefright: Handle offload fallback for 24-bit tracks

 * We need to carefully handle fallback in the 24-bit lossless
   sources for outputs such as A2DP, which cannot use PCM
   offload.
 * Clean up the code while in here as well.

Change-Id: I398d964a3c5b18f58fcc79376bc29222e796badc
Merge "appop: protect mediaserver with OP_RECORD_AUDIO op check." into cm-11.0
Revert "appop: protect mediaserver with OP_RECORD_AUDIO op check."

This reverts commit 688b6b46db58bceb8fa0e5b3a14ea192153c0fd3.

Change-Id: I8b1feb4eb22257024ef4426988be7d5f084df9db
Merge "Revert "appop: protect mediaserver with OP_RECORD_AUDIO op check."" into cm-11.0
Camera: Add Samsung klte camera parameters

Change-Id: I3a30f901befc001a8be6788641226405c6d550ca
Merge remote-tracking branch 'cm/cm-11.0' into kk4.4