OSDN Git Service

android-x86/system-bt.git
7 years agoRevert "Fix bug where a bonded device could enter BONDING and BONDED states again."
Nitin Arora [Wed, 13 Apr 2016 00:09:37 +0000 (17:09 -0700)]
Revert "Fix bug where a bonded device could enter BONDING and BONDED states again."

This reverts commit 0b7fc589089ce4a96daa668b9d293ce01982424d.

Conflicts:
btif/src/btif_dm.c

CRs-Fixed: 1033628
Change-Id: I1b7ccf0ff4eaebe1c947ee81e50e4587a1bdbb47

7 years agoBluetooth: Prevent multiple register of service change indication
Nitin Arora [Thu, 16 Jun 2016 22:27:59 +0000 (15:27 -0700)]
Bluetooth: Prevent multiple register of service change indication

Use Case:
Pair DUT to a remote LE device. The host registers for the service
change indication twice, once when the connection callback is
received and another time, when the SMP process completes

Failure:
There are a few issues caused by this.
First, the duplicate action of service change indication registeration
is unnecessary.
The registeration that follows the SMP process adds a gatt_if to the
apps holding the current link. This gatt_if (=1) never disconnects
after registeration failure or success. And hence the host can never
physically disconnect the link.

Fix:
This change removes the service change registeration at SMP
process completion

CRs-Fixed: 1033611
Change-Id: I0d7566e2b4a9d01aa7926cdbe9f528c3941fcfeb

7 years agoBluetooth: Do not go for inquiry in BONDING State
Manu Viswanadhan [Tue, 25 Jun 2013 11:04:00 +0000 (16:34 +0530)]
Bluetooth: Do not go for inquiry in BONDING State

This patch fix a special case where DUT is paired & connected
with only one device, which has capbility to intiate paring as
soon as DUT unpair same remote device. As DUT is paired with
only one device, In this case Once DUT unpair remote device. DUT
goes for inquiry & at same time remote device initiates pairing
if Bludroid stack recieve pairing request before the inquiry
start then DUT should not go for inquiry, As DUT is already in
BONDING state.

CRs-Fixed: 481263

Change-Id: I0e1ec0fdb963921629e5c52f495ae2013e679a03

SDP: Fix for SDP query in certification test with Invalid PduSize

Bluedroid stack is only checking parameter length and input data length.
Added an extra logic to handle invalid data after getting last valid data.

Change-Id: I47eafb2c24e73b472c31a2fb47e02d48c5e04f6c

CRs-Fixed: 491693

Bluetooth: GAP: Update name as part of Discovery of services

Update the remote device name to upper layers as part of
discovery of remote device services.

CRs-Fixed: 593306

Change-Id: I24d899c1f5ccc81d8b0c4257abae16a7bf5d4682

Bluetooth: Handled delayed info rsp from remote during SDP

DUT initiates connection with out waiting for information response
from remote device during SDP.

Change-Id: Iee0251f8f81923b1291983b66b31c78e14d21af0

CRs-Fixed: 635697

Bluetooth: GAP: Changing the security to general bonding

Changing the security from non bonding to general bonding
in BTM_SEC_OUT_AUTHENTICATE condition.

Change-Id: I65d2ec4466e2bd81df2cc7e2936e05159a8645ed

CRs-Fixed: 676532

Bluetooth: Store local and remote io caps before RNR

Stores the loc_io_caps nad rmt_io_caps when the remote
name request is called, and these will be retrieved
in the function bta_dm_pinname_cback.

CRs-fixed: 535245

Change-Id: I4b2156d7101acabb1ded65bd21d49a9c4551f8db

Bluetooth: GAP: Handle security failure with invalid handle

Return NULL incase of invalid handle when finding a device
based on the handle. This will make sure to avoid giving
a invalid entry from the device list.

Also send authentication failure in case of invalid handle.

Change-Id: Ia95d10ae95cfa1750386233ee90f01899061294e

CRs-Fixed: 592545

Change-Id: I71b902ae201e32a0fb18fd3bce52fd86e8cbcdd5
CRs-Fixed: 902577

7 years agoFix for Compilation Issue
Satheesh Kumar Pallemoni [Mon, 20 Jun 2016 11:26:04 +0000 (16:56 +0530)]
Fix for Compilation Issue

We build our system/bt code by setting BLUETOOTH_QTI_SW macro always to TRUE.
But Customer wants to build by setting BLUETOOTH_QTI_SW macro to FALSE,
Which leads to compilation Issue.When SCO open was initiated by AG
and failed for mSBC,then Fallback to CVSD settings which has not done in
else condition.
So, we should add falling back to CVSD in else condition.

CRs-Fixed: 1031600
Change-Id: I7ed33cc20374dd899b21e3fa12abe622ddc84eff

7 years agoFixes for Static analysis tool reported.
Satheesh Kumar Pallemoni [Tue, 14 Jun 2016 12:51:33 +0000 (18:21 +0530)]
Fixes for Static analysis tool reported.

CRs-Fixed: 1028649
Change-Id: If86dc1766f225a097e4dcdcb68bf6ea6bec50a2a

7 years agoBluetooth: Modify logic to ignore HID notifications
Nitin Arora [Thu, 23 Jun 2016 01:04:08 +0000 (18:04 -0700)]
Bluetooth: Modify logic to ignore HID notifications

This change reverts the previous logic and delays the
ignoring of indications for HID devices, after the processing
of service change indications.
This is needed for keeping the update count equal to the
number of apps registered, so that service change indications
can be properly confirmed and followed by remote service
discovery.
This reverts commit a85bd580013944b321d88c3c5515a015c9f67f72.
CRs-Fixed: 982471

Change-Id: Iabba84aac1af6847bb44fd2169bd0870d8d14a55

7 years agoBluetooth: Increased the command buffer length to 128.
Matadeen Mishra [Sat, 6 Feb 2016 12:07:38 +0000 (17:37 +0530)]
Bluetooth: Increased the command buffer length to 128.

Increased the command buffer length to 128.
In align with the incoming buffer size.

Change-Id: I2dba02a4c5b40925b4d9ddcd2babd432859e93b6
CRs-Fixed: 973303

7 years agoAG: Accept '-' character in dial number string.
Satheesh Kumar Pallemoni [Tue, 21 Jun 2016 04:57:13 +0000 (10:27 +0530)]
AG: Accept '-' character in dial number string.

Some Headsets storing Number from CLCC response and sending
ATD<number with special Char '-'> for redial.We do not accept
special char '-' in number string and sending Error reponse.
We should add check for accept this special char '-' in
string for redial.

CRs-Fixed: 1031997
Change-Id: I7dfc6c98fdd902361e40752b10d0c41d7ca8fe7b

7 years agoBT: Rectify size passed to copy service name to secu records
Gurpreet Ghai [Thu, 9 Jun 2016 09:06:35 +0000 (14:36 +0530)]
BT: Rectify size passed to copy service name to secu records

Use case: Services having name length greater than max lenght
always take new slot in security records. So, after few enable
disable cycles in BLE ON scenario, the record gets completely
occupied making further connection impossible.

Steps:
1. Install a BLE App to create BLE always ON scenario.
2. Run a few cycles of Bluetooth(bredr) enable-disable.

Failure: Once security records are completely occupied, new
connections are not possible because of socket creation
failure due to unavailability of security id.

Root cause: Size passed to copy service name does not include
bit for null termination. So, for services having name size
greater than that size have their last bit truncated for null
termication. So, during next enable, the comparision with
same size always fails causing service to take new slot in
security records array.

Fix: Increased the size passed to copy service name by 1 after
considering null termination.

Change-Id: I3527df6610932f60fd85bcdd14d5b8a527c79722
CRs-Fixed: 1026359

7 years agoBluetooth: GAP: Reject incoming pairing if already in progress
Venkata Ramana Rao K [Tue, 21 Jun 2016 12:27:31 +0000 (17:57 +0530)]
Bluetooth: GAP: Reject incoming pairing if already in progress

  - This patch properly rejects incoming pairing request from remote device
    if already in pairing state. Without this patch it was observed that in
    some corner cases pairing was auto accepted for remote device while
    pairing was in progress with another remote device leading to inconsistent
    behaviour.

Change-Id: I19a2a98e4ceb51cabaef279a2e3f8224fbed9ea1
CRs-Fixed: 1032165

7 years agoBluetooth: Fix to decrease power during OPP TX/RX
Nitin Shivpure [Wed, 16 Dec 2015 11:17:42 +0000 (16:47 +0530)]
Bluetooth: Fix to decrease power during OPP TX/RX

Due to alarm timer implementation, bta_sys_idle OR bta_sys_busy call
was the overhead(eg. 7ms) on every OPP packet(TX/RX), which was causing
high power. Below optimization have been done in JV to decrease
power during OPP TX/RX
- If particular JV acl link is in sniff, only then use bta_sys_busy to
  trigger unsniff request.
- Start intermediate idle timer(1s) before starting actual idle sniff
  timer(bta_sys_idle).

