Commit Graph

1270 Commits

Author SHA1 Message Date
Jakub Pawlowski
8d0eb01843 Merge "ScanRecord.getServiceData NPE fix"
am: d62f74e806

Change-Id: I11a254cf633dc5cf9a7c53c992bf49b00f3d274e
2018-06-11 09:07:31 -07:00
Jakub Pawlowski
59880123d7 ScanRecord.getServiceData NPE fix
Bug: 109662587
Change-Id: I0e9653d9cd7e4b748870bacb6fbcecae535ebb2a
2018-06-11 14:43:42 +00:00
Jack He
896e129f5f Bluetooth: Fix HFP SCO logic and documentation
AudioService:
* Call setBtScoActiveDevice and setBluetoothScoOn both in AudioService's
  broadcast receiver so that these two methods must be triggerred in
  the same sequence as ACTIVE_DEVICE_CHANGED and AUDIO_STATE_CHANGED
  intents are sent and we no longer need to handle race condition by
  synchronously checking active device in setBluetoothScoOn
* Default sco audio mode when no headset is active should be virtual
  voice call, as many HFP devices do not accept SCO audio without an
  ongoing call
* Synchronize checkScoAudioState() method with mScoClients
* Add helper functions connectBluetoothScoHelper and
  disconnectBluetoothScoHelper to call various SCO setup and tear down
  methods based on sco audio mode
* Try raw, virtual call, and voice recognition mode when disconnecting
  externally started SCO
* Add new sco state SCO_STATE_DEACTIVATING to allow back to back calling
  of startBluetoothSco and stopBluetoothSco

Audio Manager:
* Modified AudioManager logic so that removed devices callback is called
  before newly added devices

BluetoothHeadset:
* Modified BluetoothHeadset so that start and stop SCO using virtual
  voice call no longer need a parameter and will use active device by
  default
* Modified documentation around various sco mangement APIs to match
  their expected behaviors

Bug: 76114959
Test: VoIP calls sanity test cases
Change-Id: Id50db88f4ff36069b0f392c81dd9d90c24cd2206
(cherry picked from commit 89f979849a)
2018-05-07 12:57:26 -07:00
android-build-team Robot
e3e55b865b Merge "Bluetooth: Fix HFP SCO logic and documentation" into pi-dev
am: 1ae21127da

Change-Id: I9b4fcac73a283aac1794e13cce464728612fd0dc
2018-05-07 12:56:06 -07:00
Jack He
89f979849a Bluetooth: Fix HFP SCO logic and documentation
AudioService:
* Call setBtScoActiveDevice and setBluetoothScoOn both in AudioService's
  broadcast receiver so that these two methods must be triggerred in
  the same sequence as ACTIVE_DEVICE_CHANGED and AUDIO_STATE_CHANGED
  intents are sent and we no longer need to handle race condition by
  synchronously checking active device in setBluetoothScoOn
* Default sco audio mode when no headset is active should be virtual
  voice call, as many HFP devices do not accept SCO audio without an
  ongoing call
* Synchronize checkScoAudioState() method with mScoClients
* Add helper functions connectBluetoothScoHelper and
  disconnectBluetoothScoHelper to call various SCO setup and tear down
  methods based on sco audio mode
* Try raw, virtual call, and voice recognition mode when disconnecting
  externally started SCO
* Add new sco state SCO_STATE_DEACTIVATING to allow back to back calling
  of startBluetoothSco and stopBluetoothSco

Audio Manager:
* Modified AudioManager logic so that removed devices callback is called
  before newly added devices

BluetoothHeadset:
* Modified BluetoothHeadset so that start and stop SCO using virtual
  voice call no longer need a parameter and will use active device by
  default
* Modified documentation around various sco mangement APIs to match
  their expected behaviors

Bug: 76114959
Test: VoIP calls sanity test cases
Change-Id: Id50db88f4ff36069b0f392c81dd9d90c24cd2206
2018-05-04 19:49:49 -07:00
Stanley Tng
c87223b718 Fix spelling errors in BluetoothGatt documentation
Correct "paramter" to "parameter". Correct "connectoin" to connection.

