summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSravan Kumar V <sravankumar@codeaurora.org>2016-02-03 18:51:14 +0530
committerRoman Birg <roman@cyngn.com>2016-03-29 13:53:14 -0700
commit0256ad879553cd37bcf06be7fb29029124cde89f (patch)
tree728120ced3d81f62d7d7e26aedc6dc9593f18f3e
parentdb99605edbd4a29fec513258f4cb982407dbea6a (diff)
downloadandroid_packages_apps_Bluetooth-0256ad879553cd37bcf06be7fb29029124cde89f.tar.gz
android_packages_apps_Bluetooth-0256ad879553cd37bcf06be7fb29029124cde89f.tar.bz2
android_packages_apps_Bluetooth-0256ad879553cd37bcf06be7fb29029124cde89f.zip
Bluetooth-opp: Optimize OPP Power consummation.
Sleep BT service thread when screen is turned off to avoid unnecessary iterations which leads to High power consumption. Change-Id: I14261aa9f7b995ff72ab8f1827084b92ad7d0f75 CRs-Fixed: 971559
-rw-r--r--src/com/android/bluetooth/opp/BluetoothOppService.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/com/android/bluetooth/opp/BluetoothOppService.java b/src/com/android/bluetooth/opp/BluetoothOppService.java
index ec39e6e32..10437fb30 100644
--- a/src/com/android/bluetooth/opp/BluetoothOppService.java
+++ b/src/com/android/bluetooth/opp/BluetoothOppService.java
@@ -459,6 +459,7 @@ public class BluetoothOppService extends Service {
mPendingUpdate = true;
if ((mUpdateThread == null) && (mAdapter != null)
&& mAdapter.isEnabled()) {
+ mPowerManager = (PowerManager)getSystemService(POWER_SERVICE);
if (V) Log.v(TAG, "Starting a new thread");
mUpdateThread = new UpdateThread();
mUpdateThread.start();
@@ -494,6 +495,13 @@ public class BluetoothOppService extends Service {
if (V) Log.v(TAG, "***returning from updatethread***");
return;
}
+ try {
+ if (!mPowerManager.isInteractive())
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ Log.e(TAG, "Interrupted", e);
+ }
+
mPendingUpdate = false;
}
Cursor cursor;