diff options
author | bait_dispatcher_monitor_system <bait_dispatcher_monitor_system@localhost> | 2015-02-19 22:48:03 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2015-02-19 22:48:03 -0800 |
commit | 7e0bc265b2f669726ac9e0feebf98c18809e0818 (patch) | |
tree | 0762c8f31f73c77d81eb792bfdad9834606fb52b | |
parent | 27dd25d3d4f6b0fc482e214affe0ba02995a4e33 (diff) | |
parent | 87e7d4d30a24b4c12432b454bf3e204e361e141c (diff) | |
download | android_packages_apps_BluetoothExt-7e0bc265b2f669726ac9e0feebf98c18809e0818.tar.gz android_packages_apps_BluetoothExt-7e0bc265b2f669726ac9e0feebf98c18809e0818.tar.bz2 android_packages_apps_BluetoothExt-7e0bc265b2f669726ac9e0feebf98c18809e0818.zip |
Merge "Bluetooth-Wipower:PRU re-enables Charge port after disabling."
-rw-r--r-- | src/org/codeaurora/bluetooth/a4wp/A4wpService.java | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/org/codeaurora/bluetooth/a4wp/A4wpService.java b/src/org/codeaurora/bluetooth/a4wp/A4wpService.java index ae43436..527e58c 100644 --- a/src/org/codeaurora/bluetooth/a4wp/A4wpService.java +++ b/src/org/codeaurora/bluetooth/a4wp/A4wpService.java @@ -159,6 +159,7 @@ public class A4wpService extends Service private static boolean mWipowerBoot = false; private static boolean isChargePortSet = false; static boolean mChargeComplete = true; + static boolean mOutputControl = true; private AdvertiseSettings mAdvertiseSettings; private AdvertiseData mAdvertisementData; @@ -533,22 +534,25 @@ public class A4wpService extends Service /* Hold wake lock during connection */ acquire_wake_lock(true); } - Log.v(LOGTAG, "StopAdvertising on connect"); - Message msg = mHandler.obtainMessage(STOP_ADVERTISING); - mHandler.sendMessage(msg); - mWipowerManager.enableAlertNotification(false); - mWipowerManager.enableDataNotification(true); + if (mOutputControl == true) { + Log.v(LOGTAG, "StopAdvertising on connect"); + Message msg = mHandler.obtainMessage(STOP_ADVERTISING); + mHandler.sendMessage(msg); + mWipowerManager.enableAlertNotification(false); + mWipowerManager.enableDataNotification(true); + } + mOutputControl = true; } else { Log.v(LOGTAG, "do Disable PruOutPut"); if (mChargeComplete == true) { mWipowerManager.enablePowerApply(true, true, true); } mWipowerManager.stopCharging(); - mWipowerManager.enableDataNotification(false); if(SystemProperties.getBoolean("persist.a4wp.skipwakelock", false) == false) { acquire_wake_lock(false); } isChargePortSet = false; + mOutputControl = false; return status; } @@ -741,7 +745,7 @@ public class A4wpService extends Service if (!isChargePortSet) { VRECT_DYN = (short)toUnsigned(value[VRECT_LSB]); VRECT_DYN |= (short)(toUnsigned(value[VRECT_MSB]) << 8); - if (DEFAULT_VRECT_MIN <= VRECT_DYN) { + if (DEFAULT_VRECT_MIN <= VRECT_DYN && mOutputControl) { mWipowerManager.startCharging(); isChargePortSet = true; } @@ -776,6 +780,7 @@ public class A4wpService extends Service /* Initiate a dummy connection such that on stop advertisment the advetisment instances are cleared properly */ mBluetoothGattServer.connect(mDevice, false); + mOutputControl = true; } else if (id == A4WP_PRU_DYNAMIC_UUID) { if (mPruDynamicParam == null) { |