OSDN Git Service

android-x86/system-bt.git
7 years agoMerge "Just clear IB_CFG_DONE on receiving Peer config request when channel open...
Linux Build Service Account [Tue, 6 Sep 2016 05:51:20 +0000 (22:51 -0700)]
Merge "Just clear IB_CFG_DONE on receiving Peer config request when channel open" into bt.lnx.2.1-dev

7 years agoMerge "Bluetooth: KW fix for gatt test tool memory failure" into bt.lnx.2.1-dev
Linux Build Service Account [Tue, 6 Sep 2016 05:51:14 +0000 (22:51 -0700)]
Merge "Bluetooth: KW fix for gatt test tool memory failure" into bt.lnx.2.1-dev

7 years agoMerge "Bluetooth: Enable backtrace for malloc and free functions" into bt.lnx.2.1-dev
Linux Build Service Account [Thu, 1 Sep 2016 17:11:44 +0000 (10:11 -0700)]
Merge "Bluetooth: Enable backtrace for malloc and free functions" into bt.lnx.2.1-dev

7 years agoBluetooth: KW fix for gatt test tool memory failure
Satish kumar sugasi [Thu, 10 Sep 2015 22:00:31 +0000 (15:00 -0700)]
Bluetooth: KW fix for gatt test tool memory failure

This change takes care of NULL pointer deferencing issue by checking
memory allocation for new job process succeed before copying new
command argument passed.

Change-Id: I6160ae04c1905645e9624bf4ecc3a7c945e3bb20

7 years agoGAP : Host sends neg link key for headset reconnection
Venkata Jagadeesh Garaga [Fri, 12 Aug 2016 10:01:00 +0000 (15:31 +0530)]
GAP : Host sends neg link key for headset reconnection

Use case: Stack sending neg link key for headset reconnection while 6 ACL
already connected

Precondition:
=============
- Turn ON DUT
- Pair and connect with 6 BLE devices

Step by Step procedure:
=======================
- Pair and connect with SHB9100WT headset
- Play A2DP music and listen A2DP audio over headset
- Turn Off headset and turn On
- Repeat above 2 steps 2 - 3 times

Failure: Host sending negative linkkey even linkkey present in config file as
peer device security flags reset during acl disconnection.

Root Cause: During acl disconnection,array out of index memory accessed
in memcpy.Due to corrupted flag peer device security flags reset abd host
sending negative linkkey for next acl connection.

Change-Id: I25ae78d7f5f85043943ed752d54dc2fee40c4fa6
CRs-Fixed: 1059275

7 years agoMerge "Allow full dev consolidation after pairing" into bt.lnx.2.1-dev
Linux Build Service Account [Wed, 31 Aug 2016 01:49:59 +0000 (18:49 -0700)]
Merge "Allow full dev consolidation after pairing" into bt.lnx.2.1-dev

7 years agoMerge "Bluetooth: Notify BT APP about alias as the name if present" into bt.lnx.2...
Linux Build Service Account [Wed, 31 Aug 2016 01:49:24 +0000 (18:49 -0700)]
Merge "Bluetooth: Notify BT APP about alias as the name if present" into bt.lnx.2.1-dev

7 years agoJust clear IB_CFG_DONE on receiving Peer config request when channel open
Mingbo Zhang [Tue, 23 Aug 2016 02:28:26 +0000 (10:28 +0800)]
Just clear IB_CFG_DONE on receiving Peer config request when channel open

In current codes, while l2cap channel has been configured and in
CST_OPEN state, if local receives another configure request from
remote, config_done(IB_CFG_DONE and OB_CFG_DONE) will be cleared.
However, OB_CFG_DONE will be never set again. So, from then on,
data can not be transmitted to remote by this channel. To fix
this issue, we should just clear IB_CFG_DONE and keep OB_CFG_DONE
unchanged on receiving Peer config request when channel open

Change-Id: I8deca0c8ff73faafc3da94dcd9ea55e06bd8a31d
CRs-Fixed: 1059193

7 years agoMerge "Set HF indicators bit only when remote supports it." into bt.lnx.2.1-dev
Linux Build Service Account [Tue, 30 Aug 2016 07:17:20 +0000 (00:17 -0700)]
Merge "Set HF indicators bit only when remote supports it." into bt.lnx.2.1-dev

7 years agoMerge "Fixes for Errors reported by static analysis tool." into bt.lnx.2.1-dev
Linux Build Service Account [Tue, 30 Aug 2016 06:56:41 +0000 (23:56 -0700)]
Merge "Fixes for Errors reported by static analysis tool." into bt.lnx.2.1-dev

7 years agoMerge "BT: Enable SoC logging through developer option" into bt.lnx.2.1-dev
Linux Build Service Account [Mon, 29 Aug 2016 15:13:34 +0000 (08:13 -0700)]
Merge "BT: Enable SoC logging through developer option" into bt.lnx.2.1-dev

7 years agoFixes for Errors reported by static analysis tool.
Satheesh Kumar Pallemoni [Thu, 18 Aug 2016 09:18:31 +0000 (14:48 +0530)]
Fixes for Errors reported by static analysis tool.

Fixes for Errors reported by static analysis tool.

CRs-Fixed: 1056776
Change-Id: I4c5188c477784e34d531d33b81ce8f443626d61f

7 years agoSet HF indicators bit only when remote supports it.
Satheesh Kumar Pallemoni [Fri, 19 Aug 2016 10:10:50 +0000 (15:40 +0530)]
Set HF indicators bit only when remote supports it.

If remote HFP version is 1.7 and sets HF indicators
bit in BRSF flag, don't unset HF indicators bit in
AG's BRSF flag.

CRs-Fixed: 1056813
Change-Id: Ia5df7eb3909ad773048b59686b17bc377bf35abf

7 years agoMerge "A2dp: Fix for audio loss with remote device initiated connection" into bt...
Linux Build Service Account [Mon, 29 Aug 2016 03:48:08 +0000 (20:48 -0700)]
Merge "A2dp: Fix for audio loss with remote device initiated connection" into bt.lnx.2.1-dev

7 years agoMerge "Bluetooth: HDP: Synchronize hl data operations" into bt.lnx.2.1-dev
Linux Build Service Account [Mon, 29 Aug 2016 03:48:08 +0000 (20:48 -0700)]
Merge "Bluetooth: HDP: Synchronize hl data operations" into bt.lnx.2.1-dev

7 years agoMerge "A2DP: KW fix" into bt.lnx.2.1-dev
Linux Build Service Account [Mon, 29 Aug 2016 03:48:08 +0000 (20:48 -0700)]
Merge "A2DP: KW fix" into bt.lnx.2.1-dev

7 years agoAllow full dev consolidation after pairing
Nitin Arora [Sat, 13 Aug 2016 00:48:11 +0000 (17:48 -0700)]
Allow full dev consolidation after pairing

When BR/EDR and LE RPA device records are present
in the device records and the same remote device is
paired on a new RPA, the device consolidation happens
after the IRK is received. The current consolidation
breaks out of the loop after consolidating one device
record. In such cases, BR dev record is left and when
BR link key is derived, it gets updated in a separate
device record. Since two device records are present at
the same time for the same remote, the keys and static
addresses get picked up from incorrect node and issues
such as "remove device from resolving list seen with {0}
static address" are seen.

The fix includes allowing the host to complete
the consolidation for all device records rather than
breaking at the fist match.

CRs-Fixed: 1056433
Change-Id: Ib0bf2e4029e448670ee44f63110e5332aa972580

7 years agoBluetooth: Enable backtrace for malloc and free functions
Kamal Negi [Thu, 25 Aug 2016 06:27:58 +0000 (11:57 +0530)]
Bluetooth: Enable backtrace for malloc and free functions

Printing caller address of osi malloc and free functions to debug.

CRs-Fixed: 1056804
Change-Id: I7f5c4e8f7734821513cb97394d227cf66000a463

7 years agoBT: Enable SoC logging through developer option
Matadeen Mishra [Fri, 12 Aug 2016 10:23:29 +0000 (15:53 +0530)]
BT: Enable SoC logging through developer option

Enable/Disable SoC Logging through developer option.

SoC Logging enable/disable only for Pronto device.

Change-Id: I7193d085a1de4aa1e4b0ed6ec16a4812c8dc70b5
CRs-Fixed: 1057493

7 years agoBluetooth: Notify BT APP about alias as the name if present
Matadeen Mishra [Thu, 7 Nov 2013 15:05:39 +0000 (20:35 +0530)]
Bluetooth: Notify BT APP about alias as the name if present

While scanning notify the Bluetooth APP about the alias name
as the actual device name of snanned device if alias name is
present.

CRs-Fixed: 1055177
Change-Id: Id8a093b1503eb3f308f466f30c1a4a6f4c250594

7 years agoHID: Prevent sending output report if not changed.
Hemant Gupta [Fri, 19 Aug 2016 11:41:09 +0000 (17:11 +0530)]
HID: Prevent sending output report if not changed.

Usecase:
1) Connect BT HID Keyboard with DUT and remove USB cable.
2) Turn off LCD display of DUT and wait for DUT to suspend.

Observation:
DUT does not suspend, and higher current drain on BT chip is
observed.

