Commit Graph

1611 Commits

Author SHA1 Message Date
TreeHugger Robot
44c43c51a5 Merge "Move all BluetoothCodecConfig and BluetoothCodecStatus APIs moved from the non-SDK API list to the blocklist in Android 11 back to the non-SDK API list." into rvc-dev 2020-12-07 21:21:50 +00:00
Rahul Sabnis
d84406ab7b Move all BluetoothCodecConfig and BluetoothCodecStatus APIs moved from
the non-SDK API list to the blocklist in Android 11 back to the non-SDK
API list.

NoNonSdkCheck: Intentional revert of an app breaking API change
Tag: #feature
Bug: 168812851
Test: atest BluetoothHostTest#testCodecMethodsAccessible
Change-Id: I29983284b1a1c271d983c99b286e204604abdc72
Merged-In: I29983284b1a1c271d983c99b286e204604abdc72
2020-11-23 20:00:39 +00:00
Kevin Hufnagle
fcd519fde9 docs: Use correct profile for intent
The ACTION_AUDIO_STATE_CHANGED intent action uses the HDP profile,
not the A2DP profile.

Bug: 158742305
Test: m ds-docs-java
Exempt-From-Owner-Approval: Docs-only change
Change-Id: I4358aac8c8aa9fc8b36e517e568e5a9db538555e
2020-10-19 21:08:17 -04:00
Hungyen Weng
ba5692ea72 Revert "BluetoothProfileConnecter now calls the ServiceListener'..."
Revert submission 11348591-btmap-close-gts

Reason for revert: Droidcop reverted the change due to test failure, Test failed. https://android-build.googleplex.com/builds/tests/view?invocationId=I05500004181087103&testResultId=TR42507671126333727

Reverted Changes:
I324b4ea66:BluetoothProfileConnecter now calls the ServiceLis...
I1427f1a86:Add GTS test for BluetoothMap#close

Bug: 155587865

Change-Id: I9a2645c7bbaec9fdf0c6f5972b08ba70cfe78741
2020-05-04 04:53:46 +00:00
Rahul Sabnis
ee31c78cb8 BluetoothProfileConnecter now calls the ServiceListener's
onServiceDisconnected method after unbinding the service

Bug: 155120232
Test: atest BluetoothHostTest#testMapClose
Change-Id: I324b4ea6654261eb67d5ec184f6b3456ba3d1aa4
2020-05-01 15:39:47 -07:00
Lee Shombert
6d1fa6f65a Fix exception handling in getState() binder cache
Bug: 153103051

A binder cache recompute() function cannot compute a result based on any
data that is not known to the binder server.  If the code depends on
local data that can change, then invalidation will not work properly.

The original getState() method returned OFF if the bluetooth service was
unavailable.  This computation now occurs in the getStateInternal()
method, outside of the binder cache query() method.

The recompute() method converts RemoteExceptions to RuntimeExceptions.
Then, the conversion is reversed in getStateInternal().  This double
conversion is needed because the cache recompute() method has no throw
spec.

Test: Create a debug image that enables binder cache VERIFY.  Run the
following tests:
 * atest BluetoothInstrumentationTests
 * atest PtsChreTestCases
 * atest UserLifecycleTests
 * manual testing connecting to bluetooth devices and toggling airplane
   mode.
No cache inconsistencies found.  No test failures seen.

Change-Id: I93b9742587c4eb695d9a11fc6ab145f6a40a0ece
2020-04-15 13:58:55 -07:00
Lee Shombert
2a8802d2ca Revert "Fix exception handling in getState() binder cache"
This reverts commit 81a3e1c578.

Bug: b/153505953

Change-Id: I58c46e534ccadf332d10fff8f99c85ad24340c27
2020-04-08 21:12:52 +00:00
Lee Shombert
81a3e1c578 Fix exception handling in getState() binder cache
Bug: 153103051

A binder cache query function cannot compute a result based on any data
that is not known to the binder server.  If the code depends on local
data that can change, then invalidation will not work properly.

The getState() method returns OFF if the bluetooth service is
unavailable.  This computation now occurs in the getState() method,
outside of the binder cache query() method.

The query method converts RemoteExceptions to RuntimeExceptions.  Then,
the conversion is reversed in getState().  This double conversion is
needed because the cache query() method has no throw spec.

Test: Run 'atest BluetoothInstrumentationTests' with a special debug
image that enables binder cache VERIFY.  The test found no cache
inconsistencies.

