summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAjay Panicker <apanicke@google.com>2015-08-27 19:40:06 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-08-27 19:40:06 +0000
commit38347a7e66a7c8a47767d8aad3d9534d95a0f070 (patch)
tree9e1291056f3ad816f22703405426c83a0dc3e9e0
parent37604004520846495a5dba50d7c3afef05a9ecf9 (diff)
parentd678c40f35f18ef48bddbbf07934bd2b82f92400 (diff)
downloadandroid_packages_apps_Bluetooth-38347a7e66a7c8a47767d8aad3d9534d95a0f070.tar.gz
android_packages_apps_Bluetooth-38347a7e66a7c8a47767d8aad3d9534d95a0f070.tar.bz2
android_packages_apps_Bluetooth-38347a7e66a7c8a47767d8aad3d9534d95a0f070.zip
am d678c40f: am 9135d866: HFP/A2DP: Remove pending auto-connect messages when connected
* commit 'd678c40f35f18ef48bddbbf07934bd2b82f92400': HFP/A2DP: Remove pending auto-connect messages when connected
-rwxr-xr-xsrc/com/android/bluetooth/a2dp/A2dpStateMachine.java6
-rw-r--r--src/com/android/bluetooth/hfp/HeadsetStateMachine.java14
2 files changed, 16 insertions, 4 deletions
diff --git a/src/com/android/bluetooth/a2dp/A2dpStateMachine.java b/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
index 3e48eae90..7ad4a5948 100755
--- a/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
+++ b/src/com/android/bluetooth/a2dp/A2dpStateMachine.java
@@ -479,6 +479,12 @@ final class A2dpStateMachine extends StateMachine {
private class Connected extends State {
@Override
public void enter() {
+ // Remove pending connection attempts that were deferred during the pending
+ // state. This is to prevent auto connect attempts from disconnecting
+ // devices that previously successfully connected.
+ // TODO: This needs to check for multiple A2DP connections, once supported...
+ removeDeferredMessages(CONNECT);
+
log("Enter Connected: " + getCurrentMessage().what);
// Upon connected, the audio starts out as stopped
broadcastAudioState(mCurrentDevice, BluetoothA2dp.STATE_NOT_PLAYING,
diff --git a/src/com/android/bluetooth/hfp/HeadsetStateMachine.java b/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
index 972239b07..d226e7cfe 100644
--- a/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
+++ b/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
@@ -741,6 +741,12 @@ final class HeadsetStateMachine extends StateMachine {
private class Connected extends State {
@Override
public void enter() {
+ // Remove pending connection attempts that were deferred during the pending
+ // state. This is to prevent auto connect attempts from disconnecting
+ // devices that previously successfully connected.
+ // TODO: This needs to check for multiple HFP connections, once supported...
+ removeDeferredMessages(CONNECT);
+
log("Enter Connected: " + getCurrentMessage().what +
", size: " + mConnectedDevicesList.size());
// start phone state listener here so that the CIND response as part of SLC can be
@@ -2216,7 +2222,7 @@ final class HeadsetStateMachine extends StateMachine {
boolean needAudio = true;
if (mVoiceRecognitionStarted || isInCall())
{
- Log.e(TAG, "Voice recognition started when call is active. isInCall:" + isInCall() +
+ Log.e(TAG, "Voice recognition started when call is active. isInCall:" + isInCall() +
" mVoiceRecognitionStarted: " + mVoiceRecognitionStarted);
return;
}
@@ -2695,9 +2701,9 @@ final class HeadsetStateMachine extends StateMachine {
removeMessages(DIALING_OUT_TIMEOUT);
} else if (callState.mCallState ==
HeadsetHalConstants.CALL_STATE_ACTIVE || callState.mCallState
- == HeadsetHalConstants.CALL_STATE_IDLE) {
+ == HeadsetHalConstants.CALL_STATE_IDLE) {
mDialingOut = false;
- }
+ }
}
/* Set ActiveScoDevice to null when call ends */
@@ -2867,7 +2873,7 @@ final class HeadsetStateMachine extends StateMachine {
String operatorName = mPhoneProxy.getNetworkOperator();
if (operatorName == null) {
operatorName = "";
- }
+ }
copsResponseNative(operatorName, getByteAddress(device));
} catch (RemoteException e) {
Log.e(TAG, Log.getStackTraceString(new Throwable()));