summaryrefslogtreecommitdiffstats
path: root/tools/aapt/ResourceTable.h
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2014-09-17 18:34:15 -0700
committerAdam Lesinski <adamlesinski@google.com>2014-09-18 14:05:24 -0700
commit82a2dd8efe48d3a4e04655f01329da857ace4b7d (patch)
tree9c5ec064aeba43cf4b27fd4bb36e31f0bf425f35 /tools/aapt/ResourceTable.h
parent49c0e7375b237bc6eff8746ae91466ea6a660233 (diff)
downloadframeworks_base-82a2dd8efe48d3a4e04655f01329da857ace4b7d.zip
frameworks_base-82a2dd8efe48d3a4e04655f01329da857ace4b7d.tar.gz
frameworks_base-82a2dd8efe48d3a4e04655f01329da857ace4b7d.tar.bz2
Fix backwards compat problem with AAPT public attrs
AAPT has traditionally assigned resource IDs to public attributes, and then followed those public definitions with private attributes. --- PUBLIC --- | 0x01010234 | attr/color | 0x01010235 | attr/background --- PRIVATE --- | 0x01010236 | attr/secret | 0x01010237 | attr/shhh Each release, when attributes are added, they take the place of the private attributes and the private attributes are shifted down again. --- PUBLIC --- | 0x01010234 | attr/color | 0x01010235 | attr/background | 0x01010236 | attr/shinyNewAttr | 0x01010237 | attr/highlyValuedFeature --- PRIVATE --- | 0x01010238 | attr/secret | 0x01010239 | attr/shhh Platform code may look for private attributes set in a theme. If an app compiled against a newer version of the platform uses a new public attribute that happens to have the same ID as the private attribute the older platform is expecting, then the behavior is undefined. We get around this by detecting any newly defined attributes (in L), copy the resource into a -v21 qualified resource, and delete the attribute from the original resource. This ensures that older platforms don't see the new attribute, but when running on L+ platforms, the attribute will be respected. We still need to address this problem in the platform moving forward, as this will only help us in the transition from pre L to L. Bug:17520380 Change-Id: Ia2a985798b50006c21c7c3431d30d9598f27cd91
Diffstat (limited to 'tools/aapt/ResourceTable.h')
-rw-r--r--tools/aapt/ResourceTable.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/aapt/ResourceTable.h b/tools/aapt/ResourceTable.h
index 3721de4..025a868 100644
--- a/tools/aapt/ResourceTable.h
+++ b/tools/aapt/ResourceTable.h
@@ -165,6 +165,8 @@ public:
size_t numLocalResources() const;
bool hasResources() const;
+ status_t modifyForCompat(const Bundle* bundle);
+
sp<AaptFile> flatten(Bundle* bundle, const sp<const ResourceFilter>& filter,
const bool isBase);
@@ -281,6 +283,9 @@ public:
: mName(name), mType(TYPE_UNKNOWN),
mItemFormat(ResTable_map::TYPE_ANY), mNameIndex(-1), mPos(pos)
{ }
+
+ Entry(const Entry& entry);
+
virtual ~Entry() { }
enum type {
@@ -311,6 +316,8 @@ public:
bool replace=false, bool isId = false,
int32_t format = ResTable_map::TYPE_ANY);
+ status_t removeFromBag(const String16& key);
+
// Index of the entry's name string in the key pool.
int32_t getNameIndex() const { return mNameIndex; }
void setNameIndex(int32_t index) { mNameIndex = index; }
@@ -523,6 +530,7 @@ private:
const Item* getItem(uint32_t resID, uint32_t attrID) const;
bool getItemValue(uint32_t resID, uint32_t attrID,
Res_value* outValue);
+ bool isAttributeFromL(uint32_t attrId);
String16 mAssetsPackage;