summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKiran Kelageri <kkelageri@codeaurora.org>2014-09-18 13:05:30 -0700
committerKiran Kelageri <kkelageri@codeaurora.org>2014-09-18 13:17:53 -0700
commit9de7a8ae29cb0a6b6470614b9a0eb6ba835f8f91 (patch)
tree5ff1a2277bef2287229d592bdde895ea5a43f15f /src
parent6d558b8b517d06041d0a2703281275eeee5f84ad (diff)
downloadandroid_packages_apps_BluetoothExt-9de7a8ae29cb0a6b6470614b9a0eb6ba835f8f91.tar.gz
android_packages_apps_BluetoothExt-9de7a8ae29cb0a6b6470614b9a0eb6ba835f8f91.tar.bz2
android_packages_apps_BluetoothExt-9de7a8ae29cb0a6b6470614b9a0eb6ba835f8f91.zip
Bluetooth-Wipower: Stop Advertisment on disconnect.
Stopping advertisment on disconnect, Connection state is been maintained to avoid unncessary clean-up of wipower activity. state is been added to avoid sending VS command to get the wipower state. Change-Id: Icf9eafa72a67a4def746f5132dea0e341d7412c0 CRs-fixed: 726742
Diffstat (limited to 'src')
-rw-r--r--src/org/codeaurora/bluetooth/a4wp/A4wpService.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/org/codeaurora/bluetooth/a4wp/A4wpService.java b/src/org/codeaurora/bluetooth/a4wp/A4wpService.java
index 3b55e23..9e88249 100644
--- a/src/org/codeaurora/bluetooth/a4wp/A4wpService.java
+++ b/src/org/codeaurora/bluetooth/a4wp/A4wpService.java
@@ -117,6 +117,7 @@ public class A4wpService extends Service
private static boolean mWipowerBoot = false;
static boolean mChargeComplete = true;
+ static boolean isConnected = false;
private AdvertiseSettings mAdvertiseSettings;
private AdvertiseData mAdvertisementData;
@@ -438,7 +439,7 @@ public class A4wpService extends Service
mWipowerManager.startCharging();
mWipowerManager.enableAlertNotification(false);
mWipowerManager.enableDataNotification(true);
- stopAdvertising();
+ isConnected = true;
} else {
Log.v(LOGTAG, "do Disable PruOutPut");
return status;
@@ -573,9 +574,10 @@ public class A4wpService extends Service
public void onConnectionStateChange(BluetoothDevice device, int status, int newState) {
WipowerState state = WipowerState.OFF;
mState = newState;
- state = mWipowerManager.getState();
- if ((mState == BluetoothProfile.STATE_DISCONNECTED) && state == WipowerState.ON) {
+ if (mState == BluetoothProfile.STATE_DISCONNECTED && isConnected == true) {
Log.v(LOGTAG, "onConnectionStateChange:DISCONNECTED " + device + "charge complete " + mChargeComplete);
+ stopAdvertising();
+ isConnected = false;
if (mDevice != null && mWipowerManager != null) {
mWipowerManager.enableDataNotification(false);
mWipowerManager.stopCharging();