OSDN Git Service

A2dpSink sends CONNECTED instead of DISCONNECTED when connection
authorSanket Agarwal <sanketa@google.com>
Mon, 18 Apr 2016 22:35:23 +0000 (15:35 -0700)
committerSanket Agarwal <sanketa@google.com>
Fri, 28 Oct 2016 01:37:31 +0000 (18:37 -0700)
timeout

When a timeout happens for an outgoing A2DP Sink connection we are (most
likely a typo) sending a CONNECTED instead of DISCONNECTED event. This
confuses the UI and shows it as connected instead of disconnected.

Change-Id: I2fc5a9df86781b45e5c5ff9368a7c49c6c910294
(cherry picked from commit 688344c5ed34758c1e96a1dec9212e10107a7263)

src/com/android/bluetooth/a2dpsink/A2dpSinkStateMachine.java

index c005f27..7f21323 100644 (file)
@@ -241,7 +241,7 @@ final class A2dpSinkStateMachine extends StateMachine {
         private void processConnectionEvent(int state, BluetoothDevice device) {
             switch (state) {
             case CONNECTION_STATE_DISCONNECTED:
-                logw("Ignore HF DISCONNECTED event, device: " + device);
+                logw("Ignore A2DP DISCONNECTED event, device: " + device);
                 break;
             case CONNECTION_STATE_CONNECTING:
                 if (okToConnect(device)){
@@ -354,6 +354,8 @@ final class A2dpSinkStateMachine extends StateMachine {
         // in Pending state
         private void processConnectionEvent(int state, BluetoothDevice device) {
             log("processConnectionEvent state " + state);
+            log("Devices curr: " + mCurrentDevice + " target: " + mTargetDevice +
+                " incoming: " + mIncomingDevice + " device: " + device);
             switch (state) {
                 case CONNECTION_STATE_DISCONNECTED:
                     mAudioConfigs.remove(device);
@@ -383,7 +385,7 @@ final class A2dpSinkStateMachine extends StateMachine {
                         }
                     } else if (mTargetDevice != null && mTargetDevice.equals(device)) {
                         // outgoing connection failed
-                        broadcastConnectionState(mTargetDevice, BluetoothProfile.STATE_CONNECTED,
+                        broadcastConnectionState(mTargetDevice, BluetoothProfile.STATE_DISCONNECTED,
                                                  BluetoothProfile.STATE_CONNECTING);
                         synchronized (A2dpSinkStateMachine.this) {
                             mTargetDevice = null;