Commit Graph

885 Commits

Author SHA1 Message Date
Jakub Pawlowski
fe2bf16a2b Discover primary service by UUID for PTS tests (4/4)
Bug: 38123054
Test: manual
Change-Id: I89e088e60f4325f1ece59d22efda0c907a3b716a
2017-05-16 11:37:00 -07:00
Hemant Gupta
cef9ce368c Bluetooth: HID: Add support for Set Idle and Get Idle Commands (3/4)
Provides an interface for application to send Set Idle
and Get Idle commands to remote HID Device. Support for these
two commands was missing from existing code, so existing code
design is reused to add support for these two commands.

Without this support following mandatory PTS test cases for HID 1.0
cannot be passed, TC_HOS_HID_BV_05/06.

Test: Executed PTS tests TC_HOS_HID_BV_05/06 and confirmed if they can
pass

Bug: 34344715
Change-Id: I548362cc328498920b2dae740f1a76b2cc2d6a67
2017-05-10 16:23:17 +00:00
Sunny Kapdi
037d3513e0 Bluetooth: Fix Periodic Adv interval check
The MIN and MAX values need to be swapped else
the parameter check in setInterval would always
fail

Bug: 37579882
Change-Id: I48538c2a61be88caaf04abd94074b3d9eb6dde96
2017-05-10 07:23:06 +00:00
Jakub Pawlowski
6b1f39502c Bluetooth: Fix interval low/min values
Bug: 38175945
Test: none
Change-Id: Idf487c7aafc518f2c57be78a1fa979b2c4a383d6
2017-05-09 22:59:18 +00:00
Ajay Panicker
a43bd01bd1 Bluetooth: Move Bluetooth battery stats tracking (1/2)
Move Bluetooth battery stats tracking to AppScanStats for a more
unified tracking system.

Bug: 37720787
Test: cts-tradefed run cts-dev -m CtsIncidentHostTestCases -t com.android.server.cts.BatteryStatsValidationTest#testBleScans
      Perform BLE scan and check battery stats
Change-Id: Ie6c682374e6e258c291d3a11eede649c7747ef40
2017-05-09 17:52:36 +00:00
Ruben Brunk
c131051e28 Fix Bluetooth GATT API default handler assignment
Restores previous behaviour where GATT callbacks are invoked on the
binder thread and not the calling process main looper thread.

This fixes performance regressions as well as some
NetworkOnMainThreadException's for some applications.

Bug: 37544152
Bug: 37871717
Test: Covered by prior API tests.
Change-Id: Id8ab705dd4d7f00030e6ac29e056dde5180670e9
(cherry picked from commit 6bdc550e27)
2017-05-05 22:22:50 +00:00
Jakub Pawlowski
9d4abb5631 Bluetooth: bluetooth.le API fixes
Fix minor spelling problems.
Throw IllegalStateException instead of IllegalArgumentException in
build().

Bug: 37532634
Test: none
Change-Id: I73b6f04aec98f5baffb06a363e2a3f71e8cec3c4
2017-04-28 21:35:53 +00:00
Jakub Pawlowski
c7c01a2877 Bluetooth: Add constants to ScanResult
Add TX_POWER_NOT_PRESENT and PERIODIC_INTERVAL_NOT_PRESENT

Test: none
Bug: 37536707
Change-Id: Ia48a30f44a961c6e0babd17ecaed0eb93c98ecad
2017-04-27 21:03:46 +00:00
Jakub Pawlowski
0e4ac75f2e Fix NPE when accessing mCallback in BluetoothGatt
This issue was introduced in commit
4eab49652e.

Bug: 37710354
Test: none
Change-Id: I2d985ce97c44d4e096713e156e57437f44ea3ddb
2017-04-27 19:37:35 +00:00
Ajay Panicker
37cad12cb1 Merge "Limit btsnoop file size (3/8)" 2017-04-27 17:29:37 +00:00
Ajay Panicker
731a26666d Limit btsnoop file size (3/8)
Limit btsnoop file size by rotating between snoop files. The rotation occurrs
when a fixed number of packets have been logged and will start overwriting
the older file.

