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
diff --git a/tools/aapt2/ResourceTable.cpp b/tools/aapt2/ResourceTable.cpp
index a1e7d36..e32fb5e 100644
--- a/tools/aapt2/ResourceTable.cpp
+++ b/tools/aapt2/ResourceTable.cpp
@@ -62,17 +62,17 @@
     return nullptr;
 }
 
-ResourceTablePackage* ResourceTable::createPackage(const StringPiece16& name, uint8_t id) {
+ResourceTablePackage* ResourceTable::createPackage(const StringPiece16& name, Maybe<uint8_t> 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) {