OSDN Git Service

android-x86/system-bt.git
8 years agoRewrite GATT read operations to use new style
Jakub Pawlowski [Thu, 12 May 2016 17:25:45 +0000 (17:25 +0000)]
Rewrite GATT read operations to use new style
am: 61a112e488

* commit '61a112e488a7686e5cc9680434c42895ef9db878':
  Rewrite GATT read operations to use new style

Change-Id: I981bfd27a7010da48b204f22f7854055665497e4

8 years agoUse MessageLoop in bt_jni_workqueue thread
Jakub Pawlowski [Thu, 12 May 2016 17:25:44 +0000 (17:25 +0000)]
Use MessageLoop in bt_jni_workqueue thread
am: 140645f6b8

* commit '140645f6b8d87464c08f082bd14740eecab23f71':
  Use MessageLoop in bt_jni_workqueue thread

Change-Id: I0d60049b62c4295bea9f2fa5f12bcbee81a5c962

8 years agoRewrite GATT read operations to use new style
Jakub Pawlowski [Tue, 3 May 2016 00:50:25 +0000 (17:50 -0700)]
Rewrite GATT read operations to use new style

Bug: 28485365
Change-Id: I3c5918abdf79da7d6b566506ad53fa38656bcb65

8 years agoUse MessageLoop in bt_jni_workqueue thread
Jakub Pawlowski [Sat, 30 Apr 2016 21:37:40 +0000 (14:37 -0700)]
Use MessageLoop in bt_jni_workqueue thread

Up till now, to execute anyting on bt_jni_workqueue thread, we were
sending events to workqueue associated with this thread. Flow was:
btif_transfer_context -> btif_sendmsg -> thread_post.
Events were containing defined action, i.e. BTIF_GATTC_SCAN_START and
pointer to struct that contained all required data to execute it.
This was very cumbersome - figuring out what is executed when event is
send was hard. Also everything have to be packed into structure which
means that
we have to define lots of structures, or have one big super-structure
holding data for all events (like in btif_gatt_client.cc). Event sending
and receiving
logic is a huge percent of all code.

From now on, there will be a MessageLoop running inside bt_jni_workqueue
that will execute all tasks that will be posted with PostTask. The
benefit of having PostTask method, is that we can simply create Closure
that will be run in bt_jni_workqueue thread. It will take care of
transferring all associated values, and their cleanup. It will also do
compile-time check of all parameters. We no longer have to create
events, structs, and separate call logic from execution logic.

Bug: 28485365
Change-Id: I5014ef680757c0d3c6c69781aadc5139c8e1c3c4

8 years agoAdd additional VW car kits to absolute volume blacklist
Andre Eisenbach [Wed, 11 May 2016 20:34:13 +0000 (20:34 +0000)]
Add additional VW car kits to absolute volume blacklist
am: 29e7944184

* commit '29e794418452c8b35c2d42fe0cda81acd86bbf43':
  Add additional VW car kits to absolute volume blacklist

Change-Id: If5c53e050f667e1042748809d04c48d5c7bb108d

8 years agoAdd additional VW car kits to absolute volume blacklist
Andre Eisenbach [Wed, 11 May 2016 19:20:23 +0000 (12:20 -0700)]
Add additional VW car kits to absolute volume blacklist

Change-Id: I8b0b73595e9183b9c1540b06e9e0378312c6a63d
Fixes: 25613423

8 years agoFix double mutex unlock and if() condition
Andre Eisenbach [Wed, 11 May 2016 18:34:08 +0000 (18:34 +0000)]
Fix double mutex unlock and if() condition
am: 0403dcd262

* commit '0403dcd262980110ef2a24ac9c0a72d0dc3d96bb':
  Fix double mutex unlock and if() condition

Change-Id: Ib81d74eb8940060149509bcae7c8f289b3bf0f9c

8 years agoFix double mutex unlock and if() condition
Andre Eisenbach [Wed, 11 May 2016 03:27:20 +0000 (20:27 -0700)]
Fix double mutex unlock and if() condition

Commit "L2CAP and SDP Search API for BT profiles (2/2)" introduced two
separate issues in btsock_rfc_signaled():

1. The "slot_lock" potentially gets unlocked twice, causing
   undefined behaviour.

2. The call to BTA_JvRfcommWrite() was incorrectly taken outside
   of the conditional if() block that only executes the code if
   data is available.

This patch reverts the relevant locking change and fixes the if()
condition.

Bug: 27204458
Change-Id: I63b1257d21ca7bdd248858ec67e28f64e37a7895

8 years agoMove extern "C" to top of headers and remove tBTA_HF_CLIENT_HDR.
Bryce Lee [Wed, 11 May 2016 18:23:10 +0000 (18:23 +0000)]
Move extern "C" to top of headers and remove tBTA_HF_CLIENT_HDR.
am: 3d6accfcc0

* commit '3d6accfcc0bdc5c7a8713320c9bb069cbf253348':
  Move extern "C" to top of headers and remove tBTA_HF_CLIENT_HDR.

Change-Id: I0850e31cd573afb2ef6d625cbe8c6ae78ab3a000

8 years agoMove extern "C" to top of headers and remove tBTA_HF_CLIENT_HDR.
Bryce Lee [Wed, 11 May 2016 00:10:09 +0000 (17:10 -0700)]
Move extern "C" to top of headers and remove tBTA_HF_CLIENT_HDR.

Previously, extern "C" was placed in various locations within the header
files, sometimes below actual struct declarations. Doing so would lead to
alignment issues between C and C++ code.

tBTA_HF_CLIENT_HDR was removed from bta_hf_client_api since it was
extraneous and empty - leading to alignment issues.

Change-Id: Icdd338f1affe4c3a70c7bbd716249be6a16443d2

8 years agoChange initial order of commands after establishing an LE connection
Jakub Pawlowski [Wed, 11 May 2016 16:42:16 +0000 (16:42 +0000)]
Change initial order of commands after establishing an LE connection
am: 9376f77974

* commit '9376f7797412447a7a00aabafafc53f06232405f':
  Change initial order of commands after establishing an LE connection

Change-Id: I3cbf6a6f338085f6cf71ebbd757f24af17e51357

