libmedia: add pre jb-4.2.1 signature for AudioSystem::getDeviceConnectionState

With jb-4.2.1 the type audio_devices_t found in system/core/include/system/audio.h
was redefined from a typedef enum to uint32_t.  This causes the signature
of AudioSystem::getDeviceConnectionState to change in libmedia.so.
Any older than 4.2.1 prebuilt audio.primary.___.so binaries (such as mine from ICS)
may refer to the old signature.  This patch adds back in that reference.

Change-Id: Ie4f92eaec20d581c9bebc805cfd25f8558406e30
Signed-off-by: Hashcode <hashcode0f@gmail.com>
Camera: Qcom parameters partial rebase

Add customized parameters for qcom camera features.

Squashed commit of the following submissions to CAF:

camera: add custom camera parameters to hardware java file.

Change-Id: Ic2b363df6d25a0c3a49aed30e717d10874f533ae

Camera: Add support for wavelet denoise

Change-Id: I97be72615fe5909987ac430034bbdc16f2d20509

Camera : Add support for histogram in frameworks

Change-Id: Ibf751c3b2d488f4be0afaaa3e994372bafeffbe7

Camera: Add ZSL support in framework.

Change-Id: I4e863020d7d407d9c3936beb83dc7abf385c4654

Camera: Add touch AF/AEC support in ICS framework

In, ICS the old touch AF/AEC functions getTouchIndexAf(),
setTouchIndexAf() etc  are no longer valid. Added new functions  to get
the center of touched area.

Change-Id: I37d00040f895cd8a4de2e2a438971aa2d9c1a045

Camera: Add support for Red eye reduction

Change-Id: Iada280ac33aee8b1114dc40d8d79e0e47ad5c2fd

Conflicts:

	api/current.txt

Camera: Enable streaming texture and YV12 feature

Change-Id: I814c92b469e0f25baef0ce80338761d1e6443085

Camera: Add frameworks support for high frame rate

Change-Id: I9722e9b7e61433651ab5f76f76208853eb1fd849

Camera: Simplify ASD menu and best mode menu.

Change-Id: Ia7a1eca9268eec021a6e2c3f7ce2a932e8819d50

Camera : Macro definition change. PIXEL_FORMAT_YV12 to "yuv420p"

Why: CTS testcase is expecting "yuv420p" as the format string for YV12 mode.

CRs-Fixed: 328252
(cherry picked from commit 0a263f67b75497e4b95b9de8c370ed9496ab59ef)

Change-Id: I66f418a52775a969d81bcb332bbe500370e3ab7c

Camera: Changes for face detection

Change-Id: I7b2172e8690d6e23762e42f5888fecbfda15ba61

Camera: Add support for burst count

Change-Id: I4488a5eac1eebb0b5c8e2cc7cbbe7be0c7301be7

Camera: enable HDR feature

(cherry picked from commit e40770bbdadd925fc1e07a08249a15981b961570)

Change-Id: Ie9ca3066e8e53710bf292d047a3724aefc029854

Camera : Add API to find fullsize liveshot support

Change-Id: I3c2fc3578decbe5cf87fded5362f317df0b40b5e
(cherry picked from commit 65d80f04892776eec1c19c844eacb8c454b4bd1a)

Camera: Set default camera area string

The default invalid value for KEY_FOCUS_AREA and
KEY_METERING_AREA is changed to "(0,0,0,0,0)"
CRs-fixed: 334934

Change-Id: I354802c8611ee5c00a591b96b1a1ca04926969cb

Camera: Change the scenemode names in framework

To comply with ICS API Specification,
SCENE_MODE_AUTO changed to SCENE_MODE_ASD
SCENE_MODE_OFF changed to SCENE_MODE_AUTO

Change-Id: I8e744f10c728f469923b09f69d6d64bc5c7c6850

Camera : Framework changes for camcorder UI menu

Change-Id: Iff9e9021da44b67f81a24c828b960113ee249248

Camera : Remove unwanted video resolution in Framework

- FWVGA, WQVGA resolution UI options are removed for camcorder.

Change-Id: If621140966b01dbc8c30a4d161e6771528b8adda

Camera : Enable FWVGA and WQVGA resolutions in camcorder media profiles

Change-Id: Iad9cc33f7b6d8eb7de21df372c016edeef0b99ba

Unlock camera AWB lock only when white-balance is changed.

bug:5633546
Change-Id: I90bb4b5b445daedf38a64e2f8fb980fc0f0aaa81

Change-Id: Ie3cc15132489502e64321776d49d96846b5705d6

