OSDN Git Service

android-x86/system-bt.git
9 years agoLE: Fix random address resolution when done in the stack
Andre Eisenbach [Sun, 3 Aug 2014 22:57:06 +0000 (15:57 -0700)]
LE: Fix random address resolution when done in the stack

If the local device does not support random address resolution in the
Bluetooth chip, it has to be performed in the host stack. This patch
fixes some instances where address resolution was not performed
properly, causing device reconnection to fail.

Change-Id: Ifb84a9fa44995caa3680d9a0b4248ef911eb9ad0

9 years agoupdate test to build and run with latest BT HAL
Thierry Strudel [Fri, 1 Aug 2014 05:53:46 +0000 (22:53 -0700)]
update test to build and run with latest BT HAL

Change-Id: I497ac4649081a3244549e067fe6d5181ee2f7b2a
Signed-off-by: Thierry Strudel <thierry.strudel@intel.com>
9 years agoADV data override issue
Satya Calloji [Thu, 31 Jul 2014 20:18:40 +0000 (13:18 -0700)]
ADV data override issue

Setting scan response overrides advertiseData

Bug 16577710

Change-Id: I5ca28568495c8e487648a5f36d945e4443cba639

9 years agoAdded function headers.
Mudumba Ananth [Wed, 30 Jul 2014 06:17:41 +0000 (23:17 -0700)]
Added function headers.

-> Added function headers to bta_hh_le_read_battery_level_descr_cmpl
   and bta_hh_le_find_service_inst_by_battery_inst_id.

Bug: 16560957

Change-Id: I1f9867f397e4bb4a848a42ac8547016e8b36898c

9 years agoMerge "Unnecessary l2cap idle timer is being restarted everytime mode change to activ...
Andre Eisenbach [Wed, 30 Jul 2014 23:58:51 +0000 (23:58 +0000)]
Merge "Unnecessary l2cap idle timer is being restarted everytime mode change to active" into lmp-dev

9 years agoUnnecessary l2cap idle timer is being restarted everytime mode change to active
Mudumba Ananth [Fri, 4 Jul 2014 06:51:38 +0000 (23:51 -0700)]
Unnecessary l2cap idle timer is being restarted everytime mode change to active

Bug: 16560957
Change-Id: I543cab003dbf2be9e5f63667f32bdeb78d1d56d1

9 years agoTx power is 0 in ADV packet
Satya Calloji [Tue, 29 Jul 2014 22:32:51 +0000 (15:32 -0700)]
Tx power is 0 in ADV packet

b/15412969 Tx power is always 0 in advertising packet

Change-Id: I7eb1f16b5fb1ab4ed669ba6a72f9603885cebc99

9 years agoam 83970699: (-s ours) am 8d502374: commit 001ccea74ec61b1be00c8ede827f55c0359d1051...
Dmitry Grinberg [Wed, 30 Jul 2014 00:49:44 +0000 (00:49 +0000)]
am 83970699: (-s ours) am 8d502374: commit 001ccea74ec61b1be00c8ede827f55c0359d1051 Author: Nitin Shivpure <nshivpur@codeaurora.org> Date:   Tue Jun 17 16:29:18 2014 +0530

* commit '839706997f7c16a67d4dcc70889f2e1a934a5da2':
  commit 001ccea74ec61b1be00c8ede827f55c0359d1051 Author: Nitin Shivpure <nshivpur@codeaurora.org> Date:   Tue Jun 17 16:29:18 2014 +0530

9 years agoMerge "Service change indication is not sent to a bonded remote device sometimes...
Andre Eisenbach [Wed, 30 Jul 2014 23:55:52 +0000 (23:55 +0000)]
Merge "Service change indication is not sent to a bonded remote device sometimes" into lmp-dev

9 years agoService change indication is not sent to a bonded remote device sometimes
Mudumba Ananth [Fri, 4 Jul 2014 06:56:42 +0000 (23:56 -0700)]
Service change indication is not sent to a bonded remote device sometimes

-> The service change indication was requested before
   GATT profile finished processing the connection callback.
-> Sending service change indication after
   profile connection is up solves the problem.

Bug: 16560957
Change-Id: I99dd7528883efbedcbf785132fe6aaa3aea5b42c

9 years agoMerge "ADV flag is missing LE discoverable flag" into lmp-dev
Andre Eisenbach [Wed, 30 Jul 2014 23:53:17 +0000 (23:53 +0000)]
Merge "ADV flag is missing LE discoverable flag" into lmp-dev

9 years agoADV flag is missing LE discoverable flag
Mudumba Ananth [Fri, 4 Jul 2014 09:46:05 +0000 (02:46 -0700)]
ADV flag is missing LE discoverable flag

ADV flag is missing LE discoverable flag when setting device in
general discoverable mode. Device discovery mode is masked off
by a wrong flag that cause the problem. Use the correct discoverable
mask will solve this problem.

Bug: 16560957
Change-Id: Ic11d1497d38dedfea6feeaa84f36aed90590939c

9 years agoMerge "Execute Write Response shall be sent after the attributes are written" into...
Andre Eisenbach [Wed, 30 Jul 2014 23:47:14 +0000 (23:47 +0000)]
Merge "Execute Write Response shall be sent after the attributes are written" into lmp-dev

9 years agoExecute Write Response shall be sent after the attributes are written
Mudumba Ananth [Fri, 4 Jul 2014 10:45:11 +0000 (03:45 -0700)]
Execute Write Response shall be sent after the attributes are written

Bug: 16560957
Change-Id: I085a2218644615bc13f5a0d0d78fc2afe0605a04