8 years agoChange initial order of commands after establishing an LE connection
Jakub Pawlowski [Wed, 11 May 2016 16:42:14 +0000 (16:42 +0000)]
Change initial order of commands after establishing an LE connection
am: 272c9711bc

* commit '272c9711bc6363f0b32c48a86d71726bdd9abfd9':
  Change initial order of commands after establishing an LE connection

Change-Id: Ia1d2d01da3f34efeefe17f61d7f82cb4d32f6cb3

8 years agoChange initial order of commands after establishing an LE connection
Jakub Pawlowski [Tue, 10 May 2016 23:43:41 +0000 (16:43 -0700)]
Change initial order of commands after establishing an LE connection

This patch changes order of commands send to LE device after connecting.
This will cause update connection parameters to be send after read
remote version. Having it other way around cause some problems with
broadcom chips, even though it should work both ways.

Bug: 28435172
Change-Id: I8ecf76217b036842e1d9ec7df714da94a99df7d5

8 years agoChange initial order of commands after establishing an LE connection
Jakub Pawlowski [Tue, 10 May 2016 20:29:59 +0000 (13:29 -0700)]
Change initial order of commands after establishing an LE connection

This patch changes order of commands send to LE device after connecting.
This will cause update connection parameters to be send after read
remote features. Having it other way around cause some problems with
broadcom chips, even though it should work both ways.

Bug: 28435172
Change-Id: I280993d40b63d41729f5a8ccf246809c3abf617d

8 years agoA2DP_SINK: create avrcp connection only if a2dp is successful
AnubhavGupta [Tue, 10 May 2016 19:25:42 +0000 (19:25 +0000)]
A2DP_SINK: create avrcp connection only if a2dp is successful
am: 71461b979a

* commit '71461b979a25adc0c30eae899837575e1d95490d':
  A2DP_SINK: create avrcp connection only if a2dp is successful

Change-Id: I66a2e42b6b491266eb6dd21d73b7409f0eade41d

8 years agoA2DP_SINK: create avrcp connection only if a2dp is successful
AnubhavGupta [Thu, 7 Apr 2016 17:35:53 +0000 (23:05 +0530)]
A2DP_SINK: create avrcp connection only if a2dp is successful

 Scenario: Pair and connect carkit to a remote mobile
           Disconnect from carkit
           Initiate connection from carkit and turn BT-OFF
           on remote mobile phone
 Issuses: Even though A2DP connection is unsuccessful we
          try to connect AVRCP connectoin
 Solution:
  - for a2dp sink, we should not send pending play command
  - we should create avrcp connection only if a2dp connection
    is successful

Change-Id: If2c6a3710b6ebdaa382a3d8bcae5c137aaef1f2c

8 years agoPTS: Read SMP pairing options from bt_stack.conf
Nitin Arora [Tue, 10 May 2016 15:16:51 +0000 (15:16 +0000)]
PTS: Read SMP pairing options from bt_stack.conf
am: 2aa2b80259

* commit '2aa2b80259612d1a324891c2e036a7bb002b2462':
  PTS: Read SMP pairing options from bt_stack.conf

Change-Id: Ic9a9c40284da55ff2389f5a987afaf8528867bfb

8 years agoPTS: Avoid BR SDP after LE pairing
Nitin Arora [Tue, 10 May 2016 15:16:49 +0000 (15:16 +0000)]
PTS: Avoid BR SDP after LE pairing
am: 4cdb0e547b

* commit '4cdb0e547b0dd056e60cc4724efa10c07e45fb96':
  PTS: Avoid BR SDP after LE pairing

Change-Id: I98b651ab3b94a8c9a71a892d4919e249da0b1bcf

8 years agoPTS: Allow disabling connection updates
Nitin Arora [Tue, 10 May 2016 15:16:48 +0000 (15:16 +0000)]
PTS: Allow disabling connection updates
am: 36ad41b678

* commit '36ad41b67822fed38597556eb102418ecf623c21':
  PTS: Allow disabling connection updates

Change-Id: I42444ce90406c09f0aed17a9032c357238022ecf

8 years agoPTS: Add a Secure Only mode.
Nitin Arora [Tue, 10 May 2016 15:16:47 +0000 (15:16 +0000)]
PTS: Add a Secure Only mode.
am: a0ee0f8968

* commit 'a0ee0f896808a0d78cbaa30afc432cee5cf4d658':
  PTS: Add a Secure Only mode.

Change-Id: Ib440967673774e098255d55f96dd40740aab27ce

8 years agoChanges to allow LE key upgrade
Nitin Arora [Tue, 10 May 2016 15:16:45 +0000 (15:16 +0000)]
Changes to allow LE key upgrade
am: 6ea4d23280

* commit '6ea4d232808d04f476b60aa2dcfc935ad4f8398e':
  Changes to allow LE key upgrade

Change-Id: Id3e99c6a5fea64432917da824fc8282565de9384

8 years agoPTS: Read SMP pairing options from bt_stack.conf
Nitin Arora [Sat, 12 Mar 2016 00:37:51 +0000 (16:37 -0800)]
PTS: Read SMP pairing options from bt_stack.conf

Use Case:
A number of cenrtification test cases require the host
to change the pairing options including auth request,
I/O capabilities, key distribution mask, key length
and Out of band capability.

Test Case: TP/PKE/BV-02-C

Failure:
Host currently only supports fixed SMP options and only
a few test cases involving pairing, are executed due
to that limitation.

Fix:
Added changes to read the SMP options from the bt_stack.conf
file at run time.
The pairing options are entered as a comma separated list eg:
SMPOptions=0xD,0x4,0xf,0xf,0x10
where the included hex values are in the following order:
\#auth, io, ikey, rkey, ksize
If all 5 options are not present, the host falls back to the
default values

Bug: 27852645
Change-Id: I693b05966695cf4660c5da10249c5f7c0663e53a

8 years agoPTS: Avoid BR SDP after LE pairing
Nitin Arora [Fri, 11 Mar 2016 02:27:24 +0000 (18:27 -0800)]
PTS: Avoid BR SDP after LE pairing

Use Case: Certification test case requiring LE secure pairing
with PTS.

Test Case: TP/SCJW/BV-01-C