Conflicts:
	camera/Android.mk
	camera/CameraParameters.cpp
	include/camera/CameraParameters.h
	services/camera/libcameraservice/CameraService.cpp
	services/camera/libcameraservice/CameraService.h

Conflicts:
	camera/Android.mk
	include/camera/CameraParameters.h
libstagefright: Add support to seek to zero

- Add CAN_SEEK_TO_ZERO flag in MediaExtractor to allow
  seek to zero, when previous button is pressed, for clip
  that can't be seeked.

Change-Id: Ic2761cc5bac2403ee1339da77ad02fde942a3437
camera: add ISO3200 and ISO6400

This change adds camera ISO 3200 and 6400, needed by some camera hal.

Change-Id: I65172a7de6554c3c288f0a4153d3fcb432b70db8
camera: add power mode support

Based on commit 7036d66bec7697160ba1b2e255f1e7fae0c8c435 from CAF,
branch ics_chocolate.

Change-Id: I652d63c33db9a8da4a9f8f613be12877d032de37
Fix the build on non-QCOM

Change-Id: Idb8d5c98fbdc01e6063ad0eb224baba66acc813d
libmediaplayerservice: Add new player for DASH

- Add new player factory to support dash playback.
- DASH urls end with .mpd. When media player receives
  an url with .mpd, it will use new factory to instantiate the player
  to be used for supporting DASH playback.

Change-Id: I69e5a08fb2baf89d97b1e0711dbe52a8b1c39c29
libstagefright: Check for duration > 0 to avoid DivideByZero crash

- duration = 0 can cause divide by zero and for this clip duration
  is indiacted as 0.
- check for duration > 0 rather than duration >= 0

Change-Id: I58ccacbf7ede892dff9626715162ea7b1f2ddbc6
CRs-Fixed: 451855
libstagefright: Fix incorrectness nPortIndex value for QueryCodec
                The query index is wrong, it will make a death loop in
my ME722 when get resource thumbnail for MPEG4 video.

Change-Id: I64532156e762b847a8eae59560fb828549c29519
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
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
Revert "libstagefright: Fix incorrectness nPortIndex value for QueryCodec"

This reverts commit 9a814ad626233ff02dd2d393929f32225bc94b68.
This is wrong. kPortIndexInput is defined as 0, the original value was correct.
Additionally, it breaks android.media.cts.MediaCodecListTest

Change-Id: Ib273cde69a4c622daf239bab5d12c5e7d568af2f
libstagefright: fix indefinate loop in QueryCodec

portFormat.nIndex is being incremented which is not
trustworthy since the nIndex value could be overriden
by the OMX Component,  which causes an indefinate loop
which inturn causes a memory leak and crashes the system.

OMX Component on encore and p970 exhibits this behaviour
(OMX.TI.720P.Decoder). This patch prevents stagefright
freezes when QueryCodec is called during Gallery Thumbnail
generation for videos and Adobe Flash playback.

Change-Id: I825c99ddecacbb927e22ac7d1a53facb26d95ff2
Fix includes for media-caf

Change-Id: I5d6dedbb9ba03fc313ab27f91bf83376fa20a7a9
audio: Squashed commit of LPA and Tunnel feature from CAF

frameworks/av: Add support for LPA and Tunnel Playback

-Add DirectTrack and DirectTrackClient.
-DirectTrack enables client to create a direct
 output.
-DirectTrackClient allows notifications to be sent to the
 client from DirectTrack.
-DirectTrack is being used for Low Power Audio
 playback and Tunnel Audio playback

Change-Id: Iddaaa557c4d6cb2e44903b6eaeba35cb9315194d

frameworks/av: enable tunnel mode based on flags

- Enable tunnel mode playback based on flags defined
  in target board config file instead of checking
  target name

Change-Id: I25a5431b659d9d07ed2791d90ec341ff26bd191f

frameworks/av: port fixes in LPA and Tunnel mode playback

No History was maintained during porting. Updating the Description
and CR's of all the fixes

Reference point: AU_LINUX_ANDROID_JB_MR1.04.02.02.049.366

LPA Mode:
LPAPlayer synchronization fixes
Fixes for seek, pause/resume, EOS handling
Fixes for synchronization b/w the decoder thread, TimedEventQueue and player thread.
Convert mono to stereo for LPA clips - CRs-Fixed: 421639
Add support to change clip duration to enable LPA
Set correct device while creating effects - CRs-Fixed: 496866
Fix the LPA-AudioEffects dead lock issue - CRs-Fixed: 477511
fix volume not updated in pause state of direct track - CRs-Fixed: 490592

