Commit Graph

810 Commits

Author SHA1 Message Date
Hemant Gupta
12358b4057 Merge "Bluetooth: Expose L2CAP API to support OPP 1.2"
am: 79eb213a98

Change-Id: I5f82a0c40c64fca0701abba44693b2892209acf3
2017-03-08 00:38:14 +00:00
Hemant Gupta
ef3e0dbf00 Bluetooth: Expose L2CAP API to support OPP 1.2
Add changes to expose L2CAP API to create an insecure L2CAP socket
for supporting OPP 1.2.

Test: Connect with Remote OPP Client supporting OPP 1.2 and verify
that connection and transfer happens over L2CAP. Connect with Remote
OPP Client supporting OPP 1.1 and verify that connection and transfer
happens over RFCOMM.

Bug: 33010988
Change-Id: I21ed672afb4ed5d2355ff0a0f9691af220921c1f
2017-03-07 02:30:52 +00:00
Pavlin Radoslavov
b7067e2b6c Merge "Add a mechanism to configure the default A2DP codec priorities" am: acf34d8b62
am: cd6e0ee19d

Change-Id: I6fb8a3a35451cf2d1e228466ef4a4d4e89d1d4ca
2017-02-07 00:10:21 +00:00
Pavlin Radoslavov
2199339c39 Add a mechanism to configure the default A2DP codec priorities
Previously, the relative codec priorities were hard-codec internally.
The new mechanism uses the following configurable resources in
packages/apps/Bluetooth/res/values/config.xml to re-assign the
default codec priorities per device, or to explicitly disable a codec.

 - a2dp_source_codec_priority_sbc
 - a2dp_source_codec_priority_aac
 - a2dp_source_codec_priority_aptx
 - a2dp_source_codec_priority_aptx_hd
 - a2dp_source_codec_priority_ldac

Those values are assigned on startup.
Also, they can be changed per device by using an overlay:
device/<VENDOR>/<DEVICE>/overlay/packages/apps/Bluetooth/res/values/config.xml

Test: Manually streaming to a headset
Change-Id: Ic4da3a51ac73f00cbae731156cb7878c8fadee06
2017-02-06 13:07:23 -08:00
Pavlin Radoslavov
91707989c4 Merge "Update the A2DP Codec Config API" am: ccd60f7cbe
am: f0096fb868

Change-Id: Ibc7d4b500adc4451978f366557b93dc6b6d3da63
2017-01-31 19:13:05 +00:00
Pavlin Radoslavov
b37f181c98 Update the A2DP Codec Config API
Previously, the JNI upcall would contain only the current codec config.
In the new API, the upcall contains:
 1. The current codec config
 2. The list of codecs containing the local codecs capabilities
 3. The list of codecs containing the selectable codecs capabilities.
    This list is the intersection of the local codecs capabilities
    and the capabilities of the paired device.

Also, refactored the Java internals to accomodate the extra information:
 * Added new class BluetoothCodecStatus that contains the extra info:
   current codec config, local codecs capabilities and selectable
   codecs capabilities
 * Renamed method getCodecConfig() to getCodecStatus() and return the
   corresponding BluetoothCodecStatus object.
 * Updates to class BluetoothCodecConfig:
   new methods isValid(), getCodecName(), and updated toString()
   so it is more user friendly
 * Removed BluetoothCodecConfig.EXTRA_CODEC_CONFIG and
   EXTRA_PREVIOUS_CODEC_CONFIG.
   The former is superseded by BluetoothCodecStatus.EXTRA_CODEC_STATUS;
   the latter is not really used.

Test: A2DP streaming with headsets and switching the codecs
Change-Id: Ia1af2c22e521e863e28a360610aca49f7e62d31b
2017-01-31 18:58:27 +00:00
Marie Janssen
ca312c1cd3 Merge "Bluetooth: add getDiscoveryEndMillis() call" am: 1785fc4eea
am: 7f8d8638eb