Root Cause:
Kernel Input driver sends LED output report to connected HID Keyboard
on every device resume from suspend. If for some reason suspend fails
(some other task is pending), kernel aborts suspenson and resumes device
drivers, which calls the callback of resume in corresponding device
drivers. This results in kernel sending output LED report to HID over BT,
which in turn sends the data over UART to BT SoC. Now if kernel tries to
suspend, it fails as UART is busy, so it resumes again, therebyu sending
same LED output report to BT thereby making a continous loop of sending
output report preventing BT SoC from sleeping and resulting in higher
current drain.

Fix:
In user space BT code, add check to prevent sending output report to remote
device if the content of report is same as previous data sent out to same
remote device. This will ensure that output report is sent to remote device
only once (if no change in conent of report), and will ensure that kernel can
suspend the device without errors as UART will not be busy.

Change-Id: I9759e5e567b6ebe06e5660539881ba827b15fb1f
CRs-Fixed: 1056709

7 years agoA2dp: Fix for audio loss with remote device initiated connection
pramod kotreshappa [Thu, 11 Aug 2016 03:42:08 +0000 (20:42 -0700)]
A2dp: Fix for audio loss with remote device initiated connection

Mark all SEPs of corresponding stream control block to busy if
one of the SEP is in use to avoid incoming connection trying to
connect to SEP of the stream control block which is already in
open state with active connection.

Change-Id: I819281c57c03f60619b488df1dbd92c8598aec68

7 years agoBluetooth: HDP: Synchronize hl data operations
Venkata Jagadeesh [Tue, 31 May 2016 11:20:10 +0000 (16:50 +0530)]
Bluetooth: HDP: Synchronize hl data operations

Validate Tx packet before memcpy as it can be free
from different thread

Handled hl data cfm in error conditions

Change-Id: I566f62ce02c8e95c9f4b8d7155132e4434657f66
CRs-Fixed: 1043930

7 years agoA2DP: KW fix
pramod kotreshappa [Wed, 24 Aug 2016 22:38:54 +0000 (15:38 -0700)]
A2DP: KW fix

Check keyval ptr is not equal to null to process out set param
keyvalue pair.

Change-Id: I52a6dd15fa00a85937a2c0eb8e484c393fedee92

7 years agoBluetooth: Including vendor HAL directory path for wearables
Manu Viswanadhan [Fri, 19 Aug 2016 11:13:57 +0000 (16:43 +0530)]
Bluetooth: Including vendor HAL directory path for wearables

Including vendor HAL directory path for wearables

Change-Id: I7e310bd08b5c75f4cd532d2feb2eea3635cd9a0d
CRs-Fixed: 1056850

7 years agoA2DP: Multiple Split-A2dp fixes
pramod kotreshappa [Thu, 28 Jul 2016 05:56:21 +0000 (22:56 -0700)]
A2DP: Multiple Split-A2dp fixes

- Sanity check ctrl fd is valid, if the output stream was not
closed previously and audio hal is trying to start stream.
- Ack back stream suspend ctrl command from the hal immediately
during device disconnect is initiated during streaming to avoid
delay in device disconnection.
- If stream start is requested from audio hal and disconnect is
initiated at the same time, check for ctrl cmd pending for ack.
- Increase stream start retry timeout to 8sec to address IOT
issue in soft handoff scenario.

Change-Id: I39c1963cb2ecedd568b4e8b67b2df891d8f9f5bf

7 years agoProper state transition for disconnect during connection setup
Ayan Ghosh [Fri, 8 Jul 2016 07:27:38 +0000 (12:57 +0530)]
Proper state transition for disconnect during connection setup

 - Ensure BTA AV correctly moves to init state when remote tears
   down the AV connection and ACL during incoming connection setup.
 - Properly set collision flags for handling AV connection collision.

CRs-Fixed: 1052672

Change-Id: I30cecf2cbf2cd4a21b243230e81ced80ae773db5

7 years agoFix for SS Level U headset not connecting
Umesh Vats [Tue, 9 Aug 2016 18:52:48 +0000 (11:52 -0700)]
Fix for SS Level U headset not connecting

Added the changes to do proper comparison of the codec configuration
based on codec selected by the remote headset

CRs-Fixed: 1052332

Change-Id: I078f07b39ab61ea2755333f0d94afe9efaf86c85

7 years agoDo SDP when HSP connection opened by remote.
Satheesh Kumar Pallemoni [Thu, 4 Aug 2016 12:14:11 +0000 (17:44 +0530)]
Do SDP when HSP connection opened by remote.

When HSP connection opened by Remote do SDP, So that AG could find out
whether remote supports remote volume control feature.

CRs-Fixed: 1052230
Change-Id: I6441142fcdebcd9f2b652f90e0d8d592dea3db3d

7 years agoAllow second A2dp connection when SCO exists with first
Ayan Ghosh [Mon, 25 Jul 2016 12:39:15 +0000 (18:09 +0530)]
Allow second A2dp connection when SCO exists with first

Allow A2dp connection with second device even when there is
an ongoing SCO with first and role switch fails.

CRs-Fixed: 1048629
Change-Id: Iacc2a8a3f53f497b8e00d8641b53a218c5a74589

7 years agoInitiate Reconfig if DUT preferred config not chosen
Ayan Ghosh [Mon, 20 Jun 2016 10:34:37 +0000 (16:04 +0530)]
Initiate Reconfig if DUT preferred config not chosen

 - Add all mandatory capabilities to DUT supported config list.
 - On peer device initiated AV Setconfig if peer chooses
   any config other than DUT preferred one then trigger AV
   Reconfig to override remote chosen config.

CRs-Fixed: 1043899

Change-Id: I6c89c4fb6f87be967c280c8c1c422e250bf91ae3

7 years agoBluetooth: Increase profile connection timeout
Nitin Arora [Fri, 5 Aug 2016 00:39:01 +0000 (17:39 -0700)]
Bluetooth: Increase profile connection timeout

This change increases the timeout after the gatt
discovery complete from 1 sec to 5 sec.
For profiles such as HOGP, the profile level gatt connections
after the discovery complete callbacks sometime take more time,
due to which the "no app timeout" disconnects the physical link.
This change will hold the gatt connection used for remote discovery,
for 5 seconds, after the discovery is complete, and thus provide
sufficient time for the profile level connections to kick in.

CRs-Fixed: 1050047
Change-Id: I8f3c3ad162e3dadeb0e3215bf9fe6a20e4d9c425

7 years agoSometimes BT settings UI shows wrong name for a paired device
Umesh Vats [Fri, 22 Jul 2016 19:34:08 +0000 (12:34 -0700)]
Sometimes BT settings UI shows wrong name for a paired device

This patch includes changes to use BTM_SecReadDevName instead of
bta_dm_get_remname() for getting the remote device name during
BTM_LE_NC_REQ_EVT (SMP Numeric comparison request event).
bta_dm_get_remname() relies on the global variable
bta_dm_search_cb.peer_name. This variable can have name of the
legacy device inquired earlier. Now if an LE device is paired,
during numeric comparison request event, the older remote
name stored in bta_dm_search_cb.peer_name is used and gets
stored when the LE device is pairing

Change-Id: I0e02ed262ac111c074e0a4a8b29e84a57e41faf1
CRs-Fixed: 1045318

7 years agoBluetooth: Add logic to cancel link timeout alarm
Nitin Arora [Mon, 25 Jul 2016 18:33:19 +0000 (11:33 -0700)]
Bluetooth: Add logic to cancel link timeout alarm

Issue:
Post bonding process, temporary gatt connections are
created to perform device name discovery and remote
device discovery before any profile level connections
are made for remote devices. At every disconnection
the number of apps holding the physical link is validated
to keep the link alive. A disconnection starts the idle
timeout of 1sec if there is no other apps available.
However, a new logical connection is unable to reset
the timer, even if the link comes up, within 1sec of
the last disconnection.

Fix:
At every connection occuring within the "No app timeout",
the link timer is cancelled since there is still a gatt_if
that needs to keep the link alive.

CRs-Fixed: 1050047
Change-Id: I3205894e4d692e4e8b1a547b6fb4d346c4f281a5

7 years agoBT: Fix hardware error detection failure for Pronto devices.
Gurpreet Ghai [Tue, 2 Aug 2016 10:23:33 +0000 (15:53 +0530)]
BT: Fix hardware error detection failure for Pronto devices.

Issue: Hardware error detection failure during scenario which
include enforced ssr.

Cause: Due to incorrect condition, the function that checks
for hardware reset bit was not called.

Measure: Applied the correct check so that hardware reset is
detected in pronto devices.

Change-Id: Ie6cea5fc2b33956d01911910fcc97f8c4b4b6669

7 years agoBT: Remove Btsnoop_dump from system/bt as tool is disable
Matadeen Mishra [Tue, 2 Aug 2016 10:30:22 +0000 (16:00 +0530)]
BT: Remove Btsnoop_dump from system/bt as tool is disable

Remove Btsnoop_dump directory from system/bt.

Change-Id: I6dea2c9d87926aa1a8d77682c970462c20026d18
CRs-Fixed: 1049200

7 years agoA2DP: Split A2DP Extension
pramod kotreshappa [Tue, 10 May 2016 06:44:35 +0000 (23:44 -0700)]
A2DP: Split A2DP Extension

Split A2dp extended feature enables a2dp encoding offloaded to
LPASS. Codec info is provided to audio module via BT IPC library
to instatiate encoder session in LPASS. Remote headset codec info
is provided to BT SoC to encapsulate avdtp and l2cap header to
encoded audio data from DSP module.

