Snap for 5956190 from f9128dcf0251f491b8d58ad6ca947c362d2d9d49 to qt-qpr2-release
Change-Id: Ia3693a6c01b511374116c4605288c6e36939db53
diff --git a/src/com/android/bluetooth/a2dpsink/A2dpSinkStateMachine.java b/src/com/android/bluetooth/a2dpsink/A2dpSinkStateMachine.java
index 19ed87f..77ead16 100644
--- a/src/com/android/bluetooth/a2dpsink/A2dpSinkStateMachine.java
+++ b/src/com/android/bluetooth/a2dpsink/A2dpSinkStateMachine.java
@@ -15,6 +15,8 @@
*/
package com.android.bluetooth.a2dpsink;
+import static android.bluetooth.BluetoothProfile.PRIORITY_OFF;
+
import android.bluetooth.BluetoothA2dpSink;
import android.bluetooth.BluetoothAudioConfig;
import android.bluetooth.BluetoothDevice;
@@ -168,6 +170,15 @@
switch (event.mType) {
case StackEvent.EVENT_TYPE_CONNECTION_STATE_CHANGED:
switch (event.mState) {
+ case StackEvent.CONNECTION_STATE_CONNECTING:
+ if (mService.getPriority(mDevice) == PRIORITY_OFF) {
+ Log.w(TAG, "Ignore incoming connection, profile is"
+ + " turned off for " + mDevice);
+ mService.disconnectA2dpNative(mDeviceAddress);
+ } else {
+ transitionTo(mConnecting);
+ }
+ break;
case StackEvent.CONNECTION_STATE_CONNECTED:
transitionTo(mConnected);
break;