Commit Graph

956 Commits

Author SHA1 Message Date
Jakub Pawlowski
09ad0b27bb Discover primary service by UUID for PTS tests (4/4)
Bug: 38123054
Test: manual
Change-Id: I89e088e60f4325f1ece59d22efda0c907a3b716a
(cherry picked from commit fe2bf16a2b)
2017-05-16 13:50:11 -07:00
Jakub Pawlowski
fec6ef8e90 Bluetooth: Fix interval low/min values
Bug: 38175945
Test: none
Change-Id: Idf487c7aafc518f2c57be78a1fa979b2c4a383d6
(cherry picked from commit 6b1f39502c)
2017-05-10 01:30:31 +00:00
Ajay Panicker
a71643e91c 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-04 23:48:04 +00:00
Ajay Panicker
4d1fb218f4 Merge "Limit btsnoop file size (3/9)" into oc-dev 2017-05-04 22:56:21 +00:00
Ajay Panicker
4d71437598 Limit btsnoop file size (3/9)
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
Change-Id: I40d5da4c1b1c9b45908e5790d130f1c5e804c773
2017-05-04 09:56:50 -07:00
TreeHugger Robot
d53a71f443 Merge "Add persistent state for Bluetooth high quality audio support" into oc-dev 2017-05-04 01:37:07 +00:00
Antony Sargent
f5772c6121 Add persistent state for Bluetooth high quality audio support
Defines the flags used in code and the Settings.Global key names for
persisting the following state for Bluetooth A2DP Sink devices:
-Whether the device supports optional codecs or not
-Whether optional codecs should be turned on for the device

For each of these two properties we model the state in the code as
yes/no/unknown, so that we can tailor the UI and behavior
accordingly.

Bug=37441685
Test: manually

Change-Id: I6bcd02fd7c95bef989575f3b13d4788dab61971a
2017-05-03 04:36:51 +00:00
Ruben Brunk
6bdc550e27 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
2017-05-03 00:11:10 +00:00
Jakub Pawlowski
17100948f9 Bluetooth: bluetooth.le API fixes
Fix minor spelling problems.
Throw IllegalStateException instead of IllegalArgumentException in
build().

Bug: 37532634
Test: none
Change-Id: I73b6f04aec98f5baffb06a363e2a3f71e8cec3c4
(cherry picked from commit 9d4abb5631)
2017-04-28 21:51:53 +00:00
Jakub Pawlowski
56d8f786a5 Bluetooth: Add constants to ScanResult
Add TX_POWER_NOT_PRESENT and PERIODIC_INTERVAL_NOT_PRESENT

Test: none
Bug: 37536707
Change-Id: Ia48a30f44a961c6e0babd17ecaed0eb93c98ecad
(cherry-picked from commit c7c01a2877)
2017-04-27 22:22:36 +00:00
Jakub Pawlowski
0e0e75793d Fix NPE when accessing mCallback in BluetoothGatt
This issue was introduced in commit
4eab49652e.

Bug: 37710354
Test: none
Change-Id: I2d985ce97c44d4e096713e156e57437f44ea3ddb
(cherry picked from commit 0e4ac75f2e)
2017-04-27 13:16:32 -07:00
Jakub Pawlowski
348ba3da78 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
(cherry picked from commit 4bc4a44100)
2017-04-27 13:15:58 -07:00
Jakub Pawlowski
ce21cb903c 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
(cherry picked from commit de74891d1c)
2017-04-27 13:15:43 -07:00
Jakub Pawlowski
91fe3080e7 Bluetooth: expand comments on new PHY constants
Bug: 37544152
Test: the all-knowing eyes of the reviewers
Change-Id: I8f5a756a204fe90960700e1dc42f64824d3b844a
(cherry picked from commit 60c7dac775)
2017-04-25 13:00:52 -07:00
Jakub Pawlowski
e7c6e6ae1f Bluetooth: document status value in PHY read/update
Bug: 37544152
Test: none
Change-Id: I2bac468f833c73cd282b1dac80b6553917996604
(cherry picked from commit e55c446977)
2017-04-25 13:00:43 -07:00
Jakub Pawlowski
b0f647492f Bluetooth: Add handler parameter to connectGatt
Bug: 37544152
Test: sl4a GattReadTest GattWriteTest
Change-Id: I043dfefaafe9f3700418f2c855c52aac3644310f
(cherry picked from commit 4eab49652e)
2017-04-25 13:00:36 -07:00
Jakub Pawlowski
d2ac8b94e7 Get rid of the IAdvertiserCallabck
Bug: 30622771
Test: none
Change-Id: I2c55f96e71cd3be67f88201ab07c91730cd85971
(cherry picked from commit 89e10d3eb4)
2017-04-25 13:00:25 -07:00
Amith Yamasani
ad8f086912 Add link to class with constants
Addresses api-council feedback

Change-Id: I2dcd526a266a2320b34c714fd91fb4a83d382d9c
Fixes: 37536012
Test: make update-api
2017-04-24 11:01:20 -07:00
Jeff Sharkey
6bc03748a7 Merge "More auto-doc work." into oc-dev 2017-04-22 19:11:34 +00:00
TreeHugger Robot
afe32d2fb1 Merge "Allow the Bluetooth MAC address to be updated asynchronously (2/3)" into oc-dev 2017-04-22 00:17:29 +00:00
Jeff Sharkey
910e081216 More auto-doc work.
Add support for AnyThread, CallSuper, and UiThread.

Another related CL started documenting @RequiresPermission, so remove
duplicated information in existing APIs.