Change-Id: I4dede32c7510dc6e95555d56d1066a0f9bfdf860

7 years agoA2DP: New BT IPC library
pramod kotreshappa [Thu, 31 Mar 2016 21:34:20 +0000 (14:34 -0700)]
A2DP: New BT IPC library

New BT IPC library that facilitates communication betwee audio hal
and BT host. Bthost-ipc library will be loaded by audio primary
hal in Split A2dp scenario to communicate with bt host and in
legacy non-split a2dp scenario this library will be loaded by
a2dp hal.

Change-Id: Ie11d88b27662c97a00ac9d484ae9c621293949e8

7 years agoMisc Split A2dp changes.
Ayan Ghosh [Thu, 3 Dec 2015 13:55:53 +0000 (19:25 +0530)]
Misc Split A2dp changes.

 - Disconnect A2dp if any of the vendor specific command
fails to start Split A2dp in controller.
 - Send mesaages to media task command queue only if
queue exists.
 - Proper handling of Remote Suspend and Start.

Change-Id: I0498487d4d54b8c793e439f777e38343f89a5c9d

7 years agoSplit A2dp implementation
Ayan Ghosh [Wed, 7 Oct 2015 13:04:50 +0000 (18:34 +0530)]
Split A2dp implementation

Implement Split A2dp to process AVDTP Signalling commands
from host and media packet handling from Controller.
Host uses vendor specific commands to let controller know
the media channel configurations for controller to form
the media packets accordingly.

Change-Id: I7a98177a8125fd70b057bb514f0d870971a45bcf

7 years agoFix display of GATT cache server attributes
Subramanian Srinivasan [Thu, 28 Jul 2016 20:11:34 +0000 (13:11 -0700)]
Fix display of GATT cache server attributes

Fix the display of GATT cache server attributes by
making use of the new GATT attribute data structures
when BTA_GATT_DEBUG is enabled.

CRs-fixed: 1047756

Change-Id: If5bbbde5b43c4e82ab4fa772c1a16e99b839ccd5

7 years agoBluetooth: Introduced new HAL directory for VS interface
Manu Viswanadhan [Tue, 12 Jul 2016 12:46:51 +0000 (18:16 +0530)]
Bluetooth: Introduced new HAL directory for VS interface

Introduced new HAL directory for all vendor specific interface
implementations. This helps in keeping original HAL untouched
with respect to vendor specific changes. The new directory will
be used for all vendor specific API calls.

CRs-Fixed: 1047009
Change-Id: I99a4b55f645a9719fca535ee659757c55e9211e8

7 years agoDo AV registration for different roles in proper way
Ayan Ghosh [Tue, 12 Jul 2016 10:36:49 +0000 (16:06 +0530)]
Do AV registration for different roles in proper way

For multiple codec (SBC, APTx) and multiple role (SRC, SNK) enabled
environment make sure registration of individual AV endpoints are
done in a way that enabling different roles for differnt codecs does
not affect other codecs or roles.

CRs-Fixed: 1042243
Change-Id: I03e05eef7d9bf669c6600630afcb507bb52bd5a7

7 years agoBluetooth : GAP : Dont initiate role switch for blacklisted remotes
venkata Jagadeesh [Tue, 12 Jul 2016 13:48:12 +0000 (19:18 +0530)]
Bluetooth : GAP : Dont initiate role switch for blacklisted remotes

Don't initiate role switch for blacklisted remotes from DUT
as some remotes always rejects role switch and role swicth retrails from
DUT may lead to a2dp glitches or random disconnections

Change-Id: If0c5212e38ab16a16b6fda35b15b160f89f7f297
CRs-Fixed: 1040611

7 years agoMove aptX config parse to main code from the library
Umesh Vats [Mon, 25 Jul 2016 18:19:25 +0000 (11:19 -0700)]
Move aptX config parse to main code from the library

For aptX offload feature, aptX config parsing and caps check
functions need to be included in open source

Change-Id: If31864374a3fa04720b03637c3dfb492f2cfacd1
CRs-Fixed: 1046053

7 years agoFix for error reported by Static analysis tool
Matadeen Mishra [Thu, 21 Jul 2016 11:21:07 +0000 (16:51 +0530)]
Fix for error reported by Static analysis tool

- Fix Array Index Out of Bounds Exceptions
    in the fludroid code space of Bluetooth.

Change-Id: If6d2c208e12a3e71ecd9d4d375ef6f8b81e17532
CRs-Fixed: 1044013

7 years agoPBAP: Add support for SIM phonebook in SDP
Hemant Gupta [Wed, 15 Jul 2015 09:38:29 +0000 (15:08 +0530)]
PBAP: Add support for SIM phonebook in SDP

This change will add SIM phonebook service support
in SDP registeration.

Change-Id: I1315a9031e66bc091a9d3d2721182e843e35e2cd
CRs-Fixed: 509165

7 years agoBluetooth: LE Stack certification tool changes
Satish kumar sugasi [Fri, 10 Apr 2015 19:46:02 +0000 (12:46 -0700)]
Bluetooth: LE Stack certification  tool changes

This includes changes needed for new code baseline
and below stashed commits.

Bluetooth stack 4.0/4.1 certification tool changes

This adds test application code and stack interface
code for BLE certification purpose

CRs-fixed: 649248
Change-Id: I6e8ecbf2fdb0fe6ee80fd6d57c2e151b62797f01

Bluetooth: Avoid Encryption after gatt server connection complete.

This doesn't start encrtyption by default after connecting to a client.
needed for certain test cases of BLE stack certification.

Change-Id: I04dbe1daba32b416f59fed00989168507ce261fa
CRs-Fixed: 652485

Bluetooth: add config flag to gatt tool test app

This adds logic to compile gatt tool only if config test flag
is enabled and aincludes indendation changes

Change-Id: If018d0676bb6334be0558fd6f6464ffbfc33196a

Bluetooth: Gatt tool changes and code cleanup

Fixes for compilation issues and remove CONFIG
flag from makefile.

Change-Id: I57646edf9b0ec3ffd62e34aeed54f13ef09ef1a0

Bluetooth: Include Gatt test app for certification

This adds debug and optional flags to makefile to compile tool
as part of android build

Change-Id: I603a982a4bc7c392e45e753bcbb57bf8394ed21c

Bluetooth: Add gatt refresh api in gatt certification tool

this fixes gatt tool crash during service discovery test cases
and code cleanup.
CRs-Fixed: 734268
Change-Id: I7e600d912c0b631b3bc865c571f9ad1c05f99ae4

Bluetooth: Add conn update api for gatt tool

This adds support to do LE connection parameters update after
successful connection using Gatt test app for certification

CRs-Fixed: 743373
Change-Id: Id76d244f6bf7721016ef397c8bfea9cd877b0253

Bluetooth: Gatt tool change for wakelock support and cleanup

This change does send hci success status for wakelock apis which
are newly added in BT.Also does remove tabs and proper indentation

CRs-Fixed: 743399
Change-Id: I9346c3a04e4c7238cd5afaabb0361f7083cb93fe

Supports Simple pairing with No bonding and no MITM

Supports Bluetooth simple pairing with no MITM,
no bonding set in the authentication request and
initiator and responder keys set to 0.

Change-Id: I6e8ecbf2fdb0fe6ee80fd6d57c2e151b62797f01

Conflicts:
main/Android.mk

Change-Id: I36eba14defe16418037ba4b253d31c9a6270d93c

7 years agoBT: Adding check for hci_layer status before processing func calls
Gurpreet Ghai [Thu, 4 Feb 2016 14:40:03 +0000 (20:10 +0530)]
BT: Adding check for hci_layer status before processing func calls

When hci_layer functions for transmit command and cleanup
are called during hci_layer shutdown, they might try to
access lists that are already cleared as part of shutdown
process. This causes issues during BT turn off.

Added check within such functions to check for hci_layer
state before processing.

Change-Id: I8dbca9893e03dfc500886c5033a79976dc5d23e1

Bluetooth: Process data only after cmd cmpl for reset

- Process incoming event/ACL packet only after command
  complete event received for reset command.

- Otherwise there might be a chance of receving other
  events though the controller module is not ready,
  as part of processing events, accessing the controller
  module capabilities leads to crash.

Change-Id: Id4b1d207fd237d56c95c7af801fc25d8c05808df

BT: Adding check for hci_layer state before dispatching event

During Bluetooth disable process, alarms and command lists
are reset causing race condition because pending commands
and packets are still present in the list and reactor still
runing. So, adding check for hci layer state before processing
events of command and packet ready.

Change-Id: Ib10a2caa7a9e4739088d5192208fb4f97f3e4bbf
CRs-Fixed: 1022151

7 years agoAG: Set/Unset HF indicator bit based on remote device
Satheesh Kumar Pallemoni [Tue, 19 Jul 2016 06:23:39 +0000 (11:53 +0530)]
AG: Set/Unset HF indicator bit based on remote device

For HFP 1.6 or below remote devices, we don't set HF indicators,
S4 settings bit in BRSF in the current implementation. For HFP 1.7
remote devices, if remote does not set HF indicators bit, unset
HF indicators bit in AG's BRSF.

CRs-Fixed: 1042926
Change-Id: I24844ffd7c045cd5b19f554d78470db27bcb9f1c