Failure:
While pairing with PTS for certification test cases, LE secure
pairing followed by BR/EDR cross key derivation results in the
host initiating the SDP to gather the remote BR/EDR services.
PTS considers it as a test failure.

Fix: Added run time flag in bt_stack.conf file
"PTS_DisableSDPOnLEPair" to disable the SDP immidiately after
LE pairing followed by cross key derivation.

Bug: 27852645
Change-Id: Ib5a05c47b99c2ef8256967a608ae9ebbdfba60ee

8 years agoPTS: Allow disabling connection updates
Nitin Arora [Thu, 11 Jun 2015 00:10:57 +0000 (17:10 -0700)]
PTS: Allow disabling connection updates

Use Case: Certification test case requiring LE secure pairing
with PTS.

Failure:
LE pairing test cases follow the host behavior where
connection parameters are switched to fast parameters
for SMP and service discovery and switched back to the
default values after SMP/LE discovery is complete.
PTS disconnects to these series of connection updates.

Fix:
This change disables connection updates based on run time
flag "PTS_DisableConnUpdates" fetched from bt_stack.conf

Bug: 27852645
Change-Id: I1da213fd143ccfcb0ac82c7049a94094d2716ff1

8 years agoPTS: Add a Secure Only mode.
Nitin Arora [Fri, 11 Mar 2016 20:26:51 +0000 (12:26 -0800)]
PTS: Add a Secure Only mode.

Use Case:
Certification test cases require BLE to be in secure only
mode and reject legacy pairing requests.

Test Case: TP/SEC/SEM/BV-28-C

Failure:
Currently the host doesn't have a method of putting host into
a mode where it can only perform secure pairing.
This prevents execution of certification test cases
requiring Secure Only mode.

Fix:
Made changes to read the value of a tag "PTS_SecurePairOnly"
at runtime from the file "bt_stack.conf".

Bug: 27852645
Change-Id: I32cd6412621efeed2cb31c760a031762d9f369f9

8 years agoChanges to allow LE key upgrade
Nitin Arora [Tue, 30 Jun 2015 22:04:23 +0000 (15:04 -0700)]
Changes to allow LE key upgrade

Use Case: Certifiation test cases require the LE key upgrade
to happen when the current MITM level of the device has
been upgraded. In that case, a repairing is performed,
leading to more authenticated LTK.

Test Case: TP/SEC/AUT/BV-17-C

Steps:
1. Perform LE pairing between two devices using no MITM.
2. Change the IO capability of the devices, so that a
repair would involve authentication.
3. Reconnect the devices and expect key upgrade.

Failure:
No key upgrade is seen at reconnection and the devices
continue to use the old key.

Fix:
Added changes to re-calulate the requirement of key
upgrade when the LE channel is already encrypted.

Bug: 27852645
Change-Id: If62f334dcf298b2ce9840e95035b4398cb951c84

8 years agoFix undefined usage of snprintf
Ajay Panicker [Mon, 9 May 2016 18:26:59 +0000 (18:26 +0000)]
Fix undefined usage of snprintf
am: def4219f08

* commit 'def4219f08f34fd5d930b1b98cfd8e3f29b3fc86':
  Fix undefined usage of snprintf

Change-Id: I66b0939e09d2d32f4fbae8cdea6c8a8847d547cc

8 years agoRemove redefine of ARRAY_SIZE
Ajay Panicker [Mon, 9 May 2016 17:34:30 +0000 (17:34 +0000)]
Remove redefine of ARRAY_SIZE
am: 778d57b7e8

* commit '778d57b7e8222fff731d7deabed25983d508dc14':
  Remove redefine of ARRAY_SIZE

Change-Id: I1ab8580f2cc7d8cf51cf1b7a93733e3b8ec079ef

8 years agoFix undefined usage of snprintf
Ajay Panicker [Thu, 5 May 2016 21:51:34 +0000 (14:51 -0700)]
Fix undefined usage of snprintf

Using a buffer as both the format and output for snprintf could
cause undefinied behaviour on certain platforms. Instead just
use a temporary variable.

Bug: 27882028
Change-Id: If9f96fba4b3447b3248917ab9fb994bd80cbca0f

8 years agoUpdate l2c_fcr_clone_buf() to allocate large enough buffer
Pavlin Radoslavov [Mon, 9 May 2016 17:30:19 +0000 (17:30 +0000)]
Update l2c_fcr_clone_buf() to allocate large enough buffer
am: 871e9ba306

* commit '871e9ba3063530a81ca7ff03e8433c25e1e8c096':
  Update l2c_fcr_clone_buf() to allocate large enough buffer

Change-Id: Id80eba1a1bd5fba4b9fa525b05fe59ec0e4be61e

8 years agoRemove redefine of ARRAY_SIZE
Ajay Panicker [Fri, 6 May 2016 21:01:24 +0000 (14:01 -0700)]
Remove redefine of ARRAY_SIZE

Bug: 28621069
Change-Id: Ie3db0ff733052113493d0e53bb35e2d617c31bff

8 years agoUpdate l2c_fcr_clone_buf() to allocate large enough buffer
Pavlin Radoslavov [Mon, 9 May 2016 02:12:53 +0000 (19:12 -0700)]
Update l2c_fcr_clone_buf() to allocate large enough buffer

Apparently, in some parts of the code we assumed the original
buffer size is large enough and we can extend it and write
few more octets at the end.

Bug: 28351270
Change-Id: Idc53d8f68e55808c9f6bf7f18568288304a9bfb9

8 years agoLower unnecesary high log level
Jakub Pawlowski [Mon, 9 May 2016 16:05:50 +0000 (16:05 +0000)]
Lower unnecesary high log level
am: 292a62d370

* commit '292a62d3708900ba83c1789dc2c06d6dfdb0cfac':
  Lower unnecesary high log level

Change-Id: I83f1bb9d6797c5cc67bd37746498f221d7933bfb

8 years agoLower unnecesary high log level
Jakub Pawlowski [Fri, 6 May 2016 20:26:45 +0000 (13:26 -0700)]
Lower unnecesary high log level

Change-Id: Id4d255d79c844cd8dbf044e5bda073b8f5d784e7

