Commit Graph

1138 Commits

Author SHA1 Message Date
Joseph Pirozzo
843d380cf1 Bluetooth in band ring
Add a flag to the BluetoothHeadsetClientCall indicating the current
status of in band ring on the connected phone.

Bug: 65673832
Test: runtest bluetooth -c
com.android.bluetooth.hfpclient.HeadsetClientStateMachineTest

Change-Id: I7e839f2790b1a27d336528e93bc8a4c8d8ff3036
(cherry picked from commit f780364a9a1f6171860cbdf4e1b41a01ee7d88c6)
2018-01-11 14:09:25 -08:00
Treehugger Robot
ff9bc3a88c Merge "Make Bluetooth constants used by gmscore a system api" 2018-01-11 20:22:05 +00:00
Selim Gurun
17a26c715f Make Bluetooth constants used by gmscore a system api
These constants are used by GMSCore car module via reflection. Make
them system API.

Bug: 67052734
Test: Manual - and using make update-api
Change-Id: I0709c0e0eb9fcb9fb29d575e9b74927a70b2a924
2018-01-09 16:04:12 -08:00
Jack He
bc9976e749 HFP: Add isInbandRingingEnabled() API (1/4)
* Use BluetoothHeadset.isInbandRingingEnabled() API to check whether
  in-band ringing is currently enabled in the system when deciding on
  audio routes for ringtone
* Add this as a hidden internal API for system components

Bug: 71646213
Test: make, toggle in-band ringing from Development Settings and observe
      whether Telecom service tries to open SCO when there is an
      incoming call

Change-Id: I1ef0dd2b54ace7649ddd1f043f0ef5847743a5c4
2018-01-09 15:17:34 -08:00
Myles Watson
fa792b97a5 BluetoothProfile: Add Object Push Profile (OPP)
Test: toggle Bluetooth
Change-Id: I5aec940ba3d6c6364c2de667426d98d0b3cea0c6
2018-01-09 00:13:03 +00:00
Jack He
05f4bc4074 HFP: Add APIs for set and get active device (1/3)
1. Call BluetoothHeadset.setActiveDevice(BluetoothDevice device) to set
   a connected HFP/HSP device as active.
2. Listen for BluetoothHeadset.ACTION_ACTIVE_DEVICE_CHANGED intent
   that will contain the latest active device (in EXTRA_DEVICE field).
   If the active device could not be changed, the EXTRA_DEVICE
   field could be null.
3. If setActiveDevice() is NOT in-progress, BluetoothA2dp.getActiveDevice()
   can be used. If setActiveDevice() is in-progress, the result is undefined.
4. BluetoothHeadset.setActiveDevice() could be called by some other parts of
   the system, so interested parties should always listen for
   BluetoothHeadset.ACTION_ACTIVE_DEVICE_CHANGED intents and prepared
   for active device updates.

Bug: 68951996
Test: manual
Change-Id: I22ca639a04fed7bf17df59c405ddeda90dafb8ff
2018-01-05 14:51:40 -08:00
Selim Gurun
4029fa6039 Add SystemApis annotations
There are some number of places where bluetooth APIs are used via
reflection from GMSCore. Add proper annotations.

Bug: 67052734
Test: Manual - and using make update-api
Change-Id: Ib6e3aa1ff5b6f9cdc78367f9be13ed00542d6f65
(cherry picked from commit 64bd35ef2c)
2018-01-05 14:50:30 -08:00
Pavlin Radoslavov
64a9435cc7 Added internal API to get/set the A2DP Active Device
1. Call BluetoothA2dp.setActiveDevice(BluetoothDevice device) to set
   a connected A2DP device as active.
   The value of "device" could be null to clear the active device
   and stop streaming audio to a Bluetooth device.
2. Listen for BluetoothA2dp.ACTION_ACTIVE_DEVICE_CHANGED intent
   that will contain the latest active device (in EXTRA_DEVICE field).
   If the active device could not be changed, the EXTRA_DEVICE
   field could be null.