Change-Id: I6f02c4ddc0fe56cda5af2dcf2f5193ba13522792
2017-01-30 17:57:02 +00:00
Marie Janssen
23a4833157 Bluetooth: add getDiscoveryEndMillis() call
Method to tell when the adapter finished (or will finish) being in
discovery mode.

Test: compiles and still can scan
Bug: 34395439
Change-Id: I41b48c2b934c0a1d5e1727cec08f3f762e3cb309
2017-01-27 18:48:11 -08:00
Pavlin Radoslavov
d364208388 Merge "Integration of the AAC codec for A2DP source" am: 22f97c83fb
am: f23e80bb9b

Change-Id: If2d85eba17f7ece5b3d19e3ee8fc86b7cf9bc062
2017-01-26 19:25:37 +00:00
Pavlin Radoslavov
b33bd5bc2e Integration of the AAC codec for A2DP source
Test: A2DP streaming to AAC headsets
Bug: 30958229
Change-Id: I1b530f1c5c495b8231fd68bed788d4567096683d
2017-01-26 09:06:02 -08:00
Sanket Agarwal
c8399321e9 Change HFP Client API to support multi device
- Adds BluetoothDevice as a parameter where required
- Gets rid of device management APIs that can be done via
  BluetoothProfiles instead

Test: Manual sanity tests
Bug: b/33554547
Bug: b/30984220
Change-Id: I3485ac5bfe1fcb29c774ad040fdd608e1cacb8df
(cherry picked from commit 039eeb81b5)
2017-01-23 22:53:58 +00:00
Sanket Agarwal
a3ae5c4e24 Change HFP Client API to support multi device
- Adds BluetoothDevice as a parameter where required
- Gets rid of device management APIs that can be done via
  BluetoothProfiles instead

Test: Manual sanity tests
Bug: b/33554547
Bug: b/30984220
Change-Id: I3485ac5bfe1fcb29c774ad040fdd608e1cacb8df
(cherry picked from commit 039eeb81b5)
2017-01-20 19:30:35 -08:00
Neil Fuller
43d53395dc Merge "Refactor RFCOMM / BluetoothSocket usage of LocalSocket" am: 649a89e524
am: f4e236c794

Change-Id: If23b5efe912c5b0a76487c46723288ff6a903a14
2017-01-11 13:48:14 +00:00
Neil Fuller
7fd724611b Refactor RFCOMM / BluetoothSocket usage of LocalSocket
LocalSocket is used by BluetoothSocket. BluetoothSocket
passes a pre-created file descriptor to LocalSocket that
is then given to the LocalSocketImpl.

Commit b08c7bc0bd broke the
behavior. Commit 7a8c36aa4e
put in a minimal fix.

This change tidies up LocalSocket and associated classes
and replaces a specialist constructor with a factory method
to highlight the special case. While there an unnecessary
exception has been removed.

Bug: 34111534
Test: Boot device
Test: vogar --mode app_process tests/tests/net/src/android/net/cts/LocalSocketTest.java
Change-Id: I4ba2f2d9ea361a950ff8bc8d64fc800d998c3210
2017-01-06 14:18:07 +00:00
Pavlin Radoslavov
7d14914239 Merge "Integration of the LDAC codec for A2DP source" am: 3c050268f0
am: bb8f1cd92b

Change-Id: I62f8462330d7661b8008abf862c4d4bb47c129dc
2017-01-05 07:55:27 +00:00
Pavlin Radoslavov
fad8b730d2 Integration of the LDAC codec for A2DP source
The codec can be used if the encoding shared library is installed
on the device:
 libldacBT_enc.so

Test: A2DP streaming to LDAC headsets
Bug: 30958229

Change-Id: I524805fd308b5181427515617eda05625a7c4ae5
2017-01-04 18:07:29 -08:00
Pavlin Radoslavov
5aaa985e97 Merge "Integration of the aptX and aptX-HD codecs for A2DP source" am: 5242acbd0b
am: a750c90ac1