8 years agoCall BTA_VendorCleanup() during actual cleanup of the stack
Pavlin Radoslavov [Fri, 6 May 2016 01:24:02 +0000 (01:24 +0000)]
Call BTA_VendorCleanup() during actual cleanup of the stack
am: 58318f48fc

* commit '58318f48fc93afe606c77f3ef83c7bff83b65bf8':
  Call BTA_VendorCleanup() during actual cleanup of the stack

Change-Id: Ib3ba5aea125cc08676cbe3bbea8eac7e0ca90085

8 years agoCall BTA_VendorCleanup() during actual cleanup of the stack
Pavlin Radoslavov [Thu, 5 May 2016 23:20:15 +0000 (16:20 -0700)]
Call BTA_VendorCleanup() during actual cleanup of the stack

Previously, BTA_VendorCleanup() was called during the shutdown
process, and this created race condition crashing the stack.

Bug: 28450506
Change-Id: Ibee90d406036862b95d18e2ef00b08b820c70f68

8 years agoMerge "Return handle if an RFCOMM port is already open"
Andre Eisenbach [Thu, 5 May 2016 23:44:37 +0000 (23:44 +0000)]
Merge "Return handle if an RFCOMM port is already open"
am: 6787eb8288

* commit '6787eb828800e0a0999db3c947e54818bbc1c101':
  Return handle if an RFCOMM port is already open

Change-Id: I41aedda07880ee8f25356b39dd1d818d7420498b

8 years agoMerge "Return handle if an RFCOMM port is already open"
Treehugger Robot [Thu, 5 May 2016 23:29:24 +0000 (23:29 +0000)]
Merge "Return handle if an RFCOMM port is already open"

8 years agoMerge "Fix size of SDP black list array"
Ajay Panicker [Thu, 5 May 2016 22:41:03 +0000 (22:41 +0000)]
Merge "Fix size of SDP black list array"
am: f7432dc822

* commit 'f7432dc8225e7085dd194e7a5f99243c019e195b':
  Fix size of SDP black list array

Change-Id: I34c18f6c51c2ac189ba456e603c4695f54644236

8 years agoMerge "Fix size of SDP black list array"
Treehugger Robot [Thu, 5 May 2016 22:31:40 +0000 (22:31 +0000)]
Merge "Fix size of SDP black list array"

8 years agoReturn handle if an RFCOMM port is already open
Andre Eisenbach [Thu, 5 May 2016 17:57:44 +0000 (10:57 -0700)]
Return handle if an RFCOMM port is already open

By returning the handle, the upper layer (BTA) will attempt to
disconnect on failure to connect. Thus the attempt to open the port will
still fail, but any subsequent attempts will be able to recover.

Bug: 27204458
Change-Id: I0f8489b98adeb7f5e217201ffbbb35132a66f210

8 years agoAllow C++ code to check bt_stack_config options
Myles Watson [Thu, 5 May 2016 21:04:57 +0000 (21:04 +0000)]
Allow C++ code to check bt_stack_config options
am: e8a76f58bc

* commit 'e8a76f58bc176828f1824044eebe33bb0d55b0ce':
  Allow C++ code to check bt_stack_config options

Change-Id: I50e07a19968183c523b0d2b5f09d2e11bde08a20

8 years agoFix size of SDP black list array
Ajay Panicker [Thu, 5 May 2016 19:51:49 +0000 (12:51 -0700)]
Fix size of SDP black list array

Bug: 28617843
Change-Id: Iff5690e3aae42d9907ed9351f1059461985c8a20

8 years agoAllow C++ code to check bt_stack_config options
Myles Watson [Thu, 5 May 2016 18:57:54 +0000 (11:57 -0700)]
Allow C++ code to check bt_stack_config options

Stack configuration options are parsed in C.

Bug: 28485365
Change-Id: I046ef5c676256a8da23bf8c0a7d1eeb1e9603c05

8 years agoFixed test_periodic_unregister_processing_queue unit test
Pavlin Radoslavov [Wed, 4 May 2016 23:44:17 +0000 (23:44 +0000)]
Fixed test_periodic_unregister_processing_queue unit test
am: f5d575c418

* commit 'f5d575c4183dae210876ff0f27a54747367b6a19':
  Fixed test_periodic_unregister_processing_queue unit test

Change-Id: I9add4ca7c14f0c03f22e33ad057fe47eb587d849

8 years agoAvoid NULL pointer usage of startup_future in case of HCI startup timeout
Pavlin Radoslavov [Wed, 4 May 2016 23:44:16 +0000 (23:44 +0000)]
Avoid NULL pointer usage of startup_future in case of HCI startup timeout
am: 3d1aa9d385

* commit '3d1aa9d3856342764db13503a07452a79edbaeda':
  Avoid NULL pointer usage of startup_future in case of HCI startup timeout

Change-Id: Id2c6442e547ed77ef685f9d0c37137d4d45c0e6c

8 years agoFixed test_periodic_unregister_processing_queue unit test
Pavlin Radoslavov [Wed, 4 May 2016 06:00:15 +0000 (23:00 -0700)]
Fixed test_periodic_unregister_processing_queue unit test

Removed a copy-and-paste check in the
test_periodic_unregister_processing_queue unit test.
The removed check adds little value - it has time-dependency,
and is not robust.

Bug: 26982349
Change-Id: I4adb948713b9946b5eb821d6fe52b7ada1400182

8 years agoAvoid NULL pointer usage of startup_future in case of HCI startup timeout
Pavlin Radoslavov [Wed, 4 May 2016 03:20:06 +0000 (20:20 -0700)]
Avoid NULL pointer usage of startup_future in case of HCI startup timeout

Previously, the startup_timer was created within the HCI layer start_up()
function, and after several vendor calls, we created the startup_future
that is used elsewhere. However, if any of the vendor calls blocks for
very long time, the startup_timer will timeout.
The startup_timer_expired() callback will try to use startup_future
that is still NULL, and that will trigger an assert.

The issue is avoided by creating the startup_future right before
the startup_timer is scheduled.

Bug: 28528815
Change-Id: Ib9f2c6581a86d3df0fd4d02d0b4c290663b5cfa1