Tunnel Mode:
Use tunnel player only for music stream
Exceptions in using Tunnel mode decode - CRs-Fixed: 432080
Enable Tunnel Decode for select formats - CRs-Fixed:437651
Use software decoder for ADTS content. - CRs-fixed: 431096
Skip tunnel mode for playback through AudioCache - CRs-Fixed: 437539
Fix stability crash on tunnel playback. - CRs-Fixed: 498386
support multiple tunnel instances - CRs-Fixed: 483603
Fix ANR repeated next with tunnel clips on BT/AOA - CRs-Fixed: 482966
Update condition to ignore a seek request - CRs-Fixed: 461908
Return seek position until seek has been processed - CRs-Fixed: 454825
TunnelPlayer performance tweaks for audio video playback - CRs-Fixed: 444041
Stability fixes for Tunnel Player (part 2) - CRs-Fixed: 449122
Adjustment for TunnelPlayer buffer size - CRs-Fixed: 447274, 442365
Remove unnecessary code from TunnelPlayer - CRs-Fixed: 442365
update condition to send SEEK_COMPLETE - CRs-Fixed: 441411
Stop extractor source after start in TunnelPlayer - CRs-Fixed: 440239
Handling of EOS, and triggering EOS was wrong in TunnelPlayer.
EOS should not be posted till seek is complete
Disable tunnel mode playback for streaming use cases to avoid jittery playback
CRs-Fixed: 433346 432233 429868
APIs for returning correct timestamps were implemented
Check whether sink is open before flushing or closing it.
Check for mIsAudioRouted is good to know if we are closing it
Seekbar freezes after seek and pause
Check pause status before writing

Change-Id: I55687403b8ee77f4c04eeba63538fa5c3d6d43ed

frameworks/av: Fix the LPA-AudioEffects dead lock issue

- Issue:Deadlock occurs when the LPA clips are subjected to
  rapid next from BT device and simultaneously on/off the
  audio effects.
- Rootcause:some times flinger thread processing
  LPAPlayer/directtrack next deadlocks with the thread
  working on effect configuration as both of them
  contend for the audioflinger::mlock and effectmodule::mlock.
- Fix1:AudioFlinger::deleteEffectSession() not to acquire
  audioflinger:mLock  instead take the mLPAEffectChain.mlock.
- Fix2:ThreadBase::effectConfigChanged() not to acquire
  audioflinger::mlock.
CRs-Fixed: 477511

Change-Id: Ia0e6d72f467afce6de5e66c6cd6edbe0759d271b

audioflinger: Fix crash in flinger during monkey runs

The trackrefptr in DirectTrack descriptor can be invalid and
this can result in a crash is stability runs. Add check for
validity of the trackrefptr before accessing it

Change-Id: I4c7fbff022f381f9d2cdbf0fc04ade8defbb2195

audioflinger: Support SRS Trumedia effects

Add support for SRS Trumedia post processing effects

Change-Id: I6718b0c90a199d53fe971a8a7c089e63b649c112

frameworks/av: Enable subsystem restart for LPA/Tunnel

-Audio Daemon in Audio HAL intimates AudioFlinger
 of ADSP status (online/offline) using set_paramaters.
-AudioFlinger send set_parameters to its clients
 which is DirectTrack used for LPA/Tunnel playback.
-In case of ADSP crash during LPA/Tunnel playback,
 clean up of DirectTrack is initiated.

Change-Id: If83102ddde1da880fb769d86a20884185c049bca

libstagefright: Create MP3 decoder libraries without OMX layer

- With the current MP3 OMX SW decoders, the decoding time
is increased w.r.t the libraries without OMX layer that are
present in GB. This increase in decoding time results reduction in
power savings in LPA mode.
- This commit is to remove OMX layer for MP3 to reduce the
power consumption in LPA mode

Change-Id: Ie194b11619de9ba43cd85dddbf7892239858945d

frameworks/av: Add metadata mode changes to LPAPlayer

-Seek to EOS was causing playback to hang for 3 seconds before
 switching to the next clip.
-This is because the lpa driver works on period size. Partial
 buffers are not handled.
 Add support for metadata mode changes to LPAPlayer to support
 partial frames.

CRs-Fixed: 458904 491077 490992
Change-Id: I8673756b54ae7bca18855d326c85ae1064652514

Conflicts:
	media/libstagefright/LPAPlayerALSA.cpp

frameworks/av: audiotrack state check during flush

-Audiotrack flush should be handled only on
 pause/stop state for non LPA/Tunnel playback
 as per AOSP

Change-Id: I112d71a465424dc81fc3acb9423f63cb9f84c2d7

