summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSmriti Gupta <smritig@qti.qualcomm.com>2014-04-14 18:33:09 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2014-04-14 23:24:57 -0700
commit3eef80de0eee4820e2057514a5d756476d5b6514 (patch)
tree60a592801788c36e71d5af82a223cf251b5ee968 /src
parent93c830323f976756b54e2227d519cf85f58b68f0 (diff)
downloadandroid_packages_apps_BluetoothExt-3eef80de0eee4820e2057514a5d756476d5b6514.tar.gz
android_packages_apps_BluetoothExt-3eef80de0eee4820e2057514a5d756476d5b6514.tar.bz2
android_packages_apps_BluetoothExt-3eef80de0eee4820e2057514a5d756476d5b6514.zip
Bluetooth: Avoiding ANR, while rejecting SAP authorization request
- A case, where SAP has rejected remote device authorization request, DUT start RFCOMM Listener thread & does not update authorization status(isWaitingAuthorization is true), then ACTION_ACL_DISCONNECTED is received. As isWaitingAuthorization is true, So DUT try to start RFCOMM Listener thread again, which is running. So ANR due to longer OBJECT wait in main thread. Updating the correct authorization status while rejecting remote SAP authorization request to solve the issue. - Avoiding the resource leak by closing RFCOMM Socket, if Sapd client socket is not successfully initialized. Change-Id: I2820d5b04502b344f43c22af08c173a526c30834 CRs-Fixed: 647175
Diffstat (limited to 'src')
-rw-r--r--src/org/codeaurora/bluetooth/sap/BluetoothSapService.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/org/codeaurora/bluetooth/sap/BluetoothSapService.java b/src/org/codeaurora/bluetooth/sap/BluetoothSapService.java
index 22bad56..adefc32 100644
--- a/src/org/codeaurora/bluetooth/sap/BluetoothSapService.java
+++ b/src/org/codeaurora/bluetooth/sap/BluetoothSapService.java
@@ -527,6 +527,9 @@ public class BluetoothSapService extends Service {
} else if (action.equals(SAP_ACCESS_DISALLOWED_ACTION)) {
/* close the rfcomm socket and restart the listener thread */
+ Log.d(TAG,"SAP_ACCESS_DISALLOWED_ACTION:" + mIsWaitingAuthorization);
+
+ mIsWaitingAuthorization = false;
sendErrorConnResp();
closeRfcommSocket();
startRfcommListenerThread();
@@ -967,6 +970,8 @@ public class BluetoothSapService extends Service {
public void run() {
if (mSapdSocket == null) {
if (!initSapdClientSocket()) {
+ /* close the rfcomm socket to avoid resource leakage */
+ closeRfcommSocket();
/*restart the listener thread */
mSapHandler.sendMessage(mSapHandler.obtainMessage(MESSAGE_START_LISTENER));
return;