9 years agoMerge "Update simultaneous LE BR/EDR host support bit for 4.1 controller and 4.1...
Andre Eisenbach [Wed, 30 Jul 2014 23:43:00 +0000 (23:43 +0000)]
Merge "Update simultaneous LE BR/EDR host support bit for 4.1 controller and 4.1 stack" into lmp-dev

9 years agoIncorrect data type in local LE features
Satya Calloji [Wed, 30 Jul 2014 05:08:55 +0000 (22:08 -0700)]
Incorrect data type in local LE features
bt_local_le_features_t of wrong size

b/16653133

Change-Id: I81da7f8c6b9151b8def8d4e3c655cf746d0e3db9

9 years agoUpdate simultaneous LE BR/EDR host support bit for 4.1 controller and 4.1 stack
Mudumba Ananth [Fri, 4 Jul 2014 06:42:34 +0000 (23:42 -0700)]
Update simultaneous LE BR/EDR host support bit for 4.1 controller and 4.1 stack

Need to set simultaneous LE BR/EDR host support bit when BTE DMT included stack or newer version
running on top of 4.1 controller.

Bug: 16560957
Change-Id: I3e2827dbaf8b4259d4f00f14b1a5f587e4424bdc

9 years agoMerge "Cannot resolve RPA from a DUMO device when being a peripheral device" into...
Andre Eisenbach [Wed, 30 Jul 2014 23:38:19 +0000 (23:38 +0000)]
Merge "Cannot resolve RPA from a DUMO device when being a peripheral device" into lmp-dev

9 years agoCannot resolve RPA from a DUMO device when being a peripheral device
Mudumba Ananth [Fri, 4 Jul 2014 10:19:07 +0000 (03:19 -0700)]
Cannot resolve RPA from a DUMO device when being a peripheral device

Stack needs to allow DUMO devie to use RPA per 4.1 spec requirement.

Bug: 16560957
Change-Id: I8af5cade6dbd2da04aa05a4aa66663a767678d00

9 years agoWhen HOGP reconnection fails, it will lose all cached HID report
Mudumba Ananth [Fri, 4 Jul 2014 09:57:49 +0000 (02:57 -0700)]
When HOGP reconnection fails, it will lose all cached HID report

When HOGP reconnection fails, it will lose all cached HID reports.
This will cause the following connection report all HID reports as
unknown reports, can not recover until rebond the device.
Make sure to remove cached reports only if open
fails during HID report discovery process.

Bug: 16560957
Change-Id: Ib23adad4a2721acabb5129779c0e9f2ff30d5e39

9 years agoam 8d502374: commit 001ccea74ec61b1be00c8ede827f55c0359d1051 Author: Nitin Shivpure...
Dmitry Grinberg [Tue, 29 Jul 2014 20:16:42 +0000 (20:16 +0000)]
am 8d502374: commit 001ccea74ec61b1be00c8ede827f55c0359d1051 Author: Nitin Shivpure <nshivpur@codeaurora.org> Date:   Tue Jun 17 16:29:18 2014 +0530

* commit '8d502374a5f903e85d77c2a4476f90dd9d85de47':
  commit 001ccea74ec61b1be00c8ede827f55c0359d1051 Author: Nitin Shivpure <nshivpur@codeaurora.org> Date:   Tue Jun 17 16:29:18 2014 +0530

9 years agoMerge "LE: Fix problem where pending command is not sent after pairing" into lmp-dev
Andre Eisenbach [Tue, 29 Jul 2014 20:18:30 +0000 (20:18 +0000)]
Merge "LE: Fix problem where pending command is not sent after pairing" into lmp-dev

9 years agoBug 16498557 Inconsistent energy reporting
Satya Calloji [Tue, 29 Jul 2014 06:22:05 +0000 (23:22 -0700)]
Bug 16498557 Inconsistent energy reporting

Fix for inconsistent energy reporting

Change-Id: Iddd77354624a631ca8db52f12086d3afa5751d36

9 years agoLE: Fix problem where pending command is not sent after pairing
Andre Eisenbach [Fri, 25 Jul 2014 22:46:21 +0000 (15:46 -0700)]
LE: Fix problem where pending command is not sent after pairing

If a read/write or other operation triggers SMP pairing with a remote
device, the operation should complete once pairing has finished. This
patch fixes a bug where the pending command was not sent after pairing.

Bug: 16405565
Change-Id: Idb2e54931c71b0a9e009cac318712eb9f5c7e15a

9 years agoBluetooth: Cleaning up pan_conn DB, if connection is not successful. - do not merge
Nitin Shivpure [Thu, 3 Oct 2013 13:36:12 +0000 (19:06 +0530)]
Bluetooth: Cleaning up pan_conn DB, if connection is not successful. - do not merge

A case where DUT is paired with remoteDeviceA &  remoteDeviceB.
remoteDeviceA is not pagable(turned off or some other reason).
DUT(PANU) try to connect remoteDeviceA(NAP). But connection is
unsuccessful, Because remoteDeviceA is not pagable, In this scenario
btpan_conn Database is not cleaning up at btif layer. Later
remoteDeviceB(PANU) connect to DUT(NAP) & connection is succesful,
When remoteDeviceB disconnect existing connection. As database
still has remoteDeviceA BD address at Btif layer. remoteDeviceA
BD address is passed instead of remoteDeviceB BD address from Btif
to UI. So remoteDeviceB still shows connected on UI. Cleaning up
pan_conn database for particular pan connection at BTIF layer,
whichever connection is not successful will solve this issue.

Change-Id: I31dfe3ef46295e74bbfb57563e4fd4fc7155f006

9 years agoBluetooth: Update security for HID Devices to Encrypt on BT On. - do not merge
Hemant Gupta [Thu, 29 Aug 2013 10:16:49 +0000 (15:46 +0530)]
Bluetooth: Update security for HID Devices to Encrypt on BT On. - do not merge

