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

Commit 27ef44c4 authored by Romain Guy's avatar Romain Guy Committed by Android (Google) Code Review
Browse files

Merge "Invalidate display lists immediately when views are removed/added quickly" into jb-dev

parents 14326fd4 2a0f228a
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -11096,22 +11096,30 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
        if ((mPrivateFlags & REQUEST_TRANSPARENT_REGIONS) != 0) {
            mParent.requestTransparentRegion(this);
        }
        if ((mPrivateFlags & AWAKEN_SCROLL_BARS_ON_ATTACH) != 0) {
            initialAwakenScrollBars();
            mPrivateFlags &= ~AWAKEN_SCROLL_BARS_ON_ATTACH;
        }
        jumpDrawablesToCurrentState();
        // Order is important here: LayoutDirection MUST be resolved before Padding
        // and TextDirection
        resolveLayoutDirection();
        resolvePadding();
        resolveTextDirection();
        resolveTextAlignment();
        clearAccessibilityFocus();
        if (isFocused()) {
            InputMethodManager imm = InputMethodManager.peekInstance();
            imm.focusIn(this);
        }
        if (mAttachInfo != null && mDisplayList != null) {
            mAttachInfo.mViewRootImpl.dequeueDisplayList(mDisplayList);
        }
    }
    /**
@@ -11332,7 +11340,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
        if (mAttachInfo != null) {
            if (mDisplayList != null) {
                mAttachInfo.mViewRootImpl.invalidateDisplayList(mDisplayList);
                mAttachInfo.mViewRootImpl.enqueueDisplayList(mDisplayList);
            }
            mAttachInfo.mViewRootImpl.cancelInvalidate(this);
        } else {
@@ -12026,7 +12034,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
            boolean caching = false;
            final HardwareCanvas canvas = displayList.start();
            int restoreCount = 0;
            int width = mRight - mLeft;
            int height = mBottom - mTop;
@@ -12659,10 +12666,6 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
        return more;
    }
    void setDisplayListProperties() {
        setDisplayListProperties(mDisplayList);
    }
    /**
     * This method is called by getDisplayList() when a display list is created or re-rendered.
     * It sets or resets the current value of all properties on that display list (resetting is
+11 −2
Original line number Diff line number Diff line
@@ -4412,7 +4412,7 @@ public final class ViewRootImpl implements ViewParent,
        mInvalidateOnAnimationRunnable.addViewRect(info);
    }

    public void invalidateDisplayList(DisplayList displayList) {
    public void enqueueDisplayList(DisplayList displayList) {
        mDisplayLists.add(displayList);

        mHandler.removeMessages(MSG_INVALIDATE_DISPLAY_LIST);
@@ -4420,6 +4420,15 @@ public final class ViewRootImpl implements ViewParent,
        mHandler.sendMessage(msg);
    }

    public void dequeueDisplayList(DisplayList displayList) {
        if (mDisplayLists.remove(displayList)) {
            displayList.invalidate();
            if (mDisplayLists.size() == 0) {
                mHandler.removeMessages(MSG_INVALIDATE_DISPLAY_LIST);
            }
        }
    }

    public void cancelInvalidate(View view) {
        mHandler.removeMessages(MSG_INVALIDATE, view);
        // fixme: might leak the AttachInfo.InvalidateInfo objects instead of returning