CRs-fixed: 1028625
Change-Id: Ied1173776f9bf2dc89b8e84e68d6217932a01607

7 years agoBT: Checking for stack status before removing sdp
Gurpreet Ghai [Wed, 10 Feb 2016 14:51:39 +0000 (20:21 +0530)]
BT: Checking for stack status before removing sdp

Based on appliaction implementation, this api
can be called during undesirable state like
when stack is being cleared. This causes ANR
and tombstone in Bluetooth.
Checked for status of stack and returned without
processing if stack is already cleared.

Change-Id: Ib5447402f9c28e010a74700927be54db44f9ca65
CRs-Fixed: 975088

7 years agoUse Local ccb variable in loop to check GAP CCB pool
Venkata Ramana Rao [Wed, 15 Jun 2016 09:57:12 +0000 (15:27 +0530)]
Use Local ccb variable in loop to check GAP CCB pool

File Receiving fails on DUT after 3 file transfers using OOL from DUT.

steps:
Transfer the files between two devices which supports OOL after pairing.
After 3 files transfer from DUT, send a file from remote to DUT.
File transfer fails.

Failure: File transfer from remote to DUT fails always after 3 opp
client connections

Root cause: File transfer is failing always because no RCB's available.
RCB's were not cleaned up after use.

FIX: RCB's were not cleaned up because there is an extra check has been
added with transpo for the CCB.And wrong CCB is passed to check transport
to clean up.Using another local variable for the p_ccb will solve the issue.

Change-Id: I06a8f237047ffb212118b4239e9856fe5c89acb1

7 years agoHID:PAN: Fix issues reported by Static Analysis Tool
Hemant Gupta [Fri, 3 Jun 2016 12:31:44 +0000 (18:01 +0530)]
HID:PAN: Fix issues reported by Static Analysis Tool

Fix issues reported by Static Analysis Tool.

CRs-Fixed: 1025718
Change-Id: Ie0347307d7536f18bf8f32a2dfeda593a41933bf

7 years agoDelete GATT cache file from NVRAM when device is unpaired
Subramanian Srinivasan [Tue, 14 Jun 2016 01:15:31 +0000 (18:15 -0700)]
Delete GATT cache file from NVRAM when device is unpaired

GATT cache file is created for each remote device when
service discovery is performed. This file is not removed
when a device is unpaired. Hence even after performing a
fresh pairing, the subsequent service discoveries end up
retrieving the attribute list from the GATT cache instead
of fetching the results over the air.

The service discoveries for non paired devices also are
not performed over the air for the reconnection attempts.

This change deletes the GATT cache NVRAM file when a device
is unpaired and also resets the GATT cache structures
during disconnection of non paired devices.

Change-Id: I35ec4d0a53820c671fe94cb83927548b9be53d28

7 years agoBluetooth: Select bluetooth transport dynamically
Dibyendu Roy [Wed, 25 May 2016 09:24:43 +0000 (14:54 +0530)]
Bluetooth: Select bluetooth transport dynamically

Select bluetooth transport dynamically on the basis of
qcom.bluetooth.soc property. This patch removes the use of board
configuration option QCOM_BT_USE_SMD_TTY and uses dynamically
detected SOC type to choose required transport.

Change-Id: Iae1ee900362af95c42bffcc444b56267cbbae92d

7 years agoBluetooth: Select bluetooth HCI driver dynamically
Dibyendu Roy [Mon, 9 May 2016 09:24:25 +0000 (14:54 +0530)]
Bluetooth: Select bluetooth HCI driver dynamically

Select bluetooth HCI driver dynamically on the basis of
qcom.bluetooth.soc property. This patch removes the use of board
configuration option BLUETOOTH_HCI_USE_MCT and uses dynamically
detected SOC type to choose required HCI driver.

Change-Id: Idecb2fd74fbc9d361c2877e9b3a47606667e0229

7 years agoRevert "Revert "Initial commit for rfcomm test tool""
Matadeen Mishra [Thu, 12 May 2016 04:16:09 +0000 (21:16 -0700)]
Revert "Revert "Initial commit for rfcomm test tool""

Added strict_mode boolean parameter in enable function.

This reverts commit 007093f5aded6eb02501602996e2f2883b3923c7

Change-Id: I37a282e80fa6e884fbdf51de283d3e9c2761a7c4
CRs-Fixed: 1014526

7 years agoBtsnoop write from external process
Matadeen Mishra [Fri, 14 Nov 2014 14:16:19 +0000 (19:46 +0530)]
Btsnoop write from external process

- Write btsnoop from external process
  Introduced a new proces to dump snoop packets into file.
  Snoop packet can be send to the remote process using local
  socket as writing to file from BT process can cause A2DP
  choppyness.

- Avoid btsnoop file write if btsnoop client is connected
  Existing implementation writes it to file though the packet is
  sent over network socket. This chnage will make sure to avoid
  writing it to file if any of the network/local socket is
  connected.

- Generalized the mechanism to use same code irrespective of
  what type of socket it is. Otherwise having thread for each
  socket is not preferrable.

- Adjust the GMT offset to match with logcat logs.

- Limit the block of snoop write to 10ms and drop the packet.

- Memcpy issue single write to eliminate multiple I/O.

- Enable snoop by default on userdebug build.

- Option to override snoop config for userdebug build.

Change-Id: I13749dc348baf88af57e3ebec1ec7acd5e999c04

7 years agoHID: Add support for set report and get report
Hemant Gupta [Thu, 3 Sep 2015 09:19:18 +0000 (14:49 +0530)]
HID: Add support for set report and get report

Add support for set report and get report in HID user
space because of changes in uhid kernel driver with kernel changes
for kernel 3.18. Without these changes issues are seen with hid devices
that uses vendor usb hid drivers and send specific set and get report
to hid devices for their proper functioning.

Following are the new flags added in uhid driver of kernel, for which
support is required in hid user space.

UHID_GET_REPORT
UHID_GET_REPORT_REPLY
UHID_SET_REPORT
UHID_SET_REPORT_REPLY

Also update __FUNCTION__ to __func__ in API's where changes are made.

Change-Id: I90230b76d68e9275dcacd9f46f03e312ddf2fa30
CRs-Fixed: 963213

7 years agoBluetooth: Disable eager reader threads in RX path
Srinu Jella [Tue, 15 Dec 2015 14:22:32 +0000 (19:52 +0530)]
Bluetooth: Disable eager reader threads in RX path

- Disabled eager reader threads in RX path for both
  ROME and PRONTO targets.

- Exising machamisn is to poll for incoming data
  (event, ACL data) using dedicated thread called
  eager reader thread.

- Now the responsibility of polling for data moved
  to existing HCI worker thread.

- Enhanced the read mechanism from hci hal interface.

CRsFixed: 934414
Change-Id: Icfd27b7b93f83033b2230e61a23df69aa3c33bdf

Bluetooth: Optimize the L2cap FCR tx timer

- Optimize the L2cap Flow control tx timer
  to avoid frequent start and stop of same
  timer.

- it will restart the timer instead of stop
  and start.

- Changes made in btm timer functions also
  to avoid scheduling of next timer in queue
  though is not required as the same timer
  is supposed to start.

CRsFixed: 934414
Change-Id: Idd43a71617a27c6d70fafa4e31c16f735a1a9425

Bluetooth: Handle the SSR timeout case properly

- Kill the bluetooth process in case of SSR timeout,
  otherwise it will try to read the invalid data
  that might lead to crash.

- Also corrected the data type to check when error
  occurs on read call.

CRs-Fixed: 978009
Change-Id: I42f6c9f4a437f7b143fe1e1beb3b6ef39533f4d7

7 years agoBluetooth: Separated initialize and re-initialize of bta_dm_cb control block
Bandari Ramesh [Tue, 7 Jun 2016 13:46:52 +0000 (19:16 +0530)]
Bluetooth: Separated initialize and re-initialize of bta_dm_cb control block

 -Added bta_dm_deinit_cb function to re-initialize of
  bta_dm_cb control block

 -Modified the condition to set disable timer in case of any active
  ACL connections

Change-Id: I872944c39912bc8a534eba080a0ade7ced942bec
CRs-Fixed: 1025769

7 years agoSet DUT role as slave for outgoing connection
Venkateshwarlu Domakonda [Tue, 12 Jan 2016 07:04:45 +0000 (12:34 +0530)]
Set DUT role as slave for outgoing connection

Do not send role switch while accepting incoming connection
for Roman R9020 which delays responding to AVDTP_DISCOVER
and AVDTP_OPEN when in Slave role.

Change-Id: I1ba5bc0f1f88fe8ef7f4c186fbdfacd6726d3720

7 years agoAdd debug log to track Negative reply
Manu Viswanadhan [Fri, 29 Jan 2016 06:37:19 +0000 (12:07 +0530)]
Add debug log to track Negative reply

- Added logs to provide the negative reply
  information of
  - Pin code reply
  - Link key reply
  - Pass key reply
  - IO capability reply.