Change-Id: I80db86f66d8b51fa94207824c8b15972a9066ef5
2020-04-06 18:07:33 -07:00
Ugo Yu
f845259eec Independent methods to enable/disable BLE mode
* Use IBluetoothManager.enableBle() and disableBle() to toggle BLE only
  mode instead of updateBleAppCount() then enable().
* Fix BluetoothAdapter.disableBle sometime won't disable Bluetooth.
* Add active log if Bluetooth is disabled via disableBle().

Bug: 139454316
Test: enableBle() -> disableBle() and check Bluetooth is OFF.
Change-Id: I173d5fed1b47ff68a6504741e25754e65cbd1455
2020-03-30 09:38:54 +08:00
Rahul Sabnis
4a55841ae5 BluetoothHearingAid System APIs now throw an exception if a null
BluetoothDevice is passed in

Bug: 149238489
Test: Manual
Change-Id: I594f558bfe1e286bf74dd8dc3db4c8497fd0a025
2020-03-24 17:57:30 -07:00
Rahul Sabnis
2c71d16ced Add BLUETOOTH_PRIVILEGED permission as a requirement for all new Bluetooth SystemApis and for hidden connect/disconnect APIs.
Hide some APIs that were previously marked as @UnsupportedAppUsage and re-add annotation as changing the permissions for these SystemApis would break the unsupported app contract that was previously there. Therefore, we're choosing to hide them until we have a good story on how to deal with them next release.

Bug: 148689314
Test: Manual
Change-Id: I33ee2c7ccd3827db3d23d6447cf82d9ffc36836a
2020-03-21 04:10:15 +00:00
TreeHugger Robot
8f8d351bb8 Merge "BluetoothHearingAid#getHiSyncId now consistently uses the term HiSyncId (removed all references to CustomerId) and added link to explain what the HiSyncId represents" into rvc-dev 2020-03-21 03:00:32 +00:00
TreeHugger Robot
922833a430 Merge "Update permissions of BluetoothPan System APIs and re-hide some APIs that do not need to be System APIs." into rvc-dev 2020-03-20 16:55:47 +00:00
Rahul Sabnis
6a5d8e4b55 Update permissions of BluetoothPan System APIs and re-hide some APIs
that do not need to be System APIs.

Bug: 146045934
Test: Manual
Merged-In: Ic6325fde05294eb0266fee25f4b3e7098749a287
Change-Id: Ic6325fde05294eb0266fee25f4b3e7098749a287
2020-03-20 01:44:50 -07:00
Rahul Sabnis
b3ba6a4ee7 BluetoothHearingAid#getHiSyncId now consistently uses the term HiSyncId
(removed all references to CustomerId) and added link to explain what
the HiSyncId represents

Bug: 149238489
Test: Manual
Merged-In: I4ff2a8d46f3fc5d06a29829a69a27a0c15e466f8
Change-Id: I4ff2a8d46f3fc5d06a29829a69a27a0c15e466f8
2020-03-20 01:42:16 -07:00
Rahul Sabnis
c62712e98e Add error code for BluetoothDevice#getBatteryLevel to represent
Bluetooth is off

Bug: 147428695
Test: Manual
Merged-In: I07c2fa49954632da6aa6a93706883e4cdfd32fa6
Change-Id: I07c2fa49954632da6aa6a93706883e4cdfd32fa6
2020-03-20 01:38:06 -07:00
Philip P. Moltmann
12ac3f406f Rename featureId -> attributionTag
In the core functionality this changes everything including aidl's and
field names:
- Context
- ContentProvider
- AppOps*
- Package parsing

For the rest, this is a shallow change to only change to the changed
APIs. This keeps the change small-ish

Exempt-From-Owner-Approval: Rename
Fixes: 148792795
Test: TH
Change-Id: I2a2245fe76e09e62cb13d5785d2efb4a304ba54a
Merged-In: I2a2245fe76e09e62cb13d5785d2efb4a304ba54a
2020-03-12 19:26:10 +00:00
weichinweng
e547073e75 Fix bluetooth can't turn off during network reset (2/3)
Remove disable Bluetooth action from AdapterService and move to
BluetoothManagerService.
Add factory reset reason into Bluetooth enable/disable reason list.

