aboutsummaryrefslogtreecommitdiff
path: root/service/java/com/android/server/bluetooth/BluetoothManagerService.java
diff options
context:
space:
mode:
authorAnimesh Fatehpuria <fatehpuria@google.com>2021-07-13 16:21:49 +0800
committerCherrypicker Worker <android-build-cherrypicker-worker@google.com>2023-01-18 00:43:20 +0000
commit5bee68ce5869f016bc7bb06269c9715658072e43 (patch)
treeb660c3cb4437436a07abbc4c270e5b637e9ae8a8 /service/java/com/android/server/bluetooth/BluetoothManagerService.java
parentfd2f985c7862f7d82a721cff11c30e2faad4117e (diff)
Fix BT Query Routing Issue
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
Diffstat (limited to 'service/java/com/android/server/bluetooth/BluetoothManagerService.java')
-rw-r--r--service/java/com/android/server/bluetooth/BluetoothManagerService.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/service/java/com/android/server/bluetooth/BluetoothManagerService.java b/service/java/com/android/server/bluetooth/BluetoothManagerService.java
index da4b71ed55..cab6fc7be7 100644
--- a/service/java/com/android/server/bluetooth/BluetoothManagerService.java
+++ b/service/java/com/android/server/bluetooth/BluetoothManagerService.java
@@ -2832,11 +2832,18 @@ public class BluetoothManagerService extends IBluetoothManager.Stub {
sendBluetoothStateCallback(isUp);
sendBleStateChanged(prevState, newState);
- } else if (newState == BluetoothAdapter.STATE_BLE_TURNING_ON
- || newState == BluetoothAdapter.STATE_BLE_TURNING_OFF) {
+ } else if (newState == BluetoothAdapter.STATE_BLE_TURNING_ON) {
sendBleStateChanged(prevState, newState);
isStandardBroadcast = false;
-
+ } else if (newState == BluetoothAdapter.STATE_BLE_TURNING_OFF) {
+ sendBleStateChanged(prevState, newState);
+ if (prevState != BluetoothAdapter.STATE_TURNING_OFF) {
+ isStandardBroadcast = false;
+ } else {
+ // Broadcast as STATE_OFF for app that do not receive BLE update
+ newState = BluetoothAdapter.STATE_OFF;
+ sendBrEdrDownCallback(mContext.getAttributionSource());
+ }
} else if (newState == BluetoothAdapter.STATE_TURNING_ON
|| newState == BluetoothAdapter.STATE_TURNING_OFF) {
sendBleStateChanged(prevState, newState);