Change-Id: I7a25a53bf2dd7b69ecd9d0b30d49a163af731ee1
CRs-Fixed: 970954

7 years agoBT: Audio: Enhance default stack logging for AUDIO
rakesh reddy [Thu, 14 Aug 2014 06:28:45 +0000 (11:58 +0530)]
BT: Audio: Enhance default stack logging for AUDIO

Make default logging for upstream events,
statemachine state transitions, sco state
transitions, call state transitions etc.

Change-Id: Ia0dcb22e2efb99f186166ae4af2a8cb73f87616d

Bluetooth: A2DP Sink Logging.

 - logs for state transition.
 - Latency logs with sequence Number.

Change-Id: Iedabccd97d1118406f43b7ba494bdec5935b60b9

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

Change-Id: If081480b29f02126a1d48b9d0d9f855a3a605cc5

Enable required AVRCP Logging by default

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

Change-Id: Ie2e88de06254257af3b77b4f8b06401273f29262

7 years agoRevert "Bluetooth: Proper gatt disconnection after ccc process"
Arusha Goyal [Wed, 1 Jun 2016 06:21:48 +0000 (23:21 -0700)]
Revert "Bluetooth: Proper gatt disconnection after ccc process"

This reverts commit 73d92fd3a7a40536add8d25f30a9c4eb8a6948b8

Change-Id: I38a8e8f8a96eb5e68598126117607543f181b29e

7 years agoA2dp logging enhancement for media task
Ayan Ghosh [Thu, 5 Nov 2015 13:25:26 +0000 (18:55 +0530)]
A2dp logging enhancement for media task

Enabling important mediatask logs to be printed
with TRC level set to default.

Change-Id: I4bf1eb2f130b136cc1b3987ba2c042a4bc268020

Conflicts:
btif/src/btif_media_task.c
Change-Id: I68b34253821a5a5f6ff9a87b6353e6bbbbfe718d

7 years agoRestart sniff timer on AVDTP signalling channel establishment
Ayan Ghosh [Fri, 6 Dec 2013 11:41:11 +0000 (17:11 +0530)]
Restart sniff timer on AVDTP signalling channel establishment

VolksWagan UHV Preminum takes time to initiate AVDTP media channel
after AVDTP signalling channel is up. If mentioned duration exceeds
7 seconds then ACL link goes into sniff due to which A2dp Connection
fails.

With this change we make sure that when AVDTP signalling channel
is up and media channel is not connected we do not go to sniff,
which is achieved by restarting sniff timer on signalling channel up
so that link does not go to sniff in between ongoing connection.

Change-Id: Ic3f268703067155ffd55a43f320ce199641c6b3f

7 years agoQLogKit: Enable FW Logging and Set Stack Trace Level
Sai Aitharaju [Fri, 19 Jun 2015 03:44:00 +0000 (09:14 +0530)]
QLogKit: Enable FW Logging and Set Stack Trace Level

   - Enables FW Logging during BT On and disables
     the FW Logging during BT Off in userdebug
     builds only.

   - Provides an interface to set trace level for
     all the stack layers of bluedroid.

CRs-Fixed: 866285
Change-Id: Ib12d220e0aa4845d04b05b7fbea079d30c308004

Bluetooth: Disable SOC logging for ROME targets

Disable SOC logging for ROME targets

Change-Id: Ifbb99900d8596932e514582619aaf775dacd3c33

7 years agoBluetooth: Add support to send/receive raw command/event
Srinu Jella [Fri, 6 Dec 2013 09:55:26 +0000 (15:25 +0530)]
Bluetooth: Add support to send/receive raw command/event

Bluetooth: Add support to send/receive raw command/event

Support added to send/Receive raw command/event.

Change-Id: I194e9ceed29d60de492427784ae340691e4254e7
CRsFixed: 598650

Bluetooth: Support to send HCI raw command to stack.

Provide an interface in stack to send
HCI raw commands to stack.

Change-Id: Id70d419c19a2b983450ebc113b8d0cca2b36ecf9
CRs-fixed: 751111

7 years agoBluetooth: Proper gatt disconnection after ccc process
Nitin Arora [Fri, 6 May 2016 22:26:13 +0000 (15:26 -0700)]
Bluetooth: Proper gatt disconnection after ccc process

This change allows for an operation complete of the client
configuration registeration process.
In the current code, the successful completion of the
process where host writes the client configuration
descriptor of the service changed characteristic of the
remote device, the connection id (1) is never disconnected.
Hence, for those remote devices with the service changed
characteristic that allows Indications, there will always
be a remaining connection which will prevent disconnection
of the remote device.

This change fixes that issue and also the issue related
to early notifications/registerations causing disconnects
of HOGP devices

CRs-Fixed: 1014919
Change-Id: I04273f6a1ab5e2d74f49687c9a70670e40db9d39

7 years agoDUN: Squashed commit of the following:
Ashwini Munigala [Tue, 10 May 2016 10:56:38 +0000 (16:26 +0530)]
DUN: Squashed commit of the following:

commit fc3b33bbee0f9e0ae62dc922baae5fd5e8c9e307
Author: Nitin Shivpure <nshivpur@codeaurora.org>
Date:   Tue Dec 8 18:38:20 2015 +0530

    Dun: Don't add Obex protocol descriptor in SDP

    Don't add Obex protocol descriptor in DUN SDP record.

    CRs-fixed: 949818
    Change-Id: Id108722eafdf146228636412d087220da24af91c

commit 5f726cef997ee8400e0761f60e6a72f74f999ad6
Author: Srinu Jella <sjella@codeaurora.org>
Date:   Mon Oct 21 11:19:44 2013 +0530

    DUN: Add DUN SDP record to the Bluedroid stack.

    Add DUN server SDP record in Bluedroid stack.

    CRs-Fixed: 557180
    Change-Id: I432496079ae0d7325805b1b1cf684629bbf51035

Change-Id: I21ca2b1396de77611b55e34ce3d875b960f9b6d7

7 years agoFix for issues reported by Static analysis tool.
Satheesh Kumar Pallemoni [Mon, 9 May 2016 12:43:05 +0000 (18:13 +0530)]
Fix for issues reported by Static analysis tool.

Fixed issues in reported by static analysis tool.

Change-Id: I5a3ca9070ef21d2d86060b25f4282acf113a0987

7 years agoSocket: Add Get/Set socket option to the Rfcomm socket.(2/4)
Srinu Jella [Mon, 21 Oct 2013 06:11:15 +0000 (11:41 +0530)]
Socket: Add Get/Set socket option to the Rfcomm socket.(2/4)

Introduced Get/Set socket option support to the Rfcomm socket.
Currently Rfcomm socket supports get/set modem bits socket
options.For other sockets it will return error.

CRs-Fixed: 557180
Change-Id: Ia1779293b643c22d3f754c7f405646d42eb94963

7 years agoAdd support for FM vendor operations such as ON/OFF
Satish kumar sugasi [Thu, 17 Dec 2015 20:26:03 +0000 (12:26 -0800)]
Add support for FM vendor operations such as ON/OFF

This adds FM ON/OFF and HCI init operations

Change-Id: I476a8017343f9bc8dd8f30cc5ce14c8d05515caf

7 years agoBluetooth: GAP: Don't update short name if the device paired
Matadeen Mishra [Fri, 29 Apr 2016 15:15:34 +0000 (20:45 +0530)]
Bluetooth: GAP: Don't update short name if the device paired

Don't notify the BT APP about the shortened device name which
will be part of EIR response,incase of device is already
paired.
Incase if the alias name present for that device, it
will notify th BT APP alias name as the actual device name.

CRs-Fixed: 576911
Change-Id: Ia64e1e90aae8c4e0cc52643ce3bbbb1332fe5b66

7 years agoAG: Disable HSP profile durning BT turn off.
Satish Kodishala [Wed, 9 Mar 2016 13:27:01 +0000 (18:57 +0530)]
AG: Disable HSP profile durning BT turn off.

When BT Turns ON we are enabling HSP and HFP profile.
When BT Turns OFF we are disabling only HFP profile.
So,When BT Turns ON unable to connect HSP profile.
So,Add Disable for HSP profile also once BT Turn OFF.

CRs-Fixed: 987527
Change-Id: Ied8bef7eee8a20530ceedea636fcc1000ee7bb3a

7 years agoBluetooth:CoreStack: DUT Stack Logging.
Matadeen Mishra [Sat, 30 Apr 2016 11:46:12 +0000 (17:16 +0530)]
Bluetooth:CoreStack: DUT Stack Logging.

   DUT stack information logging:
   -L2CAP configuration parameter,
   -Device role information
   -L2CAP flow control and congestion information
   -L2CAP State machine and events
   -RFCOMM credits count
change-id: I6e74bdb1cda4455c50314f67bbcd19accd3c31e4

CRs-Fixed:602294
Bluetooth:CoreStack: DUT Stack Logging set2
   DUT stack information logging:
   -L2CAP CIDs, PSM and MTU
   -removed RFCOMM credits count from default logs
change-id: I7a25d751b200e8ece87f9e5fd79ab48d736087cb