Change-Id: I7957fb151bb113485240fdc2bae1cdd380930f27
2017-01-05 02:07:05 +00:00
Pavlin Radoslavov
feeb9b245c Integration of the aptX and aptX-HD codecs for A2DP source
Each of the codecs can be used if the corresponding encoding
shared library is installed on the device:
 - aptX: libaptX.so
 - aptX-HD: libaptXHD.so

Test: A2DP streaming to aptX and aptX-HD headsets
Bug: 30958229
Change-Id: I24faddc8cd88ae3e1370922c633f30e13124a867
2017-01-04 16:30:35 -08:00
Ivan Podogov
8e2e2b1381 Merge "HID Device role API fixes" am: f33a71d017
am: a7d58fecc6

Change-Id: Iab0dc91a8e2d4066d5eb85ec4771d42642783671
2017-01-04 10:41:26 +00:00
Ivan Podogov
f33a71d017 Merge "HID Device role API fixes" 2017-01-04 10:32:41 +00:00
Pavlin Radoslavov
da3de76bdb Merge "Add a mechanism for configuring the A2DP Source codecs" am: 63270f2b96
am: 8b46f87e7e

Change-Id: I39e4b90491f646887200649954b652d9f5439925
2017-01-04 03:44:40 +00:00
Pavlin Radoslavov
44a4ef0aa9 Add a mechanism for configuring the A2DP Source codecs
* Added a new class BluetoothCodecConfig that contains codec-related
  configuration or capabilities: codec type, priority, sample rate,
  bits per sample, channel mode, and codec specific fields.

* Extended the Bluetooth A2DP AIDL interface to get/set the current
  codec configuration

* Added new call handleBluetoothA2dpDeviceConfigChange() to the Media
  Framework that is called when there are changes in the
  Bluetooth A2DP device configuration - e.g., the A2DP codec is changed.

Test: A2DP streaming to headsets, TestPlans/71390
Bug: 30958229
Change-Id: I9a82716cbc2a5efbe77352a031ac80c88f6a2459
2017-01-03 17:52:52 -08:00
Ivan Podogov
dd87cd3bb6 HID Device role API fixes
This change makes HIDD API more like the other ones, i.e.
supporting multiple devices, and implements missing methods.

While the underlying implementation may still only support a
single device at a time, the "device" parameter can still be
useful for checking if the application is trying to send the
data to a correct device.

Test: make
Change-Id: I55fe04c0762a96fcddd6c6678e790361d648111a
2017-01-03 22:36:30 +00:00
Ivan Podogov
72d9008700 Fix profiles broken by ag/1751147
am: 5297dba712

Change-Id: I9c0a4ead26f60b601847c1ba73e6b492a3611880
2016-12-30 23:07:32 +00:00
Ivan Podogov
5297dba712 Fix profiles broken by ag/1751147
Change-Id: Ifa92819df8e63355a3979ea0f1a20a0363b6cd45
2016-12-30 22:22:38 +00:00
Marie Janssen
07e590a574 resolve merge conflicts of c816141 to nyc-mr1-dev-plus-aosp
Change-Id: I42e00b90165220d88519771b8f4280aaf3a07525
2016-12-29 14:05:47 -08:00
Marie Janssen
c816141bce resolve merge conflicts of 9cc7ebe to stage-aosp-master
Change-Id: Ia1cdf49d77a574c38ed5cc33c31d5cf930103484
2016-12-29 12:44:03 -08:00
Ivan Podogov
91ab2e2f98 Rename the Bluetooth profile classes for HID Device role. am: 0afe190af5
am: 94e3d3f499

Change-Id: I97ff93fd2564bd76d90095f8086f79c6c6086aff
2016-12-29 19:46:55 +00:00
Hemant Gupta
1ee22b7f70 Bluetooth: Add support for HID Device Role am: e88fd4b594
am: ee469c6fe9

