Resume RT-animations after a pauseSurface

Bug: 18203577

The issue occurs as a result of performTraversals() both doing
a window relayout call *and* early-returning because it's not dirty.

To fix this pauseSurface() returns whether or not the RT-side is
"dirty" to force ViewRootImpl to do a draw even if mDirty is
otherwise empty.

Change-Id: I534f367e75d18d273ebf14df3927f5c464ef6bef
This commit is contained in:
John Reck
2014-12-03 13:01:07 -08:00
parent 8d72046b9b
commit 01a5ea35fb
10 changed files with 25 additions and 20 deletions

View File

@@ -235,7 +235,7 @@ public abstract class HardwareRenderer {
* or not the surface used by the HardwareRenderer will be changing. It
* Suspends any rendering into the surface, but will not do any destruction
*/
abstract void pauseSurface(Surface surface);
abstract boolean pauseSurface(Surface surface);
/**
* Destroys all hardware rendering resources associated with the specified

View File

@@ -155,8 +155,8 @@ public class ThreadedRenderer extends HardwareRenderer {
}
@Override
void pauseSurface(Surface surface) {
nPauseSurface(mNativeProxy, surface);
boolean pauseSurface(Surface surface) {
return nPauseSurface(mNativeProxy, surface);
}
@Override
@@ -494,7 +494,7 @@ public class ThreadedRenderer extends HardwareRenderer {
private static native boolean nInitialize(long nativeProxy, Surface window);
private static native void nUpdateSurface(long nativeProxy, Surface window);
private static native void nPauseSurface(long nativeProxy, Surface window);
private static native boolean nPauseSurface(long nativeProxy, Surface window);
private static native void nSetup(long nativeProxy, int width, int height,
float lightX, float lightY, float lightZ, float lightRadius,
int ambientShadowAlpha, int spotShadowAlpha);

View File

@@ -1493,7 +1493,11 @@ public final class ViewRootImpl implements ViewParent,
// relayoutWindow may decide to destroy mSurface. As that decision
// happens in WindowManager service, we need to be defensive here
// and stop using the surface in case it gets destroyed.
mAttachInfo.mHardwareRenderer.pauseSurface(mSurface);
if (mAttachInfo.mHardwareRenderer.pauseSurface(mSurface)) {
// Animations were running so we need to push a frame
// to resume them
mDirty.set(0, 0, mWidth, mHeight);
}
}
final int surfaceGenerationId = mSurface.getGenerationId();
relayoutResult = relayoutWindow(params, viewVisibility, insetsPending);