summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2016-10-12 05:03:53 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2016-10-12 05:03:55 +0000
commit56746f9830eb2e91692c2f0882dbd3ab8438b213 (patch)
treea9c158179cbbe5e339987ac0fa6eb6eeba4350d7
parent250262a3134e5cd39e2ec93330eaca5cbde565b8 (diff)
parent3b3940d38105a8c8d50dd04ff50a77b8eff1311e (diff)
Merge "Change 2nd and later burn-in protection intervals to 2 mins" into cw-f-dev
-rw-r--r--services/core/java/com/android/server/policy/BurnInProtectionHelper.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/policy/BurnInProtectionHelper.java b/services/core/java/com/android/server/policy/BurnInProtectionHelper.java
index e6ec6a67fe3a..92729dc08b63 100644
--- a/services/core/java/com/android/server/policy/BurnInProtectionHelper.java
+++ b/services/core/java/com/android/server/policy/BurnInProtectionHelper.java
@@ -43,7 +43,10 @@ public class BurnInProtectionHelper implements DisplayManager.DisplayListener,
// Default value when max burnin radius is not set.
public static final int BURN_IN_MAX_RADIUS_DEFAULT = -1;
- private static final long BURNIN_PROTECTION_WAKEUP_INTERVAL_MS = TimeUnit.MINUTES.toMillis(1);
+ private static final long BURNIN_PROTECTION_FIRST_WAKEUP_INTERVAL_MS =
+ TimeUnit.MINUTES.toMillis(1);
+ private static final long BURNIN_PROTECTION_SUBSEQUENT_WAKEUP_INTERVAL_MS =
+ TimeUnit.MINUTES.toMillis(2);
private static final long BURNIN_PROTECTION_MINIMAL_INTERVAL_MS = TimeUnit.SECONDS.toMillis(10);
private static final boolean DEBUG = false;
@@ -138,6 +141,9 @@ public class BurnInProtectionHelper implements DisplayManager.DisplayListener,
// We don't want to adjust offsets immediately after the device goes into ambient mode.
// Instead, we want to wait until it's more likely that the user is not observing the
// screen anymore.
+ final long interval = mFirstUpdate
+ ? BURNIN_PROTECTION_FIRST_WAKEUP_INTERVAL_MS
+ : BURNIN_PROTECTION_SUBSEQUENT_WAKEUP_INTERVAL_MS;
if (mFirstUpdate) {
mFirstUpdate = false;
} else {
@@ -156,8 +162,7 @@ public class BurnInProtectionHelper implements DisplayManager.DisplayListener,
// Next adjustment at least ten seconds in the future.
long nextWall = nowWall + BURNIN_PROTECTION_MINIMAL_INTERVAL_MS;
// And aligned to the minute.
- nextWall = nextWall - nextWall % BURNIN_PROTECTION_WAKEUP_INTERVAL_MS
- + BURNIN_PROTECTION_WAKEUP_INTERVAL_MS;
+ nextWall = (nextWall - (nextWall % interval)) + interval;
// Use elapsed real time that is adjusted to full minute on wall clock.
final long nextElapsed = nowElapsed + (nextWall - nowWall);
if (DEBUG) {