Bug: 79198797
Test: Compile
Change-Id: I98646eec66da2aaa6f74ae2db35ea914c6a105a1
(cherry picked from commit 505c05839b)
2018-05-04 23:20:46 +00:00
android-build-prod (mdb)
fe1ad15da1 Merge "Fix spelling errors in BluetoothGatt documentation" am: e7b05b8797
am: ea18806cb7

Change-Id: I5fcb0f3506a4e8856c2971302c98f4ba5b9ffffc
2018-05-03 15:16:49 -07:00
Stanley Tng
505c05839b Fix spelling errors in BluetoothGatt documentation
Correct "paramter" to "parameter". Correct "connectoin" to connection.

Bug: 79198797
Test: Compile
Change-Id: I98646eec66da2aaa6f74ae2db35ea914c6a105a1
2018-05-03 20:43:40 +00:00
android-build-prod (mdb)
97ca124998 Merge "Get/Set IO capability of Bluetooth device" am: d1ed784438
am: badce3de08

Change-Id: I112edc1bb98d4dea7c5d166c4858685bb0a40a00
2018-04-30 16:03:40 -07:00
android-build-team Robot
69b1fce562 Merge "Truncate newline and tab characters in BluetoothDevice name" into pi-dev 2018-04-30 18:54:34 +00:00
Pulkit Bhuwalka
979698bc2c Get/Set IO capability of Bluetooth device
Creates the hidden BluetoothAdapter APIs which can be used to
control IO capability settings on the local Bluetooth device.

Bug: 36015413
Test: Used a test activity to control getting/setting the value and
attempting pairing.

Change-Id: Ibbfdc5ae5a1d56c6e3d003ab3bf5d095dcb583e4
(cherry picked from commit 6043b7b90a27a836241bfc05e71eb46ce04c66cf)
2018-04-28 13:45:44 -07:00
Hansong Zhang
2e3bf46039 Truncate newline and tab characters in BluetoothDevice name
Test: manual
Bug: 73173182
Change-Id: I7f2201cab36adf7f01d1a794d783cb78a536811f
2018-04-26 14:22:39 -07:00
TreeHugger Robot
1c75189a0a Merge "Fix the implementation of BluetoothCodecStatus.equals()" into pi-dev 2018-04-20 02:12:09 +00:00
Pavlin Radoslavov
a291ce625a Fix the implementation of BluetoothCodecStatus.equals()
Previously, the BluetoothCodecStatus.equals() implementation
was incorrect when comparing arrays of capabilities.
In the new implementation, the arrays are compared correctly,
and also the ordering of the capabilities in each array is ignored.

Also, added unit tests for class BluetoothCodecConfig and class
BluetoothCodecStatus.

Bug: 73404858
Bug: 73379307
Test: Unit tests (in frameworks/base)
  runtest --path core/tests/bluetoothtests/src/android/bluetooth/BluetoothCodecConfigTest.java
  runtest --path core/tests/bluetoothtests/src/android/bluetooth/BluetoothCodecStatusTest.java

Change-Id: If22087465397b7c4175c33f7d1909a15d957fb24
Merged-In: If22087465397b7c4175c33f7d1909a15d957fb24
(cherry picked from commit 9d36e6babc)
2018-04-19 17:26:31 -07:00
Stanley Tng
0d5aa574d6 Cleanup documentation for LE CoC in BluetoothAdapter
Test: Compile
Bug: 77631591
Change-Id: Ic3c7f13e560534a048bf5c8b274fe62190c214c7
(cherry picked from commit dac8e14018)
2018-04-19 21:57:09 +00:00
Pavlin Radoslavov
9d36e6babc Fix the implementation of BluetoothCodecStatus.equals()
Previously, the BluetoothCodecStatus.equals() implementation
was incorrect when comparing arrays of capabilities.
In the new implementation, the arrays are compared correctly,
and also the ordering of the capabilities in each array is ignored.

Also, added unit tests for class BluetoothCodecConfig and class
BluetoothCodecStatus.

Bug: 73404858
Bug: 73379307
Test: Unit tests (in frameworks/base)
  runtest --path core/tests/bluetoothtests/src/android/bluetooth/BluetoothCodecConfigTest.java
  runtest --path core/tests/bluetoothtests/src/android/bluetooth/BluetoothCodecStatusTest.java