Bug: 35998031
Test: Enable snoop logs from developer options and let logs get large
Merged-In: I40d5da4c1b1c9b45908e5790d130f1c5e804c773
Change-Id: I40d5da4c1b1c9b45908e5790d130f1c5e804c773
2017-04-27 00:05:31 +00:00
Treehugger Robot
bdeb8539e8 Merge "Bluetooth: expand comments on new PHY constants" 2017-04-25 19:36:37 +00:00
Treehugger Robot
1f4e111808 Merge "Bluetooth: Add handler parameter to connectGatt" 2017-04-25 19:36:22 +00:00
Jakub Pawlowski
60c7dac775 Bluetooth: expand comments on new PHY constants
Bug: 37544152
Test: the all-knowing eyes of the reviewers
Change-Id: I8f5a756a204fe90960700e1dc42f64824d3b844a
2017-04-25 17:46:50 +00:00
Jakub Pawlowski
e55c446977 Bluetooth: document status value in PHY read/update
Bug: 37544152
Test: none
Change-Id: I2bac468f833c73cd282b1dac80b6553917996604
2017-04-25 17:46:40 +00:00
Jakub Pawlowski
4eab49652e Bluetooth: Add handler parameter to connectGatt
Bug: 37544152
Test: sl4a GattReadTest GattWriteTest
Change-Id: I043dfefaafe9f3700418f2c855c52aac3644310f
2017-04-25 17:46:33 +00:00
Jakub Pawlowski
89e10d3eb4 Get rid of the IAdvertiserCallabck
Bug: 30622771
Test: none
Change-Id: I2c55f96e71cd3be67f88201ab07c91730cd85971
2017-04-24 15:42:57 +00:00
Jakub Pawlowski
4634b5cd27 Bluetooth: improve getLeMaximumAdvertisingDataLength comment
Bug: 37534792
Test: none
Change-Id: Ieff71356aceb0e2a4c6e81d9053f854448e0c927
2017-04-21 20:28:39 +00:00
Stanley Tng
ad4d1d8e28 Allow the Bluetooth MAC address to be updated asynchronously (2/3)
There are intermittent issues where either the returned Bluetooth
MAC address to Java framework is uninitialized or this address update
arrives too late. This fix will do 2 things:
(1) Returns error when MAC address is unavailable in the native code.
(2) Updates the MAC address later by adding a new broadcast event.

Test: Check address for these cases: factory reset, system reboot, and
Bluetooth re-enable.
Bug: 36709382

Change-Id: I09720193e38fdf9139e1bb146f8e1847e2b65b1a
2017-04-20 23:34:20 +00:00
Jakub Pawlowski
4bc4a44100 Expose LE advertiser address for easier PTS tests (1/6)
This patchset adds a hidden method getOwnAddress, that lets app with
BLUETOOTH_PRIVILEGED permission to lear their own addreess. This is done
exclusively for PTS tests.

Bug: 35147497
Test: manual
Change-Id: Iaf0f2fe0613de44b8430ac25e691d66a4ad44f8d
2017-04-19 21:32:57 +00:00
Jakub Pawlowski
de74891d1c Read by UUID for PTS tests (1/5)
Add a hidden api for reading characteristic by UUID for PTS.

Bug: 35150313
Test: sl4a GattReadTest.byUuid
Change-Id: Ice4076d99e4694d20374ba0fdcae74d5ae841147
2017-04-18 20:47:03 +00:00
Jakub Pawlowski
9e377194e3 Bluetooth 5 PHY simplification
Having PHY_LE_* constants defined in four different places, with one
value being different than others is misleading. Leave just PHY_LE_*
definitions in BluetoothDevice, and add PHY_LE*_MASK for the mask used
in PHY update API.

This patch also removes need to translate PHY value between PHY update
request and event, as mask is used for request, and the value is
returned in event.

Bug: 30622771
Test: manual
Change-Id: I897effa1204a024465d55501c83c542566c4d37c
2017-04-12 10:57:03 -07:00
Jakub Pawlowski
e6c453d828 Remove enable from PeriodicAdvertisingPariameters (1/2)
Instead of setting enable to true, one can just pass null
PeriodicAdvertisingParameters and achieve same result when starting the
set.
Passing the "enable" when updating the parameters make no sense, and
might be confusing.
Experience with "timeout" field, which was a part of AdvertiseSettings
show that merging fields that go into different HCI commands can cause
problems during processing, so keep enable as separate field.

