summaryrefslogtreecommitdiffstats
path: root/services/core/java/com/android/server/display
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2015-12-07 18:50:52 -0800
committerSteve Kondik <steve@cyngn.com>2015-12-07 18:50:52 -0800
commit10c07f778a611d8723619f67e5709cbd9e502a07 (patch)
tree2747712ffb2d61348ec7b241d0c2a764397a07a5 /services/core/java/com/android/server/display
parent45c11b1020a64aae88b859870d5b2e312dab4f76 (diff)
parent4d70bd7a928903b35c92619437c70bc382587b71 (diff)
downloadframeworks_base-10c07f778a611d8723619f67e5709cbd9e502a07.zip
frameworks_base-10c07f778a611d8723619f67e5709cbd9e502a07.tar.gz
frameworks_base-10c07f778a611d8723619f67e5709cbd9e502a07.tar.bz2
Merge tag 'android-6.0.1_r3' of https://android.googlesource.com/platform/frameworks/base into cm-13.0
Android 6.0.1 release 3 Change-Id: I59b9e5a943e0860d43bcfb36ee0e8b8b072412ea
Diffstat (limited to 'services/core/java/com/android/server/display')
-rw-r--r--services/core/java/com/android/server/display/ColorFade.java37
-rw-r--r--services/core/java/com/android/server/display/DisplayPowerController.java2
-rw-r--r--services/core/java/com/android/server/display/DisplayPowerState.java9
3 files changed, 39 insertions, 9 deletions
diff --git a/services/core/java/com/android/server/display/ColorFade.java b/services/core/java/com/android/server/display/ColorFade.java
index bb4dbc3..835ba17 100644
--- a/services/core/java/com/android/server/display/ColorFade.java
+++ b/services/core/java/com/android/server/display/ColorFade.java
@@ -74,6 +74,7 @@ final class ColorFade {
// Set to true when the animation context has been fully prepared.
private boolean mPrepared;
+ private boolean mCreatedResources;
private int mMode;
private final DisplayManagerInternal mDisplayManagerInternal;
@@ -169,6 +170,7 @@ final class ColorFade {
}
// Done.
+ mCreatedResources = true;
mPrepared = true;
// Dejanking optimization.
@@ -313,18 +315,17 @@ final class ColorFade {
}
/**
- * Dismisses the color fade animation surface and cleans up.
+ * Dismisses the color fade animation resources.
*
- * To prevent stray photons from leaking out after the color fade has been
- * turned off, it is a good idea to defer dismissing the animation until the
- * color fade has been turned back on fully.
+ * This function destroys the resources that are created for the color fade
+ * animation but does not clean up the surface.
*/
- public void dismiss() {
+ public void dismissResources() {
if (DEBUG) {
- Slog.d(TAG, "dismiss");
+ Slog.d(TAG, "dismissResources");
}
- if (mPrepared) {
+ if (mCreatedResources) {
attachEglContext();
try {
destroyScreenshotTexture();
@@ -334,8 +335,28 @@ final class ColorFade {
} finally {
detachEglContext();
}
- destroySurface();
+ // This is being called with no active context so shouldn't be
+ // needed but is safer to not change for now.
GLES20.glFlush();
+ mCreatedResources = false;
+ }
+ }
+
+ /**
+ * Dismisses the color fade animation surface and cleans up.
+ *
+ * To prevent stray photons from leaking out after the color fade has been
+ * turned off, it is a good idea to defer dismissing the animation until the
+ * color fade has been turned back on fully.
+ */
+ public void dismiss() {
+ if (DEBUG) {
+ Slog.d(TAG, "dismiss");
+ }
+
+ if (mPrepared) {
+ dismissResources();
+ destroySurface();
mPrepared = false;
}
}
diff --git a/services/core/java/com/android/server/display/DisplayPowerController.java b/services/core/java/com/android/server/display/DisplayPowerController.java
index 45065b8..38c4180 100644
--- a/services/core/java/com/android/server/display/DisplayPowerController.java
+++ b/services/core/java/com/android/server/display/DisplayPowerController.java
@@ -859,6 +859,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
if (mPendingScreenOff && target != Display.STATE_OFF) {
setScreenState(Display.STATE_OFF);
mPendingScreenOff = false;
+ mPowerState.dismissColorFadeResources();
}
if (target == Display.STATE_ON) {
@@ -932,6 +933,7 @@ final class DisplayPowerController implements AutomaticBrightnessController.Call
// A black surface is already hiding the contents of the screen.
setScreenState(Display.STATE_OFF);
mPendingScreenOff = false;
+ mPowerState.dismissColorFadeResources();
} else if (performScreenOffTransition
&& mPowerState.prepareColorFade(mContext,
mColorFadeFadesConfig ?
diff --git a/services/core/java/com/android/server/display/DisplayPowerState.java b/services/core/java/com/android/server/display/DisplayPowerState.java
index 2eabd32..9862516 100644
--- a/services/core/java/com/android/server/display/DisplayPowerState.java
+++ b/services/core/java/com/android/server/display/DisplayPowerState.java
@@ -187,7 +187,7 @@ final class DisplayPowerState {
}
/**
- * Dismisses the electron beam surface.
+ * Dismisses the color fade surface.
*/
public void dismissColorFade() {
mColorFade.dismiss();
@@ -195,6 +195,13 @@ final class DisplayPowerState {
mColorFadeReady = true;
}
+ /**
+ * Dismisses the color fade resources.
+ */
+ public void dismissColorFadeResources() {
+ mColorFade.dismissResources();
+ }
+
/**
* Sets the level of the electron beam steering current.
*