Commit Graph

1644 Commits

Author SHA1 Message Date
Philip P. Moltmann
01628ba180 Set attributionTag for noteOp(WRITE_SETTINGS) calls
Test: atest FrameworksNetTests
Bug: 136595429
Change-Id: I33f787644c44d7b0e5ce17a433820cfcd985cdfb
Exempt-From-Owner-Approval: Merge from AOSP
2020-04-21 21:46:34 +00:00
Lee Shombert
303cf24280 Merge "Fix exception handling in getState() binder cache" into rvc-dev am: 6e17bc7fae am: 3bfe58bd5e
Change-Id: I68d37b6591f6725a0dfba4ddefafe80a197ecf28
2020-04-16 16:26:15 +00: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
TreeHugger Robot
ae22de6111 Merge "Revert "Fix exception handling in getState() binder cache"" into rvc-dev am: 58de85c41e am: 409b13dbb0
Change-Id: If3ec8be83ba651313b2564776ca87245d5af7aa5
2020-04-09 00:25:28 +00: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
e46da26d89 Merge "Fix exception handling in getState() binder cache" into rvc-dev am: 773cc6249e
Change-Id: I6ae7601efafdca3df5f1bdc6897a2796d3ef7fa8
2020-04-07 16:25:31 +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
Treehugger Robot
10a2b079b0 Merge "Independent methods to enable/disable BLE mode" am: bb3874364f am: df9658720b
Change-Id: Ie3373dda0c8d92aafdbf85d228d5596e584720ef
2020-03-30 01:52:54 +00: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
Treehugger Robot
bb3874364f Merge "Independent methods to enable/disable BLE mode" 2020-03-30 01:20:19 +00:00
Treehugger Robot
364534c3d2 Merge "BluetoothHearingAid System APIs now throw an exception if a null BluetoothDevice is passed in" 2020-03-26 10:07:30 +00:00
Rahul Sabnis
eb5712abd2 BluetoothHearingAid System APIs now throw an exception if a null
BluetoothDevice is passed in

Bug: 149238489
Test: Manual
Merged-In: I594f558bfe1e286bf74dd8dc3db4c8497fd0a025
Change-Id: I594f558bfe1e286bf74dd8dc3db4c8497fd0a025
2020-03-25 13:50:36 -07:00
TreeHugger Robot
e228bc0b61 Merge "BluetoothHearingAid System APIs now throw an exception if a null BluetoothDevice is passed in" into rvc-dev am: fc099117fc
Change-Id: I1f8863a291515441a410f1c5339b7eb3eef46cda
2020-03-25 13:42:54 +00:00
Ugo Yu
644a6d52a6 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-25 17:47:19 +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
115bebfea3 Merge "Add BLUETOOTH_PRIVILEGED permission as a requirement for all new Bluetooth SystemApis and for hidden connect/disconnect APIs." into rvc-dev am: bd91b5360f
Change-Id: I342a5b035d9ded41e1a850553148c7b184f8a46c
2020-03-21 07:02:55 +00:00
Rahul Sabnis
8bc55739e7 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
Merged-In: I33ee2c7ccd3827db3d23d6447cf82d9ffc36836a
Change-Id: I33ee2c7ccd3827db3d23d6447cf82d9ffc36836a
2020-03-21 04:14:29 +00: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
Treehugger Robot
74c07d06c8 Merge "BluetoothHearingAid#getHiSyncId now consistently uses the term HiSyncId (removed all references to CustomerId) and added link to explain what the HiSyncId represents" am: e8640349ed am: 55bb6e2275
Change-Id: I677945e30762425ad600ef6f56c05fd402f2cefa
2020-03-19 20:29:49 +00:00
Treehugger Robot
e8640349ed Merge "BluetoothHearingAid#getHiSyncId now consistently uses the term HiSyncId (removed all references to CustomerId) and added link to explain what the HiSyncId represents" 2020-03-19 20:01:07 +00:00
Rahul Sabnis
3c7e8444f5 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
Change-Id: I4ff2a8d46f3fc5d06a29829a69a27a0c15e466f8
2020-03-19 11:44:54 -07:00
Rahul Sabnis
cd3bee95ed 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: I91ee6878cac1b84bd289278a1b965658a26fe4db
Merged-In: I4d7d971af75bff8967fd807d34dad90c32e24eba
Change-Id: I4d7d971af75bff8967fd807d34dad90c32e24eba
2020-03-18 11:10:24 -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
Philip P. Moltmann
aea50fc06a 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 11:47:51 -07:00
Automerger Merge Worker
fb2afb3d86 Merge "Update permissions of BluetoothPan System APIs and re-hide some APIs that do not need to be System APIs." am: 365caf6f04 am: a05c58f38d
Change-Id: I823c0912de5d688d76566f0a8dd4f61f5229b487
2020-03-10 21:07:26 +00:00
Automerger Merge Worker
20f320904f Merge "Add error code for BluetoothDevice#getBatteryLevel to represent Bluetooth is off" am: 1bb18d83eb am: 4e85f7bb92
Change-Id: Id96fc34f2d766829d18ee79c7f260b43ef95f434
2020-03-10 21:01:50 +00:00
Treehugger Robot
365caf6f04 Merge "Update permissions of BluetoothPan System APIs and re-hide some APIs that do not need to be System APIs." 2020-03-10 19:13:52 +00:00
Treehugger Robot
1bb18d83eb Merge "Add error code for BluetoothDevice#getBatteryLevel to represent Bluetooth is off" 2020-03-10 17:28:27 +00:00
Automerger Merge Worker
9a0299c3b5 Merge "Fix bluetooth can't turn off during network reset (2/3)" into rvc-dev am: d7e8b96042
Change-Id: I5d93e5d83fa8e0de7e99b70ddf30676385616fb8
2020-03-10 03:09:01 +00:00
Rahul Sabnis
d479374757 Update permissions of BluetoothPan System APIs and re-hide some APIs
that do not need to be System APIs.

