libstagefright: Fix memory leak in video playback start failure

Output buffers are not freed when video playback fails
when starting playback, causing a memory leak.

In the case of a codec initialization failure, we now make
sure that the omx component is properly transitioned to
loaded state and that the buffers are freed.

CRs-Fixed: 360964
(cherry picked from commit 37fa976da8bbeff3d5edf55785224b1c389154d5)

Change-Id: I9a0efe80564a3fca1847f5e5c08b671fa78927af
libstagefright: Added suspend-resume support for 3D clips

On suspend-resume, 3D clips were not being detected as 3D and were being
played on 2D.  As we never send the frame with 3D SEI (typically the first
frame) on resume, it is necessary to store state in between.  Due to the
loss of the suspend-resume APIs in stagefright, mediaplayer can no longer
store state between s/r.  As a result, we have to make VideoView hold state.

This change sends a notification (MEDIA_INFO_3D_ATTRIBUTES)to the upper layer
with the appropriate 3D flags.  On resume, the upper layer is expected
to pass these flags back to stagefright via the setParameters call. This
in turn sets the appropriate key in metadata. In processSEI, if we
happen to see this key, we pass the value associated with the key to
NativeWindow.

CRs-Fixed: 355006
(cherry picked from commit 931ab52420061c10120d658058e9926e75f6338f)

Change-Id: I08f0c8fbf4febc6a6dbc1d2f4125b2d59fbb6e42
Telephony: Verify received reconnect alarm

Ignore regular reconnect alarm if DC is already in partial success
state.

Change-Id: I5e3a90c5ccb3a8e982d9b315925dc6320d93e56c
CRs-Fixed: 363623
(cherry picked from commit e44319d40a008b01aeb71a2081cdd3433f9d85d5)
libstagefright: dynamic port reconfig handling

- Add support for dynamic port reconfiguration handling in OMXCodec

Change-Id: I41747522e41d3e92fbacd9c457cb83ba9e46480e
CRs-Fixed: 331504, 351640
(cherry picked from commit 2ee46f4f2a3fcc1e0aa149b68be28c9a5ddbd082)
Revert "Force a WebView pictureset reset on screen rotation."

This reverts commit e8b05e858a95c900c1bebb993857ed0ff8770e4e.

Conflicts:

        core/java/android/webkit/WebView.java

Calling clear content during rotation is not needed. Calling
contentInvalidateAll is sufficient to trigger new picture generation.
Calling clear content has an occasional timing-based failure mode where
it clears the invalidation rectangle before a new PictureSet is re-
generated resulting in failure to create the new picture until the
next time the content is invalidated again.

Change-Id: Ie93589207f9c32b66bb97553fcfff387787faa9b
CRs-Fixed: 343553
CRs-Fixed: 349428
(cherry picked from commit 33da3719120e20e5bf8b5aa74fd9d0a48f3feca6)
Merge "libstagefright: dynamic port reconfig handling" into ics_chocolate
Telephony(DSDS): Add more APIs to MSimTelephonyManager

Overwrite the below APIs in MSimTelephonyManager
 - getPhoneTypeFromProperty
 - getNetworkOperatorName
 - getNetworkOperator
 - getNetworkCountryIso
 - getSimState
 - getSimOperator
 - getSimOperatorName
 - getSimCountryIso

CRs-Fixed: 365557
(cherry picked from commit c78c1af5b6b70dd9dd822ee9db67479f2a4208ac)

Change-Id: Ia0003aaadd43a1c3fea173143354152603a1a481
SurfaceTextureClient : Reset buffer size to 0 after setting geometry

Buffer size has to be reset to 0 after setting geometry , otherwise
the new request may get the buffer with wrong size.

CRs-Fixed: 337041
(cherry picked from commit 9b3ebedad4f53b7348135dac827392a39b01f69f)

Change-Id: Id9afe01c80912d3245c2f37ddac51f550c896dce
Bluetooth: Avoid Profile Connections for Avoid Auto Connect Scenarios

Some of the car-kits does not entertain incoming profile
connections and respond DM for incoming RFCOMM
connection. We should not initiate HF connection request
for these carkits.

CRs-fixed: 357884
(cherry picked from commit eb7bbf10b20cffbe4f39db020f213e6c324ac120)