This patch updates HID Devices security mask to BTA_SEC_ENCRYPT from
BTA_SEC_NONE. Without this change it was observed that on BT Reset,
authentication and encryption were not initiated by DUT for incoming
HID Control L2CAP Connection Request from remote HID Keyboard device.

Change-Id: I484fbae1294fde386bd7959467214f9968e381e9

9 years agoBluetooth: Getbuf returning invalid buffer pointer - do not merge
Hemant Gupta [Fri, 12 Jul 2013 14:35:54 +0000 (20:05 +0530)]
Bluetooth: Getbuf returning invalid buffer pointer - do not merge

Getbuff is checking for the pool which can accommodate
requested size, but is changing the pool with a restricted
check and not checking for the free memory size in that pool.
Added a check to avoid returng the wrong pool free buf pointer.
Without this patch, SDP Codenomicon TestSuite crash is observed
on Bluedroid stack.

Change-Id: Id66d460c5a40d8c3208438d7cfaf729e9b355184

10 years agocommit 001ccea74ec61b1be00c8ede827f55c0359d1051
Dmitry Grinberg [Fri, 25 Jul 2014 22:10:11 +0000 (15:10 -0700)]
commit 001ccea74ec61b1be00c8ede827f55c0359d1051
Author: Nitin Shivpure <nshivpur@codeaurora.org>
Date:   Tue Jun 17 16:29:18 2014 +0530

    LW: Set sniff interval as 1.28s for JV RFCOMM server

    - Reducing sniff timer value to 1s for JV RFCOMM Server
      to reduce power consumption on wearable in idle scenario.
    - Changing sniff interval value as 1.28s for BTA_DM_PM_SNIFF
      to reduce power consumption on wearable, when wearable is
      in sniff with remote device.

    CRs-Fixed: 686491

Bug: 16378407
Change-Id: Ibe4650a63a97fec86bb7d5ed8bafad9e56269287

10 years agoMerge "PM: Stop Power Manager Timer if in sniff mode - do not merge" into lmp-dev
Matthew Xie [Mon, 28 Jul 2014 21:36:50 +0000 (21:36 +0000)]
Merge "PM: Stop Power Manager Timer if in sniff mode - do not merge" into lmp-dev

9 years agoPM: Stop Power Manager Timer if in sniff mode - do not merge
Hemant Gupta [Thu, 12 Jun 2014 07:49:15 +0000 (13:19 +0530)]
PM: Stop Power Manager Timer if in sniff mode - do not merge

Power manager timer is started when ACL link is in active mode
depending on profile connected. This timer was never stopped
when link was put in sniff mode by remote device preventing
system from going to sleep since timer is still active resulting
in extra power consumption.

Change-Id: I7569eed3ad7e0487e411377977b4f0671f24df12

9 years agoBluetooth: DIS: Only read the requested DIS characteristics
Adam Hampson [Fri, 25 Jul 2014 20:39:11 +0000 (13:39 -0700)]
Bluetooth: DIS: Only read the requested DIS characteristics

The BLE HID code only uses the PNP_ID characteristic from DIS.
Previously the DIS client would read all DIS characteristics
when a read request was made.  This change allows the DIS user to
request certain DIS characteristics.

Bug: 16521059

Change-Id: I09c24718bb2e2da73c518b64c3cbdd07e7d6cf27
Signed-off-by: Adam Hampson <ahampson@google.com>
10 years agoSettings app does not show BLE devices
Satya Calloji [Tue, 8 Jul 2014 23:18:58 +0000 (16:18 -0700)]
Settings app does not show BLE devices

Settings does not show all BLE devices when scan filter is set

Change-Id: I669ef3b87a9a21dfce26c1e22b5d984a5ea6f75c

10 years agoMerge "audio HAL: add parameters to open stream functions" into lmp-dev
Eric Laurent [Mon, 28 Jul 2014 20:57:10 +0000 (20:57 +0000)]
Merge "audio HAL: add parameters to open stream functions" into lmp-dev

9 years agoaudio HAL: add parameters to open stream functions
Eric Laurent [Mon, 28 Jul 2014 00:27:35 +0000 (17:27 -0700)]
audio HAL: add parameters to open stream functions

Pass device address (and audio source for inputs) to
open_output_stream() and open_input_stream() audio HAL functions.

Bug: 14815883.
Change-Id: I4f66478606349ab64d880923c53de00a11d74d25

10 years agoMerge "Work around race condition between thread shutdown and vendor lib shutdown...
Sharvil Nanavati [Thu, 24 Jul 2014 21:08:55 +0000 (21:08 +0000)]
Merge "Work around race condition between thread shutdown and vendor lib shutdown." into lmp-dev

10 years agoWork around race condition between thread shutdown and vendor lib shutdown.
Sharvil Nanavati [Thu, 24 Jul 2014 16:07:36 +0000 (09:07 -0700)]
Work around race condition between thread shutdown and vendor lib shutdown.

This race condition occurs because of a structural bug - the userial
thread depends on the HCI thread and the HCI thread depends on the
userial thread but both are independently owned and torn down. This
change fixes a crash bug due to the race condition (NULL pointer
access in userial thread).

http://b/16483216

Change-Id: I91ea274856ac72e9d72b92f0dc5c94e53aaf22f4

10 years agoMerge "Increase BLE background scan window for faster re-connection" into lmp-dev
Matthew Xie [Thu, 24 Jul 2014 19:12:45 +0000 (19:12 +0000)]
Merge "Increase BLE background scan window for faster re-connection" into lmp-dev

10 years agoIncrease BLE background scan window for faster re-connection
Matthew Xie [Thu, 24 Jul 2014 18:20:50 +0000 (11:20 -0700)]
Increase BLE background scan window for faster re-connection

