Merge "Use background drawable from the client" into nyc-dev

This commit is contained in:
Chong Zhang
2016-02-18 21:32:44 +00:00
committed by Android (Google) Code Review

View File

@@ -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;