Change-Id: Ib9c79cb057fa9bc9acffd49d23d75508af392ceb
Merge "SurfaceTextureClient : Reset buffer size to 0 after setting geometry" into ics_chocolate
libstagefirght: Fix for data loss in A2DP playback with repeat mode

- Data loss is observed in A2DP at the starting of
  second playback with current song repeat mode
-When the file EOS reaches Awesomeplayer calls seek to zero and
 pause the LPAplayer till A2DP thread sent all the data to A2DP.
 Since decoderThread not aware that LPAPlayer in pause state it
 keeps on calling fill buffer.But A2DPThread will be blocked till
 LPAplayer resumes from pause.So buffers which fillbuffer returned
 in pause state are not sent to A2DP and these buffer will be
 over written.
-Added the condition to avoid fillbuffer in decoderThread when
 the LPAplayer is in pause state.

CRs-fixed: 351079
(cherry picked from commit b2ecd5f5b39e3fbee3f73f533897b0d14624244a)

Change-Id: Ib424a5f5794f91df4cad4fbbd7ab27faffcc4ba2
libstagefirght: Fix for music skip in LPA A2DP case

-Portion of music repeating twice after disconnecting and
 connecting A2DP
-When A2DP disconnects, timeplayed will be updated with the data
 sent to A2DP. But Decoder thread already has some decoded data
 which is not sent to A2DP.Here if A2DP connects back decoder
 thread calls fillbuffer with the  time played position.
 Because of this fillbuffer getting some of the decoded data
 which is already decoded earlier.
-To address this issue when the A2DP disconnect and connect happens
 clearing all the buffer which are there in response queue.

CRs-Fixed: 356571
(cherry picked from commit b52619bdc157646278fce30ceb84057370f030c1)

Conflicts:

	media/libstagefright/LPAPlayer.cpp

Change-Id: I98578d4470021757625ad1203682da4bb45cd055
Telephony(DSDS): Correct the use of MSimTelephonyManager for non-dsds

Changes to call the super class (ie., TelephonyManager) methods
from the MSimTelephonyManager methods in case of non-dsds.

CRs-Fixed: 365759
(cherry picked from commit 32fe99c79ffe11792f2c7017ba074e4dd2d91b57)

Change-Id: I3c7c0a4ca53fbfe107fbf37b69270780188d502a
Merge "Bluetooth: Avoid Profile Connections for Avoid Auto Connect Scenarios" into ics_chocolate
Merge "Telephony(DSDS): Correct the use of MSimTelephonyManager for non-dsds" into ics_chocolate
Bluetooth: Mediaplayer changes to notify Forward and Rewind Seek.

Bluetooth AVRCP 1.3 feature expects forward and rewind seek
status to be notified with get playback status command. Hence
updated Mediaplayer seekTo API to send the playback status
with intent.

CRs-Fixed: 355470

Conflicts:

	media/java/android/media/MediaPlayer.java

Change-Id: Iccc7c97e7bf3e6a9dd41098e441e7b97b7761c57
Telephony: Change dns setting code

If only dns2 is used don't overwrite its value to dns1 property

CRs-Fixed: 359766
(cherry picked from commit f10c50bb196bc175e56ac9fa9198321784c2faac)

Change-Id: I85680237ec6cb5274863ed54c911774f06aec102
NuPlayer: Shutdown audio deocder during seek for DashLiveSource

Shutdown audio deocder during seek for DashLiveSource

CRs-Fixed: 346380
(cherry picked from commit 241cf5298f6a8f670ebaa20e11053cb71bb7bb06)

Change-Id: If3aae86420cc3e2054eb5f1a43ca5a50c66b2d1c
(cherry picked from commit da31cf6ea370713008f822a7e2ebcaa02ce2bf51)
(cherry picked from commit 0a226ef99607d7efbfca2ebccd0f78bd066cbf5c)
Merge "NuPlayer: Shutdown audio deocder during seek for DashLiveSource" into ics_chocolate
frameworks/base: Fix for LPA volume sequence reversal

- LPA volume is sometimes reversed while doing volume Up&DOwn.
- Two different threads are trying to set volume, one by invoking
  setSessionVolume() and other by invoking setStreamVolume().
  But currently only setStreamVolume() is mutex protected. This
  is leading to race condition and volume set second is getting
  applied first.
- Fix is to acquire mutex in setSessionVolume() before setting
  volume.

CRs-Fixed: 360973
Change-Id: I02ac979bf83c4f3589deb5c83ae816179735aa2b