AAPT2: Introduce notion of 'product' to ResourceTable

This allows us to preserve the various product definitions during the compile
phase, and allows us to select the product in the link phase.

This allows compiled files to remain product-independent, so that they do not need
to be recompiled when switching targets.

Bug:25958912
Change-Id: Iaa7eed25c834b67a39cdc9be43613e8b5ab6cdd7
diff --git a/tools/aapt2/flatten/TableFlattener.cpp b/tools/aapt2/flatten/TableFlattener.cpp
index 71ab3db..da81046 100644
--- a/tools/aapt2/flatten/TableFlattener.cpp
+++ b/tools/aapt2/flatten/TableFlattener.cpp
@@ -402,10 +402,10 @@
 
             const size_t configCount = entry->values.size();
             for (size_t i = 0; i < configCount; i++) {
-                const ConfigDescription& config = entry->values[i].config;
+                const ConfigDescription& config = entry->values[i]->config;
                 for (size_t j = i + 1; j < configCount; j++) {
                     configMasks[entry->id.value()] |= util::hostToDevice32(
-                            config.diff(entry->values[j].config));
+                            config.diff(entry->values[j]->config));
                 }
             }
         }
@@ -445,8 +445,8 @@
 
                 // Group values by configuration.
                 for (auto& configValue : entry->values) {
-                    configToEntryListMap[configValue.config].push_back(FlatEntry{
-                            entry, configValue.value.get(), keyIndex });
+                    configToEntryListMap[configValue->config].push_back(FlatEntry{
+                            entry, configValue->value.get(), keyIndex });
                 }
             }