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

Commit 4c9a29ef authored by Jaikumar Ganesh's avatar Jaikumar Ganesh
Browse files

Set Sink State when ACL disconnects.

Change-Id: I9c71c1b848da48883c8ce28503c53c7d32e2fa34
parent 5eb7c9d3
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -112,6 +112,13 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub {
                    Message msg = Message.obtain(mHandler, MESSAGE_CONNECT_TO, device);
                    mHandler.sendMessageDelayed(msg, 6000);
                }
            } else if (action.equals(BluetoothDevice.ACTION_ACL_DISCONNECTED)) {
                synchronized (this) {
                    if (mAudioDevices.containsKey(device)) {
                        int state = mAudioDevices.get(device);
                        handleSinkStateChange(device, state, BluetoothA2dp.STATE_DISCONNECTED);
                    }
                }
            }
        }
    };
@@ -135,6 +142,7 @@ public class BluetoothA2dpService extends IBluetoothA2dp.Stub {
        mIntentFilter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
        mIntentFilter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
        mIntentFilter.addAction(BluetoothDevice.ACTION_ACL_CONNECTED);
        mIntentFilter.addAction(BluetoothDevice.ACTION_ACL_DISCONNECTED);
        mContext.registerReceiver(mReceiver, mIntentFilter);

        mAudioDevices = new HashMap<BluetoothDevice, Integer>();