8 years agoMerge "Update alarm_unregister_processing_queue() to cancel scheduled alarms"
Pavlin Radoslavov [Wed, 4 May 2016 00:05:52 +0000 (00:05 +0000)]
Merge "Update alarm_unregister_processing_queue() to cancel scheduled alarms"
am: 757b1b48d7

* commit '757b1b48d72a917443a6eb48dba45075d0e546c9':
  Update alarm_unregister_processing_queue() to cancel scheduled alarms

Change-Id: Ifb404ace4b6b24d673f3f67e0270f37f40eddf49

8 years agoMerge "Update alarm_unregister_processing_queue() to cancel scheduled alarms"
Treehugger Robot [Tue, 3 May 2016 23:57:18 +0000 (23:57 +0000)]
Merge "Update alarm_unregister_processing_queue() to cancel scheduled alarms"

8 years agoUpdate alarm_unregister_processing_queue() to cancel scheduled alarms
Pavlin Radoslavov [Mon, 2 May 2016 17:52:07 +0000 (10:52 -0700)]
Update alarm_unregister_processing_queue() to cancel scheduled alarms

Update the alarm_unregister_processing_queue() implementation
so it cancels all alarms that are scheduled on the corresponding
queue.
This fixes a race condition during Bluetooth shutdown: if an alarm
expires right after an alarm processing queue is invalidated,
the alarm processing would try to use the invalidated queue.

Added the corresponding unit tests.

Also, added a missing call to alarm_unregister_processing_queue().

Bug: 26982349
Change-Id: I09a111e8080b6dbc354dffa03a487f7a8c578ce6

8 years agoSimplify btif multi adv data handling
Jakub Pawlowski [Tue, 3 May 2016 19:57:44 +0000 (19:57 +0000)]
Simplify btif multi adv data handling
am: 1668d204a0

* commit '1668d204a0da63609fa1affcc86de9b76d0a0f48':
  Simplify btif multi adv data handling

Change-Id: I038037fcb58e82aa5fa59359bc905cdc5f3ce55b

8 years agoSimplify btif multi adv data handling
Jakub Pawlowski [Tue, 3 May 2016 16:42:34 +0000 (09:42 -0700)]
Simplify btif multi adv data handling

Use static fixed size arrays to transport advertisement data instead of
dynamically allocated ones. This simplifies memory allocation and
cleanup handling.

Bug: 28485365
Change-Id: I3a2642e3b11a272eeec50fd959e10820ea3de74f

8 years agoFix google-explicit-constructor warnings.
Chih-Hung Hsieh [Tue, 3 May 2016 18:48:34 +0000 (18:48 +0000)]
Fix google-explicit-constructor warnings.
am: 0194affe0f

* commit '0194affe0fb5e0d850206007bd56c6c15d91afae':
  Fix google-explicit-constructor warnings.

Change-Id: I40c225f5326a357d5d4887eb779d559f824e13f7

8 years agoFix google-explicit-constructor warnings.
Chih-Hung Hsieh [Tue, 3 May 2016 17:23:34 +0000 (10:23 -0700)]
Fix google-explicit-constructor warnings.

Bug: 28341362
Change-Id: I7ed9eb20b9b378a25a5454ce2ebfa113428baaf4

8 years agoBuild fix
Jakub Pawlowski [Tue, 3 May 2016 04:26:35 +0000 (04:26 +0000)]
Build fix
am: f9a8352fd2

* commit 'f9a8352fd2388b582b09fe01c9a4d4094b3c287c':
  Build fix

Change-Id: I99e209bcfcc4889b8e0208710245f0746f74929c

8 years agoBuild fix
Jakub Pawlowski [Tue, 3 May 2016 04:06:16 +0000 (21:06 -0700)]
Build fix

Change-Id: I6fd0ebe5e1d650ef307b22f96869c0004f6c956f

8 years agoAdd read/write timeout to the audio sockets
Pavlin Radoslavov [Tue, 3 May 2016 00:08:59 +0000 (00:08 +0000)]
Add read/write timeout to the audio sockets
am: 9fc08748b7

* commit '9fc08748b716e29d25d9cf1dc2ac918edda14d98':
  Add read/write timeout to the audio sockets

Change-Id: I6f38b5230d1ffc1ec43ba722d0584dc51dbc0324

8 years agoFix test_set_zero_periodic unit test failure
Pavlin Radoslavov [Tue, 3 May 2016 00:08:57 +0000 (00:08 +0000)]
Fix test_set_zero_periodic unit test failure
am: b290604bd8

* commit 'b290604bd88742c468a52ea4c261e1c74d7380fc':
  Fix test_set_zero_periodic unit test failure

Change-Id: I3a92fce4a46d53d615abf54389aac80a5db7144e

8 years agoAdd read/write timeout to the audio sockets
Pavlin Radoslavov [Mon, 2 May 2016 20:40:26 +0000 (13:40 -0700)]
Add read/write timeout to the audio sockets

Add read/write timeout of 2 seconds when reading/writing
from/to the audio-related control and data sockets.
Also, removed unnecessary poll(POLLOUT), because it is not needed anymore.

Bug: 27996931
Change-Id: Ib214a85f4837760b17cded155464957f56806bd3

8 years agoFix test_set_zero_periodic unit test failure
Pavlin Radoslavov [Mon, 2 May 2016 22:53:22 +0000 (15:53 -0700)]
Fix test_set_zero_periodic unit test failure

Removed an "EXPECT_EQ(cb_counter, 0)" statement
right after a timer of value 0 is scheduled.
The EXPECT_EQ statement shouldn't be there,
because by the time it is reached, the callback might
have been called already.

Change-Id: I61fbec96c436787321c6b36006a2bc1c0e627667

8 years agoConvert BTIF code from C to C++
Jakub Pawlowski [Mon, 2 May 2016 21:05:14 +0000 (21:05 +0000)]
Convert BTIF code from C to C++
am: 713993d178

* commit '713993d1784ab7c23aee1fa3cf1ab8676cc0aa69':
  Convert BTIF code from C to C++

Change-Id: I5ff141fbb5614e0eee7d0b14af39ba103c008ffa

8 years agoConvert BTIF code from C to C++
Jakub Pawlowski [Thu, 21 Apr 2016 20:16:45 +0000 (13:16 -0700)]
Convert BTIF code from C to C++

