media: Add Ops check before starting audio recording.

Confirm user permission before starting audio recording.

Change-Id: Ia4e6d8fb6986d4e73fb656ba0efaf42c210e92af
audioflinger: do not use raw pointer for tracks

Commit 9da3d95 surfaced a problem caused by the use of a raw
pointer to a track in offload thread implementation.

Pointers to tracks should always be weak or strong pointers.

Bug: 11708529.
Change-Id: Ic48632532d186c9be8261f73cefdf824b9fbbd2b
audio: Supress redundant effect config events in short duration

Distortion sound persists for the whole song when re-enabling effect in
LPA playback mode till switch to next song. And pop noise is quite obvious
when enable/disable effects in LPA.

As the design of LPA, EffectsThreadEntry() loop is used to handle effect
config changes through applying effects with new config on dsp pcm buffers.
However, it can't handle too many config change events in a short time,
and effect with new configuration will be applied on part of dsp buffers.

Filter out redundant effect config events that come too closely to avoid
applying effect on dsp buffer in vain.

Change-Id: If8915b1d068724d5976e1519ec57e3c08cf89c9d
CRs-Fixed: 562806, 563418
audioflinger: Add Null pointer check while enabling effects for LPA

- MediaServer is crashing when disabling effects after mediaplayer
object is released.
- EffectChain pointer is de-referenced without NULL check, hence
leading to a mediaserver crash.
- Adding a NULL pointer check before using EffectChain object.

Change-Id: If5ff469445246028046ba65e5ddf3300180318c2
CRs-Fixed: 583305
Audio: Tunnel Exception for ER AAC ELD profile format

- some m4a clips are not working properly

- ADSP audio decoders don't support ER AAC ELD support

- Added tunnel exception for ER AAC ELD format.
  Added AACProfile metadata support for MKVExtractor

Change-Id: I2f6fe721b05377dfe0f24ea0ad1f6c4a885d576d
audio: Check the return code of MediaWriter::start

- Return code of MediaWriter::start method is not checked
  in startRawAudioRecording. Due to this, sound recorder
  application is not receiving the error whenever there is
  an error in starting of the recording
- Fix is to check the error and return it back to
  the client accordingly

Change-Id: I15916211da7a2eb0f27fbf9d4151410a8bdfdd42
CRs-Fixed: 591788
audio: Use composition instead of multiple inheritance

- AudioTrack is derived from BnDirectTrackClient along
  with RefBase to receive the notifications from
  AudioFlinger in tunnel/LPA mode. This is breaking
  binary compatibility for the clients which use native
  AudioTrack directly instead of Java based AudioTrack
  API
- Fix is to use composition here instead of inheritance

Change-Id: I9fd2c61cff5629924e3b08f63559679e0263bcfd