BT: Multi A2dp support in Bluetooth App

1. Added support for Multi A2dp connections
in Bluetooth application.
2. All connection transition states for
2nd HS onwards is handled in new state-
MultiConnectionPending.
3. The changes are done to handle proper
state transition for all connected HS.

Change-Id: Ib7d16a4a647ba5d7e38a8c2edc4581474725ab6c

Conflicts:
	src/com/android/bluetooth/avrcp/Avrcp.java
	src/com/android/bluetooth/btservice/AdapterService.java

Bluetooth: Add support for multi Streaming.

Add changes to support dual streaming for
A2dp

Change-Id: I84882d850ffd374bb998ef5e942464e2972d64bf

Bluetooth: A2dp MultiCast/ Soft Hands-off.

 - Allow new profile connection on same ACL
 - Reset scan mode to last set scan mode before
   starting multicast
 - Check for mTargetDevice before moving to
   disconnected state.
 - Remove playing device from list on disconnect

Change-Id: I24fa041783abba1584730930336b65a9586cb778

Bluetooth: Send Track change notification

 - Send track change notification to both
   devices.
 - Check for absolute volume support in both connected
   HS before updating audio
 - Reject 2nd incoming connection, when connecting event
   is received in pending state and already processing
   incoming connection.
Change-Id: Ia5271febddcbf69c205fbebc7a11964a1ef0719c

Dual A2DP: Update playstate on suspend

    - playstate update for suspend case to reflect the
      right state to remote device.

Change-Id: If11acb9126ac8f424c622d786d4eaf3f155ca0c6

A2DP/AG: Increase A2DP/AG application level connection timeout

    - Application level connection timeout should be higher
      than lower level possible timeout to avoid race conditions.
      Stack level timeout for user response timeout is 30 seconds,
      hence during such scenarios stack will be still not timed out
      but application starts cleanup.

Change-Id: I606e81fcea2e02c0cf4e5e47dba216bcbef42db4

Bluetooth: Update AudioManager for ABS volume

 - Update audiomanager for abs volume after RC features
   is received.
 - Update audiomanager when any of connected HS is
   disconnected.

Change-Id: Ie2479cf538a830ba47c5a6418199caef2a81e78a

Conflicts:
	src/com/android/bluetooth/avrcp/Avrcp.java

Bluetooth: Block new ACL connections.

 - During active multicast, no new ACL
   should be created.
 - Do not proceed to new A2dp connection
   during active multicast.

Change-Id: I0b9f6e7648976095ece8de4a41fbe10634c07131

Dual A2DP: Update currentDevice for unexpected disconnection

   - While in multipending state, currentDevice should be updated
     when disconnection is initiated for one device but happens
     for other device which is currentDevice.
   - Increase the connection timeout to 38 seconds to accomodate
     LMP response timeout and page timeout.

CRs-Fixed: 835641
Change-Id: I54d439e458a212d6acf3031e5d1e89706071cfa9

Dual A2DP: Do not initiate bonding while multicast

    - Bonding has to be disabled while active multicast is on.
      This has to be explicitly taken care for avoiding the
      bonding and connection from available devices.

Change-Id: Ic82686dd100201ca6171fbc3ab14c0b9690a850c
CRs-Fixed: 837415

Misc A2dp Multicast Changes for proper Avrcp handling

    - Send play status update only if Music streaming is
	 in progress.
    - Send play status update based on device specific stored
         state.
    - Remove multi player implementation as it causes mismatch
         in stored playback state and actual player state.
    - Logging changes for scan state update.

CRs-Fixed: 839396
Change-Id: I539d949c32cbe1871f3c737bdd0e092798f729c1

Proper assignment of track number and play position

 - Initialize track number with value as -1 but on
receiving meta update set it to 0 if media player
in use is not capable of setting it to valid value.
This change will help supporting 3rd party media
player apps which are not capable of updating
mentioned fields properly.

 - Explicitly send play-position as 0 in getPlayStatus
response when position is not initialized as specification
suggests that -1 is not a valid value for this command
response. As per specification -1 will still be sent
as the play position in interim response of Play Postion
Changed notification.

CRs-Fixed: 836672
Change-Id: I3e10ec4e49df095485fa630b95bf829e755686f1

Misc Avrcp handling for Multi connection scenarios

 - Handle avrcp TG connection state change update
from stack and add remove respective devices to
Avrcp connected device list.

 - Proper clean-up of device entries in A2dp and
Handsfree state-machine.

 - Sending playback state changed as Paused when
playback switches from that device to another.

 - Reject pending notifications when addressed
player changes even to non 1.5 capable player.

CRs-Fixed: 843335
Change-Id: Iafbeb17907e8bc5409ee996b966824fd4ba87417

Conflicts:
	src/com/android/bluetooth/avrcp/Avrcp.java

Proper handling of Player settings attribute change

  - Proper handling of Player setting attribute change
  - Logging enhancement in player setting attrbute path.
  - Formatting changes.

CRs-Fixed: 845462
Change-Id: I06067a091a21082b2668c31762f078da557841ee

Conflicts:
	src/com/android/bluetooth/avrcp/Avrcp.java

Dual A2DP: Update the connection state after timeout in Connected state

When initiating incoming/outgoing connections, there is a possiblity
that CONNECT_TIMEOUT for outgoing happens after successfully
connecting to two other devices and this will be received in
Connected state. We need to update the connection state and
clear the target device.

Change-Id: I0a1ad01f85b6f45b9276c6da9ce0e6b34f75990e

Proper handling of Setting Addressed Player

Proper handling of Setting Addressed Player ID.
Make addressed Player ID as device independent.
As otherwise device wont update the same after
reconnection if any change has happened in between.

CRs-Fixed: 855172
Change-Id: I23a4c3e9670fcd6538e0e3f5ef8c0be116a25de4

Change Play Position and Play status handling

Change Play Position and Play status handling
in a way that play positions are not kept device
speific anymore as that belongs to change in
player state, not device state.
Play state changing to playing is sent only when
device is identified as active one in hand-off mode.

CRs-Fixed: 856063

Conflicts:
	src/com/android/bluetooth/a2dp/A2dpStateMachine.java

Change-Id: Ia7e859c28a1826ac2686c432690030741a3c67bc
15 files changed