AAPT2: Fix merging of styleables the right way

Styleables should only be merged when processing overlays.
This moves the styleable merging code out of ResourceTable
and into TableMerger.

Change-Id: I3aae05cf4dd875cd25ac2ac744b61194409b2fee
diff --git a/tools/aapt2/flatten/TableFlattener.cpp b/tools/aapt2/flatten/TableFlattener.cpp
index 6a35e8c..d5067b1 100644
--- a/tools/aapt2/flatten/TableFlattener.cpp
+++ b/tools/aapt2/flatten/TableFlattener.cpp
@@ -83,19 +83,19 @@
 
     void visit(Attribute* attr) override {
         {
-            Reference key = Reference(ResTable_map::ATTR_TYPE);
+            Reference key = Reference(ResourceId(ResTable_map::ATTR_TYPE));
             BinaryPrimitive val(Res_value::TYPE_INT_DEC, attr->typeMask);
             flattenEntry(&key, &val);
         }
 
         if (attr->minInt != std::numeric_limits<int32_t>::min()) {
-            Reference key = Reference(ResTable_map::ATTR_MIN);
+            Reference key = Reference(ResourceId(ResTable_map::ATTR_MIN));
             BinaryPrimitive val(Res_value::TYPE_INT_DEC, static_cast<uint32_t>(attr->minInt));
             flattenEntry(&key, &val);
         }
 
         if (attr->maxInt != std::numeric_limits<int32_t>::max()) {
-            Reference key = Reference(ResTable_map::ATTR_MAX);
+            Reference key = Reference(ResourceId(ResTable_map::ATTR_MAX));
             BinaryPrimitive val(Res_value::TYPE_INT_DEC, static_cast<uint32_t>(attr->maxInt));
             flattenEntry(&key, &val);
         }