AudioFlinger: SRS effect signal in case of Tunnel

send SRS effect signal to Direct Audio Track for tunnel
decoding
CRs-Fixed: 500015

Change-Id: I43d7296d0956c3b918681b9939c3f6a98b9a143a

libstagefright: TunnelPlayer: update condition to send SEEK_COMPLETE

- If the client tries to seek to 0 (e.g as a result of LOOPING)
  without ever calling getPosition(), we will always sent an
  immediate seek notification without seeking.
CRs-Fixed: 441411

Change-Id: I35b059448784324149890636933fdf9d536b2bb8

audioflinger:Set correct device while creating effects

Change-Id: Id2c96c1f1fe4cdfc2795c86caa050f31f15e7f8d
  -Issue: Effectmodule is created with stale output device
  -Rootcause: While creating effects the output device set is
   output device of mixer thread, which is stale and
   not updated, so effects use the wrong/old device as
   the output device and leads to issue such as difference
   in volume level after setting correct device etc.
  -Fix: Cache the latest device value for direct track
   in a flinger member variable when setparameter of
   flinger is called with new device and
   audioflinger::openoutput is called.
   Use this cached value while creating effects
CRs-Fixed: 496866

libstagefright: Fix ANR with rigorous rewind of 3gp LPA clips.

-ANR is seen with rigorous rewind of 3gp LPA clips.
-The lpa destructor waits for decoder thread to be killed when
 the thread function has not got the time-slice to execute after
 creation.
-Use mLock instead of extractor mutex. use mLock before signalling
 the thread to avoid indefinite wait.
CRs-Fixed: 491077 490992

Change-Id: Icf2ae64a379ff2b1260d34dd0e5c45f07f429718

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)
CRs-Fixed: 435661, 435664, 435680, 430309

Change-Id: I9e3e0a77ea64ef8c5afbe5a18ee583803a96c99d

audio: Compile AudioParameter as shared library

- AudioParameter as shared lib is needed by BT
  support in WFD source, SRS TruMedia

Change-Id: I8d78740ee0df456c8a305511d9335c228c9be3b0

audio: define QCOM audio parameters

- Define QCOM audio paramters for FM, VOIP,
  fluence, SSR, and etc.

Change-Id: Id708c22f7ebe96f1831095447560ff9376c73878

Conflicts:
	media/libmedia/Android.mk
Fix path

Change-Id: I52fe573eca57d0d70c8605014043ef76f9ce7b24
libmedia: Fix crashes on non-QC hardware

 * Correct the ifdeffage to stop crashes on non-QC systems.

Change-Id: If2e8cab322c78363c3c044e2f302dac897dbba50
libstagefright: Squashed commit of QC media features from CAF

libstagefright: Add support to plug-in proprietary parser

 - Introduce an Extended Extractor to facilitate plugging-in
   of proprietary parsers.

 - QC Proprietary parsers will be built and added only if
   TARGET_ENABLE_QC_AV_ENHANCEMENTS is true.

Change-Id: I2aae9515867f0beaa822e17fa390a1dc81953965

libstagefright: Add QC specific mime types

 - Add QC specific media extensions and mime types.

Change-Id: Id942a12cde131ca37a4a8855b340a9c8ff7b70d5

libstagefright: add ExtendedCodec to configure QC specific formats

 - ExtendedCodec configures omx component with QC specific
   extensions to augment container/codec format-support

Change-Id: I0eadf056f46d0512ae1cf3b2be29797a86cdd9eb

libstagefright: Configure decoder to support VC1 clips

Change-Id: I94900e9d6bd8a53c49a7449cc241b684749a4f33
 - Configure decoder in frame-by-frame or arbitrary mode
   based on the codec type.
 - Enable timestamp reordering for VC1 and AVI
CRs-Fixed: 432847

MediaProfiles: Add support for camcorder video resolutions.

Added video resolutions to support camcorder recording.

Change-Id: I2291de43ae2be7338c673f2f0417ec5c1581391e

audio: Add support for QCOM's VOIP solution

Change-Id: I108c4aea30b3e807209910ade429060e23545cde

libmedia: Add QC enhancements to MediaProfiles

Add entries for:
- EVRC, QCELP, and WMA formats
- 4K resolution support for camcorder

Change-Id: Ic308a735ffae5c57174824a86bff0248aff15ad2

audio: add support for QCOM audio formats

-Add support for EVRC, QCELP, AMRWB+, and WMA formats.

Change-Id: If110058284c8b3e18c2f242f560fc7748f62081c

mediaserver: conditionally launch ListenService

