Bluetooth: Fix for BT fails to turn on in PDT test

Fix for BT fails to turn on after several hours of PDT test
Issue is due to disable timeout, host fails to get the wack ACK from
the SoC during BT turn of. Adding ssr cleanup routine in disable
timout routine

Change-Id: I6f71a9d63256ff0f911ff8aa4fb0dbecffc27a98
CRs-Fixed: 614585
Bluetooth: Clear connect queue in ACL Disconnected Event

Connect queue should be cleared when it receives ACL Disconnected
Event and also for open event in idle handler.

Change-Id: Ia11441de8e4e541a0bd1bdc3659d7491a6a8601f
CRs-fixed: 622324
Bluetooth: A2dp Connection failure.

Send disconnect event to closing state from state machine
and handle closing event BTIF layer to update app for
connection failure.

Change-Id: Iab6de022227f20db82bbbe20b9eac6457f426061
CRs-Fixed: 655231
Connection management with non scmst capable remote

If scmst is enabled on DUT, then connect to non-scmst headset if
BTA_AV_DISCONNECT_IF_NO_SCMS_T is not defined or defined but set
to FALSE, otherwise disconnect the link if A2dp is tried to be
connected with non scmst capable headsets.

CRs-Fixed: 644204
Change-Id: I88593fec8619b14d2ed96cef13b3dd1d8bf580bd
Bluetooth: Suspend AVDTP link in remote initiated Start

Few remote devices sends start on power up and does not
suspend causing link not to go to sniff.
Change done was to send suspend and initiate start
when local playback starts

Change-Id: I8ebee009c95148cf733e39d897bc8ffe5af7791e
CRs-Fixed: 621127
BTIF-AV: Use valid memory for AVRCP message

After the context switch to BTIF for META message processing
the buffer allocated for tAVRC_MSG will be freed, hence allocate
the required memory and free that after handling the META
message.

Crs-Fixed: 651506
Change-Id: Icbf61776a6fb63fac1555bf25d3700beccf2b67a
BTIF-AV: Do not attempt connection for unbonded devices

Do not attempt connection for unbonded devices

CRs-fixed: 631398

Change-Id: I0b87338dca5bce07ee03d774d3339131514c1268
Calculate number of sbc frames per AVDTP packet

Calculate number of frames per AVDTP packet based on config
parameters.

Change-Id: Ib167f3c705e5062f041dc17cefd1830250769242
CRs-Fixed: 669291
Bluetooth: retry recv in case of EINTR

 -  retry recv call in HAL, in case socket call
    fails with EINTR

CRs-Fixed: 629622

Change-Id: I3ab27752b0ce0a68f6776cf5da340580e7d1f345
Print delay logs during A2dp streaming

    - Log systrace during A2dp streaming. This logging is not
enabled by default.BT_AUDIO_SYSTRACE_LOG needs to be defined in
applicable files to turn this logging on.
    - Properly name threads.
    - Log A2dp write delays.
    - Log pcm dump before writing to media socket to mediatask.
This logging is not enabled by default. BT_AUDIO_SAMPLE_LOG needs
to be dfined to enable this logging

CRs-Fixed: 595049
Change-Id: If081480b29f02126a1d48b9d0d9f855a3a605cc5
BT: Avoid extra power mode entry for AV.

- Extra power mode entry for AV is avoided by
passing correct app_id to sys methods.

- Avoid sending app_open from SDP for A2dp.
Instead use conn_open while starting sdp and
conn_close on sdp complete.

CRs-Fixed: 619847
Change-Id: Ibede90a9cb49d98e4814ff5efd994716c0987a9e
Bluetooth: Validate the Metadata length.

This change ensures that DUT rejects
invalid AVRCP Meta command having invalid
data length.

Change-Id: I8a591d601636a0fce268b5b965f2bd691c24c319
CRs-Fixed: 667378
Bluetooth: A2DP Sink Logging

 - logs for state transition
 - Latency logs with sequence Number

CRs-fixed: 601894
CRs-fixed: 601893

Change-Id: Ic4b68cdf68b228342c91034535a5f5dcfab6fe25
Enable required AVRCP Logging by default

Enable required AVRCP Logging by default.
Introduce additional logging whereever required.

CRs-Fixed: 601898
Change-Id: I08e7a51337c7aaae5758178b818654475dbdefe9
Bluetooth: Reject second AVRCP connection.

This change rejects the RC connection from
second device if the DUT is already connected
to RC of first device.

Change-Id: If2e39cd90575baffd0e4442b8e7cd2a91eebdf56
CRs-Fixed: 626011
Bluetooth: Clear Notification array on AVRCP disconnect

DUT does not clear previous AVRCP notification registration
on AVCTP disconnect hence DUT sends response even when remote
device hasn't registered.
Changes made to clear notification array and while sending
notification respose check if event is registered.

Change-Id: I610f8ae6381a63236378f179bb2a619ec0c6549e
CRs-Fixed: 613785
Bluetooth: Fix for NULL pointer check

This fix is to avoid NULL pointer dereference for 'p_remote_cmd'
in handle_rc_passthrough_cmd function.

Change-Id: I3ba7d91d6b18c8fb29caee176b10f6a6097d8e47
CRs-Fixed: 657785
Bluetooth: Check RC Handle for processing pass-through Commands.

In some race conditions 2nd AVRCP connection
is connected and remote sends pass through commands
immediately, in such conditions check for RC handle before
processing pass through command.

Change-Id: Idc8756983adfd12b3871dfe46d5aafbe6c2b6a91
CRs-Fixed: 642934
Bluetooth: Increase HF connection timeout

A BT headset takes longer time to establish SLC
connection. So, increase HF connection timeout
from 5 seconds to 10 seconds.

Change-Id: I1af681177db01902f6121fe4cd9817476e4c78c7
Bluetooth: Move to proper SCO state.

On SCO shutdown event,while in SCO
opening state,  move to SCO shutdown
state.

CRs-Fixed: 652289
Change-Id: I72f3c602d3873afd1f976f026fb9b6f25afff952