summaryrefslogtreecommitdiffstats
path: root/src/com/android/bluetooth/opp/BluetoothOppService.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/bluetooth/opp/BluetoothOppService.java')
-rw-r--r--src/com/android/bluetooth/opp/BluetoothOppService.java43
1 files changed, 19 insertions, 24 deletions
diff --git a/src/com/android/bluetooth/opp/BluetoothOppService.java b/src/com/android/bluetooth/opp/BluetoothOppService.java
index b69a1f47e..cc9f6baec 100644
--- a/src/com/android/bluetooth/opp/BluetoothOppService.java
+++ b/src/com/android/bluetooth/opp/BluetoothOppService.java
@@ -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;
/*
@@ -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();
}
@@ -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 ( ( 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 (mBtRfcServerSocket != null && mBtL2cServerSocket != null) {
- mOppSdpHandle = SdpManager.getDefaultManager().createOppOpsRecord("OBEX Object Push",
- mBtRfcServerSocket.getChannel(), mBtL2cServerSocket.getChannel(),
- 0x0102, SdpManager.OPP_FORMAT_ALL);
- } else {
- Log.e(TAG, "ERROR:serversocket object is NULL");
- }
-
- if (mSocketListener != null) {
- mSocketListener.start(mHandler);
- }
-
- if (mL2cSocketListener != null) {
- mL2cSocketListener.start(mHandler);
- }
-
}
@Override