summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android/systemui/doze
diff options
context:
space:
mode:
authorJohn Spurlock <jspurlock@google.com>2014-08-21 16:43:45 -0400
committerJohn Spurlock <jspurlock@google.com>2014-08-22 09:02:58 -0400
commitd96179e02d157af92769e5c4adf584f05063b194 (patch)
tree98b66a23d2dcfb4986a4c103c121de7f463ccf75 /packages/SystemUI/src/com/android/systemui/doze
parent0df011725ce254c39cf2b83e337247f439c99f82 (diff)
downloadframeworks_base-d96179e02d157af92769e5c4adf584f05063b194.zip
frameworks_base-d96179e02d157af92769e5c4adf584f05063b194.tar.gz
frameworks_base-d96179e02d157af92769e5c4adf584f05063b194.tar.bz2
Don't do ambient display when in power-conservation mode.
Finish SystemUI's doze dream early when we enter saver mode. Bug:17164834 Change-Id: I79153be34da8c4b6447acf5dc9f93364906b2bab
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/doze')
-rw-r--r--packages/SystemUI/src/com/android/systemui/doze/DozeService.java25
1 files changed, 24 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeService.java b/packages/SystemUI/src/com/android/systemui/doze/DozeService.java
index 74c0328..fe1e5db 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeService.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeService.java
@@ -76,6 +76,7 @@ public class DozeService extends DreamService {
private PendingIntent mNotificationPulseIntent;
private int mMultipulseCount;
private int mNotificationPulseInterval;
+ private boolean mPowerSaveActive;
public DozeService() {
if (DEBUG) Log.d(mTag, "new DozeService()");
@@ -94,6 +95,7 @@ public class DozeService extends DreamService {
pw.print(" mNotificationLightOn: "); pw.println(mNotificationLightOn);
pw.print(" mMultipulseCount: "); pw.println(mMultipulseCount);
pw.print(" mNotificationPulseInterval: "); pw.println(mNotificationPulseInterval);
+ pw.print(" mPowerSaveActive: "); pw.println(mPowerSaveActive);
}
@Override
@@ -141,7 +143,13 @@ public class DozeService extends DreamService {
@Override
public void onDreamingStarted() {
super.onDreamingStarted();
- if (DEBUG) Log.d(mTag, "onDreamingStarted canDoze=" + canDoze());
+ mPowerSaveActive = mHost != null && mHost.isPowerSaveActive();
+ if (DEBUG) Log.d(mTag, "onDreamingStarted canDoze=" + canDoze() + " mPowerSaveActive="
+ + mPowerSaveActive);
+ if (mPowerSaveActive) {
+ finishToSavePower();
+ return;
+ }
mDreaming = true;
listenForPulseSignals(true);
requestDoze();
@@ -232,6 +240,11 @@ public class DozeService extends DreamService {
}
}
+ private void finishToSavePower() {
+ Log.w(mTag, "Exiting ambient mode due to low power battery saver");
+ finish();
+ }
+
private void listenForPulseSignals(boolean listen) {
if (DEBUG) Log.d(mTag, "listenForPulseSignals: " + listen);
mSigMotionSensor.setListening(listen);
@@ -329,6 +342,14 @@ public class DozeService extends DreamService {
mNotificationLightOn = on;
rescheduleNotificationPulse();
}
+
+ @Override
+ public void onPowerSaveChanged(boolean active) {
+ mPowerSaveActive = active;
+ if (mPowerSaveActive && mDreaming) {
+ finishToSavePower();
+ }
+ }
};
public interface Host {
@@ -337,11 +358,13 @@ public class DozeService extends DreamService {
void requestDoze(DozeService dozeService);
void requestPulse(int pulses, boolean delayed, DozeService dozeService);
void dozingStopped(DozeService dozeService);
+ boolean isPowerSaveActive();
public interface Callback {
void onNewNotifications();
void onBuzzBeepBlinked();
void onNotificationLight(boolean on);
+ void onPowerSaveChanged(boolean active);
}
}