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

Commit c435c3e2 authored by Uwais Ashraf's avatar Uwais Ashraf
Browse files

Clear Bitmap density to render correctly in Overview

Fix: 419196782
Flag: com.android.launcher3.enable_refactor_task_thumbnail
Test: Manual - steps in bug
Test: Manual - Media projection (other usage of the screenshots)
Test: Manual reverify of b/421205443
Change-Id: I6ba77aa7d24f85ab9890d2c900f283369c247a1f
parent b5c3c931
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ android_library {
        "androidx.lifecycle_lifecycle-runtime-ktx",
        "androidx.lifecycle_lifecycle-viewmodel-ktx",
        "androidx.recyclerview_recyclerview",
        "com_android_launcher3_flags_lib",
        "kotlinx_coroutines_android",
        "kotlinx_coroutines",
        "dagger2",
+16 −9
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.graphics.Rect
import android.util.Log
import android.view.WindowInsetsController.Appearance
import android.window.TaskSnapshot
import com.android.launcher3.Flags.enableRefactorTaskThumbnail

/** Data for a single thumbnail. */
data class ThumbnailData(
@@ -63,6 +64,11 @@ data class ThumbnailData(
                    ex,
                )
            }
            if (enableRefactorTaskThumbnail()) {
                // These bitmaps are used with custom rendering logic (PreviewPositionHelper) that
                // doesn't account for bitmap density
                thumbnail?.density = Bitmap.DENSITY_NONE
            } else {
                if (snapshot.densityDpi > 0 && thumbnail?.density != snapshot.densityDpi) {
                    Log.d(
                        TAG,
@@ -73,6 +79,7 @@ data class ThumbnailData(
                    )
                    thumbnail?.density = snapshot.densityDpi
                }
            }
            return thumbnail
                ?: Bitmap.createBitmap(snapshot.taskSize.x, snapshot.taskSize.y, ARGB_8888).apply {
                    eraseColor(Color.BLACK)