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

Commit 5a6bbae6 authored by Chris Craik's avatar Chris Craik
Browse files

Deprecate and disable legacy caching APIs

bug:20159889

Change-Id: Ib25bb6bceaee27b4d04a64e8ad298db9977b2719
parent a323e3f3
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -35505,10 +35505,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);
@@ -35547,11 +35547,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
@@ -38054,10 +38054,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);
@@ -38096,11 +38096,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
@@ -15021,7 +15021,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;
@@ -15138,23 +15138,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;
@@ -15204,7 +15194,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;
@@ -15233,7 +15222,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
@@ -244,8 +244,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
@@ -291,16 +290,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
@@ -583,8 +577,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;
@@ -3067,44 +3059,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;
@@ -3275,8 +3229,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];
@@ -3284,12 +3236,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);
                        }
                    }
                }
            }

@@ -3303,10 +3249,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());
            }
@@ -3484,13 +3426,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);
    }

@@ -5258,8 +5193,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;
    }
@@ -5274,6 +5211,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);
@@ -5288,8 +5228,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;
    }
@@ -5310,6 +5252,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);
@@ -5323,8 +5268,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;
    }
@@ -5341,6 +5289,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);