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

Commit 7a0f8169 authored by Jaikumar Ganesh's avatar Jaikumar Ganesh
Browse files

Disconnect PAN and Input devices on BT disable.

Also, add a missing break.

Change-Id: I228f80a4223de20e60d2f3828e3f63bdc14f5afc
parent 06487a58
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -773,6 +773,7 @@ public final class BluetoothDeviceProfileState extends HierarchicalStateMachine

                case CONNECT_HFP_INCOMING:
                    transitionTo(mIncomingHandsfree);
                    break;
                case CONNECT_A2DP_INCOMING:
                    transitionTo(mIncomingA2dp);

+12 −0
Original line number Diff line number Diff line
@@ -385,11 +385,23 @@ public class BluetoothService extends IBluetooth.Stub {
        // Allow 3 seconds for profiles to gracefully disconnect
        // TODO: Introduce a callback mechanism so that each profile can notify
        // BluetoothService when it is done shutting down
        disconnectDevices();

        mHandler.sendMessageDelayed(
                mHandler.obtainMessage(MESSAGE_FINISH_DISABLE, saveSetting ? 1 : 0, 0), 3000);
        return true;
    }

    private synchronized void disconnectDevices() {
        // Disconnect devices handled by BluetoothService.
        for (BluetoothDevice device: getConnectedInputDevices()) {
            disconnectInputDevice(device);
        }

        for (BluetoothDevice device: getConnectedPanDevices()) {
            disconnectPanDevice(device);
        }
    }

    private synchronized void finishDisable(boolean saveSetting) {
        if (mBluetoothState != BluetoothAdapter.STATE_TURNING_OFF) {