Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f518a3ab authored by Chris Craik's avatar Chris Craik Committed by Android (Google) Code Review
Browse files

Merge "Deprecate and disable legacy caching APIs"

parents 98680e96 5a6bbae6
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -35833,10 +35833,10 @@ package android.view {
    method public int indexOfChild(android.view.View);
    method public final void invalidateChild(android.view.View, android.graphics.Rect);
    method public android.view.ViewParent invalidateChildInParent(int[], android.graphics.Rect);
    method public boolean isAlwaysDrawnWithCacheEnabled();
    method public boolean isAnimationCacheEnabled();
    method public deprecated boolean isAlwaysDrawnWithCacheEnabled();
    method public deprecated boolean isAnimationCacheEnabled();
    method protected boolean isChildrenDrawingOrderEnabled();
    method protected boolean isChildrenDrawnWithCacheEnabled();
    method protected deprecated boolean isChildrenDrawnWithCacheEnabled();
    method public boolean isMotionEventSplittingEnabled();
    method public boolean isTransitionGroup();
    method public final void layout(int, int, int, int);
@@ -35875,11 +35875,11 @@ package android.view {
    method public void requestTransparentRegion(android.view.View);
    method public void scheduleLayoutAnimation();
    method public void setAddStatesFromChildren(boolean);
    method public void setAlwaysDrawnWithCacheEnabled(boolean);
    method public void setAnimationCacheEnabled(boolean);
    method public deprecated void setAlwaysDrawnWithCacheEnabled(boolean);
    method public deprecated void setAnimationCacheEnabled(boolean);
    method protected void setChildrenDrawingCacheEnabled(boolean);
    method protected void setChildrenDrawingOrderEnabled(boolean);
    method protected void setChildrenDrawnWithCacheEnabled(boolean);
    method protected deprecated void setChildrenDrawnWithCacheEnabled(boolean);
    method public void setClipChildren(boolean);
    method public void setClipToPadding(boolean);
    method public void setDescendantFocusability(int);
+6 −6
Original line number Diff line number Diff line
@@ -38458,10 +38458,10 @@ package android.view {
    method public int indexOfChild(android.view.View);
    method public final void invalidateChild(android.view.View, android.graphics.Rect);
    method public android.view.ViewParent invalidateChildInParent(int[], android.graphics.Rect);
    method public boolean isAlwaysDrawnWithCacheEnabled();
    method public boolean isAnimationCacheEnabled();
    method public deprecated boolean isAlwaysDrawnWithCacheEnabled();
    method public deprecated boolean isAnimationCacheEnabled();
    method protected boolean isChildrenDrawingOrderEnabled();
    method protected boolean isChildrenDrawnWithCacheEnabled();
    method protected deprecated boolean isChildrenDrawnWithCacheEnabled();
    method public boolean isMotionEventSplittingEnabled();
    method public boolean isTransitionGroup();
    method public final void layout(int, int, int, int);
@@ -38500,11 +38500,11 @@ package android.view {
    method public void requestTransparentRegion(android.view.View);
    method public void scheduleLayoutAnimation();
    method public void setAddStatesFromChildren(boolean);
    method public void setAlwaysDrawnWithCacheEnabled(boolean);
    method public void setAnimationCacheEnabled(boolean);
    method public deprecated void setAlwaysDrawnWithCacheEnabled(boolean);
    method public deprecated void setAnimationCacheEnabled(boolean);
    method protected void setChildrenDrawingCacheEnabled(boolean);
    method protected void setChildrenDrawingOrderEnabled(boolean);
    method protected void setChildrenDrawnWithCacheEnabled(boolean);
    method protected deprecated void setChildrenDrawnWithCacheEnabled(boolean);
    method public void setClipChildren(boolean);
    method public void setClipToPadding(boolean);
    method public void setDescendantFocusability(int);
+28 −40
Original line number Diff line number Diff line
@@ -15087,7 +15087,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * Utility function, called by draw(canvas, parent, drawingTime) to handle the less common
     * case of an active Animation being run on the view.
     */
    private boolean drawAnimation(ViewGroup parent, long drawingTime,
    private boolean applyLegacyAnimation(ViewGroup parent, long drawingTime,
            Animation a, boolean scalingRequired) {
        Transformation invalidationTransform;
        final int flags = parent.mGroupFlags;
@@ -15204,23 +15204,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        Transformation transformToApply = null;
        boolean concatMatrix = false;
        boolean scalingRequired = false;
        boolean caching;
        boolean scalingRequired = mAttachInfo != null && mAttachInfo.mScalingRequired;
        int layerType = getLayerType();
        final boolean hardwareAccelerated = canvas.isHardwareAccelerated();
        if ((flags & ViewGroup.FLAG_CHILDREN_DRAWN_WITH_CACHE) != 0 ||
                (flags & ViewGroup.FLAG_ALWAYS_DRAWN_WITH_CACHE) != 0) {
            caching = true;
            // Auto-scaled apps are not hw-accelerated, no need to set scaling flag on DisplayList
            if (mAttachInfo != null) scalingRequired = mAttachInfo.mScalingRequired;
        } else {
            caching = (layerType != LAYER_TYPE_NONE) || hardwareAccelerated;
        }
        final Animation a = getAnimation();
        if (a != null) {
            more = drawAnimation(parent, drawingTime, a, scalingRequired);
            more = applyLegacyAnimation(parent, drawingTime, a, scalingRequired);
            concatMatrix = a.willChangeTransformationMatrix();
            if (concatMatrix) {
                mPrivateFlags3 |= PFLAG3_VIEW_IS_ANIMATING_TRANSFORM;
@@ -15270,7 +15260,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        RenderNode renderNode = null;
        Bitmap cache = null;
        boolean hasDisplayList = false;
        if (caching) {
        if (!hardwareAccelerated) {
            if (layerType != LAYER_TYPE_NONE) {
                layerType = LAYER_TYPE_SOFTWARE;
@@ -15299,7 +15288,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                    break;
            }
        }
        }
        usingRenderNodeProperties &= hasDisplayList;
        if (usingRenderNodeProperties) {
            renderNode = getDisplayList();
+25 −73
Original line number Diff line number Diff line
@@ -245,8 +245,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
    // to clip it, even if FLAG_CLIP_TO_PADDING is set
    private static final int FLAG_PADDING_NOT_NULL = 0x20;

    // When set, this ViewGroup caches its children in a Bitmap before starting a layout animation
    // Set by default
    /** @deprecated - functionality removed */
    private static final int FLAG_ANIMATION_CACHE = 0x40;

    // When set, this ViewGroup converts calls to invalidate(Rect) to invalidate() during a
@@ -292,16 +291,11 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
     */
    private static final int FLAG_ADD_STATES_FROM_CHILDREN = 0x2000;

    /**
     * When set, this ViewGroup tries to always draw its children using their drawing cache.
     */
    static final int FLAG_ALWAYS_DRAWN_WITH_CACHE = 0x4000;
    /** @deprecated functionality removed */
    private static final int FLAG_ALWAYS_DRAWN_WITH_CACHE = 0x4000;

    /**
     * When set, and if FLAG_ALWAYS_DRAWN_WITH_CACHE is not set, this ViewGroup will try to
     * draw its children with their drawing cache.
     */
    static final int FLAG_CHILDREN_DRAWN_WITH_CACHE = 0x8000;
    /** @deprecated functionality removed */
    private static final int FLAG_CHILDREN_DRAWN_WITH_CACHE = 0x8000;

    /**
     * When set, this group will go through its list of children to notify them of
@@ -584,8 +578,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        mGroupFlags |= FLAG_CLIP_CHILDREN;
        mGroupFlags |= FLAG_CLIP_TO_PADDING;
        mGroupFlags |= FLAG_ANIMATION_DONE;
        mGroupFlags |= FLAG_ANIMATION_CACHE;
        mGroupFlags |= FLAG_ALWAYS_DRAWN_WITH_CACHE;

        if (mContext.getApplicationInfo().targetSdkVersion >= Build.VERSION_CODES.HONEYCOMB) {
            mGroupFlags |= FLAG_SPLIT_MOTION_EVENTS;
@@ -3087,44 +3079,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        }
    }

    @Override
    protected void onAnimationStart() {
        super.onAnimationStart();

        // When this ViewGroup's animation starts, build the cache for the children
        if ((mGroupFlags & FLAG_ANIMATION_CACHE) == FLAG_ANIMATION_CACHE) {
            final int count = mChildrenCount;
            final View[] children = mChildren;
            final boolean buildCache = !isHardwareAccelerated();

            for (int i = 0; i < count; i++) {
                final View child = children[i];
                if ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE) {
                    child.setDrawingCacheEnabled(true);
                    if (buildCache) {
                        child.buildDrawingCache(true);
                    }
                }
            }

            mGroupFlags |= FLAG_CHILDREN_DRAWN_WITH_CACHE;
        }
    }

    @Override
    protected void onAnimationEnd() {
        super.onAnimationEnd();

        // When this ViewGroup's animation ends, destroy the cache of the children
        if ((mGroupFlags & FLAG_ANIMATION_CACHE) == FLAG_ANIMATION_CACHE) {
            mGroupFlags &= ~FLAG_CHILDREN_DRAWN_WITH_CACHE;

            if ((mPersistentDrawingCache & PERSISTENT_ANIMATION_CACHE) == 0) {
                setChildrenDrawingCacheEnabled(false);
            }
        }
    }

    @Override
    Bitmap createSnapshot(Bitmap.Config quality, int backgroundColor, boolean skipChildren) {
        int count = mChildrenCount;
@@ -3295,8 +3249,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        int flags = mGroupFlags;

        if ((flags & FLAG_RUN_ANIMATION) != 0 && canAnimate()) {
            final boolean cache = (mGroupFlags & FLAG_ANIMATION_CACHE) == FLAG_ANIMATION_CACHE;

            final boolean buildCache = !isHardwareAccelerated();
            for (int i = 0; i < childrenCount; i++) {
                final View child = children[i];
@@ -3304,12 +3256,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
                    final LayoutParams params = child.getLayoutParams();
                    attachLayoutAnimationParameters(child, params, i, childrenCount);
                    bindLayoutAnimation(child);
                    if (cache) {
                        child.setDrawingCacheEnabled(true);
                        if (buildCache) {
                            child.buildDrawingCache(true);
                        }
                    }
                }
            }

@@ -3323,10 +3269,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
            mGroupFlags &= ~FLAG_RUN_ANIMATION;
            mGroupFlags &= ~FLAG_ANIMATION_DONE;

            if (cache) {
                mGroupFlags |= FLAG_CHILDREN_DRAWN_WITH_CACHE;
            }

            if (mAnimationListener != null) {
                mAnimationListener.onAnimationStart(controller.getAnimation());
            }
@@ -3504,13 +3446,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
           post(end);
        }

        if ((mGroupFlags & FLAG_ANIMATION_CACHE) == FLAG_ANIMATION_CACHE) {
            mGroupFlags &= ~FLAG_CHILDREN_DRAWN_WITH_CACHE;
            if ((mPersistentDrawingCache & PERSISTENT_ANIMATION_CACHE) == 0) {
                setChildrenDrawingCacheEnabled(false);
            }
        }

        invalidate(true);
    }

@@ -5278,8 +5213,10 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
     *
     * @see #setAnimationCacheEnabled(boolean)
     * @see View#setDrawingCacheEnabled(boolean)
     *
     * @deprecated As of {@link android.os.Build.VERSION_CODES#MNC}, this property is ignored.
     * Caching behavior of children may be controlled through {@link View#setLayerType(int, Paint)}.
     */
    @ViewDebug.ExportedProperty
    public boolean isAnimationCacheEnabled() {
        return (mGroupFlags & FLAG_ANIMATION_CACHE) == FLAG_ANIMATION_CACHE;
    }
@@ -5294,6 +5231,9 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
     *
     * @see #isAnimationCacheEnabled()
     * @see View#setDrawingCacheEnabled(boolean)
     *
     * @deprecated As of {@link android.os.Build.VERSION_CODES#MNC}, this property is ignored.
     * Caching behavior of children may be controlled through {@link View#setLayerType(int, Paint)}.
     */
    public void setAnimationCacheEnabled(boolean enabled) {
        setBooleanFlag(FLAG_ANIMATION_CACHE, enabled);
@@ -5308,8 +5248,10 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
     * @see #setAlwaysDrawnWithCacheEnabled(boolean)
     * @see #setChildrenDrawnWithCacheEnabled(boolean)
     * @see View#setDrawingCacheEnabled(boolean)
     *
     * @deprecated As of {@link android.os.Build.VERSION_CODES#MNC}, this property is ignored.
     * Child views may no longer have their caching behavior disabled by parents.
     */
    @ViewDebug.ExportedProperty(category = "drawing")
    public boolean isAlwaysDrawnWithCacheEnabled() {
        return (mGroupFlags & FLAG_ALWAYS_DRAWN_WITH_CACHE) == FLAG_ALWAYS_DRAWN_WITH_CACHE;
    }
@@ -5330,6 +5272,9 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
     * @see #setChildrenDrawnWithCacheEnabled(boolean)
     * @see View#setDrawingCacheEnabled(boolean)
     * @see View#setDrawingCacheQuality(int)
     *
     * @deprecated As of {@link android.os.Build.VERSION_CODES#MNC}, this property is ignored.
     * Child views may no longer have their caching behavior disabled by parents.
     */
    public void setAlwaysDrawnWithCacheEnabled(boolean always) {
        setBooleanFlag(FLAG_ALWAYS_DRAWN_WITH_CACHE, always);
@@ -5343,8 +5288,11 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
     *
     * @see #setAlwaysDrawnWithCacheEnabled(boolean)
     * @see #setChildrenDrawnWithCacheEnabled(boolean)
     *
     * @deprecated As of {@link android.os.Build.VERSION_CODES#MNC}, this property is ignored.
     * Child views may no longer be forced to cache their rendering state by their parents.
     * Use {@link View#setLayerType(int, Paint)} on individual Views instead.
     */
    @ViewDebug.ExportedProperty(category = "drawing")
    protected boolean isChildrenDrawnWithCacheEnabled() {
        return (mGroupFlags & FLAG_CHILDREN_DRAWN_WITH_CACHE) == FLAG_CHILDREN_DRAWN_WITH_CACHE;
    }
@@ -5361,6 +5309,10 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
     *
     * @see #setAlwaysDrawnWithCacheEnabled(boolean)
     * @see #isChildrenDrawnWithCacheEnabled()
     *
     * @deprecated As of {@link android.os.Build.VERSION_CODES#MNC}, this property is ignored.
     * Child views may no longer be forced to cache their rendering state by their parents.
     * Use {@link View#setLayerType(int, Paint)} on individual Views instead.
     */
    protected void setChildrenDrawnWithCacheEnabled(boolean enabled) {
        setBooleanFlag(FLAG_CHILDREN_DRAWN_WITH_CACHE, enabled);