Change-Id: If22087465397b7c4175c33f7d1909a15d957fb24
2018-04-19 14:36:18 -07:00
Stanley Tng
d0c1b23e06 Clarify API doc for BluetoothGattServer::addService
Clarify that the caller has to wait for onServiceAdded callback before
calling BluetoothGattServer::addService again.

Bug: 72717069
Test: Compile
Change-Id: I20b031c724ba64bfd71cf10e58e587f69e4a2555
(cherry picked from commit 4b5cf48560)
2018-04-18 16:10:11 -07:00
Treehugger Robot
f493c66f39 Merge "Clarify API doc for BluetoothGattServer::addService" 2018-04-17 00:07:38 +00:00
Stanley Tng
dac8e14018 Cleanup documentation for LE CoC in BluetoothAdapter
Test: Compile
Bug: 77631591
Change-Id: Ic3c7f13e560534a048bf5c8b274fe62190c214c7
2018-04-16 22:33:31 +00:00
Stanley Tng
4b5cf48560 Clarify API doc for BluetoothGattServer::addService
Clarify that the caller has to wait for onServiceAdded callback before
calling BluetoothGattServer::addService again.

Bug: 72717069
Test: Compile
Change-Id: I20b031c724ba64bfd71cf10e58e587f69e4a2555
2018-04-16 13:12:52 -07:00
Stanley Tng
bbb35c0ba6 Add min_ce/max_ce parameters to requestLeConnectionUpdate()
Add new test parameters, min_ce and max_ce, to the SL4A tests for LE
Connection-oriented Channel (CoC) feature. This CL passes these 2
parameters to native stack.

Test: Run cmd: act.py -c $MY_SL4A_CONFIG -tc BleCoc2ConnTest
Bug: 77528723

Change-Id: I9d3d74f671772014209f8114c2d1b8ba606c54d5
(cherry picked from commit 148dd5bf86)
2018-04-12 09:00:05 -07:00
Stanley Tng
0980006a2a Merge "Add min_ce/max_ce parameters to requestLeConnectionUpdate()" 2018-04-12 14:36:12 +00:00
TreeHugger Robot
06d4cda1ac Merge changes from topic "hid-device-app-name" into pi-dev
* changes:
  Show Bluetooth HID Device connection status in Settings
  Bluetooth: Add hidden API to get current user of HID Device (1/3)
2018-04-06 22:23:39 +00:00
Treehugger Robot
d61e87ad08 Merge "Bluetooth: Add hidden API to get current user of HID Device (1/3)" 2018-04-06 21:54:06 +00:00
Hansong Zhang
3b8f09b3c5 Hearing Aid: change get/set active device (3/3)
* setActiveDevice() returns false in error case, e.g. when the device is
not connected
* add getActiveDevices() instead of isActiveDevice(), which returns a list
that must have two elements: left and right, or empty list on error

Test: manual
Bug: 69623109
Change-Id: I48f3388c56434d0c21e09bd8b794e58848cd8794
(cherry picked from commit 8d799f8340)
2018-04-04 14:54:07 -07:00
Hansong Zhang
baca867094 Bluetooth: Add hidden API to get current user of HID Device (1/3)
Bug: 69136526
Test: test with apps using HID Device profile
Change-Id: If0e49840257c877c975c2da176a08e613668cbc3
(cherry picked from commit 347ef4099e)
2018-04-03 16:09:40 -07:00
Hansong Zhang
347ef4099e Bluetooth: Add hidden API to get current user of HID Device (1/3)
Bug: 69136526
Test: test with apps using HID Device profile
Change-Id: If0e49840257c877c975c2da176a08e613668cbc3
2018-04-03 12:12:53 -07:00
Stanley Tng
148dd5bf86 Add min_ce/max_ce parameters to requestLeConnectionUpdate()
Add new test parameters, min_ce and max_ce, to the SL4A tests for LE
Connection-oriented Channel (CoC) feature. This CL passes these 2
parameters to native stack.

Test: Run cmd: act.py -c $MY_SL4A_CONFIG -tc BleCoc2ConnTest
Bug: 77528723