Modifications required:
 * added proper casting
 * moved variable definitions before goto statements
 * added 'extern "C"' markers where needed
 * renamed 'operator' to 'operator_name'

Bug: 28485365
Change-Id: I903357967387207e678866c02e008f047f8263f6

8 years agoFix issues during cleanup stage of the Bluetooth stack
Pavlin Radoslavov [Tue, 26 Apr 2016 22:27:46 +0000 (22:27 +0000)]
Fix issues during cleanup stage of the Bluetooth stack
am: 1bd691c

* commit '1bd691cb8ae3c23ffe25b5ca1fcfd11b82a9fbda':
  Fix issues during cleanup stage of the Bluetooth stack

Change-Id: I454cdfee1d7d618a018652b2dd08d3855d0bb42e

8 years agoHID: Fix compilation error when HID_HOST_REPAGE_WIN is set to 0
Hemant Gupta [Tue, 26 Apr 2016 21:29:53 +0000 (21:29 +0000)]
HID: Fix compilation error when HID_HOST_REPAGE_WIN is set to 0
am: 6bf5069

* commit '6bf50692ee2ff80cabb0649142d6627fdc2e9cc5':
  HID: Fix compilation error when HID_HOST_REPAGE_WIN is set to 0

Change-Id: I918abff787a202ece8b1aaf627c6f5ec670fe1c7

8 years agoFix issues during cleanup stage of the Bluetooth stack
Pavlin Radoslavov [Tue, 26 Apr 2016 19:18:36 +0000 (12:18 -0700)]
Fix issues during cleanup stage of the Bluetooth stack

 * Moved free-ing of bta_av_cb timers from the init function
   to the cleanup stage.
 * Changed the usage of btif_jni_disassociate() so it is called
   synchronously. Its previous usage was complicated -
   the function was called asynchronously on a different thread,
   and we had to wait on a future for its completion.
 * Renamed function btif_shutdown_bluetooth() to
   btif_cleanup_bluetooth() to represent better its purpose.
   Similarly, bte_main_shutdown() is renamed to bte_main_cleanup()

Also:
 * Removed function btif_init_fail(), because it is not used.
 * Updated an error log message inside function
   btif_in_execute_service_request() so the log information
   is accurate and more useful.
 * Updated the log messages related to the lifecycle of a module
   in btcore/src/module.c

Bug: 26982349
Change-Id: Icd6f159d993bdb9c8ef09bfb5b1386b3d6ea4ff2

8 years agoHID: Fix compilation error when HID_HOST_REPAGE_WIN is set to 0
Hemant Gupta [Fri, 22 Apr 2016 07:11:39 +0000 (12:41 +0530)]
HID: Fix compilation error when HID_HOST_REPAGE_WIN is set to 0

Update invalid function call to hidh_process_repage_process with
valid function call hidh_try_repage as this was leading to compilation
error when HID_HOST_REPAGE_WIN is set to 0

Change-Id: Ib94233ec83ac30dcae701a16c588a2e2a63cac99

8 years agoDo not log unsolicited NOOP command complete events
Andre Eisenbach [Tue, 26 Apr 2016 17:51:24 +0000 (17:51 +0000)]
Do not log unsolicited NOOP command complete events
am: 2641ef4

* commit '2641ef4998c3843c96ebc5e0edd58d1ff5d65df2':
  Do not log unsolicited NOOP command complete events

Change-Id: Ia8693958b5a677fe33dae875d08d3af2e1f25d7a

8 years agoDo not log unsolicited NOOP command complete events
Andre Eisenbach [Tue, 26 Apr 2016 16:51:06 +0000 (09:51 -0700)]
Do not log unsolicited NOOP command complete events

Bug: 27744135
Change-Id: I683e3a9f0a116f83763ebcf4d0583ea1c89ef5b2

8 years agoFix a race condition during alarm_cleanup()
Pavlin Radoslavov [Tue, 26 Apr 2016 15:36:44 +0000 (15:36 +0000)]
Fix a race condition during alarm_cleanup()
am: 9334247

* commit '93342476cae97c085e3f274a8bf1339b523f7132':
  Fix a race condition during alarm_cleanup()

Change-Id: I179478479d17f800aa5fcf989b82427fc6e53e2b

8 years agoFix a race condition during alarm_cleanup()
Pavlin Radoslavov [Mon, 25 Apr 2016 19:29:29 +0000 (12:29 -0700)]
Fix a race condition during alarm_cleanup()

Fix a race condition inside function alarm_cleanup() that
could be triggered during shutdown.

Also, fix few other issues:
 * Add missing "timer_delete(akeup_timer)" statement inside
   alarm_cleanup()
 * Fix the argument when calling "timer_delete(timer)"
 * Call "semaphore_free(alarm_expired)" inside alarm_cleanup()
   after the corresponding "timer" and "wakeup_timer" have
   been deleted.
 * Fix the argument type when calling eventfd_read() inside
   semaphore_wait()

Bug: 26982349
Change-Id: I2b00cd7ee7f56f755775f8e7b370006e31c6eb08

8 years agoUse audio_session_t consistently
Glenn Kasten [Mon, 25 Apr 2016 22:26:40 +0000 (22:26 +0000)]
Use audio_session_t consistently
am: f1c12e5

* commit 'f1c12e5e648bd1dcb2d0ecb935012ca063249e73':
  Use audio_session_t consistently

Change-Id: Ie3fc95140339bafa44b22588a25b01258180858b

8 years agoUse audio_session_t consistently
Glenn Kasten [Tue, 8 Mar 2016 20:12:33 +0000 (12:12 -0800)]
Use audio_session_t consistently

Bug: 27562099
Change-Id: I10780c8bfc84af568795a2c15557020fbe89a1c4

8 years agoAdd const guarantees
Jakub Pawlowski [Mon, 25 Apr 2016 19:23:36 +0000 (19:23 +0000)]
Add const guarantees
am: 063ca02

* commit '063ca0230d902b1397bb8c19366e807980d876f3':
  Add const guarantees

Change-Id: I5a1700be20f12bb687f79a1433c78c158bf060b2

8 years agoAdd const guarantees
Jakub Pawlowski [Mon, 25 Apr 2016 17:43:02 +0000 (10:43 -0700)]
Add const guarantees

