Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 60d5315e authored by Alex Chau's avatar Alex Chau
Browse files

Refresh overlay when thumbnail was set for first time

Bug: 202414125
Test: TaplTestsNexus.testOverviewActions && TaplTestsQuickstep.testOverviewActions
Change-Id: I2cc38df4c891fb21a8295d4f9c75e396c71449f2
parent 90a9982b
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -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.
         *
+12 −3
Original line number Diff line number Diff line
@@ -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;