summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSmriti Gupta <smritig@codeaurora.org>2014-04-25 15:18:51 +0530
committerSmriti Gupta <smritig@codeaurora.org>2014-04-25 15:18:51 +0530
commit9e5a55c11a440b03d586da561f888a66587a6dd0 (patch)
tree0c9ae68cc996041fc729508f70b1766627b36ea4 /src
parentffb942b5f0bea602982eaac9e4ed6bdb08890c1f (diff)
downloadandroid_packages_apps_BluetoothExt-9e5a55c11a440b03d586da561f888a66587a6dd0.tar.gz
android_packages_apps_BluetoothExt-9e5a55c11a440b03d586da561f888a66587a6dd0.tar.bz2
android_packages_apps_BluetoothExt-9e5a55c11a440b03d586da561f888a66587a6dd0.zip
SAP: Handle the case of remote side DISC properly
If the SAP is getting disconnect from the remote side but the sapDevice is already NULL, UI status was not updated properly as DISCONNECTED in the DUT. Change-Id: I2ff0882fb0c871cfabc7a5be41e54ae0583080cb CRs-Fixed: 643437
Diffstat (limited to 'src')
-rw-r--r--src/org/codeaurora/bluetooth/sap/BluetoothSapService.java23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/org/codeaurora/bluetooth/sap/BluetoothSapService.java b/src/org/codeaurora/bluetooth/sap/BluetoothSapService.java
index adefc32..7db1583 100644
--- a/src/org/codeaurora/bluetooth/sap/BluetoothSapService.java
+++ b/src/org/codeaurora/bluetooth/sap/BluetoothSapService.java
@@ -73,8 +73,8 @@ import org.codeaurora.bluetooth.R;
public class BluetoothSapService extends Service {
private static final String TAG = "BluetoothSapService";
- private static final boolean DBG = false;
- public static final boolean VERBOSE = false;
+ private static final boolean DBG = true;
+ public static final boolean VERBOSE = true;
private final static String SAP_SERVER = "qcom.sap.server";
@@ -1054,8 +1054,6 @@ public class BluetoothSapService extends Service {
closeSapdSocket();
/* close the rfcomm socket */
closeRfcommSocket();
- // Intimate the Settings APP about the disconnection
- handleSapDeviceStateChange(mRemoteDevice, BluetoothProfile.STATE_DISCONNECTED);
/* wait for sap downlink thread to close */
synchronized (mDownlinkLock) {
@@ -1069,6 +1067,10 @@ public class BluetoothSapService extends Service {
}
}
}
+
+ // Intimate the Settings APP about the disconnection
+ handleSapDeviceStateChange(mRemoteDevice, BluetoothProfile.STATE_DISCONNECTED);
+
if (IntExit && !stopped) {
if (VERBOSE) Log.v(TAG, "starting the listener thread ");
/* start the listener thread */
@@ -1319,14 +1321,15 @@ public class BluetoothSapService extends Service {
prevState = sapDevice.mState;
}
Log.d(TAG, "handleSapDeviceStateChange preState: " + prevState + " state: " + state);
- if (prevState == state) return;
- if (sapDevice == null) {
- sapDevice = new BluetoothSapDevice(state);
- mSapDevices.put(device, sapDevice);
- } else {
+ if (prevState != state) {
+ if (sapDevice == null) {
+ sapDevice = new BluetoothSapDevice(state);
+ mSapDevices.put(device, sapDevice);
+ } else {
sapDevice.mState = state;
- }
+ }
+ }
/* Notifying the connection state change of the profile before sending
the intent for connection state change, as it was causing a race