CRs-Fixed: 602294
Bluetooth: Add debug logs for the remote device information
change-id: I857016c056635907586d8a9d0d577edde4efc34a

Add logs to provide the below remote device information
- Remote device features
- Service class
- LMP version, subversion, manufacturer
- Role changed event
CRs-Fixed: 602291
Change-Id: I99f51841716e27ef7170b7566379b975c99a65e0

7 years agoRevert "Initial commit for rfcomm test tool"
Arusha Goyal [Mon, 9 May 2016 11:06:09 +0000 (16:36 +0530)]
Revert "Initial commit for rfcomm test tool"

This reverts commit 3d4f014eb0595ff41393c0c1e259b8941737cb0c.

Change-Id: I21701af4cea0cfdcd23819a400e9c09f1f50008b

7 years agoBluetooth: Fix module cleanup.
Ajay Kumar [Wed, 25 Nov 2015 06:52:46 +0000 (12:22 +0530)]
Bluetooth: Fix module cleanup.

if module does not start fully its state will either NONE
OR INITIALIZED. While module_shut_down if module state is
not STARTED, it will exit without shutting underlying
layers which will give issues or ASSERT in next cleanup.

In this specific issue hci module stucks in USERIAL_OPEN
and startup timer expires and module exits with the error.
Since there is no error check on hci module fail it goes
ahead and enables BT(that might give issues later) but
fails to cleanup and does not call USERIAL_CLOSE while
hci module_shut_down as part of disable.Now this will
ASSERT in next enable as USERIAL lib handle is not NULL.

even if we call module_shut_down that is not going to
help as it will exit without calling lifecycle function
:shutdown. Adding module error state will solve the issue

CRs-Fixed: 939575
Change-Id: I0f448eb438881a9df46d07eab44d809bae740ab5

7 years agoAVRCP: Update sdp record correctly for CT or TG
Anubhav Gupta [Tue, 22 Mar 2016 18:03:33 +0000 (23:33 +0530)]
AVRCP: Update sdp record correctly for CT or TG

 - pass sdp version as parameter
 - update sdp records for avrcp controller in case of client
   profiles being enabled
 - BTA_AV_FEAT_BROWSE flag was incorrecly set during AV registration
   causing AVRCP TG version to upgrade to 1.4 even though browsing
   feature is not supported.
 - Use AVRC_CTLR_INCLUDED feature flag instead of AVRC_ADV_CTRL_INCLUDED
   for guarding Avrcp controller code in build/parse apis for
   command/response

Change-Id: I3ff4082453a2624a72d8f152d75af83a8efb4937

7 years agoHID: Return error when hid host is disabled
Hemant Gupta [Tue, 19 Jan 2016 15:48:15 +0000 (21:18 +0530)]
HID: Return error when hid host is disabled

This patch returns error when hid host service is disabled.
Without this patch thre could be potential UI synchronization
errors when hid host service is disabled.

Change-Id: Ida9e4c91015c8b0e4d36db5f58c0a65b7630a259
CRs-Fixed: 964404

7 years agoHID: Fix issues in stack reported by static analysis tool
Hemant Gupta [Fri, 22 Apr 2016 07:23:02 +0000 (12:53 +0530)]
HID: Fix issues in stack reported by static analysis tool

This patch fixes issues for hid profile in BD stack reported
by static analysis tool.

Change-Id: I8d765e8e7662781266b73344dee3dd1766930799
CRs-Fixed: 740857

7 years agoHID: Fix corner case state machine handling for HID Host
Hemant Gupta [Tue, 4 Nov 2014 14:49:01 +0000 (20:19 +0530)]
HID: Fix corner case state machine handling for HID Host

This patch fixes the following issues for HID Host state machine handling
  - Retry timer was never stopped in stack in case l2cap channel was refused
    by remote device, and l2cap connection was made before timer could expire.
    This was leading to some variable corruption in collision cases.
  - UHID driver is also closed in case open failed to fix some corner case
    issues of uhid driver not closed in some cases.
  - Handling of virtual cable unplug in waiting for connection state. Without
    this some IOT issues were seen with some hid mouse which used to send
    VC unplug while connection setup was still ongoing for hid host because of
    SDP.
  - Fix corner case race condition when remote device closes the l2cap while
    DUT is about to send Virtual cable unplug control command. Without this change,
    it was seen that in above scenario state machine of hid host moved to idle on
    reception of close event from remote device, and was unable to handle device
    unpairing on successful completion of virtual unpulg event which never came
    in above scenarios.
  - Some extra debug logs are added in code flow.

Change-Id: I851b73068a801f637eac94533a60150946d257f6
CRs-Fixed: 750415

7 years agoHID: Set sniff subrate with optimize latency value on HID Link.
Hemant Gupta [Fri, 21 Feb 2014 13:20:41 +0000 (18:50 +0530)]
HID: Set sniff subrate with optimize latency value on HID Link.

Current HID design disables sniff on HID Link in presence of SCO/eSCO, which
was leading to many IOT issues, as HID links work in sniff mode, and disabling
sniff on hid leads to issues of connection timeout if anchor points are missed
during sco/esco concurrent usecases. This design is changed as below:

- If HID is connected & SCO is active, then disabling Sniff subrate
  to fix connection timeout on HID link.

- If HID is connected & SCO is not active. Setting sniff subrate with
  optimize value based on the remote parameter to fix connection
  timeout on HID link to avoid HID IOT issues.

- Adds behaviour of host disabling SSR for JW MT002 and prevents
  Host from sending Sniff subrating command to SoC for BORND mouse
  so as to avoid IOT issues of disconnection and slow mouse movements
  respectively with these device.

- Updates SSR parameters for HID Link to have a minimum
  Max latency value for SSR, to have better trade off between power
  consumption as well as performance of HID.

Change-Id: I6d60df88ea33e00b0fb173447351da4874dc97e5
CRs-Fixed: 635632

7 years agoHID: Add support for Set Idle and Get Idle commands (2/4)
Hemant Gupta [Tue, 30 Jul 2013 10:41:33 +0000 (16:11 +0530)]
HID: Add support for Set Idle and Get Idle commands (2/4)

This patch adds support for sending set idle and get idle commands to
remote HID device, on receiving the function call from upper layers.
Also on reception of get idle time from remote device, upper layers
are infrmed using registered callback.
Without this support TC_HOS_HID_BV_05/06 PTS test cases for HID 1.0
cannot be passed.

Change-Id: I14bc2dc349354fd87ef8aba25357514398532e87
CRs-Fixed: 522511

7 years agoInitial commit for rfcomm test tool
Srinu Jella [Fri, 29 May 2015 11:33:08 +0000 (17:03 +0530)]
Initial commit for rfcomm test tool

- Initial commit for rfcomm test tool.

Change-Id: I2c00ea88030d6494acb368da08f81be87ef411d7

Rfcomm test tool for rfcomm protocol certification

- Interface provided from BT-If layer to interact
  with rfcomm.

- This tool covers all rfcomm PTS test cases.

Change-Id: I129fbabdbdd80c87f0867c90e472e65bd1611af2

Initial commit for mcap test tool

- Initial commit for mcap test tool

Change-Id: I8657c941603728f6681000a904d96368c6f1f2cc

Initial commit for l2cap test tool

- Initial commit for l2cap test tool

Change-Id: Ia989c59f16d3cb2f314083e4436249f38dc93e7e

Mcap test tool for mcap protocol certification

- Interface provided from BT-If layer to interact
  with mcap

- This tool covers all mcap PTS test cases.

Change-Id: I07f1eb8dc3d98c95b82ee67554c1a846e71c4bfc

L2CAP test tool for L2cap layer certification

- Interface provided from BT-If layer to interact
  with l2cap

- This tool covers all l2cap 4.0 PTS test cases
  whcih includes basic, ertm and streaming mode
  test cases.

Change-Id: Ifacd0b99974c28788926e0f901c37ee2c12ff97b

Bluetooth : Cert tool compilation

Change-Id: I7eaf1ce9ccd2872ba614152ee34f53e6a6fc897b

Qual tools: L2CAP Add support for window size
            MCAP  Delay MDP Handling

Change-Id: Ic7a99e89a956a95a882caa829925cda08d642232

7 years agoBluetooth: Check for NULL String.
Gaurav Asati [Mon, 9 Jun 2014 12:34:10 +0000 (18:04 +0530)]
Bluetooth: Check for NULL String.

When JNI checks are enabled it checks for
NULL, so check for empty string for ATD.

CRs-Fixed: 676866
Change-Id: I8b0cdafeb34737b95041ed6a6ec117fa32effa36

7 years agoDon't unset the HF indicators and S4 Settings for PTS
Satish Kodishala [Thu, 7 Apr 2016 10:26:34 +0000 (15:56 +0530)]
Don't unset the HF indicators and S4 Settings for PTS