Test: manual
Bug: 30622771
Change-Id: Ida02c59eb8433537179b4d22202fe745f8b4bb3e
2017-04-11 06:18:44 +00:00
Jack He
e86bdcaed1 Add developer setting and system API for inband ringing support
* Add 1 system API to check inband ringing flag in config.xml
	static isInbandRingingSupported(Context)
* Add developer menu options to enable this feature

Bug: 19171297
Test: mm -j 40, HFP regression testing, testplans/82144
Change-Id: Iaf56ea41911f546bbc7ae1f82e399d0f8d48f75f
2017-04-10 19:49:36 +00:00
Jakub Pawlowski
010cc95583 Bluetooth 5 fix default AdvertisingSetParameters values
Having advertiser be scannable and connectable by default is a bad
choice for new advertising set.

Bug: 30622771
Test: sl4a Bt5ScanTest
Change-Id: I4fc270e78ca4e62d3077c5cd28aa59b0518d2e77
2017-04-06 17:21:28 +00:00
Jakub Pawlowski
8c5b5b0c4b Merge "Bluetooth 5 advertising duration refactoring (4/4)"
am: 3946df68ed

Change-Id: I04f7f867a1387d1816d007ba4bdebf9eecc66b06
2017-04-01 04:42:45 +00:00
Jakub Pawlowski
821523d859 Merge "Bluetooth LE Advertising minor improvements"
am: 3d84362412

Change-Id: Idc51a6673d8c29a22f9bed177ecb949a49480e3a
2017-04-01 04:40:10 +00:00
Jakub Pawlowski
5a355610fe Bluetooth 5 advertising duration refactoring (4/4)
Expose both duration and maximum extended advertising events to limit
advertising time.

Test: manual
Bug: 30622771
Change-Id: I44df300995ef985526b93f8c24389775720b3432
2017-04-01 04:34:40 +00:00
Jakub Pawlowski
f4ed33f5fa Bluetooth LE Advertising minor improvements
This patch adds some additional error checking for the advertising set
parameters, and some more comments.

Test: manual
Bug: 30622771
Change-Id: I87bd44f4179ef63694ad3ed656dc2acc52e40f1e
2017-04-01 04:33:24 +00:00
Ajay Panicker
7eaf518b71 Merge "Bluetooth: Add additional BluetoothSocket logging to root cause errors"
am: 985fe4cbd2

Change-Id: I81f642bae7fe8f1530db6474ebab26760c707fa3
2017-04-01 03:28:13 +00:00
Treehugger Robot
985fe4cbd2 Merge "Bluetooth: Add additional BluetoothSocket logging to root cause errors" 2017-04-01 03:18:46 +00:00
Jakub Pawlowski
21bd8d5f2e Merge "Fix advertise data size estimation"
am: 5b2e9f40b4

Change-Id: Ic6c0a5d5a988ebeedde333910281af54c026f428
2017-04-01 02:13:41 +00:00
Jakub Pawlowski
72e9e9f815 Fix advertise data size estimation
UUID in service data field can be 2, 4, or 16 bytes long.

Test: manual
Bug: 36553478
Change-Id: Ib5ba2d16065496ca311e8642a15a7ea6bc84d4c1
2017-03-31 16:52:48 -07:00
Ajay Panicker
c251633ce2 Bluetooth: Add additional BluetoothSocket logging to root cause errors
Bug: 34780400
Test: Code still compiles
Change-Id: I166842ecc6889f9ea403e7aa3678ed818cd80968
2017-03-31 21:22:59 +00:00
Jakub Pawlowski
c06722e788 Merge "Hide periodic scanning"
am: ca7544ea15

Change-Id: Icedae1d34de063d6b708a30bdc6217d48ed373ef
2017-03-30 03:26:18 +00:00
Jakub Pawlowski
63fad69a19 Hide periodic scanning
Bug: 30622771
Test: manual
Change-Id: I5d786b13cf99287732e16769e2563ac7c4fe715c
2017-03-29 17:11:59 -07:00
Pavlin Radoslavov
25105f6561 Merge "Add new internal API: enableOptionalCodecs()/disableOptionalCodecs()"
am: 3c7fce3579