Change-Id: I9d3d74f671772014209f8114c2d1b8ba606c54d5
2018-04-03 11:36:51 -07:00
Hansong Zhang
8d799f8340 Hearing Aid: change get/set active device (3/3)
* setActiveDevice() returns false in error case, e.g. when the device is
not connected
* add getActiveDevices() instead of isActiveDevice(), which returns a list
that must have two elements: left and right, or empty list on error

Test: manual
Bug: 69623109
Change-Id: I48f3388c56434d0c21e09bd8b794e58848cd8794
2018-03-29 17:54:24 -07:00
Hansong Zhang
4b410fa9f9 Bluetooth HIDD: Remove unplug()
Remove the hidden unplug() API because it is not used and it can cause
the remote device to be unpaired. System apps should use unbond() and
user apps should not use reflection to invoke it.

Bug: 67866553
Test: SL4A
Change-Id: I1bdc06dbb5460c9fd52230b78cbf9434a4349d24
(cherry picked from commit dbc6d14f6e)
2018-03-28 23:18:54 +00:00
Hansong Zhang
dbc6d14f6e Bluetooth HIDD: Remove unplug()
Remove the hidden unplug() API because it is not used and it can cause
the remote device to be unpaired. System apps should use unbond() and
user apps should not use reflection to invoke it.

Bug: 67866553
Test: SL4A
Change-Id: I1bdc06dbb5460c9fd52230b78cbf9434a4349d24
2018-03-28 20:11:18 +00:00
Ajay Panicker
0a9258f435 Add the AVRCP Target Service (2/2)
Add the AVRCP Target constant to Bluetooth Profile. Also remove redundant
public static final modifier on the constants.

Bug: 68854188
Test: Compiles and local test with service enabled
Change-Id: If2ec607fc704c225f8903d438fe970dfafac25f1
(cherry picked from commit 38c3073ba2)
Merged-In: If2ec607fc704c225f8903d438fe970dfafac25f1
2018-03-26 23:11:09 +00:00
TreeHugger Robot
4efdab2a74 Merge "HIDD: Address API Review concerns" into pi-dev 2018-03-23 21:03:34 +00:00
Hansong Zhang
7ca303c3b8 Hearing Aid Profile: set and get activeDevice
Add setActiveDevice() for Hearing Aid Profile in SettingsLib

Bug: 69623109
Test: robolectric test and manual test
Change-Id: I70eafe030747053876e2ab8a125d5dd01c5e0eb9
Merged-In: I70eafe030747053876e2ab8a125d5dd01c5e0eb9
(cherry picked from commit d7b3591659)
2018-03-23 12:27:33 -07:00
TreeHugger Robot
5bdf063537 Merge "Revert "Bluetooth: preserve one advertisement slot for GMS core"" into pi-dev 2018-03-23 19:18:41 +00:00
Zach Johnson
14faa2d49b Revert "Bluetooth: preserve one advertisement slot for GMS core"
This reverts commit 7020b015e9.

Reason for revert: This breaks platforms that only support a single advertising slot.

Bug: 76135219
Test: advertising does not work, revert change, advertising works
Change-Id: Ib8c823eb9990cc06bad95c8c3ad0129afb245e00
2018-03-23 17:30:56 +00:00
Ivan Podogov
191ce9c442 HIDD: Address API Review concerns
* Replace bare field usage with getter methods;
 * Remove Builder;
 * Move BluetoothHidDeviceCallback to inner class;
 * Remove toArray() and equals();
 * Throw IllegalArgumentException where applicable;
 * Add an Executor parameter before Callback;

Bug: 72168436, 72168126
Test: make update-api, make, make sl4a.Common
Change-Id: I13095458bf3ded7a376e8d20fd13df12ef426693
(cherry picked from commit f2f5dc355f)
2018-03-22 16:29:54 -07:00
Treehugger Robot
8085d6f247 Merge "HIDD: Address API Review concerns" 2018-03-22 21:50:57 +00:00
Ivan Podogov
f2f5dc355f HIDD: Address API Review concerns
* Replace bare field usage with getter methods;
 * Remove Builder;
 * Move BluetoothHidDeviceCallback to inner class;
 * Remove toArray() and equals();
 * Throw IllegalArgumentException where applicable;
 * Add an Executor parameter before Callback;

