Merge "Draw legacy nav bar background directly" into qt-dev

am: 324cdd4ae0

Change-Id: I3291e2788df951510c5abf3a23df226d5174a5c5
This commit is contained in:
Jorim Jaggi
2019-06-12 11:22:27 -07:00
committed by android-build-merger

View File

@@ -262,8 +262,10 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
private final int mResizeShadowSize;
private final Paint mVerticalResizeShadowPaint = new Paint();
private final Paint mHorizontalResizeShadowPaint = new Paint();
private final Paint mLegacyNavigationBarBackgroundPaint = new Paint();
private Insets mBackgroundInsets = Insets.NONE;
private Insets mLastBackgroundInsets = Insets.NONE;
private boolean mDrawLegacyNavigationBarBackground;
DecorView(Context context, int featureId, PhoneWindow window,
WindowManager.LayoutParams params) {
@@ -292,6 +294,8 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
mResizeShadowSize = context.getResources().getDimensionPixelSize(
R.dimen.resize_shadow_size);
initResizingPaints();
mLegacyNavigationBarBackgroundPaint.setColor(Color.BLACK);
}
void setBackgroundFallback(@Nullable Drawable fallbackDrawable) {
@@ -1143,6 +1147,8 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
navBarToRightEdge || navBarToLeftEdge, navBarToLeftEdge,
0 /* sideInset */, animate && !disallowAnimate,
mForceWindowDrawsBarBackgrounds);
mDrawLegacyNavigationBarBackground = mNavigationColorViewState.visible
&& (mWindow.getAttributes().flags & FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS) == 0;
boolean statusBarNeedsRightInset = navBarToRightEdge
&& mNavigationColorViewState.present;
@@ -2310,6 +2316,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
@Override
public void onPostDraw(RecordingCanvas canvas) {
drawResizingShadowIfNeeded(canvas);
drawLegacyNavigationBarBackground(canvas);
}
private void initResizingPaints() {
@@ -2342,6 +2349,18 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
canvas.restore();
}
private void drawLegacyNavigationBarBackground(RecordingCanvas canvas) {
if (!mDrawLegacyNavigationBarBackground) {
return;
}
View v = mNavigationColorViewState.view;
if (v == null) {
return;
}
canvas.drawRect(v.getLeft(), v.getTop(), v.getRight(), v.getBottom(),
mLegacyNavigationBarBackgroundPaint);
}
/** Release the renderer thread which is usually done when the user stops resizing. */
private void releaseThreadedRenderer() {
if (mResizingBackgroundDrawable != null && mLastBackgroundDrawableCb != null) {