diff options
-rw-r--r-- | core/java/android/app/ResourcesManager.java | 12 | ||||
-rw-r--r-- | core/java/android/content/res/ResourcesKey.java | 3 | ||||
-rw-r--r-- | core/java/android/content/res/ThemeConfig.java | 8 |
3 files changed, 21 insertions, 2 deletions
diff --git a/core/java/android/app/ResourcesManager.java b/core/java/android/app/ResourcesManager.java index a9984b3..a12434c 100644 --- a/core/java/android/app/ResourcesManager.java +++ b/core/java/android/app/ResourcesManager.java @@ -184,7 +184,9 @@ public class ResourcesManager { final boolean isThemeable = compatInfo.isThemeable; Configuration overrideConfigCopy = (overrideConfiguration != null) ? new Configuration(overrideConfiguration) : null; - ResourcesKey key = new ResourcesKey(resDir, displayId, overrideConfigCopy, scale, isThemeable); + final ThemeConfig themeConfig = getThemeConfig(); + ResourcesKey key = new ResourcesKey(resDir, displayId, overrideConfiguration, scale, + isThemeable, themeConfig); Resources r; synchronized (this) { // Resources is app scale dependent. @@ -735,4 +737,12 @@ public class ResourcesManager { assets.getThemeCookies().clear(); assets.setThemePackageName(null); } + + private ThemeConfig getThemeConfig() { + Configuration config = getConfiguration(); + if (config != null) { + return config.themeConfig; + } + return null; + } } diff --git a/core/java/android/content/res/ResourcesKey.java b/core/java/android/content/res/ResourcesKey.java index f2ed758..466d810 100644 --- a/core/java/android/content/res/ResourcesKey.java +++ b/core/java/android/content/res/ResourcesKey.java @@ -32,7 +32,7 @@ public final class ResourcesKey { public final Configuration mOverrideConfiguration; public ResourcesKey(String resDir, int displayId, Configuration overrideConfiguration, - float scale, boolean isThemeable) { + float scale, boolean isThemeable, ThemeConfig themeConfig) { mResDir = resDir; mDisplayId = displayId; mOverrideConfiguration = overrideConfiguration != null @@ -46,6 +46,7 @@ public final class ResourcesKey { hash = 31 * hash + mOverrideConfiguration.hashCode(); hash = 31 * hash + Float.floatToIntBits(mScale); hash = 31 * hash + (mIsThemeable ? 1 : 0); + hash = 31 * hash + (themeConfig != null ? themeConfig.hashCode() : 0); mHash = hash; } diff --git a/core/java/android/content/res/ThemeConfig.java b/core/java/android/content/res/ThemeConfig.java index a10151d..b1a6d90 100644 --- a/core/java/android/content/res/ThemeConfig.java +++ b/core/java/android/content/res/ThemeConfig.java @@ -146,6 +146,14 @@ public class ThemeConfig implements Cloneable, Parcelable, Comparable<ThemeConfi return result.toString(); } + @Override + public int hashCode() { + int hash = 17; + hash = 31 * hash + mThemes.hashCode(); + hash = 31 * hash + (int) mThemeChangeTimestamp; + return hash; + } + public String toJson() { return JsonSerializer.toJson(this); } |