Bug: 110181479
Test: manual
Change-Id: I4bff3c3bb75fbb0d1e13c459c0d9d3fd3b8b3195
2020-03-09 05:09:08 +00:00
TreeHugger Robot
77864d6771 Merge "Revert "Revert "Require user pass in a non-null BluetoothDevice ..."" into rvc-dev 2020-03-05 19:15:30 +00:00
Rahul Sabnis
35bc5b5b28 Revert "Revert "Require user pass in a non-null BluetoothDevice ..."
Revert "Revert "Pass in active device to all BluetoothA2dp APIs ..."

Revert "Revert "Pass in active device to all BluetoothA2dp APIs ..."

Revert submission 10303287-revert-10253996-bt-a2dp-no-null-FQRXACWPIA

Reason for revert: Fixing breakage
Reverted Changes:
I4d9f2f819:Revert "Make sure calls to BluetoothA2dp APIs pass...
I771ca0d57:Revert "Need to now pass in active device instead ...
I76529c7a1:Revert "Pass in active device to all BluetoothA2dp...
I297bda68d:Revert "Require user pass in a non-null BluetoothD...
I525327959:Revert "Pass in active device to all BluetoothA2dp...
I1d8660b11:Revert "Pass in active device to all BluetoothA2dp...

Bug: 147287141
Test: Manual
Merged-In: I4d7d971af75bff8967fd807d34dad90c32e24eba
Change-Id: I4d7d971af75bff8967fd807d34dad90c32e24eba
2020-03-03 16:20:50 -08:00
TreeHugger Robot
1f9f5ddd1c Merge "Update BluetoothDevice SystemApi permissions and disallow passing a null pin to BluetoothDevice#setPin" into rvc-dev 2020-03-03 19:14:16 +00:00
Rahul Sabnis
82425166a8 Update BluetoothDevice SystemApi permissions and disallow passing a null
pin to BluetoothDevice#setPin

Bug: 147428695
Test: Manual
Change-Id: I74613d61420babecf5f1976fe33a2e1a729b71a1
2020-03-02 16:41:20 -08:00
TreeHugger Robot
4894b560a5 Merge "Add missing RequiresPermission annotations in BluetoothHidHost and BluetoothMap APIs, disallow null device input for setConnectionPolicy, getConnectionPolicy, and getConnectionState in BluetoothHidHost, and BluetoothMap implements AutoCloseable, its close() method is public, and utilizes a CloseGuard." into rvc-dev 2020-03-02 19:16:12 +00:00
Rahul Sabnis
946bf8834b Add missing RequiresPermission annotations in BluetoothHidHost and
BluetoothMap APIs, disallow null device input for setConnectionPolicy,
getConnectionPolicy, and getConnectionState in BluetoothHidHost, and
BluetoothMap implements AutoCloseable, its close() method is public, and
utilizes a CloseGuard.

Bug: 149238030
Test: Manual
Merged-In: I8add9e26afcaf1a988c15e3cc7f8c446491f0686
Change-Id: I8add9e26afcaf1a988c15e3cc7f8c446491f0686
2020-03-02 19:13:19 +00:00
Rahul Sabnis
7f6bfd9dc1 Update javadoc to reflect that BluetoothPbap#setConnectionPolicy returns
true on successfully setting the connection policy instead of on
disconnection. It also now indicates that if
BluetoothProfile#CONNECTION_POLICY_FORBIDDEN is passed in, the profile
will be disconnected.

Bug: 148966894
Test: Manual
Change-Id: I881c240fcbce0c8148625c35e6e88ab02ea7122f
2020-02-28 13:13:51 -08:00
Lee Shombert
9202f4dbd3 Binder cache for Bluetooth getBondState()
Bug: 140788621

Test: A special build that puts the PropertyInvalidatedCache in verification
mode was loaded on the device.  Then one iteration of MPTS was executed.  No
cache inconsistencies were found and no SELinux violations (associated with
the binder cache) were found.  The number of cache misses was approximately
10% of the total binder calls.  Then the phone was cycled through bluetooth
pairing and unpairing events.

Change-Id: Ia494f0ad58b889130052e5beb3bec6d1011508ef
2020-02-19 01:04:44 +00:00
Zach Johnson
c425dc2958 Merge "Revert "Require user pass in a non-null BluetoothDevice to all B..."" 2020-02-12 21:39:47 +00:00
Daniel Chapin
45fefe0f65 Revert "Require user pass in a non-null BluetoothDevice to all B..."
Revert "Pass in active device to all BluetoothA2dp APIs in packa..."

Revert "Pass in active device to all BluetoothA2dp APIs in packa..."

Revert submission 10253996-bt-a2dp-no-null

