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

Commit 4ed3f1dd authored by Jorim Jaggi's avatar Jorim Jaggi Committed by android-build-merger
Browse files

Merge "Fixes for resize thread" into nyc-dev

am: 13219992

* commit '13219992':
  Fixes for resize thread

Change-Id: I2efa14b883a2d9ad31b6e2c4fd72a2b2258adf69
parents ae59a1e0 13219992
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -2716,11 +2716,11 @@ public final class ViewRootImpl implements ViewParent,
                    mAttachInfo.mHardwareRenderer.setStopped(false);
                }

                mAttachInfo.mHardwareRenderer.draw(mView, mAttachInfo, this);

                if (updated) {
                    requestDrawWindow();
                }

                mAttachInfo.mHardwareRenderer.draw(mView, mAttachInfo, this);
            } else {
                // If we get here with a disabled & requested hardware renderer, something went
                // wrong (an invalidate posted right before we destroyed the hardware surface
+26 −26
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package com.android.internal.policy;

import static android.view.WindowCallbacks.RESIZE_MODE_FREEFORM;

import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
@@ -102,9 +100,6 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame
        mOldSystemInsets.set(systemInsets);
        mOldStableInsets.set(stableInsets);
        mResizeMode = resizeMode;
        synchronized (this) {
            redrawLocked(initialBounds, fullscreen, mSystemInsets, mStableInsets);
        }

        // Kick off our draw thread.
        start();
@@ -160,7 +155,7 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame
            mSystemInsets.set(systemInsets);
            mStableInsets.set(stableInsets);
            // Notify of a bounds change.
            pingRenderLocked();
            pingRenderLocked(false /* drawImmediate */);
        }
    }

@@ -172,7 +167,7 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame
            if (mRenderer != null) {
                // Enforce a window redraw.
                mOldTargetRect.set(0, 0, 0, 0);
                pingRenderLocked();
                pingRenderLocked(false /* drawImmediate */);
            }
        }
    }
@@ -197,7 +192,7 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame
                mRenderer = null;

                // Exit the renderer loop.
                pingRenderLocked();
                pingRenderLocked(false /* drawImmediate */);
            }
        }
    }
@@ -208,9 +203,6 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame
            Looper.prepare();
            synchronized (this) {
                mChoreographer = Choreographer.getInstance();

                // Draw at least once.
                mChoreographer.postFrameCallback(this);
            }
            Looper.loop();
        } finally {
@@ -236,6 +228,11 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame
                Looper.myLooper().quit();
                return;
            }
            doFrameUncheckedLocked();
        }
    }

    private void doFrameUncheckedLocked() {
        mNewTargetRect.set(mTargetRect);
        if (!mNewTargetRect.equals(mOldTargetRect)
                || mOldFullscreen != mFullscreen
@@ -249,7 +246,6 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame
            redrawLocked(mNewTargetRect, mFullscreen, mSystemInsets, mStableInsets);
        }
    }
    }

    /**
     * The content is about to be drawn and we got the location of where it will be shown.
@@ -288,7 +284,7 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame
        synchronized (this) {
            mReportNextDraw = reportNextDraw;
            mOldTargetRect.set(0, 0, 0, 0);
            pingRenderLocked();
            pingRenderLocked(true /* drawImmediate */);
        }
    }

@@ -403,10 +399,14 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame
     * Sends a message to the renderer to wake up and perform the next action which can be
     * either the next rendering or the self destruction if mRenderer is null.
     * Note: This call must be synchronized.
     *
     * @param drawImmediate if we should draw immediately instead of scheduling a frame
     */
    private void pingRenderLocked() {
        if (mChoreographer != null) {
    private void pingRenderLocked(boolean drawImmediate) {
        if (mChoreographer != null && !drawImmediate) {
            mChoreographer.postFrameCallback(this);
        } else {
            doFrameUncheckedLocked();
        }
    }