PTS Test Case HFP_AG_SLC_BV_10_I failed due to PTS HFP version is 1.5.
If there is HFP Version less than 1.7 we are unsetting the HF indicators
and S4 settings in BRSF.So,regardless of PTS HFP version we should not
unset the HF indicators and S4 settings in BRSF.
Also for HSP Profile some PTS Test cases failed because when there is
HSP connection we are checking for callsetup indicator which were not
present for HSP profile. So,we should check for HFP connection as well
with the call setup Indicator.

CRs-Fixed: 1000512
Change-Id: I61239a187c2f85b759eb3029c47e6c2fe341c16e

7 years agoDynamic HF version change based on remote hf version
Satish Kodishala [Thu, 5 Nov 2015 06:46:12 +0000 (12:16 +0530)]
Dynamic HF version change based on remote hf version

For remote devices supporting HF specification 1.6 or lower,
advertize phone's HF version as 1.6. For remote devices supporting
HF version 1.7, add them to data base and advertize phone's HF
version as 1.7. User need to re-pair HFP version 1.7 devices

CRs-fixed: 934912
Change-Id: Icd6eeea738b19a9ca74214cb33b0bcaebc5f4b9e

7 years agoBluetooth: Implement dynamic blacklist method for role switch
Srinu Jella [Thu, 8 Oct 2015 11:44:16 +0000 (17:14 +0530)]
Bluetooth: Implement dynamic blacklist method for role switch

 - Blacklist the device if it's rejected the role switch for
   max number of times.Same is added to the iot_devlist.conf
   file.

-  Maximum number of failed (BTM_MAX_SW_ROLE_FAILED_ATTEMPTS)
   attempts set to 3 and it is configurable.

-  Same blacklisted device is referred by the BTM module when
   any other module like profile is requesting for role switch
   and BTM module returns BTM_REPEATED_ATTEMPTS as the switch
   role status.

-  There is option to retry for role switch even though the
   device is blacklisted and it can be controlled by feature
   flag BTM_SAFE_REATTEMPT_ROLE_SWITCH. And by default it is
   enabled

CRs-Fixed: 831542
Change-Id: I570e1539578e60901794941ca46f0722e368a954

7 years agoFTP: Add FTP SDP record in Bluedroid stack.
Hemant Gupta [Wed, 8 Jul 2015 18:23:15 +0000 (23:53 +0530)]
FTP: Add FTP SDP record in Bluedroid stack.

Add FTP SDP record registeration in Bluedroid Stack.

Change-Id: I7b3c3d85c5c6a7ac20a0a9361a646d2d494f8fec
CRs-Fixed: 504049

7 years agoHF Client: Handle errors for CGMI, CGMM in the stack
Satish Kodishala [Tue, 6 Oct 2015 15:42:14 +0000 (21:12 +0530)]
HF Client: Handle errors for CGMI, CGMM in the stack

AT+CGMI=? and AT+CGMM=? commands are sent from stack to
the AG in post SLC sequence. We are upstreaming errors
returned from AG for these commands to
HeadsetClientStateMachine. This leads to state mismatch
in state machine.

CRs-fixed: 919514
Change-Id: I4acb32d3c1dd78ba3de3b60fb029268b307199f7

7 years agoHID: Prevent incoming and outgoing SDP collision
Hemant Gupta [Wed, 7 Oct 2015 06:38:10 +0000 (12:08 +0530)]
HID: Prevent incoming and outgoing SDP collision

SDP is performed 2 times as part of HID connection in BD stack,
one after successful authentication, and one in hid stack layer
as sdp data is not stored currently in stack. When there is outgoing and
incoming connections, SDP failed message was posted which was resulting
in SDP failure for hid host resulting in improper disconnection of
hid interrupt channel.

Change-Id: I5b4813dc916696e2c0f76be27a85c1a89c2d8be0
CRs-Fixed: 683139

7 years agoGet AG manufacturer information
Satish Kodishala [Fri, 1 May 2015 14:23:35 +0000 (19:53 +0530)]
Get AG manufacturer information

Added support for AT+CGMI and AT+CGMM commands.
The commands get manufacturer identification and model
information respectively. Commands are sent post SLC
procedure.

CRs-fixed: 844824
Change-Id: Ie556281eebc7b8511d28b2d56f3519cca312e3c6

7 years agoBluetooth: Avoid crash while releasing CCB
Ajay Kumar [Wed, 9 Mar 2016 05:03:33 +0000 (10:33 +0530)]
Bluetooth: Avoid crash while releasing CCB

There are chances that LCB values are not
filled while releasing CCB, putting check
for this ensuring no crash while LCB is NULL.

Change-Id: Iac2fa78d3599431308a030861158efa095bbdbf5
CRs-Fixed: 984983

7 years agoIgnore RFCOMM close event in case of collision
Satish Kodishala [Fri, 10 Jul 2015 09:36:07 +0000 (15:06 +0530)]
Ignore RFCOMM close event in case of collision

When Multi-hf is enabled, if outgoing and incoming to/from
HF collide, ignore RFCOMM close event if HF is already connected.

CRs-fixed: 869792
Change-Id: I1ed5b17de13ed66c2add4c2377949cdffe968c48

Handle unknown codecs sent by HF

Use case:
1. Connect to headset supporting CVSD, mSBC and other codecs.
2. Verify if headset sending AT+BAC with supported codecs.
3. Check if SCO is established with mSBC codec.

Failure:
SCO is established with CVSD codec.

Root cause:
When parsing AT+BAC command, if unknown codec is received,
we are falling back to CVSD although mSBC is supported in HF.

Fix:
AT+BAC parsing function modified to return correct codecs
supported by HF when it encounters unknown codecs in arguments
of AT+BAC.

CRs-fixed: 861222
Change-Id: Ibc6a72b749280dc70a355270f37f4316468c1a4f

Clear remote BD address if SDP search fails

Use case:
1. Enable multi hf.
2. Pair and connect to a headset.
3. Turn off headset and try connecting to headset from AG.
4. After the connection fails, turn on headset.
5. Make sure headset initiates HF connection to AG.
6. Make MO/MT call, switch from headset to AG, vice versa using headset.

Failure:
When call is transferred from AG to headset, headset initiated
SCO connection request is rejected by AG.

Root cause:
For outgoing connection in step 3, SDP search fails. BD address of
remote headset is stored in scb[0]. BD address of headset with which
we tried to connect is not cleared in scb[0].

When incoming HF connection request is accepted in step 5, BD address
of headset is stored in scb[1]. Now, BD address of the same headset is
stored in both scb[0], scb[1].

When SCO connection request is received from headset, we get scb
information using BD address. However, since BD address in scb[0]
is not cleared, we end up selecting scb[0] for which there is no
headset connected. This makes us think that remote is initiating
SCO connection without SLC and we reject the SCO connection.

Fix:
Clear the BD address of remote when SDP search fails.

CRs-fixed: 861209
Change-Id: Iff3e1f2a25988c3eb55d6914cae6ac8427a7e211

BT: HFP1.7: Do not upstream invalid BIND set event.

Incase remote HS sends incorrect BIND set command during
SLC, do not upstream the event to BT apps to avoid disconnection.

Change-Id: Ie2d52a97ab179174e219ebe0c17f9d1f66545367
CRs-Fixed: 809572

Do not reset SSR parameters on SCO link.

When Headset is connected during active call, HFP is connected
first. Due to active call SCO is also established, when SCO is
established we disable SSR. When a2dp is connected after SCO
connection it enables SSR. This enabling of SSR is causing ACL
disconnect.

When there is new profile connection on same device which has SCO
we should not enable SSR. It should be enabled only when there
is no SCO.

Change-Id: I25263a148a13136174a67867a822ba3497a11f8e

7 years agoGAP: Accept incoming connection with slave role
venkata Jagadeesh [Thu, 26 Jun 2014 06:25:41 +0000 (11:55 +0530)]
GAP: Accept incoming connection with slave role

-Define DUT Default desired role as master

-Accept incoming connection with DUT role as slave for
list of carkits and headsets which are blacklisted.

Change-Id: Ie6af63b50debd417ce2d54b28b83d95ef4f695a6
CRs-Fixed: 892194

Bluetooth: GAP: Disallow roleswitch for blacklisted devices

Set link policy to disallow role switch for blacklisted devices
as some devices not starting encryption after role switch
and a2dp connection getting delayed for some devices due to role switch

Change-Id: I75a20b5cda9c4b46d118b12de373c99a25f72012
CRs-Fixed: 892242

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

Change-Id: I41bd78f1d25f1fc2985f1cf226a54d6819be968b

7 years agoBluetooth: Add support to send h/w error event
Srinu Jella [Mon, 21 Sep 2015 13:59:50 +0000 (19:29 +0530)]
Bluetooth: Add support to send h/w error event

- Bluedroid stack needs to be reset whenever H/w
  chip restarts like Subsytem restart.

- Emulates the hardware error event on detecting
  SSR event from PR controller.

CRs-Fixed: 914079
Change-Id: I9248a4e6ad689fc590fd4fd0f7a067cd33bf314f

Bluetooth: Reset bluetooth status to download NVM tags

