Loading core/java/android/view/ThreadedRenderer.java +0 −4 Original line number Diff line number Diff line Loading @@ -791,15 +791,11 @@ public final class ThreadedRenderer { * @param callbacks Callbacks invoked when drawing happens. */ void draw(View view, AttachInfo attachInfo, DrawCallbacks callbacks) { attachInfo.mIgnoreDirtyState = true; final Choreographer choreographer = attachInfo.mViewRootImpl.mChoreographer; choreographer.mFrameInfo.markDrawStart(); updateRootDisplayList(view, callbacks); attachInfo.mIgnoreDirtyState = false; // register animating rendernodes which started animating prior to renderer // creation, which is typical for animators started prior to first draw if (attachInfo.mPendingAnimatingRenderNodes != null) { Loading core/java/android/view/View.java +5 −29 Original line number Diff line number Diff line Loading @@ -2297,19 +2297,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, static final int PFLAG_DIRTY = 0x00200000; /** * View flag indicating whether this view was invalidated by an opaque * invalidate request. * Mask for {@link #PFLAG_DIRTY}. * * @hide */ static final int PFLAG_DIRTY_OPAQUE = 0x00400000; /** * Mask for {@link #PFLAG_DIRTY} and {@link #PFLAG_DIRTY_OPAQUE}. * * @hide */ static final int PFLAG_DIRTY_MASK = 0x00600000; static final int PFLAG_DIRTY_MASK = 0x00200000; /** * Indicates whether the background is opaque. Loading Loading @@ -3833,7 +3825,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, name = "DRAWING_CACHE_INVALID", outputIf = false), @ViewDebug.FlagToString(mask = PFLAG_DRAWN, equals = PFLAG_DRAWN, name = "DRAWN", outputIf = true), @ViewDebug.FlagToString(mask = PFLAG_DRAWN, equals = PFLAG_DRAWN, name = "NOT_DRAWN", outputIf = false), @ViewDebug.FlagToString(mask = PFLAG_DIRTY_MASK, equals = PFLAG_DIRTY_OPAQUE, name = "DIRTY_OPAQUE"), @ViewDebug.FlagToString(mask = PFLAG_DIRTY_MASK, equals = PFLAG_DIRTY, name = "DIRTY") }, formatToHexString = true) Loading Loading @@ -20173,8 +20164,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, @CallSuper public void draw(Canvas canvas) { final int privateFlags = mPrivateFlags; final boolean dirtyOpaque = (privateFlags & PFLAG_DIRTY_MASK) == PFLAG_DIRTY_OPAQUE && (mAttachInfo == null || !mAttachInfo.mIgnoreDirtyState); mPrivateFlags = (privateFlags & ~PFLAG_DIRTY_MASK) | PFLAG_DRAWN; /* Loading @@ -20192,9 +20181,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, // Step 1, draw the background, if needed int saveCount; if (!dirtyOpaque) { drawBackground(canvas); } // skip step 2 & 5 if possible (common case) final int viewFlags = mViewFlags; Loading @@ -20202,7 +20189,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, boolean verticalEdges = (viewFlags & FADING_EDGE_VERTICAL) != 0; if (!verticalEdges && !horizontalEdges) { // Step 3, draw the content if (!dirtyOpaque) onDraw(canvas); onDraw(canvas); // Step 4, draw the children dispatchDraw(canvas); Loading Loading @@ -20316,7 +20303,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } // Step 3, draw the content if (!dirtyOpaque) onDraw(canvas); onDraw(canvas); // Step 4, draw the children dispatchDraw(canvas); Loading Loading @@ -26473,17 +26460,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ long mDrawingTime; /** * Indicates whether or not ignoring the DIRTY_MASK flags. */ boolean mIgnoreDirtyState; /** * This flag tracks when the mIgnoreDirtyState flag is set during draw(), * to avoid clearing that flag prematurely. */ boolean mSetIgnoreDirtyState = false; /** * Indicates whether the view's window is currently in touch mode. */ core/java/android/view/ViewGroup.java +1 −8 Original line number Diff line number Diff line Loading @@ -5853,11 +5853,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager // Views being animated or transformed are not considered opaque because we may // be invalidating their old position and need the parent to paint behind them. Matrix childMatrix = child.getMatrix(); final boolean isOpaque = child.isOpaque() && !drawAnimation && child.getAnimation() == null && childMatrix.isIdentity(); // Mark the child as dirty, using the appropriate flag // Make sure we do not set both flags at the same time int opaqueFlag = isOpaque ? PFLAG_DIRTY_OPAQUE : PFLAG_DIRTY; if (child.mLayerType != LAYER_TYPE_NONE) { mPrivateFlags |= PFLAG_INVALIDATED; Loading Loading @@ -5911,12 +5908,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager // If the parent is dirty opaque or not dirty, mark it dirty with the opaque // flag coming from the child that initiated the invalidate if (view != null) { if ((view.mViewFlags & FADING_EDGE_MASK) != 0 && view.getSolidColor() == 0) { opaqueFlag = PFLAG_DIRTY; } if ((view.mPrivateFlags & PFLAG_DIRTY_MASK) != PFLAG_DIRTY) { view.mPrivateFlags = (view.mPrivateFlags & ~PFLAG_DIRTY_MASK) | opaqueFlag; view.mPrivateFlags = (view.mPrivateFlags & ~PFLAG_DIRTY_MASK) | PFLAG_DIRTY; } } Loading core/java/android/view/ViewRootImpl.java +7 −27 Original line number Diff line number Diff line Loading @@ -1283,10 +1283,6 @@ public final class ViewRootImpl implements ViewParent, private void invalidateRectOnScreen(Rect dirty) { final Rect localDirty = mDirty; if (!localDirty.isEmpty() && !localDirty.contains(dirty)) { mAttachInfo.mSetIgnoreDirtyState = true; mAttachInfo.mIgnoreDirtyState = true; } // Add the new dirty rect to the current one localDirty.union(dirty.left, dirty.top, dirty.right, dirty.bottom); Loading Loading @@ -3178,7 +3174,6 @@ public final class ViewRootImpl implements ViewParent, } if (fullRedrawNeeded) { mAttachInfo.mIgnoreDirtyState = true; dirty.set(0, 0, (int) (mWidth * appScale + 0.5f), (int) (mHeight * appScale + 0.5f)); } Loading Loading @@ -3325,13 +3320,6 @@ public final class ViewRootImpl implements ViewParent, canvas = mSurface.lockCanvas(dirty); // The dirty rectangle can be modified by Surface.lockCanvas() //noinspection ConstantConditions if (left != dirty.left || top != dirty.top || right != dirty.right || bottom != dirty.bottom) { attachInfo.mIgnoreDirtyState = true; } // TODO: Do this in native canvas.setDensity(mDensity); } catch (Surface.OutOfResourcesException e) { Loading Loading @@ -3377,23 +3365,15 @@ public final class ViewRootImpl implements ViewParent, ", metrics=" + cxt.getResources().getDisplayMetrics() + ", compatibilityInfo=" + cxt.getResources().getCompatibilityInfo()); } try { canvas.translate(-xoff, -yoff); if (mTranslator != null) { mTranslator.translateCanvas(canvas); } canvas.setScreenDensity(scalingRequired ? mNoncompatDensity : 0); attachInfo.mSetIgnoreDirtyState = false; mView.draw(canvas); drawAccessibilityFocusedDrawableIfNeeded(canvas); } finally { if (!attachInfo.mSetIgnoreDirtyState) { // Only clear the flag if it was not set during the mView.draw() call attachInfo.mIgnoreDirtyState = false; } } } finally { try { surface.unlockCanvasAndPost(canvas); Loading core/tests/coretests/src/android/view/ViewInvalidateTest.java +0 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,6 @@ public class ViewInvalidateTest { public ActivityTestRule<Activity> mActivityRule = new ActivityTestRule<>(Activity.class); private static final int INVAL_TEST_FLAG_MASK = View.PFLAG_DIRTY | View.PFLAG_DIRTY_OPAQUE | View.PFLAG_DRAWN | View.PFLAG_DRAWING_CACHE_VALID | View.PFLAG_INVALIDATED Loading Loading
core/java/android/view/ThreadedRenderer.java +0 −4 Original line number Diff line number Diff line Loading @@ -791,15 +791,11 @@ public final class ThreadedRenderer { * @param callbacks Callbacks invoked when drawing happens. */ void draw(View view, AttachInfo attachInfo, DrawCallbacks callbacks) { attachInfo.mIgnoreDirtyState = true; final Choreographer choreographer = attachInfo.mViewRootImpl.mChoreographer; choreographer.mFrameInfo.markDrawStart(); updateRootDisplayList(view, callbacks); attachInfo.mIgnoreDirtyState = false; // register animating rendernodes which started animating prior to renderer // creation, which is typical for animators started prior to first draw if (attachInfo.mPendingAnimatingRenderNodes != null) { Loading
core/java/android/view/View.java +5 −29 Original line number Diff line number Diff line Loading @@ -2297,19 +2297,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback, static final int PFLAG_DIRTY = 0x00200000; /** * View flag indicating whether this view was invalidated by an opaque * invalidate request. * Mask for {@link #PFLAG_DIRTY}. * * @hide */ static final int PFLAG_DIRTY_OPAQUE = 0x00400000; /** * Mask for {@link #PFLAG_DIRTY} and {@link #PFLAG_DIRTY_OPAQUE}. * * @hide */ static final int PFLAG_DIRTY_MASK = 0x00600000; static final int PFLAG_DIRTY_MASK = 0x00200000; /** * Indicates whether the background is opaque. Loading Loading @@ -3833,7 +3825,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, name = "DRAWING_CACHE_INVALID", outputIf = false), @ViewDebug.FlagToString(mask = PFLAG_DRAWN, equals = PFLAG_DRAWN, name = "DRAWN", outputIf = true), @ViewDebug.FlagToString(mask = PFLAG_DRAWN, equals = PFLAG_DRAWN, name = "NOT_DRAWN", outputIf = false), @ViewDebug.FlagToString(mask = PFLAG_DIRTY_MASK, equals = PFLAG_DIRTY_OPAQUE, name = "DIRTY_OPAQUE"), @ViewDebug.FlagToString(mask = PFLAG_DIRTY_MASK, equals = PFLAG_DIRTY, name = "DIRTY") }, formatToHexString = true) Loading Loading @@ -20173,8 +20164,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, @CallSuper public void draw(Canvas canvas) { final int privateFlags = mPrivateFlags; final boolean dirtyOpaque = (privateFlags & PFLAG_DIRTY_MASK) == PFLAG_DIRTY_OPAQUE && (mAttachInfo == null || !mAttachInfo.mIgnoreDirtyState); mPrivateFlags = (privateFlags & ~PFLAG_DIRTY_MASK) | PFLAG_DRAWN; /* Loading @@ -20192,9 +20181,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, // Step 1, draw the background, if needed int saveCount; if (!dirtyOpaque) { drawBackground(canvas); } // skip step 2 & 5 if possible (common case) final int viewFlags = mViewFlags; Loading @@ -20202,7 +20189,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, boolean verticalEdges = (viewFlags & FADING_EDGE_VERTICAL) != 0; if (!verticalEdges && !horizontalEdges) { // Step 3, draw the content if (!dirtyOpaque) onDraw(canvas); onDraw(canvas); // Step 4, draw the children dispatchDraw(canvas); Loading Loading @@ -20316,7 +20303,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } // Step 3, draw the content if (!dirtyOpaque) onDraw(canvas); onDraw(canvas); // Step 4, draw the children dispatchDraw(canvas); Loading Loading @@ -26473,17 +26460,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ long mDrawingTime; /** * Indicates whether or not ignoring the DIRTY_MASK flags. */ boolean mIgnoreDirtyState; /** * This flag tracks when the mIgnoreDirtyState flag is set during draw(), * to avoid clearing that flag prematurely. */ boolean mSetIgnoreDirtyState = false; /** * Indicates whether the view's window is currently in touch mode. */
core/java/android/view/ViewGroup.java +1 −8 Original line number Diff line number Diff line Loading @@ -5853,11 +5853,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager // Views being animated or transformed are not considered opaque because we may // be invalidating their old position and need the parent to paint behind them. Matrix childMatrix = child.getMatrix(); final boolean isOpaque = child.isOpaque() && !drawAnimation && child.getAnimation() == null && childMatrix.isIdentity(); // Mark the child as dirty, using the appropriate flag // Make sure we do not set both flags at the same time int opaqueFlag = isOpaque ? PFLAG_DIRTY_OPAQUE : PFLAG_DIRTY; if (child.mLayerType != LAYER_TYPE_NONE) { mPrivateFlags |= PFLAG_INVALIDATED; Loading Loading @@ -5911,12 +5908,8 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager // If the parent is dirty opaque or not dirty, mark it dirty with the opaque // flag coming from the child that initiated the invalidate if (view != null) { if ((view.mViewFlags & FADING_EDGE_MASK) != 0 && view.getSolidColor() == 0) { opaqueFlag = PFLAG_DIRTY; } if ((view.mPrivateFlags & PFLAG_DIRTY_MASK) != PFLAG_DIRTY) { view.mPrivateFlags = (view.mPrivateFlags & ~PFLAG_DIRTY_MASK) | opaqueFlag; view.mPrivateFlags = (view.mPrivateFlags & ~PFLAG_DIRTY_MASK) | PFLAG_DIRTY; } } Loading
core/java/android/view/ViewRootImpl.java +7 −27 Original line number Diff line number Diff line Loading @@ -1283,10 +1283,6 @@ public final class ViewRootImpl implements ViewParent, private void invalidateRectOnScreen(Rect dirty) { final Rect localDirty = mDirty; if (!localDirty.isEmpty() && !localDirty.contains(dirty)) { mAttachInfo.mSetIgnoreDirtyState = true; mAttachInfo.mIgnoreDirtyState = true; } // Add the new dirty rect to the current one localDirty.union(dirty.left, dirty.top, dirty.right, dirty.bottom); Loading Loading @@ -3178,7 +3174,6 @@ public final class ViewRootImpl implements ViewParent, } if (fullRedrawNeeded) { mAttachInfo.mIgnoreDirtyState = true; dirty.set(0, 0, (int) (mWidth * appScale + 0.5f), (int) (mHeight * appScale + 0.5f)); } Loading Loading @@ -3325,13 +3320,6 @@ public final class ViewRootImpl implements ViewParent, canvas = mSurface.lockCanvas(dirty); // The dirty rectangle can be modified by Surface.lockCanvas() //noinspection ConstantConditions if (left != dirty.left || top != dirty.top || right != dirty.right || bottom != dirty.bottom) { attachInfo.mIgnoreDirtyState = true; } // TODO: Do this in native canvas.setDensity(mDensity); } catch (Surface.OutOfResourcesException e) { Loading Loading @@ -3377,23 +3365,15 @@ public final class ViewRootImpl implements ViewParent, ", metrics=" + cxt.getResources().getDisplayMetrics() + ", compatibilityInfo=" + cxt.getResources().getCompatibilityInfo()); } try { canvas.translate(-xoff, -yoff); if (mTranslator != null) { mTranslator.translateCanvas(canvas); } canvas.setScreenDensity(scalingRequired ? mNoncompatDensity : 0); attachInfo.mSetIgnoreDirtyState = false; mView.draw(canvas); drawAccessibilityFocusedDrawableIfNeeded(canvas); } finally { if (!attachInfo.mSetIgnoreDirtyState) { // Only clear the flag if it was not set during the mView.draw() call attachInfo.mIgnoreDirtyState = false; } } } finally { try { surface.unlockCanvasAndPost(canvas); Loading
core/tests/coretests/src/android/view/ViewInvalidateTest.java +0 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,6 @@ public class ViewInvalidateTest { public ActivityTestRule<Activity> mActivityRule = new ActivityTestRule<>(Activity.class); private static final int INVAL_TEST_FLAG_MASK = View.PFLAG_DIRTY | View.PFLAG_DIRTY_OPAQUE | View.PFLAG_DRAWN | View.PFLAG_DRAWING_CACHE_VALID | View.PFLAG_INVALIDATED Loading