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

Commit 873086e4 authored by Hemant Gupta's avatar Hemant Gupta
Browse files

MAP: Update API name used during Socket Listening.

Since MAP supports 1.2, update API name from startRfcommSocketListeners
to startSocketListeners since both L2CAP and RFCOMM sockets are being
used for listening in MAP 1.2 code.

Test: Code builds.

Fixes: 35013632
Change-Id: I6f12f91b6869bd94692157d26eeef36515f294c1
parent 3418324f
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -257,9 +257,12 @@ public class BluetoothMapMasInstance implements IObexConnectionHandler {
        return combinedVersionCounter;
    }

    public synchronized void startRfcommSocketListener() {
    /**
     * Start Obex Server Sockets and create the SDP record.
     */
    public synchronized void startSocketListeners() {
        if (D) {
            Log.d(mTag, "Map Service startRfcommSocketListener");
            Log.d(mTag, "Map Service startSocketListeners");
        }

        if (mServerSession != null) {
@@ -422,7 +425,7 @@ public class BluetoothMapMasInstance implements IObexConnectionHandler {
        if (D) {
            Log.d(mTag, "MAP Service restartObexServerSession()");
        }
        startRfcommSocketListener();
        startSocketListeners();
    }


@@ -490,7 +493,7 @@ public class BluetoothMapMasInstance implements IObexConnectionHandler {
            Log.e(mTag, "Failed to accept incomming connection - " + "shutdown");
        } else {
            Log.e(mTag, "Failed to accept incomming connection - " + "restarting");
            startRfcommSocketListener();
            startSocketListeners();
        }
    }

+7 −7
Original line number Diff line number Diff line
@@ -214,20 +214,20 @@ public class BluetoothMapService extends ProfileService {
    }

    /**
     * Starts the RFComm listener threads for each MAS
     * Starts the Socket listener threads for each MAS
     * @throws IOException
     */
    private void startRfcommSocketListeners(int masId) {
    private void startSocketListeners(int masId) {
        if (masId == -1) {
            for (int i = 0, c = mMasInstances.size(); i < c; i++) {
                mMasInstances.valueAt(i).startRfcommSocketListener();
                mMasInstances.valueAt(i).startSocketListeners();
            }
        } else {
            BluetoothMapMasInstance masInst = mMasInstances.get(masId); // returns null for -1
            if (masInst != null) {
                masInst.startRfcommSocketListener();
                masInst.startSocketListeners();
            } else {
                Log.w(TAG, "startRfcommSocketListeners(): Invalid MasId: " + masId);
                Log.w(TAG, "startSocketListeners(): Invalid MasId: " + masId);
            }
        }
    }
@@ -363,7 +363,7 @@ public class BluetoothMapService extends ProfileService {
                    break;
                case START_LISTENER:
                    if (mAdapter.isEnabled()) {
                        startRfcommSocketListeners(msg.arg1);
                        startSocketListeners(msg.arg1);
                    }
                    break;
                case MSG_MAS_CONNECT:
@@ -754,7 +754,7 @@ public class BluetoothMapService extends ProfileService {
                    changed = true;
                    /* Start the new instance */
                    if (mAdapter.isEnabled()) {
                        newInst.startRfcommSocketListener();
                        newInst.startSocketListeners();
                    }
                }
            }