From 60d5315e19fdd422fbff97ee33c0acf79c9f627c Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Wed, 17 Nov 2021 19:03:04 +0000 Subject: [PATCH] Refresh overlay when thumbnail was set for first time Bug: 202414125 Test: TaplTestsNexus.testOverviewActions && TaplTestsQuickstep.testOverviewActions Change-Id: I2cc38df4c891fb21a8295d4f9c75e396c71449f2 --- .../com/android/quickstep/TaskOverlayFactory.java | 7 ------- .../quickstep/views/TaskThumbnailView.java | 15 ++++++++++++--- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java index c45159e48e..02468497bb 100644 --- a/quickstep/src/com/android/quickstep/TaskOverlayFactory.java +++ b/quickstep/src/com/android/quickstep/TaskOverlayFactory.java @@ -208,13 +208,6 @@ public class TaskOverlayFactory implements ResourceBasedOverride { } } - /** - * Called when the current task's thumbnail has changed. - */ - public void refreshActionVisibility(ThumbnailData thumbnail) { - getActionsView().updateDisabledFlags(DISABLED_NO_THUMBNAIL, thumbnail == null); - } - /** * End rendering live tile in Overview. * diff --git a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java index f8368aed6c..d91669ad96 100644 --- a/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java +++ b/quickstep/src/com/android/quickstep/views/TaskThumbnailView.java @@ -148,10 +148,11 @@ public class TaskThumbnailView extends View { public void setThumbnail(@Nullable Task task, @Nullable ThumbnailData thumbnailData, boolean refreshNow) { mTask = task; + boolean thumbnailWasNull = mThumbnailData == null; mThumbnailData = (thumbnailData != null && thumbnailData.thumbnail != null) ? thumbnailData : null; if (refreshNow) { - refresh(); + refresh(thumbnailWasNull && mThumbnailData != null); } } @@ -162,14 +163,22 @@ public class TaskThumbnailView extends View { /** Updates the shader, paint, matrix to redraw. */ public void refresh() { + refresh(false); + } + + /** + * Updates the shader, paint, matrix to redraw. + * @param shouldRefreshOverlay whether to re-initialize overlay + */ + private void refresh(boolean shouldRefreshOverlay) { if (mThumbnailData != null && mThumbnailData.thumbnail != null) { Bitmap bm = mThumbnailData.thumbnail; bm.prepareToDraw(); mBitmapShader = new BitmapShader(bm, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); mPaint.setShader(mBitmapShader); updateThumbnailMatrix(); - if (mOverlayEnabled) { - getTaskOverlay().refreshActionVisibility(mThumbnailData); + if (shouldRefreshOverlay) { + refreshOverlay(); } } else { mBitmapShader = null;