This patch adds const qualifiers to parameter of some methods.
It adds no value right now, but will make conversion of btif to C++
much easier.

Change-Id: I380a63484230f92aedfd4ff5e1ee72f30307d9d9

8 years agoFix a Floating point exception for periodic timers
Pavlin Radoslavov [Fri, 22 Apr 2016 23:35:53 +0000 (23:35 +0000)]
Fix a Floating point exception for periodic timers
am: 399f217

* commit '399f217fddd4ce195ada3b69575caeca74ca1314':
  Fix a Floating point exception for periodic timers

Change-Id: Ia6d18b9950760aef1759c7e3ea2a1417432ea69b

8 years agoImprove debug-ability of the stack manager
Pavlin Radoslavov [Fri, 22 Apr 2016 23:35:53 +0000 (23:35 +0000)]
Improve debug-ability of the stack manager
am: 8e77215

* commit '8e7721573557c4ccb7918810349f8a80c2e49803':
  Improve debug-ability of the stack manager

Change-Id: I9857157c637342a70c02f7f237b18f4b1ce52bf4

8 years agoAdd missing mutex lock/unlock inside alarm_cleanup()
Pavlin Radoslavov [Fri, 22 Apr 2016 23:35:53 +0000 (23:35 +0000)]
Add missing mutex lock/unlock inside alarm_cleanup()
am: 06d3f47

* commit '06d3f477818b66ff1a113c8bf33f9f07f3950d32':
  Add missing mutex lock/unlock inside alarm_cleanup()

Change-Id: I5b152512e0a0ddfeda9ce0fb265f92cc08567382

8 years agoFix a Floating point exception for periodic timers
Pavlin Radoslavov [Wed, 20 Apr 2016 00:30:19 +0000 (17:30 -0700)]
Fix a Floating point exception for periodic timers

Fix a Floating point exception for periodic timers that are
scheduled with interval of 0ms, and add a corresponding unit test.
Also, fix a typo when printing "Action counts" statistics.

Bug: 28278593
Change-Id: Ic381efc573ed9954c36980c26a89318d2de40b29

8 years agoImprove debug-ability of the stack manager
Pavlin Radoslavov [Wed, 20 Apr 2016 02:20:01 +0000 (19:20 -0700)]
Improve debug-ability of the stack manager

Add or update existing log messages in the stack manager,
so it is clear when each of the init/startup/shutdown/cleanup
steps is executed and completed.
The added/updated log messages are at INFO level.

Bug: 26982349
Change-Id: Ie84aa8e96133999eb76c5b351ddd4fea56404ef0

8 years agoAdd missing mutex lock/unlock inside alarm_cleanup()
Pavlin Radoslavov [Wed, 20 Apr 2016 02:16:26 +0000 (19:16 -0700)]
Add missing mutex lock/unlock inside alarm_cleanup()

Bug: 26982349
Change-Id: I32f4e6450491adcc1e12e71fb8bb582d6397a91a

8 years agoFix FD leak caused by module wrapper thread
Manu Viswanadhan [Fri, 22 Apr 2016 22:07:58 +0000 (22:07 +0000)]
Fix FD leak caused by module wrapper thread
am: a6f0395

* commit 'a6f0395de4f636dd1b7cd2e237fe7f5321f114a6':
  Fix FD leak caused by module wrapper thread

Change-Id: I1ec2b181bff666c056dc4b62a8ca47c28e97ac94

8 years agoFix FD leak caused by module wrapper thread
Manu Viswanadhan [Tue, 19 Apr 2016 09:28:40 +0000 (14:58 +0530)]
Fix FD leak caused by module wrapper thread

Use Case: Repeated BT ON/OFF

Failure: FD leak is observed with ON/OFF stress test
which eventually leads to crash due to unavailability
of FDs.

Steps:
BT ON/OFF.

Root Cause: During cleanup the module wrapper thread is
stopped but the resources are not freed, leading to FD leak.

Fix: Cleanup the module wrapper thread properly so that there
are no resource leaks.

Bug: 28312228
Change-Id: I4de2fba9c98a0e4ae73315759ec6bc8bf273948e

8 years agoFix 64-bit build break.
Dan Albert [Fri, 22 Apr 2016 19:59:08 +0000 (19:59 +0000)]
Fix 64-bit build break.
am: c376302

* commit 'c3763020edb86027a5627154e9fec5d85e26e33e':
  Fix 64-bit build break.

Change-Id: I37012931ef7df78db4147cdbd9b5cce3b63eee33

8 years agoFix 64-bit build break.
Dan Albert [Fri, 22 Apr 2016 18:24:14 +0000 (11:24 -0700)]
Fix 64-bit build break.

Master (aosp and internal) has been broken for nearly two days now.

Was broken by https://android-review.googlesource.com/#/c/212244/
because no one checked 64-bit before merging.

No one noticed post-submit because the build servers aren't
checkbuilding any 64-bit targets (aside from mips64, which is broken
for other reasons).

