summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAndroid (Google) Code Review <android-gerrit@google.com>2009-06-10 15:32:56 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-06-10 15:32:56 -0700
commit1b04076251d4edb2248651e36b60671123bb3975 (patch)
tree5b27d1bdfd4ec21fc6e6c3fabaad31e8421862ca /tools
parentea6a49436a21b0bb0287f009aed6868c5ce949cf (diff)
parent684a2edbe192a2a76684c5d6855773196d2e1a2e (diff)
downloadframeworks_base-1b04076251d4edb2248651e36b60671123bb3975.zip
frameworks_base-1b04076251d4edb2248651e36b60671123bb3975.tar.gz
frameworks_base-1b04076251d4edb2248651e36b60671123bb3975.tar.bz2
am 684a2edb: Merge change 3577 into donut
Merge commit '684a2edbe192a2a76684c5d6855773196d2e1a2e' * commit '684a2edbe192a2a76684c5d6855773196d2e1a2e': Make aapt Error out when an overlay adds a string.
Diffstat (limited to 'tools')
-rw-r--r--tools/aapt/ResourceTable.cpp24
-rw-r--r--tools/aapt/ResourceTable.h4
2 files changed, 18 insertions, 10 deletions
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp
index 770c7d8..b004664 100644
--- a/tools/aapt/ResourceTable.cpp
+++ b/tools/aapt/ResourceTable.cpp
@@ -1516,8 +1516,9 @@ status_t ResourceTable::addEntry(const SourcePos& sourcePos,
String8(value).string());
}
#endif
-
- sp<Entry> e = getEntry(package, type, name, sourcePos, params, doSetIndex);
+
+ sp<Entry> e = getEntry(package, type, name, sourcePos, overwrite,
+ params, doSetIndex);
if (e == NULL) {
return UNKNOWN_ERROR;
}
@@ -1560,8 +1561,7 @@ status_t ResourceTable::startBag(const SourcePos& sourcePos,
String8(name).string());
return UNKNOWN_ERROR;
}
-
- sp<Entry> e = getEntry(package, type, name, sourcePos, params);
+ sp<Entry> e = getEntry(package, type, name, sourcePos, overlay, params);
if (e == NULL) {
return UNKNOWN_ERROR;
}
@@ -1615,8 +1615,7 @@ status_t ResourceTable::addBag(const SourcePos& sourcePos,
sourcePos.file.striing(), sourcePos.line, String8(type).string());
}
#endif
-
- sp<Entry> e = getEntry(package, type, name, sourcePos, params);
+ sp<Entry> e = getEntry(package, type, name, sourcePos, replace, params);
if (e == NULL) {
return UNKNOWN_ERROR;
}
@@ -2899,7 +2898,7 @@ status_t ResourceTable::Entry::setItem(const SourcePos& sourcePos,
mItem.sourcePos.file.string(), mItem.sourcePos.line);
return UNKNOWN_ERROR;
}
-
+
mType = TYPE_ITEM;
mItem = item;
mItemFormat = format;
@@ -3219,11 +3218,17 @@ status_t ResourceTable::Type::addPublic(const SourcePos& sourcePos,
sp<ResourceTable::Entry> ResourceTable::Type::getEntry(const String16& entry,
const SourcePos& sourcePos,
const ResTable_config* config,
- bool doSetIndex)
+ bool doSetIndex,
+ bool overlay)
{
int pos = -1;
sp<ConfigList> c = mConfigs.valueFor(entry);
if (c == NULL) {
+ if (overlay == true) {
+ sourcePos.error("Resource %s appears in overlay but not"
+ " in the base package.\n", String8(entry).string());
+ return NULL;
+ }
c = new ConfigList(entry, sourcePos);
mConfigs.add(entry, c);
pos = (int)mOrderedConfigs.size();
@@ -3522,6 +3527,7 @@ sp<ResourceTable::Entry> ResourceTable::getEntry(const String16& package,
const String16& type,
const String16& name,
const SourcePos& sourcePos,
+ bool overlay,
const ResTable_config* config,
bool doSetIndex)
{
@@ -3529,7 +3535,7 @@ sp<ResourceTable::Entry> ResourceTable::getEntry(const String16& package,
if (t == NULL) {
return NULL;
}
- return t->getEntry(name, sourcePos, config, doSetIndex);
+ return t->getEntry(name, sourcePos, config, doSetIndex, overlay);
}
sp<const ResourceTable::Entry> ResourceTable::getEntry(uint32_t resID,
diff --git a/tools/aapt/ResourceTable.h b/tools/aapt/ResourceTable.h
index 20865ea..ec4331a 100644
--- a/tools/aapt/ResourceTable.h
+++ b/tools/aapt/ResourceTable.h
@@ -418,7 +418,8 @@ public:
sp<Entry> getEntry(const String16& entry,
const SourcePos& pos,
const ResTable_config* config = NULL,
- bool doSetIndex = false);
+ bool doSetIndex = false,
+ bool overlay = false);
const SourcePos& getFirstPublicSourcePos() const { return *mFirstPublicSourcePos; }
@@ -502,6 +503,7 @@ private:
const String16& type,
const String16& name,
const SourcePos& pos,
+ bool overlay,
const ResTable_config* config = NULL,
bool doSetIndex = false);
sp<const Entry> getEntry(uint32_t resID,