7 years agoBluetooth: Fix for aptX media thread cleanup crash
Umesh Vats [Thu, 21 Jul 2016 18:19:39 +0000 (11:19 -0700)]
Bluetooth: Fix for aptX media thread cleanup crash

Changes added to stop aptX scheduler thread before media
thread cleanup happens.

Change-Id: I1988ea3c6b0a560d7028769307ed25e6876ac4dc
CRs-Fixed: 1041402

7 years agoHandle service discovery states properly when server cache state is LOAD
Subramanian Srinivasan [Thu, 21 Jul 2016 23:15:15 +0000 (16:15 -0700)]
Handle service discovery states properly when server cache state is LOAD

When the BT stack's server cache state is BTA_GATTC_SERV_LOAD while
performing GATT service discovery, the stack does not issue a proper
GATT_Disconnect after the completion of Gatt discovery procedure.
Also the p_clcb state is moved to BTA_GATTC_DISCOVER_ST state for
conn_id 5.

When p_clcb state is moved to BTA_GATTC_DISCOVER_ST, it implies that
service discovery is in progress in BT stack. In this scenario, when
GATT operation requests like GATT Read, GATT Write, etc are received
by BT stack from upper layers, the BTA layer state machine
(bta_gattc_sm_execute) queues up these GATT operations instead of
executing these GATT operations immediately.

The queued up GATT operations are generally executed after the service
discovery procedure is completed. In this case, the queued up GATT
operations never get executed since the GATT discovery procedure does
not get completed properly and hence the GATT operations fail.

This change cleans up the pending GATT connects for service discovery
when the server cache state is BTA_GATTC_SERV_LOAD and also resets the
discovery state. This would allow other GATT operations to get executed
by BT stack.

Change-Id: If2a25d45e2f37d1092752d4d6184540a4768c771

7 years agoSynchronize RPA completion callback and cleanup
Rupesh Tatiya [Thu, 30 Jun 2016 15:07:22 +0000 (20:37 +0530)]
Synchronize RPA completion callback and cleanup

There is a cleanup API which can free memory for btm_multi_adv_cb while
RPA completion callback API might be using this memory for processing.
Protect btm_multi_adv_cb resource across these two functions.

CRs-Fixed: 1036742
Change-Id: I5872b0a1ff1765b0f6c4e45e3d32551c03532393

7 years agoBluetooth: KW fixes in btif_rc.c
Umesh Vats [Sat, 16 Jul 2016 01:00:17 +0000 (18:00 -0700)]
Bluetooth: KW fixes in btif_rc.c

Check on index introduced.

Change-Id: Id7ff430a16cade1512e0cabef3c694c80a10b0b0
CRs-Fixed: 1042595

7 years agoBluetooth : Handled Cert tools new timer permissio issue
venkata Jagadeesh [Mon, 11 Apr 2016 14:28:54 +0000 (19:58 +0530)]
Bluetooth : Handled Cert tools new timer permissio issue

Cert tools new timer permission issue resloved.

Change-Id: I775807c07cafc326d5aae736bdcba677abc1bcfc
CRs-Fixed: 1042284

7 years agoProcess Gatt read multiple response properly
Subramanian Srinivasan [Mon, 16 May 2016 18:14:03 +0000 (11:14 -0700)]
Process Gatt read multiple response properly

The Gatt server multi response queue is made NULL after each Gatt
server response is sent by BT stack in response to the remote Gatt
client's request. But the multi response queue is not initialized
again to process subsequent read multiple Gatt server responses.
Hence, the BT stack does not send Gatt server responses for the
subsequent read multiple requests from remote device which inturn
leads to disconnection. This change would process read multiple
responses by initializing the queue when it is null.

Some of Bluetooth certification test cases involve testing
Gatt server's capability to process and send read multiple
response.

Test case: TC_GAR_SR_BV_05_C

This change also cleans up unnecessary initialization and freeing
of multi rsp queue. This change makes sure that the stack initializes
multi rsp queue only when it is necessary(ie only when the Gatt
multiple read response is being processed).

CRs-fixed: 1038422

Change-Id: Ia3e2e1569ee16cac9c518f95501945257b9fb7fd

7 years agoBluetooth: GAP: Allow only one pairing from btif layer at one time
Srinu Jella [Mon, 10 Nov 2014 13:00:26 +0000 (18:30 +0530)]
Bluetooth: GAP: Allow only one pairing from btif layer at one time

This patch prevents any new pairing request from some other remote
device if pairing has been initiated with a particular remote
device.

CRs-Fixed: 1041642
Change-Id: Id17e3f90904d2c53f1466a72253a25a38d753138

7 years agoBluetooth: GAP: Update UUIDs immediately on NVRAM
Matadeen Mishra [Thu, 14 Jul 2016 10:34:05 +0000 (16:04 +0530)]
Bluetooth: GAP: Update UUIDs immediately on NVRAM

As the new bt-if config updation have delay in writing items
to the NVRAM, some times there is a chance of not updating
incase of battery removal happens before the actual write onto
NVRAM.
As SDP UUIDs is important data to store, it will update
immediately onto NVRAM.

Change-Id: I6637dc326f3a53211a5bbf988a2dca1020203128
CRs-Fixed: 1041642

7 years agoBluetooth: Read BLE vendor capability to proceed on Secure conn
Srinu Jella [Mon, 24 Aug 2015 15:30:28 +0000 (21:00 +0530)]
Bluetooth: Read BLE vendor capability to proceed on Secure conn

- Read BLE vendor capability to proceed on enablement of
  secure connection support from Host.

- If BLE vendor capability is supported from the controller
  then secure connection is enabled from Host.

CRs-Fixed: 1041642
Change-Id: I64e79d4e6fff7d9f1b0ea7272250e8155f5888e2

7 years agoHandled invalid MTU Size in L2cap Process Commands
Ajay Kumar [Wed, 12 Mar 2014 13:59:27 +0000 (19:29 +0530)]
Handled invalid MTU Size in L2cap Process Commands

Use case: Execute the L2cap test suite on Codenomicon tool

(1)From tool Codenomicon Defensics 11 menu Utilities > Bluetooth Scan, paired Bluetooth between pc and phone.
(2)From Defensics 11 Settings ,choose paired phone Bluetooth to be Target Bluetooth device address in Basic configuration.
(3)Run the test case " Security - l2cap ".
(4)When run to the number 28, 29 test case,check the phone.BT turn off and turn on automatcially

Failure: BT crash observed due to invalid MTU packets from test tool

Root cause: L2cap is not validating packets in L2cap Process Commands

Fix: Fixed by sending reject cmd for invalid commands from tool

Change-Id: I8c503ab77d8fca3728a84c3457d8115e31ee3a13
CRs-Fixed: 1041625

7 years agoRFCOMM: Add state check to prevent assert
Srinu Jella [Mon, 7 Sep 2015 08:10:07 +0000 (13:40 +0530)]
RFCOMM: Add state check to prevent assert

This patch adds state check in bta_jv_rfcomm_write, to prevent sending
data in BTA_JV_ST_NONE state. This would prevent ASSERT in code due to
null handle, as handle might have already been set to null during previous
closing of rfcomm connection.

CRs-Fixed: 1041625
Change-Id: Ibc6b1fb7aa6dce9a4acb52d724af3023fad9a9ae

7 years agoBluetooth: Implement hardware error timer for command timeout case
Gurpreet Ghai [Fri, 24 Jun 2016 13:56:56 +0000 (19:26 +0530)]
Bluetooth: Implement hardware error timer for command timeout case

Root cause: As part of command timeout, ssr cleanup is initiated
and a special buffer is sent from the filter to SOC for intentional
crashing and collection of logs. The time provided before the
killing of stack is not sufficient for the whole dump to be
collected.

Fix: A hardware error timer is created which gets started in the
command timeout case immediately after sending ssr cleanup to the
vendor. The timer will expire after due time to kill the process.

Change-Id: I60cf55c9d4ae4078ee05bca89359de60091b3ba6
CRs-Fixed: 1022533

7 years agoBluetooth: Prevent gatt DB copy if server cache is absent
Nitin Arora [Thu, 14 Jul 2016 01:02:03 +0000 (18:02 -0700)]
Bluetooth: Prevent gatt DB copy if server cache is absent

In case the server cache does not exist for a specific
connection, the API used to copy the server DB into the
DB structure needs to return immediately. This change
makes sure of that and prevents dereferencing of a null
block causing the runtime error.

Change-Id: Iec3040a1280ef9d80b1b9c76eca8071dff499411
CRs-Fixed: 1040951

7 years agoRemoved compilation dependency on proprietary modules for aptX
Umesh Vats [Wed, 13 Jul 2016 17:39:05 +0000 (10:39 -0700)]
Removed compilation dependency on proprietary modules for aptX

This commit takes care of removing compilation dependencies between
platform/system/bt and vendor/qcom/prop../bt/hci_qcomm_init/aptX.
aptX  module in the proprietary projects has been removed

Change-Id: Ibab863be20d7792d7eb187cb5c831a7f4972a19b
CRs-Fixed: 1036566

7 years agoBluetooth: Initial commit for BLE Gatt test tool
Satish kumar sugasi [Thu, 4 Jun 2015 00:23:40 +0000 (17:23 -0700)]
Bluetooth: Initial commit for BLE Gatt test tool