3. If setActiveDevice() is NOT in-progress, BluetoothA2dp.getActiveDevice()
   can be used. If setActiveDevice() is in-progress, the result is undefined.
4. BluetoothA2dp.setActiveDevice() could be called by some other parts of
   the system, so interested parties should always listen for
   BluetoothA2dp.ACTION_ACTIVE_DEVICE_CHANGED intents and prepared
   for active device updates.

Bug: 71555243
Test: Manual
Change-Id: I661b6882e8e6b437db50210aec1dd12a10199969
2018-01-05 21:44:59 +00:00
Hansong Zhang
b06bb2186a BluetoothHidDevice: rename onIntrData to onInterruptData (1/5)
Bug: 63384609
Test: make
Merged-In: I3b55f7383d2a84162d681ebf3740ddc9e8a55bbb
Change-Id: I3b55f7383d2a84162d681ebf3740ddc9e8a55bbb
(cherry picked from commit 42324278bf)
2017-12-20 11:10:53 -08:00
Hansong Zhang
88f3891d1e Publish Bluetooth HID Device Profile Service API
Enable the BluetoothHidDevice API in framework.

Bug: 63384609
Test: SL4A HID test; test with apps using BluetoothHidDevice
Merged-In: I52ca4674f11179f865bdff22e0289dfe893c40f5
Change-Id: I52ca4674f11179f865bdff22e0289dfe893c40f5
(cherry picked from commit 7bb587d72b)
2017-12-15 16:12:00 -08:00
Treehugger Robot
f7a69aeeab Merge "Bluetooth: Add convenience method to convert connection state to string" 2017-12-12 22:41:13 +00:00
Hansong Zhang
fef6d81156 Make BluetoothPbap implement BluetoothProfile (1/3)
* BluetoothPbap will implement BluetoothProfile to be consistent with
other profiles
* Changed the method names to match the BluetoothProfile method
signatures
* Removed doesClassMatchSink() as it is never used
* Disable default DEBUG logs

Test: test with carkits
Bug: 69417672
Change-Id: I0766188f77468808d7505780c781f5fd8608af60
2017-12-11 13:36:45 -08:00
Jack He
5252b97d6c Bluetooth: Add convenience method to convert connection state to string
* Add method to convert the following state values to string
  - BluetoothHeadset.STATE_DISCONNECTED
  - BluetoothHeadset.STATE_CONNECTING
  - BluetoothHeadset.STATE_CONNECTED
  - BluetoothHeadset.STATE_DISCONNECTING

Test: make
Change-Id: Iaa5b6e35d3214ded8edbe29d626e0869651417d1
2017-12-11 13:18:13 -08:00
Treehugger Robot
ea7363402c Merge "BT: Remove dead code in BluetoothHeadset" 2017-12-08 01:14:59 +00:00
Treehugger Robot
0d3990b235 Merge "Bluetooth HID Device: format code, fix docstring, hide unplug()" 2017-12-07 21:37:45 +00:00
Jack He
887e2a1e14 BT: Remove dead code in BluetoothHeadset
The following hidden API methods are not implemented by the stack and
should be removed:
 - getBatteryUsageHint()
 - acceptIncomingConnect()
 - rejectIncomingConnect()

The following hidden API methods are no longer needed due to lack of
usage and should be removed:
 - enableWBS()
 - disableWBS()
 - bindResponse()

Bug: 70336991
Test: make
Change-Id: I75bd6735573e4cbc61b5bef8722b8badac2e9170
2017-12-07 12:06:21 -08:00
Hansong Zhang
53f5412beb Bluetooth HID Device: format code, fix docstring, hide unplug()
* Reformat code with google-java-format
* Add the note that When an application is registered, the HID Host service
will be disabled until it is unregistered
* Fix the links in docstring
* Add @hide to unplug(); this is not a public API

