Commit Graph

1309 Commits

Author SHA1 Message Date
Treehugger Robot
d17b284bdb Merge "Introduce system APIs for Bluetooth silence mode." 2019-01-24 18:08:05 +00:00
Treehugger Robot
9d3ce3e55e Merge "Change MetadataListener to a abstract static class" 2019-01-24 07:07:49 +00:00
Ugo Yu
d9a0a7fd55 Change MetadataListener to a abstract static class
Bug: 121051445
Test: build pass
Change-Id: I8148d13d2eb0899d54817197ae0be236e2914e47
2019-01-24 09:48:20 +08:00
Treehugger Robot
a53fc20213 Merge "Add Android APIs for Hearing Aids Profile" 2019-01-24 01:37:05 +00:00
Treehugger Robot
7982e6f346 Merge "Add 2 new ways to check for Support for Hearing Aids Profile" 2019-01-24 01:34:24 +00:00
Ugo Yu
bfbe0ee89d Introduce system APIs for Bluetooth silence mode.
Policies of silence mode:
1) If an active device (for A2DP or HFP) enters silence mode,
   the active device for that profile will be set to null.
2) If a device exits silence mode while the A2DP or HFP active
   device is null, the device will be set as the active device
   for that profile.
3) If a device is disconnected, it exits silence mode.
4) If a device is set as the active device for A2DP or HFP,
   while silence mode is enabled, then the device will exit
   silence mode.
5) If a device is in silence mode, AVRCP position change event
   and HFP AG indicators will be disabled.
6) If a device is not connected with A2DP or HFP, it cannot
   enter silence mode.

Bug: 112323989
Test: Manual, runtest bluetooth
Change-Id: If7f340de38c350f17c37f00a3a2e871876baa20d
2019-01-24 08:40:51 +08:00
Stanley Tng
1f5ea66a39 Add Android APIs for Hearing Aids Profile
Add the new public Android APIs for the ASHA Hearing Aids Profile.

Bug: 119617521
Bug: 120222233
Test: Run with the new HearingAidProfileTest CTS test
Change-Id: I05fc3d565bd22b5000765122da7714d961dbc15b
2019-01-22 16:50:12 -08:00
Stanley Tng
61dbd81f6a Add 2 new ways to check for Support for Hearing Aids Profile
The getProfileProxy will return false if Hearing Aids Profile is not
supported. Also the getSupportedProfiles will return the correct support
for Hearing Aids even when Bluetooth is disabled.

Test: Manual testing with configuration enabled and disabled.
Bug: 119617521
Change-Id: I146bd3bc36d4c474f7bca18a05b679fb8e70ca63
2019-01-22 16:46:06 -08:00
Ugo Yu
4a33b88761 Skeleton implementation of Bluetooth metadata APIs
Bug: 121051445
Test: Build pass
Change-Id: I5e80210205b37294b1eb8356502ebf242e627ce4
2019-01-23 07:01:47 +08:00
Jack He
6b73b32c7a Deprecate BluetoothHealth APIs
* Mark all BluetoothHealth related APIs as deprecated
* Make BluetoothAdapter#getProfileProxy(context, BluetoothProfile.HEALTH)
  always return false
* Remove all logic behind BluetoothHealth APIs and add deprecation error log
* Health Device Profile (HDP) and MCAP protocol has been largely
  replaced by BLE. New applications should use Bluetooth Low Energy
  instead of legacy Bluetooth Health Device Profile

Bug: 111562841
Test: make, unit test, use Bluetooth
Change-Id: If99a9d79e9e1b89b75b9b74bd3b1c965247a1892
Merged-In: If99a9d79e9e1b89b75b9b74bd3b1c965247a1892
(cherry picked from commit 2be70a11a2)
2019-01-09 18:09:21 -08:00
Mathew Inwood
55418eada5 Limit access to suspected false positives.
Members modified herein are suspected to be false positives: i.e. things
that were added to the greylist in P, but subsequent data analysis
suggests that they are not, in fact, used after all.

Add a maxTargetSdk=P to these APIs. This is lower-risk that simply
removing these things from the greylist, as none of out data sources are
perfect nor complete.

For APIs that are not supported yet by annotations, move them to
hiddenapi-greylist-max-p.txt instead which has the same effect.

Exempted-From-Owner-Approval: Automatic changes to the codebase
affecting only @UnsupportedAppUsage annotations, themselves added
without requiring owners approval earlier.