This file was copied from commit 4e6b49a440aff2e5bd31877b8b0d03cf6485bfa0
in platform/external/bluetooth/bluedroid project

Change-Id: I50007f918f750de7ceb29fcc965458c747b0641c

7 years agoBluetooth: Dynamic ACL buffer allocation based on ACL Priority
pramod kotreshappa [Wed, 7 May 2014 04:58:57 +0000 (21:58 -0700)]
Bluetooth: Dynamic ACL buffer allocation based on ACL Priority

1. A2dp acl link priority is set to high once streaming starts
2. Allocation min 2 ACL bufferswq to high priority link

CRs-fixed: 1040557
Change-Id: I8f7742ae193998643ff2a12bf87f9874844ee0f7

7 years agoAdd Remote Device BD address to role switch Blacklist.
Satheesh Kumar Pallemoni [Tue, 28 Jun 2016 11:00:42 +0000 (16:30 +0530)]
Add Remote Device BD address to role switch Blacklist.

When some remote devices acts as a slave role for incoming
connection to DUT, they will not respond to the AVDT signalling
commands properly and go to bad state.In this case role switch
would resolve this issue.

CRs-Fixed: 1035137
Change-Id: Ic1741d96f3409b29ee6ca2280c8ba97e214e9682

7 years agoBluetooth: Handle auth req in bta_dm_pinname_cback
Venkata Jagadeesh [Wed, 1 Jun 2016 09:54:58 +0000 (15:24 +0530)]
Bluetooth: Handle auth req in bta_dm_pinname_cback

As auth_req not handled properly in bta_dm_pinname_cback during
rnr,auth_req reset and DUT going for temperory pairing.

Change-Id: I5efa73c3f8079b5198ff672bd1d59a6ec52ec4f3
CRs-fixed: 1031548

7 years agoBT: Get chipset type dynamically during stack initialization
Manu Viswanadhan [Wed, 29 Jun 2016 11:32:20 +0000 (17:02 +0530)]
BT: Get chipset type dynamically during stack initialization

Get chipset type dynamically on the basis of qcom.bluetooth.soc
property during stack initialization. This helps in avoiding
compile time board configuration feature flags.

CRs-Fixed: 1035866

Change-Id: I65602b913c052633ec5627598a97ae85a29756f7

7 years agoSynchronize vendor callback and cleanup
Rupesh Tatiya [Wed, 22 Jun 2016 12:49:50 +0000 (18:19 +0530)]
Synchronize vendor callback and cleanup

There is a cleanup API which can free memory for btm_multi_adv_cb while
vendor callback API might be using this memory for processing. Protect
btm_multi_adv_cb resources across these two functions.

CRs-Fixed: 1028704
Change-Id: If2a6a7bd43bbaa629d2b3b3a9e825edcebb6f6fd

7 years agoBluedroid: Fixed Static Analysis Issues
Matadeen Mishra [Tue, 18 Aug 2015 08:01:42 +0000 (13:31 +0530)]
Bluedroid: Fixed Static Analysis Issues

  - This fix avoids NULL pointer dereferences
    and Array Index Out of Bounds Exceptions
    in the bluedroid code space of Bluetooth.

Change-Id: I6ad9f4518896975ff186b41086a8987c7de1eb91
CRs-Fixed: 890309

7 years agoBluetooth: GAP: Serialize the commands during Pairing process
Srinu Jella [Wed, 18 Dec 2013 06:27:33 +0000 (11:57 +0530)]
Bluetooth: GAP: Serialize the commands during Pairing process

Serialize the Remote version, Remote features, Authentication
requested commands.

This will make sure the above commands doesn't go simultaneously
to the remote device which can't handle the multiple comands
at a time.

Change-Id: I4448c291a60ee637dc5927806547e67f26571d86
CRs-Fixed: 896888

7 years agoBluetooth: SDP: Syncronize sdp callback functions
Venkata Jagadeesh [Tue, 21 Jun 2016 10:28:29 +0000 (15:58 +0530)]
Bluetooth: SDP: Syncronize sdp callback functions

Syncronize sdp callback functions in sdp server to
avoid race conditions in create/remove sdp records

CRs-Fixed: 1003295
Change-Id: Idb7a3e0a011c8ecd0d127d110e67e6a9a13a8ee9

7 years agoHID: Re-enable sniff with specific parameters to prevent LAGS
Hemant Gupta [Fri, 24 Jun 2016 14:25:52 +0000 (19:55 +0530)]
HID: Re-enable sniff with specific parameters to prevent LAGS

Usecase:
1. DUT Connected to BT Headset and MAgic Mouse
2. Make an outgoing call from DUT
3. Perform inquiry on DUT and check mouse movements.
4. Disconnect call from DUT/remote end.
5. Check Mouse Movements

Expected Result:
No lags should be seen with Mouse after call is disconnected.

Observed Results:
Lags are observed with Mouse after Call is disconnected.

Root Cause:
Remote BT Hid Mouse is not able to work with larger sniff parameters
so does not send Input reports leading to lags on DUT.

Fix:
Update sniff parameters to lower values (<15 ms interval) after call is
disconnected so that remote device works fine. Also as part
of SoC workaround, sniff should be disabled with blacklisted devices
only when DUT is slave on SCO link.

CRs-Fixed: 1039149
Change-Id: Ifa01abcae59b6f87842a763330b3a9f23511a675

7 years agoHF CLIENT: Change to disable sniff with specific Phones.
Satheesh Kumar Pallemoni [Fri, 24 Jun 2016 06:17:35 +0000 (11:47 +0530)]
HF CLIENT: Change to disable sniff with specific Phones.

When device is configured as hf client and connected to
AG, if AG goes into sniff, there may be disconnection
of hf connection with AG.We get information of AG's
manufacturer and model information using AT+CGMI
and AT+CGMM commands. We should disable sniff if AG's
model is known to have issues with sniff.

CRs-Fixed: 1021809
Change-Id: Iedfb8cbec7f716aadc83d511127834043eccfd57

7 years agoFixes for Issues reported by Static Analysis tool.
Satheesh Kumar Pallemoni [Fri, 1 Jul 2016 08:50:57 +0000 (14:20 +0530)]
Fixes for Issues reported by Static Analysis tool.

CRs-Fixed: 1036860
Change-Id: I0f4a69cbb4e47ecd333b14c2ff9fe0861166f858

7 years agoBluetooth: Kill the BT process immediately on detecting SSR
Ajay Kumar [Fri, 6 Nov 2015 07:43:42 +0000 (13:13 +0530)]
Bluetooth: Kill the BT process immediately on detecting SSR

Kill the BT process immediately on detecting SSR

CRs-Fixed: 801039
Change-Id: Id5007914140aa26c08579ca85f7622c79d73a00f

7 years agoaptX audio codec support
Umesh Vats [Tue, 21 Jun 2016 21:07:49 +0000 (14:07 -0700)]
aptX audio codec support

Support for a proprietary codec(aptX) based bluetooth audio
streaming   added.

CRs-Fixed: 962515
Change-Id: I821875227e168f9b74571c0ca814e577873b2f88

7 years agoBT: Fixed Static Analysis Issues
Matadeen Mishra [Tue, 7 Jun 2016 12:41:33 +0000 (18:11 +0530)]
BT: Fixed Static Analysis Issues

  - This fix avoids NULL pointer dereferences,
    Array Index Out of Bounds Exceptions
    and Banned funciton in the Fluedroid code
    space of Bluetooth.

Change-Id: If389820b427f39e1030013f14d5538d7c99ce9c6
CRs-Fixed: 1025718

7 years agoBluetooth: Introduced new interface for handling VS implementations
Manu Viswanadhan [Wed, 25 May 2016 06:47:20 +0000 (12:17 +0530)]
Bluetooth: Introduced new interface for handling VS implementations

Introduced new interface for handling vendor specific implementations

Created an API in the vendor interface that initiates SSR cleanup
that will be called in the case of enable and disable timeout.
SSR cleanup is called when the Bluetooth shuts down abruptly.
It sends vendor power OFF to the controller so that the next
startup occurs properly.

Created an API in the vendor interface that will be called while
transitioning from TURNING_OFF to BLE_ON, which cleanup the BREDR
profiles (from the btif layer). A callback is initiated from btif
layer which is redirected by the interface to the original implementation
of stopping the BREDR profiles. Also, since the cleanup for BREDR
profiles in the btif layer already happened during transition to
BLE_ON , the cleanup during BLE_TURNING_OFF to OFF is limited to
BLE profiles.

CRs-Fixed: 1027432

Change-Id: I4c0e8468aa71e1eeee7e81b39e71ad9f711c7a3e

7 years agoMisc AV changes in stack
Sumit Bajpai [Tue, 14 Jun 2016 09:55:37 +0000 (15:25 +0530)]
Misc AV changes in stack

1) Update UI on remote's browsing support.
2) Avoid sending get capability request if Avrcp TG.
3) Use Interop database for Abs vol.
4) Add 30msec uinput delay upon creation.
5) Role switch failure handling.
6) Misc A2dp/Avrcp handling.

CRs-Fixed: 1029888
Change-Id: I2e86285da9e9a0b7c5180fbefeb7665f62ac77cd