Bug: 63384609
Test: make
Change-Id: I5dfcaab58b02c19e5745461c16602064a0ad8b83
2017-12-06 16:34:15 -08:00
Xin Li
5364be50cd DO NOT MERGE: Merge Oreo MR1 into master
Exempt-From-Owner-Approval: Changes already landed internally
Change-Id: I727a014df2fb05a4b13cb67b1fcb760a8b387523
2017-12-06 14:24:49 -08:00
Treehugger Robot
8ab47567b2 Merge "Bluetooth HID Device: Remove BluetoothHidDeviceAppConfiguration (2/4)" 2017-12-06 19:34:22 +00:00
Myles Watson
125b5456f1 Auto-format BluetoothAdapter.java
Test: build
Change-Id: I7bfc729373a24cceee05e443195640ff7f6d43b9
2017-12-06 16:42:23 +00:00
Hansong Zhang
4cbf548dcc Bluetooth HID Device: Remove BluetoothHidDeviceAppConfiguration (2/4)
Bug: 69981563
Test: HID Device SL4A Test
Change-Id: Ifb7002bb4f3f6f29b01a3d337ab68b674d6947c9
2017-12-04 09:49:45 -08:00
Hansong Zhang
7c005ea373 Merge "Bluetooth HID Device API docs and helper"
am: a89f6150dc

Change-Id: I4b91cd3e528f480ea216e9ffb0414910d4762d3b
2017-11-16 18:50:16 +00:00
Hansong Zhang
ceb84db837 Bluetooth HID Device API docs and helper
* Add a builder for BluetoothHidDeviceAppQosSettings
* Add documentation for BluetoothHidDeviceAppSdpSettings
and BluetoothHidDeviceAppQosSettings
* Fix the behavior of and BluetoothHidDeviceAppSdpSettings.equals()
and BluetoothHidDeviceAppQosSettings.equals()

Bug: 63384609
Test: test with HID device apps
Change-Id: I933f4ec3034e1f704ddd614e48b76d27fda8b6ff
2017-11-15 17:20:52 -08:00
Xin Li
220871a697 Merge commit '98e12851336b7db16e583f9afac63ecc97465980' from
oc-mr1-dev-plus-aosp-without-vendor into stage-aosp-master.

Change-Id: Ia7b8da4a00d215160e4a4fa40f6044208d1297b7
Merged-In: I19846d2a3ee27aecbae2367a74ee49082eea154d
2017-11-14 12:31:11 -08:00
Jakub Pawlowski
0430720a23 Move connectSocket into IBluetoothSocketManager (3/3)
Bug: 68359837
Test: none
Merged-In: I1161a5fe74b034fba0112fd3a78bdf1fbace6e12
Change-Id: I1161a5fe74b034fba0112fd3a78bdf1fbace6e12
2017-11-10 21:42:26 +00:00
Jakub Pawlowski
fe7e885180 Move createSocketChannel into IBluetoothSocketManager (3/3)
Bug: 68359837
Test: none
Change-Id: I52b03ff3d637bf661c70279b7ca18b105157f7a2
2017-11-09 22:13:21 +00:00
Hansong Zhang
fa377b407b Enable HID Device Profile Service (2/2)
Add Profile Proxy for HID Device Profile.

* Add a helper method doUnbind() to deal with unbinding to Bluetooth HID
Service.

* Fix docstrings.

Bug: 63384609
Test: SL4A Bluetooth HID test
Change-Id: I168c21c3b010baac9889c556635b914c0ba3f267
2017-10-27 16:47:39 +00:00
Pulkit Bhuwalka
178e5873b0 Merge changes from topic "bt_get_cod"
am: 35dc02004c

Change-Id: Iec67ef3cc9c990b4d5285b23b51972915cbbd335
2017-10-24 06:27:23 +00:00
Pulkit Bhuwalka
b977674b17 Merge "Persist Bluetooth CoD config value across reboot"
am: ba45409c92