Bug: 115609023
Test: m
Change-Id: Ia937d8c41512e7f1b6e7f67b9104c1878b5cc3a0
Merged-In: I020a9c09672ebcae64c5357abc4993e07e744687
2018-12-28 14:26:35 +00:00
Zach Johnson
57e6e90204 Pass package name as part of startDiscovery
Test: manual
Bug: 118347252
Change-Id: Icbc2e7e756b16ffd181924b586a0292c2bf32ec5
2018-12-12 20:33:09 -08:00
Treehugger Robot
c4ce66dd2f Merge "BluetoothManager: Set DBG to false" 2018-12-01 04:44:09 +00:00
Jakub Pawlowski
4c2aa61202 Bluetooth: Fix NPE when accesing Manufacturer Data of invalid ScanRecord
Bug: 118805852
Test: compilation
Change-Id: I537bec61cd3e7df700cc972683458f977ff370b8
2018-11-29 07:20:53 +00:00
Treehugger Robot
6c4c8aeb70 Merge "HFP: Send caller ID in +CLIP command (1/4)" 2018-11-21 20:21:19 +00:00
Treehugger Robot
215a48cff4 Merge "BluetoothDevice.ACTION_UUID requires BLUETOOTH_ADMIN" 2018-11-21 01:58:32 +00:00
Stanley Tng
420a0eb576 Enable the Debug Logs for Hearing Aids Profile
Bug: 119617521
Test: Compile
Change-Id: I40de1fcb3ca9e0ee66b4650a161f3735722df7ed
2018-11-15 10:22:07 -08:00
Myles Watson
3ee31a7ac6 BluetoothManager: Set DBG to false
Fixes: 71491860
Test: Pair and connect with a phone
Change-Id: I3ead8154765267105c74cd800f571933bbe82e07
2018-11-15 13:58:42 +00:00
Hansong Zhang
ff1c21c94c BluetoothDevice.ACTION_UUID requires BLUETOOTH_ADMIN
Fix the doc - intent BluetoothDevice.ACTION_UUID requries
android.Manifest.permission#BLUETOOTH_ADMIN instead of #BLUETOOTH to
receive. This is already enforced by Bluetooth service.

Bug: 113160320
Test: manual
Change-Id: I977d58e6d534f512da80bd6b13bebb515765626f
2018-11-12 14:33:59 -08:00
Benson Li
1d4f64ac7c HFP: Send caller ID in +CLIP command (1/4)
* Modify BluetoothHeadset so that phoneStateChanged method can
  provide caller display name

Bug: 111378831
Test: runtest bluetooth, runtest -x BluetoothPhoneServiceTest.java
Change-Id: Ibc3611a50ec9f103fd235dde606ecbd10657e014
2018-11-09 20:11:04 +00:00
Mathew Inwood
45d2c252b1 Move some members to the "Q blacklist".
Based on some analysis, these fields/methods are likely false positives.
Set maxTargetSdk=P so that any apps using them are required to migrate off
them in future. See the bug for more details.

Exempted-From-Owner-Approval: Automatic changes to the codebase
affecting only @UnsupportedAppUsage annotations, themselves added
without requiring owners approval earlier.

Bug: 115609023
Test: m
Merged-In: I719b5c94e5b1f4fa562dd5d655953422958ad37e
Change-Id: I719b5c94e5b1f4fa562dd5d655953422958ad37e
(cherry picked from commit 8c854f86a4)
2018-10-22 17:28:24 -07:00
Ajay Panicker
6c96b70195 Synchronize on a static final object to lock mDeviceBusy
Synchronizing on a field doesn't lock the object in a predictable way.

Bug: 63389270
Test: Compile
Change-Id: Idd3111bc94d32bc4bb320a5c25da37fe68276337
2018-10-17 18:20:51 +00:00
Jack He
097a89513e Remove BluetoothDevice.ACTION_DISAPPEARED
This intent was never sent by the Bluetooth stack

Fixes: 112115770
Test: make
Change-Id: Iaf71aeafa21f44ec9b59c1b766c936ab7dde39f1
2018-10-11 21:06:29 +00:00
Vasu Nori
694752d5b9 Add hidden API to return "Uploading" bit value from SDP record's MapSupportedFeatures.
Bug: 111614861
Test: tested w/ KitchenSink App
Change-Id: I43895183d7b315f57257e1d2045f17dedcb0cfcd
2018-09-25 21:39:31 +00:00
Treehugger Robot
0677766615 Merge "Unhide the LE CoC APIs" 2018-09-18 18:31:26 +00:00
Stanley Tng
1bff4bab9a Unhide the LE CoC APIs
Expose the LE Connection-oriented Channels APIs for applications to use.