- Reset bluetooth status to download the NVM tags once
  the SSR is detected.

- NVM tags downloaded only once for the first BT on and
  downloaded again in case of SSR or command timeout.

- Without this change, there would be diffrence in
  BD addr which would lead to pair/connection issues.

CRs-Fixed: 932195
Change-Id: I75a44e7ae7d301ff1c9be8349c1b51d4c80cbf36

BT: Adding check for packet size before allocating buffer

During controller reset, corrupted packet might reach
to host. This packet might indicate length value more
than maximum allowed packet length. This causes crash
during buffer allocation.
Added the correct length check before allocating the
memory.

CRs-Fixed: 978009
Change-Id: I462b9b18e4c9db67d4860509376b0cb38830e56d

BT: Rectify the method to reset host after controller crash

Use case: When controller is forcefully crashed for testing,
the host process should reset itself.

Steps: Testing envolving forceful crashing of controller
to observe recovery and behavior of host in such events.

Failure: Once controller crash was enforced, the host
process was not resetting itself.

Root cause: The packet created to send hw reset event to
stack was getting truncated.

Fix: Changed the logic to first create an empty packet and
later set its type and data to make hw reset event.

CRs-Fixed: 1000446

Change-Id: Ied4e62db0be5bb8e16fac05787b9a071fd86b1e7

7 years agoAdd few logs for phone state change updates
Satish Kodishala [Tue, 18 Aug 2015 13:57:39 +0000 (19:27 +0530)]
Add few logs for phone state change updates

Added few logs to get the phone state updates from Telephony.

CRs-fixed: 751733
Change-Id: Ic5553e08f0584fef0705386ba96e0fa852676ba3

7 years agoBluetooth: Add support to read BD address from bt_nv.bin
Srinu Jella [Wed, 7 Oct 2015 12:31:53 +0000 (18:01 +0530)]
Bluetooth: Add support to read BD address from bt_nv.bin

- Add support to read BD address from bt_nv.bin if no
  other BD address is available from other mechanism.

- If the ro.boot.btmacaddr property is set, it will
  prioritize this property over bt_nv.bin.

CRs-Fixed: 921979
Change-Id: I8a0d38be7adb93db95eb3618a8f6af4030adf373

7 years agoHandling Authentication Failure From the lower layer
Matadeen Mishra [Wed, 23 Sep 2015 16:56:46 +0000 (22:26 +0530)]
Handling Authentication Failure From the lower layer

Use case: DUT unable to do connect with all devices in
Multipairing case.

Steps:
1. pair with HS
2. disconnect HS.
3. reconnect HS from DUT.

Failure: Authentication failure occurred due to LMP
transaction collision DUT not deleting link key which
lead to unable to connect to device.

Root Cause: Not posting the Authentication failure
event to application layer, while removing the link-key.

Fix: Post the Authentication failure event to application
and removing the link-key.

Change-Id: I079d8ce89c1fea66f0624127514cec8405bfdd3d

Add null check to avoid exception after L2CAP psm assigned

Use case: BT will get crash in SNS testing.

steps: SNS testing BT ON/OFF.

Failure: Crash is observed.

Root Cause: If the number of supported services increased,
larger service record array is required. Smaller array is
resulting in out of record error causing L2CAP deregister.

Fix: Check added to avoid null pointer exception if null
is returned while fetching sock from id. Also cleanup of
SDP and security records done during BT turning Off.

Change-Id: I2e77127262119cabf2c372f894427dcdf3350e80

Prevent crash due to second attempt to clean up eager_reader

Null out the eager readers once they are cleaned up, so we
don't try to clean them up later if an error occurs opening
the HAL again later.

Change-Id: I07df1010a1a619cb67b306d64e274d450234a002

Remove bonded device information on pairing rejected

Use Case: Remove bonded device information from the BTIF layer storage
when authentication failed.

Failure: Remote device appeared in the paired list after authentication
failed.

Steps:
1. Create a connection from DUT to remote.
2. Remove linkkey in remote.
3. Create connection from DUT to remote, which is in paired list of
DUT, Remote rejected the connection and authentication failed.
But after BT OFF/ON, remote device appeared in the paired list

Root Cause: Not removing device if remoted rejected the pairing
request with reason pairing not allowed

Fix: Remove bonded device information from the BTIF layer storage
on rejected with pairing not allowed reason from remote

Change-Id: Ic9e5e1ed70d304edd3dbca82a73833753fa0093c

GAP: Save pin code length for incoming legacy SAP connection

Use case: Carkit cannot reconnect to DUT in Sim Access Profile mode

Steps:
1. Pair with a car-kit (Agree all SAP, MAP, PBAP requests)
2. Initiate disconnection on DUT
3. Initiate re-connection on the car-kit.

Failure: SAP profile reconnection failing as dut gives negetive
linkkey reply.

Root Cause: sec_flags not getting updated without pin len and stack
triggering negative link key reply even linkkey is proper for 16 digit
authentication of SAP.

Fix: Save pin length during BTM_PINCodeReply.

Change-Id: I8300dd3ff497058291143313b169190910e0a7c5

Ignore pairing not allowed error when pairing in progress

Use case: Pairing with both devices fails, when there is
clash of pairing from 2 devices

1. Create a link from Test tool to DUT. Remove bonding info in Test tool.
2. Create a link from DUT to magic mouse. Unpair the link from DUT.
3. Click on magic mouse, it creates a link, and we get a pairing
   pop-up in DUT.
4. Try to pair from Test tool to DUT.

Failure: Pairing with mouse should success and other pairing
should fail. But both pairing fails

Root cause: Stack sending pairing not allowed error to upper layers
for the second device when already pairing is in progress with
some other device, which is impacting the existing pairing.

Fix: Issue fixed by Ignore pairing not allowed error for the
second device when already pairing is in progress with some
other device.

Change-Id: I20dbd70e7429505a580c9a20d40a8d92318f6c3e

Handled delayed info response from remote during SDP

Use case: DUT is not connecting to windows-7 tablet

Failure: Connection is not successful with windows-7 tablet.

Steps:
1. Turn on BT on DUT
2. Pair and connect from remote device.

Root Cause: DUT initiates connection with out waiting for
information response from remote device during SDP.

Fix: DUT will not wait for information response from the
remote during SDP.

Change-Id: Iee0251f8f81923b1291983b66b31c78e14d21af0

GAP: Update Paging and inquiry busy level seperately

Use case:  Bluetooth Search Fail while ACL disconnection.

Steps:
1. Headset(HBS 760) connect
2. Put Headset off
3. BT Search Fail.

Failure: BT search fail after disconnected Headset.

Root cause: While updating the busy level of Paging or inquiry '10'
was used as BL for paging and inquiry,this leads to
1. Ignore the one of them when both of them are active.
2. During ACL disconnection, unexpected inquiry busy level update.

Fix: Sending unique busy level for paging related events and inquiry
related events, so that each event will be notified.

Change-Id: I7bddcb4901061c450555235717b7d49bab922ae8

GAP Write 248 char name length to the chip while BT ON/OFF

Use case: Remote device cannot see local name with 248 chars.

steps:
1. Turn on BT (Default name will come)
2. Change local name to 248 chars
   make sure DUT can be successfully searched from remote device.
3. Turn off BT (or phone reboot)
4. Turn on BT

After step.4, the 248 chars name comes to GUI on MTP. However
device search from remote device having DUT "Default name".

Failure: Remote device cannot see local name with 248 chars.

Root cause: DUT not supporting for the 248 char local name

Fix: Writing the exact 248 character local name to the chip

Change-Id: I702af8fa8d0affda509de7a9f17af8922e410286

Failed to re-register APK Configuration for HDP

Use case: register/unregister HDP from third party APK

Test Steps:

1.Install Any Test APK which internally registers/unregister the HDP.
2.Run Test APK.
3.Do initialization of Test APK which internally registers the HDP.
4.Force stop the Test APK.
5.And rerun the APK by going back test APK menu.
6.Now it never perform the re-register the HDP as part of initialization.

Root Cause: HDP registration related counter write operations are done
in JNI main thread, and it's been referenced in BTIF thread.Sometimes,
if the context switch to BTIF thread doesn't happen immediately after
counter increment/decrement, it may not un-register the app if the
counter becomes 0.

Fix: Fixed it by making all operations related to counter in BTIF
thread, so that de-registration happens for all HDP APPs.

Change-Id: I71ace68a5f3d39d81b646f5f40c02ce56b9e93f0

Added check for hci_layer status before processing function calls

Use case: BT will get crash in SNS testing.

Steps: SNS testing BT ON/OFF.

Failure: Crash is observed.

Root Cause: 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.

Fix: Added check within functions to check for hci_layer state
before processing.

Change-Id: I8dbca9893e03dfc500886c5033a79976dc5d23e1

Group BR-EDR related SDP variables under transport

Use Case: Random RNR initiated after HOGP Keyboard disconnection.

