Merge "Fixes for resize thread" into nyc-dev
This commit is contained in:
@@ -2716,11 +2716,11 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
mAttachInfo.mHardwareRenderer.setStopped(false);
|
mAttachInfo.mHardwareRenderer.setStopped(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
mAttachInfo.mHardwareRenderer.draw(mView, mAttachInfo, this);
|
|
||||||
|
|
||||||
if (updated) {
|
if (updated) {
|
||||||
requestDrawWindow();
|
requestDrawWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mAttachInfo.mHardwareRenderer.draw(mView, mAttachInfo, this);
|
||||||
} else {
|
} else {
|
||||||
// If we get here with a disabled & requested hardware renderer, something went
|
// If we get here with a disabled & requested hardware renderer, something went
|
||||||
// wrong (an invalidate posted right before we destroyed the hardware surface
|
// wrong (an invalidate posted right before we destroyed the hardware surface
|
||||||
|
|||||||
@@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
package com.android.internal.policy;
|
package com.android.internal.policy;
|
||||||
|
|
||||||
import static android.view.WindowCallbacks.RESIZE_MODE_FREEFORM;
|
|
||||||
|
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
@@ -102,9 +100,6 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame
|
|||||||
mOldSystemInsets.set(systemInsets);
|
mOldSystemInsets.set(systemInsets);
|
||||||
mOldStableInsets.set(stableInsets);
|
mOldStableInsets.set(stableInsets);
|
||||||
mResizeMode = resizeMode;
|
mResizeMode = resizeMode;
|
||||||
synchronized (this) {
|
|
||||||
redrawLocked(initialBounds, fullscreen, mSystemInsets, mStableInsets);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Kick off our draw thread.
|
// Kick off our draw thread.
|
||||||
start();
|
start();
|
||||||
@@ -160,7 +155,7 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame
|
|||||||
mSystemInsets.set(systemInsets);
|
mSystemInsets.set(systemInsets);
|
||||||
mStableInsets.set(stableInsets);
|
mStableInsets.set(stableInsets);
|
||||||
// Notify of a bounds change.
|
// Notify of a bounds change.
|
||||||
pingRenderLocked();
|
pingRenderLocked(false /* drawImmediate */);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,7 +167,7 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame
|
|||||||
if (mRenderer != null) {
|
if (mRenderer != null) {
|
||||||
// Enforce a window redraw.
|
// Enforce a window redraw.
|
||||||
mOldTargetRect.set(0, 0, 0, 0);
|
mOldTargetRect.set(0, 0, 0, 0);
|
||||||
pingRenderLocked();
|
pingRenderLocked(false /* drawImmediate */);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -197,7 +192,7 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame
|
|||||||
mRenderer = null;
|
mRenderer = null;
|
||||||
|
|
||||||
// Exit the renderer loop.
|
// Exit the renderer loop.
|
||||||
pingRenderLocked();
|
pingRenderLocked(false /* drawImmediate */);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -208,9 +203,6 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame
|
|||||||
Looper.prepare();
|
Looper.prepare();
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
mChoreographer = Choreographer.getInstance();
|
mChoreographer = Choreographer.getInstance();
|
||||||
|
|
||||||
// Draw at least once.
|
|
||||||
mChoreographer.postFrameCallback(this);
|
|
||||||
}
|
}
|
||||||
Looper.loop();
|
Looper.loop();
|
||||||
} finally {
|
} finally {
|
||||||
@@ -236,6 +228,11 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame
|
|||||||
Looper.myLooper().quit();
|
Looper.myLooper().quit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
doFrameUncheckedLocked();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doFrameUncheckedLocked() {
|
||||||
mNewTargetRect.set(mTargetRect);
|
mNewTargetRect.set(mTargetRect);
|
||||||
if (!mNewTargetRect.equals(mOldTargetRect)
|
if (!mNewTargetRect.equals(mOldTargetRect)
|
||||||
|| mOldFullscreen != mFullscreen
|
|| mOldFullscreen != mFullscreen
|
||||||
@@ -249,7 +246,6 @@ public class BackdropFrameRenderer extends Thread implements Choreographer.Frame
|
|||||||
redrawLocked(mNewTargetRect, mFullscreen, mSystemInsets, mStableInsets);
|
redrawLocked(mNewTargetRect, mFullscreen, mSystemInsets, mStableInsets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The content is about to be drawn and we got the location of where it will be shown.
|
* 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) {
|
synchronized (this) {
|
||||||
mReportNextDraw = reportNextDraw;
|
mReportNextDraw = reportNextDraw;
|
||||||
mOldTargetRect.set(0, 0, 0, 0);
|
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
|
* 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.
|
* either the next rendering or the self destruction if mRenderer is null.
|
||||||
* Note: This call must be synchronized.
|
* Note: This call must be synchronized.
|
||||||
|
*
|
||||||
|
* @param drawImmediate if we should draw immediately instead of scheduling a frame
|
||||||
*/
|
*/
|
||||||
private void pingRenderLocked() {
|
private void pingRenderLocked(boolean drawImmediate) {
|
||||||
if (mChoreographer != null) {
|
if (mChoreographer != null && !drawImmediate) {
|
||||||
mChoreographer.postFrameCallback(this);
|
mChoreographer.postFrameCallback(this);
|
||||||
|
} else {
|
||||||
|
doFrameUncheckedLocked();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user