Loading services/core/java/com/android/server/display/ColorFade.java +29 −8 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -169,6 +170,7 @@ final class ColorFade { } // Done. mCreatedResources = true; mPrepared = true; // Dejanking optimization. Loading Loading @@ -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(); Loading @@ -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; } } Loading services/core/java/com/android/server/display/DisplayPowerController.java +2 −0 Original line number Diff line number Diff line Loading @@ -837,6 +837,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) { Loading Loading @@ -910,6 +911,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 ? Loading services/core/java/com/android/server/display/DisplayPowerState.java +8 −1 Original line number Diff line number Diff line Loading @@ -187,7 +187,7 @@ final class DisplayPowerState { } /** * Dismisses the electron beam surface. * Dismisses the color fade surface. */ public void dismissColorFade() { mColorFade.dismiss(); Loading @@ -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. * Loading Loading
services/core/java/com/android/server/display/ColorFade.java +29 −8 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -169,6 +170,7 @@ final class ColorFade { } // Done. mCreatedResources = true; mPrepared = true; // Dejanking optimization. Loading Loading @@ -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(); Loading @@ -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; } } Loading
services/core/java/com/android/server/display/DisplayPowerController.java +2 −0 Original line number Diff line number Diff line Loading @@ -837,6 +837,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) { Loading Loading @@ -910,6 +911,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 ? Loading
services/core/java/com/android/server/display/DisplayPowerState.java +8 −1 Original line number Diff line number Diff line Loading @@ -187,7 +187,7 @@ final class DisplayPowerState { } /** * Dismisses the electron beam surface. * Dismisses the color fade surface. */ public void dismissColorFade() { mColorFade.dismiss(); Loading @@ -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. * Loading