summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUgo Yu <ugoyu@google.com>2018-06-22 21:59:31 +0800
committerUgo Yu <ugoyu@google.com>2018-06-22 22:26:57 +0800
commit92641885b10d3e29af0742a2f1ae18afd68dd837 (patch)
treea988079cf0f49f324c767563cc9c62e69a500095 /src
parent5851f9b5afe30aea8625e56fc2192befb63c663b (diff)
downloadandroid_packages_apps_Bluetooth-92641885b10d3e29af0742a2f1ae18afd68dd837.tar.gz
android_packages_apps_Bluetooth-92641885b10d3e29af0742a2f1ae18afd68dd837.tar.bz2
android_packages_apps_Bluetooth-92641885b10d3e29af0742a2f1ae18afd68dd837.zip
SCO: Don't set active device if a diconnect message is defered
- Fix a pin-pon scenario in HeadsetService. - If a headset B is set as active deivce while headset A is connecting SCO, HeadsetService request headset A's state machine to do disconnect SCO. - However, when state machine is at AudioConnecting state, DISCONNECT_AUDIO would be pending in defered meesage queue and will be handled in next state. - Once headset A entered AndioOn state, it set it self to as active device again then start handling DISCONNECT_AUDIO. - After headset A finally disconnect SCO, HeadsetService won't reconnect it and rout to headset B since active device is still headset A. - Active deivce would be like A->B->A, and no device SCO stay connected. Bug: 110642515 Test: Manual test, make a call and switch path A->speaker->B on phone UI Change-Id: I7dde255c2ba9f04aec86b7fdd30e7bfadfdd5068 (cherry picked from commit aebfbb7e35ca4cafaa9167d74a37fdb9bc8f62bc)
Diffstat (limited to 'src')
-rw-r--r--src/com/android/bluetooth/hfp/HeadsetStateMachine.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/com/android/bluetooth/hfp/HeadsetStateMachine.java b/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
index b1d2cfc79..d25d9edff 100644
--- a/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
+++ b/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
@@ -1201,7 +1201,8 @@ public class HeadsetStateMachine extends StateMachine {
// Set active device to current active SCO device when the current active device
// is different from mCurrentDevice. This is to accommodate active device state
// mis-match between native and Java.
- if (!mDevice.equals(mHeadsetService.getActiveDevice())) {
+ if (!mDevice.equals(mHeadsetService.getActiveDevice())
+ && !hasDeferredMessages(DISCONNECT_AUDIO)) {
mHeadsetService.setActiveDevice(mDevice);
}
setAudioParameters();