diff options
author | Smriti Gupta <smritig@codeaurora.org> | 2016-02-10 19:40:41 +0530 |
---|---|---|
committer | Hemant Gupta <hemantg@codeaurora.org> | 2016-02-16 19:15:45 +0530 |
commit | 09bc94ec979e1954dabaf0750aae838c75daaba5 (patch) | |
tree | 91a4acb5630f1e5064ee21e475e6d5552d1de43a /src/com/android/bluetooth/sap/SapService.java | |
parent | 899ab7685ed54d6d78f5d94c010cd053fbb6da07 (diff) | |
download | android_packages_apps_Bluetooth-09bc94ec979e1954dabaf0750aae838c75daaba5.tar.gz android_packages_apps_Bluetooth-09bc94ec979e1954dabaf0750aae838c75daaba5.tar.bz2 android_packages_apps_Bluetooth-09bc94ec979e1954dabaf0750aae838c75daaba5.zip |
OPP: Initialize obex socket listeners while starting Listening
- Initialize socket listener when socket listening is to be started
and not during onCreate. Without this patch there were usecases when BT was
not bein turned off completely like in BLE on state, in these states, onDestroy
was not getting called for OppService, leading to issues during next BT on
state and would lead to OPP transfer failure.
- Add adapter check before calling SdpRemove Native API to prevent possible ANR.
CRs-Fixed: 975531
Change-Id: I6f0b0101f310192c90050a76ac6374cf1359fd46
Diffstat (limited to 'src/com/android/bluetooth/sap/SapService.java')
-rw-r--r-- | src/com/android/bluetooth/sap/SapService.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/com/android/bluetooth/sap/SapService.java b/src/com/android/bluetooth/sap/SapService.java index 584d7ef00..79f561f93 100644 --- a/src/com/android/bluetooth/sap/SapService.java +++ b/src/com/android/bluetooth/sap/SapService.java @@ -152,9 +152,11 @@ 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() != null) { + if (mAdapter != null && mSdpHandle >= 0 && + SdpManager.getDefaultManager() != null) { if (DEBUG) Log.d(TAG, "Removing SDP record"); - SdpManager.getDefaultManager().removeSdpRecord(mSdpHandle); + boolean status = SdpManager.getDefaultManager().removeSdpRecord(mSdpHandle); + Log.d(TAG, "RemoveSDPrecord returns " + status); mSdpHandle = -1; } mSdpHandle = SdpManager.getDefaultManager().createSapsRecord(SDP_SAP_SERVICE_NAME, @@ -730,9 +732,11 @@ public class SapService extends ProfileService { mIsWaitingAuthorization = false; cancelUserTimeoutAlarm(); } - if (mSdpHandle >= 0 && SdpManager.getDefaultManager() != null) { + if (mAdapter != null && mSdpHandle >= 0 && + SdpManager.getDefaultManager() != null) { if (DEBUG) Log.d(TAG, "Removing SDP record"); - SdpManager.getDefaultManager().removeSdpRecord(mSdpHandle); + boolean status = SdpManager.getDefaultManager().removeSdpRecord(mSdpHandle); + Log.d(TAG, "RemoveSDPrecord returns " + status); mSdpHandle = -1; } if (mSessionStatusHandler != null) { |