The scan window is increased from 11.25ms to 30ms.
The scan duty cycle is still very low at 2.34% while user experience
is greatly improved.
bug 16521059

Change-Id: Ice37c54fdc7d852fd19709112075e7492b6a1480

10 years agoFix build for non BLE supported targets(nakasi and manta)
Prerepa Viswanadham [Thu, 24 Jul 2014 00:49:48 +0000 (17:49 -0700)]
Fix build for non BLE supported targets(nakasi and manta)

Change-Id: I0de46e1dfce3a51367bc0e2640e91cdefc8a21c6

10 years agoLE energy info feature
Satya Calloji [Fri, 4 Jul 2014 00:18:02 +0000 (17:18 -0700)]
LE energy info feature

Stack and BT-IF changes for LE energy feature

Change-Id: I671e63aaead210c6352b45a5e20ad5e4bbbb77b7

10 years agoFix integer overflow in GKI timer calculation
Andre Eisenbach [Mon, 21 Jul 2014 23:52:28 +0000 (16:52 -0700)]
Fix integer overflow in GKI timer calculation

Fix an integer overflow in the GKI timer elapsed time calculation that
would cause Bluetooth Stereo Audio (A2DP) playback to stop suddenly
after a period of INT32_MAX microseconds (about 35 minutes) of
continuous uptime of the phone/tablet.

Bug: 16412377
Change-Id: I28cd3155a23444e41b26b3f3b8424cc2a3c5bf91

10 years agoMerge "Fix A2DP audio playback problem" into lmp-dev
Andre Eisenbach [Mon, 21 Jul 2014 17:57:47 +0000 (17:57 +0000)]
Merge "Fix A2DP audio playback problem" into lmp-dev

10 years agoFix A2DP audio playback problem
Andre Eisenbach [Sat, 19 Jul 2014 01:43:18 +0000 (18:43 -0700)]
Fix A2DP audio playback problem

With some A2DP headphones/car kits an issue was observed where the SBC
codec could not be initialized correctly and thus no audio was heard
over A2DP. This change fixes a variable initialization issue that
prevented the request for capabilities from being sent to the remote
device.

Change-Id: Ic55da0dbe5abd1e5bb89c8305b0a4c1f06b60a65

10 years agoLE: Add connection parameter update request API (2/4)
Andre Eisenbach [Thu, 17 Jul 2014 05:59:45 +0000 (22:59 -0700)]
LE: Add connection parameter update request API (2/4)

Change-Id: I131bfa7fb0a8cc970e1ac3e26e9d86ed2bee80a7

10 years agoFix builds: Revert "Added code to publish ble adv tx power in dBm"
Ed Heyl [Fri, 18 Jul 2014 08:05:38 +0000 (08:05 +0000)]
Fix builds: Revert "Added code to publish ble adv tx power in dBm"

This reverts commit 347a1d64c7a9c345793c61b03bdcaa31ad8e5678.

Change-Id: If62571a3f5bd87d04e5643855c9fea1b8048aa5a

10 years agoAdded code to publish ble adv tx power in dBm
git-zhenye.broadcom.com [Wed, 16 Jul 2014 00:32:21 +0000 (17:32 -0700)]
Added code to publish ble adv tx power in dBm

Bug 15412969

10 years agoFix build warning about unused argument.
Sharvil Nanavati [Thu, 17 Jul 2014 22:45:40 +0000 (15:45 -0700)]
Fix build warning about unused argument.

Change-Id: I3ae26dfc4ffd97d039386f55e3290a6cf36ae17d

10 years agoFix string format error for 64-bit builds
Michael Wright [Thu, 17 Jul 2014 21:45:58 +0000 (14:45 -0700)]
Fix string format error for 64-bit builds

Change-Id: Idefad9d9ea3a54f7f412e80c4998137d15a1b23c

10 years agoMerge "Make auto connect work for multiple known BLE devices" into lmp-dev
Mike J. Chen [Mon, 21 Jul 2014 17:22:28 +0000 (17:22 +0000)]
Merge "Make auto connect work for multiple known BLE devices" into lmp-dev

10 years agoMake auto connect work for multiple known BLE devices
Mike J. Chen [Sat, 19 Jul 2014 00:40:12 +0000 (17:40 -0700)]
Make auto connect work for multiple known BLE devices

Due to a bug with wl_state not ever setting WL_INIT,
auto connect was not working for more than one known
BLE device after a reboot.  The fix is to set the WL_INIT
flag when in initiator state.

I also added code to set the WL_SCAN flag when in
scanning state.  Not sure if that fixes any bug but
it looks like it should have been done too.

WL_ADV was the only state flag previously being set.

Bug 16404692

Change-Id: Id42907c0d8301e347e603684e2c03e4905bfec49
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoInitialize stack variable to eliminate warning
Chris Manton [Fri, 18 Jul 2014 20:41:32 +0000 (13:41 -0700)]
Initialize stack variable to eliminate warning

Change-Id: I4f4843da796d3c2b0aed3130b88d947491a341d0

10 years agoRemove extraneous field inherited from parent makefile
Chris Manton [Fri, 18 Jul 2014 19:55:34 +0000 (12:55 -0700)]
Remove extraneous field inherited from parent makefile

Change-Id: I0d0bc0c5ed508f2d94c5644cb3b0f823bae5d83a

10 years agoMerge "Fix implicit declaration of function 'prctl' in bluedroid." into lmp-dev
Elliott Hughes [Sat, 19 Jul 2014 00:11:17 +0000 (00:11 +0000)]
Merge "Fix implicit declaration of function 'prctl' in bluedroid." into lmp-dev

10 years agoFix implicit declaration of function 'prctl' in bluedroid.
Elliott Hughes [Sat, 19 Jul 2014 00:07:51 +0000 (17:07 -0700)]
Fix implicit declaration of function 'prctl' in bluedroid.