7 years agoAVRCP: Fix array index out of bound KW error.
AnubhavGupta [Fri, 3 Jun 2016 08:11:39 +0000 (13:41 +0530)]
AVRCP: Fix array index out of bound KW error.

 - fix array index out of bound KW error.

Change-Id: Id6531852141bcf53dc2132aa106a84179ec008e2

7 years agoFix issues reported by Static analysis tool
Satheesh Kumar Pallemoni [Tue, 7 Jun 2016 10:20:05 +0000 (15:50 +0530)]
Fix issues reported by Static analysis tool

CRs-Fixed: 1025718
Change-Id: Ie1f32028226f4f8e89e545bb75ef1a2a65a3b846

7 years agoEnable Sink with multicast
Venkateshwarlu Domakonda [Wed, 1 Jun 2016 13:28:05 +0000 (18:58 +0530)]
Enable Sink with multicast

Enable support for sink with multicast.

Change-Id: Ie9cb33ba102e585387a908fe821f93520ad8a860

7 years agoAVRCP(T): Add support for AVRCP 1.6
Hemant Gupta [Mon, 24 Aug 2015 11:21:38 +0000 (16:51 +0530)]
AVRCP(T): Add support for AVRCP 1.6

This patch adds supports for following AVRCP 1.6 target features:
    - Get Total Number of Items
    - Cover Art Feature

CRs-Fixed: 715683

AVRCP1.6: Reset Cover Art supported feature bit

Reset Cover Art supported feature bit in SDP record if
fallback to lower version.
Change-Id: I47bdc5dcbc777ba3afb90be1d52b0f6a152dde7b
CRs-Fixed: 956637

Update conf file only if Avrcp 1.5 or 1.6 is enabled

Update conf file only if Avrcp 1.5 or 1.6 is enabled.
CRs-Fixed: 963208

Change-Id: Ib8e81cc57a8060202dbfb2b90b5009f8d504529e

BT-AVRCP: Queue txn labels for same PDU.

If AVRCP CT sends same PDU request multiple times in
quick succession, TG ovewrites the txn label against
that PDU. This causes TG to respond with incorrect
txn labels

Change-Id: I0c9b10f0eb0e7cb695c224d8fe26f5c447ba7d93
CRs-Fixed: 995483

Change-Id: I58ec30ae039f78c59422b5612ebb9ef65a03e2dd

7 years agoCleanup L2CAP socket properly on close
Srinu Jella [Thu, 7 Apr 2016 13:35:44 +0000 (19:05 +0530)]
Cleanup L2CAP socket properly on close

Use case:
1. Sometimes pairing pop up occurs during Android beam
   transfer though it is not required.
2. No OPP Tx request over OBEX if we cancel during file transfer.

Steps:
1. Pair and connect from DUT to remote.
2. Go to gallery and send a file.
3. Accept same file and stop it from remote during transfer.
4. Repeat step 2-4 10 times.

Failure:
OPP Tx should not fail.

Root cause:
Close request was not properly handled from BTIF layer.

Fix:
1. Close the request properly from BTIF layer
   to close the socket variables and instruct the BTA layer
   close from there as well.

2. Clean up L2CAP socket properly on closure to free
   the entry registered with security manager to avoid
   leak in security manager records.

3. Close the socket for all valid handles including handle 0.

Change-Id: I4e37dcd858af258fbd64fbfb2fbf0083bd743e06

Check ccb state before executing channel state machine events

Use Case: When disconnect response is being executed, timeout
occurs and timeout event gets enqueued in BTU process. When
processing of disc event completes, timout event is received
at csm and is executed. However, by this time the Channel
Control Block is already released during previous event causing
errors.

Steps:
Various connection/disconnection scenario.

Failure: If ccb is already released while processing of
previous event, the occurance of new enqueued event causes
crash.

Root cause: Disconnection response event has already released
ccb and set lcb for this channel to null. The occurance of
timer event after this results in crash because lcb is
dereferenced while header creation to send disc response to
peer device.

Fix: Added check for ccb state for whether it is currently in
use or released before executing events in csm.

Change-Id: I9110e6dd5273fa162b51c8aa15bd0030567d664b

Handle L2CAP disconnection on incomplete connection

- Sometimes before even receiving the connection complete
  event from remote device, upper layer might send a
  disconnection on incomplete L2CAP connection, and expects
  notification of connection failure.

- This chnage notifies disconnection confirmation to upper
  layers with error incase L2CAP disconnection is received on
  incomplete L2CAP channel.

Change-Id: I4ab675329b3d791a3f68101495a6e6d90b13bde4

L2cap: Handle invalid HCI packets from Test tool

- Handled Buffer over flow for UINT16
- Handled full packet size more than gki buffer case.
- Discard invalid HCI packets from Codenomican test
  tool as data length and actual data not matching
  during reassembly

Use case: Execute L2CAP test suit from Defensics Codenomican

Steps:
1. Pair and connect DUT to Codenomican tool
2. Execute L2CAP test suit from Defensics Codenomican

Failure: Crash observed on DUT and Codenomican tool stuck in execution.

Root cause: Codenomican tool sending invalid HCI packets to DUT and
there are no checks to handle buffer over flow and other invalid data
from Codenomican tool.

Change-Id: I6f93c80244fc39d607ad285185136bbbca83d7ae

Increasing LE Properties to broadcast.

Use case: Remote BD_NAME is not broadcasted when BLE device
pairing is done by using NFC where we broadcasted only UUID.

steps:
Connect with BLE device by using NFC and check the remote name.

Failure: Remote device name is not available.

Root cause: BD_NAME is not broadcasted when BLE device pairing
is done.

Fix: Added property to broadcast remote BD_NAME also as part
BLE device pairing using NFC.

Change-Id: Ie6cda489aabff15a0ebbc692a16f9428729a7dba

Reset the pairing_cb for BREDR/cross key pairing address

Use case: HID connection stuck during multi pairing.

Steps to reproduce:
precondition:
1 DUT
1 Headset HFP supported -- Pair and Unpair
1 HID mouse -- Pair and Unpair

Steps:
1. Pair and connect HFP remote device HM1700
2. Pair and connect HID remote device Sculpt Touch Mouse
3. Unpair both the remote devices and check them in the available
   devices list in settings app.
4. Initiate HFP connection from remote device HM1700 by
   resetting the headset.
5. Along with above step, initiate HID connection to the mouse from DUT.
   Along with step 5,Power down the HID mouse to avoid another connection.

Failure: At step 5, Observe that HID mouse shows ever connecting state in
the DUT UI.

Root cause: pairing_cb state is reseted for non pairing device and leading
to stuck in pairing to other device.

Fix: Reset the pairing_cb structure for BREDR or cross key pairing address
only. Without this check pairing_cb state can be reset by other non
pairing bd addresses which can lead to stuck in pairing.

Change-Id: I077bebffac9df7a0c7559af58656651467158c14

L2CAP: Allocate sufficient memory for FCS while cloning buffer

Use Case: OPP file transfer using OBEX over L2CAP.

Failure: Crash seen while sending the file using Obex over
L2CAP due to corruption in end canary.

Root Cause: Did not allocate sufficient memory for FCS
while cloning the PDU packet, eventually FCS bytes written
will corrupt the end canary.

Fix: Allocating sufficient memory for the PDU packet which
includes FCS also.

Change-Id: Ie47b9bc07732b02f774d1dce474d488fe063f50b

Don't process pair request when controller is not ready

Use case: when one application is trying to pair and
other application is turning off bluetooth.

Steps: when one application is trying to pair and
other application is turning off bluetooth.

Failure: Bluetooth process crashed.

Root Cause: Bluetooth process crashed due to assertion,
as controller module is not ready.

Fix: Made a checks for controller module is ready or not, If
it is ready then only go for pairing.

Change-Id: I72c72f6b5545c845e79874212359854023ffad98

Add null checks for L2CAP socket callback

Use Case: Bluetooth process crashed while sending the file
to remote device.

Steps: Send a file over L2CAP (OBEX over L2CAP) to remote device

Failure: BT process will crash and restarted automatically

Root Cause: L2CAP socket callback reset to null on error
condition, and when other function try to dereference it, this
leads to BT crash.

Fix: Added null checks for L2CAP socket callback

Change-Id: I2e4f20278fcc8a09bd4dbd507a6c4147e0de93c1

Handled pairing state change in collision scenario

Use case: DUT Stuck in pairing state forever with selfy stick
during repair.

Steps:
1. Pair and connect remote devices with DUT.
2. Now un pair selfy stick from DUT.
3. Keep remote in discoverable mode.
4. Start inquiry and try to pair with device.

Failure: Pairing with selfy stick always fails after collision.

Root Cause: As we return from btm_sec_dd_create_conn with out
moving pairing state in connection collision scenario. Pairing
state will remains idle and pairing won't proceed further.

Fix: Move the pairing state in collision scenario so that pairing
can proceed further.

Change-Id: Ic5c446ad3902b0ce16c7223ec2d8e4a625831446

Conflicts:
stack/l2cap/l2c_fcr.c
Change-Id: Ia83fbcf2477152005dd60cf8344ce1db708b1379

Conflicts:
hci/src/packet_fragmenter.c
Change-Id: I1ebcd267713ee4799cba4f9ab45a2db7300c60da

7 years agoBluetooth: Enable A2dp Multicast.
Ayan Ghosh [Mon, 25 Aug 2014 12:47:48 +0000 (18:17 +0530)]
Bluetooth: Enable A2dp Multicast.

