libstagefright: Drain input buffer on resume

- Buffers returned from codec in paused state are not drained. When
codec is resumed these buffers are not drained until the next flush,
and may cause timed out issue.
- Added change to drain input buffers for sw decoders when resuming.

Change-Id: Ida2ab1d5dc3a1910accdd6fb89548262a912d8e7
CRs-Fixed: 569585, 574967
stagefright: ExtendedCodec: enable arbitrary/frame-by-frame mode

Based on the parser's hint, explicitly enable arbitrary or frame-
by-frame mode rather than assume component's default mode.

Change-Id: I0931b84f3757625d1e62311c2171ff48defcbe04
CRs-Fixed: 642025
audio: Add A2DP notification support

 * Forward porting this code.
 * Sends notifications to legacy LPAPlayer for routing A2DP thru LPA.

Change-Id: I53eebda30b2e5cd60eeac5eb2a4cdb53e38381c9
framework/av: Add Usb AoA v2.0 support

Add USB state.
Add support for LPA/Regular Track over AoA v2.0

Change-Id: Ica9c348a002bbdd66debb1a3355126deef000948
libstagefright: Convert mono to stereo for LPA clips

- Sound effects are not supported for mono clips
- Repetative calling of effects_configure and effect_process for
  mono clips is resulting in crash in the sound effects library.
- So, Mono clips are now converted to stereo by copying the left
  sample to right.
- This is same as what Resampler does in Non-LPA Playback.

Change-Id: I789cd33ea1bc5b8f2a0d69b3b5ae55adb3b79cd1
CRs-Fixed: 446016
libstagefright: Stability issue with LPA play back.

- ANR is observed during LPA playback when there is song switch for
  every few seconds
- The song switch does not happen when the song is played till the end
-Avoid creating threads and calling reset if lpa start fails.
Initiate audio sink mutex before using it and return immediately
from setupAudioSink() in error cases.
Also remove unwanted code related to a2dp thread in lpaplayer as
no such thread is created. Make decoderthreadAlive variable false
before returning from decoder thread.
Update mInternalSeeking in pausetimeout to make sure source is
updated to the timeplayed before pause and resumes at correct position.
During onPauseTimeout if resume is issued even before closing
the LPA driver, causing decoder thread to wake up and trying to
write data. When decoder thread trying to write data LPA driver
is closed as part of the pause timeout.Synchronize these two functions
using a mutex to prevent concurrent execution.
Mono clips are now converted to stereo by copying the left
sample to right.This is same as what Resampler does in Non-LPA Playback.
This is to avoid crash in the sound effects library during repetative
calling of effects_configure and effect_process for mono clips.

Change-Id: If1652db80624a888924da22d690b2a34e176cb0e
CRs-Fixed: 463272