Suppress auto-doc on a handful of classes that are already
well-documented.

Test: make -j32 offline-sdk-docs
Bug: 37526420
Change-Id: I791437dccec0f11d5349a23b982ba098cb551af8
2017-04-21 16:35:08 -06:00
Stanley Tng
dd749b0f61 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
(cherry picked from commit ad4d1d8e28)
2017-04-21 22:19:57 +00:00
Jakub Pawlowski
76cceb1189 Bluetooth: improve getLeMaximumAdvertisingDataLength comment
Bug: 37534792
Test: none
Change-Id: Ieff71356aceb0e2a4c6e81d9053f854448e0c927
(cherry picked from commit 4634b5cd27)
2017-04-21 13:41:37 -07:00
Amith Yamasani
461111bc3d BLE scan API using PendingIntent
This allows apps to listen for beacons, etc., without having to
run a foreground service and register a callback. They can instead
register a PendingIntent which will be fired when scan results
are available or when an error occurs.

Bug: 37254611
Test: WIP
Change-Id: I1793eee67ff0211370ed6fc38be4d95a4c5853f5
2017-04-14 16:16:42 -07:00
Jakub Pawlowski
a51513747a 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
(cherry picked from commit 9e377194e3)
2017-04-14 07:33:55 +00:00
Jack He
76cd53a953 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
(cherry picked from commit e86bdcaed1)
2017-04-12 22:24:37 +00:00
Jakub Pawlowski
326996916d 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
(cherry picked from commit e6c453d828)
2017-04-11 09:13:38 -07:00
Jakub Pawlowski
1ab569d43f 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
(cherry picked from commit 010cc95583)
2017-04-11 09:13:31 -07:00
Jakub Pawlowski
5203f76933 Bluetooth: fix comment wording
Test: manual
Bug: 30622771
Change-Id: I5a589c98553f35248b0d95d332e9f35774075b24
(cherry picked from commit e7f89b07e6)
2017-04-11 09:13:18 -07:00
Jakub Pawlowski
260846b31b 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
(cherry picked from commit 5a355610fe)
2017-03-31 22:47:19 -07:00
Jakub Pawlowski
d89e4ba357 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
(cherry picked from commit f4ed33f5fa)
2017-03-31 22:47:18 -07:00
Jakub Pawlowski
66bf1bd18b 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
(cherry picked from commit 72e9e9f815)
2017-03-31 22:47:18 -07:00
Jakub Pawlowski
a537b3f1f8 Hide periodic scanning
Bug: 30622771
Test: manual
Change-Id: I5d786b13cf99287732e16769e2563ac7c4fe715c
(cherry picked from commit 63fad69a19)
2017-03-31 22:47:17 -07:00
Jakub Pawlowski
f752ace75a Bluetooth API spelling fixes ("wether" -> "whether")
Bug: 30622771
Test: manual
Change-Id: I01c8b18d0057f2fd6e477ce2ca0b779321b6c0e6
(cherry picked from commit 08ed924d89)
2017-03-31 22:47:16 -07:00
Ajay Panicker
fc61da5ada Bluetooth: Add additional BluetoothSocket logging to root cause errors
Bug: 34780400
Test: Code still compiles
Change-Id: I166842ecc6889f9ea403e7aa3678ed818cd80968
2017-03-31 22:36:26 +00:00
Pavlin Radoslavov
011597b5a9 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
(cherry picked from commit 61075105ca)
2017-03-29 15:58:25 -07:00
Jakub Pawlowski
1d978329df Merge "Bluetooth GATT callback naming fix "Ext" -> "" (1/2)" am: beb8ceada8 am: cfe099b01d
am: b4e8fd65bf

Change-Id: I31be1d92cf7ad95214bf353dca20b990a280f996
2017-03-27 21:34:23 +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
36a44f070e Merge "Expose connection update callback (4/4)" am: 60865e4a8d am: 45487910b4
am: ccff3be9d4

Change-Id: I621210ff8d2c0b203d86e6ad2a11402466724b97
2017-03-24 20:46:59 +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
2a5b32faec Merge "Bluetooth 5 Enable->Enabled (1/2)" am: fa69eeac5c am: cde107da6c
am: 88e9c86822

Change-Id: I10b47fa5566c05ddeef5e13ee9d1593c648a0b48
2017-03-23 01:33:35 +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
93a094c37f Merge "BluetoothGattCallbackExt removal" am: e2ddacaff4 am: 2a32d04a24
am: 822ddff283

Change-Id: I2bffe270bde8eecd2673b75fbd578f833b59f402
2017-03-23 00:58:44 +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
Jakub Pawlowski
d64bb883d8 BluetoothGattCallbackExt removal
New methods should be added to BluetoothGattCallback, instead of
creating Ext class.

Test: manual
Bug: 30622771
Change-Id: I2567df5baace6bd2d2f30c36d2f62056408ca5d0
2017-03-22 18:27:10 +00:00
Jakub Pawlowski
a9795ca6be Merge "Add setScannable to AdvertisingSetParameters (1/2)" am: 7f14b8f095 am: 8d06b41826
am: 34d23b7794

Change-Id: I960254d1c051f58c882a6c39bb6fb2173a47c0ef
2017-03-21 18:59:57 +00:00
Jakub Pawlowski
9cd0d3eec3 Merge "Add missing txPower parameter" am: a6c1f6def1 am: 43f71975d0
am: ac5adba90e

Change-Id: I0f7b282fb1a0d09742f8a8e9aca5a62b841adf0a
2017-03-21 18:58:31 +00:00