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

Commit d3fd96c2 authored by Chong Zhang's avatar Chong Zhang
Browse files

Use background drawable from the client

And set the drawable's callback to null during drag-resizing, since
we use multi-threaded renderer, will do not want to schedule draws
to the ViewRootImpl's thread.

bug: 26729953
Change-Id: I6e5f94a5a6ba15edc2d391dd11d8fee3c657d337
(cherry picked from commit 1cc95075)
parent 24f62ea6
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -198,7 +198,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
    int mStackId;

    private boolean mWindowResizeCallbacksAdded = false;

    private Drawable.Callback mLastBackgroundDrawableCb = null;
    private BackdropFrameRenderer mBackdropFrameRenderer = null;
    private Drawable mResizingBackgroundDrawable;
    private Drawable mCaptionBackgroundDrawable;
@@ -863,6 +863,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
        if (getBackground() != drawable) {
            setBackgroundDrawable(drawable);
            if (drawable != null) {
                mResizingBackgroundDrawable = drawable;
                drawable.getPadding(mBackgroundPadding);
            } else {
                mBackgroundPadding.setEmpty();
@@ -1913,6 +1914,11 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
        final ThreadedRenderer renderer = getHardwareRenderer();
        if (renderer != null) {
            loadBackgroundDrawablesIfNeeded();
            if (mResizingBackgroundDrawable != null) {
                mLastBackgroundDrawableCb = mResizingBackgroundDrawable.getCallback();
                mResizingBackgroundDrawable.setCallback(null);
            }

            mBackdropFrameRenderer = new BackdropFrameRenderer(this, renderer,
                    initialBounds, mResizingBackgroundDrawable, mCaptionBackgroundDrawable,
                    mUserCaptionBackgroundDrawable, getCurrentColor(mStatusColorViewState),
@@ -1956,6 +1962,11 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind

    /** Release the renderer thread which is usually done when the user stops resizing. */
    private void releaseThreadedRenderer() {
        if (mResizingBackgroundDrawable != null && mLastBackgroundDrawableCb != null) {
            mResizingBackgroundDrawable.setCallback(mLastBackgroundDrawableCb);
            mLastBackgroundDrawableCb = null;
        }

        if (mBackdropFrameRenderer != null) {
            mBackdropFrameRenderer.releaseRenderer();
            mBackdropFrameRenderer = null;