Bug: 146045934
Test: Manual
Change-Id: Ic6325fde05294eb0266fee25f4b3e7098749a287
2020-03-09 16:58:34 -07: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
Rahul Sabnis
ded588641b Add error code for BluetoothDevice#getBatteryLevel to represent
Bluetooth is off

Bug: 147428695
Test: Manual
Change-Id: I07c2fa49954632da6aa6a93706883e4cdfd32fa6
2020-03-06 18:04:15 -08:00
Automerger Merge Worker
0d3c3b96b0 Merge "Revert "Revert "Require user pass in a non-null BluetoothDevice ..."" into rvc-dev am: 77864d6771
Change-Id: Id16e90dfbcd5bd9f639f8acadb589614b0075841
2020-03-05 19:33:47 +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
Automerger Merge Worker
a1b84782c5 Merge "Update BluetoothDevice SystemApi permissions and disallow passing a null pin to BluetoothDevice#setPin" am: 5f1daae19f
Change-Id: I4204ee9c10101d99fc8e4bad4ee44fc431f2cb9f
2020-03-04 19:28:11 +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
Rahul Sabnis
5f9232f3f7 Update BluetoothDevice SystemApi permissions and disallow passing a null
pin to BluetoothDevice#setPin

Bug: 147428695
Test: Manual
Merged-In: I74613d61420babecf5f1976fe33a2e1a729b71a1
Change-Id: I74613d61420babecf5f1976fe33a2e1a729b71a1
2020-03-03 11:29:58 -08:00
Automerger Merge Worker
488355b206 Merge "Update BluetoothDevice SystemApi permissions and disallow passing a null pin to BluetoothDevice#setPin" into rvc-dev am: 1f9f5ddd1c
Change-Id: Ia6ca3eee69bf89161824cf6b428363e48b9a8e3e
2020-03-03 19:26:16 +00: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
Automerger Merge Worker
65d3f63d76 Merge "Sanitize Bluetooth device names without regex" am: 6bd37ba788 am: b8f0a92e0b
Change-Id: I044fa2a33359b90724e68f89b1762e0e2b3b196a
2020-03-01 03:47:30 +00:00
Automerger Merge Worker
b8f0a92e0b Merge "Sanitize Bluetooth device names without regex" am: 6bd37ba788
Change-Id: I97c50cc31e681e53cc74d76803e3e24566b7e5dd
2020-03-01 03:34:53 +00:00
Treehugger Robot
6bd37ba788 Merge "Sanitize Bluetooth device names without regex" 2020-03-01 03:21:38 +00:00