aboutsummaryrefslogtreecommitdiff
path: root/service/java/com/android/server/bluetooth/BluetoothManagerService.java
Commit message (Collapse)AuthorAgeFilesLines
* Disable message to restart the stack when flag is pushedWilliam Escande2023-03-011-4/+1
| | | | | | | | | | This is a short term fix while a better solution is developped Test: build Bug: 265386284 Change-Id: I1a09b6709526452e796c503caa4b3295e2a9d589 (cherry picked from commit 1514ea4478203408a8f222437645529a8c2c1f8f) Merged-In: I1a09b6709526452e796c503caa4b3295e2a9d589
* Prevent concurrentModification of profilesServicesWilliam Escande2023-01-201-1/+7
| | | | | | | | | | | | | | Since BluetoothProfileConnector is used for all profiles, the BluetoothManagerService is calling the serviceDisconnected of the BluetoothProfileConnector, that will call it's unbind, that will be performed back in the BluetoothManagerService... We are using an async but it does not prevent against re-entrant call Fix: 263757880 Test: manual test of turn on off the bluetooth Change-Id: I673244b2110b09135d82d2985a33c6f4c3739d03 (cherry picked from commit 66ec07e64499d5c529965415a182fe0b9dc7c7f4) Merged-In: I673244b2110b09135d82d2985a33c6f4c3739d03
* Merge changes from topic ↵William Escande2023-01-181-3/+10
|\ | | | | | | | | | | | | | | "cherrypicker-L95100000958232375:N14700001329291186" into tm-qpr-dev * changes: Unregister callback on unregisterAppUid. Fix BT Query Routing Issue
| * Fix BT Query Routing IssueAnimesh Fatehpuria2023-01-181-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During BREDR_TIMEOUT, we accidentally skip the BLE_ON state which is important for broadcasting intent to external apps. This patch fixes this issue. Cherry picked from wear to reduce code divergence Refactor fix to not be stuck in BLE_ON Initial change Id was I8fd6c2f54b2bdae9b8a587c144424a976b6201d5 Bug: 263323082 Bug: 191828729 Tag: #refactor Test: Manual Change-Id: I8e35a574e8da7936bd1bf5073abfc5ed17b10bf9 (cherry picked from commit f18221f5f2fed98b9a0b3f38f6a899f051836ab9) Merged-In: I8e35a574e8da7936bd1bf5073abfc5ed17b10bf9
* | Allow Root to call shell commandWilliam Escande2023-01-171-14/+30
|/ | | | | | | | | | | | | Repro step: * switch to second user (guest) * enable adb as root * `adb shell cmd bluetooth_manager enable` -> fail Bug: 263554371 Test: Manual Change-Id: I3a479fbd3e2fe21b1a1b872a15aa6df4ad286356 (cherry picked from commit 145626e4098e3beb201ea4b9a6ddbfa086656532) Merged-In: I3a479fbd3e2fe21b1a1b872a15aa6df4ad286356
* Add wait-for-state commandWilliam Escande2022-12-201-7/+16
| | | | | | | | | | | | | | | Disable and enable are async shell command. This is creating flakyness in test that expect the bluetooth to be already enabled / disabled. Test: atest BluetoothInstrumentationTests Test: atest BluetoothShellCommandTest Test: atest 'BluetoothTest#AdapterEnableDisable' // net_test_bluetooth Fix: 261772749 Tag: #refactor Change-Id: I3ca29dde23a5182ede28eceaf1ac97e4668ab5d5 (cherry picked from commit ca23daa448294ebea1b5cfd421732e85440fe4b9) Merged-In: I3ca29dde23a5182ede28eceaf1ac97e4668ab5d5
* Move all profile services bind to BluetoothManagerServiceEtienne Ruffieux2022-11-291-13/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | We are currently binding the profile services in framework/ BluetoothProfileConnector, except for BluetoothHeadset and BluetoothLeCallControl that are bound in BMS. The issue with binding the profiles in framework/ is that calling apps don't always have the required permission (BLUETOOTH_PRIVILEGED) to check if the service is enabled or not (BluetoothAdapter#getSupportedProfiles), so we are trying to bind the service even if the profile is disabled. This change will unify the profiles service binding by moving the bind process in BluetoothProfileConnector in BluetoothManagerService and making BluetoothHeadset and BluetoothLeCallControl use BluetoothProfileConnector. Bug: 241827236 Bug: 236399693 Test: atest CtsBluetoothTestCases Test: atest BluetoothInstrumentationTests Tag: #feature Ignore-AOSP-First: Cherry-pick Change-Id: I925b4415c023ff9e43a8ff947ae7ca5456babe64 Merged-In: I925b4415c023ff9e43a8ff947ae7ca5456babe64
* Add APM session metricsStephanie Bak2022-10-271-17/+23
| | | | | | | | Bug: 247470852 Test: statsd_testdrive 521 Ignore-AOSP-First: already merged in AOSP Change-Id: Ie9d27426578e0605965b8f35eed4a51c9a7e2196 Merged-In: Ie9d27426578e0605965b8f35eed4a51c9a7e2196
* Enable BT OPP base activities in system service.Etienne Ruffieux2022-08-291-16/+21
| | | | | | | | | Bug: 242963176 Tag: #feature Test: manual Ignore-AOSP-First: cherry-pick Merged-In: I5954d22647dca07d5bfd55aea263a79d70ad0f7c Change-Id: I5954d22647dca07d5bfd55aea263a79d70ad0f7c
* Move enabling state of Bluetooth sharing to system service.Etienne Ruffieux2022-08-261-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | BluetoothOppLauncherActivity & BluetoothOppBtEnableActivity 'enabled' state should be updated wether Bluetooth is ON or OFF. Previously, the state of these Activities was set with resource config, but since Bluetooth started replacing them by sysprops, we had to enable / disable these Activities in BluetoothOppService. However, the bt sharing tile should be available even when Bluetooth is OFF, and as their state is already updated in BluetoothManagerService when there is an user change, we can use that instead but with the condition that BluetoothOppBtEnableActivity is enabled too. All other Bluetooth OPP Activities enabled / disabled state are still handled in BluetoothOppService as they require Bluetooth to be ON to work anyway, and don't impact UI tiles. This fixes both an issue where the bt sharing tile doesn't appear when Bluetooth has been turned OFF, and an issue where Bluetooth would crash if it hadn't been turned ON before using the bt sharing tile. Test: manual Tag: #feature Bug: 242963176 Ignore-AOSP-First: change not fully in AOSP yet Change-Id: I67840dbd9f4cfc42026a14a1fc467fc95aa3a587
* Bluetooth APM enhancementStephanie Bak2022-08-091-7/+87
| | | | | | | Bug: 239983569 Test: manual Ignore-AOSP-First: merge conflicts in AOSP Change-Id: I2092880e047a1a9d50a47e4724e5fb2815d04f2d
* Fix admin enable/disable of Bluetooth file sharing, part 2Rahul Arya2022-07-201-6/+12
| | | | | | | | | | | | | | This fixes the bluetooth package detection functionality in the case when *all* components are disabled. This occurs in the CTS test, but did not occur in manual testing of ag/19219300. Also did manual testing to make sure we don't regress (toggled the no_bluetooth_sharing option, verified that it appeared/disappeared) Bug: 239372439 Test: atest CtsDevicePolicyManagerTestCases:DeviceOwnerTest Tag: #stability Ignore-AOSP-First: depends on a ton of changes that are only in tm-dev Change-Id: Ib9530a8829a946ea00a21111e459d697086f2ef8
* Merge "Fix admin enable/disable of Bluetooth file sharing" into tm-dev am: ↵Rahul Arya2022-07-121-16/+49
|\ | | | | | | | | | | | | | | | | c001bc5f22 Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/19219300 Change-Id: Ic0beb31a5db2deaab49826a0bb4a93fdc6baba0d Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| * Fix admin enable/disable of Bluetooth file sharingRahul Arya2022-07-081-16/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an extremely partial fix for a mostly-broken feature. For fully-managed devices, this fixes the toggle for the file sharing option, by detecting which Bluetooth package should be used rather than just guessing. However, on work profiles, the file sharing option does not really work anyway, it just infinitely loads. In addition, it is not correctly disabled when Bluetooth stops, so the icon just remains but doesn't do anything. A full fix would add the enable/disable sequence for *work* UserHandles to BluetoothOppManager, so the LAUNCHER_ACTIVITY is properly enabled and disabled. In addition, it would fix the issue described in the linked bug to prevent infinite loading (dedicated bug: b/112625123). Tag: #stability Ignore-AOSP-First: For T? Bug: 237389774 Test: Manual, verifying the *badged* BT file sharing icon appears/disappears as needed Change-Id: I070987bc884947246c372c65691c4866ebd1e7c7
* | Merge "Check the service is in the supported profile list instead of using ↵TreeHugger Robot2022-07-011-2/+32
|\ \ | |/ |/| | | system property" into tm-d1-dev
| * Check the service is in the supported profile list instead of using system ↵Patty Huang2022-06-251-2/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | property The value of system property will not be overridden if user enable the LE Audio related service via developer option. Checks the service is enabled or not by the supported list instead of the system property. Bug: 236553729 Tag: #refactor Test: manual Ignore-AOSP-First: will be cherry-picked Change-Id: I6c40123a390513bf905f3dd531cabd5609064fdd
* | Catch IAE in BluetoothManagerServiceSungsoo Lim2022-06-291-1/+5
|/ | | | | | | | Bug: 237175319 Tag: #refactor Test: build Change-Id: I7d7ef16387756a53115701c461fa735f214c3f25 (cherry picked from commit aed442ee917a0e050744ea7008a65d8043604e83)
* Merge "Reuse SynchronousResultReceivers instead of creating new." into tm-devEtienne Ruffieux2022-06-231-10/+10
|\
| * Reuse SynchronousResultReceivers instead of creating new.Etienne Ruffieux2022-06-221-10/+10
| | | | | | | | | | | | | | | | Bug: 217366135 Tag: #feature Test: manual Ignore-AOSP-First: to be chery-picked Change-Id: If8ae530a284151888a3f89a51d2c58f2a5cd3644
* | Merge "Check sysprop value before trying to bind to service" into tm-devEtienne Ruffieux2022-06-171-10/+10
|\ \
| * | Check sysprop value before trying to bind to serviceEtienne Ruffieux2022-06-161-10/+10
| |/ | | | | | | | | | | | | | | | | | | | | TbsService and HeadsetService were missing one check before BluetoothManagerService would try to bond to them. Bug: 236196227 Tag: #feature Test: manual Ignore-AOSP-First: will be cherry-picked Change-Id: Iceb6c437216092a7dccc238f396f4d95e341af1d
* | Merge "Prevent infinite rebind" into tm-devTreeHugger Robot2022-06-151-3/+9
|\ \ | |/ |/|
| * Prevent infinite rebindSungsoo Lim2022-06-141-3/+9
| | | | | | | | | | | | | | | | Bug: 235495968 Tag: #refactor Test: manual Change-Id: Icfe55340b26c40111df0b2babbdfc40bf026dac0 (cherry picked from commit 00294a7805ec1ad337d331929370d464b2b6deaa)
* | Restore BluetoothOppLauncherActivity default stateEtienne Ruffieux2022-06-131-3/+8
|/ | | | | | | | Bug: 228849846 Test: atest ManagedProfileTest Tag: #feature Ignore-AOSP-First: cherry-pick Change-Id: I010cf384a8b18a776d8052e87551b8af6fb348cb
* Fix updateOppLauncherComponentState package nameEtienne Ruffieux2022-04-191-1/+2
| | | | | | | | | | | | updateOppLauncherComponentState was using the old Bluetooth package name, now we call PackageManager to get it at runtime. Bug: 227078439 Test: atest testOppDisabledWhenRestrictionSet Tag: #stability Ignore-AOSP-First: rename in internal only Change-Id: I79c100673e98d4eb64652881428435f0ac6ba501
* Listen for Intent.ACTION_USER_SWITCHED in BluetoothManagerServiceRahul Sabnis2022-04-141-11/+16
| | | | | | | | | | instead of using the SystemService#onUserSwitching method Tag: #feature Bug: 228920751 Test: Manual Ignore-AOSP-First: Change only present in tm-dev Change-Id: Ic8c32c29662389bd62fa1684de9679c369545874
* Revert "Save off foreground user id before passing the message to the ↵Rahul Sabnis2022-04-141-8/+7
| | | | | | | | | | | | | | handler on" This reverts commit eda5120b133e6f55951287b1dd85b4bd290a60e7. Reason for revert: The issue in the bug is still reproducible after this change was landed Tag: #feature Bug: 228920751 Test: Manual Ignore-AOSP-First: Change only present in tm-dev Change-Id: I8d818370bcd6694b17c77545538f25fa2bbe2e34
* Save off foreground user id before passing the message to the handler onRahul Sabnis2022-04-131-7/+8
| | | | | | | | | | user switches Tag: #feature Bug: 228920751 Test: Manual Ignore-AOSP-First: Code only present in tm-dev Change-Id: Ic7d3c94880832f240f9d85b850cf2ce9936e3622
* Merge "Disallow BLE enable in airplane mode" am: 788208c101 am: 45e6f35fe1 ↵Himanshu Rawat2022-04-091-1/+2
|\ | | | | | | | | | | | | | | | | am: 64ae5b73cd Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2046765 Change-Id: I648f6daf5192dad68f542f01cc0f57d346cdbed2 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| * Merge "Disallow BLE enable in airplane mode" am: 788208c101Himanshu Rawat2022-04-071-1/+2
| |\ | | | | | | | | | | | | | | | | | | Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2046765 Change-Id: I86946412d8e374fad119ca913e71790a53ade2b8 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| | * Disallow BLE enable in airplane modeHimanshu Rawat2022-04-071-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | If BLE enable is called when airplane mode is set, it may prevent BT from turning OFF completely. Bug: 208950823 Test: act.py -c test_config.json -tc BtStressTest:test_toggle_bluetooth; Or continuously toggle BT in airplane mode. Change-Id: Id2c9f8cbc49d455d133afe3b251b781ba925741e
| * | Merge changes from topic "Handle Shutdown Intent" am: bd01f52b72 am: c5741e1775Joner Lin2022-03-231-0/+7
| |\| | | | | | | | | | | | | | | | Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2032224 Change-Id: Ide192bd17ce20476f0838b80ce2e695e00f4ac93
| | * Do not allow Bluetooth enabling during device shutting downjonerlin2022-03-231-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | Tag: #feature Bug: 207521630 Test: reboot device in BLE_ON state, check log Change-Id: Ia51355ae88919d81108a619e789c6d3415962231 Merged-In: I6330d2f94fe7a5ca582df83c9fa32c5c6cba5186
| * | Handle SHUTDOWN Intent in BluetoothManagerService am: 753c739998 am: ce789ee6cfjonerlin2022-03-231-0/+17
| |\| | | | | | | | | | | | | | | | Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2032223 Change-Id: Iba175a3044fa9a0090bc33a4efa818849dee2d66
| | * Handle SHUTDOWN Intent in BluetoothManagerServicejonerlin2022-03-231-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | Tag: #feature Bug: 207521630 Test: reboot device and check log Change-Id: I9dc8a561fd63545d75a1080402b972cd989c99a6 Merged-In: Ib30a5000ff1be24c276e673d096f67acb64136d6
| * | Merge "Add BluetoothShellCommand" am: ccf3bda9a2 am: b58752d3b2Treehugger Robot2022-03-091-1/+10
| |\| | | | | | | | | | | | | | | | Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/1997211 Change-Id: I8ca12f3bec19f3d04fb25b5b7e6b3c2af6d189c5
| | * Add BluetoothShellCommandWilliam Escande2022-02-231-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is deprecating the svc command for mainline Fix: 216233593 Tag: #refactor Test: manual: adb shell cmd bluetooth_manager enable Test: manual: adb shell cmd bluetooth_manager disable Merged-In: I19f71fbf689d8551b20359f577fbffd999806273 Change-Id: I19f71fbf689d8551b20359f577fbffd999806273
* | | Replace logic to determine the foreground user id with the SystemServiceRahul Sabnis2022-04-061-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | callback Tag: #feature Bug: 226404651 Test: Manual Ignore-AOSP-First: Resolving merge conflict Change-Id: I78e6ead277785dff4cbbf8fc218dc68dccdc28a5
* | | Changing apk name in the manifest and the corresponding packages.Roopa Sattiraju2022-03-241-1/+1
| | | | | | | | | | | | | | | | | | | | | BUG: 226403247 Test: TH Change-Id: I060dd05cf722a4185f85f4f1e231b63ae1508cb4
* | | Do not allow Bluetooth enabling during device shutting downjonerlin2022-03-211-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | Tag: #feature Bug: 207521630 Test: reboot device in BLE_ON state, check log Ignore-AOSP-First: Conflict with internal Change-Id: I6330d2f94fe7a5ca582df83c9fa32c5c6cba5186
* | | Handle SHUTDOWN Intent in BluetoothManagerServicejonerlin2022-03-211-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | Tag: #feature Bug: 207521630 Test: reboot device and check log Ignore-AOSP-First: Conflict with internal Change-Id: Ib30a5000ff1be24c276e673d096f67acb64136d6
* | | Added missing profile owner check to enable/disableEtienne Ruffieux2022-03-071-7/+33
| | | | | | | | | | | | | | | | | | | | | | | | Bug: 222662836 Test: atest Tag: #feature Ignore-AOSP-First: Restriction only in internal for now Change-Id: Ib46ce38699ab5795b23ace594a5ad19efd66ecbc
* | | Merge "Add BluetoothShellCommand" into tm-devTreeHugger Robot2022-03-011-1/+10
|\ \ \
| * | | Add BluetoothShellCommandWilliam Escande2022-02-231-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is deprecating the svc command for mainline Fix: 216233593 Tag: #refactor Test: manual: adb shell cmd bluetooth_manager enable Test: manual: adb shell cmd bluetooth_manager disable Ignore-AOSP-First: Merge conflict resolution on package name Change-Id: I19f71fbf689d8551b20359f577fbffd999806273
* | | | Removed unused checks in BluetoothManagerServiceEtienne Ruffieux2022-02-241-16/+6
|/ / / | | | | | | | | | | | | | | | | | | | | | Test: manual Bug: 216497194 Tag: #feature Change-Id: I713c63d6bc7098694f47b83c63f06f6c63c7e13b Ignore-AOSP-First: modifications only on internal
* | | Changing server location to com.android.server.bluetoothRoopa Sattiraju2022-02-141-2/+3
| | | | | | | | | | | | | | | | | | Bug: 217736913 Test: Compile and bringup Change-Id: I3c1e07567949dd9e503a62b65feee4c7b5e10b2d
* | | fixing CTS tests for BluetoothAdapter restrictionsEtienne Ruffieux2022-02-101-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | Tag: #feature Test: atest Bug: 218719641 Ignore-AOSP-First: change only in internal Change-Id: I8e28eafcd6ba9dc67e205eec06ae07639a7e0a60
* | | Deprecating BluetoothAdapter enable/disableEtienne Ruffieux2022-02-081-48/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Starting from T, BluetoothAdapter enable/disable APIs are limited to system apps or device owners. Tag: #feature Bug: 218493289 Test: manual Ignore-AOSP-First: Merge conflict Change-Id: I851830eae8a3a2bb4be4b2bcf6147fd81e092f2a
* | | Merge "Restore the getInt / getString call"TreeHugger Robot2022-02-041-28/+15
|\ \ \
| * | | Restore the getInt / getString callWilliam Escande2022-02-031-28/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cf ag/16744674 The getInt will trigger erroprone bug it will be fix soon: b/217722828 Cleaning the temp value we created in the ManagerService while the API was not yet available Removing a no-longer user var Tag: #refactor Test: build + errorprone Bug: 217722828 Ignore-AOSP-First: merge conflict resolution Change-Id: I83077edab761241eb8260d06f8deb10e23e999f8