Change-Id: Ic8483107e72a61e8b07f26f343e36254fe57cfd9
2017-03-29 22:47:28 +00:00
Treehugger Robot
3c7fce3579 Merge "Add new internal API: enableOptionalCodecs()/disableOptionalCodecs()" 2017-03-29 22:41:15 +00:00
Jakub Pawlowski
eeedda1453 Merge "Bluetooth: fix comment wording"
am: 6ba7c54a51

Change-Id: I745973b35e5d756072bff1d0958470dc0f55f6ca
2017-03-29 18:28:44 +00:00
Pavlin Radoslavov
61075105ca Add new internal API: enableOptionalCodecs()/disableOptionalCodecs()
This API can be used to enable the optional codecs, or disable them
and use only the mandatory SBC.
Internally, it is implemented by raising the SBC priority to
highest (so SBC will be used/selected), or reducing the SBC priority
to its default value (lowest).

Test: A2DP streaming and enabling/disabling/selecting optional codecs
Bug: 35873828
Change-Id: Ia82036ac33590a3a402b1f5a36102264d47a9029
2017-03-29 10:58:48 -07:00
Jakub Pawlowski
e7f89b07e6 Bluetooth: fix comment wording
Test: manual
Bug: 30622771
Change-Id: I5a589c98553f35248b0d95d332e9f35774075b24
2017-03-29 16:34:07 +00:00
Jakub Pawlowski
5cca752a4b Merge "Bluetooth API spelling fixes ("wether" -> "whether")"
am: 81cef3aeb8

Change-Id: Ief280cbc9283ff1cabdd3c8e53fcabd47c7881b1
2017-03-28 20:12:46 +00:00
Jakub Pawlowski
08ed924d89 Bluetooth API spelling fixes ("wether" -> "whether")
Bug: 30622771
Test: manual
Change-Id: I01c8b18d0057f2fd6e477ce2ca0b779321b6c0e6
2017-03-28 18:09:50 +00:00
Jakub Pawlowski
cfe099b01d Merge "Bluetooth GATT callback naming fix "Ext" -> "" (1/2)"
am: beb8ceada8

Change-Id: Ie88e330a1d50adac8c6b83581079c6096c4d898a
2017-03-27 21:22:15 +00:00
Jakub Pawlowski
d7116bea06 Bluetooth GATT callback naming fix "Ext" -> "" (1/2)
Gatt callback don't need the "Ext" postfix, as it was removed from new
API.

Test: manual
Bug: 30622771
Change-Id: I54596ffdcb818343cc313123266cfa16291c6236
2017-03-27 19:27:57 +00:00
Jakub Pawlowski
45487910b4 Merge "Expose connection update callback (4/4)"
am: 60865e4a8d

Change-Id: I0f5301b195b697743d1fb552dac4af8e1fd1445c
2017-03-24 20:36:30 +00:00
Jakub Pawlowski
326f7b31b9 Expose connection update callback (4/4)
Test: manual
Bug: 30622771
Change-Id: I56a3c42814249abc33e95e84ce092c2d8df65434
2017-03-24 17:22:54 +00:00
Jakub Pawlowski
cde107da6c Merge "Bluetooth 5 Enable->Enabled (1/2)"
am: fa69eeac5c

Change-Id: Ia09cf5db2f69659a3b77e4c5e663d5977793df48
2017-03-23 01:25:31 +00:00
Jakub Pawlowski
2a32d04a24 Merge "BluetoothGattCallbackExt removal"
am: e2ddacaff4

Change-Id: I59ba6c9950997ea447a5b021d509a72abc546661
2017-03-23 00:44:06 +00:00
Jakub Pawlowski
7998be9e44 Bluetooth 5 Enable->Enabled (1/2)
Test: manual
Bug: 30622771
Change-Id: I37b198927076a0267de67e1bd94eaea9e88e53bb
2017-03-22 15:42:53 -07:00