From f547f0bc3cc40d8be813f6227ee4d212ac46ead4 Mon Sep 17 00:00:00 2001 From: Chris Drury Date: Wed, 5 Jul 2023 14:03:41 -0400 Subject: [PATCH] BitmapHunter resets Thread's name to original name (#2407) --- picasso/src/main/java/com/squareup/picasso3/BitmapHunter.kt | 4 ++-- .../main/java/com/squareup/picasso3/PicassoExecutorService.kt | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/picasso/src/main/java/com/squareup/picasso3/BitmapHunter.kt b/picasso/src/main/java/com/squareup/picasso3/BitmapHunter.kt index 1129bae513..776ec1ead1 100644 --- a/picasso/src/main/java/com/squareup/picasso3/BitmapHunter.kt +++ b/picasso/src/main/java/com/squareup/picasso3/BitmapHunter.kt @@ -20,7 +20,6 @@ import com.squareup.picasso3.MemoryPolicy.Companion.shouldReadFromMemoryCache import com.squareup.picasso3.Picasso.LoadedFrom import com.squareup.picasso3.RequestHandler.Result.Bitmap import com.squareup.picasso3.Utils.OWNER_HUNTER -import com.squareup.picasso3.Utils.THREAD_IDLE_NAME import com.squareup.picasso3.Utils.THREAD_PREFIX import com.squareup.picasso3.Utils.VERB_DECODED import com.squareup.picasso3.Utils.VERB_EXECUTING @@ -64,6 +63,7 @@ internal open class BitmapHunter( get() = future?.isCancelled ?: false override fun run() { + val originalName = Thread.currentThread().name try { updateThreadName(data) @@ -84,7 +84,7 @@ internal open class BitmapHunter( exception = e dispatcher.dispatchFailed(this) } finally { - Thread.currentThread().name = THREAD_IDLE_NAME + Thread.currentThread().name = originalName } } diff --git a/picasso/src/main/java/com/squareup/picasso3/PicassoExecutorService.kt b/picasso/src/main/java/com/squareup/picasso3/PicassoExecutorService.kt index 75c6561438..ed7a32af09 100644 --- a/picasso/src/main/java/com/squareup/picasso3/PicassoExecutorService.kt +++ b/picasso/src/main/java/com/squareup/picasso3/PicassoExecutorService.kt @@ -49,6 +49,7 @@ class PicassoExecutorService( private class PicassoThread(r: Runnable) : Thread(r) { override fun run() { + name = Utils.THREAD_IDLE_NAME Process.setThreadPriority(THREAD_PRIORITY_BACKGROUND) super.run() }