Change-Id: I4d28d0b1b52e587285d3b92b66fdc4b6c1b38720
2017-10-24 06:13:48 +00:00
Pulkit Bhuwalka
d01fa6e686 Get Bluetooth Class of Device
Adds API to fetch Bluetooth CoD value of the stack. The API is hidden to
only be used by System code.

Bug: 36015415
Test: Verified fetching of COD from test app on flashed device, after modification
and after after reboot.

Change-Id: Ie35ecf141704c2aac46678da7cabdc7203a088f2
2017-10-23 23:11:37 -07:00
Treehugger Robot
ba45409c92 Merge "Persist Bluetooth CoD config value across reboot" 2017-10-24 06:05:45 +00:00
Hansong Zhang
c8a370aeba Merge "Change Bluetooth HID Profile Name (1/6)"
am: 8218b219f3

Change-Id: Ic085deaa070b4008b34d03b507f81a5df220764a
2017-10-23 22:33:50 +00:00
Hansong Zhang
0edf754b2d Change Bluetooth HID Profile Name (1/6)
Make the Bluetooth HID profile name consistent with the Bluetooth HID service
name.

BluetoothInputHost → BluetoothHidDevice
BluetoothInputDevice → BluetoothHidHost
IBluetoothInputHost → IBluetoothHidDevice
IBluetoothInputDevice → IBluetoothHidHost
BluetoothProfile.INPUT_HOST → BluetoothProfile.HID_DEVICE
BluetoothProfile.INPUT_DEVICE → BluetoothProfile.HID_HOST

(Cherry-picked from commit c26c76c63d)
Merged-In: Iadb890a54dd3d6868b87514472bbac6bb0c6179f
Bug: 68055651
Test: make
Change-Id: Iadb890a54dd3d6868b87514472bbac6bb0c6179f
2017-10-23 22:21:00 +00:00
Pulkit Bhuwalka
547853d4c3 Persist Bluetooth CoD config value across reboot
Create new Settings key for storage and update the API doc.

Bug: 36015415
Test: Verified by storing a value through a test app and restarting the
machine to ensure it's picked up.

Change-Id: I94aa054e525c4656bb3a824a29cae9c88f8904e0
2017-10-22 15:36:06 -07:00
Jack He
1b41112e38 Merge "PBAP: Use ACTION_CONNECTION_STATE_CHANGED intent" am: cfe51aabd2 am: 8057ba832e
am: 5dfce858ea

Change-Id: Ia3112971eb20c04325dd04bc76078195cec99a5f
2017-10-04 18:09:50 +00:00
Jack He
5dfce858ea Merge "PBAP: Use ACTION_CONNECTION_STATE_CHANGED intent" am: cfe51aabd2
am: 8057ba832e

Change-Id: I946cce466bb5e048ad7b19cd97caa466dab27a52
2017-10-04 17:42:26 +00:00
Jack He
8057ba832e Merge "PBAP: Use ACTION_CONNECTION_STATE_CHANGED intent"
am: cfe51aabd2

Change-Id: I6e2337a0b0f4722b82a91c53c340618b9277f3f6
2017-10-04 17:22:28 +00:00
Jack He
37ab815c96 PBAP: Use ACTION_CONNECTION_STATE_CHANGED intent
* Use ACTION_CONNECTION_STATE_CHANGED to broadcast connection state
  change to comply with BluetoothProfile interface requirement
* Use BluetoothProfile.STATE_* variables to represent connection
  states for PBAP profile

Bug: 63873163
Test: Connect to car kits
Change-Id: I7dfcfc1b3a3e4868ea5e313f62ad5e504d58b9c2
2017-10-04 16:22:57 +00:00
Hansong Zhang
a51244c781 DO NOT MERGE ANYWHERE: Revert "Merge "Bluetooth HID Device: Fix a typo" am: d30e47ecfc am: 849805b804"
This reverts commit 45f17f4533.