I've uploaded a build change to get treehugger building a 64-bit
target (http://cr/120564724), and also to make all the targets
checkbuilds again (http://cr/120568746).

Change-Id: I195000284de5b52a539a47ad8b308990e72eea96

8 years agoProtect config module init and add date to config file
Ajay Panicker [Thu, 21 Apr 2016 23:34:37 +0000 (23:34 +0000)]
Protect config module init and add date to config file
am: 646134e0a0

* commit '646134e0a04459f649cb50aa9f3272054630c345':
  Protect config module init and add date to config file

Change-Id: Ie226b162fd335fb3a31741e33ba987271d39e9d9

8 years agoProtect config module init and add date to config file
Ajay Panicker [Mon, 18 Apr 2016 18:31:48 +0000 (11:31 -0700)]
Protect config module init and add date to config file

Bug: 27354612
Change-Id: I45c3c46cf9be81b9d235cfef68343413c98b6d4a

8 years agoMerge "Fix assertion failure in btif_sock_rfc"
Sharvil Nanavati [Thu, 21 Apr 2016 21:59:06 +0000 (21:59 +0000)]
Merge "Fix assertion failure in btif_sock_rfc"
am: 1423f8c4ba

* commit '1423f8c4babd9ecb2b4faf702601e734eecd9a08':
  Fix assertion failure in btif_sock_rfc

Change-Id: Ib5e970bb1e2f5e37cd778abeb415ea253e52013c

8 years agoMerge "Fix assertion failure in btif_sock_rfc"
Sharvil Nanavati [Thu, 21 Apr 2016 21:54:55 +0000 (21:54 +0000)]
Merge "Fix assertion failure in btif_sock_rfc"

8 years agoAdd missing init/destroy of state_lock mutex
Pavlin Radoslavov [Thu, 21 Apr 2016 17:54:19 +0000 (17:54 +0000)]
Add missing init/destroy of state_lock mutex
am: 4aa6d30d1c

* commit '4aa6d30d1cde7e261e240e0eb2afc0d5a1803757':
  Add missing init/destroy of state_lock mutex

Change-Id: If067e17a1fb5885acbbde0768851666c29bb75f4

8 years agoAdd missing init/destroy of state_lock mutex
Pavlin Radoslavov [Wed, 20 Apr 2016 19:06:08 +0000 (12:06 -0700)]
Add missing init/destroy of state_lock mutex

Add missing init/destroy of state_lock mutex inside file
btif_sock_l2cap.c.
Also, add a missing unlock for the same mutex.

Bug: 28296454
Change-Id: I48b8deb911d29e8dcc6b7243fd61fc3ba69046dd

8 years agoFix assertion failure in btif_sock_rfc
Sharvil Nanavati [Wed, 20 Apr 2016 17:49:10 +0000 (10:49 -0700)]
Fix assertion failure in btif_sock_rfc

The BTIF RFCOMM code was ignoring the status code on RFCOMM writes. In
the failure case, the slot id is 0 which is invalid. But the slot id
shouldn't even be referenced since the result was failure.

Stack trace:

__assert2+20               bionic/libc/bionic/assert.cpp:40
find_rfc_slot_by_id+18     system/bt/main/../btif/src/btif_sock_rfc.c:144
on_rfc_write_done          system/bt/main/../btif/src/btif_sock_rfc.c:537
rfcomm_cback+632           system/bt/main/../btif/src/btif_sock_rfc.c:585
bta_jv_rfcomm_write+74     system/bt/bta/./jv/bta_jv_act.c:2121
bta_jv_sm_execute+18       system/bt/bta/./jv/bta_jv_main.c:93
bta_sys_event+56           system/bt/bta/./sys/bta_sys_main.c:523
run_reactor+254            system/bt/osi/./src/reactor.c:278
run_thread+142             system/bt/osi/./src/thread.c:209
__pthread_start(void*)+30  bionic/libc/bionic/pthread_create.cpp:199
__start_thread+6           bionic/libc/bionic/clone.cpp:41

Bug: 27819511
Change-Id: Ifcd19fdfb214559f345567f04db8146b30037363

8 years agoFix sluggish HID devices
Bluetooth Build Test [Thu, 21 Apr 2016 15:49:15 +0000 (15:49 +0000)]
Fix sluggish HID devices
am: 46b8d12b92

* commit '46b8d12b92e74dc03cd17a77a3365cd4d96902f4':
  Fix sluggish HID devices

Change-Id: I8e50c5a89094b31fd0e2400d2e060c9b06f4e356

8 years agoFix sluggish HID devices
Bluetooth Build Test [Wed, 13 Apr 2016 14:39:53 +0000 (16:39 +0200)]
Fix sluggish HID devices

Right now, when connecting to HID devices, preferred connection
parameters are not being used. This is because of bug in GAP profile.
This make all HID devices use default connection parameters, which
mean that they behave sluggish. This patch fixes that by forcing
HID devices to re-read connection parameters on each reconnection.

This is a temporary workaround until GAP is rewritten.

Change-Id: I74b70ad8e96c29517cace808632fe4d8e0251994

8 years agoEnable test_vendor_lib compilation on Linux
Bluetooth Build Test [Wed, 20 Apr 2016 23:58:50 +0000 (23:58 +0000)]
Enable test_vendor_lib compilation on Linux
am: aabb300

* commit 'aabb3008aa03ad95339cf1a818c025301cbc14d3':
  Enable test_vendor_lib compilation on Linux

Change-Id: Ic75011df40615323592343247794769d66b99ba1

8 years agoEnable test_vendor_lib compilation on Linux
Bluetooth Build Test [Wed, 20 Apr 2016 19:35:28 +0000 (12:35 -0700)]
Enable test_vendor_lib compilation on Linux

8 years agovendor_libs: create Android.mk
Cristian Iorga [Wed, 20 Apr 2016 20:52:55 +0000 (20:52 +0000)]
vendor_libs: create Android.mk
am: 6f2ae30

* commit '6f2ae3021d3487ef00dd76f9bfb8ace8b7069b7d':
  vendor_libs: create Android.mk

Change-Id: I4e07e95b8b609cbd5625968c9daa5618edf2ddd7

8 years agovendor_libs: create Android.mk
Cristian Iorga [Tue, 15 Mar 2016 14:33:08 +0000 (16:33 +0200)]
vendor_libs: create Android.mk

all-subdir-makefiles call works for only one
nested sublevels, so we need to add a default
Android.mk in order to be able to build libbt-vendor module.

BUG=28014054

Change-Id: I7cc004d2a4dd6216a80d13c6384d9dcde328323e
Signed-off-by: Cristian Iorga <cristian.iorga@intel.com>
8 years agoMerge "vendor_libs: test_vendor_lib: fix build"
Cristian Iorga [Wed, 20 Apr 2016 16:00:24 +0000 (16:00 +0000)]
Merge "vendor_libs: test_vendor_lib: fix build"
am: 67a29d6

* commit '67a29d6259335cd12f6eb7f6daaec1785ed68d03':
  vendor_libs: test_vendor_lib: fix build

Change-Id: I21eef55cf5f3af64de9b0eb44df67b9ba300a683

8 years agoMerge "vendor_libs: test_vendor_lib: fix build"
Jakub Pawlowski [Wed, 20 Apr 2016 15:51:39 +0000 (15:51 +0000)]
Merge "vendor_libs: test_vendor_lib: fix build"