Add namespace handling in attribute values

Previously, you could only reference namespace prefixes in attribute names:

<View xmlns:appcompat="http://schemas.android.com/apk/res/android.support.v7.appcompat"
      appcompat:name="hey"
      ...

Now you can also reference them in resource names within an attribute value:

      ...
      android:text="@appcompat:string/confirm"
      ...

Which will be treated as "@android.support.v7.appcompat:string/confirm".

Change-Id: Ib076e867a990c80cf877a704eb77cd1ef0b23b52
diff --git a/tools/aapt2/BinaryResourceParser.cpp b/tools/aapt2/BinaryResourceParser.cpp
index 326a2ac..bad5aa5 100644
--- a/tools/aapt2/BinaryResourceParser.cpp
+++ b/tools/aapt2/BinaryResourceParser.cpp
@@ -39,7 +39,7 @@
  * given a mapping from resource ID to resource name.
  */
 struct ReferenceIdToNameVisitor : ValueVisitor {
-    ReferenceIdToNameVisitor(const std::shared_ptr<Resolver>& resolver,
+    ReferenceIdToNameVisitor(const std::shared_ptr<IResolver>& resolver,
                              std::map<ResourceId, ResourceName>* cache) :
             mResolver(resolver), mCache(cache) {
     }
@@ -96,30 +96,25 @@
             reference.name = cacheIter->second;
             reference.id = 0;
         } else {
-            const android::ResTable& table = mResolver->getResTable();
-            android::ResTable::resource_name resourceName;
-            if (table.getResourceName(reference.id.id, false, &resourceName)) {
-                const ResourceType* type = parseResourceType(StringPiece16(resourceName.type,
-                                                                           resourceName.typeLen));
-                assert(type);
-                reference.name.package.assign(resourceName.package, resourceName.packageLen);
-                reference.name.type = *type;
-                reference.name.entry.assign(resourceName.name, resourceName.nameLen);
-                reference.id = 0;
+            Maybe<ResourceName> result = mResolver->findName(reference.id);
+            if (result) {
+                reference.name = result.value();
 
                 // Add to cache.
                 mCache->insert({reference.id, reference.name});
+
+                reference.id = 0;
             }
         }
     }
 
-    std::shared_ptr<Resolver> mResolver;
+    std::shared_ptr<IResolver> mResolver;
     std::map<ResourceId, ResourceName>* mCache;
 };
 
 
 BinaryResourceParser::BinaryResourceParser(const std::shared_ptr<ResourceTable>& table,
-                                           const std::shared_ptr<Resolver>& resolver,
+                                           const std::shared_ptr<IResolver>& resolver,
                                            const Source& source,
                                            const void* data,
                                            size_t len) :