Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d1752abd authored by Pavel Maltsev's avatar Pavel Maltsev Committed by android-build-merger
Browse files

Merge "Ignore incoming A2DP if profile is disabled" am: 33c39f2a

am: 5dafd991

Change-Id: I8ea63b1de3337644d3d255a06929a3c5a1b3f6e3
parents 542bffe4 5dafd991
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -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 @@ public class A2dpSinkStateMachine extends StateMachine {
            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;