Merged-In: I06ffc536f5912d53319b4d325f77991d65ab04f2
Change-Id: I74271f26bbe28b02117d688a6aa0bf83f0be3780
2017-10-02 22:34:23 +00:00
Hansong Zhang
185ec6d91d DO NOT MERGE ANYWHERE: Revert "Merge "Bluetooth HID Device: Fix a typo" am: d30e47ecfc am: 849805b804 am: 45f17f4533"
This reverts commit 7c55e52d51.

Merged-In: I06ffc536f5912d53319b4d325f77991d65ab04f2
Change-Id: Ib83d5de0dbc0c98c6cf0b4c5f7381cb0f70a5da5
2017-10-02 22:33:47 +00:00
Hansong Zhang
7c55e52d51 Merge "Bluetooth HID Device: Fix a typo" am: d30e47ecfc am: 849805b804
am: 45f17f4533

Change-Id: I2a972a4ea474e2ef9462519a7b333a6e64cfff70
2017-09-30 05:05:28 +00:00
Hansong Zhang
849805b804 Merge "Bluetooth HID Device: Fix a typo"
am: d30e47ecfc

Change-Id: Ibd3c731781359861d89a7f396ead2f9a7b377821
2017-09-30 04:48:28 +00:00
Hansong Zhang
ecd09fb952 Bluetooth HID Device: Fix a typo
Fixed a typo in BluetoothInputHost. "DIGITIZER_TABLED" should be
"DIGITIZER_TABLET".

Test: Not needed.
Change-Id: I06ffc536f5912d53319b4d325f77991d65ab04f2
2017-09-29 20:56:00 +00:00
Pulkit Bhuwalka
252eebec97 Merge "Modify Bluetooth Class of Device from Android stack" am: f4ec2ab706 am: c037004fd9
am: 69da7a1766

Change-Id: I5815862db057bf1925bfa9482a451aa0ac3b08ad
2017-09-27 20:18:38 +00:00
Pulkit Bhuwalka
c037004fd9 Merge "Modify Bluetooth Class of Device from Android stack"
am: f4ec2ab706

Change-Id: I9a0b06f44d2fe7be343fc38ce240d82f1b309d7d
2017-09-27 20:04:32 +00:00
Treehugger Robot
f4ec2ab706 Merge "Modify Bluetooth Class of Device from Android stack" 2017-09-27 19:43:17 +00:00
Pulkit Bhuwalka
66d6123880 Modify Bluetooth Class of Device from Android stack
Bug: 36015415
Test: Modified Class of Device using sample app and verified device icon
change when discovering from a remote device.

Change-Id: Ie25f10be5560f9c090ebe489d5f3bb00cbca81ef
2017-09-20 15:51:49 -07:00
Ruina Liu
57a1d7a669 Merge "Fix extracting 32-bit uuid error via calling method uuidToBytes" am: ac421b8f44 am: 8c65620d31
am: 311d031d22

Change-Id: I151f0dc74bfeca44db6aa0c428f8cfbb8b2d3891
2017-09-18 18:06:30 +00:00
Ruina Liu
8c65620d31 Merge "Fix extracting 32-bit uuid error via calling method uuidToBytes"
am: ac421b8f44

Change-Id: I9c6b453e0ef71a70cd972a47763d042943fe3f36
2017-09-18 17:53:31 +00:00
Ruina Liu
044e0fe5c5 Fix extracting 32-bit uuid error via calling method uuidToBytes
A new defined method of uuidToBytes is used to convert
Bluetooth uuid to bytes in the case of BLE advertising.
But the most significant 16 bits of a 32-bit uuid
will be cleared after the and operations with
0X0000FFFF00000000L in the function of
getServiceIdentifierFromParcelUuid.
0XFFFFFFFF00000000L should be used as bit mask.

Change-Id: I83e22ffbecd718540e644289fee12bf9c3b66305
Test: Advertise with payload contains 32-bit uuid
2017-09-15 17:08:32 -07:00