Change-Id: Ic48911d254671d402f5a6b8198109f28e6497036
2016-12-29 19:46:08 +00:00
Ivan Podogov
94e3d3f499 Rename the Bluetooth profile classes for HID Device role.
am: 0afe190af5

Change-Id: Ib5c9b904da57048d719df504142edd3dab0e6ec3
2016-12-29 19:38:41 +00:00
Hemant Gupta
ee469c6fe9 Bluetooth: Add support for HID Device Role
am: e88fd4b594

Change-Id: Ic2a82d5670ffbd3046766d73ed9b180546c59169
2016-12-29 19:37:58 +00:00
Marie Janssen
9cc7ebe7d9 Merge "Bluetooth: track enabling in dumpsys" 2016-12-29 19:32:36 +00:00
Marie Janssen
5980456040 Bluetooth: track enabling in dumpsys
Move basic state dumpsys to here from AdapterService.

Track which apps are enabling and disabling Bluetooth, including BLE
apps, and show the apps in the dumpsys logs.

Test: start phone and enable/disable, take bug report
Bug: 33692282
Change-Id: I6ea62ebdcfd7873d0be1bb5c5c520bbce3737a40
2016-12-29 19:22:14 +00:00
Ivan Podogov
0afe190af5 Rename the Bluetooth profile classes for HID Device role.
We already have BluetoothInputDevice class, so adding something
called BluetoothHidDevice seems confusing. On the other hand,
the new class is designed to connect to HID Host devices, so
naming it BluetoothInputHost makes sense and goes in line with
the existing BluetoothInputDevice.

The same goes for the new constant HID_DEVICE that is just as
confusing to have together with the INPUT_DEVICE one.

This CL also renames the "connection state changed" broadcast
(for the same reasons), declares it as an SDK constant, and also
adds some javadoc to it.

Note that BluetoothHidDeviceApp* classes remained unchanged, as
those correspond to the app that implements the Device (and
connects to the Host).

Test: make
Change-Id: I5075ca5b97db3c1dd403c2e9660eecc7380cffe2
2016-12-29 14:30:40 +00:00
Hemant Gupta
e88fd4b594 Bluetooth: Add support for HID Device Role
This patch adds the HID Device Role support in Bluetooth framework.
Also AIDL and callback related files for HID Device role are added
to provide interface for third party applications to communicate with
HID Device Service.

Change-Id: Id03a362b7bcfa2e76056fa0197eaac12ce49b5a2
2016-12-29 14:29:53 +00:00
Marie Janssen
f2fc15824d resolve merge conflicts of 7a2518e to nyc-mr1-dev-plus-aosp
Change-Id: I903680717ed121a93fee3b7c2ed358cb29726d71
2016-12-14 13:44:28 -08:00
Marie Janssen
7a2518ee6e Merge "Bluetooth: log message improvements"
am: f34bdf7676

Change-Id: Ic89c59257559d95119829fa4157dbb763124e86f
2016-12-14 20:01:39 +00:00
Marie Janssen
cb21ad71ed Bluetooth: log message improvements
Some log improvements:
 - Reduce logspam
 - Use names for states in logs instead of numbers
 - Be more consistent with messages

Also remove some commented out dead code.

Test: run on phone, observe more useful logs
Change-Id: I32163278e148be144c03d4e8aaf0eb761226c94c
2016-12-14 09:51:30 -08:00
Ivan Podogov
903d6414e5 resolve merge conflicts of b1e2da7 to nyc-mr1-dev-plus-aosp
Test: build police
Change-Id: Ifec1ab6760ebb94b0b411c9c60f07066e151206b
2016-12-13 17:55:14 +00:00
Svetoslav Ganov
c2ac5bde6f DO NOT MERGE Add Bluetooth toggle prompts - framework
If permission review is enabled toggling bluetoth on or off
results in a user prompt to collect consent. This applies
only to legacy apps, i.e. ones that don't support runtime
permissions as they target SDK 22.

