summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authord34d <clark@cyngn.com>2015-02-15 16:45:53 -0800
committerClark Scheff <clark@cyngn.com>2015-10-27 10:40:12 -0700
commita0109b463a29072a1afcee1780deb884e811b8c3 (patch)
treece8712679cf6322dc1bf5be07c22dc88536104ec /core/java/android
parent1efc14c608e0522640f4ccfd424628fd038721c0 (diff)
downloadframeworks_base-a0109b463a29072a1afcee1780deb884e811b8c3.zip
frameworks_base-a0109b463a29072a1afcee1780deb884e811b8c3.tar.gz
frameworks_base-a0109b463a29072a1afcee1780deb884e811b8c3.tar.bz2
Themes: Include ThemeConfig for ResourceKey hash
This patch will help guarantee we retrieve the correct resources including any themed assets that need to be attached. This fixes a bug with SystemUI no longer accepting theme changes because it was returning a cached version of the Resources object from mActiveResources. Change-Id: Icabc2edc6a8a839e459076374db55296e5b21a13
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/ResourcesManager.java12
-rw-r--r--core/java/android/content/res/ResourcesKey.java3
-rw-r--r--core/java/android/content/res/ThemeConfig.java8
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);
}