summaryrefslogtreecommitdiffstats
path: root/libs/androidfw
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2015-05-06 10:41:43 -0700
committerAlan Viverette <alanv@google.com>2015-05-06 10:41:43 -0700
commite54d245b993e1347cb32c23a6bdc907a45fab324 (patch)
treebe087de6d12733ca9800724ac77103a0b2173964 /libs/androidfw
parent424681e43e454bfcbceb863ddccb875ea57ec26f (diff)
downloadframeworks_base-e54d245b993e1347cb32c23a6bdc907a45fab324.zip
frameworks_base-e54d245b993e1347cb32c23a6bdc907a45fab324.tar.gz
frameworks_base-e54d245b993e1347cb32c23a6bdc907a45fab324.tar.bz2
Improve keying for theme caches, rebase system theme on config change
Themes now use an array of applied styles rather than a String to store their history. They are keyed based on a hash code computed from the history of applied styles. The themed drawable cache has been abstracted out into its own class. Also updates system context to use DayNight as the default and ensures that GlobalActions uses the correct context, which exercises the change. CTS tests have been added in another CL. Bug: 20421157 Change-Id: I9eb4b7dffd198ad24d02f656eaf0839570b59caa
Diffstat (limited to 'libs/androidfw')
-rw-r--r--libs/androidfw/ResourceTypes.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp
index 19a5beb..2ae7b08 100644
--- a/libs/androidfw/ResourceTypes.cpp
+++ b/libs/androidfw/ResourceTypes.cpp
@@ -3336,6 +3336,30 @@ status_t ResTable::Theme::setTo(const Theme& other)
return NO_ERROR;
}
+status_t ResTable::Theme::clear()
+{
+ if (kDebugTableTheme) {
+ ALOGI("Clearing theme %p...\n", this);
+ dumpToLog();
+ }
+
+ for (size_t i = 0; i < Res_MAXPACKAGE; i++) {
+ if (mPackages[i] != NULL) {
+ free_package(mPackages[i]);
+ mPackages[i] = NULL;
+ }
+ }
+
+ mTypeSpecFlags = 0;
+
+ if (kDebugTableTheme) {
+ ALOGI("Final theme:");
+ dumpToLog();
+ }
+
+ return NO_ERROR;
+}
+
ssize_t ResTable::Theme::getAttribute(uint32_t resID, Res_value* outValue,
uint32_t* outTypeSpecFlags) const
{