Loading src/com/android/bluetooth/OolConnManager.java +6 −3 Original line number Diff line number Diff line Loading @@ -54,7 +54,10 @@ public class OolConnManager { public static void setSdpInitiatedAddress(BluetoothDevice remBtDev) { if (remBtDev != null) mAddress = remBtDev.getAddress(); else mAddress = null; Log.d(TAG,"setSdpInitiatedAddress "+ mAddress); } Loading @@ -63,9 +66,9 @@ public class OolConnManager { int waitCount = 0; int channelNo = -1; while(!sdpDone && waitCount < 20) { while(!sdpDone && waitCount < 100) { try { Thread.sleep(500); Thread.sleep(100); } catch (InterruptedException e) { Log.e(TAG, "Interrupted", e); } Loading src/com/android/bluetooth/map/BluetoothMapMasInstance.java +6 −4 Original line number Diff line number Diff line Loading @@ -277,10 +277,11 @@ public class BluetoothMapMasInstance implements IObexConnectionHandler { Log.e(TAG, "Failed to start the listeners"); return; } if(mSdpHandle >= 0) { SdpManager.getDefaultManager().removeSdpRecord(mSdpHandle); if (mSdpHandle >= 0 && SdpManager.getDefaultManager() != null) { if(V) Log.d(TAG, "Removing SDP record for MAS instance: " + mMasInstanceId + " Object reference: " + this + "SDP handle: " + mSdpHandle); SdpManager.getDefaultManager().removeSdpRecord(mSdpHandle); mSdpHandle = -1; } mSdpHandle = createMasSdpRecord(mServerSockets.getRfcommChannel(), mServerSockets.getL2capPsm()); Loading Loading @@ -407,10 +408,11 @@ public class BluetoothMapMasInstance implements IObexConnectionHandler { mObserver.deinit(); mObserver = null; } if (mSdpHandle >= 0) { SdpManager.getDefaultManager().removeSdpRecord(mSdpHandle); if (mSdpHandle >= 0 && SdpManager.getDefaultManager() != null) { if(V) Log.d(TAG, "Removing SDP record for MAS instance: " + mMasInstanceId + " Object reference: " + this + "SDP handle: " + mSdpHandle); SdpManager.getDefaultManager().removeSdpRecord(mSdpHandle); mSdpHandle = -1; } closeConnectionSocket(); Loading src/com/android/bluetooth/opp/BluetoothOppL2capListener.java +5 −5 Original line number Diff line number Diff line Loading @@ -115,9 +115,6 @@ public class BluetoothOppL2capListener { while (!mInterrupted) { try { if (V) Log.v(TAG, "Accepting connection..."); if (mBtServerSocket == null) { } BluetoothServerSocket sSocket = mBtServerSocket; if (sSocket ==null) { mInterrupted = true; Loading Loading @@ -192,10 +189,13 @@ public class BluetoothOppL2capListener { } } public int getL2capChannel() { Log.d(TAG,"L2C channel is " +mBtServerSocket.getChannel()); public int getL2capPsm() { if (mBtServerSocket != null) { Log.d(TAG, "L2CAP psm is " + mBtServerSocket.getChannel()); return mBtServerSocket.getChannel(); } return -1; } public BluetoothServerSocket openL2capSocket(){ Loading src/com/android/bluetooth/opp/BluetoothOppService.java +19 −24 Original line number Diff line number Diff line Loading @@ -139,8 +139,6 @@ public class BluetoothOppService extends Service { private int mIncomingRetries = 0; private ObexTransport mPendingConnection = null; private BluetoothServerSocket mBtRfcServerSocket = null; private BluetoothServerSocket mBtL2cServerSocket = null; private int mOppSdpHandle = -1; /* Loading Loading @@ -237,6 +235,12 @@ public class BluetoothOppService extends Service { public void handleMessage(Message msg) { switch (msg.what) { case STOP_LISTENER: if (mOppSdpHandle >= 0 && SdpManager.getDefaultManager() != null) { if (D) Log.d(TAG, "Removing SDP record"); SdpManager.getDefaultManager().removeSdpRecord(mOppSdpHandle); mOppSdpHandle = -1; } if(mSocketListener != null){ mSocketListener.stop(); } Loading Loading @@ -357,30 +361,21 @@ public class BluetoothOppService extends Service { private void startSocketListener() { if (V) Log.v(TAG, "start Socket Listeners"); if (mSocketListener != null ) { mBtRfcServerSocket = mSocketListener.openRfcommSocket(); } if (mL2cSocketListener != null) { mBtL2cServerSocket = mL2cSocketListener.openL2capSocket(); } if (mSocketListener != null && mL2cSocketListener != null) { if (mBtRfcServerSocket != null && mBtL2cServerSocket != null) { mOppSdpHandle = SdpManager.getDefaultManager().createOppOpsRecord("OBEX Object Push", mBtRfcServerSocket.getChannel(), mBtL2cServerSocket.getChannel(), 0x0102, SdpManager.OPP_FORMAT_ALL); if ( ( mSocketListener.openRfcommSocket() != null) && ( mL2cSocketListener.openL2capSocket() != null) && SdpManager.getDefaultManager() != null) { mOppSdpHandle = SdpManager.getDefaultManager() .createOppOpsRecord("OBEX Object Push", mSocketListener.getRfcommChannel(), mL2cSocketListener.getL2capPsm(), 0x0102, SdpManager.OPP_FORMAT_ALL); mSocketListener.start(mHandler); mL2cSocketListener.start(mHandler); } else { Log.e(TAG, "ERROR:serversocket object is NULL"); } if (mSocketListener != null) { mSocketListener.start(mHandler); } if (mL2cSocketListener != null) { mL2cSocketListener.start(mHandler); } } @Override Loading src/com/android/bluetooth/sap/SapService.java +8 −2 Original line number Diff line number Diff line Loading @@ -153,9 +153,10 @@ public class SapService extends ProfileService { // for multiple connections. mServerSocket = mAdapter.listenUsingRfcommOn( BluetoothAdapter.SOCKET_CHANNEL_AUTO_STATIC_NO_SDP, true, true); if (mSdpHandle >= 0) { SdpManager.getDefaultManager().removeSdpRecord(mSdpHandle); if (mSdpHandle >= 0 && SdpManager.getDefaultManager() != null) { if (DEBUG) Log.d(TAG, "Removing SDP record"); SdpManager.getDefaultManager().removeSdpRecord(mSdpHandle); mSdpHandle = -1; } mSdpHandle = SdpManager.getDefaultManager().createSapsRecord(SDP_SAP_SERVICE_NAME, mServerSocket.getChannel(), SDP_SAP_VERSION); Loading Loading @@ -732,6 +733,11 @@ public class SapService extends ProfileService { mIsWaitingAuthorization = false; cancelUserTimeoutAlarm(); } if (mSdpHandle >= 0 && SdpManager.getDefaultManager() != null) { if (DEBUG) Log.d(TAG, "Removing SDP record"); SdpManager.getDefaultManager().removeSdpRecord(mSdpHandle); mSdpHandle = -1; } if (mSessionStatusHandler != null) { mSessionStatusHandler.removeCallbacksAndMessages(null); // Request release of all resources Loading Loading
src/com/android/bluetooth/OolConnManager.java +6 −3 Original line number Diff line number Diff line Loading @@ -54,7 +54,10 @@ public class OolConnManager { public static void setSdpInitiatedAddress(BluetoothDevice remBtDev) { if (remBtDev != null) mAddress = remBtDev.getAddress(); else mAddress = null; Log.d(TAG,"setSdpInitiatedAddress "+ mAddress); } Loading @@ -63,9 +66,9 @@ public class OolConnManager { int waitCount = 0; int channelNo = -1; while(!sdpDone && waitCount < 20) { while(!sdpDone && waitCount < 100) { try { Thread.sleep(500); Thread.sleep(100); } catch (InterruptedException e) { Log.e(TAG, "Interrupted", e); } Loading
src/com/android/bluetooth/map/BluetoothMapMasInstance.java +6 −4 Original line number Diff line number Diff line Loading @@ -277,10 +277,11 @@ public class BluetoothMapMasInstance implements IObexConnectionHandler { Log.e(TAG, "Failed to start the listeners"); return; } if(mSdpHandle >= 0) { SdpManager.getDefaultManager().removeSdpRecord(mSdpHandle); if (mSdpHandle >= 0 && SdpManager.getDefaultManager() != null) { if(V) Log.d(TAG, "Removing SDP record for MAS instance: " + mMasInstanceId + " Object reference: " + this + "SDP handle: " + mSdpHandle); SdpManager.getDefaultManager().removeSdpRecord(mSdpHandle); mSdpHandle = -1; } mSdpHandle = createMasSdpRecord(mServerSockets.getRfcommChannel(), mServerSockets.getL2capPsm()); Loading Loading @@ -407,10 +408,11 @@ public class BluetoothMapMasInstance implements IObexConnectionHandler { mObserver.deinit(); mObserver = null; } if (mSdpHandle >= 0) { SdpManager.getDefaultManager().removeSdpRecord(mSdpHandle); if (mSdpHandle >= 0 && SdpManager.getDefaultManager() != null) { if(V) Log.d(TAG, "Removing SDP record for MAS instance: " + mMasInstanceId + " Object reference: " + this + "SDP handle: " + mSdpHandle); SdpManager.getDefaultManager().removeSdpRecord(mSdpHandle); mSdpHandle = -1; } closeConnectionSocket(); Loading
src/com/android/bluetooth/opp/BluetoothOppL2capListener.java +5 −5 Original line number Diff line number Diff line Loading @@ -115,9 +115,6 @@ public class BluetoothOppL2capListener { while (!mInterrupted) { try { if (V) Log.v(TAG, "Accepting connection..."); if (mBtServerSocket == null) { } BluetoothServerSocket sSocket = mBtServerSocket; if (sSocket ==null) { mInterrupted = true; Loading Loading @@ -192,10 +189,13 @@ public class BluetoothOppL2capListener { } } public int getL2capChannel() { Log.d(TAG,"L2C channel is " +mBtServerSocket.getChannel()); public int getL2capPsm() { if (mBtServerSocket != null) { Log.d(TAG, "L2CAP psm is " + mBtServerSocket.getChannel()); return mBtServerSocket.getChannel(); } return -1; } public BluetoothServerSocket openL2capSocket(){ Loading
src/com/android/bluetooth/opp/BluetoothOppService.java +19 −24 Original line number Diff line number Diff line Loading @@ -139,8 +139,6 @@ public class BluetoothOppService extends Service { private int mIncomingRetries = 0; private ObexTransport mPendingConnection = null; private BluetoothServerSocket mBtRfcServerSocket = null; private BluetoothServerSocket mBtL2cServerSocket = null; private int mOppSdpHandle = -1; /* Loading Loading @@ -237,6 +235,12 @@ public class BluetoothOppService extends Service { public void handleMessage(Message msg) { switch (msg.what) { case STOP_LISTENER: if (mOppSdpHandle >= 0 && SdpManager.getDefaultManager() != null) { if (D) Log.d(TAG, "Removing SDP record"); SdpManager.getDefaultManager().removeSdpRecord(mOppSdpHandle); mOppSdpHandle = -1; } if(mSocketListener != null){ mSocketListener.stop(); } Loading Loading @@ -357,30 +361,21 @@ public class BluetoothOppService extends Service { private void startSocketListener() { if (V) Log.v(TAG, "start Socket Listeners"); if (mSocketListener != null ) { mBtRfcServerSocket = mSocketListener.openRfcommSocket(); } if (mL2cSocketListener != null) { mBtL2cServerSocket = mL2cSocketListener.openL2capSocket(); } if (mSocketListener != null && mL2cSocketListener != null) { if (mBtRfcServerSocket != null && mBtL2cServerSocket != null) { mOppSdpHandle = SdpManager.getDefaultManager().createOppOpsRecord("OBEX Object Push", mBtRfcServerSocket.getChannel(), mBtL2cServerSocket.getChannel(), 0x0102, SdpManager.OPP_FORMAT_ALL); if ( ( mSocketListener.openRfcommSocket() != null) && ( mL2cSocketListener.openL2capSocket() != null) && SdpManager.getDefaultManager() != null) { mOppSdpHandle = SdpManager.getDefaultManager() .createOppOpsRecord("OBEX Object Push", mSocketListener.getRfcommChannel(), mL2cSocketListener.getL2capPsm(), 0x0102, SdpManager.OPP_FORMAT_ALL); mSocketListener.start(mHandler); mL2cSocketListener.start(mHandler); } else { Log.e(TAG, "ERROR:serversocket object is NULL"); } if (mSocketListener != null) { mSocketListener.start(mHandler); } if (mL2cSocketListener != null) { mL2cSocketListener.start(mHandler); } } @Override Loading
src/com/android/bluetooth/sap/SapService.java +8 −2 Original line number Diff line number Diff line Loading @@ -153,9 +153,10 @@ public class SapService extends ProfileService { // for multiple connections. mServerSocket = mAdapter.listenUsingRfcommOn( BluetoothAdapter.SOCKET_CHANNEL_AUTO_STATIC_NO_SDP, true, true); if (mSdpHandle >= 0) { SdpManager.getDefaultManager().removeSdpRecord(mSdpHandle); if (mSdpHandle >= 0 && SdpManager.getDefaultManager() != null) { if (DEBUG) Log.d(TAG, "Removing SDP record"); SdpManager.getDefaultManager().removeSdpRecord(mSdpHandle); mSdpHandle = -1; } mSdpHandle = SdpManager.getDefaultManager().createSapsRecord(SDP_SAP_SERVICE_NAME, mServerSocket.getChannel(), SDP_SAP_VERSION); Loading Loading @@ -732,6 +733,11 @@ public class SapService extends ProfileService { mIsWaitingAuthorization = false; cancelUserTimeoutAlarm(); } if (mSdpHandle >= 0 && SdpManager.getDefaultManager() != null) { if (DEBUG) Log.d(TAG, "Removing SDP record"); SdpManager.getDefaultManager().removeSdpRecord(mSdpHandle); mSdpHandle = -1; } if (mSessionStatusHandler != null) { mSessionStatusHandler.removeCallbacksAndMessages(null); // Request release of all resources Loading