Reset interrupted state on InterruptedException (#8120)

This resets the interrupted state for the thread, because it is checked in the calling method.

If you catch a InterruptedException and do not call Thread.currentThread().interrupt(), the interrupt state of the thread is not set anymore and the calling method has no information about it. Without the correction the if (!Thread.currentThread().isInterrupted()) will always be true. Neither Thread.currentThread().interrupt() is called nor the exception is rethrown which can result in unexpected behavior.
This commit is contained in:
schwarzspecht
2025-11-30 15:31:05 +01:00
committed by GitHub
parent 0e1a5da0de
commit 9b78c586df

View File

@ -88,11 +88,13 @@ public class PlaybackServiceNotificationBuilder {
.submit(iconSize, iconSize)
.get();
} catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
Log.e(TAG, "Media icon loader was interrupted");
} catch (Throwable tr) {
Log.e(TAG, "Error loading the media icon for the notification", tr);
}
} catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
Log.e(TAG, "Media icon loader was interrupted");
} catch (Throwable tr) {
Log.e(TAG, "Error loading the media icon for the notification", tr);