steps:
1. keep madcatz in advertisement mode and scan, pair from DUT.
2. keep dailog Keyboard in advertisement mode and scan, pair from DUT.
3. Take Keyboard out of range to initiate disconnection from remote
or initiate disconnection from remote.

Failure: DUT trying to do RNR to random device.

Root Cause: when the disconnection happened for LE device, it sets
the wait_disc to true, that is causing random RNR to go for BR-EDR
device.

Fix: Group all BR-EDR related SDP variables under transport check
so that if some other operation on LE will not corrupt these BR-EDR
variables to mislead.

Change-Id: Ic9003f2b85bbaaa30b201b8a639a9d9b52055ac5

7 years agoEnable AVRCP TG feature only when A2dp source is enabled
Anubhav Gupta [Tue, 5 May 2015 12:18:24 +0000 (17:48 +0530)]
Enable AVRCP TG feature only when A2dp source is enabled

  - Drop Control, Meta and Browse commands when TG is not up.
  - Not to call AVRCP app callbacks when mentioned service is down.
  - Advertise AVRC CT category 2 support in CT SDP record.

Change-Id: Ib54c104e87c735b55d6c6ec07c08d2149acc1a6d

7 years agoReject Metadata command with invalid length
Anubhav Gupta [Wed, 21 May 2014 14:33:00 +0000 (20:03 +0530)]
Reject Metadata command with invalid length

This change ensures that DUT rejects AVRCP Meta command
having invalid data length to avoid crash while processing
the invalid command further.
This crash was seen while running codenomicon test suit.

Change-Id: I8a591d601636a0fce268b5b965f2bd691c24c319

7 years agoEnable incoming connection for AVRCP Controller
Anubhav Gupta [Tue, 5 May 2015 14:54:47 +0000 (20:24 +0530)]
Enable incoming connection for AVRCP Controller

 - Start listening for incoming AVRCP connection if we have
   only AVRCP Controller
 - Update default peer_features based on feature mask. In case
   of incoming AVRCP connection, SDP will be done later.
   In such a scenario default peer features sent to btif should
   be based on  features-set selected during initialization.

Change-Id: Ied8ac0673288a4423bd41500985366ddc2c567a8

7 years agoInitiate Sniff on A2DP/HFP links
Anubhav Gupta [Tue, 24 Sep 2013 06:01:16 +0000 (11:31 +0530)]
Initiate Sniff on A2DP/HFP links

With Plantronics headsets it has been seen that sometime
it takes upto 30s to initiate SNIFF. With these devices
ACL is in active mode for that duration. Though there is
no user observable impact but power consumption will
be more as link does not go to SNIFF.

Changes are done in Handsfree Power Manager table such that
once Handsfree PM state Machine goes to idle state, SNIFF
timer is started. In addition to that extra power mode entry
for AV is avoided by passing correct app_id to sys methods.
This avoids sending app_open from SDP for A2DP. Instead uses
conn_open while starting SDP and conn_close on SDP complete.

Change-Id: I25608db3e2b8cfe8f44b10894d5d3a7388b54ed5

7 years agoHandle Disconnect request in Opening State.
c_sdamga [Mon, 20 Jul 2015 13:47:04 +0000 (19:17 +0530)]
Handle Disconnect request in Opening State.

When A2dp is unchecked from settings UI and remote has
initiated a2dp connection and initiated AVRCP play music
gets started on DUT. Since A2dp connection is disconnected
music continues to play on DUT.

As A2dp connection was not completed, btif state was still
in opening state.Hence handle disconnect in opening state
so that we disconnect A2dp before AVRCP cmd is processed

Change-Id: If1cda5b78100419fdc60c97349efafdd4a18d40c

7 years agoBT:[1/3]Send VSC to SOC for VOIP connectivity network type.
Sumit Bajpai [Tue, 9 Jun 2015 12:55:20 +0000 (18:25 +0530)]
BT:[1/3]Send VSC to SOC for VOIP connectivity network type.

- Handle voip network type wifi command from BT app.
- Prepare VSC in BTIF.
- Handle command complete for VSC.

CRs-Fixed: 821566
Change-Id: Ia74e1f0f1e0fb37f952b736b1546ed2de5aee5af

7 years agoBluetooth: update both connected HS.
Gaurav Asati [Tue, 18 Aug 2015 13:39:57 +0000 (19:09 +0530)]
Bluetooth: update both connected HS.

 - When VR is launched/closed from connected HS, update other
   HS for VR state change.
 - When VR is launched/closed from UI, update both connected
   HS for VR state change.

Change-Id: I652557abe6983e60b7d2ace305b5418f4fba3c70

7 years agoRead HFP version property on BT4.0 or older BT devices
Satish Kodishala [Fri, 31 Jul 2015 13:09:01 +0000 (18:39 +0530)]
Read HFP version property on BT4.0 or older BT devices

If reading local supported codecs command is not supported,
read HFP version property to set MSBC codec.

Change-Id: Ifc44d1b63e454c8c0212eca47d763c6bb16e2034

7 years agoBT-HFP: HFP1.7 AG support in bluedroid
Sumit Bajpai [Fri, 9 Jan 2015 09:19:00 +0000 (14:49 +0530)]
BT-HFP: HFP1.7 AG support in bluedroid

Added HFP 1.7 support in BT stack.

CRs-fixed: 715684
Change-Id: I315c723cb956a566a8c248a34959a18d177d166e

7 years agoEnable WBS
Satish Kodishala [Wed, 22 Jul 2015 10:27:31 +0000 (15:57 +0530)]
Enable WBS

Enable compile time flag BTM_WBS_INCLUDED in the stack to enable
the WBS codec negotiation code in the stack.

All changes in stack are guarded using BLUETOOTH_QCOM_SW feature flag.

Initiate codec negotiation process only for those remote
devices which support it

start codec negotiation procedure after AT+BCC command is received from HF
requesting to start codec negotiation.

SCO state machine moves to proper state to reinitiate SCO connection.
Avoid sending codec negotiation for HF devices not supporting
WBS in such error cases.

CRs-fixed: 878963
Change-Id: Ia3641bfad60b4087cf99250a7ea190ec700547bf

7 years agoAG: Clear the memory before using it
Satish Kodishala [Fri, 5 Feb 2016 07:05:54 +0000 (12:35 +0530)]
AG: Clear the memory before using it

Initialize memory with 0s before copying the arguments
of AT commands received from headset. If buffer is not
initialized to 0s, when we encounter any unknown character
while parsing the arguments, we return error.

CRs-Fixed: 972767
Change-Id: Ia107ccd140b7bbc9e5963920d34fad22664c7519

7 years agoAvrcp: Do not initialize transactions if cleanup done already.
Sumit Bajpai [Wed, 16 Sep 2015 13:08:43 +0000 (18:38 +0530)]
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

7 years agoDisconnect AVRCP if A2DP does not connect to same device
Ayan Ghosh [Thu, 29 Jan 2015 12:04:48 +0000 (17:34 +0530)]
Disconnect AVRCP if A2DP does not connect to same device

Disconnect existing AVRCP if A2DP connects to other peer device.
This fix is required as we do not have separate UI to disconnect
AVRCP profile. So unless AVRCP is disconnected this way this orphan
connection will exist for ever.

Change-Id: I1113de2d40e7596095fd7e7fbca600dfaf0b551e

7 years agoSynchronize encoder init and encoder update
Ayan Ghosh [Wed, 6 Aug 2014 10:34:42 +0000 (16:04 +0530)]
Synchronize encoder init and encoder update

Ensure encoder init and encoder update are executed
from same BTIF context which ensures sequential
execution of encoder init and update functions.

Change-Id: I0945737497f87e450a6c9959eb5f163e932db7d4

7 years agoIncrease number of semaphores for media workqueue
Ayan Ghosh [Thu, 3 Mar 2016 13:04:48 +0000 (18:34 +0530)]
Increase number of semaphores for media workqueue

As mediatask allows only 128 pending workqueue enqueue semaphores
to be created hence on Suspend confirm delay alarm callbacks run
out of that semaphore count and 129th instance of it gets blocked
and corresponding alarm_callback gets stuck.
Now later on receiving suspend ack, mediatask goes for freeing the
media alarm which eventually waits for pending callback to come out.
But as that never happens as callback is stuck so eventually mediatask
also gets blocked and SUSPEND ACK to Audio HAL also gets blocked.
So this phenomenon eventually leads to deadlock and later whosoever
tries to make use of audio therad runs into ANR.

This fix ensures that the current proposed value of semaphore/ workqueue
element cound is made so big that is capable of handling delay of 15s
(Max delay entertained for any AV signalling commands) for
suspend confirm case.

Change-Id: I917e2e0651cfc93837c483cd6f4f94d8aa933fa8

7 years agoHFP-AG: Cleanup when incoming and outgoing connections collide.
Satish Kodishala [Mon, 16 Nov 2015 17:16:51 +0000 (22:46 +0530)]
HFP-AG: Cleanup when incoming and outgoing connections collide.

- When incoming and outgoing connections from/to same device collide,
  clean up outgoing path after incoming connection is accepted.

