summaryrefslogtreecommitdiffstats
path: root/include/androidfw
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2013-07-31 12:14:24 -0700
committerDianne Hackborn <hackbod@google.com>2013-07-31 15:57:49 -0700
commitd45c68dd24fe3dd510af5a9591b5e2f509b56772 (patch)
treef9a3d18ecce9509eddcc2b4c5899e2b7c90765a2 /include/androidfw
parentaf728bd201195799c8e993ece145d607b9ca67df (diff)
downloadframeworks_base-d45c68dd24fe3dd510af5a9591b5e2f509b56772.zip
frameworks_base-d45c68dd24fe3dd510af5a9591b5e2f509b56772.tar.gz
frameworks_base-d45c68dd24fe3dd510af5a9591b5e2f509b56772.tar.bz2
Resource memory optimization.
Don't ever need the cached UTF-16 string conversions on the device. Don't need to create those strings, and don't need to create the lookup array for them at all. This requires fixing all of the remaining places in the platform where we interacted with the resources with the blind assumption that the strings are UTF-16. Change-Id: Ia0e5a150499837471e494e85b23b05fa06e0cf1d
Diffstat (limited to 'include/androidfw')
-rw-r--r--include/androidfw/ResourceTypes.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/include/androidfw/ResourceTypes.h b/include/androidfw/ResourceTypes.h
index a305fc3..97afa59 100644
--- a/include/androidfw/ResourceTypes.h
+++ b/include/androidfw/ResourceTypes.h
@@ -479,7 +479,7 @@ private:
const uint32_t* mEntries;
const uint32_t* mEntryStyles;
const void* mStrings;
- char16_t** mCache;
+ char16_t mutable** mCache;
uint32_t mStringPoolSize; // number of uint16_t
const uint32_t* mStyles;
uint32_t mStylePoolSize; // number of uint32_t
@@ -678,11 +678,15 @@ public:
// Returns -1 if no namespace, -2 if idx out of range.
int32_t getAttributeNamespaceID(size_t idx) const;
const uint16_t* getAttributeNamespace(size_t idx, size_t* outLen) const;
-
+
int32_t getAttributeNameID(size_t idx) const;
const uint16_t* getAttributeName(size_t idx, size_t* outLen) const;
uint32_t getAttributeNameResID(size_t idx) const;
-
+
+ // These will work only if the underlying string pool is UTF-8.
+ const char* getAttributeNamespace8(size_t idx, size_t* outLen) const;
+ const char* getAttributeName8(size_t idx, size_t* outLen) const;
+
int32_t getAttributeValueStringID(size_t idx) const;
const uint16_t* getAttributeStringValue(size_t idx, size_t* outLen) const;
@@ -1294,12 +1298,14 @@ public:
const char16_t* package;
size_t packageLen;
const char16_t* type;
+ const char* type8;
size_t typeLen;
const char16_t* name;
+ const char* name8;
size_t nameLen;
};
- bool getResourceName(uint32_t resID, resource_name* outName) const;
+ bool getResourceName(uint32_t resID, bool allowUtf8, resource_name* outName) const;
/**
* Retrieve the value of a resource. If the resource is found, returns a