diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewThumbnail.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewThumbnail.java index 4ac0f9eed5197..02b01136f3528 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewThumbnail.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewThumbnail.java @@ -77,10 +77,11 @@ public class TaskViewThumbnail extends View { @ViewDebug.ExportedProperty(category="recents") private float mDimAlpha; private Matrix mMatrix = new Matrix(); - protected Paint mDrawPaint = new Paint(); - private Paint mLockedPaint = new Paint(); + private Paint mDrawPaint = new Paint(); + protected Paint mLockedPaint = new Paint(); protected Paint mBgFillPaint = new Paint(); protected BitmapShader mBitmapShader; + protected boolean mUserLocked = false; private LightingColorFilter mLightingColorFilter = new LightingColorFilter(0xffffffff, 0); // Clip the top of the thumbnail against the opaque header bar that overlaps this view @@ -152,7 +153,7 @@ public class TaskViewThumbnail extends View { int thumbnailHeight = Math.min(viewHeight, (int) (mThumbnailRect.height() * mThumbnailScale)); - if (mTask != null && mTask.isLocked) { + if (mUserLocked) { canvas.drawRoundRect(0, 0, viewWidth, viewHeight, mCornerRadius, mCornerRadius, mLockedPaint); } else if (mBitmapShader != null && thumbnailWidth > 0 && thumbnailHeight > 0) { @@ -343,6 +344,17 @@ public class TaskViewThumbnail extends View { updateThumbnailPaintFilter(); } + /** + * Returns the {@link Paint} used to draw a task screenshot, or {@link #mLockedPaint} if the + * thumbnail shouldn't be drawn because it belongs to a locked user. + */ + protected Paint getDrawPaint() { + if (mUserLocked) { + return mLockedPaint; + } + return mDrawPaint; + } + /** * Binds the thumbnail view to the task. */ @@ -354,7 +366,10 @@ public class TaskViewThumbnail extends View { if (t.colorBackground != 0) { mBgFillPaint.setColor(t.colorBackground); } - mLockedPaint.setColor(t.colorPrimary); + if (t.colorPrimary != 0) { + mLockedPaint.setColor(t.colorPrimary); + } + mUserLocked = t.isLocked; EventBus.getDefault().register(this); } diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/grid/GridTaskViewThumbnail.java b/packages/SystemUI/src/com/android/systemui/recents/views/grid/GridTaskViewThumbnail.java index 2c3e42b6c7d78..bcf4f17d43406 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/grid/GridTaskViewThumbnail.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/grid/GridTaskViewThumbnail.java @@ -28,7 +28,6 @@ public class GridTaskViewThumbnail extends TaskViewThumbnail { private Path mThumbnailOutline; private Path mRestBackgroundOutline; - private Path mFullBackgroundOutline; // True if either this view's size or thumbnail scale has changed and mThumbnailOutline should // be updated. private boolean mUpdateThumbnailOutline = true; @@ -145,10 +144,7 @@ public class GridTaskViewThumbnail extends TaskViewThumbnail { 90, 90, false); // F mRestBackgroundOutline.lineTo(l, t); // A mRestBackgroundOutline.close(); - } - } else { - mFullBackgroundOutline = mThumbnailOutline; } } @@ -167,7 +163,10 @@ public class GridTaskViewThumbnail extends TaskViewThumbnail { updateThumbnailOutline(); mUpdateThumbnailOutline = false; } - if (mBitmapShader != null && thumbnailWidth > 0 && thumbnailHeight > 0) { + + if (mUserLocked) { + canvas.drawPath(mThumbnailOutline, mLockedPaint); + } else if (mBitmapShader != null && thumbnailWidth > 0 && thumbnailHeight > 0) { // Draw the background, there will be some small overdraw with the thumbnail if (thumbnailWidth < viewWidth) { // Portrait thumbnail on a landscape task view @@ -177,9 +176,9 @@ public class GridTaskViewThumbnail extends TaskViewThumbnail { // Landscape thumbnail on a portrait task view canvas.drawPath(mRestBackgroundOutline, mBgFillPaint); } - canvas.drawPath(mThumbnailOutline, mDrawPaint); + canvas.drawPath(mThumbnailOutline, getDrawPaint()); } else { - canvas.drawPath(mFullBackgroundOutline, mBgFillPaint); + canvas.drawPath(mThumbnailOutline, mBgFillPaint); } } }