(cherry picked from commit d356ffbf6f6095489c73266e6e591b1167cfa5e6)

Change-Id: Icc160c758c126e48fd6490cd14211a8685e4cdba

10 years agoFix build: Revert the reversion done due to build failure.
Prerepa Viswanadham [Fri, 18 Jul 2014 22:20:54 +0000 (15:20 -0700)]
Fix build: Revert the reversion done due to build failure.
original commit id: 347a1d64c7a9c345793c61b03bdcaa31ad8e5678
revert commit id: 571c81ed119833b5e5cbd6bedffd7409a10be21d

Fix builds: Revert "Added code to publish ble adv tx power in dBm""

This reverts commit 571c81ed119833b5e5cbd6bedffd7409a10be21d.

Change-Id: I2afeeaa4b52aa449e54115fd5f816a7a949d2ea8

10 years agoMerge "Bluetooth: fix the HOGP device(iBUFFALO BSMBB09DS) pair and reconnect problem...
Matthew Xie [Fri, 18 Jul 2014 23:26:52 +0000 (23:26 +0000)]
Merge "Bluetooth: fix the HOGP device(iBUFFALO BSMBB09DS) pair and reconnect problem." into lmp-dev

10 years agoBluetooth: fix the HOGP device(iBUFFALO BSMBB09DS) pair and reconnect problem.
Thomas.TT_Lin [Fri, 18 Jul 2014 04:10:59 +0000 (12:10 +0800)]
Bluetooth: fix the HOGP device(iBUFFALO BSMBB09DS) pair and reconnect problem.

in bta_hh_le.c (fix reconnect issue)
Since new LE security flags are import, (BTM_SEC_LE_AUTHENTICATED, BTM_SEC_LE_ENCRYPTED,
BTM_SEC_LE_NAME_KNOWN, BTM_SEC_LE_LINK_KEY_KNOWN, BTM_SEC_LE_LINK_KEY_AUTHED),
we have to use new BTM_GetSecurityFlagsByTransport() function with LE transport to get right sec_flag,
or will cause cannot correctly add to white list and cause reconnect fail.

in btif_dm.c (fix HOGP mouse pair issue)
the HOGP mouse will become abnormal if we update connection parameter too many times.
Therefore the is_hid case is not suitable for HOGP mouse,
it will trigger call to L2CA_EnableUpdateBleConnParams() several times due to service discovery and bonded state.
L2CA_EnableUpdateBleConnParams() update connection cause mouse abnormal.
The change will make the flow: complete bonding procedure first, then do service discovery, connect to mouse.

in gap_ble.c (fix HOGP device pair issue)
After pairing status is bonded, host start to create ATT layer to get some information from HOGP device.
If host send "disconnect" command during period. Device will stop to feedback anything.
Suggest to delete it.

in smp_act.c (fix HOGP device pair issue)
update connection parameter too many times may cause mouse abnormal,
so remove this code since this will be called again after service discovery.
Suggest to delete it.

Change-Id: I4b722343c2b08d33530bc6b928bc9ffe89fd09e9
Signed-off-by: Thomas.TT_Lin <Thomas.TT_Lin@htc.com>
10 years agoMerge "A simple, thread-safe timer API for bluedroid." into lmp-dev
Sharvil Nanavati [Thu, 17 Jul 2014 21:24:30 +0000 (21:24 +0000)]
Merge "A simple, thread-safe timer API for bluedroid." into lmp-dev

10 years agoMerge "Revert "Revert "Clean up messy dispatch in bt_hci_bdroid by using new primitiv...
Sharvil Nanavati [Thu, 17 Jul 2014 21:00:17 +0000 (21:00 +0000)]
Merge "Revert "Revert "Clean up messy dispatch in bt_hci_bdroid by using new primitives.""" into lmp-dev

10 years agoRevert "Revert "Clean up messy dispatch in bt_hci_bdroid by using new primitives.""
Sharvil Nanavati [Thu, 17 Jul 2014 07:53:01 +0000 (00:53 -0700)]
Revert "Revert "Clean up messy dispatch in bt_hci_bdroid by using new primitives.""

Original code broke the build for razor-eng, updated the code to fix break.

This reverts commit dd29f036a8cde94b3c296fb08ee3e9b2d65c15e0.

Change-Id: I2d2f9b5b51b923e3f0e8092b3169ea447193887d

10 years agoA simple, thread-safe timer API for bluedroid.
Sharvil Nanavati [Wed, 2 Jul 2014 01:42:56 +0000 (18:42 -0700)]
A simple, thread-safe timer API for bluedroid.

Change-Id: I5fa21b48506e4d1d65da4b8bedbbf39e03dad559

10 years agoMerge "Add audio_input_flags_t to HAL open_input_stream" into lmp-dev
Glenn Kasten [Thu, 17 Jul 2014 15:18:33 +0000 (15:18 +0000)]
Merge "Add audio_input_flags_t to HAL open_input_stream" into lmp-dev

10 years agoAdd audio_input_flags_t to HAL open_input_stream
Glenn Kasten [Thu, 17 Jul 2014 14:33:51 +0000 (07:33 -0700)]
Add audio_input_flags_t to HAL open_input_stream

Change-Id: I5023c0fdb8069668ca2b84096277d6abdbf7d729

10 years agoMerge "Fix GKI_add_to_timer_list to handle middle-of-list insertions correctly" into...
Andre Eisenbach [Thu, 17 Jul 2014 01:59:17 +0000 (01:59 +0000)]
Merge "Fix GKI_add_to_timer_list to handle middle-of-list insertions correctly" into lmp-dev