Reason for revert: b/149361880
Reverted Changes:
If43934374: Pass in active device to all BluetoothA2dp APIs in...
I22dd1ca36: Make sure calls to BluetoothA2dp APIs pass non-nul...
If6475af6f: Require user pass in a non-null BluetoothDevice to...
I9d0e2c89c: Pass in active device to all BluetoothA2dp APIs in...
I1faa6174d: Need to now pass in active device instead of null ...
I69a941a7e: Pass in active device to all BluetoothA2dp APIs in...

Change-Id: I297bda68da5023fd832201c485554d6bff05fa78
2020-02-12 17:16:10 +00:00
TreeHugger Robot
ed1e5bb875 Merge "Require user pass in a non-null BluetoothDevice to all BluetoothA2dp APIs, rename APIs as per API guidelines" 2020-02-11 02:36:51 +00:00
Automerger Merge Worker
2de8671a67 Merge "BluetoothA2dpSink System APIs now require BLUETOOTH_ADMIN permission" am: 88fba38a1c am: 940853b36f am: 87adc2705f
Change-Id: I315fc5ad3a124b3d38b4104c8afb35557d440b84
2020-02-10 23:53:01 +00:00
Automerger Merge Worker
940853b36f Merge "BluetoothA2dpSink System APIs now require BLUETOOTH_ADMIN permission" am: 88fba38a1c
Change-Id: If1599cabe081cd259051ffd36e2a597443919de7
2020-02-10 23:29:58 +00:00
Automerger Merge Worker
c592b3d042 Merge "Update BluetoothPbap class description to indicate how to create an instance of the class, add intdef to return value of BluetoothPbap#getConnectionState, and move all SystemApis to require the BLUETOOTH_PRIVILEGED permission" am: cc89e59203 am: 687ef90ac5 am: ccc1ad01e8
Change-Id: Ie7d5fb2def3e86d488150cc271e788e346f2ac76
2020-02-10 23:29:19 +00:00
Treehugger Robot
88fba38a1c Merge "BluetoothA2dpSink System APIs now require BLUETOOTH_ADMIN permission" 2020-02-10 23:16:52 +00:00
Automerger Merge Worker
687ef90ac5 Merge "Update BluetoothPbap class description to indicate how to create an instance of the class, add intdef to return value of BluetoothPbap#getConnectionState, and move all SystemApis to require the BLUETOOTH_PRIVILEGED permission" am: cc89e59203
Change-Id: I96de10ac130e3737911c050e0a76e30602c85721
2020-02-10 22:57:46 +00:00
Rahul Sabnis
eaa088f14b BluetoothA2dpSink System APIs now require BLUETOOTH_ADMIN permission
Bug: 149216030
Test: Manual
Change-Id: Ib28c7f3133eb96c1ba0b43c8b140babde699d5f4
2020-02-10 14:02:25 -08:00
Lee Shombert
a6574308c7 Binder caches for Bluetooth
* A cache for isOffloadedFilteringSupported().

* A cache for getProfileConnectionState().

Bug: 140788621

Test: A special build that puts the PropertyInvalidatedCache in
verification mode was loaded on the device.  Then one iteration of MPTS
was executed.  No cache inconsistencies were found and no SELinux
violations (associated with the binder cache) were found.  The number of
cache misses was approximately 15% of the total binder calls.  A second
test was run in which bluetooth headphones were connected and
disconnected.  Then bluetooth itself was disabled and then enabled.  The
caches were invalidated as expected and no errors were uncovered.

Change-Id: Icfad1071725e2d1e320fd252a49f0c4ae8ce6ad0
2020-02-10 11:07:18 -08:00
Lee Shombert
b26612a3a8 Merge "Binder cache for Bluetooth getState()." 2020-02-10 17:25:37 +00:00
Rahul Sabnis
b0a9a5dfac Update BluetoothPbap class description to indicate how to create an
instance of the class, add intdef to return value of
BluetoothPbap#getConnectionState, and move all SystemApis to require
the BLUETOOTH_PRIVILEGED permission

Bug: 148966894
Test: Manual
Change-Id: I4a798b0a16ab839f2047fc58f21c420cc99b6db6
2020-02-07 17:21:21 -08:00
Rahul Sabnis
bdc220961d Require user pass in a non-null BluetoothDevice to all BluetoothA2dp
APIs, rename APIs as per API guidelines