Also added a configuration resource which controls whether
permission review mode is enabled. By default it is not and
an OEM can change this via an overlay. For now we also keep
the old mechanism to toggle review mode via a build property
which is still used and will be removed when clients have
transitioned.

bug:28715749
Change-Id: I77bca2305f9d0f20034b2c8fc5b58e0565d5e617
2016-12-12 09:50:24 -08:00
Svetoslav Ganov
b1e2da7c24 Add Bluetooth toggle prompts - framework
If permission review is enabled toggling bluetoth on or off
results in a user prompt to collect consent. This applies
only to legacy apps, i.e. ones that don't support runtime
permissions as they target SDK 22.

Also added a configuration resource which controls whether
permission review mode is enabled. By default it is not and
an OEM can change this via an overlay. For now we also keep
the old mechanism to toggle review mode via a build property
which is still used and will be removed when clients have
transitioned.

bug:28715749

Change-Id: I94c5828ad6c8aa6b363622a26ff9da4fc2e2fac7
2016-12-02 11:52:18 +00:00
Jakub Pawlowski
e8ceb15b51 Merge "Bluetooth: report proper advertiser status on error" am: b509957e62
am: 673c0e5596

Change-Id: Ic91b1c614e9cc71e7d57bd39ac31ec1127f08f65
2016-11-23 02:03:13 +00:00
Jakub Pawlowski
673c0e5596 Merge "Bluetooth: report proper advertiser status on error"
am: b509957e62

Change-Id: I1bb0a029a9044c3931e158c7ef02ffee4cb0f1cd
2016-11-23 01:58:03 +00:00
Jakub Pawlowski
76f517a173 Bluetooth: report proper advertiser status on error
When advertiser is not started because too many advertisers are
registered, return proper error code.

Bug: 30622771
Test: sl4a ConcurrentBleAdvertisingTest
Change-Id: I57384ff30132e9a7ee17dcf191ff89baa7abf1ef
2016-11-22 13:38:15 -08:00
Jakub Pawlowski
d81df46e80 Merge "Bluetooth: advertising improvements" am: 82c9ba9c55
am: e3b71cd572

Change-Id: I54df9c355ac951d40b2d8e865d5f36f8875ce71f
2016-11-11 23:58:44 +00:00
Jakub Pawlowski
e3b71cd572 Merge "Bluetooth: advertising improvements"
am: 82c9ba9c55

Change-Id: I662ba0f326aa204f9f07ce88bc9d48f5b06770cb
2016-11-11 23:48:51 +00:00
Jakub Pawlowski
3d83b0e90b Bluetooth: advertising improvements
This patch removes isPeripheralModeSupported(), hidden public method
which is always returning true. It also modify the BluetoothLeAdvertiser
to be able to use advertising instance with instance id equal 0.

Bug: 30622771
Bug: 24099160
Change-Id: Id31582621dbe56d5c3a8d4ee5cd296af66a5f026
2016-11-11 23:28:32 +00:00
Jakub Pawlowski
f59ad8bd68 Merge "BLE OOB Pairing - parse address type (5/5)" am: 97d9fe0a2f
am: c3cfff6ef6

Change-Id: Ia05bccadc06b202cf6ac1039b1e227bd67575bb5
2016-11-10 20:14:24 +00:00
Jakub Pawlowski
c3cfff6ef6 Merge "BLE OOB Pairing - parse address type (5/5)"
am: 97d9fe0a2f

Change-Id: I935cc35d9f7f1eea5459f0091ad14dc8b200bc02
2016-11-10 20:07:39 +00:00
Jakub Pawlowski
f465823f6d BLE OOB Pairing - parse address type (5/5)
When address type is not parsed, creating bond to devices not using
random address is impossible.

Bug: 32780409
Test: try pairing with nRF52DK using random address
Change-Id: Ie6cc1f8c008d43b2acd021b47f9bbfb1f63472e8
2016-11-10 19:51:49 +00:00