10 years agoFix GKI_add_to_timer_list to handle middle-of-list insertions correctly
Andre Eisenbach [Thu, 17 Jul 2014 01:35:56 +0000 (18:35 -0700)]
Fix GKI_add_to_timer_list to handle middle-of-list insertions correctly

The newly added timer_list code didn't handle middle-of-list insertions
correctly, leading to problems pairing certain Bluetooth devices as well
as causing 100% CPU usage for the Bluetooth task.

Change-Id: I3d4c22b775a91da2a3f983e8c78facbd91d4cb7d

10 years agoRevert "Clean up messy dispatch in bt_hci_bdroid by using new primitives."
Svetoslav Ganov [Thu, 17 Jul 2014 00:26:24 +0000 (00:26 +0000)]
Revert "Clean up messy dispatch in bt_hci_bdroid by using new primitives."

This change broke the build. Reverting to unblock people waiting for a green build to start working.

This reverts commit 3f9fbe74c1d6e774d3f21275515c7b895715aec5.

Change-Id: I58c3bdcc2f5f3fe744b8d3f80753566cf1d22bd1

10 years agoClean up messy dispatch in bt_hci_bdroid by using new primitives.
Sharvil Nanavati [Sun, 6 Jul 2014 04:21:38 +0000 (21:21 -0700)]
Clean up messy dispatch in bt_hci_bdroid by using new primitives.

Instead of dispatching onto a worker thread by setting bits of a
bitfield and then having the thread pull data from shared data
structures, this code uses the previously defined primitives to
write to a synchronized thread event queue. It's advantageous because
it's more direct dispatch (you specify which function you want to
call on the worker thread instead of mapping bitfields to a function),
it avoids a lot of boilerplate code, function calls have predictable
ordering, and it uses generic infrastructure instead of building a
custom dispatch + synchronized data strucures.

Change-Id: If938e4fd47c8ddf328a29d104151f900ec659588

10 years agoExtend the threading library to back thread with an event queue.
Sharvil Nanavati [Sat, 5 Jul 2014 00:51:29 +0000 (17:51 -0700)]
Extend the threading library to back thread with an event queue.

This change allows arbitrary functions to be called on a given
thread which will clean up much of the dispatch code in bluedroid.
Looking forward, this code will be extended to allow additional objects
and queues to be attached to a thread for more customizable dispatch.

Change-Id: Id3a16256c264e3d35e6db5a562cb0e7762676457

10 years agoExpose enqueue/dequeue file descriptors for fixed_queue.
Sharvil Nanavati [Fri, 4 Jul 2014 23:33:37 +0000 (16:33 -0700)]
Expose enqueue/dequeue file descriptors for fixed_queue.

These file descriptors can be used with a reactor to perform
non-blocking enqueue/dequeue operations.

Change-Id: If75730f9093e8d20a789a7bd2bde92e019922e5a

10 years agoEliminate last_ticks from TIMER_LIST_ENT.
Sharvil Nanavati [Tue, 15 Jul 2014 22:18:12 +0000 (15:18 -0700)]
Eliminate last_ticks from TIMER_LIST_ENT.

It's unnecessary, potentially calculated incorrectly, and the insertion
logic that depended on it was fragile. I've rewritten the list
insertion routine so it's easier to follow. This should also fix
http://b/16259295.

Change-Id: Ib7184c94c495c03d3acbe105955b1bb712dbbfaa
(cherry picked from commit a1bfd3ee95378fab78c931c3360cfbd16de3b617)

10 years agoMerge "Calculate A2DP frames to send based on elapsed time"
Andre Eisenbach [Sat, 12 Jul 2014 01:18:05 +0000 (01:18 +0000)]
Merge "Calculate A2DP frames to send based on elapsed time"

10 years agoCalculate A2DP frames to send based on elapsed time
Andre Eisenbach [Fri, 11 Jul 2014 23:57:24 +0000 (16:57 -0700)]
Calculate A2DP frames to send based on elapsed time

This patch is aimed at improving A2DP audio quality by sending the
correct number of frames based on the actual time elapes between "ticks"
in order to account for timer drift.

Change-Id: If5b7cde90f5eb10b926ad247f51cff0eb60bbff7

10 years agoA2DP: Fix audio stuttering in A2DP sink mode
Mike Lockwood [Fri, 11 Jul 2014 19:05:04 +0000 (12:05 -0700)]
A2DP: Fix audio stuttering in A2DP sink mode

Change-Id: Ied821aeb14f83e3fd1daa6e175ac995abbfbb198

10 years agoMerge "Fix GKI buffer leak with discovery information service reading"
Mike J. Chen [Sat, 12 Jul 2014 00:57:15 +0000 (00:57 +0000)]
Merge "Fix GKI buffer leak with discovery information service reading"

10 years agoFix GKI buffer leak with discovery information service reading
Mike J. Chen [Sat, 28 Jun 2014 02:01:10 +0000 (19:01 -0700)]
Fix GKI buffer leak with discovery information service reading

If the discovery information service of the LE client has
the fields model number, serial number, fw version, etc,
the service would allocate PKI buffer and never do anything
with it, so it would leak.  It looks like it should have
been assigned the a callback string array, however fixing
that still doesn't fix the leak because the code that receives
the string array, bta_hh_le_dis_cback(), never uses it and
never frees it.

I believe the semantic is that the string arrays are kept around
as a cache in the srvc engine connection structure,
so it's the srvc engine dealloc of the callback structure that
needs to also free the string buffers if they have been allocated.
After fixing the string array allocation, add code to free the
string array entries if they are not null.

Also fixed an off by one error in DIS_SrUpdate() that would also lead
to a GKI buffer leak.

Improve two string termination cases to use a simple set of the
last entry in the char array instead of memsetting the whole array
when most of it will be filled by a following memcpy.

