From 9ba47d813075fcb05c5e1532c137c93b394631cb Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Tue, 13 Oct 2015 11:37:10 -0700 Subject: Filter products during compile phase Unfortunately there is no good way to deal with products in the link phase. Products are like preprocessor defines in that they are processed early and change the composition of the compiled unit. Change-Id: I6d5e15ef60d29df8e83e059ba857c09333993779 --- tools/aapt2/ResourceTable.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tools/aapt2/ResourceTable.cpp') diff --git a/tools/aapt2/ResourceTable.cpp b/tools/aapt2/ResourceTable.cpp index a1e7d36d91d9..e32fb5ee22ea 100644 --- a/tools/aapt2/ResourceTable.cpp +++ b/tools/aapt2/ResourceTable.cpp @@ -62,17 +62,17 @@ ResourceTablePackage* ResourceTable::findPackageById(uint8_t id) { return nullptr; } -ResourceTablePackage* ResourceTable::createPackage(const StringPiece16& name, uint8_t id) { +ResourceTablePackage* ResourceTable::createPackage(const StringPiece16& name, Maybe id) { ResourceTablePackage* package = findOrCreatePackage(name); - if (!package->id) { + if (id && !package->id) { package->id = id; return package; } - if (package->id.value() == id) { - return package; + if (id && package->id && package->id.value() != id.value()) { + return nullptr; } - return nullptr; + return package; } ResourceTablePackage* ResourceTable::findOrCreatePackage(const StringPiece16& name) { -- cgit v1.2.3-59-g8ed1b