Bug: 72168436, 72168126
Test: make update-api, make, make sl4a.Common
Change-Id: I13095458bf3ded7a376e8d20fd13df12ef426693
2018-03-21 09:44:57 -07:00
Hansong Zhang
d7b3591659 Hearing Aid Profile: set and get activeDevice
Add setActiveDevice() for Hearing Aid Profile in SettingsLib

Bug: 69623109
Test: robolectric test and manual test
Change-Id: I70eafe030747053876e2ab8a125d5dd01c5e0eb9
2018-03-20 15:33:36 -07:00
Qiyu Hu
7020b015e9 Bluetooth: preserve one advertisement slot for GMS core
This brings back the check on the multiple advertisement support before
granting any Bluetooth LE advertiser. In other words, one slot is preserved
for GMS core.

Bug: 74819586
Test: Run an BLE application and verify the number of advertisements
Change-Id: I05014e597bd5868f18a81842dc341e47991f2c79
2018-03-16 12:22:16 -07:00
Ajay Panicker
38c3073ba2 Add the AVRCP Target Service (2/2)
Add the AVRCP Target constant to Bluetooth Profile. Also remove redundant
public static final modifier on the constants.

Bug: 68854188
Test: Compiles and local test with service enabled
Change-Id: If2ec607fc704c225f8903d438fe970dfafac25f1
2018-03-16 18:22:00 +00:00
Miao-chen Chou
9d3389d17e Bluetooth: preserve one advertisement slot for GMS core
This brings back the check on the multiple advertisement support before
granting any Bluetooth LE advertiser. In other words, one slot is preserved
for GMS core.

Bug: 74819586
Test: Run an BLE application and verify the number of advertisements
Change-Id: Iac3b47c76c6f699018982a69e9b04a9d8c631bfb
2018-03-14 16:35:11 -07:00
Jack He
bd020a6f5a Bluetooth: Use enums for adapter connection states
Bug: 69478930
Test: make, no user visible change
Change-Id: I999d0c445fe3b24aca72961c40c3428901542bc1
(cherry picked from commit ee81f99150)
2018-03-05 17:27:05 -08:00
Jack He
ee81f99150 Bluetooth: Use enums for adapter connection states
Bug: 69478930
Test: make, no user visible change
Change-Id: I999d0c445fe3b24aca72961c40c3428901542bc1
2018-03-05 11:23:31 -08:00
Ajay Panicker
566f5b30c0 Merge "Bluetooth: Remove adjustAvrcpAbsoluteVolume" am: 2cd2a6aef0 am: ad2f9017ad
am: d8185da227

Change-Id: Id99f889cb15789f36bc2c9c57ebdc58f730eb800
2018-03-01 21:35:34 +00:00
Ajay Panicker
d8185da227 Merge "Bluetooth: Remove adjustAvrcpAbsoluteVolume" am: 2cd2a6aef0
am: ad2f9017ad

Change-Id: I2526a89c6f366a77dbbeb0b3310438cbef2af857
2018-03-01 21:27:16 +00:00
Ajay Panicker
2a216f3999 Bluetooth: Remove adjustAvrcpAbsoluteVolume
The AudioManager now handles all calculations for volume stepping now
and no longer uses adjustAvrcpAbsoluteVolume.

Bug: 68812037
Test: Compile
Change-Id: I9cbf7989e49738c7a43fe3142aced5803111271e
2018-03-01 19:04:55 +00:00
Jakub Pawlowski
ddd4ca1e1b Merge "Use assigned UUID for Hearing Aid Service" am: d310970d36 am: 7f2091c522
am: 8d03a60930

Change-Id: I4c255621db616337c20d8e239dfe409545dea18a
2018-02-26 19:38:59 +00:00
Jakub Pawlowski
8d03a60930 Merge "Use assigned UUID for Hearing Aid Service" am: d310970d36
am: 7f2091c522

Change-Id: I3e54498760d071a38d60467c2865a77374f8c928
2018-02-26 19:31:12 +00:00