Change-Id: I7905cd771dbbe166e3c2b42e019bac9f5a312877
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoFix deadlock and non-working socket msg throttling
Mike J. Chen [Tue, 1 Jul 2014 19:41:02 +0000 (12:41 -0700)]
Fix deadlock and non-working socket msg throttling

Two major bugs in btif_config.c.  One is that due to improper
locking order, a deadlock could occur (symptom is generally
out of GKI buffers because BTIF thread stops processing it's
mailbox because it is blocked sending a msg to the socket
thread, which in turn is blocked because BTIF is holding
the lock it needs to do the config save that BTIF requested
in the first place).

The other is also lock related.  The mechanism to throttle
socket messages based on whether there was one already
in flight wasn't working because there wasn't locking
when that variable was being used.  The compiler would be
free to cache it in a register on SMP machines, so it would
never look like there as a value in flight.  This would
cause a bunch of messages to be queued up, and then the
way the handling worked in cfg_cmd_callback(), every
cmd would cause a 3 second sleep, even if there was nothing
to do.  Modified the loop to check if there was nothing
to do before sleeping.

I was running into both bugs when repeatedly pairing and
unpairing a BLE device.  The deadlock would hit first, causing
out of GKI buffers.  Once I fixed the deadlock, I would still
run out of GKI buffers because the socket thread wasn't working
fast enough to clear the backlog of socket messages it had
received.

Also optimized some string termination code which was using
a memset of the full buffer before and then copying over
every entry except the last.  Now we do the copy and just
set the last buffer entry to null.

Change-Id: Ic06ef0b8e15d8f1fe669fb88439851ffbad560de
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoam 02d9b7b4: Bluetooth: Increase number of allowed notifications
Nitin Arora [Fri, 11 Jul 2014 01:40:18 +0000 (01:40 +0000)]
am 02d9b7b4: Bluetooth: Increase number of allowed notifications

* commit '02d9b7b41f1fcf21e798a4c0aabde89f00729d08':
  Bluetooth: Increase number of allowed notifications

10 years agoam 7475a509: Bluetooth: Adds SMP response timer for security request
Nitin Arora [Fri, 11 Jul 2014 01:40:17 +0000 (01:40 +0000)]
am 7475a509: Bluetooth: Adds SMP response timer for security request

* commit '7475a5098339d763aa6e3a0374ee2f1c16e002c4':
  Bluetooth: Adds SMP response timer for security request

10 years agoam 156c52bb: Send correct status for SMP AUTH failure
Priti Aghera [Fri, 11 Jul 2014 01:40:17 +0000 (01:40 +0000)]
am 156c52bb: Send correct status for SMP AUTH failure

* commit '156c52bb003a14147db99d8a151edc08f591bd34':
  Send correct status for SMP AUTH failure

10 years agoBluetooth: Increase number of allowed notifications
Nitin Arora [Thu, 9 Jan 2014 22:27:25 +0000 (14:27 -0800)]
Bluetooth: Increase number of allowed notifications

This change increase the maximum number of notifications
that can be registered for LE remote devices.
This count is increase from 7 to 15.

Change-Id: I422704e9bae69c48b731757526ed9ee4055aa643

10 years agoBluetooth: Adds SMP response timer for security request
Nitin Arora [Fri, 21 Feb 2014 02:52:41 +0000 (18:52 -0800)]
Bluetooth: Adds SMP response timer for security request

This adds timer to cancel security request from remote if there
is no response from user for pairing popup.

Change-Id: I18694dcc5275a1eb10de4ad921b6baca189b42fa

10 years agoMerge "Fix deadlock and non-working socket msg throttling"
Mike J. Chen [Sat, 12 Jul 2014 00:57:09 +0000 (00:57 +0000)]
Merge "Fix deadlock and non-working socket msg throttling"

10 years agoFix GKI buffer leak in GATT event handling
Mike J. Chen [Tue, 1 Jul 2014 19:15:12 +0000 (12:15 -0700)]
Fix GKI buffer leak in GATT event handling

The GATT event handler was telling the BTA dispatcher that
it would always free the GKI msg buffers itself, but in fact
this wasn't true.  There were some cases where the buffer is
queued and freed later (queued in p_clcb->p_q_cmd for later
access and freeing), but many times the event handlers
(like bta_gattc_ci_save()) don't queue the buffer and don't
free it, causing a GKI buffer leak.

Also, prevent a double free case (not certain it happens, but
in theory it could) if bta_gattc_sm_execute() queues a buffer
in bta_gattc_disc_cmpl().

Lastly, remove held flag since it's redundant with whether
p_q_cmd is null or not.  Just go with one source of truth and
not have one shadow the other.

Change-Id: I1bd43919b8a2e125076e26cd6a3a08480b3e7e2d
Signed-off-by: Mike J. Chen <mjchen@google.com>
10 years agoSend correct status for SMP AUTH failure
Priti Aghera [Wed, 9 Jul 2014 21:58:19 +0000 (14:58 -0700)]
Send correct status for SMP AUTH failure

Send correct corresponding status for SMP AUTH failure to JAVA layer.
This will enable BluetoothEventManager to display correct error message
for bond state changed callback.
Bug 15677623

Change-Id: I6a8742926bac862f960890417b5d68c23b33e010

10 years agoMerge "Fix GKI timers to take execution time into account"
Andre Eisenbach [Wed, 9 Jul 2014 21:35:39 +0000 (21:35 +0000)]
Merge "Fix GKI timers to take execution time into account"

10 years agoFix GKI timers to take execution time into account
Andre Eisenbach [Mon, 7 Jul 2014 18:29:34 +0000 (11:29 -0700)]
Fix GKI timers to take execution time into account

