diff options
author | Jeff Brown <jeffbrown@google.com> | 2012-12-04 14:04:28 -0800 |
---|---|---|
committer | Jeff Brown <jeffbrown@google.com> | 2012-12-04 14:40:23 -0800 |
commit | 7f3994ec2a5dce1a037f04714b1f25cab85affb6 (patch) | |
tree | 28ebf44ea836cfdcbe41ead53943104a1d026b8d /services/java/com/android/server/power/DisplayPowerController.java | |
parent | e0a676a3bb0e7b9aced9359a021e4c5d2ffef752 (diff) |
Pin electron beam surface to natural orientation.
If a rotation occurred while the electron beam surface was showing,
the surface may have appeared in the wrong orientation. We fix this
problem by adjusting the transformation matrix of the electron beam
surface according to the display orientation whenever a display
transaction occurs.
The rotation itself is allowed to proceed but it is not visible
to the user. We must let this happen so that the lock screen
is correctly oriented when the screen is turned back on.
Note that the electron beam surface serves two purposes.
First, it is used to play the screen off animation.
When the animation is finished, the surface remains visible but is
solid black. Then we turn the screen off.
Second, when we turn the screen back on we leave the electron beam
surface showing until the window manager is ready to show the
new content. This prevents the user from seeing a flash of the
old content while the screen is being turned on. When everything is
ready, we dismiss the electron beam.
It's important for the electron beam to remain visible for
the entire duration from just before the screen is turned off until
after the screen is turned on and is ready to be seen. This is
why we cannot fix the bug by deferring rotation or otherwise
getting in the way of the window manager doing what it needs
to do to get the screen ready when the screen is turned on again.
Bug: 7479740
Change-Id: I2fcf35114ad9b2e00fdfc67793be6df62c8dc4c3
Diffstat (limited to 'services/java/com/android/server/power/DisplayPowerController.java')
-rw-r--r-- | services/java/com/android/server/power/DisplayPowerController.java | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/services/java/com/android/server/power/DisplayPowerController.java b/services/java/com/android/server/power/DisplayPowerController.java index 317fec05d41a..724e1260249d 100644 --- a/services/java/com/android/server/power/DisplayPowerController.java +++ b/services/java/com/android/server/power/DisplayPowerController.java @@ -19,6 +19,7 @@ package com.android.server.power; import com.android.server.LightsService; import com.android.server.TwilightService; import com.android.server.TwilightService.TwilightState; +import com.android.server.display.DisplayManagerService; import android.animation.Animator; import android.animation.ObjectAnimator; @@ -29,7 +30,6 @@ import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.hardware.SystemSensorManager; -import android.hardware.display.DisplayManager; import android.os.Handler; import android.os.Looper; import android.os.Message; @@ -40,7 +40,6 @@ import android.util.FloatMath; import android.util.Slog; import android.util.Spline; import android.util.TimeUtils; -import android.view.Display; import java.io.PrintWriter; @@ -183,7 +182,7 @@ final class DisplayPowerController { private final TwilightService mTwilight; // The display manager. - private final DisplayManager mDisplayManager; + private final DisplayManagerService mDisplayManager; // The sensor manager. private final SensorManager mSensorManager; @@ -346,6 +345,7 @@ final class DisplayPowerController { */ public DisplayPowerController(Looper looper, Context context, Notifier notifier, LightsService lights, TwilightService twilight, + DisplayManagerService displayManager, DisplayBlanker displayBlanker, Callbacks callbacks, Handler callbackHandler) { mHandler = new DisplayControllerHandler(looper); @@ -357,7 +357,7 @@ final class DisplayPowerController { mLights = lights; mTwilight = twilight; mSensorManager = new SystemSensorManager(mHandler.getLooper()); - mDisplayManager = (DisplayManager)context.getSystemService(Context.DISPLAY_SERVICE); + mDisplayManager = displayManager; final Resources resources = context.getResources(); @@ -518,9 +518,8 @@ final class DisplayPowerController { } private void initialize() { - Display display = mDisplayManager.getDisplay(Display.DEFAULT_DISPLAY); mPowerState = new DisplayPowerState( - new ElectronBeam(display), mDisplayBlanker, + new ElectronBeam(mDisplayManager), mDisplayBlanker, mLights.getLight(LightsService.LIGHT_ID_BACKLIGHT)); mElectronBeamOnAnimator = ObjectAnimator.ofFloat( |