Bug: 147287141
Test: Manual
Change-Id: If6475af6fa7feab84eed7d3edeb0d2e24c1ed925
2020-02-07 13:29:56 -08:00
Automerger Merge Worker
f01ecddd8c Merge "BluetoothAdapter#connectAllEnabledProfiles and BluetoothAdapter#disconnectAllEnabledProfiles updated to require BLUETOOTH_PRIVILEGED permission and update documentation to indicate connection and disconnection is asynchronous" am: 750ab04052 am: 1f65bc19d4 am: 08730cb3b2
Change-Id: I5f4c5445841de8ebb61a5197156e78b512068659
2020-02-06 05:19:47 +00:00
Automerger Merge Worker
1f65bc19d4 Merge "BluetoothAdapter#connectAllEnabledProfiles and BluetoothAdapter#disconnectAllEnabledProfiles updated to require BLUETOOTH_PRIVILEGED permission and update documentation to indicate connection and disconnection is asynchronous" am: 750ab04052
Change-Id: Ie1a3555e3ca5d6a137142d3693850d72184cd3b6
2020-02-06 04:46:01 +00:00
Rahul Sabnis
966cef37c2 BluetoothAdapter#connectAllEnabledProfiles and
BluetoothAdapter#disconnectAllEnabledProfiles updated to require
BLUETOOTH_PRIVILEGED permission and update documentation to indicate
connection and disconnection is asynchronous

Bug: 147321746
Test: Manual
Change-Id: I961f02a539a247b1397ce4f478b9dc804d9973ab
2020-02-05 16:37:18 -08:00
Lee Shombert
38265345e8 Binder cache for Bluetooth getState().
Bug: 140788621

Test: A special build that puts the PropertyInvalidatedCache in verification
mode was loaded on the device.  Then one iteration of MPTS was executed.  No
cache inconsistencies were found and no SELinux violations (associated with
the binder cache) were found.  The number of cache misses was approximately
3% of the total binder calls.  All binder calls went through the cache.
Repeated the test with a work profile installed (to provide a second user
ID).

Change-Id: I2f1d0b6d61dedc5d1badb06a20c5932eca415904
2020-02-05 15:16:29 +00:00
Automerger Merge Worker
e7217d3eee Merge "Change data type of duration param from int representing seconds to long representing milliseconds in BluetoothAdapter#setScanMode" am: 6d4004fc61 am: cd3f28071e am: 9514b54cfd
Change-Id: I648f6be33a3b9ec4626fc991863df4645629d2a2
2020-02-05 01:14:26 +00:00
Automerger Merge Worker
cd3f28071e Merge "Change data type of duration param from int representing seconds to long representing milliseconds in BluetoothAdapter#setScanMode" am: 6d4004fc61
Change-Id: I3a222fe93c7cc4bfc0b967e51b633ceb0605c642
2020-02-05 00:50:59 +00:00
Rahul Sabnis
99507b5eb3 Change data type of duration param from int representing seconds to long
representing milliseconds in BluetoothAdapter#setScanMode

Bug: 144380530
Test: Manual
Change-Id: I76528478a64d22afefd4ec964d1a78295dd3c94f
2020-02-04 14:29:09 -08:00
Automerger Merge Worker
e2deab502f Merge "Add privileged permission to SystemApi BluetoothDevice#setAlias" am: 7a028c7f5b am: bbfcf7fc56 am: 8eebd377ae
Change-Id: I61d78666262095cd22f3fdef7bcc50e281ddc2a0
2020-02-02 00:02:43 +00:00
Automerger Merge Worker
4104f77d64 Merge "Add new API BluetoothAdapter#removeActiveDevice to replace calls to BluetoothAdapter#setActiveDevice with a null device" am: f0f3a0f48e am: 44d8a611c4 am: 96c736b92c
Change-Id: Id0be090915b319b8f38a624279cec31c9cfd62c1
2020-02-02 00:02:21 +00:00
Automerger Merge Worker
bbfcf7fc56 Merge "Add privileged permission to SystemApi BluetoothDevice#setAlias" am: 7a028c7f5b
Change-Id: I363ded95542c1402b6828d5475e04d2554c8d01e
2020-02-01 23:41:15 +00:00
Automerger Merge Worker
44d8a611c4 Merge "Add new API BluetoothAdapter#removeActiveDevice to replace calls to BluetoothAdapter#setActiveDevice with a null device" am: f0f3a0f48e
Change-Id: Ia5a08318ebdfdee7634a6cec492b36f35e143870
2020-02-01 23:37:45 +00:00