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

Commit 1cc95075 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
parent b6522408
Loading
Loading
Loading
Loading
+12 −1
Original line number Original line Diff line number Diff line
@@ -196,7 +196,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
    int mStackId;
    int mStackId;


    private boolean mWindowResizeCallbacksAdded = false;
    private boolean mWindowResizeCallbacksAdded = false;

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

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


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

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