Merge "Copy drawable so that mutations don't affect other uses of the drawable" into main

This commit is contained in:
Treehugger Robot authored and Android (Google) Code Review committed 2025-02-20 10:28:17 -08:00
commit e8a1719649
1 file changed
+2 -1
@@ -78,7 +78,8 @@ class IconView : View, TaskViewIcon {
override fun setDrawable(d: Drawable?) {
drawable?.callback = null
drawable = d
// Copy drawable so that mutations below do not affect other users of the drawable
drawable = d?.constantState?.newDrawable()?.mutate()
drawable?.let {
it.callback = this
setDrawableSizeInternal(width, height)