diff options
author | Jeff Brown <jeffbrown@google.com> | 2012-08-16 16:20:54 -0700 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2012-08-16 16:26:54 -0700 |
commit | 13c589b66c47aa4d988eecce9a12c39d580939c9 (patch) | |
tree | 62da402e6e794134566c3635fdbe0c1a144ba998 | |
parent | cc48c144bb0c15e003d1b9469c87a2c132ea6308 (diff) | |
download | frameworks_base-13c589b66c47aa4d988eecce9a12c39d580939c9.zip frameworks_base-13c589b66c47aa4d988eecce9a12c39d580939c9.tar.gz frameworks_base-13c589b66c47aa4d988eecce9a12c39d580939c9.tar.bz2 |
Animate brightness with electron beam.
Also added an internal flag to control whether the electron beam
on animation is used. It's on for now but we might want to
turn if off if we can't get the HAL to provide the
necessary screen on synchronization on all devices.
Change-Id: Iaa3cfa0fd61de10174e68351e4db890eff2d2918
-rw-r--r-- | services/java/com/android/server/power/DisplayPowerController.java | 25 | ||||
-rw-r--r-- | services/java/com/android/server/power/DisplayPowerState.java | 5 |
2 files changed, 21 insertions, 9 deletions
diff --git a/services/java/com/android/server/power/DisplayPowerController.java b/services/java/com/android/server/power/DisplayPowerController.java index b0c79fa..f3183f8 100644 --- a/services/java/com/android/server/power/DisplayPowerController.java +++ b/services/java/com/android/server/power/DisplayPowerController.java @@ -70,6 +70,12 @@ final class DisplayPowerController { private static final boolean DEBUG_PRETEND_PROXIMITY_SENSOR_ABSENT = false; private static final boolean DEBUG_PRETEND_LIGHT_SENSOR_ABSENT = false; + // If true, uses the electron beam on animation. + // We might want to turn this off if we cannot get a guarantee that the screen + // actually turns on and starts showing new content after the call to set the + // screen state returns. + private static final boolean USE_ELECTRON_BEAM_ON_ANIMATION = true; + private static final int ELECTRON_BEAM_ON_ANIMATION_DURATION_MILLIS = 300; private static final int ELECTRON_BEAM_OFF_ANIMATION_DURATION_MILLIS = 600; @@ -550,14 +556,19 @@ final class DisplayPowerController { // on animation immediately then the results are pretty ugly. if (!mElectronBeamOffAnimator.isStarted()) { setScreenOn(true); - if (!mElectronBeamOnAnimator.isStarted()) { - if (mPowerState.getElectronBeamLevel() == 1.0f) { - mPowerState.dismissElectronBeam(); - } else if (mPowerState.prepareElectronBeam(true)) { - mElectronBeamOnAnimator.start(); - } else { - mElectronBeamOnAnimator.end(); + if (USE_ELECTRON_BEAM_ON_ANIMATION) { + if (!mElectronBeamOnAnimator.isStarted()) { + if (mPowerState.getElectronBeamLevel() == 1.0f) { + mPowerState.dismissElectronBeam(); + } else if (mPowerState.prepareElectronBeam(true)) { + mElectronBeamOnAnimator.start(); + } else { + mElectronBeamOnAnimator.end(); + } } + } else { + mPowerState.setElectronBeamLevel(1.0f); + mPowerState.dismissElectronBeam(); } } } else { diff --git a/services/java/com/android/server/power/DisplayPowerState.java b/services/java/com/android/server/power/DisplayPowerState.java index f618725..64a0462 100644 --- a/services/java/com/android/server/power/DisplayPowerState.java +++ b/services/java/com/android/server/power/DisplayPowerState.java @@ -242,8 +242,9 @@ final class DisplayPowerState { mElectronBeam.draw(mElectronBeamLevel); } - if ((mDirty & (DIRTY_BRIGHTNESS | DIRTY_SCREEN_ON)) != 0) { - mScreenBrightnessModulator.setBrightness(mScreenOn ? mScreenBrightness : 0); + if ((mDirty & (DIRTY_BRIGHTNESS | DIRTY_SCREEN_ON | DIRTY_ELECTRON_BEAM)) != 0) { + mScreenBrightnessModulator.setBrightness(mScreenOn ? + (int)(mScreenBrightness * mElectronBeamLevel) : 0); } if ((mDirty & DIRTY_SCREEN_ON) != 0 && mScreenOn) { |