MediaScanner: Ignore dirs with .noscanandnomtp

Completely ignore directories with .noscanandnomtp files
in them. Placing a .nomedia file will still scan a
directory but exclude it from the media database. This
is so the file may still be presented for MTP purposes.

Placing .noscanandnomtp completely prevents the scan,
which saves considerable processing power and battery
life on systems with numerous media files, but prevents
them from being seen over MTP.

Change-Id: Ibff2a9f2525255a2ac34132eeee36734962fbdd7
Silence error when DASH player isn't present

Change-Id: I9e5c22af1a5cf916b0efaec7ca1c5f48f6d0c82a
libstagefright: Squashed audio fixes from CodeAurora

libstagefright: Return seek position until seek has been processed

If it so happens that the client to TunnelPlayer (e.g. AwesomePlayer)
queries for the current time before data from the new seek position
is given to the compressed driver, we need to return the seek position

Change-Id: If709e61f67cc8e81d34c14d19145dc61ecd82c2b
CRs-Fixed: 454825

libstagefright: Use 64 bit offsets only when needed.

For enabling >2GB recording, 64 bit offsets are
needed for file writing. So, this feature was turned
on by default. This in turn increased the file size.
With this change, by default this feature will be
off and turned on only when required.

- Use 64 bit offsets for resolutions >= 720p.
- Limit maximum file size for recording to 4GB.
- Set max file size only if no value is set from the client.
- Fix MPEG4Extractor to use 64 bit offsets

CRs-Fixed: 273144, 285785, 288319
(cherry picked from commit 04476a3fb89dfbb025f7852dd4d62cae72385f1a)

Change-Id: I00af2c7cddbbf86c566fe4bb989fe728ca06dd19

libstagefright: TunnelPlayer sync fix

- Allow close on the AudioSink to be called from
  the extractor thread and the application thread.
- This fixes a race condition where an onPauseTimeout
  event scheduled from the main thread closes the
  audio sink while the extractor thread was about
  to issue write() on audio HAL. (note: on HAL, not audio sink)

Change-Id: I22a5c655dfcb40f3cbda3765dc23ad8e6f99c9bb
CRs-Fixed: 443205

Frameworks/av: 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.

(cherry picked from commit 011db22abf565dfbe7f9d0a5c7af7564587b3b48)

Change-Id: I82cfdab045ecf077f0ba0185fc693fc623fa10db
CRs-Fixed: 435661, 435664, 435680, 430309

audio: Use tunnel player only for music stream

- Check stream type before creating tunnel player to
  use tunnel player only for STREAM_MUSIC

Change-Id: I6e4b58524e61441ad2e09499bd9187c6dd56cd3d

framework/av: Fix for audio recording test through CTS

- Issue: Failure in stop is observed with the audio recording test
through CTS.
TestScenario: When the audio record test is initiated in the CTS
console, the recording session is force closed with a notification
File Size limit exceeded. Further, the stop fails with the same
message(notification of the File size exceeded error).

- Cause: The calculation of nTotalBytesEstimate for the recording
session exceeds the limit 95 percent of mMaxFileSizeLimitBytes.
As a result of size deficit, the recording is stopped at the
beginning of the recording session notifying
MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED.

- Fix: The factor size used in the calculation of nTotalBytesEstimate
has been updated properly for 64bit file offset setting. The
setParam64BitFileOffset in StagefrightRecorder::prepare() is executed
based on two additional validations so that the factor size is updated
appropriately.

Change-Id: I4749ce8f9735ccc9e1d9e49718c36470837ab27f
CRs-Fixed: 396057

audioflinger: apply volume on direct track when track is active

During back to back tunnel playback, we encounter a race condition
where setVolume can be called when the track is not updated to
active state. Fix to apply the volume on direct track only when the
track is in active state.

Change-Id: I70c289fbf8a9266bae0bd01b04be9f43ad32c70d
CRs-Fixed: 464148

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.

Change-Id: I86b44679fb5fe442bb5adb510c62514f6be3d304
CRs-Fixed: 453067

audioflinger: for DirectAudioTrak, call startOutput before stream is active

For LPA and Tunnel playback, when resume is done in paused state, before
starting actual playback, volume should be set through AudioPolicy command
thread.

Change-Id: I7ee1098058c01a35a3e7181d3b291304abf3cac1
CRs-Fixed: 464348
Revert "audioflinger: apply volume on direct track when track is active"

Causes issues with MortPlayer (LPA).  Track starts/resumes playing, but volume is forced to zero, until a track-change occurs.

4-17 21:41:51.492 D/ALSADevice(  256): setHardwareParams: reqBuffSize 262144 channels 2 sampleRate 44100
04-17 21:41:51.492 D/ALSADevice(  256): setHardwareParams: buffer_size 1048576, period_size 262144, period_cnt 4
04-17 21:41:51.492 W/AudioFlinger(  256): There was no effectChain created for the sessionId(283)
04-17 21:41:51.512 E/AudioFlinger(  256): setting observer mOutputDesc track 0x40c598a0, obv 0x40c598b0
04-17 21:41:51.512 D/AudioSessionOutALSA(  256): setLpaVolume(0)
04-17 21:41:51.512 D/AudioSessionOutALSA(  256): Setting LPA volume to 0 (available range is 0 to 100)
04-17 21:41:51.512 D/ALSADevice(  256): setMixerControl:: name LPA RX Volume value 0 index 0
04-17 21:41:51.512 D/AudioSessionOutALSA(  256): setLpaVolume(0)
04-17 21:41:51.512 D/AudioSessionOutALSA(  256): Setting LPA volume to 0 (available range is 0 to 100)

Change-Id: I6e0ee8cd7c2f577ca5b4cb834c7a83703db4b167
OMXCodec: Re-implement requires-flush-before-shutdown quirk

Support is already there, but is not in the codec quirk reading list.
Re-implement it as required by Broadcom's OMX

Change-Id: I1beac06af8118dcf0c248b631bc8e6dbbab2c1d5
camera: Don't segfault if we get a NULL parameter

 * Values end up NULL on some drivers, don't crash.

Change-Id: Ic897dbd4629cf3af98c85f93be202c382dde806b