This feature enables the multi
streaming support on BT HOST.

Change-Id: Ic3748c32b30036abd352c9322e30a704b2103fa7

Bluetooth: A2dp MultiCast/ Soft Hands-off.

 - Trigger suspend, when new ACL is up during active
   multicast
 - Initiate suspend on both links when it is initiated by
   either connected HS
 - Clear remote suspend flag when play is initiated by either
   connected HS
 - Allocate first free SCB when remote has initiated AVRCP connection
   and we are trying to connect to other HS
 - Update Encoder when HS2 is connected during
   active streaming on HS1
Change-Id: I7ccfb81637688c23c6a2b005f849ac76cc0dbd2a

Bluetooth: Initialize RC handle with proper value.

 - Initialize rc_handle with 0xFF
 - On disconnect re-set rc_handle to invalid value.

Change-Id: Id507114451701e998f9960aa5dc961ff16f2d1bf

Bluetooth: Do not register for Volume change.

 - When absolute volume is not supported by any
   of connected HS do not register for volume change
   notification on connected HS.

Change-Id: I3b29ac5929989bc7c45b1b0f8cbe75b3082e66d3

Bluetooth: Use SCB handle for Sniff.

 - Use scb handle for making entry for sniff instead
   of audio count.With Multi A2dp audio count denotes
   number of A2dp devices connected.Due to this stale
   entries were created for AV power entries, due to
   which links did not go to sniff after max entries
   in table is reached.

Change-Id: I051017991c7d3d7d42c4822efdad2b2aa1b0e2b2

Bluetooth: Use free SCB for Incoming connections.

  - In connection race conditions, check for
    first free SCB to allocate for incoming
    connection.
  - Initiate disconnect for incoming connection when
    no free SCB is available.
  - Check for max. possible connections before initiating
    suspend for new link up-event.
  - Clear all flag on AVRCP disconnect.
Change-Id: Ic605b0470ca88aac856cefe54bf6c9ec5320bd5a

A2DP Multicast: Allow outgoing connections for scatternet

    - As there is fallback to soft handoff incase of
      scatternet scenarios, allow the outgoing
      connections in case of role switch failure for
      existing slave connection.
    - Reject the incoming connection from BTA while
      processing another incoming connection.

Change-Id: Ib8a087eea5e9845a6e2ef758757f941c1bdf7b52

A2DP Multicast: Disable multicast if BR HS is connected

    - Disable multicast if BR headset is connected
    - Use scb index for AV Busy and Idle state updates

Change-Id: If7310be4f47cbe0775eb35c0b81122d524be25f5

Dual A2DP: Avoid blocking Play key event

    - Send play key event for PLAY sent from non playing device
      to be compliant with default behavior for single connection.

Change-Id: Ie07fc10d3a946ca4e3f9643b2ae5e556358fd0b8

A2DP Multicast: Update multicast state after AV state update

    - multicast state update checks the AV state for updating
      multicast condition. Need to make sure that AV state
      is updated in OPEN state before calling the API.

Change-Id: Ifa0fd1a90ff5d8a05c37dba1590f76176d9899e0

Dual A2DP: Disconnect AVRCP only connection.

    - AVRCP only connection should be disconnected to avoid
      confusion to end user in the Dual A2DP/Multicast scenarios.
    - Proper check for RC connections before closing uinput.

Change-Id: Id515c3f29499a3ada02b8e45cc2189276152a461

Conflicts:
btif/src/btif_av.c

Dual A2DP: Allocate free SCB for incoming connection

    - SCB allocated to incoming connection should be idle.
      If not, ongoing connection handling will be affected.

Change-Id: Ideaab85b928f08b37c7a284644fd3a62926b15ec

Dual A2DP: Initiate outgoing connection only if the state is Idle

    - A2DP connection also could be triggered from remote device
      before the AVRCP timer expires. Check the state before initiating
      connection for the device.

Change-Id: Id538de6ce829a388a4c052769177319cd5c217fc

Dual A2DP: Don't suspend if stream is started for other device

    - Avoid sending suspend for remote initiated START if
      stream is started for other device. IOT issues are seen with
      specific devices if gap between SUSPEND and START is less.

Change-Id: I64d768aa8246101687bbc98b4ae0be97645bb5b1

A2DP Multicast: Update multicast state during role change

    - Role change can be triggered at any point of time
      during the connection. Update the multicast state
      upon getting role change event.

Change-Id: I60a17e955b6fdc4379d571c59d8527ec023e9531

Revert "Bluetooth: Do not register for Volume change."

This reverts commit c87e747f40b870b9a540902595524b34a5436b43.

Change-Id: I4752486979366f67e9109bd61df54dc48786f564

Dual A2DP: Set the flush only when there is no play in progress

    - When connected to two devices update the flush state only
      if there is no play on any connected device.

Change-Id: Ic13b7285625c49350334c35eed878407b6e78821

Dual A2DP: Handle connection inconstencies during stress scenarios

    - Avoid removal of connect nodes in profile connect queue
    - Dual Handoff flag cleanup during START failure
    - Reject the A2DP connection from remote device if it is
      initiated on the same endpoint where outgoing connection
      is being attempted.

CRs-Fixed: 835641
Change-Id: I4cc0d680e5cabb003dd11c8ba232d1fc70f41780

Dual A2DP: Mark the AVDTP busy during outgoing connection

    - AVDTP incoming connection cannot be handled when there is
      outgoing connection in progress as per the base design.
      Reject the incoming AVDT connection so that other
      connection can happen and A2DP connection is always
      attempted from connectOtherProfile path.

CRs-Fixed: 839392

Change-Id: Iff801a7e4f170aa85cd06278c7d62dfc81464b5a

Dual A2DP: Acknowledge the SUSPEND after both streams stop

    - Avoid on_suspended call when other stream is not yet
      suspended as it unblocks the audio process to send
      further commands.
    - Handle RC close to cleanup the BTIF RC block even if
      the current AV connections are for different devices.
      This was seen because of not getting AVCT disconnection
      response and later this event is received after getting
      ACL disconnection complete.

CRs-Fixed: 842690
Change-Id: I7eb95a9ddfc7be06af4521af1567e4e166630317

Dual A2DP: Disconnect the AVRCP only connection

AVRCP only connection has to be disconnected when it is evaluated
for A2DP connection and no free AV blocks are available in BTIF.

Change-Id: I3f6b731ed6701c739defbfd8e011bbb6a1aeb3ba

Conflicts:
btif/src/btif_rc.c

A2DP Multicast: Check for both streams for stream ready

    - Stream ready should succeed only after both streams
      are suspended during multicast, otherwise audio data
      coming will trigger inconsistent behavior for stream
      starting.

Change-Id: Ia8794dbed7dbe5f55cf7139b200fcdf2eb5ee45f

A2DP Multicast: Handle suspend for both streams

In race conditions, it is seen that ACL is established while
stream is being started for both devices for multicast.
Since the multicast state is updated after stream start when
suspend is initiated we need to check if both streams are
started and suspend them accordingly.

Change-Id: I23f64174914350b476022f7bfbfb553a55d12902

Dual A2DP: Clear the RC priority information while disconnect

RC priority information has to be cleared during disconnection
to avoid improper usage during start even after initiating
disconnection.

Change-Id: Ia52c04ea2bfecbf390aae12400073adb0f327718

Dual A2DP: Interface to query active device for handoff

During Handoff case, check the playing device and device to
start playback to provide state for given device.

CRs-Fixed: 856063
Change-Id: I3a326d9f0c6221cfc4cdcc3fad037f22a29ff90e

Dual A2DP: Connection failure handling for proper cleanup

    - Cleanup BTA AV block for the outgoing connection if
      it fails because of no resources
    - Reject the incoming connection if there is outgoing
      connection in progress

Change-Id: I44d3dd6bbff93d38c1c22260056897e42d915ffa

Conflicts:
stack/avdt/avdt_msg.c
Change-Id: Ie74102d0254fa73061b6baea9811d834fae64358

7 years agoBluetooth: Add Dialog mouse & KB to blacklist for LE secure connections
Nitin Arora [Wed, 6 Apr 2016 00:10:37 +0000 (17:10 -0700)]
Bluetooth: Add Dialog mouse & KB to blacklist for LE secure connections

This change allows the host to mask the Cross key bit in
the key distribution fields of the pairing request and
response while pairing with the Dialog keyboard and mouse
to prevent the remote from rejecting the DUT's pairing request.

CRs-Fixed: 1033619
Change-Id: I888b5ce8c12652ef5c393b304bed8948c4e6b444

7 years agoAVRCP 1.5 Implementation
Ayan Ghosh [Fri, 25 Jul 2014 12:21:32 +0000 (17:51 +0530)]
AVRCP 1.5 Implementation

AVRCP 1.5 Implementation

Change-Id: Ia35dc4344b05584cf5ab3b463815c9e6297d24ab

Proper check to ensure attributes are populated properly

Incorporated proper check to ensure if memory is allocated properly
then all requested attributes are populated in response from DUT

CRs-Fixed: 753309
Change-Id: Iead549635cd2059bc8cf33585a5d87ae023149d4

Reset Browsing Bit if carkit is blacklisted

    - Reset Browsing bit if carkit is blacklisted for avrcp 1.5.
    - Not to send 1.3+ specific supported events if carkit is blacklisted.