Test: Run the SL4A ACTS test: BleCocTest
Bug: 70683224
Change-Id: I68128bc7154966ec065091c973351f8892da9b4d
2018-09-13 13:46:39 -07:00
Nitin Shivpure
1555eae7fa BLE: Add service solicitation uuid feature in scan filter
Adding service solicitation uuid feature in
scan filter, So BLE Scanner can set scan filter for
advertising packets that includes the Service Solicitation
uuid, which can be one of the below types.
 - List of 16 bit Service UUIDs
 - List of 32 bit Service UUIDs
 - List of 128 bit Service UUIDs

Test: BLE Scanner can do filter scan for advertising packets that
includes the Service Solicitation uuid.

Bug: 78483310
Change-Id: I3d83c50e446fca06a76db002dad716759c145d6e
2018-08-29 07:40:29 +00:00
Treehugger Robot
c3824e5d57 Merge "Be the current user to get A2DP proxy" 2018-08-22 05:40:11 +00:00
Treehugger Robot
041eb388de Merge "Add note for FLAG_CANCEL_CURRENT when stopping scan" 2018-08-21 17:01:00 +00:00
Cheney Ni
4b6d6c202b Be the current user to get A2DP proxy
After user switched, Bluetooth process will be restarted to run as
secondary user and some system process like AudioService keeps as
primary user. When BluetoothA2dp did rebind, it still used primary UID
for those system process and caused they could not invoke A2DP APIs.

This changes to use current user ID when rebinding to A2dpService and
system process can get correct A2DP proxy after user switched.

Bug: 112469503
Test: manual
Change-Id: If5ee945b0dcf2044ef2baedd762751fa6ef3d09a
2018-08-21 14:08:00 +08:00
Stanley Tng
20fc9a250e Add note for FLAG_CANCEL_CURRENT when stopping scan
Added a note in the Android API documentation for stopScan to make sure
that the flag FLAG_CANCEL_CURRENT is not used when creating the
PendingIntent parameter.

Bug: 77658091
Test: Just compile since not logic is changed
Change-Id: I55f33ae68679310ba4899708a2072a40fea0b3b4
2018-08-20 16:15:58 -07:00
Treehugger Robot
c1fd61b302 Merge "Add IntDef to BluetoothAdapter IO_CAP constants" 2018-08-20 21:43:24 +00:00
Treehugger Robot
4d98474f2a Merge "Fix NPE when starting advertising with null GATT" 2018-08-09 06:48:17 +00:00
Treehugger Robot
d5eff002eb Merge "Mark BluetoothClass#getClassOfDevice as TestApi" 2018-08-09 00:58:44 +00:00
Jakub Pawlowski
1f014f4010 Fix NPE when starting advertising with null GATT
Bug: 112164168
Change-Id: I82be0e06e990cc116d3ab48de80b5bb170d69892
2018-08-08 12:14:17 +00:00
Ralph Nathan
29335fdc9b Mark BluetoothClass#getClassOfDevice as TestApi
This method is being used the Android Things instrumentation test apk.

Bug: 111654175
Test: tests pass
Change-Id: Id3fcd2d89789868e50048542fd1dfe25d9986103
2018-08-06 15:21:30 -07:00
Mathew Inwood
4a8c67bbe8 Merge "Add @UnsupportedAppUsage annotations"
am: b40b37910d

Change-Id: Ic3de9e4c6d17687d4a1f64c02026e5c0711e8fd1
2018-08-06 03:59:41 -07:00
Mathew Inwood
4dc66d3c58 Add @UnsupportedAppUsage annotations
For packages:
  android.bluetooth.le
  android.bluetooth

This is an automatically generated CL. See go/UnsupportedAppUsage
for more details.

Exempted-From-Owner-Approval: Mechanical changes to the codebase
which have been approved by Android API council and announced on
android-eng@

Bug: 110868826
Test: m
Change-Id: Ifcf24c0617acd7facc0e03f30a95c3a6b09b205c
Merged-In: I88a1311e27c5f9a5f9d1035db76034f86f650efc
2018-08-01 15:07:20 +01:00
Pulkit Bhuwalka
80238145a3 Add IntDef to BluetoothAdapter IO_CAP constants
Bug: None
Test: Builds
Change-Id: I04f8f6cdcc1a552ae2f2a358308b9a5c862989d3
2018-07-23 17:49:28 -07:00
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