From 58857c8b2bd64272d2320f62fd860783bb671da8 Mon Sep 17 00:00:00 2001 From: Alan Viverette Date: Sat, 29 Oct 2016 00:47:45 +0100 Subject: [PATCH] Always propagate changingConfigurations to newly-created drawables Bug: 32395972 Test: ResourcesTest#testChangingConfigurations Change-Id: I555f3271854bdb6026db15f855847714c4986af3 --- core/java/android/content/res/ResourcesImpl.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/java/android/content/res/ResourcesImpl.java b/core/java/android/content/res/ResourcesImpl.java index 8233ad2f6f634..c46fe29d07a5b 100644 --- a/core/java/android/content/res/ResourcesImpl.java +++ b/core/java/android/content/res/ResourcesImpl.java @@ -553,6 +553,7 @@ public class ResourcesImpl { if (!mPreloading && useCache) { final Drawable cachedDrawable = caches.getInstance(key, wrapper, theme); if (cachedDrawable != null) { + cachedDrawable.setChangingConfigurations(value.changingConfigurations); return cachedDrawable; } } @@ -588,9 +589,11 @@ public class ResourcesImpl { // If we were able to obtain a drawable, store it in the appropriate // cache: preload, not themed, null theme, or theme-specific. Don't // pollute the cache with drawables loaded from a foreign density. - if (dr != null && useCache) { + if (dr != null) { dr.setChangingConfigurations(value.changingConfigurations); - cacheDrawable(value, isColorDrawable, caches, theme, canApplyTheme, key, dr); + if (useCache) { + cacheDrawable(value, isColorDrawable, caches, theme, canApplyTheme, key, dr); + } } return dr;