CRs-Fixed: 762470
Change-Id: I32ac80c0549b2b89dd2522dbb0dea89d255d33dc

Free Browse packet

Free Borwse packet in AVRC layer once the same is
copied to BTA for further processing.

CRs-Fixed: 785286
Change-Id: I8037a649cff5a1e527c28ba36999a1bed34d315a

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

Bluetooth: Change cleanup sequence.

 - Clear btif_rc_cb before setting callback to null.
 - do not initiate callback if rc address is null.

Change-Id: Ief15f21e40a36cf894b7c2e14e3236fc3ecf7701

Dynamic AVRC version change based on Remote's capability

 - Update DUT's adevertised AVRCP version as 1.4 or more if remote
   is capable of Avrcp File browsing with feature supported as 1.4 or more.
 - For other remote DUT always displays Avrcp version as 1.3.
 - For browsing capable remote, browsing feature works when remote does
   SDP after repair.

Change-Id: I00679397559cfb3b9efffeb92fc6b2755b851fea

Remove redundant entries from Browse structure

Remove redundant entries from Browse structure

Change-Id: Iff961f91693a2c7a32e9a22273c5e3c2b7ba4b96

Avrcp: Do not initialize transactions if cleanup done already.

In case of BT turn off, if avrcp cleanup happens earlier than
rc disconnection, then initialize_transaction gets blocked on
locking mutex which got destroyed during cleanup. Do not initialise
transaction and close uinput if done already during cleanup

Change-Id: Ib3fd61275bc918872a80a70b3d7ba66309b23ab6

BT-AVRCP: Cache set_addressed_player request while in active call.

When set addressed player is requested by avrcp controller while
in ongoing call, we fail to cache the request. Because of this
we do not send reject response to set addressed player request.
The change properly caches request and send reject response

Change-Id: I4cb02c8cb78c26fcbe22dda57cf9009e4b20be96
CRs-Fixed: 988856

Avoid updating conf file if Avrcp 1.5 is not enabled.

Avoid updating conf file if Avrcp 1.5 is not enabled.

Change-Id: I9088d0804f69a8a0a2369e97f07ce74bf750f966

Change-Id: Icbf61776a6fb63fac1555bf25d3700beccf2b67a

7 years agoA2DP Sink: Changes to support A2DP Sink in N MCL
AnubhavGupta [Thu, 28 Apr 2016 06:24:30 +0000 (11:54 +0530)]
A2DP Sink: Changes to support A2DP Sink in N MCL

- changes to enable A2DP Sink in N MCL.

Change-Id: I281f435ce5c55a2e2440f124e034cf478e7624e7

7 years agoBluetooth: IOP: Allow more time for AG connection to go through
Satheesh Kumar Pallemoni [Tue, 10 May 2016 12:00:06 +0000 (17:30 +0530)]
Bluetooth: IOP: Allow more time for AG connection to go through

Fix inter-operability issue by increasing connection timeout for
AG profile

Change-Id: I565d72fa23012c683f83a025b41c20e236864dc7

7 years agoHID: Fix following IOT issues
Hemant Gupta [Tue, 7 Jun 2016 09:22:11 +0000 (14:52 +0530)]
HID: Fix following IOT issues

  -  Add HID keyboard to sniff blacklist, to disable sniff when SCO
     is active and re-enable sniff when SCO is disconnected.
  -  Add Game Controller to sdp blacklist.

CRs-Fixed: 1025271
Change-Id: Idab33ca9326c7e0724113cb8db29691b2a65ea12

7 years agoHID: Disable sniff for some particluar remote devices
Hemant Gupta [Tue, 18 Aug 2015 10:52:06 +0000 (16:22 +0530)]
HID: Disable sniff for some particluar remote devices

This patch disables sniff on hid link for certain remote devices in
presence of SCO/esCO to prevent IOT issues of ACL disconnection on
HID link.

CRs-Fixed: 892083
Change-Id: Ia9fe1d8f5578b55c0e708e8791c5c37c3dbc48ff

7 years agoHID: Fix IOT issue with Motorolla KZ499 Keyboard
Hemant Gupta [Mon, 4 Apr 2016 06:56:41 +0000 (12:26 +0530)]
HID: Fix IOT issue with Motorolla KZ499 Keyboard

Fix IOT issue with Motorolla KZ500 Keyboard, which claims
support for multiouch functionality in SDP repord descriptor, but this
functionality doesn't work because of issues in usb hid kernel driver.
To handle this keyboard, digitizer record in report descriptor is removed
and the remaining descriptor is passed to kernel usb hid driver during
connection, which interprets the keyboard as generic keyboard instead of
multitouch keyboard and normal functioning of keyboard works fine thereafter.

Change-Id: I888b4a8997296ebbf3d9d23dd1c52ade230f984e
CRs-Fixed: 776647

7 years agoHID: Enhance blacklist logic for restricting SDP
Hemant Gupta [Sun, 26 Apr 2015 05:02:57 +0000 (10:32 +0530)]
HID: Enhance blacklist logic for restricting SDP

Enhance existing blacklist logic for restricting SDP
for HID devices, by adding BD address and name support in addition
to manufacturer id. Also blacklist logic is added for HID devices not
supporting authentication.
    - Targus mouse does not support authentication, so blacklist logic
      added to disable authentication for such HID devices.
    - Many HID mice return an out of resource error for incoming connections
      when more than 1 SDP connection is made to them. Current implementaion
      in BD stack performs SDP from 2 layers HID BTA layer to determine HID
      desritors for HID device and btif layer for determining uuid's supported.
      Blacklist logic is enhanced for such devices to not perform SDP from btif
      layer after authentication and directly inform upper layers that SDP is
      complete by adding support for BD address and name based addition to
      blacklist.

Change-Id: I4fe1e016549bb55ad176cd014bf1d5da85b38353
CRs-Fixed: 465421, 568114

7 years agoBluetooth: Fix to decrease power during OPP TX/RX
Matadeen Mishra [Thu, 30 Jun 2016 09:21:31 +0000 (14:51 +0530)]
Bluetooth: Fix to decrease power during OPP TX/RX

Refactor the original Fix.
Used 1000 milli second instead of 1 second, as API
changed to millisecond.

Change-Id: I0ecac707751f990eeabc63e56ad79e54b06e7a73
CRs-Fixed: 1036350

7 years agoBluetooth: Gap: Adding NULL check in HAL interface
Balraj Selvaraj [Wed, 21 Oct 2015 14:14:04 +0000 (19:44 +0530)]
Bluetooth: Gap: Adding NULL check in HAL interface

When the HCI_RAW_CMD support is included, adding
NULL check for bt_hal_cbacks and hci_event_recv_cb
in btif_hci_event_cback to avoid ASSERT message
continuosly which is consuming more power.

CRs-Fixed: 922611
Change-Id: I995e6411012fe515ca725267045a97076b692b7d

7 years agoBT: ACL and l2c out if sync after connection collision
Gurpreet Ghai [Tue, 8 Mar 2016 18:09:55 +0000 (23:39 +0530)]
BT: ACL and l2c out if sync after connection collision

Problem: Remote device can't be removed from paired list.
Cause: After connection collision, lcb is removed after
connection request is rejected by soc but acl entry is not
removed. So, for upper layer, acl connection always remains
up.
Fix: Removed acl connection and acl entry when connection
complete is received and lcb is not present.

CRs-Fixed: 987968
Change-Id: Ie2049217e436704262f06d0c0dc51611697cc29a

7 years agoBluetooth: GAP: Accept incoming connection in slave role
venkata Jagadeesh [Mon, 16 Nov 2015 09:22:02 +0000 (14:52 +0530)]
Bluetooth: GAP: Accept incoming connection in slave role

Accept incoming connection in slave role for blacklisted remotes

Change-Id: I7acda5f794fa53dd270b31c048f5e85a0ed7ce94
CRs-Fixed: 943689

7 years agoSDP: Restricted invalid attr len in sdp delete
venkata Jagadeesh [Tue, 16 Jun 2015 09:59:04 +0000 (15:29 +0530)]
SDP: Restricted invalid attr len in sdp delete

    Restricted invalid attr len in SDP_DeleteAttribute as
    pointer is trying to access invalid memory when attr_len
    is invalid

    Registering PNP record before PAN profile as PNP record
    should be registered before profiles.In some cases PAN and
    PNP SDP registration colliding and leading to memory
    corruption in SDP DB.

    Change-Id: Ib6d2120c7ef1d10633fa905d6b853281efaf0ecd

    Bluetooth: Cleanup ACL link during restarting pending ACL connection

    This fix removes the previously held ACL link with the BR_EDR
    device before trying to create a new pending connection with the
    same device.

    Change-Id: Iac941794e2fc86c48781edc86492146ab5c21eae

    Bluetooth: Cleanup the lcb variables properly on reuse

    - Cleanup all relevant link control block variables
      like send_not_acked, partial_segment_being_sent
      and stop the info response timer to reuse the same
      LCB.

    - L2cap layer will reuse the same lcb if the link is
      disconnected and wants to re-establish the link.

    Change-Id: I822b0ee350574bbeb5b3c86a349d1471fa45761a

Change-Id: I15f83b5c1a88d248d29080123ebbf4652f2cb340
CRs-Fixed: 885782