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

Commit ac9715de authored by Joseph Pirozzo's avatar Joseph Pirozzo
Browse files

MAP Client Only connect MNS in connected state

Only allow the MNS to connect when the MAS client is in the connected
state, this prevents the possibility of the MNS client from connecting
if the MAS fails to connect.

Bug: 135088863
Test: disallow MAS connection and verify MNS notifications don't arrive.
Change-Id: I75de88e74708283ebbaef70251f7575c0da0c4d4
parent a353a95c
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.bluetooth.mapclient;

import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothProfile;
import android.bluetooth.BluetoothServerSocket;
import android.bluetooth.BluetoothSocket;
import android.os.Handler;
@@ -129,6 +130,11 @@ public class MnsService {
                Log.e(TAG, "Error: NO statemachine for device: " + device.getAddress()
                        + " (name: " + device.getName());
                return false;
            } else if (stateMachine.getState() != BluetoothProfile.STATE_CONNECTED) {
                Log.e(TAG, "Error: statemachine for device: " + device.getAddress()
                        + " (name: " + device.getName() + ") is not currently CONNECTED : "
                        + stateMachine.getCurrentState());
                return false;
            }
            MnsObexServer srv = new MnsObexServer(stateMachine, sServerSockets);
            BluetoothObexTransport transport = new BluetoothObexTransport(socket);