MediaProfiles: Add support for camcorder video resolutions.

Added video resolutions to support camcorder recording.
(cherry picked from commit I2291de43ae2be7338c673f2f0417ec5c1581391e)

Change-Id: I309fa41cfa36ee0551a8a7c53072089858a2c66a
(cherry picked from commit 805cb98f40acfb242206b7db71c50bc56ea77d2a)
(cherry picked from commit 68c1f41295f4be54ed13af20ebd1041890d2f3ca)
(cherry picked from commit 5a74f7e0e0fbec707333a1f7481d85961aff3908)
Camera: Enable Histogram feature.

Link the histogram enable/disable commands from
application to the HAL layer.
(cherry picked from commit 8ccc5e2091fcaf181210ebf16a86640e3c609b0d)

Change-Id: I510c4e1798285ed1315bfb0d234fa76090659ba2
(cherry picked from commit 6e13c154132ff81c6039375b12e71d7cd5ee42ff)
(cherry picked from commit e805ef1ab03a52c3f68e7f814921564adf534383)
(cherry picked from commit ac3ff28b327dffc08e45c4ce131fda4e65ca8a45)
Camera: Add support for ZSL burst mode.

Added ability to set number of snapshots in burst mode.
(cherry picked from commit94e831cb179f05e50ac4fc9b2b15c26f44f2ee9a)

Change-Id: Ia227d9c3445febd9b76e42471652c7b9b11b8d02
(cherry picked from commit e9856cb45feaf62b67e624386920dc7c1985fc34)
(cherry picked from commit 09767651bec149b9c53e667049b0946eee2c4f04)
(cherry picked from commit a7c14d8dc5b5513c8c9fde136429fb9801f2b90f)
Camera: Fix deadlock due to mLock in pcb and takepicture.

