summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2015-02-06 05:41:59 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2015-02-06 05:41:59 -0800
commita920259150436607d91b641b9ab862bc57dcfd71 (patch)
tree0f226d848dc532b2d26571bce0a83351dbba47ce /src
parentbd0e962489164adf5797d1643435cd4c1b13e369 (diff)
parent6b0fd020deabe46ab10d2fd4be256883e89070d2 (diff)
downloadandroid_packages_apps_BluetoothExt-a920259150436607d91b641b9ab862bc57dcfd71.tar.gz
android_packages_apps_BluetoothExt-a920259150436607d91b641b9ab862bc57dcfd71.tar.bz2
android_packages_apps_BluetoothExt-a920259150436607d91b641b9ab862bc57dcfd71.zip
Merge "Bluetooth-Wipower: Fix for disconnect during LE unpair."
Diffstat (limited to 'src')
-rw-r--r--src/org/codeaurora/bluetooth/a4wp/A4wpService.java24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/org/codeaurora/bluetooth/a4wp/A4wpService.java b/src/org/codeaurora/bluetooth/a4wp/A4wpService.java
index aff0ce5..ed80174 100644
--- a/src/org/codeaurora/bluetooth/a4wp/A4wpService.java
+++ b/src/org/codeaurora/bluetooth/a4wp/A4wpService.java
@@ -123,7 +123,6 @@ public class A4wpService extends Service
private static boolean mWipowerBoot = false;
static boolean mChargeComplete = true;
- static boolean isConnected = false;
private AdvertiseSettings mAdvertiseSettings;
private AdvertiseData mAdvertisementData;
@@ -554,11 +553,11 @@ public class A4wpService extends Service
Log.v(LOGTAG, "StartAdvertising");
StartAdvertising();
} else {
- Log.v(LOGTAG, "Cancel connection as part of -" + state);
- if (mBluetoothGattServer != null) {
- if (mDevice != null) {
- mBluetoothGattServer.cancelConnection(mDevice);
- }
+ if (mBluetoothGattServer != null && mDevice != null) {
+ Log.v(LOGTAG, "onPowerApply " + state + "dropping Connection");
+ mBluetoothGattServer.cancelConnection(mDevice);
+ } else {
+ Log.v(LOGTAG, "onPowerApply " + state + "skip dropping Connection");
}
}
}
@@ -618,11 +617,9 @@ public class A4wpService extends Service
public void onConnectionStateChange(BluetoothDevice device, int status, int newState) {
WipowerState state = WipowerState.OFF;
mState = newState;
- if (mState == BluetoothProfile.STATE_DISCONNECTED && isConnected == true) {
- Log.v(LOGTAG, "onConnectionStateChange:DISCONNECTED " + device + "charge complete " + mChargeComplete);
- isConnected = false;
- if (mDevice != null && mWipowerManager != null) {
- stopAdvertising();
+ if (mState == BluetoothProfile.STATE_DISCONNECTED) {
+ if (mWipowerManager != null && device.equals(mDevice)) {
+ Log.v(LOGTAG, "onConnectionStateChange:DISCONNECTED " + device + "charge complete " + mChargeComplete);
mWipowerManager.enableDataNotification(false);
mWipowerManager.stopCharging();
if (mChargeComplete != true) {
@@ -636,10 +633,9 @@ public class A4wpService extends Service
}
} else if (mState == BluetoothProfile.STATE_CONNECTED) {
Log.v(LOGTAG, "onConnectionStateChange:CONNECTED");
- mDevice = device;
/* Initiate a dummy connection such that on stop advertisment
the advetisment instances are cleared properly */
- mBluetoothGattServer.connect(mDevice, false);
+ mBluetoothGattServer.connect(device, false);
}
}
@@ -683,7 +679,7 @@ public class A4wpService extends Service
else if(id == A4WP_PRU_STATIC_UUID)
{
value = mPruStaticParam.getValue();
- isConnected = true;
+ mDevice = device;
}
else if (id == A4WP_PRU_DYNAMIC_UUID) {
if (mPruDynamicParam == null) {