From d912e1f6a111fb33118d116bd72da1a328041bca Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Fri, 11 Apr 2014 18:46:22 -0700 Subject: Use the display's actual state in the view hierarchy. Previously, the view hierarchy would suppress drawing whenever the PowerManager.isScreenOn() method returned false. However, this method really describes the interactive state of the device rather than the actual display state. This is especially a problem when there are multiple displays but it also breaks drawing while in doze mode. This change makes the view hierarchy consider the actual state of the display instead on an individual basis. Bug: 13133142 Change-Id: I69870b6b14a3504607a30562aa48c3452f777c1f --- core/java/android/view/View.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'core/java/android/view/View.java') diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 80725dc..8d69477 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -16840,8 +16840,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, // If the screen is off assume the animation start time is now instead of // the next frame we draw. Keeping the START_ON_FIRST_FRAME start time // would cause the animation to start when the screen turns back on - if (mAttachInfo != null && !mAttachInfo.mScreenOn && - animation.getStartTime() == Animation.START_ON_FIRST_FRAME) { + if (mAttachInfo != null && mAttachInfo.mDisplayState == Display.STATE_OFF + && animation.getStartTime() == Animation.START_ON_FIRST_FRAME) { animation.setStartTime(AnimationUtils.currentAnimationTimeMillis()); } animation.reset(); @@ -18713,7 +18713,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * A set of information given to a view when it is attached to its parent * window. */ - static class AttachInfo { + final static class AttachInfo { interface Callbacks { void playSoundEffect(int effectId); boolean performHapticFeedback(int effectId, boolean always); @@ -18779,7 +18779,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, boolean mHardwareAccelerationRequested; HardwareRenderer mHardwareRenderer; - boolean mScreenOn; + /** + * The state of the display to which the window is attached, as reported + * by {@link Display#getState()}. Note that the display state constants + * declared by {@link Display} do not exactly line up with the screen state + * constants declared by {@link View} (there are more display states than + * screen states). + */ + int mDisplayState = Display.STATE_UNKNOWN; /** * Scale factor used by the compatibility mode -- cgit v1.1