Conditionally instantiate ListenService from MediaService

Change-Id: Ib7a7e9bec41c64b0787433268d7ab769b852c124

framework/av:: Add support to decode mp3 data in mp4 container

- Added support to decode mp3 data in mp4 container packed as mp4a
  atom and .mp3 atom as well.

Port of 8fa3774adf9259b33ee721cfaeff26da42c29928
CRs-Fixed: 439897

Change-Id: I42acc43d7c856b7b565409924b4d08fe9b6b7344

audiomixer: Use High Quality resampler

Use very high quality resampler to upsample to 48KHz sample
rate.
CRs-fixed: 416730

Change-Id: I30420cbaa8f6d34e2bce408494cc08cb00b175a3

audio: Send correct channel mask in voice call recording.

-Using popCount function to get channel count gives incorrect value on
voice call recording.
-Only STEREO and MONO bits to be considered to count
channels on input

Change-Id: If3b7f8ec303e567ff10b572f09d504db5373afb3

libstagefright: Add Utilities for QC Enhancements

Introduce a QCUtils file containing utility methods
for QC enhancements. Enable these features only if
TARGET_ENABLE_QC_AV_ENHANCEMENTS is true.
Add following enhancements:
 - High Frame Rate (HFR) recording
 - Shell property to disable audio
 - Shell property to override encoding profiles
 - Support for B frame encoding

Change-Id: I466e7c4923db3c4d7516fb02d34dad840a0d114e

libstagefright: enable sync-frame-decoding mode for thumbnails

Force video decoder to sync-frame-decoding mode to optimize
thumbnail generation in terms of timing and resources

Change-Id: I7d6198747a42db05a08fd4cf237de51d3e936dcc

libstagefright: Add interlaced video support

- Adds call to set output buffer size on the native window

Change-Id: I4754e1f1d4d0bba375f719240499ef58c9e87ca2

frameworks/av: Add support for FM feature

Add FM volume key to AudioParamater class
which is used to initimate Audio HAL to
apply correct volume to FM stream

Change-Id: I5569bb12e33a07cde153b884bdceb549ac62c7e7

libmediaplayerservice: Add support for DashPlayer

Add support for DashPlayer in MedaPlayerFactor

Change-Id: I3e1fd871340117cb11975f6819d4bf0e6630607a

audioflinger: do not invalidate stream used by voip

During the process of invalidation of voip streams,
actual driver is not closed so when it tries to open again
getoutput fails as only one instance of voip can be created.
so do not invalidate the tracks used by voip driver.
CRs-Fixed: 494093

Change-Id: I42a962991ce1d586d87f4aecba19c0e5dde6b9dd

libmedia: Add support for LCH tones

- Add the INCALL_MUSIC flag for tracks
  created for INCALL_MUSIC stream.
- Adding tones to the ToneGenerator that are
  to be used for Local Call Hold.

Change-Id: I98c914a0d6cce26da5b82d010328ee689e12a1c5

libstagefright: Move checks for creating new extractor to ExtendedExtractor

- Move all the checks and creation of the extended extractor
into ExtendedExtractor.
- Restrict creation of new extractor to the following conditions
  o default extractor is NULL
  o default extractor says the content is video only
    or has an unrecognized audio stream
  o the audio stream is a amr-wb (plus).
- Avoid creation of two extractor, this improve start-up latency.
CRs-Fixed: 507045

Change-Id: Id9f9428f0ca5781ecdbc9b27f6c6d930df820751

libstagefright: wrong component name set for wma

Const key word for component name doesn't update the component name.
Update function signature to return component name.
CRs-Fixed: 507111

Change-Id: Ia79c7d9bbc3d7014ee13ed3a2d43d5825b7467e9

libstagefright: i/p o/p port config not required for AC3/EAC3

For Dolby AC3/EAC3 media we dont need to configure input and
output ports here

Change-Id: I772d31919c82d0598e3c2b2bbabf4ec04cdf92ed

libstagefright: Set the profile type to user selected type for AVC Encoder

User selected AVC profile was not set as it was over ridden
by base profile.For QC Enhancment Enabled,user selected profile
should be used.
CRs-Fixed: 514235

Change-Id: I4de760539d2b9f31f08e5e3956e2be3f5f280713

libstagefright: Add new QC Media formats

- Add QC MediaDefs and MetaData for new
  QC parsers
- Add property to support runtime enabling of
  QC parsers

Change-Id: I7df285a6556f49df2c1ed5eda650bbf6dd39a863

Conflicts:
	include/media/stagefright/OMXCodec.h
	media/libstagefright/OMXCodec.cpp