- Abort outgoing connection to the same device if collision is detected
  before making RFCOMM connection.

- Choose the connected device to send response for AT commands.

Change-Id: If5c86356ce0496ab63d6445257bdc1977d2cb56b

7 years agoBluetooth: Enable WBS for HFP 1.6 and above
Gaurav Asati [Tue, 5 May 2015 10:46:15 +0000 (16:16 +0530)]
Bluetooth: Enable WBS for HFP 1.6 and above

 - Enable WBS feature for HFP versions 1.6 and above

Change-Id: I971e5c89e31142c4aec84aae9b92c0e26a00800e

7 years agoAG: Check MT call setup state before starting ring timer
Satish Kodishala [Wed, 13 Jan 2016 13:53:04 +0000 (19:23 +0530)]
AG: Check MT call setup state before starting ring timer

If the MT call is accepted, we should not send ring to
connected headset. If ring timer expires at the same time
when the call gets accepted, we end up stopping and starting
the ring timer.

CRs-Fixed: 961730
Change-Id: I84fe460318a0c10a90a89979e3e0e0ba4fdaa0bd

7 years agoBluetooth: Update hf structure on phone state change only if SLC is up
Bhakthavatsala Raghavendra [Wed, 23 Sep 2015 21:28:27 +0000 (14:28 -0700)]
Bluetooth: Update hf structure on phone state change only if SLC is up

Update hf structures on phone state change only if the perticular
SLC is connected. Updating it regardless of the states causes hf state
to indicate wrong status

CRs-fixed: 913024

Change-Id: I360677306b46e914f939b9034305d4b89dabd79b

7 years agoBluetooth: Proper removal of item from connect queue in AG
Bhakthavatsala Raghavendra [Wed, 2 Sep 2015 23:27:42 +0000 (16:27 -0700)]
Bluetooth: Proper removal of item from connect queue in AG

Remove the connect queue item when RFCOMM connection for HFP is
up instead of while SLC is up, so that Profile state machine
wouldn't allow simultaneous CONNECT requests

Change-Id: Ie913f552d428d40fae1f8cded169c1cc49c822c8

7 years agoMove SCO state properly
Mallikarjuna GB [Tue, 23 Jun 2015 12:00:03 +0000 (17:30 +0530)]
Move SCO state properly

Due to sudden SCO disconnect along with ACL disconnect,
DUT's SCO state didn't move to proper state.Due to this,
next attempts to open SCO is failed and user was not
able to route call audio to BT headset.

This change attempts to handle this bad behaviour from
the remote and makes sure that SCO state is proper.The
change calls sco disconnection callback even in collision
case to allow SCO statemachine move to proper state.

Change-Id: I077b4b9c795bb8130bde5fe1cff98c88d570de44

7 years agoBT: Initializing the SDP event message pointer before sending
Manu Viswanadhan [Tue, 7 Jun 2016 10:51:18 +0000 (16:21 +0530)]
BT: Initializing the SDP event message pointer before sending

In case of SDP_ServiceSearchAttributeRequest failure, garbage value
might be sent for discovery result structure, leading to crash.
Initializing the structure to zero to avoid this scenario.

Change-Id: I46d92d6262bae3b5def5401270465a3a06468c1a
CRs-Fixed: 1023388

8 years agomerge in nyc-release history after reset to nyc-dev
The Android Automerger [Tue, 28 Jun 2016 07:04:16 +0000 (00:04 -0700)]
merge in nyc-release history after reset to nyc-dev

8 years agoAdd Subaru and Nissan car kits to auto pair blacklist
Andre Eisenbach [Mon, 27 Jun 2016 22:49:53 +0000 (15:49 -0700)]
Add Subaru and Nissan car kits to auto pair blacklist

Bug: 29157087
Change-Id: If227963b939a9b0ed55e6d900364c71932d3cfe8

8 years agomerge in nyc-release history after reset to nyc-dev
The Android Automerger [Sun, 26 Jun 2016 07:04:02 +0000 (00:04 -0700)]
merge in nyc-release history after reset to nyc-dev

8 years agoA2DP media task: Flush full TX queue on congestion
Andre Eisenbach [Thu, 23 Jun 2016 23:14:53 +0000 (16:14 -0700)]
A2DP media task: Flush full TX queue on congestion

Currently, our TX queue does not allow for quick recovery of minor
congestion. As we only clear as much room in the queue as is needed to
fix the news frames needed for a given timer tick, any minor congestion
on the TX path can result in single frames to be dropped over an
excessively long amount of time.

From the "just rip the band-aid off" school of thought, drop the whole
queue instead to cause a single drop-out on congestion and catch up to
the live stream immediately, hoping that the stream recovers...

Bug: 29601962
Change-Id: I482c3cfef6d8b51143e54733eb2da5f70663636f

8 years agoMerge "Remove SBC frame scrambling" into nyc-dev
Andre Eisenbach [Fri, 24 Jun 2016 17:16:52 +0000 (17:16 +0000)]
Merge "Remove SBC frame scrambling" into nyc-dev

8 years agoRemove SBC frame scrambling
Andre Eisenbach [Thu, 23 Jun 2016 22:25:44 +0000 (15:25 -0700)]
Remove SBC frame scrambling

Bug: 29601962
Change-Id: I30ce09f1c7550a1be9fd1c8ed70745f9aa0cdb44

8 years agoRemove log spam in btif_gattc_update_properties
Andre Eisenbach [Thu, 23 Jun 2016 21:22:35 +0000 (14:22 -0700)]
Remove log spam in btif_gattc_update_properties

Bug: 29601962
Change-Id: I4a86b786609b0203a72b750a1c4a38c82fcc5f97

8 years agoresolve merge conflicts of 1f433cb to mnc-dr-dev am: f15ca6d21d -s ours am: 8e80a26078
Sharvil Nanavati [Wed, 22 Jun 2016 01:19:12 +0000 (01:19 +0000)]
resolve merge conflicts of 1f433cb to mnc-dr-dev am: f15ca6d21d  -s ours am: 8e80a26078
am: edb7ce120e

Change-Id: Ie7ea41474e11479b54ba526294977dfaa60c8cd7

8 years agoresolve merge conflicts of 1f433cb to mnc-dr-dev am: f15ca6d21d -s ours
Sharvil Nanavati [Wed, 22 Jun 2016 01:16:24 +0000 (01:16 +0000)]
resolve merge conflicts of 1f433cb to mnc-dr-dev am: f15ca6d21d  -s ours
am: 8e80a26078

Change-Id: I54a690024ccd316058d9d59ff7b16206f7fcd543

8 years agoresolve merge conflicts of 1f433cb to mnc-dr-dev
Sharvil Nanavati [Wed, 22 Jun 2016 01:13:44 +0000 (01:13 +0000)]
resolve merge conflicts of 1f433cb to mnc-dr-dev
am: f15ca6d21d  -s ours

Change-Id: Ic1a23e2c6d0284b9fdf346a681f59cdcbaa599e0

8 years agoresolve merge conflicts of 1f433cb to mnc-dr-dev
Sharvil Nanavati [Tue, 21 Jun 2016 22:56:42 +0000 (15:56 -0700)]
resolve merge conflicts of 1f433cb to mnc-dr-dev

Change-Id: I7278875d21c59316217cb1b99d902f4fc248ca06

8 years agoDO NOT MERGE Fix potential DoS caused by delivering signal to BT process
Sharvil Nanavati [Tue, 21 Jun 2016 02:16:12 +0000 (19:16 -0700)]
DO NOT MERGE Fix potential DoS caused by delivering signal to BT process

Bug: 28885210
Change-Id: I63866d894bfca47464d6e42e3fb0357c4f94d360

8 years agomerge in nyc-release history after reset to nyc-dev
The Android Automerger [Tue, 21 Jun 2016 07:03:55 +0000 (00:03 -0700)]
merge in nyc-release history after reset to nyc-dev

8 years agoL2CAP: Handle invalid HCI packets
Matadeen Mishra [Wed, 3 Feb 2016 12:43:39 +0000 (18:13 +0530)]
L2CAP: Handle invalid HCI packets

- Handled Buffer over flow for uint16_t
- 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.

Bug: 29498064
Change-Id: I6f93c80244fc39d607ad285185136bbbca83d7ae

8 years agomerge in nyc-release history after reset to nyc-dev
The Android Automerger [Sun, 19 Jun 2016 07:05:37 +0000 (00:05 -0700)]
merge in nyc-release history after reset to nyc-dev

8 years agoAdd missing NULL pointers assignments
Pavlin Radoslavov [Thu, 16 Jun 2016 23:37:57 +0000 (16:37 -0700)]
Add missing NULL pointers assignments

Each pointer that was freed by one of the following functions should
be reset to NULL:
 - config_free()
 - data_dispatcher_free()
 - fixed_queue_free()
 - list_free()

Bug: 29421693
Change-Id: Ie55a04ed986393994564edcf872d7413b0767a85
(cherry picked from commit 8cbc291080730cd7d04990a8fc0e11249b06aa08)