Previously, the GKI timer system would not take the time taken for
updating the timers into account when re-scheduling the next timer. This
would by design introduce timer drift into the system.

This patch measures the time taken for an alarm to be triggered to
report the correct number of ticks to the GKI timer subsystem, as well
as measuring the time taken for updating the timers to adjust the next
alarm accordingly.

This patch dramatically improves A2DP audio quality on various devices
which currently suffer timer drift problems.

Change-Id: Ia99454abcb2a6889c47b1d8e267705f29ebe7b64

10 years agoAdd template doc for Android properties used by bluedroid.
Sharvil Nanavati [Sun, 6 Jul 2014 04:31:25 +0000 (21:31 -0700)]
Add template doc for Android properties used by bluedroid.

Change-Id: Idafbaa69161a7fa01a381d9b4fc5d9f41bc5695f

10 years agoMerge "Prevent A2DP bit pool calculation endless loops."
Andre Eisenbach [Wed, 9 Jul 2014 17:03:00 +0000 (17:03 +0000)]
Merge "Prevent A2DP bit pool calculation endless loops."

10 years agoExpose semaphore's file descriptor.
Sharvil Nanavati [Sun, 6 Jul 2014 03:42:07 +0000 (20:42 -0700)]
Expose semaphore's file descriptor.

|semaphore_get_fd| can be used by callers to determine if it's safe
to call |semaphore_wait| and |semaphore_post| without blocking.

Change-Id: Icf758f03ea2aa85cddcb4ab3f7906b2c587fb8ac

10 years agoStart of threading library
Sharvil Nanavati [Thu, 8 May 2014 05:09:12 +0000 (22:09 -0700)]
Start of threading library

So far it's a thin shim around pthreads which allows setting thread
name and querying tids from any thread.

Change-Id: Id156f662778806a54a8a302be424ee051fac4710

10 years agoPrevent A2DP bit pool calculation endless loops.
Andre Eisenbach [Tue, 8 Jul 2014 19:33:38 +0000 (12:33 -0700)]
Prevent A2DP bit pool calculation endless loops.

This prevents log spam and endless loops in the A2DP bit pool
calculation. Protecting against the endless loop with prevent battery
draining issues and phone unresponsiveness.

This patch addresses the symptom. A separate patch will be submitted
once root cause is determined to address the problem.

Change-Id: I045b724c1c1638551b9333249f39eee109fa9ba1

10 years agoBluetooth: Rename BTA_AVK_INCLUDED flag to BTA_AV_SINK_INCLUDED (bt_target.h)
lungtsai_lin [Wed, 2 Jul 2014 12:39:02 +0000 (20:39 +0800)]
Bluetooth: Rename BTA_AVK_INCLUDED flag to BTA_AV_SINK_INCLUDED (bt_target.h)

Now OEM could enable/disable A2DP SINK role

Change-Id: I62cf17b0397a86c5f886a2c1ca724ca77a7f9bd4
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
10 years agoMerge "DO NOT MERGE: Send to local UUID for AV connection" into klp-wireless-dev
Matthew Xie [Sat, 5 Jul 2014 19:50:41 +0000 (19:50 +0000)]
Merge "DO NOT MERGE: Send to local UUID for AV connection" into klp-wireless-dev

10 years agoImplement the reactor pattern in C.
Sharvil Nanavati [Mon, 23 Jun 2014 23:30:46 +0000 (16:30 -0700)]
Implement the reactor pattern in C.

This code will form the basis of most select-based event loops in
bluedroid. It provides a thread-safe abort routine and a separation
between the dispatcher and event handler code.

Change-Id: I6f1c033d18f045ba273187dab607c209dfe32d30

10 years agoDO NOT MERGE: Send to local UUID for AV connection
Ravi Nagarajan [Wed, 2 Jul 2014 10:15:34 +0000 (03:15 -0700)]
DO NOT MERGE: Send to local UUID for AV connection

BTA expects local UUID to be passed into BTA_AvOpen. The value of source/sink
was reversed in the btif layer thus causing connection failure
bug 15837817

Change-Id: If159ac0491afcb75659336c98caba3cefe71ee7b

10 years agoMerge "Code cleanup - remove unnecessary commented out code" into klp-wireless-dev
Wei Wang [Wed, 2 Jul 2014 19:05:46 +0000 (19:05 +0000)]
Merge "Code cleanup - remove unnecessary commented out code" into klp-wireless-dev

10 years agoCode cleanup - remove unnecessary commented out code
Wei Wang [Wed, 2 Jul 2014 18:34:08 +0000 (11:34 -0700)]
Code cleanup - remove unnecessary commented out code

Change-Id: I86e78d1b0470b9fda7455ae8ef5788814cf5c780

10 years agoMerge "audio: deprecate audio_stream_frame_size()"
Eric Laurent [Sun, 6 Jul 2014 17:07:59 +0000 (17:07 +0000)]
Merge "audio: deprecate audio_stream_frame_size()"

10 years agoam 85b4ee5d: (-s ours) Merge "DO NOT MERGE: Send to local UUID for AV connection...
Matthew Xie [Sat, 5 Jul 2014 19:53:58 +0000 (19:53 +0000)]
am 85b4ee5d: (-s ours) Merge "DO NOT MERGE: Send to local UUID for AV connection" into klp-wireless-dev

* commit '85b4ee5df4208fd06e836f40d7a19a84545f4e93':
  DO NOT MERGE: Send to local UUID for AV connection

10 years agoaudio: deprecate audio_stream_frame_size()
Eric Laurent [Thu, 3 Jul 2014 23:09:53 +0000 (16:09 -0700)]
audio: deprecate audio_stream_frame_size()

Bug: 15000850.
Change-Id: I1edcc78561cdc328ae0d91a1d07b0836ca5e1715