diff options
author | Dianne Hackborn <hackbod@google.com> | 2011-10-10 18:40:22 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2011-10-10 18:40:22 -0700 |
commit | 474fd74b8828717820b303497fece32f0b0e5d44 (patch) | |
tree | acc6af64e5bad221a0458b35befe4d72f6eefe58 /services/java | |
parent | 94e8471a956d46f4fae3da2b1e79862e07209efa (diff) | |
download | frameworks_base-474fd74b8828717820b303497fece32f0b0e5d44.zip frameworks_base-474fd74b8828717820b303497fece32f0b0e5d44.tar.gz frameworks_base-474fd74b8828717820b303497fece32f0b0e5d44.tar.bz2 |
Keep screen brightness at 0 while waiting for the UI to be displayed.
Change-Id: I957135c5423db6d83f4f30232481a1b6d77165fa
Diffstat (limited to 'services/java')
-rw-r--r-- | services/java/com/android/server/PowerManagerService.java | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java index 78dbbd6..1941c6a 100644 --- a/services/java/com/android/server/PowerManagerService.java +++ b/services/java/com/android/server/PowerManagerService.java @@ -1677,6 +1677,18 @@ public class PowerManagerService extends IPowerManager.Stub e.fillInStackTrace(); Slog.i(TAG, "Set screen state: " + on, e); } + if (on) { + if ((mPowerState & SCREEN_ON_BIT) == 0 || mSkippedScreenOn) { + // If we are turning the screen state on, but the screen + // light is currently off, then make sure that we set the + // light at this point to 0. This is the case where we are + // turning on the screen and waiting for the UI to be drawn + // before showing it to the user. We want the light off + // until it is ready to be shown to the user, not it using + // whatever the last value it had. + mScreenBrightness.forceValueLocked(Power.BRIGHTNESS_OFF); + } + } int err = Power.setScreenState(on); if (err == 0) { mLastScreenOnTime = (on ? SystemClock.elapsedRealtime() : 0); @@ -2029,8 +2041,6 @@ public class PowerManagerService extends IPowerManager.Stub RuntimeException e = new RuntimeException("here"); e.fillInStackTrace(); Slog.i(TAG, "Setting screen brightness: " + brightness, e); - mScreenBrightness.setTargetLocked(brightness, steps, - INITIAL_SCREEN_BRIGHTNESS, nominalCurrentValue); } } @@ -2103,6 +2113,15 @@ public class PowerManagerService extends IPowerManager.Stub + " delta=" + delta); } + void forceValueLocked(int value) { + targetValue = -1; + curValue = value; + setLightBrightness(mask, value); + if (animating) { + finishAnimationLocked(false, value); + } + } + void setTargetLocked(int target, int stepsToTarget, int initialValue, int nominalCurrentValue) { if (!initialized) { |