In non-zsl case of takepicture, we do streamoff for preview
stream which is waiting on preview callback thread to exit.
By that time the lock has already been acquired by takePicture.
So preivew callback will not exit until it acquires lock and
takePicture cannot continue until PCB call back is returned.
Fix: Avoid the mLock at services when both Preview cb &
Compressed cb are enabled.
(cherrypicked from commit bd423581f4b7eb8481f5525fc51174ce4c7261bc

Change-Id: If8b2d7465b279386f06eeeb4fee51cf73ca5ee41
(cherry picked from commit 7168882cbe6c8cb79a1788c3d1e7d4579f966491)
(cherry picked from commit 2274c3035b27ce850ebf46af123e31b977029afc)
(cherry picked from commit b31c52b9cabc34f37ad56a0d2747f284efcf83af)
Camera: Disable TakePicture related messages in stopPreview, stopRecording This change fixes the race condition and avoid the deadlock in abnormal snapshot stop I.e, Observed DeadLock when Data or Notify Callbacks is sent to App after StopPreview is triggered and so disabling the corresponding take picture messages. (Changes cherrypicked from commit 962b0856465e7abbd5900fffa68112363b8e5360

Change-Id: I19a71b520393e17a396dffb0c3c128274145defc
(cherry picked from commit 21fc74ac6917dbc9c9bd356516daf0481d2ffbb6)
(cherry picked from commit cce451c27f09e9495bbfc16fbd93477994dfd603)
(cherry picked from commit 74053c899d8e7804e0a66f22285a9b22defd85d2)
Camera: Dont process dataCalllback if recording is stopped

Issue: Here stopRecording is not finished as the previous
recording frame process has not completed. dataCallbackTimeStamp()
in CameraSource.cpp has stuck in the thread itself waiting for a lock.
In between, reset() function in CameraSource.cpp has called
and acquired lock. Reset() function calls stopRecording.
So the dataCallbackTimeStamp() is continuously waiting.
Unless dataCallbackTimeStamp returns, processRecordFrame
in HAL will not finish.
(changes cherrypicked from 8c47e1700fc8b6ef84d5fc76797255e6fc8e8a7f)

Change-Id: I2bb6f6d1a045bbff5ea701b4ba29ff12c0d832f5
(cherry picked from commit 18d00326f362f8a9551f91ff6eec9747cff7b1a5)
(cherry picked from commit cff04e1ab6802815e2a5d8d350a3b1a0a43f3968)
(cherry picked from commit 13cb195870f20ca703dac82bae07500417c35f56)
frameworks/av: Add support for FM feature

Add FM handle key and volume key to AudioParamater
class which is used to initimate Audio HAL to
that FM device is connected and apply correct
volume to FM stream

Change-Id: If5fa14faf7946ab27eb42b89546dc2274b24f754
(cherry picked from commit 165f20759433d0137a292b457aa783f801f13277)
(cherry picked from commit c98b484de0877e159f00b3b01d622b6539f0b2bc)
(cherry picked from commit f752d489bb85a94b81d38c72333409b4384d860a)
libstagefright:add enhancements for extended format support

Extended-extractor to support extended container format.
 - Introduce an Extended Extractor to facilitate plugging-in
   of parsers extensions.

Extended-codec to configure codec specific configurations.
 - configures omx component with extensions to augment
   container/codec format-suppor

Extended-utility to add utility methods and shell extensions.
 - Utility methods for supporting following features
  - High Frame Rate (HFR) recording
  - Support for B frame encoding

Change-Id: I77a40af701916f1803fa9c6af3c43a312a8d2c98
(cherry picked from commit ab6a474cd9acc7bc54c54a7c235f6eab032349ca)
(cherry picked from commit fe07c231dbecd255aedbf7aac597260831eb98cf)
(cherry picked from commit df7b013ceeeb4697f448a2d150ae75b86c325013)
libstagefright:enable extended codec/format support

Configure omx component with extended extensions and
register exended-extractor to augment container/codec
support.

Change-Id: I0bfa4bd6c4dfed93a96e1af431018de54d6fb57b
(cherry picked from commit 318c38f40b53e1987473b29a359e586615bf3c02)
(cherry picked from commit 4a0e6d65c200604a9618e2fc90326031153e6f08)
(cherry picked from commit f9b65059fabc1c24ae5107b54f96a017e8fc7376)
libstagefright: For interlace, set decoder in arbitrary mode

In arbitrary mode, frame parsers sends individual fields
to core. Once both the field is decoded, output done (FBD)
is sent back to client.
Default frame by frame mode will send both the fields in
a single buffer to core, which might decode only one field
or will throw up error.

CRs-Fixed: 531034
Change-Id: I31844093b6a93d3a62577fc8d799353d30573c17
(cherry picked from commit cb45f5a702992242538fab6d9e2c36b7b8e55c7f)
(cherry picked from commit 214938ef4f9997233a33a24e9e9e9751a1fa1882)
(cherry picked from commit 646e3bdce1c8241fb46802e7eba3c4f8a528517d)
audio: add support for MSM audio formats

- Add support for EVRC, QCELP, AMRWB+, and WMA formats
- Refernece change If110058284c8b3e18c2f242f560fc7748f62081c form jb-mr2

Change-Id: Ie20f2d61f79d2ba41d552718187b7098141e7b8c
(cherry picked from commit bca561e38853351c0bae15c5d201dbca7f5a027e)
(cherry picked from commit a11972f505000be397ee3a377ec42bf9e5fef420)
(cherry picked from commit 7465e6129b291c66dc7741325a90e3725e40e941)
libstagefright: fix metadata key sizes

 - some wma metadata keys should be treated as 32 bit keys instead
   of 64 bits.
 - fixes wma lossless from failing

Change-Id: Ic6af8392aea6a1bd8810dac59e1d1c27c21c4059
(cherry picked from commit 1fae0bcb8ef9244e1f28d21c36e388ab365e3c0f)
(cherry picked from commit 97be73e3004a838227060f026f38c7231dd7e2f7)
(cherry picked from commit 4d24c91e49c89eadb7b48e47e38a9b7b6df8f1cf)
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: I265ae1fa32c6fdd8be0382cc2b28605bc756a2f3
(cherry picked from commit b255c1963bb3af6f547b68d646737a7c92739555)
(cherry picked from commit 7cb21f77ae28f58da1cb8ba8f684b2968dcd4122)
(cherry picked from commit d4fa9e74c1ee1c2f7f7262c245da0b94dc0ac05b)
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: Iea150f8d75aa9aa6d14da078695e920a3742dd81
(cherry picked from commit f7c9bafa439c5d52d945b966ba08cb16dfc34818)
(cherry picked from commit 68dee8112bbac7e0a70003175ed71b4e6a0376f4)
(cherry picked from commit 19c7fd3e330be551d477e8388b536294b1166a22)
frameworks/av: port fixes in LPA and Tunnel mode playback draft -2

 -LPAPlayer: Update condition to ignore seek CRs-Fixed: 453067
 -libstagefright: TunnelPlayer: update condition to send SEEK_COMPLETE
  CRs-Fixed: 441411
 -libstagefright: Fix ANR with rigorous rewind of 3gp LPA clips
  CRs-Fixed: 491077 490992
 -frameworks/av: Add  metadata mode changes to LPAPlayer
  CRs-Fixed: 458904 491077 490992

Change-Id: Ia89d7d6ac63b1267422a9138df9f98ef59b0ccb7
(cherry picked from commit 72f3bd4cddd3d93812692bffbfc19e2534477938)
(cherry picked from commit db6330d01d91d466d18c7714bd024a10fb009f57)
(cherry picked from commit 416e9ef0eed0ffa7b6e2c9d5a107d1ed2a94a624)
frameworks/av: port fixes in LPA effects

 -audio: fix for deadlock issue during LPA playback.
 -frameworks/av: Fix the LPA-AudioEffects dead lock issue CRs-Fixed: 477511
 -audioflinger: Fix pops in LPA while effects are applied CRs-Fixed: 526799
 -audioflinger: Fix delay in enabling effect for LPA CRs-Fixed: 525510

Change-Id: I92118b5cba17f5337608007052e7dc891d2d6b5b
(cherry picked from commit b24a38903f3fc2fd2bf7cc8fb71d50e1ff38162d)
(cherry picked from commit e8a1d6f80e64822d83f04f4f0704890644048189)
(cherry picked from commit 571f36890abe9f6b8bfe7341776cb5b3975bf952)
frameworks/av: Use the correct macro for AV enhancement

- Use correct macro for AV enhancement
- Add HW aac encoder entry in codec list

Change-Id: I2933ee92ff15875144acec17d3dd8ef61d6b37f9
(cherry picked from commit 5bb728d3bb84f2f24ddfbaa99fa133c87ff66298)
(cherry picked from commit dbc1e5bde1564e80052086a7ee301173515c8d64)
(cherry picked from commit 941f87a69f87dbeab0068f3e9a98c97981ff2700)
libstagefright: Add support for H/W AAC decoder

- Currently, only software AAC decoding is supported.
- Add support for H/W AAC decoding by including it in the
  list of available decoders and use it for decoding only
  if the property 'media.aaccodectype' is set to 0.

Change-Id: I35caba6fb694d17b51a0a9983a5fc5f28cb375ec
CRs-Fixed: 449145
(cherry picked from commit a87c3159a34da86e62c029a06e8e39bef66ae2db)
(cherry picked from commit 6a47c5cb0fe741f31b36bee7e74bd953a3ad3bcc)
(cherry picked from commit 8f6bacb4427d3c84af00b06a8ceb1bb324550acc)
frameworks/av: Compile AudioParameter as shared library

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

Change-Id: I30ee584ba7f45f5cafbdf07c45aa7429a84b1b49
(cherry picked from commit 30b89b3bfdafa2f3b877644400efbaefd6572f1e)
(cherry picked from commit 84c3b42f25a28d14426dba29276aae8c5ab795ce)
(cherry picked from commit 53c42631eeb1e13b786d9f4f616f38fe59690e4e)
frameworks/av: Define MSM Audio parameters

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

Change-Id: Iec6f146a0dde3095e3380da439a883b1bbb7d462
(cherry picked from commit 8e943f5bd88bda87f1aa9230487a69372ad49cf7)
(cherry picked from commit 85f4743d12c13aab39ac712a9005632f427c1c43)
(cherry picked from commit 333ba54561c59049f695b07479afe1d5ed734d31)