diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2015-01-17 17:37:39 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2015-01-17 17:37:39 -0800 |
commit | ddcd0caf30f4565e472204a6c492caae1edbc80d (patch) | |
tree | a619dcdfcf2f7cbcdedc069b611f5fbe812901ac | |
parent | 3d203d684cab41c2f15ce4ab8b447170498b50b8 (diff) | |
parent | bcf067cfdde09a6f90579e9add128040bca1e570 (diff) | |
download | android_packages_apps_BluetoothExt-ddcd0caf30f4565e472204a6c492caae1edbc80d.tar.gz android_packages_apps_BluetoothExt-ddcd0caf30f4565e472204a6c492caae1edbc80d.tar.bz2 android_packages_apps_BluetoothExt-ddcd0caf30f4565e472204a6c492caae1edbc80d.zip |
Merge "Bluetooth-Wipower: Fix for disconnect during LE unpair."
-rw-r--r-- | src/org/codeaurora/bluetooth/a4wp/A4wpService.java | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/org/codeaurora/bluetooth/a4wp/A4wpService.java b/src/org/codeaurora/bluetooth/a4wp/A4wpService.java index 699c322..fa69330 100644 --- a/src/org/codeaurora/bluetooth/a4wp/A4wpService.java +++ b/src/org/codeaurora/bluetooth/a4wp/A4wpService.java @@ -159,7 +159,6 @@ public class A4wpService extends Service private static boolean mWipowerBoot = false; private static boolean isChargePortSet = false; static boolean mChargeComplete = true; - static boolean isConnected = false; private AdvertiseSettings mAdvertiseSettings; private AdvertiseData mAdvertisementData; @@ -620,11 +619,11 @@ public class A4wpService extends Service mHandler.sendMessage(msg); } 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"); } } } @@ -687,10 +686,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) { + 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) { @@ -705,10 +703,9 @@ public class A4wpService extends Service isChargePortSet = false; } 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); } } @@ -778,7 +775,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) { |