diff --git a/tools/aapt2/cmd/ApkInfo.cpp b/tools/aapt2/cmd/ApkInfo.cpp
index 7c9df4c..697b110 100644
--- a/tools/aapt2/cmd/ApkInfo.cpp
+++ b/tools/aapt2/cmd/ApkInfo.cpp
@@ -21,10 +21,10 @@
 #include <iostream>
 #include <memory>
 
-#include "Diagnostics.h"
 #include "LoadedApk.h"
 #include "android-base/file.h"  // for O_BINARY
 #include "android-base/utf8.h"
+#include "androidfw/IDiagnostics.h"
 #include "androidfw/StringPiece.h"
 #include "dump/DumpManifest.h"
 #include "format/proto/ProtoSerialize.h"
@@ -35,7 +35,7 @@
 
 int ExportApkInfo(LoadedApk* apk, bool include_resource_table,
                   const std::unordered_set<std::string>& xml_resources, pb::ApkInfo* out_apk_info,
-                  IDiagnostics* diag) {
+                  android::IDiagnostics* diag) {
   auto result = DumpBadgingProto(apk, out_apk_info->mutable_badging(), diag);
   if (result != 0) {
     return result;
@@ -74,14 +74,14 @@
   int result =
       ExportApkInfo(apk.get(), include_resource_table_, xml_resources_, &out_apk_info, diag_);
   if (result != 0) {
-    diag_->Error(DiagMessage() << "Failed to serialize ApkInfo into proto.");
+    diag_->Error(android::DiagMessage() << "Failed to serialize ApkInfo into proto.");
     return result;
   }
 
   int mode = O_WRONLY | O_CREAT | O_TRUNC | O_BINARY;
   int outfd = ::android::base::utf8::open(output_path_.c_str(), mode, 0666);
   if (outfd == -1) {
-    diag_->Error(DiagMessage() << "Failed to open output file.");
+    diag_->Error(android::DiagMessage() << "Failed to open output file.");
     return 1;
   }
 
diff --git a/tools/aapt2/cmd/ApkInfo.h b/tools/aapt2/cmd/ApkInfo.h
index d682678..bb92a85 100644
--- a/tools/aapt2/cmd/ApkInfo.h
+++ b/tools/aapt2/cmd/ApkInfo.h
@@ -18,13 +18,13 @@
 #define AAPT2_APKINFO_H
 
 #include "Command.h"
-#include "Diagnostics.h"
+#include "androidfw/IDiagnostics.h"
 
 namespace aapt {
 
 class ApkInfoCommand : public Command {
  public:
-  explicit ApkInfoCommand(IDiagnostics* diag) : Command("apkinfo"), diag_(diag) {
+  explicit ApkInfoCommand(android::IDiagnostics* diag) : Command("apkinfo"), diag_(diag) {
     SetDescription("Dump information about an APK in binary proto format.");
     AddRequiredFlag("-o", "Output path", &output_path_, Command::kPath);
     AddOptionalSwitch("--include-resource-table", "Include the resource table data into output.",
@@ -38,7 +38,7 @@
   int Action(const std::vector<std::string>& args) override;
 
  private:
-  IDiagnostics* diag_;
+  android::IDiagnostics* diag_;
   std::string output_path_;
   bool include_resource_table_ = false;
   std::unordered_set<std::string> xml_resources_;
diff --git a/tools/aapt2/cmd/ApkInfo_test.cpp b/tools/aapt2/cmd/ApkInfo_test.cpp
index 70539c0..97d4abe 100644
--- a/tools/aapt2/cmd/ApkInfo_test.cpp
+++ b/tools/aapt2/cmd/ApkInfo_test.cpp
@@ -43,12 +43,7 @@
   EXPECT_EQ(produced_apk_info.DebugString(), expected);
 }
 
-class NoopDiagnostics : public IDiagnostics {
- public:
-  void Log(Level level, DiagMessageActual& actualMsg) override {
-  }
-};
-static NoopDiagnostics noop_diag;
+static android::NoOpDiagnostics noop_diag;
 
 TEST_F(ApkInfoTest, ApkInfoWithBadging) {
   auto apk_path = file::BuildPath(
@@ -80,4 +75,4 @@
   AssertProducedAndExpectedInfo(out_info_path, expected_path);
 }
 
-}  // namespace aapt
\ No newline at end of file
+}  // namespace aapt
diff --git a/tools/aapt2/cmd/Compile.cpp b/tools/aapt2/cmd/Compile.cpp
index e27b9aa..0409f73 100644
--- a/tools/aapt2/cmd/Compile.cpp
+++ b/tools/aapt2/cmd/Compile.cpp
@@ -17,19 +17,17 @@
 #include "Compile.h"
 
 #include <dirent.h>
+
 #include <string>
 
+#include "ResourceParser.h"
+#include "ResourceTable.h"
 #include "android-base/errors.h"
 #include "android-base/file.h"
 #include "android-base/utf8.h"
 #include "androidfw/ConfigDescription.h"
+#include "androidfw/IDiagnostics.h"
 #include "androidfw/StringPiece.h"
-#include "google/protobuf/io/coded_stream.h"
-#include "google/protobuf/io/zero_copy_stream_impl_lite.h"
-
-#include "Diagnostics.h"
-#include "ResourceParser.h"
-#include "ResourceTable.h"
 #include "cmd/Util.h"
 #include "compile/IdAssigner.h"
 #include "compile/InlineXmlFormatParser.h"
@@ -39,6 +37,8 @@
 #include "format/Archive.h"
 #include "format/Container.h"
 #include "format/proto/ProtoSerialize.h"
+#include "google/protobuf/io/coded_stream.h"
+#include "google/protobuf/io/zero_copy_stream_impl_lite.h"
 #include "io/BigBufferStream.h"
 #include "io/FileStream.h"
 #include "io/FileSystem.h"
@@ -61,7 +61,7 @@
 namespace aapt {
 
 struct ResourcePathData {
-  Source source;
+  android::Source source;
   std::string resource_dir;
   std::string name;
   std::string extension;
@@ -122,9 +122,8 @@
     }
   }
 
-  const Source res_path = options.source_path
-      ? StringPiece(options.source_path.value())
-      : StringPiece(path);
+  const android::Source res_path =
+      options.source_path ? StringPiece(options.source_path.value()) : StringPiece(path);
 
   return ResourcePathData{res_path, dir_str.to_string(), name.to_string(),
                           extension.to_string(), config_str.to_string(), config};
@@ -154,8 +153,8 @@
   {
     auto fin = file->OpenInputStream();
     if (fin->HadError()) {
-      context->GetDiagnostics()->Error(DiagMessage(path_data.source)
-          << "failed to open file: " << fin->GetError());
+      context->GetDiagnostics()->Error(android::DiagMessage(path_data.source)
+                                       << "failed to open file: " << fin->GetError());
       return false;
     }
 
@@ -191,7 +190,7 @@
 
   // Create the file/zip entry.
   if (!writer->StartEntry(output_path, 0)) {
-    context->GetDiagnostics()->Error(DiagMessage(output_path) << "failed to open");
+    context->GetDiagnostics()->Error(android::DiagMessage(output_path) << "failed to open");
     return false;
   }
 
@@ -204,13 +203,13 @@
     pb::ResourceTable pb_table;
     SerializeTableToPb(table, &pb_table, context->GetDiagnostics());
     if (!container_writer.AddResTableEntry(pb_table)) {
-      context->GetDiagnostics()->Error(DiagMessage(output_path) << "failed to write");
+      context->GetDiagnostics()->Error(android::DiagMessage(output_path) << "failed to write");
       return false;
     }
   }
 
   if (!writer->FinishEntry()) {
-    context->GetDiagnostics()->Error(DiagMessage(output_path) << "failed to finish entry");
+    context->GetDiagnostics()->Error(android::DiagMessage(output_path) << "failed to finish entry");
     return false;
   }
 
@@ -218,7 +217,7 @@
     io::FileOutputStream fout_text(options.generate_text_symbols_path.value());
 
     if (fout_text.HadError()) {
-      context->GetDiagnostics()->Error(DiagMessage()
+      context->GetDiagnostics()->Error(android::DiagMessage()
                                        << "failed writing to'"
                                        << options.generate_text_symbols_path.value()
                                        << "': " << fout_text.GetError());
@@ -282,11 +281,11 @@
 
 static bool WriteHeaderAndDataToWriter(const StringPiece& output_path, const ResourceFile& file,
                                        io::KnownSizeInputStream* in, IArchiveWriter* writer,
-                                       IDiagnostics* diag) {
+                                       android::IDiagnostics* diag) {
   TRACE_CALL();
   // Start the entry so we can write the header.
   if (!writer->StartEntry(output_path, 0)) {
-    diag->Error(DiagMessage(output_path) << "failed to open file");
+    diag->Error(android::DiagMessage(output_path) << "failed to open file");
     return false;
   }
 
@@ -300,20 +299,20 @@
     SerializeCompiledFileToPb(file, &pb_compiled_file);
 
     if (!container_writer.AddResFileEntry(pb_compiled_file, in)) {
-      diag->Error(DiagMessage(output_path) << "failed to write entry data");
+      diag->Error(android::DiagMessage(output_path) << "failed to write entry data");
       return false;
     }
   }
 
   if (!writer->FinishEntry()) {
-    diag->Error(DiagMessage(output_path) << "failed to finish writing data");
+    diag->Error(android::DiagMessage(output_path) << "failed to finish writing data");
     return false;
   }
   return true;
 }
 
 static bool FlattenXmlToOutStream(const StringPiece& output_path, const xml::XmlResource& xmlres,
-                                  ContainerWriter* container_writer, IDiagnostics* diag) {
+                                  ContainerWriter* container_writer, android::IDiagnostics* diag) {
   pb::internal::CompiledFile pb_compiled_file;
   SerializeCompiledFileToPb(xmlres.file, &pb_compiled_file);
 
@@ -324,7 +323,7 @@
   io::StringInputStream serialized_in(serialized_xml);
 
   if (!container_writer->AddResFileEntry(pb_compiled_file, &serialized_in)) {
-    diag->Error(DiagMessage(output_path) << "failed to write entry data");
+    diag->Error(android::DiagMessage(output_path) << "failed to write entry data");
     return false;
   }
   return true;
@@ -334,12 +333,12 @@
   const file::FileType file_type = file::GetFileType(input_path);
   if (file_type != file::FileType::kRegular && file_type != file::FileType::kSymlink) {
     if (file_type == file::FileType::kDirectory) {
-      context->GetDiagnostics()->Error(DiagMessage(input_path)
+      context->GetDiagnostics()->Error(android::DiagMessage(input_path)
                                        << "resource file cannot be a directory");
     } else if (file_type == file::FileType::kNonExistant) {
-      context->GetDiagnostics()->Error(DiagMessage(input_path) << "file not found");
+      context->GetDiagnostics()->Error(android::DiagMessage(input_path) << "file not found");
     } else {
-      context->GetDiagnostics()->Error(DiagMessage(input_path)
+      context->GetDiagnostics()->Error(android::DiagMessage(input_path)
                                        << "not a valid resource file");
     }
     return false;
@@ -352,14 +351,14 @@
                        const std::string& output_path) {
   TRACE_CALL();
   if (context->IsVerbose()) {
-    context->GetDiagnostics()->Note(DiagMessage(path_data.source) << "compiling XML");
+    context->GetDiagnostics()->Note(android::DiagMessage(path_data.source) << "compiling XML");
   }
 
   std::unique_ptr<xml::XmlResource> xmlres;
   {
     auto fin = file->OpenInputStream();
     if (fin->HadError()) {
-      context->GetDiagnostics()->Error(DiagMessage(path_data.source)
+      context->GetDiagnostics()->Error(android::DiagMessage(path_data.source)
                                        << "failed to open file: " << fin->GetError());
       return false;
     }
@@ -389,7 +388,7 @@
 
   // Start the entry so we can write the header.
   if (!writer->StartEntry(output_path, 0)) {
-    context->GetDiagnostics()->Error(DiagMessage(output_path) << "failed to open file");
+    context->GetDiagnostics()->Error(android::DiagMessage(output_path) << "failed to open file");
     return false;
   }
 
@@ -416,7 +415,8 @@
   }
 
   if (!writer->FinishEntry()) {
-    context->GetDiagnostics()->Error(DiagMessage(output_path) << "failed to finish writing data");
+    context->GetDiagnostics()->Error(android::DiagMessage(output_path)
+                                     << "failed to finish writing data");
     return false;
   }
 
@@ -424,7 +424,7 @@
     io::FileOutputStream fout_text(options.generate_text_symbols_path.value());
 
     if (fout_text.HadError()) {
-      context->GetDiagnostics()->Error(DiagMessage()
+      context->GetDiagnostics()->Error(android::DiagMessage()
                                        << "failed writing to'"
                                        << options.generate_text_symbols_path.value()
                                        << "': " << fout_text.GetError());
@@ -452,10 +452,10 @@
                        const std::string& output_path) {
   TRACE_CALL();
   if (context->IsVerbose()) {
-    context->GetDiagnostics()->Note(DiagMessage(path_data.source) << "compiling PNG");
+    context->GetDiagnostics()->Note(android::DiagMessage(path_data.source) << "compiling PNG");
   }
 
-  BigBuffer buffer(4096);
+  android::BigBuffer buffer(4096);
   ResourceFile res_file;
   res_file.name = ResourceName({}, *ParseResourceType(path_data.resource_dir), path_data.name);
   res_file.config = path_data.config;
@@ -465,11 +465,12 @@
   {
     auto data = file->OpenAsData();
     if (!data) {
-      context->GetDiagnostics()->Error(DiagMessage(path_data.source) << "failed to open file ");
+      context->GetDiagnostics()->Error(android::DiagMessage(path_data.source)
+                                       << "failed to open file ");
       return false;
     }
 
-    BigBuffer crunched_png_buffer(4096);
+    android::BigBuffer crunched_png_buffer(4096);
     io::BigBufferOutputStream crunched_png_buffer_out(&crunched_png_buffer);
 
     // Ensure that we only keep the chunks we care about if we end up
@@ -486,7 +487,7 @@
       std::string err;
       nine_patch = NinePatch::Create(image->rows.get(), image->width, image->height, &err);
       if (!nine_patch) {
-        context->GetDiagnostics()->Error(DiagMessage() << err);
+        context->GetDiagnostics()->Error(android::DiagMessage() << err);
         return false;
       }
 
@@ -503,8 +504,8 @@
       }
 
       if (context->IsVerbose()) {
-        context->GetDiagnostics()->Note(DiagMessage(path_data.source) << "9-patch: "
-                                                                      << *nine_patch);
+        context->GetDiagnostics()->Note(android::DiagMessage(path_data.source)
+                                        << "9-patch: " << *nine_patch);
       }
     }
 
@@ -522,13 +523,13 @@
       // The re-encoded PNG is larger than the original, and there is
       // no mandatory transformation. Use the original.
       if (context->IsVerbose()) {
-        context->GetDiagnostics()->Note(DiagMessage(path_data.source)
+        context->GetDiagnostics()->Note(android::DiagMessage(path_data.source)
                                         << "original PNG is smaller than crunched PNG"
                                         << ", using original");
       }
 
       png_chunk_filter.Rewind();
-      BigBuffer filtered_png_buffer(4096);
+      android::BigBuffer filtered_png_buffer(4096);
       io::BigBufferOutputStream filtered_png_buffer_out(&filtered_png_buffer);
       io::Copy(&filtered_png_buffer_out, &png_chunk_filter);
       buffer.AppendBuffer(std::move(filtered_png_buffer));
@@ -538,13 +539,13 @@
       // For debugging only, use the legacy PNG cruncher and compare the resulting file sizes.
       // This will help catch exotic cases where the new code may generate larger PNGs.
       std::stringstream legacy_stream(content.to_string());
-      BigBuffer legacy_buffer(4096);
+      android::BigBuffer legacy_buffer(4096);
       Png png(context->GetDiagnostics());
       if (!png.process(path_data.source, &legacy_stream, &legacy_buffer, {})) {
         return false;
       }
 
-      context->GetDiagnostics()->Note(DiagMessage(path_data.source)
+      context->GetDiagnostics()->Note(android::DiagMessage(path_data.source)
                                       << "legacy=" << legacy_buffer.size()
                                       << " new=" << buffer.size());
     }
@@ -560,7 +561,7 @@
                         const std::string& output_path) {
   TRACE_CALL();
   if (context->IsVerbose()) {
-    context->GetDiagnostics()->Note(DiagMessage(path_data.source) << "compiling file");
+    context->GetDiagnostics()->Note(android::DiagMessage(path_data.source) << "compiling file");
   }
 
   ResourceFile res_file;
@@ -571,7 +572,8 @@
 
   auto data = file->OpenAsData();
   if (!data) {
-    context->GetDiagnostics()->Error(DiagMessage(path_data.source) << "failed to open file ");
+    context->GetDiagnostics()->Error(android::DiagMessage(path_data.source)
+                                     << "failed to open file ");
     return false;
   }
 
@@ -581,7 +583,7 @@
 
 class CompileContext : public IAaptContext {
  public:
-  explicit CompileContext(IDiagnostics* diagnostics) : diagnostics_(diagnostics) {
+  explicit CompileContext(android::IDiagnostics* diagnostics) : diagnostics_(diagnostics) {
   }
 
   PackageType GetPackageType() override {
@@ -597,7 +599,7 @@
     return verbose_;
   }
 
-  IDiagnostics* GetDiagnostics() override {
+  android::IDiagnostics* GetDiagnostics() override {
     return diagnostics_;
   }
 
@@ -633,7 +635,7 @@
  private:
   DISALLOW_COPY_AND_ASSIGN(CompileContext);
 
-  IDiagnostics* diagnostics_;
+  android::IDiagnostics* diagnostics_;
   bool verbose_ = false;
 };
 
@@ -665,7 +667,7 @@
         path, inputs->GetDirSeparator(), &err_str, options)) {
       path_data = maybe_path_data.value();
     } else {
-      context->GetDiagnostics()->Error(DiagMessage(file->GetSource()) << err_str);
+      context->GetDiagnostics()->Error(android::DiagMessage(file->GetSource()) << err_str);
       error = true;
       continue;
     }
@@ -688,8 +690,8 @@
         }
       }
     } else {
-      context->GetDiagnostics()->Error(DiagMessage()
-          << "invalid file path '" << path_data.source << "'");
+      context->GetDiagnostics()->Error(android::DiagMessage()
+                                       << "invalid file path '" << path_data.source << "'");
       error = true;
       continue;
     }
@@ -699,15 +701,16 @@
     if (compile_func != &CompileFile && !options.legacy_mode
         && std::count(path_data.name.begin(), path_data.name.end(), '.') != 0) {
       error = true;
-      context->GetDiagnostics()->Error(DiagMessage(file->GetSource())
-                                                    << "file name cannot contain '.' other than for"
-                                                    << " specifying the extension");
+      context->GetDiagnostics()->Error(android::DiagMessage(file->GetSource())
+                                       << "file name cannot contain '.' other than for"
+                                       << " specifying the extension");
       continue;
     }
 
     const std::string out_path = BuildIntermediateContainerFilename(path_data);
     if (!compile_func(context, options, path_data, file, output_writer, out_path)) {
-      context->GetDiagnostics()->Error(DiagMessage(file->GetSource()) << "file failed to compile");
+      context->GetDiagnostics()->Error(android::DiagMessage(file->GetSource())
+                                       << "file failed to compile");
       error = true;
     }
   }
@@ -728,9 +731,10 @@
     } else if (visibility_.value() == "default") {
       options_.visibility = Visibility::Level::kUndefined;
     } else {
-      context.GetDiagnostics()->Error(
-          DiagMessage() << "Unrecognized visibility level passes to --visibility: '"
-                        << visibility_.value() << "'. Accepted levels: public, private, default");
+      context.GetDiagnostics()->Error(android::DiagMessage()
+                                      << "Unrecognized visibility level passes to --visibility: '"
+                                      << visibility_.value()
+                                      << "'. Accepted levels: public, private, default");
       return 1;
     }
   }
@@ -739,17 +743,17 @@
 
   // Collect the resources files to compile
   if (options_.res_dir && options_.res_zip) {
-    context.GetDiagnostics()->Error(DiagMessage()
-                                      << "only one of --dir and --zip can be specified");
+    context.GetDiagnostics()->Error(android::DiagMessage()
+                                    << "only one of --dir and --zip can be specified");
     return 1;
   } else if ((options_.res_dir || options_.res_zip) &&
               options_.source_path && args.size() > 1) {
-      context.GetDiagnostics()->Error(DiagMessage(kPath)
-      << "Cannot use an overriding source path with multiple files.");
-      return 1;
+    context.GetDiagnostics()->Error(android::DiagMessage(kPath)
+                                    << "Cannot use an overriding source path with multiple files.");
+    return 1;
   } else if (options_.res_dir) {
     if (!args.empty()) {
-      context.GetDiagnostics()->Error(DiagMessage() << "files given but --dir specified");
+      context.GetDiagnostics()->Error(android::DiagMessage() << "files given but --dir specified");
       Usage(&std::cerr);
       return 1;
     }
@@ -758,12 +762,12 @@
     std::string err;
     file_collection = io::FileCollection::Create(options_.res_dir.value(), &err);
     if (!file_collection) {
-      context.GetDiagnostics()->Error(DiagMessage(options_.res_dir.value()) << err);
+      context.GetDiagnostics()->Error(android::DiagMessage(options_.res_dir.value()) << err);
       return 1;
     }
   } else if (options_.res_zip) {
     if (!args.empty()) {
-      context.GetDiagnostics()->Error(DiagMessage() << "files given but --zip specified");
+      context.GetDiagnostics()->Error(android::DiagMessage() << "files given but --zip specified");
       Usage(&std::cerr);
       return 1;
     }
@@ -772,7 +776,7 @@
     std::string err;
     file_collection = io::ZipFileCollection::Create(options_.res_zip.value(), &err);
     if (!file_collection) {
-      context.GetDiagnostics()->Error(DiagMessage(options_.res_zip.value()) << err);
+      context.GetDiagnostics()->Error(android::DiagMessage(options_.res_zip.value()) << err);
       return 1;
     }
   } else {
diff --git a/tools/aapt2/cmd/Compile.h b/tools/aapt2/cmd/Compile.h
index bd2e3d7..14a730a 100644
--- a/tools/aapt2/cmd/Compile.h
+++ b/tools/aapt2/cmd/Compile.h
@@ -17,15 +17,15 @@
 #ifndef AAPT2_COMPILE_H
 #define AAPT2_COMPILE_H
 
-#include <optional>
-
 #include <androidfw/StringPiece.h>
 
+#include <optional>
+
+#include "Command.h"
+#include "ResourceTable.h"
+#include "androidfw/IDiagnostics.h"
 #include "format/Archive.h"
 #include "process/IResourceTableConsumer.h"
-#include "Command.h"
-#include "Diagnostics.h"
-#include "ResourceTable.h"
 
 namespace aapt {
 
@@ -47,8 +47,8 @@
 /** Parses flags and compiles resources to be used in linking.  */
 class CompileCommand : public Command {
  public:
-  explicit CompileCommand(IDiagnostics* diagnostic) : Command("compile", "c"),
-                                                      diagnostic_(diagnostic) {
+  explicit CompileCommand(android::IDiagnostics* diagnostic)
+      : Command("compile", "c"), diagnostic_(diagnostic) {
     SetDescription("Compiles resources to be linked into an apk.");
     AddRequiredFlag("-o", "Output path", &options_.output_path, Command::kPath);
     AddOptionalFlag("--dir", "Directory to scan for resources", &options_.res_dir, Command::kPath);
@@ -81,7 +81,7 @@
   int Action(const std::vector<std::string>& args) override;
 
  private:
-  IDiagnostics* diagnostic_;
+  android::IDiagnostics* diagnostic_;
   CompileOptions options_;
   std::optional<std::string> visibility_;
   std::optional<std::string> trace_folder_;
diff --git a/tools/aapt2/cmd/Compile_test.cpp b/tools/aapt2/cmd/Compile_test.cpp
index fbfbf68..3464a76 100644
--- a/tools/aapt2/cmd/Compile_test.cpp
+++ b/tools/aapt2/cmd/Compile_test.cpp
@@ -219,7 +219,7 @@
   ASSERT_NE(table, nullptr);
   table->string_pool.Sort();
 
-  const std::vector<std::unique_ptr<StringPool::Entry>>& pool_strings =
+  const std::vector<std::unique_ptr<android::StringPool::Entry>>& pool_strings =
       table->string_pool.strings();
 
   // The actual / expected vectors have the same size
@@ -316,7 +316,7 @@
 
   std::unique_ptr<LoadedApk> apk = LoadedApk::LoadApkFromPath(apk_path, &diag);
   ResourceTable* resource_table = apk.get()->GetResourceTable();
-  const std::vector<std::unique_ptr<StringPool::Entry>>& pool_strings =
+  const std::vector<std::unique_ptr<android::StringPool::Entry>>& pool_strings =
       resource_table->string_pool.strings();
 
   ASSERT_EQ(pool_strings.size(), 2);
diff --git a/tools/aapt2/cmd/Convert.cpp b/tools/aapt2/cmd/Convert.cpp
index d8c541d..cf58f98 100644
--- a/tools/aapt2/cmd/Convert.cpp
+++ b/tools/aapt2/cmd/Convert.cpp
@@ -18,6 +18,7 @@
 
 #include <vector>
 
+#include "Diagnostics.h"
 #include "LoadedApk.h"
 #include "ValueVisitor.h"
 #include "android-base/macros.h"
@@ -42,8 +43,9 @@
 
 class IApkSerializer {
  public:
-  IApkSerializer(IAaptContext* context, const Source& source) : context_(context),
-                                                                source_(source) {}
+  IApkSerializer(IAaptContext* context, const android::Source& source)
+      : context_(context), source_(source) {
+  }
 
   virtual bool SerializeXml(const xml::XmlResource* xml, const std::string& path, bool utf16,
                             IArchiveWriter* writer, uint32_t compression_flags) = 0;
@@ -54,21 +56,22 @@
 
  protected:
   IAaptContext* context_;
-  Source source_;
+  android::Source source_;
 };
 
 class BinaryApkSerializer : public IApkSerializer {
  public:
-  BinaryApkSerializer(IAaptContext* context, const Source& source,
+  BinaryApkSerializer(IAaptContext* context, const android::Source& source,
                       const TableFlattenerOptions& table_flattener_options,
                       const XmlFlattenerOptions& xml_flattener_options)
       : IApkSerializer(context, source),
         table_flattener_options_(table_flattener_options),
-        xml_flattener_options_(xml_flattener_options) {}
+        xml_flattener_options_(xml_flattener_options) {
+  }
 
   bool SerializeXml(const xml::XmlResource* xml, const std::string& path, bool utf16,
                     IArchiveWriter* writer, uint32_t compression_flags) override {
-    BigBuffer buffer(4096);
+    android::BigBuffer buffer(4096);
     xml_flattener_options_.use_utf16 = utf16;
     XmlFlattener flattener(&buffer, xml_flattener_options_);
     if (!flattener.Consume(context_, xml)) {
@@ -80,7 +83,7 @@
   }
 
   bool SerializeTable(ResourceTable* table, IArchiveWriter* writer) override {
-    BigBuffer buffer(4096);
+    android::BigBuffer buffer(4096);
     TableFlattener table_flattener(table_flattener_options_, &buffer);
     if (!table_flattener.Consume(context_, table)) {
       return false;
@@ -95,7 +98,7 @@
     if (file->type == ResourceFile::Type::kProtoXml) {
       unique_ptr<io::InputStream> in = file->file->OpenInputStream();
       if (in == nullptr) {
-        context_->GetDiagnostics()->Error(DiagMessage(source_)
+        context_->GetDiagnostics()->Error(android::DiagMessage(source_)
                                           << "failed to open file " << *file->path);
         return false;
       }
@@ -103,7 +106,7 @@
       pb::XmlNode pb_node;
       io::ProtoInputStreamReader proto_reader(in.get());
       if (!proto_reader.ReadMessage(&pb_node)) {
-        context_->GetDiagnostics()->Error(DiagMessage(source_)
+        context_->GetDiagnostics()->Error(android::DiagMessage(source_)
                                           << "failed to parse proto XML " << *file->path);
         return false;
       }
@@ -111,15 +114,15 @@
       std::string error;
       unique_ptr<xml::XmlResource> xml = DeserializeXmlResourceFromPb(pb_node, &error);
       if (xml == nullptr) {
-        context_->GetDiagnostics()->Error(DiagMessage(source_)
-                                          << "failed to deserialize proto XML "
-                                          << *file->path << ": " << error);
+        context_->GetDiagnostics()->Error(android::DiagMessage(source_)
+                                          << "failed to deserialize proto XML " << *file->path
+                                          << ": " << error);
         return false;
       }
 
       if (!SerializeXml(xml.get(), *file->path, false /*utf16*/, writer,
                         file->file->WasCompressed() ? ArchiveEntry::kCompress : 0u)) {
-        context_->GetDiagnostics()->Error(DiagMessage(source_)
+        context_->GetDiagnostics()->Error(android::DiagMessage(source_)
                                           << "failed to serialize to binary XML: " << *file->path);
         return false;
       }
@@ -127,7 +130,7 @@
       file->type = ResourceFile::Type::kBinaryXml;
     } else {
       if (!io::CopyFileToArchivePreserveCompression(context_, file->file, *file->path, writer)) {
-        context_->GetDiagnostics()->Error(DiagMessage(source_)
+        context_->GetDiagnostics()->Error(android::DiagMessage(source_)
                                           << "failed to copy file " << *file->path);
         return false;
       }
@@ -145,8 +148,9 @@
 
 class ProtoApkSerializer : public IApkSerializer {
  public:
-  ProtoApkSerializer(IAaptContext* context, const Source& source)
-      : IApkSerializer(context, source) {}
+  ProtoApkSerializer(IAaptContext* context, const android::Source& source)
+      : IApkSerializer(context, source) {
+  }
 
   bool SerializeXml(const xml::XmlResource* xml, const std::string& path, bool utf16,
                     IArchiveWriter* writer, uint32_t compression_flags) override {
@@ -166,7 +170,7 @@
     if (file->type == ResourceFile::Type::kBinaryXml) {
       std::unique_ptr<io::IData> data = file->file->OpenAsData();
       if (!data) {
-        context_->GetDiagnostics()->Error(DiagMessage(source_)
+        context_->GetDiagnostics()->Error(android::DiagMessage(source_)
                                           << "failed to open file " << *file->path);
         return false;
       }
@@ -174,14 +178,14 @@
       std::string error;
       std::unique_ptr<xml::XmlResource> xml = xml::Inflate(data->data(), data->size(), &error);
       if (xml == nullptr) {
-        context_->GetDiagnostics()->Error(DiagMessage(source_) << "failed to parse binary XML: "
-                                                               << error);
+        context_->GetDiagnostics()->Error(android::DiagMessage(source_)
+                                          << "failed to parse binary XML: " << error);
         return false;
       }
 
       if (!SerializeXml(xml.get(), *file->path, false /*utf16*/, writer,
                         file->file->WasCompressed() ? ArchiveEntry::kCompress : 0u)) {
-        context_->GetDiagnostics()->Error(DiagMessage(source_)
+        context_->GetDiagnostics()->Error(android::DiagMessage(source_)
                                           << "failed to serialize to proto XML: " << *file->path);
         return false;
       }
@@ -189,7 +193,7 @@
       file->type = ResourceFile::Type::kProtoXml;
     } else {
       if (!io::CopyFileToArchivePreserveCompression(context_, file->file, *file->path, writer)) {
-        context_->GetDiagnostics()->Error(DiagMessage(source_)
+        context_->GetDiagnostics()->Error(android::DiagMessage(source_)
                                           << "failed to copy file " << *file->path);
         return false;
       }
@@ -215,7 +219,7 @@
     return &symbols_;
   }
 
-  IDiagnostics* GetDiagnostics() override {
+  android::IDiagnostics* GetDiagnostics() override {
     return &diag_;
   }
 
@@ -270,7 +274,7 @@
   } else if (output_format == ApkFormat::kProto) {
     serializer.reset(new ProtoApkSerializer(context, apk->GetSource()));
   } else {
-    context->GetDiagnostics()->Error(DiagMessage(apk->GetSource())
+    context->GetDiagnostics()->Error(android::DiagMessage(apk->GetSource())
                                      << "Cannot convert APK to unknown format");
     return 1;
   }
@@ -279,7 +283,7 @@
   if (!serializer->SerializeXml(apk->GetManifest(), kAndroidManifestPath, true /*utf16*/,
                                 output_writer, (manifest != nullptr && manifest->WasCompressed())
                                                ? ArchiveEntry::kCompress : 0u)) {
-    context->GetDiagnostics()->Error(DiagMessage(apk->GetSource())
+    context->GetDiagnostics()->Error(android::DiagMessage(apk->GetSource())
                                      << "failed to serialize AndroidManifest.xml");
     return 1;
   }
@@ -298,7 +302,7 @@
             FileReference* file = ValueCast<FileReference>(config_value->value.get());
             if (file != nullptr) {
               if (file->file == nullptr) {
-                context->GetDiagnostics()->Error(DiagMessage(apk->GetSource())
+                context->GetDiagnostics()->Error(android::DiagMessage(apk->GetSource())
                                                  << "no file associated with " << *file);
                 return 1;
               }
@@ -306,7 +310,7 @@
               // Only serialize if we haven't seen this file before
               if (files_written.insert(*file->path).second) {
                 if (!serializer->SerializeFile(file, output_writer)) {
-                  context->GetDiagnostics()->Error(DiagMessage(apk->GetSource())
+                  context->GetDiagnostics()->Error(android::DiagMessage(apk->GetSource())
                                                    << "failed to serialize file " << *file->path);
                   return 1;
                 }
@@ -319,7 +323,7 @@
 
     // Converted resource table
     if (!serializer->SerializeTable(converted_table, output_writer)) {
-      context->GetDiagnostics()->Error(DiagMessage(apk->GetSource())
+      context->GetDiagnostics()->Error(android::DiagMessage(apk->GetSource())
                                        << "failed to serialize the resource table");
       return 1;
     }
@@ -340,8 +344,8 @@
     }
 
     if (!io::CopyFileToArchivePreserveCompression(context, file, path, output_writer)) {
-      context->GetDiagnostics()->Error(DiagMessage(apk->GetSource())
-                                           << "failed to copy file " << path);
+      context->GetDiagnostics()->Error(android::DiagMessage(apk->GetSource())
+                                       << "failed to copy file " << path);
       return 1;
     }
   }
@@ -363,7 +367,7 @@
   const StringPiece& path = args[0];
   unique_ptr<LoadedApk> apk = LoadedApk::LoadApkFromPath(path, context.GetDiagnostics());
   if (apk == nullptr) {
-    context.GetDiagnostics()->Error(DiagMessage(path) << "failed to load APK");
+    context.GetDiagnostics()->Error(android::DiagMessage(path) << "failed to load APK");
     return 1;
   }
 
@@ -386,8 +390,9 @@
   } else if (output_format_.value() == ConvertCommand::kOutputFormatProto) {
     format = ApkFormat::kProto;
   } else {
-    context.GetDiagnostics()->Error(DiagMessage(path) << "Invalid value for flag --output-format: "
-                                                      << output_format_.value());
+    context.GetDiagnostics()->Error(android::DiagMessage(path)
+                                    << "Invalid value for flag --output-format: "
+                                    << output_format_.value());
     return 1;
   }
 
diff --git a/tools/aapt2/cmd/Convert_test.cpp b/tools/aapt2/cmd/Convert_test.cpp
index f35237e..27df8c1 100644
--- a/tools/aapt2/cmd/Convert_test.cpp
+++ b/tools/aapt2/cmd/Convert_test.cpp
@@ -101,7 +101,8 @@
   // Check that the raw string index has been set to the correct string pool entry
   int32_t raw_index = tree.getAttributeValueStringID(0);
   ASSERT_THAT(raw_index, Ne(-1));
-  EXPECT_THAT(util::GetString(tree.getStrings(), static_cast<size_t>(raw_index)), Eq("007"));
+  EXPECT_THAT(android::util::GetString(tree.getStrings(), static_cast<size_t>(raw_index)),
+              Eq("007"));
 }
 
 TEST_F(ConvertTest, DuplicateEntriesWrittenOnce) {
diff --git a/tools/aapt2/cmd/Diff.cpp b/tools/aapt2/cmd/Diff.cpp
index a854146..423e939 100644
--- a/tools/aapt2/cmd/Diff.cpp
+++ b/tools/aapt2/cmd/Diff.cpp
@@ -16,10 +16,10 @@
 
 #include "Diff.h"
 
-#include "android-base/macros.h"
-
+#include "Diagnostics.h"
 #include "LoadedApk.h"
 #include "ValueVisitor.h"
+#include "android-base/macros.h"
 #include "process/IResourceTableConsumer.h"
 #include "process/SymbolTable.h"
 
@@ -45,7 +45,7 @@
     return 0x0;
   }
 
-  IDiagnostics* GetDiagnostics() override {
+  android::IDiagnostics* GetDiagnostics() override {
     return &diagnostics_;
   }
 
@@ -78,7 +78,7 @@
   SymbolTable symbol_table_;
 };
 
-static void EmitDiffLine(const Source& source, const StringPiece& message) {
+static void EmitDiffLine(const android::Source& source, const StringPiece& message) {
   std::cerr << source << ": " << message << "\n";
 }
 
@@ -385,7 +385,7 @@
     return 1;
   }
 
-  IDiagnostics* diag = context.GetDiagnostics();
+  android::IDiagnostics* diag = context.GetDiagnostics();
   std::unique_ptr<LoadedApk> apk_a = LoadedApk::LoadApkFromPath(args[0], diag);
   std::unique_ptr<LoadedApk> apk_b = LoadedApk::LoadApkFromPath(args[1], diag);
   if (!apk_a || !apk_b) {
diff --git a/tools/aapt2/cmd/Dump.cpp b/tools/aapt2/cmd/Dump.cpp
index bcce3e5..71b0802 100644
--- a/tools/aapt2/cmd/Dump.cpp
+++ b/tools/aapt2/cmd/Dump.cpp
@@ -57,8 +57,8 @@
   return "UNKNOWN";
 }
 
-static void DumpCompiledFile(const ResourceFile& file, const Source& source, off64_t offset,
-                             size_t len, Printer* printer) {
+static void DumpCompiledFile(const ResourceFile& file, const android::Source& source,
+                             off64_t offset, size_t len, Printer* printer) {
   printer->Print("Resource: ");
   printer->Println(file.name.to_string());
 
@@ -83,7 +83,7 @@
     return PackageType::kApp;
   }
 
-  IDiagnostics* GetDiagnostics() override {
+  android::IDiagnostics* GetDiagnostics() override {
     return &diagnostics_;
   }
 
@@ -138,7 +138,7 @@
   print_options.show_values = !no_values_;
 
   if (args.size() < 1) {
-    diag_->Error(DiagMessage() << "No dump container specified");
+    diag_->Error(android::DiagMessage() << "No dump container specified");
     return 1;
   }
 
@@ -146,7 +146,7 @@
   for (auto container : args) {
     io::FileInputStream input(container);
     if (input.HadError()) {
-      context.GetDiagnostics()->Error(DiagMessage(container)
+      context.GetDiagnostics()->Error(android::DiagMessage(container)
                                       << "failed to open file: " << input.GetError());
       error = true;
       continue;
@@ -155,7 +155,7 @@
     // Try as a compiled file.
     ContainerReader reader(&input);
     if (reader.HadError()) {
-      context.GetDiagnostics()->Error(DiagMessage(container)
+      context.GetDiagnostics()->Error(android::DiagMessage(container)
                                       << "failed to read container: " << reader.GetError());
       error = true;
       continue;
@@ -170,7 +170,7 @@
 
         pb::ResourceTable pb_table;
         if (!entry->GetResTable(&pb_table)) {
-          context.GetDiagnostics()->Error(DiagMessage(container)
+          context.GetDiagnostics()->Error(android::DiagMessage(container)
                                           << "failed to parse proto table: " << entry->GetError());
           error = true;
           continue;
@@ -179,7 +179,7 @@
         ResourceTable table;
         error.clear();
         if (!DeserializeTableFromPb(pb_table, nullptr /*files*/, &table, &error)) {
-          context.GetDiagnostics()->Error(DiagMessage(container)
+          context.GetDiagnostics()->Error(android::DiagMessage(container)
                                           << "failed to parse table: " << error);
           error = true;
           continue;
@@ -194,7 +194,7 @@
         off64_t offset;
         size_t length;
         if (!entry->GetResFileOffsets(&pb_compiled_file, &offset, &length)) {
-          context.GetDiagnostics()->Error(DiagMessage(container)
+          context.GetDiagnostics()->Error(android::DiagMessage(container)
                                           << "failed to parse compiled proto file: "
                                           << entry->GetError());
           error = true;
@@ -203,14 +203,14 @@
 
         ResourceFile file;
         if (!DeserializeCompiledFileFromPb(pb_compiled_file, &file, &error)) {
-          context.GetDiagnostics()->Warn(DiagMessage(container)
+          context.GetDiagnostics()->Warn(android::DiagMessage(container)
                                          << "failed to parse compiled file: " << error);
           error = true;
           continue;
         }
 
         printer_->Indent();
-        DumpCompiledFile(file, Source(container), offset, length, printer_);
+        DumpCompiledFile(file, android::Source(container), offset, length, printer_);
         printer_->Undent();
       }
     }
@@ -228,7 +228,7 @@
 int DumpConfigsCommand::Dump(LoadedApk* apk) {
   ResourceTable* table = apk->GetResourceTable();
   if (!table) {
-    GetDiagnostics()->Error(DiagMessage() << "Failed to retrieve resource table");
+    GetDiagnostics()->Error(android::DiagMessage() << "Failed to retrieve resource table");
     return 1;
   }
 
@@ -268,13 +268,13 @@
 int DumpStringsCommand::Dump(LoadedApk* apk) {
   ResourceTable* table = apk->GetResourceTable();
   if (!table) {
-    GetDiagnostics()->Error(DiagMessage() << "Failed to retrieve resource table");
+    GetDiagnostics()->Error(android::DiagMessage() << "Failed to retrieve resource table");
     return 1;
   }
 
   // Load the run-time xml string pool using the flattened data
-  BigBuffer buffer(4096);
-  StringPool::FlattenUtf8(&buffer, table->string_pool, GetDiagnostics());
+  android::BigBuffer buffer(4096);
+  android::StringPool::FlattenUtf8(&buffer, table->string_pool, GetDiagnostics());
   auto data = buffer.to_string();
   android::ResStringPool pool(data.data(), data.size(), false);
   Debug::DumpResStringPool(&pool, GetPrinter());
@@ -291,14 +291,14 @@
   const auto table = apk->GetResourceTable();
 
   if (!table) {
-    GetDiagnostics()->Error(DiagMessage() << "Failed to retrieve resource table");
+    GetDiagnostics()->Error(android::DiagMessage() << "Failed to retrieve resource table");
     return 1;
   }
 
   std::optional<ResourceTable::SearchResult> target = table->FindResource(target_style);
   if (!target) {
-    GetDiagnostics()->Error(
-        DiagMessage() << "Target style \"" << target_style.entry << "\" does not exist");
+    GetDiagnostics()->Error(android::DiagMessage()
+                            << "Target style \"" << target_style.entry << "\" does not exist");
     return 1;
   }
 
@@ -315,7 +315,7 @@
 
   ResourceTable* table = apk->GetResourceTable();
   if (!table) {
-    GetDiagnostics()->Error(DiagMessage() << "Failed to retrieve resource table");
+    GetDiagnostics()->Error(android::DiagMessage() << "Failed to retrieve resource table");
     return 1;
   }
 
@@ -340,7 +340,7 @@
       }
 
       // Flatten the xml document to get a binary representation of the proto xml file
-      BigBuffer buffer(4096);
+      android::BigBuffer buffer(4096);
       XmlFlattenerOptions options = {};
       options.keep_raw_values = true;
       XmlFlattener flattener(&buffer, options);
@@ -356,7 +356,7 @@
     } else if (apk->GetApkFormat() == ApkFormat::kBinary) {
       io::IFile* file = apk->GetFileCollection()->FindFile(xml_file);
       if (!file) {
-        GetDiagnostics()->Error(DiagMessage(xml_file)
+        GetDiagnostics()->Error(android::DiagMessage(xml_file)
                                 << "File '" << xml_file << "' not found in APK");
         error = true;
         continue;
@@ -364,7 +364,7 @@
 
       std::unique_ptr<io::IData> data = file->OpenAsData();
       if (!data) {
-        GetDiagnostics()->Error(DiagMessage() << "Failed to open " << xml_file);
+        GetDiagnostics()->Error(android::DiagMessage() << "Failed to open " << xml_file);
         error = true;
         continue;
       }
@@ -372,7 +372,7 @@
       // Load the run-time xml tree from the file data
       tree.setTo(data->data(), data->size(), /** copyData */ true);
     } else {
-      GetDiagnostics()->Error(DiagMessage(apk->GetSource()) << "Unknown APK format");
+      GetDiagnostics()->Error(android::DiagMessage(apk->GetSource()) << "Unknown APK format");
       error = true;
       continue;
     }
@@ -396,7 +396,7 @@
 int DumpOverlayableCommand::Dump(LoadedApk* apk) {
   ResourceTable* table = apk->GetResourceTable();
   if (!table) {
-    GetDiagnostics()->Error(DiagMessage() << "Failed to retrieve resource table");
+    GetDiagnostics()->Error(android::DiagMessage() << "Failed to retrieve resource table");
     return 1;
   }
 
@@ -563,13 +563,13 @@
 int DumpChunks::Dump(LoadedApk* apk) {
   auto file = apk->GetFileCollection()->FindFile("resources.arsc");
   if (!file) {
-    GetDiagnostics()->Error(DiagMessage() << "Failed to find resources.arsc in APK");
+    GetDiagnostics()->Error(android::DiagMessage() << "Failed to find resources.arsc in APK");
     return 1;
   }
 
   auto data = file->OpenAsData();
   if (!data) {
-    GetDiagnostics()->Error(DiagMessage() << "Failed to open resources.arsc ");
+    GetDiagnostics()->Error(android::DiagMessage() << "Failed to open resources.arsc ");
     return 1;
   }
 
diff --git a/tools/aapt2/cmd/Dump.h b/tools/aapt2/cmd/Dump.h
index c7a3567..76d33d7 100644
--- a/tools/aapt2/cmd/Dump.h
+++ b/tools/aapt2/cmd/Dump.h
@@ -33,29 +33,30 @@
  **/
 class DumpApkCommand : public Command {
  public:
-  explicit DumpApkCommand(const std::string&& name, text::Printer* printer, IDiagnostics* diag)
+  explicit DumpApkCommand(const std::string&& name, text::Printer* printer,
+                          android::IDiagnostics* diag)
       : Command(name), printer_(printer), diag_(diag) {
-        SetDescription("Dump information about an APK or APC.");
+    SetDescription("Dump information about an APK or APC.");
   }
 
   text::Printer* GetPrinter() {
     return printer_;
   }
 
-  IDiagnostics* GetDiagnostics() {
+  android::IDiagnostics* GetDiagnostics() {
     return diag_;
   }
 
   std::optional<std::string> GetPackageName(LoadedApk* apk) {
     xml::Element* manifest_el = apk->GetManifest()->root.get();
     if (!manifest_el) {
-      GetDiagnostics()->Error(DiagMessage() << "No AndroidManifest.");
+      GetDiagnostics()->Error(android::DiagMessage() << "No AndroidManifest.");
       return {};
     }
 
     xml::Attribute* attr = manifest_el->FindAttribute({}, "package");
     if (!attr) {
-      GetDiagnostics()->Error(DiagMessage() << "No package name.");
+      GetDiagnostics()->Error(android::DiagMessage() << "No package name.");
       return {};
     }
     return attr->value;
@@ -66,7 +67,7 @@
 
   int Action(const std::vector<std::string>& args) final {
     if (args.size() < 1) {
-      diag_->Error(DiagMessage() << "No dump apk specified.");
+      diag_->Error(android::DiagMessage() << "No dump apk specified.");
       return 1;
     }
 
@@ -86,13 +87,13 @@
 
  private:
   text::Printer* printer_;
-  IDiagnostics* diag_;
+  android::IDiagnostics* diag_;
 };
 
 /** Command that prints contents of files generated from the compilation stage. */
 class DumpAPCCommand : public Command {
  public:
-  explicit DumpAPCCommand(text::Printer* printer, IDiagnostics* diag)
+  explicit DumpAPCCommand(text::Printer* printer, android::IDiagnostics* diag)
       : Command("apc"), printer_(printer), diag_(diag) {
     SetDescription("Print the contents of the AAPT2 Container (APC) generated fom compilation.");
     AddOptionalSwitch("--no-values", "Suppresses output of values when displaying resource tables.",
@@ -104,7 +105,7 @@
 
  private:
   text::Printer* printer_;
-  IDiagnostics* diag_;
+  android::IDiagnostics* diag_;
   bool no_values_ = false;
   bool verbose_ = false;
 };
@@ -124,7 +125,7 @@
 
 class DumpBadgingCommand : public DumpApkCommand {
  public:
-  explicit DumpBadgingCommand(text::Printer* printer, IDiagnostics* diag)
+  explicit DumpBadgingCommand(text::Printer* printer, android::IDiagnostics* diag)
       : DumpApkCommand("badging", printer, diag) {
     SetDescription("Print information extracted from the manifest of the APK.");
     AddOptionalSwitch("--include-meta-data", "Include meta-data information.",
@@ -149,7 +150,7 @@
 
 class DumpConfigsCommand : public DumpApkCommand {
  public:
-  explicit DumpConfigsCommand(text::Printer* printer, IDiagnostics* diag)
+  explicit DumpConfigsCommand(text::Printer* printer, android::IDiagnostics* diag)
       : DumpApkCommand("configurations", printer, diag) {
     SetDescription("Print every configuration used by a resource in the APK.");
   }
@@ -159,7 +160,7 @@
 
 class DumpPackageNameCommand : public DumpApkCommand {
  public:
-  explicit DumpPackageNameCommand(text::Printer* printer, IDiagnostics* diag)
+  explicit DumpPackageNameCommand(text::Printer* printer, android::IDiagnostics* diag)
       : DumpApkCommand("packagename", printer, diag) {
     SetDescription("Print the package name of the APK.");
   }
@@ -169,7 +170,7 @@
 
 class DumpPermissionsCommand : public DumpApkCommand {
  public:
-  explicit DumpPermissionsCommand(text::Printer* printer, IDiagnostics* diag)
+  explicit DumpPermissionsCommand(text::Printer* printer, android::IDiagnostics* diag)
       : DumpApkCommand("permissions", printer, diag) {
     SetDescription("Print the permissions extracted from the manifest of the APK.");
   }
@@ -183,7 +184,7 @@
 
 class DumpStringsCommand : public DumpApkCommand {
  public:
-  explicit DumpStringsCommand(text::Printer* printer, IDiagnostics* diag)
+  explicit DumpStringsCommand(text::Printer* printer, android::IDiagnostics* diag)
       : DumpApkCommand("strings", printer, diag) {
     SetDescription("Print the contents of the resource table string pool in the APK.");
   }
@@ -194,7 +195,7 @@
 /** Prints the graph of parents of a style in an APK. */
 class DumpStyleParentCommand : public DumpApkCommand {
  public:
-  explicit DumpStyleParentCommand(text::Printer* printer, IDiagnostics* diag)
+  explicit DumpStyleParentCommand(text::Printer* printer, android::IDiagnostics* diag)
       : DumpApkCommand("styleparents", printer, diag) {
     SetDescription("Print the parents of a style in an APK.");
     AddRequiredFlag("--style", "The name of the style to print", &style_);
@@ -208,7 +209,7 @@
 
 class DumpTableCommand : public DumpApkCommand {
  public:
-  explicit DumpTableCommand(text::Printer* printer, IDiagnostics* diag)
+  explicit DumpTableCommand(text::Printer* printer, android::IDiagnostics* diag)
       : DumpApkCommand("resources", printer, diag) {
     SetDescription("Print the contents of the resource table from the APK.");
     AddOptionalSwitch("--no-values", "Suppresses output of values when displaying resource tables.",
@@ -225,7 +226,7 @@
 
 class DumpXmlStringsCommand : public DumpApkCommand {
  public:
-  explicit DumpXmlStringsCommand(text::Printer* printer, IDiagnostics* diag)
+  explicit DumpXmlStringsCommand(text::Printer* printer, android::IDiagnostics* diag)
       : DumpApkCommand("xmlstrings", printer, diag) {
     SetDescription("Print the string pool of a compiled xml in an APK.");
     AddRequiredFlagList("--file", "A compiled xml file to print", &files_);
@@ -239,7 +240,8 @@
 
 class DumpChunks : public DumpApkCommand {
  public:
-  DumpChunks(text::Printer* printer, IDiagnostics* diag) : DumpApkCommand("chunks", printer, diag) {
+  DumpChunks(text::Printer* printer, android::IDiagnostics* diag)
+      : DumpApkCommand("chunks", printer, diag) {
     SetDescription("Print the chunk information of the compiled resources.arsc in the APK.");
   }
 
@@ -249,7 +251,7 @@
 /** Prints the tree of a compiled xml in an APK. */
 class DumpXmlTreeCommand : public DumpApkCommand {
  public:
-  explicit DumpXmlTreeCommand(text::Printer* printer, IDiagnostics* diag)
+  explicit DumpXmlTreeCommand(text::Printer* printer, android::IDiagnostics* diag)
       : DumpApkCommand("xmltree", printer, diag) {
     SetDescription("Print the tree of a compiled xml in an APK.");
     AddRequiredFlagList("--file", "A compiled xml file to print", &files_);
@@ -263,7 +265,7 @@
 
 class DumpOverlayableCommand : public DumpApkCommand {
  public:
-  explicit DumpOverlayableCommand(text::Printer* printer, IDiagnostics* diag)
+  explicit DumpOverlayableCommand(text::Printer* printer, android::IDiagnostics* diag)
       : DumpApkCommand("overlayable", printer, diag) {
     SetDescription("Print the <overlayable> resources of an APK.");
   }
@@ -274,7 +276,7 @@
 /** The default dump command. Performs no action because a subcommand is required. */
 class DumpCommand : public Command {
  public:
-  explicit DumpCommand(text::Printer* printer, IDiagnostics* diag)
+  explicit DumpCommand(text::Printer* printer, android::IDiagnostics* diag)
       : Command("dump", "d"), diag_(diag) {
     AddOptionalSubcommand(util::make_unique<DumpAPCCommand>(printer, diag_));
     AddOptionalSubcommand(util::make_unique<DumpBadgingCommand>(printer, diag_));
@@ -293,16 +295,16 @@
 
   int Action(const std::vector<std::string>& args) override {
     if (args.size() == 0) {
-      diag_->Error(DiagMessage() << "no subcommand specified");
+      diag_->Error(android::DiagMessage() << "no subcommand specified");
     } else {
-      diag_->Error(DiagMessage() << "unknown subcommand '" << args[0] << "'");
+      diag_->Error(android::DiagMessage() << "unknown subcommand '" << args[0] << "'");
     }
     Usage(&std::cerr);
     return 1;
   }
 
  private:
-  IDiagnostics* diag_;
+  android::IDiagnostics* diag_;
 };
 
 }  // namespace aapt
diff --git a/tools/aapt2/cmd/Dump_test.cpp b/tools/aapt2/cmd/Dump_test.cpp
index d018882..03da364 100644
--- a/tools/aapt2/cmd/Dump_test.cpp
+++ b/tools/aapt2/cmd/Dump_test.cpp
@@ -30,12 +30,7 @@
 
 using DumpTest = CommandTestFixture;
 
-class NoopDiagnostics : public IDiagnostics {
- public:
-  void Log(Level level, DiagMessageActual& actualMsg) override {
-  }
-};
-static NoopDiagnostics noop_diag;
+static android::NoOpDiagnostics noop_diag;
 
 void DumpBadgingToString(LoadedApk* loaded_apk, std::string* output, bool include_meta_data = false,
                          bool only_permissions = false) {
@@ -97,4 +92,4 @@
   ASSERT_EQ(output, expected);
 }
 
-}  // namespace aapt
\ No newline at end of file
+}  // namespace aapt
diff --git a/tools/aapt2/cmd/Link.cpp b/tools/aapt2/cmd/Link.cpp
index bd74cc7..82f2e8f 100644
--- a/tools/aapt2/cmd/Link.cpp
+++ b/tools/aapt2/cmd/Link.cpp
@@ -17,20 +17,13 @@
 #include "Link.h"
 
 #include <sys/stat.h>
-#include <cinttypes>
 
 #include <algorithm>
+#include <cinttypes>
 #include <queue>
 #include <unordered_map>
 #include <vector>
 
-#include "android-base/errors.h"
-#include "android-base/expected.h"
-#include "android-base/file.h"
-#include "android-base/stringprintf.h"
-#include "androidfw/Locale.h"
-#include "androidfw/StringPiece.h"
-
 #include "AppInfo.h"
 #include "Debug.h"
 #include "LoadedApk.h"
@@ -38,6 +31,13 @@
 #include "ResourceUtils.h"
 #include "ResourceValues.h"
 #include "ValueVisitor.h"
+#include "android-base/errors.h"
+#include "android-base/expected.h"
+#include "android-base/file.h"
+#include "android-base/stringprintf.h"
+#include "androidfw/IDiagnostics.h"
+#include "androidfw/Locale.h"
+#include "androidfw/StringPiece.h"
 #include "cmd/Util.h"
 #include "compile/IdAssigner.h"
 #include "compile/XmlIdCollector.h"
@@ -98,7 +98,7 @@
 
 class LinkContext : public IAaptContext {
  public:
-  explicit LinkContext(IDiagnostics* diagnostics)
+  explicit LinkContext(android::IDiagnostics* diagnostics)
       : diagnostics_(diagnostics), name_mangler_({}), symbols_(&name_mangler_) {
   }
 
@@ -110,7 +110,7 @@
     package_type_ = type;
   }
 
-  IDiagnostics* GetDiagnostics() override {
+  android::IDiagnostics* GetDiagnostics() override {
     return diagnostics_;
   }
 
@@ -170,7 +170,7 @@
   DISALLOW_COPY_AND_ASSIGN(LinkContext);
 
   PackageType package_type_ = PackageType::kApp;
-  IDiagnostics* diagnostics_;
+  android::IDiagnostics* diagnostics_;
   NameMangler name_mangler_;
   std::string compilation_package_;
   uint8_t package_id_ = 0x0;
@@ -216,14 +216,16 @@
         // Check that this doesn't overlap another resource.
         if (DefaultSymbolTableDelegate::FindById(rewritten_id, sources) != nullptr) {
           // The ID overlaps, so log a message (since this is a weird failure) and fail.
-          context_->GetDiagnostics()->Error(DiagMessage() << "Failed to rewrite " << name
-                                                          << " for pre-O feature split support");
+          context_->GetDiagnostics()->Error(android::DiagMessage()
+                                            << "Failed to rewrite " << name
+                                            << " for pre-O feature split support");
           return {};
         }
 
         if (context_->IsVerbose()) {
-          context_->GetDiagnostics()->Note(DiagMessage() << "rewriting " << name << " (" << *id
-                                                         << ") -> (" << rewritten_id << ")");
+          context_->GetDiagnostics()->Note(android::DiagMessage()
+                                           << "rewriting " << name << " (" << *id << ") -> ("
+                                           << rewritten_id << ")");
         }
 
         *id = rewritten_id;
@@ -243,14 +245,14 @@
                        OutputFormat format, IArchiveWriter* writer) {
   TRACE_CALL();
   if (context->IsVerbose()) {
-    context->GetDiagnostics()->Note(DiagMessage(path) << "writing to archive (keep_raw_values="
-                                                      << (keep_raw_values ? "true" : "false")
-                                                      << ")");
+    context->GetDiagnostics()->Note(android::DiagMessage(path)
+                                    << "writing to archive (keep_raw_values="
+                                    << (keep_raw_values ? "true" : "false") << ")");
   }
 
   switch (format) {
     case OutputFormat::kApk: {
-      BigBuffer buffer(1024);
+      android::BigBuffer buffer(1024);
       XmlFlattenerOptions options = {};
       options.keep_raw_values = keep_raw_values;
       options.use_utf16 = utf16;
@@ -278,14 +280,15 @@
 }
 
 // Inflates an XML file from the source path.
-static std::unique_ptr<xml::XmlResource> LoadXml(const std::string& path, IDiagnostics* diag) {
+static std::unique_ptr<xml::XmlResource> LoadXml(const std::string& path,
+                                                 android::IDiagnostics* diag) {
   TRACE_CALL();
   FileInputStream fin(path);
   if (fin.HadError()) {
-    diag->Error(DiagMessage(path) << "failed to load XML file: " << fin.GetError());
+    diag->Error(android::DiagMessage(path) << "failed to load XML file: " << fin.GetError());
     return {};
   }
-  return xml::Inflate(&fin, diag, Source(path));
+  return xml::Inflate(&fin, diag, android::Source(path));
 }
 
 struct ResourceFileFlattenerOptions {
@@ -451,10 +454,10 @@
     ResourceTable* table, FileOperation* file_op) {
   TRACE_CALL();
   xml::XmlResource* doc = file_op->xml_to_flatten.get();
-  const Source& src = doc->file.source;
+  const android::Source& src = doc->file.source;
 
   if (context_->IsVerbose()) {
-    context_->GetDiagnostics()->Note(DiagMessage()
+    context_->GetDiagnostics()->Note(android::DiagMessage()
                                      << "linking " << src.path << " (" << doc->file.name << ")");
   }
 
@@ -545,7 +548,7 @@
 
           io::IFile* file = file_ref->file;
           if (!file) {
-            context_->GetDiagnostics()->Error(DiagMessage(file_ref->GetSource())
+            context_->GetDiagnostics()->Error(android::DiagMessage(file_ref->GetSource())
                                               << "file not found");
             return false;
           }
@@ -561,7 +564,7 @@
                file_ref->type == ResourceFile::Type::kProtoXml)) {
             std::unique_ptr<io::IData> data = file->OpenAsData();
             if (!data) {
-              context_->GetDiagnostics()->Error(DiagMessage(file->GetSource())
+              context_->GetDiagnostics()->Error(android::DiagMessage(file->GetSource())
                                                 << "failed to open file");
               return false;
             }
@@ -569,7 +572,7 @@
             if (file_ref->type == ResourceFile::Type::kProtoXml) {
               pb::XmlNode pb_xml_node;
               if (!pb_xml_node.ParseFromArray(data->data(), static_cast<int>(data->size()))) {
-                context_->GetDiagnostics()->Error(DiagMessage(file->GetSource())
+                context_->GetDiagnostics()->Error(android::DiagMessage(file->GetSource())
                                                   << "failed to parse proto XML");
                 return false;
               }
@@ -577,7 +580,7 @@
               std::string error;
               file_op.xml_to_flatten = DeserializeXmlResourceFromPb(pb_xml_node, &error);
               if (file_op.xml_to_flatten == nullptr) {
-                context_->GetDiagnostics()->Error(DiagMessage(file->GetSource())
+                context_->GetDiagnostics()->Error(android::DiagMessage(file->GetSource())
                                                   << "failed to deserialize proto XML: " << error);
                 return false;
               }
@@ -585,7 +588,7 @@
               std::string error_str;
               file_op.xml_to_flatten = xml::Inflate(data->data(), data->size(), &error_str);
               if (file_op.xml_to_flatten == nullptr) {
-                context_->GetDiagnostics()->Error(DiagMessage(file->GetSource())
+                context_->GetDiagnostics()->Error(android::DiagMessage(file->GetSource())
                                                   << "failed to parse binary XML: " << error_str);
                 return false;
               }
@@ -621,10 +624,10 @@
           if (drawable_entry != kDrawableVersions.end()) {
             if (drawable_entry->second > context_->GetMinSdkVersion()
                 && drawable_entry->second > config.sdkVersion) {
-              context_->GetDiagnostics()->Error(DiagMessage(file_op.xml_to_flatten->file.source)
-                                                    << "<" << drawable_entry->first << "> elements "
-                                                    << "require a sdk version of at least "
-                                                    << (int16_t) drawable_entry->second);
+              context_->GetDiagnostics()->Error(
+                  android::DiagMessage(file_op.xml_to_flatten->file.source)
+                  << "<" << drawable_entry->first << "> elements "
+                  << "require a sdk version of at least " << (int16_t)drawable_entry->second);
               error = true;
               continue;
             }
@@ -642,7 +645,7 @@
             if (doc->file.config != file_op.config) {
               // Only add the new versioned configurations.
               if (context_->IsVerbose()) {
-                context_->GetDiagnostics()->Note(DiagMessage(doc->file.source)
+                context_->GetDiagnostics()->Note(android::DiagMessage(doc->file.source)
                                                  << "auto-versioning resource from config '"
                                                  << config << "' -> '" << doc->file.config << "'");
               }
@@ -680,12 +683,12 @@
   return !error;
 }
 
-static bool WriteStableIdMapToPath(IDiagnostics* diag,
+static bool WriteStableIdMapToPath(android::IDiagnostics* diag,
                                    const std::unordered_map<ResourceName, ResourceId>& id_map,
                                    const std::string& id_map_path) {
   io::FileOutputStream fout(id_map_path);
   if (fout.HadError()) {
-    diag->Error(DiagMessage(id_map_path) << "failed to open: " << fout.GetError());
+    diag->Error(android::DiagMessage(id_map_path) << "failed to open: " << fout.GetError());
     return false;
   }
 
@@ -700,17 +703,17 @@
   fout.Flush();
 
   if (fout.HadError()) {
-    diag->Error(DiagMessage(id_map_path) << "failed writing to file: " << fout.GetError());
+    diag->Error(android::DiagMessage(id_map_path) << "failed writing to file: " << fout.GetError());
     return false;
   }
   return true;
 }
 
-static bool LoadStableIdMap(IDiagnostics* diag, const std::string& path,
+static bool LoadStableIdMap(android::IDiagnostics* diag, const std::string& path,
                             std::unordered_map<ResourceName, ResourceId>* out_id_map) {
   std::string content;
   if (!android::base::ReadFileToString(path, &content, true /*follow_symlinks*/)) {
-    diag->Error(DiagMessage(path) << "failed reading stable ID file");
+    diag->Error(android::DiagMessage(path) << "failed reading stable ID file");
     return false;
   }
 
@@ -725,7 +728,7 @@
 
     auto iter = std::find(line.begin(), line.end(), '=');
     if (iter == line.end()) {
-      diag->Error(DiagMessage(Source(path, line_no)) << "missing '='");
+      diag->Error(android::DiagMessage(android::Source(path, line_no)) << "missing '='");
       return false;
     }
 
@@ -733,8 +736,8 @@
     StringPiece res_name_str =
         util::TrimWhitespace(line.substr(0, std::distance(line.begin(), iter)));
     if (!ResourceUtils::ParseResourceName(res_name_str, &name)) {
-      diag->Error(DiagMessage(Source(path, line_no)) << "invalid resource name '" << res_name_str
-                                                     << "'");
+      diag->Error(android::DiagMessage(android::Source(path, line_no))
+                  << "invalid resource name '" << res_name_str << "'");
       return false;
     }
 
@@ -744,8 +747,8 @@
 
     std::optional<ResourceId> maybe_id = ResourceUtils::ParseResourceId(res_id_str);
     if (!maybe_id) {
-      diag->Error(DiagMessage(Source(path, line_no)) << "invalid resource ID '" << res_id_str
-                                                     << "'");
+      diag->Error(android::DiagMessage(android::Source(path, line_no))
+                  << "invalid resource ID '" << res_id_str << "'");
       return false;
     }
 
@@ -835,20 +838,21 @@
     auto asset_source = util::make_unique<AssetManagerSymbolSource>();
     for (const std::string& path : options_.include_paths) {
       if (context_->IsVerbose()) {
-        context_->GetDiagnostics()->Note(DiagMessage() << "including " << path);
+        context_->GetDiagnostics()->Note(android::DiagMessage() << "including " << path);
       }
 
       std::string error;
       auto zip_collection = io::ZipFileCollection::Create(path, &error);
       if (zip_collection == nullptr) {
-        context_->GetDiagnostics()->Error(DiagMessage() << "failed to open APK: " << error);
+        context_->GetDiagnostics()->Error(android::DiagMessage()
+                                          << "failed to open APK: " << error);
         return false;
       }
 
       if (zip_collection->FindFile(kProtoResourceTablePath) != nullptr) {
         // Load this as a static library include.
         std::unique_ptr<LoadedApk> static_apk = LoadedApk::LoadProtoApkFromFileCollection(
-            Source(path), std::move(zip_collection), context_->GetDiagnostics());
+            android::Source(path), std::move(zip_collection), context_->GetDiagnostics());
         if (static_apk == nullptr) {
           return false;
         }
@@ -857,7 +861,8 @@
           // Can't include static libraries when not building a static library (they have no IDs
           // assigned).
           context_->GetDiagnostics()->Error(
-              DiagMessage(path) << "can't include static library when not building a static lib");
+              android::DiagMessage(path)
+              << "can't include static library when not building a static lib");
           return false;
         }
 
@@ -869,7 +874,8 @@
         if (options_.no_static_lib_packages && !table->packages.empty()) {
           auto lib_package_result = GetStaticLibraryPackage(table);
           if (!lib_package_result.has_value()) {
-            context_->GetDiagnostics()->Error(DiagMessage(path) << lib_package_result.error());
+            context_->GetDiagnostics()->Error(android::DiagMessage(path)
+                                              << lib_package_result.error());
             return false;
           }
           lib_package_result.value()->name = context_->GetCompilationPackage();
@@ -880,7 +886,7 @@
         static_library_includes_.push_back(std::move(static_apk));
       } else {
         if (!asset_source->AddAssetPath(path)) {
-          context_->GetDiagnostics()->Error(DiagMessage()
+          context_->GetDiagnostics()->Error(android::DiagMessage()
                                             << "failed to load include path " << path);
           return false;
         }
@@ -913,7 +919,8 @@
     return true;
   }
 
-  std::optional<AppInfo> ExtractAppInfoFromManifest(xml::XmlResource* xml_res, IDiagnostics* diag) {
+  std::optional<AppInfo> ExtractAppInfoFromManifest(xml::XmlResource* xml_res,
+                                                    android::IDiagnostics* diag) {
     TRACE_CALL();
     // Make sure the first element is <manifest> with package attribute.
     xml::Element* manifest_el = xml::FindRootElement(xml_res->root.get());
@@ -924,13 +931,13 @@
     AppInfo app_info;
 
     if (!manifest_el->namespace_uri.empty() || manifest_el->name != "manifest") {
-      diag->Error(DiagMessage(xml_res->file.source) << "root tag must be <manifest>");
+      diag->Error(android::DiagMessage(xml_res->file.source) << "root tag must be <manifest>");
       return {};
     }
 
     xml::Attribute* package_attr = manifest_el->FindAttribute({}, "package");
     if (!package_attr) {
-      diag->Error(DiagMessage(xml_res->file.source)
+      diag->Error(android::DiagMessage(xml_res->file.source)
                   << "<manifest> must have a 'package' attribute");
       return {};
     }
@@ -940,7 +947,7 @@
             manifest_el->FindAttribute(xml::kSchemaAndroid, "versionCode")) {
       std::optional<uint32_t> maybe_code = ResourceUtils::ParseInt(version_code_attr->value);
       if (!maybe_code) {
-        diag->Error(DiagMessage(xml_res->file.source.WithLine(manifest_el->line_number))
+        diag->Error(android::DiagMessage(xml_res->file.source.WithLine(manifest_el->line_number))
                     << "invalid android:versionCode '" << version_code_attr->value << "'");
         return {};
       }
@@ -951,9 +958,9 @@
         manifest_el->FindAttribute(xml::kSchemaAndroid, "versionCodeMajor")) {
       std::optional<uint32_t> maybe_code = ResourceUtils::ParseInt(version_code_major_attr->value);
       if (!maybe_code) {
-        diag->Error(DiagMessage(xml_res->file.source.WithLine(manifest_el->line_number))
-                        << "invalid android:versionCodeMajor '"
-                        << version_code_major_attr->value << "'");
+        diag->Error(android::DiagMessage(xml_res->file.source.WithLine(manifest_el->line_number))
+                    << "invalid android:versionCodeMajor '" << version_code_major_attr->value
+                    << "'");
         return {};
       }
       app_info.version_code_major = maybe_code.value();
@@ -963,7 +970,7 @@
             manifest_el->FindAttribute(xml::kSchemaAndroid, "revisionCode")) {
       std::optional<uint32_t> maybe_code = ResourceUtils::ParseInt(revision_code_attr->value);
       if (!maybe_code) {
-        diag->Error(DiagMessage(xml_res->file.source.WithLine(manifest_el->line_number))
+        diag->Error(android::DiagMessage(xml_res->file.source.WithLine(manifest_el->line_number))
                     << "invalid android:revisionCode '" << revision_code_attr->value << "'");
         return {};
       }
@@ -1016,15 +1023,15 @@
               // Special case the occurrence of an ID that is being generated
               // for the 'android' package. This is due to legacy reasons.
               if (ValueCast<Id>(config_value->value.get()) && package->name == "android") {
-                context_->GetDiagnostics()->Warn(DiagMessage(config_value->value->GetSource())
-                                                 << "generated id '" << res_name
-                                                 << "' for external package '" << package->name
-                                                 << "'");
+                context_->GetDiagnostics()->Warn(
+                    android::DiagMessage(config_value->value->GetSource())
+                    << "generated id '" << res_name << "' for external package '" << package->name
+                    << "'");
               } else {
-                context_->GetDiagnostics()->Error(DiagMessage(config_value->value->GetSource())
-                                                  << "defined resource '" << res_name
-                                                  << "' for external package '" << package->name
-                                                  << "'");
+                context_->GetDiagnostics()->Error(
+                    android::DiagMessage(config_value->value->GetSource())
+                    << "defined resource '" << res_name << "' for external package '"
+                    << package->name << "'");
                 error = true;
               }
             }
@@ -1048,8 +1055,9 @@
         for (const auto& entry : type->entries) {
           if (entry->id) {
             ResourceNameRef res_name(package->name, type->named_type, entry->name);
-            context_->GetDiagnostics()->Error(DiagMessage() << "resource " << res_name << " has ID "
-                                                            << entry->id.value() << " assigned");
+            context_->GetDiagnostics()->Error(android::DiagMessage()
+                                              << "resource " << res_name << " has ID "
+                                              << entry->id.value() << " assigned");
             return false;
           }
         }
@@ -1058,7 +1066,7 @@
     return true;
   }
 
-  bool VerifyLocaleFormat(xml::XmlResource* manifest, IDiagnostics* diag) {
+  bool VerifyLocaleFormat(xml::XmlResource* manifest, android::IDiagnostics* diag) {
     // Skip it if the Manifest doesn't declare the localeConfig attribute within the <application>
     // element.
     const xml::Element* application = manifest->root->FindChild("", "application");
@@ -1084,18 +1092,19 @@
         const std::string& path = value->value->GetSource().path;
         std::unique_ptr<xml::XmlResource> localeConfig_xml = LoadXml(path, diag);
         if (!localeConfig_xml) {
-          diag->Error(DiagMessage(path) << "can't load the XML");
+          diag->Error(android::DiagMessage(path) << "can't load the XML");
           return false;
         }
 
         xml::Element* localeConfig_el = xml::FindRootElement(localeConfig_xml->root.get());
         if (!localeConfig_el) {
-          diag->Error(DiagMessage(path) << "no root tag defined");
+          diag->Error(android::DiagMessage(path) << "no root tag defined");
           return false;
         }
         if (localeConfig_el->name != "locale-config") {
-          diag->Error(DiagMessage(path) << "invalid element name: " << localeConfig_el->name
-                                        << ", expected: locale-config");
+          diag->Error(android::DiagMessage(path)
+                      << "invalid element name: " << localeConfig_el->name
+                      << ", expected: locale-config");
           return false;
         }
 
@@ -1109,15 +1118,15 @@
               // Start to verify the locale format
               ConfigDescription config;
               if (!ConfigDescription::Parse(valid_name, &config)) {
-                diag->Error(DiagMessage(path) << "invalid configuration: " << locale_name);
+                diag->Error(android::DiagMessage(path) << "invalid configuration: " << locale_name);
                 return false;
               }
             } else {
-              diag->Error(DiagMessage(path) << "the attribute android:name is not found");
+              diag->Error(android::DiagMessage(path) << "the attribute android:name is not found");
               return false;
             }
           } else {
-            diag->Error(DiagMessage(path)
+            diag->Error(android::DiagMessage(path)
                         << "invalid element name: " << child_el->name << ", expected: locale");
             return false;
           }
@@ -1147,10 +1156,11 @@
     TRACE_CALL();
     switch (format) {
       case OutputFormat::kApk: {
-        BigBuffer buffer(1024);
+        android::BigBuffer buffer(1024);
         TableFlattener flattener(options_.table_flattener_options, &buffer);
         if (!flattener.Consume(context_, table)) {
-          context_->GetDiagnostics()->Error(DiagMessage() << "failed to flatten resource table");
+          context_->GetDiagnostics()->Error(android::DiagMessage()
+                                            << "failed to flatten resource table");
           return false;
         }
 
@@ -1183,7 +1193,7 @@
       out_path = options_.generate_java_class_path.value();
       file::AppendPath(&out_path, file::PackageToPath(out_package));
       if (!file::mkdirs(out_path)) {
-        context_->GetDiagnostics()->Error(DiagMessage()
+        context_->GetDiagnostics()->Error(android::DiagMessage()
                                           << "failed to create directory '" << out_path << "'");
         return false;
       }
@@ -1192,8 +1202,9 @@
 
       fout = util::make_unique<io::FileOutputStream>(out_path);
       if (fout->HadError()) {
-        context_->GetDiagnostics()->Error(DiagMessage() << "failed writing to '" << out_path
-                                                        << "': " << fout->GetError());
+        context_->GetDiagnostics()->Error(android::DiagMessage()
+                                          << "failed writing to '" << out_path
+                                          << "': " << fout->GetError());
         return false;
       }
     }
@@ -1202,7 +1213,7 @@
     if (out_text_symbols_path) {
       fout_text = util::make_unique<io::FileOutputStream>(out_text_symbols_path.value());
       if (fout_text->HadError()) {
-        context_->GetDiagnostics()->Error(DiagMessage()
+        context_->GetDiagnostics()->Error(android::DiagMessage()
                                           << "failed writing to '" << out_text_symbols_path.value()
                                           << "': " << fout_text->GetError());
         return false;
@@ -1211,7 +1222,7 @@
 
     JavaClassGenerator generator(context_, table, java_options);
     if (!generator.Generate(package_name_to_generate, out_package, fout.get(), fout_text.get())) {
-      context_->GetDiagnostics()->Error(DiagMessage(out_path) << generator.GetError());
+      context_->GetDiagnostics()->Error(android::DiagMessage(out_path) << generator.GetError());
       return false;
     }
 
@@ -1335,8 +1346,8 @@
     file::AppendPath(&out_path, file::PackageToPath(package_utf8));
 
     if (!file::mkdirs(out_path)) {
-      context_->GetDiagnostics()->Error(DiagMessage() << "failed to create directory '" << out_path
-                                                      << "'");
+      context_->GetDiagnostics()->Error(android::DiagMessage()
+                                        << "failed to create directory '" << out_path << "'");
       return false;
     }
 
@@ -1344,8 +1355,8 @@
 
     io::FileOutputStream fout(out_path);
     if (fout.HadError()) {
-      context_->GetDiagnostics()->Error(DiagMessage() << "failed to open '" << out_path
-                                                      << "': " << fout.GetError());
+      context_->GetDiagnostics()->Error(android::DiagMessage() << "failed to open '" << out_path
+                                                               << "': " << fout.GetError());
       return false;
     }
 
@@ -1354,8 +1365,8 @@
     fout.Flush();
 
     if (fout.HadError()) {
-      context_->GetDiagnostics()->Error(DiagMessage() << "failed writing to '" << out_path
-                                                      << "': " << fout.GetError());
+      context_->GetDiagnostics()->Error(android::DiagMessage() << "failed writing to '" << out_path
+                                                               << "': " << fout.GetError());
       return false;
     }
     return true;
@@ -1370,8 +1381,8 @@
     const std::string& out_path = out.value();
     io::FileOutputStream fout(out_path);
     if (fout.HadError()) {
-      context_->GetDiagnostics()->Error(DiagMessage() << "failed to open '" << out_path
-                                                      << "': " << fout.GetError());
+      context_->GetDiagnostics()->Error(android::DiagMessage() << "failed to open '" << out_path
+                                                               << "': " << fout.GetError());
       return false;
     }
 
@@ -1380,8 +1391,8 @@
     fout.Flush();
 
     if (fout.HadError()) {
-      context_->GetDiagnostics()->Error(DiagMessage() << "failed writing to '" << out_path
-                                                      << "': " << fout.GetError());
+      context_->GetDiagnostics()->Error(android::DiagMessage() << "failed writing to '" << out_path
+                                                               << "': " << fout.GetError());
       return false;
     }
     return true;
@@ -1390,12 +1401,13 @@
   bool MergeStaticLibrary(const std::string& input, bool override) {
     TRACE_CALL();
     if (context_->IsVerbose()) {
-      context_->GetDiagnostics()->Note(DiagMessage() << "merging static library " << input);
+      context_->GetDiagnostics()->Note(android::DiagMessage()
+                                       << "merging static library " << input);
     }
 
     std::unique_ptr<LoadedApk> apk = LoadedApk::LoadApkFromPath(input, context_->GetDiagnostics());
     if (apk == nullptr) {
-      context_->GetDiagnostics()->Error(DiagMessage(input) << "invalid static library");
+      context_->GetDiagnostics()->Error(android::DiagMessage(input) << "invalid static library");
       return false;
     }
 
@@ -1406,7 +1418,7 @@
 
     auto lib_package_result = GetStaticLibraryPackage(table);
     if (!lib_package_result.has_value()) {
-      context_->GetDiagnostics()->Error(DiagMessage(input) << lib_package_result.error());
+      context_->GetDiagnostics()->Error(android::DiagMessage(input) << lib_package_result.error());
       return false;
     }
 
@@ -1425,12 +1437,12 @@
       // Clear the package name, so as to make the resources look like they are coming from the
       // local package.
       pkg->name = "";
-      result = table_merger_->Merge(Source(input), table, override);
+      result = table_merger_->Merge(android::Source(input), table, override);
 
     } else {
       // This is the proper way to merge libraries, where the package name is
       // preserved and resource names are mangled.
-      result = table_merger_->MergeAndMangle(Source(input), pkg->name, table);
+      result = table_merger_->MergeAndMangle(android::Source(input), pkg->name, table);
     }
 
     if (!result) {
@@ -1442,7 +1454,7 @@
     return true;
   }
 
-  bool MergeExportedSymbols(const Source& source,
+  bool MergeExportedSymbols(const android::Source& source,
                             const std::vector<SourcedResourceName>& exported_symbols) {
     TRACE_CALL();
     // Add the exports of this file to the table.
@@ -1472,7 +1484,7 @@
   bool MergeCompiledFile(const ResourceFile& compiled_file, io::IFile* file, bool override) {
     TRACE_CALL();
     if (context_->IsVerbose()) {
-      context_->GetDiagnostics()->Note(DiagMessage()
+      context_->GetDiagnostics()->Note(android::DiagMessage()
                                        << "merging '" << compiled_file.name
                                        << "' from compiled file " << compiled_file.source);
     }
@@ -1491,14 +1503,14 @@
   bool MergeArchive(const std::string& input, bool override) {
     TRACE_CALL();
     if (context_->IsVerbose()) {
-      context_->GetDiagnostics()->Note(DiagMessage() << "merging archive " << input);
+      context_->GetDiagnostics()->Note(android::DiagMessage() << "merging archive " << input);
     }
 
     std::string error_str;
     std::unique_ptr<io::ZipFileCollection> collection =
         io::ZipFileCollection::Create(input, &error_str);
     if (!collection) {
-      context_->GetDiagnostics()->Error(DiagMessage(input) << error_str);
+      context_->GetDiagnostics()->Error(android::DiagMessage(input) << error_str);
       return false;
     }
 
@@ -1538,31 +1550,32 @@
   // where we could have other files like classes.dex.
   bool MergeFile(io::IFile* file, bool override) {
     TRACE_CALL();
-    const Source& src = file->GetSource();
+    const android::Source& src = file->GetSource();
 
     if (util::EndsWith(src.path, ".xml") || util::EndsWith(src.path, ".png")) {
       // Since AAPT compiles these file types and appends .flat to them, seeing
       // their raw extensions is a sign that they weren't compiled.
       const StringPiece file_type = util::EndsWith(src.path, ".xml") ? "XML" : "PNG";
-      context_->GetDiagnostics()->Error(DiagMessage(src) << "uncompiled " << file_type
-                                                         << " file passed as argument. Must be "
-                                                            "compiled first into .flat file.");
+      context_->GetDiagnostics()->Error(android::DiagMessage(src)
+                                        << "uncompiled " << file_type
+                                        << " file passed as argument. Must be "
+                                           "compiled first into .flat file.");
       return false;
     } else if (!util::EndsWith(src.path, ".apc") && !util::EndsWith(src.path, ".flat")) {
       if (context_->IsVerbose()) {
-        context_->GetDiagnostics()->Warn(DiagMessage(src) << "ignoring unrecognized file");
+        context_->GetDiagnostics()->Warn(android::DiagMessage(src) << "ignoring unrecognized file");
         return true;
       }
     }
 
     std::unique_ptr<io::InputStream> input_stream = file->OpenInputStream();
     if (input_stream == nullptr) {
-      context_->GetDiagnostics()->Error(DiagMessage(src) << "failed to open file");
+      context_->GetDiagnostics()->Error(android::DiagMessage(src) << "failed to open file");
       return false;
     }
 
     if (input_stream->HadError()) {
-      context_->GetDiagnostics()->Error(DiagMessage(src)
+      context_->GetDiagnostics()->Error(android::DiagMessage(src)
                                         << "failed to open file: " << input_stream->GetError());
       return false;
     }
@@ -1571,7 +1584,7 @@
     ContainerReader reader(input_stream.get());
 
     if (reader.HadError()) {
-      context_->GetDiagnostics()->Error(DiagMessage(src)
+      context_->GetDiagnostics()->Error(android::DiagMessage(src)
                                         << "failed to read file: " << reader.GetError());
       return false;
     }
@@ -1581,21 +1594,22 @@
         TRACE_NAME(std::string("Process ResTable:") + file->GetSource().path);
         pb::ResourceTable pb_table;
         if (!entry->GetResTable(&pb_table)) {
-          context_->GetDiagnostics()->Error(DiagMessage(src) << "failed to read resource table: "
-                                                             << entry->GetError());
+          context_->GetDiagnostics()->Error(
+              android::DiagMessage(src) << "failed to read resource table: " << entry->GetError());
           return false;
         }
 
         ResourceTable table;
         std::string error;
         if (!DeserializeTableFromPb(pb_table, nullptr /*files*/, &table, &error)) {
-          context_->GetDiagnostics()->Error(DiagMessage(src)
+          context_->GetDiagnostics()->Error(android::DiagMessage(src)
                                             << "failed to deserialize resource table: " << error);
           return false;
         }
 
         if (!table_merger_->Merge(src, &table, override)) {
-          context_->GetDiagnostics()->Error(DiagMessage(src) << "failed to merge resource table");
+          context_->GetDiagnostics()->Error(android::DiagMessage(src)
+                                            << "failed to merge resource table");
           return false;
         }
       } else if (entry->Type() == ContainerEntryType::kResFile) {
@@ -1604,15 +1618,15 @@
         off64_t offset;
         size_t len;
         if (!entry->GetResFileOffsets(&pb_compiled_file, &offset, &len)) {
-          context_->GetDiagnostics()->Error(DiagMessage(src) << "failed to get resource file: "
-                                                             << entry->GetError());
+          context_->GetDiagnostics()->Error(
+              android::DiagMessage(src) << "failed to get resource file: " << entry->GetError());
           return false;
         }
 
         ResourceFile resource_file;
         std::string error;
         if (!DeserializeCompiledFileFromPb(pb_compiled_file, &resource_file, &error)) {
-          context_->GetDiagnostics()->Error(DiagMessage(src)
+          context_->GetDiagnostics()->Error(android::DiagMessage(src)
                                             << "failed to read compiled header: " << error);
           return false;
         }
@@ -1641,10 +1655,10 @@
 
         auto iter = merged_assets.find(full_key);
         if (iter == merged_assets.end()) {
-          merged_assets.emplace(std::move(full_key),
-                                util::make_unique<io::RegularFile>(Source(std::move(full_path))));
+          merged_assets.emplace(std::move(full_key), util::make_unique<io::RegularFile>(
+                                                         android::Source(std::move(full_path))));
         } else if (context_->IsVerbose()) {
-          context_->GetDiagnostics()->Warn(DiagMessage(iter->second->GetSource())
+          context_->GetDiagnostics()->Warn(android::DiagMessage(iter->second->GetSource())
                                            << "asset file overrides '" << full_path << "'");
         }
       }
@@ -1729,10 +1743,10 @@
         continue;
       }
 
-      context_->GetDiagnostics()->Note(DiagMessage() << "generating "
-                                                     << round_icon_reference->name.value()
-                                                     << " with config \"" << config_value->config
-                                                     << "\" for round icon compatibility");
+      context_->GetDiagnostics()->Note(android::DiagMessage()
+                                       << "generating " << round_icon_reference->name.value()
+                                       << " with config \"" << config_value->config
+                                       << "\" for round icon compatibility");
 
       CloningValueTransformer cloner(&table->string_pool);
       auto value = icon_reference->Transform(cloner);
@@ -1758,7 +1772,7 @@
       if (util::IsAndroidSharedUserId(context_->GetCompilationPackage(), shared_user_id)) {
         return true;
       }
-      DiagMessage error_msg(manifest_el->line_number);
+      android::DiagMessage error_msg(manifest_el->line_number);
       error_msg << "attribute 'sharedUserId' in <manifest> tag is not a valid shared user id: '"
                 << shared_user_id << "'";
       if (options_.manifest_fixer_options.warn_validation) {
@@ -1834,7 +1848,7 @@
 
     ResourceFileFlattener file_flattener(file_flattener_options, context_, keep_set);
     if (!file_flattener.Flatten(table, writer)) {
-      context_->GetDiagnostics()->Error(DiagMessage() << "failed linking file resources");
+      context_->GetDiagnostics()->Error(android::DiagMessage() << "failed linking file resources");
       return false;
     }
 
@@ -1865,8 +1879,8 @@
 
         if (context_->IsVerbose()) {
           context_->GetDiagnostics()->Note(
-              DiagMessage() << "rewriting resource package name for feature split to '"
-                            << new_package_name << "'");
+              android::DiagMessage() << "rewriting resource package name for feature split to '"
+                                     << new_package_name << "'");
         }
         package_to_rewrite->name = new_package_name;
       }
@@ -1886,7 +1900,7 @@
     }
 
     if (!success) {
-      context_->GetDiagnostics()->Error(DiagMessage() << "failed to write resource table");
+      context_->GetDiagnostics()->Error(android::DiagMessage() << "failed to write resource table");
     }
     return success;
   }
@@ -1947,7 +1961,7 @@
       // Verify we're building a regular app.
       if (context_->GetPackageType() != PackageType::kApp) {
         context_->GetDiagnostics()->Error(
-            DiagMessage() << "package 'android' can only be built as a regular app");
+            android::DiagMessage() << "package 'android' can only be built as a regular app");
         return 1;
       }
     }
@@ -1960,7 +1974,7 @@
     table_merger_ = util::make_unique<TableMerger>(context_, &final_table_, table_merger_options);
 
     if (context_->IsVerbose()) {
-      context_->GetDiagnostics()->Note(DiagMessage()
+      context_->GetDiagnostics()->Note(android::DiagMessage()
                                        << StringPrintf("linking package '%s' using package ID %02x",
                                                        context_->GetCompilationPackage().data(),
                                                        context_->GetPackageId()));
@@ -1981,14 +1995,14 @@
 
     for (const std::string& input : input_files) {
       if (!MergePath(input, false)) {
-        context_->GetDiagnostics()->Error(DiagMessage() << "failed parsing input");
+        context_->GetDiagnostics()->Error(android::DiagMessage() << "failed parsing input");
         return 1;
       }
     }
 
     for (const std::string& input : options_.overlay_files) {
       if (!MergePath(input, true)) {
-        context_->GetDiagnostics()->Error(DiagMessage() << "failed parsing overlays");
+        context_->GetDiagnostics()->Error(android::DiagMessage() << "failed parsing overlays");
         return 1;
       }
     }
@@ -2001,14 +2015,15 @@
       PrivateAttributeMover mover;
       if (context_->GetPackageId() == kAndroidPackageId &&
           !mover.Consume(context_, &final_table_)) {
-        context_->GetDiagnostics()->Error(DiagMessage() << "failed moving private attributes");
+        context_->GetDiagnostics()->Error(android::DiagMessage()
+                                          << "failed moving private attributes");
         return 1;
       }
 
       // Assign IDs if we are building a regular app.
       IdAssigner id_assigner(&options_.stable_id_map);
       if (!id_assigner.Consume(context_, &final_table_)) {
-        context_->GetDiagnostics()->Error(DiagMessage() << "failed assigning IDs");
+        context_->GetDiagnostics()->Error(android::DiagMessage() << "failed assigning IDs");
         return 1;
       }
 
@@ -2052,7 +2067,7 @@
     // are just identifiers.
     if (context_->GetMinSdkVersion() < SDK_O && context_->GetPackageType() == PackageType::kApp) {
       if (context_->IsVerbose()) {
-        context_->GetDiagnostics()->Note(DiagMessage()
+        context_->GetDiagnostics()->Note(android::DiagMessage()
                                          << "enabling pre-O feature split ID rewriting");
       }
       context_->GetExternalSymbols()->SetDelegate(
@@ -2063,7 +2078,7 @@
     // We want to force any references to these to fail the build.
     if (!options_.no_resource_removal) {
       if (!NoDefaultResourceRemover{}.Consume(context_, &final_table_)) {
-        context_->GetDiagnostics()->Error(DiagMessage()
+        context_->GetDiagnostics()->Error(android::DiagMessage()
                                           << "failed removing resources with no defaults");
         return 1;
       }
@@ -2071,19 +2086,19 @@
 
     ReferenceLinker linker;
     if (!options_.merge_only && !linker.Consume(context_, &final_table_)) {
-      context_->GetDiagnostics()->Error(DiagMessage() << "failed linking references");
+      context_->GetDiagnostics()->Error(android::DiagMessage() << "failed linking references");
       return 1;
     }
 
     if (context_->GetPackageType() == PackageType::kStaticLib) {
       if (!options_.products.empty()) {
-        context_->GetDiagnostics()->Warn(DiagMessage()
+        context_->GetDiagnostics()->Warn(android::DiagMessage()
                                          << "can't select products when building static library");
       }
     } else {
       ProductFilter product_filter(options_.products);
       if (!product_filter.Consume(context_, &final_table_)) {
-        context_->GetDiagnostics()->Error(DiagMessage() << "failed stripping products");
+        context_->GetDiagnostics()->Error(android::DiagMessage() << "failed stripping products");
         return 1;
       }
     }
@@ -2091,14 +2106,14 @@
     if (!options_.no_auto_version) {
       AutoVersioner versioner;
       if (!versioner.Consume(context_, &final_table_)) {
-        context_->GetDiagnostics()->Error(DiagMessage() << "failed versioning styles");
+        context_->GetDiagnostics()->Error(android::DiagMessage() << "failed versioning styles");
         return 1;
       }
     }
 
     if (context_->GetPackageType() != PackageType::kStaticLib && context_->GetMinSdkVersion() > 0) {
       if (context_->IsVerbose()) {
-        context_->GetDiagnostics()->Note(DiagMessage()
+        context_->GetDiagnostics()->Note(android::DiagMessage()
                                          << "collapsing resource versions for minimum SDK "
                                          << context_->GetMinSdkVersion());
       }
@@ -2117,9 +2132,8 @@
         ConfigDescription config_description;
 
         if (!ConfigDescription::Parse(config_string, &config_description)) {
-          context_->GetDiagnostics()->Error(DiagMessage()
-                                                << "failed to parse --excluded-configs "
-                                                << config_string);
+          context_->GetDiagnostics()->Error(
+              android::DiagMessage() << "failed to parse --excluded-configs " << config_string);
           return 1;
         }
 
@@ -2128,7 +2142,8 @@
 
       ResourceExcluder excluder(excluded_configs);
       if (!excluder.Consume(context_, &final_table_)) {
-        context_->GetDiagnostics()->Error(DiagMessage() << "failed excluding configurations");
+        context_->GetDiagnostics()->Error(android::DiagMessage()
+                                          << "failed excluding configurations");
         return 1;
       }
     }
@@ -2136,7 +2151,7 @@
     if (!options_.no_resource_deduping) {
       ResourceDeduper deduper;
       if (!deduper.Consume(context_, &final_table_)) {
-        context_->GetDiagnostics()->Error(DiagMessage() << "failed deduping resources");
+        context_->GetDiagnostics()->Error(android::DiagMessage() << "failed deduping resources");
         return 1;
       }
     }
@@ -2148,7 +2163,7 @@
     if (context_->GetPackageType() == PackageType::kStaticLib) {
       if (options_.table_splitter_options.config_filter != nullptr ||
           !options_.table_splitter_options.preferred_densities.empty()) {
-        context_->GetDiagnostics()->Warn(DiagMessage()
+        context_->GetDiagnostics()->Warn(android::DiagMessage()
                                          << "can't strip resources when building static library");
       }
     } else {
@@ -2159,7 +2174,7 @@
           AdjustSplitConstraintsForMinSdk(context_->GetMinSdkVersion(), options_.split_constraints);
 
       if (origConstraintSize != options_.split_constraints.size()) {
-        context_->GetDiagnostics()->Warn(DiagMessage()
+        context_->GetDiagnostics()->Warn(android::DiagMessage()
                                          << "requested to split resources prior to min sdk of "
                                          << context_->GetMinSdkVersion());
       }
@@ -2174,7 +2189,7 @@
       auto split_constraints_iter = options_.split_constraints.begin();
       for (std::unique_ptr<ResourceTable>& split_table : table_splitter.splits()) {
         if (context_->IsVerbose()) {
-          context_->GetDiagnostics()->Note(DiagMessage(*path_iter)
+          context_->GetDiagnostics()->Note(android::DiagMessage(*path_iter)
                                            << "generating split with configurations '"
                                            << util::Joiner(split_constraints_iter->configs, ", ")
                                            << "'");
@@ -2182,7 +2197,7 @@
 
         std::unique_ptr<IArchiveWriter> archive_writer = MakeArchiveWriter(*path_iter);
         if (!archive_writer) {
-          context_->GetDiagnostics()->Error(DiagMessage() << "failed to create archive");
+          context_->GetDiagnostics()->Error(android::DiagMessage() << "failed to create archive");
           return 1;
         }
 
@@ -2192,7 +2207,7 @@
 
         XmlReferenceLinker linker(&final_table_);
         if (!linker.Consume(context_, split_manifest.get())) {
-          context_->GetDiagnostics()->Error(DiagMessage()
+          context_->GetDiagnostics()->Error(android::DiagMessage()
                                             << "failed to create Split AndroidManifest.xml");
           return 1;
         }
@@ -2210,7 +2225,7 @@
     // Start writing the base APK.
     std::unique_ptr<IArchiveWriter> archive_writer = MakeArchiveWriter(options_.output_path);
     if (!archive_writer) {
-      context_->GetDiagnostics()->Error(DiagMessage() << "failed to create archive");
+      context_->GetDiagnostics()->Error(android::DiagMessage() << "failed to create archive");
       return 1;
     }
 
@@ -2254,7 +2269,7 @@
     }
 
     if (error) {
-      context_->GetDiagnostics()->Error(DiagMessage() << "failed processing manifest");
+      context_->GetDiagnostics()->Error(android::DiagMessage() << "failed processing manifest");
       return 1;
     }
 
@@ -2327,7 +2342,7 @@
       const std::string path = arg.substr(1, arg.size() - 1);
       std::string error;
       if (!file::AppendArgsFromFile(path, &arg_list, &error)) {
-        context.GetDiagnostics()->Error(DiagMessage(path) << error);
+        context.GetDiagnostics()->Error(android::DiagMessage(path) << error);
         return 1;
       }
     } else {
@@ -2341,7 +2356,7 @@
       const std::string path = arg.substr(1, arg.size() - 1);
       std::string error;
       if (!file::AppendArgsFromFile(path, &options_.overlay_files, &error)) {
-        context.GetDiagnostics()->Error(DiagMessage(path) << error);
+        context.GetDiagnostics()->Error(android::DiagMessage(path) << error);
         return 1;
       }
     } else {
@@ -2354,9 +2369,9 @@
   }
 
   if (int{shared_lib_} + int{static_lib_} + int{proto_format_} > 1) {
-    context.GetDiagnostics()->Error(
-        DiagMessage()
-            << "only one of --shared-lib, --static-lib, or --proto_format can be defined");
+    context.GetDiagnostics()
+        ->Error(android::DiagMessage()
+                << "only one of --shared-lib, --static-lib, or --proto_format can be defined");
     return 1;
   }
 
@@ -2364,15 +2379,16 @@
     // If a shared library styleable in a public R.java uses a private attribute, attempting to
     // reference the private attribute within the styleable array will cause a link error because
     // the private attribute will not be emitted in the public R.java.
-    context.GetDiagnostics()->Error(DiagMessage()
+    context.GetDiagnostics()->Error(android::DiagMessage()
                                     << "--shared-lib cannot currently be used in combination with"
                                     << " --private-symbols");
     return 1;
   }
 
   if (options_.merge_only && !static_lib_) {
-    context.GetDiagnostics()->Error(
-        DiagMessage() << "the --merge-only flag can be only used when building a static library");
+    context.GetDiagnostics()
+        ->Error(android::DiagMessage()
+                << "the --merge-only flag can be only used when building a static library");
     return 1;
   }
 
@@ -2393,15 +2409,16 @@
   if (package_id_) {
     if (context.GetPackageType() != PackageType::kApp) {
       context.GetDiagnostics()->Error(
-          DiagMessage() << "can't specify --package-id when not building a regular app");
+          android::DiagMessage() << "can't specify --package-id when not building a regular app");
       return 1;
     }
 
     const std::optional<uint32_t> maybe_package_id_int =
         ResourceUtils::ParseInt(package_id_.value());
     if (!maybe_package_id_int) {
-      context.GetDiagnostics()->Error(DiagMessage() << "package ID '" << package_id_.value()
-                                                    << "' is not a valid integer");
+      context.GetDiagnostics()->Error(android::DiagMessage()
+                                      << "package ID '" << package_id_.value()
+                                      << "' is not a valid integer");
       return 1;
     }
 
@@ -2410,7 +2427,7 @@
         || package_id_int == kFrameworkPackageId
         || (!options_.allow_reserved_package_id && package_id_int < kAppPackageId)) {
       context.GetDiagnostics()->Error(
-          DiagMessage() << StringPrintf(
+          android::DiagMessage() << StringPrintf(
               "invalid package ID 0x%02x. Must be in the range 0x7f-0xff.", package_id_int));
       return 1;
     }
@@ -2474,7 +2491,7 @@
       const std::string path = regex.substr(1, regex.size() -1);
       std::string error;
       if (!file::AppendSetArgsFromFile(path, &options_.extensions_to_not_compress, &error)) {
-        context.GetDiagnostics()->Error(DiagMessage(path) << error);
+        context.GetDiagnostics()->Error(android::DiagMessage(path) << error);
         return 1;
       }
     } else {
diff --git a/tools/aapt2/cmd/Link.h b/tools/aapt2/cmd/Link.h
index d8c76e2..a5623cb 100644
--- a/tools/aapt2/cmd/Link.h
+++ b/tools/aapt2/cmd/Link.h
@@ -20,12 +20,12 @@
 #include <regex>
 
 #include "Command.h"
-#include "Diagnostics.h"
 #include "Resource.h"
-#include "split/TableSplitter.h"
+#include "androidfw/IDiagnostics.h"
 #include "format/binary/TableFlattener.h"
 #include "format/proto/ProtoSerialize.h"
 #include "link/ManifestFixer.h"
+#include "split/TableSplitter.h"
 #include "trace/TraceBuffer.h"
 
 namespace aapt {
@@ -111,8 +111,7 @@
 
 class LinkCommand : public Command {
  public:
-  explicit LinkCommand(IDiagnostics* diag) : Command("link", "l"),
-                                             diag_(diag) {
+  explicit LinkCommand(android::IDiagnostics* diag) : Command("link", "l"), diag_(diag) {
     SetDescription("Links resources into an apk.");
     AddRequiredFlag("-o", "Output path.", &options_.output_path, Command::kPath);
     AddRequiredFlag("--manifest", "Path to the Android manifest to build.",
@@ -316,7 +315,7 @@
   int Action(const std::vector<std::string>& args) override;
 
  private:
-  IDiagnostics* diag_;
+  android::IDiagnostics* diag_;
   LinkOptions options_;
 
   std::vector<std::string> overlay_arg_list_;
diff --git a/tools/aapt2/cmd/Link_test.cpp b/tools/aapt2/cmd/Link_test.cpp
index 7b1236a..683ccad 100644
--- a/tools/aapt2/cmd/Link_test.cpp
+++ b/tools/aapt2/cmd/Link_test.cpp
@@ -19,6 +19,7 @@
 #include <android-base/file.h>
 
 #include "AppInfo.h"
+#include "Diagnostics.h"
 #include "LoadedApk.h"
 #include "test/Test.h"
 
@@ -87,7 +88,8 @@
   // Check that the raw string index has been set to the correct string pool entry
   int32_t raw_index = tree.getAttributeValueStringID(0);
   ASSERT_THAT(raw_index, Ne(-1));
-  EXPECT_THAT(util::GetString(tree.getStrings(), static_cast<size_t>(raw_index)), Eq("007"));
+  EXPECT_THAT(android::util::GetString(tree.getStrings(), static_cast<size_t>(raw_index)),
+              Eq("007"));
 }
 
 TEST_F(LinkTest, NoCompressAssets) {
@@ -410,7 +412,7 @@
 
 static void BuildApk(const std::vector<SourceXML>& source_files, const std::string& apk_path,
                      LinkCommandBuilder&& link_args, CommandTestFixture* fixture,
-                     IDiagnostics* diag) {
+                     android::IDiagnostics* diag) {
   TemporaryDir res_dir;
   TemporaryDir compiled_res_dir;
   for (auto& source_file : source_files) {
@@ -423,7 +425,7 @@
 
 static void BuildSDK(const std::vector<SourceXML>& source_files, const std::string& apk_path,
                      const std::string& java_root_path, CommandTestFixture* fixture,
-                     IDiagnostics* diag) {
+                     android::IDiagnostics* diag) {
   auto android_manifest = ManifestBuilder(fixture).SetPackageName("android").Build();
 
   auto android_link_args = LinkCommandBuilder(fixture)
@@ -435,7 +437,7 @@
 }
 
 static void BuildNonFinalizedSDK(const std::string& apk_path, const std::string& java_path,
-                                 CommandTestFixture* fixture, IDiagnostics* diag) {
+                                 CommandTestFixture* fixture, android::IDiagnostics* diag) {
   const std::string android_values =
       R"(<resources>
           <public type="attr" name="finalized_res" id="0x01010001"/>
@@ -471,7 +473,7 @@
 }
 
 static void BuildFinalizedSDK(const std::string& apk_path, const std::string& java_path,
-                              CommandTestFixture* fixture, IDiagnostics* diag) {
+                              CommandTestFixture* fixture, android::IDiagnostics* diag) {
   const std::string android_values =
       R"(<resources>
           <public type="attr" name="finalized_res" id="0x01010001"/>
@@ -511,7 +513,7 @@
 
 static void BuildAppAgainstSDK(const std::string& apk_path, const std::string& java_path,
                                const std::string& sdk_path, CommandTestFixture* fixture,
-                               IDiagnostics* diag) {
+                               android::IDiagnostics* diag) {
   const std::string app_values =
       R"(<resources xmlns:android="http://schemas.android.com/apk/res/android">
            <attr name="bar" />
diff --git a/tools/aapt2/cmd/Optimize.cpp b/tools/aapt2/cmd/Optimize.cpp
index e1370fd..4033983 100644
--- a/tools/aapt2/cmd/Optimize.cpp
+++ b/tools/aapt2/cmd/Optimize.cpp
@@ -19,18 +19,17 @@
 #include <memory>
 #include <vector>
 
-#include "android-base/file.h"
-#include "android-base/stringprintf.h"
-
-#include "androidfw/ConfigDescription.h"
-#include "androidfw/ResourceTypes.h"
-#include "androidfw/StringPiece.h"
-
 #include "Diagnostics.h"
 #include "LoadedApk.h"
 #include "ResourceUtils.h"
 #include "SdkConstants.h"
 #include "ValueVisitor.h"
+#include "android-base/file.h"
+#include "android-base/stringprintf.h"
+#include "androidfw/ConfigDescription.h"
+#include "androidfw/IDiagnostics.h"
+#include "androidfw/ResourceTypes.h"
+#include "androidfw/StringPiece.h"
 #include "cmd/Util.h"
 #include "configuration/ConfigurationParser.h"
 #include "filter/AbiFilter.h"
@@ -69,7 +68,7 @@
     return PackageType::kApp;
   }
 
-  IDiagnostics* GetDiagnostics() override {
+  android::IDiagnostics* GetDiagnostics() override {
     return &diagnostics_;
   }
 
@@ -130,12 +129,12 @@
 
   int Run(std::unique_ptr<LoadedApk> apk) {
     if (context_->IsVerbose()) {
-      context_->GetDiagnostics()->Note(DiagMessage() << "Optimizing APK...");
+      context_->GetDiagnostics()->Note(android::DiagMessage() << "Optimizing APK...");
     }
     if (!options_.resources_exclude_list.empty()) {
       ResourceFilter filter(options_.resources_exclude_list);
       if (!filter.Consume(context_, apk->GetResourceTable())) {
-        context_->GetDiagnostics()->Error(DiagMessage() << "failed filtering resources");
+        context_->GetDiagnostics()->Error(android::DiagMessage() << "failed filtering resources");
         return 1;
       }
     }
@@ -147,20 +146,21 @@
 
     ResourceDeduper deduper;
     if (!deduper.Consume(context_, apk->GetResourceTable())) {
-      context_->GetDiagnostics()->Error(DiagMessage() << "failed deduping resources");
+      context_->GetDiagnostics()->Error(android::DiagMessage() << "failed deduping resources");
       return 1;
     }
 
     if (options_.shorten_resource_paths) {
       ResourcePathShortener shortener(options_.table_flattener_options.shortened_path_map);
       if (!shortener.Consume(context_, apk->GetResourceTable())) {
-        context_->GetDiagnostics()->Error(DiagMessage() << "failed shortening resource paths");
+        context_->GetDiagnostics()->Error(android::DiagMessage()
+                                          << "failed shortening resource paths");
         return 1;
       }
       if (options_.shortened_paths_map_path
           && !WriteShortenedPathsMap(options_.table_flattener_options.shortened_path_map,
                                       options_.shortened_paths_map_path.value())) {
-        context_->GetDiagnostics()->Error(DiagMessage()
+        context_->GetDiagnostics()->Error(android::DiagMessage()
                                           << "failed to write shortened resource paths to file");
         return 1;
       }
@@ -183,9 +183,10 @@
     auto split_constraints_iter = options_.split_constraints.begin();
     for (std::unique_ptr<ResourceTable>& split_table : splitter.splits()) {
       if (context_->IsVerbose()) {
-        context_->GetDiagnostics()->Note(
-            DiagMessage(*path_iter) << "generating split with configurations '"
-                                    << util::Joiner(split_constraints_iter->configs, ", ") << "'");
+        context_->GetDiagnostics()->Note(android::DiagMessage(*path_iter)
+                                         << "generating split with configurations '"
+                                         << util::Joiner(split_constraints_iter->configs, ", ")
+                                         << "'");
       }
 
       // Generate an AndroidManifest.xml for each split.
@@ -228,7 +229,7 @@
 
  private:
   bool WriteSplitApk(ResourceTable* table, xml::XmlResource* manifest, IArchiveWriter* writer) {
-    BigBuffer manifest_buffer(4096);
+    android::BigBuffer manifest_buffer(4096);
     XmlFlattener xml_flattener(&manifest_buffer, {});
     if (!xml_flattener.Consume(context_, manifest)) {
       return false;
@@ -255,7 +256,7 @@
 
             if (file_ref->file == nullptr) {
               ResourceNameRef name(pkg->name, type->named_type, entry->name);
-              context_->GetDiagnostics()->Warn(DiagMessage(file_ref->GetSource())
+              context_->GetDiagnostics()->Warn(android::DiagMessage(file_ref->GetSource())
                                                << "file for resource " << name << " with config '"
                                                << config_value->config << "' not found");
               continue;
@@ -276,7 +277,7 @@
       }
     }
 
-    BigBuffer table_buffer(4096);
+    android::BigBuffer table_buffer(4096);
     TableFlattener table_flattener(options_.table_flattener_options, &table_buffer);
     if (!table_flattener.Consume(context_, table)) {
       return false;
@@ -311,18 +312,18 @@
 
     auto split_line = util::Split(line, '#');
     if (split_line.size() < 2) {
-      context->GetDiagnostics()->Error(DiagMessage(line) << "No # found in line");
+      context->GetDiagnostics()->Error(android::DiagMessage(line) << "No # found in line");
       return false;
     }
     StringPiece resource_string = split_line[0];
     StringPiece directives = split_line[1];
     ResourceNameRef resource_name;
     if (!ResourceUtils::ParseResourceName(resource_string, &resource_name)) {
-      context->GetDiagnostics()->Error(DiagMessage(line) << "Malformed resource name");
+      context->GetDiagnostics()->Error(android::DiagMessage(line) << "Malformed resource name");
       return false;
     }
     if (!resource_name.package.empty()) {
-      context->GetDiagnostics()->Error(DiagMessage(line)
+      context->GetDiagnostics()->Error(android::DiagMessage(line)
                                        << "Package set for resource. Only use type/name");
       return false;
     }
@@ -341,7 +342,7 @@
 bool ExtractConfig(const std::string& path, IAaptContext* context, OptimizeOptions* options) {
   std::string content;
   if (!android::base::ReadFileToString(path, &content, true /*follow_symlinks*/)) {
-    context->GetDiagnostics()->Error(DiagMessage(path) << "failed reading config file");
+    context->GetDiagnostics()->Error(android::DiagMessage(path) << "failed reading config file");
     return false;
   }
   return ParseConfig(content, context, options);
@@ -356,7 +357,7 @@
 
   auto app_info = ExtractAppInfoFromBinaryManifest(*manifest, context->GetDiagnostics());
   if (!app_info) {
-    context->GetDiagnostics()->Error(DiagMessage()
+    context->GetDiagnostics()->Error(android::DiagMessage()
                                      << "failed to extract data from AndroidManifest.xml");
     return false;
   }
@@ -376,7 +377,7 @@
   const std::string& apk_path = args[0];
   OptimizeContext context;
   context.SetVerbose(verbose_);
-  IDiagnostics* diag = context.GetDiagnostics();
+  android::IDiagnostics* diag = context.GetDiagnostics();
 
   if (config_path_) {
     std::string& path = config_path_.value();
@@ -384,12 +385,12 @@
     if (for_path) {
       options_.apk_artifacts = for_path.value().WithDiagnostics(diag).Parse(apk_path);
       if (!options_.apk_artifacts) {
-        diag->Error(DiagMessage() << "Failed to parse the output artifact list");
+        diag->Error(android::DiagMessage() << "Failed to parse the output artifact list");
         return 1;
       }
 
     } else {
-      diag->Error(DiagMessage() << "Could not parse config file " << path);
+      diag->Error(android::DiagMessage() << "Could not parse config file " << path);
       return 1;
     }
 
@@ -411,11 +412,13 @@
     // Since we know that we are going to process the APK (not just print targets), make sure we
     // have somewhere to write them to.
     if (!options_.output_dir) {
-      diag->Error(DiagMessage() << "Output directory is required when using a configuration file");
+      diag->Error(android::DiagMessage()
+                  << "Output directory is required when using a configuration file");
       return 1;
     }
   } else if (print_only_) {
-    diag->Error(DiagMessage() << "Asked to print artifacts without providing a configurations");
+    diag->Error(android::DiagMessage()
+                << "Asked to print artifacts without providing a configurations");
     return 1;
   }
 
diff --git a/tools/aapt2/cmd/Optimize_test.cpp b/tools/aapt2/cmd/Optimize_test.cpp
index ac681e8..d180c87 100644
--- a/tools/aapt2/cmd/Optimize_test.cpp
+++ b/tools/aapt2/cmd/Optimize_test.cpp
@@ -17,9 +17,9 @@
 #include "Optimize.h"
 
 #include "AppInfo.h"
-#include "Diagnostics.h"
 #include "LoadedApk.h"
 #include "Resource.h"
+#include "androidfw/IDiagnostics.h"
 #include "test/Test.h"
 
 using testing::Contains;
diff --git a/tools/aapt2/cmd/Util.cpp b/tools/aapt2/cmd/Util.cpp
index 3244fb8..c3a6ed1 100644
--- a/tools/aapt2/cmd/Util.cpp
+++ b/tools/aapt2/cmd/Util.cpp
@@ -34,10 +34,12 @@
 
 namespace aapt {
 
-std::optional<uint16_t> ParseTargetDensityParameter(const StringPiece& arg, IDiagnostics* diag) {
+std::optional<uint16_t> ParseTargetDensityParameter(const StringPiece& arg,
+                                                    android::IDiagnostics* diag) {
   ConfigDescription preferred_density_config;
   if (!ConfigDescription::Parse(arg, &preferred_density_config)) {
-    diag->Error(DiagMessage() << "invalid density '" << arg << "' for --preferred-density option");
+    diag->Error(android::DiagMessage()
+                << "invalid density '" << arg << "' for --preferred-density option");
     return {};
   }
 
@@ -46,14 +48,14 @@
 
   if (preferred_density_config.diff(ConfigDescription::DefaultConfig()) !=
       ConfigDescription::CONFIG_DENSITY) {
-    diag->Error(DiagMessage() << "invalid preferred density '" << arg << "'. "
-                              << "Preferred density must only be a density value");
+    diag->Error(android::DiagMessage() << "invalid preferred density '" << arg << "'. "
+                                       << "Preferred density must only be a density value");
     return {};
   }
   return preferred_density_config.density;
 }
 
-bool ParseSplitParameter(const StringPiece& arg, IDiagnostics* diag, std::string* out_path,
+bool ParseSplitParameter(const StringPiece& arg, android::IDiagnostics* diag, std::string* out_path,
                          SplitConstraints* out_split) {
   CHECK(diag != nullptr);
   CHECK(out_path != nullptr);
@@ -67,9 +69,9 @@
 
   std::vector<std::string> parts = util::Split(arg, sSeparator);
   if (parts.size() != 2) {
-    diag->Error(DiagMessage() << "invalid split parameter '" << arg << "'");
-    diag->Note(DiagMessage() << "should be --split path/to/output.apk" << sSeparator
-                             << "<config>[,<config>...].");
+    diag->Error(android::DiagMessage() << "invalid split parameter '" << arg << "'");
+    diag->Note(android::DiagMessage() << "should be --split path/to/output.apk" << sSeparator
+                                      << "<config>[,<config>...].");
     return false;
   }
 
@@ -78,8 +80,8 @@
   for (const StringPiece& config_str : util::Tokenize(parts[1], ',')) {
     ConfigDescription config;
     if (!ConfigDescription::Parse(config_str, &config)) {
-      diag->Error(DiagMessage() << "invalid config '" << config_str << "' in split parameter '"
-                                << arg << "'");
+      diag->Error(android::DiagMessage()
+                  << "invalid config '" << config_str << "' in split parameter '" << arg << "'");
       return false;
     }
     out_split->configs.insert(config);
@@ -88,7 +90,7 @@
 }
 
 std::unique_ptr<IConfigFilter> ParseConfigFilterParameters(const std::vector<std::string>& args,
-                                                           IDiagnostics* diag) {
+                                                           android::IDiagnostics* diag) {
   std::unique_ptr<AxisConfigFilter> filter = util::make_unique<AxisConfigFilter>();
   for (const std::string& config_arg : args) {
     for (const StringPiece& config_str : util::Tokenize(config_arg, ',')) {
@@ -97,12 +99,13 @@
       if (lv.InitFromFilterString(config_str)) {
         lv.WriteTo(&config);
       } else if (!ConfigDescription::Parse(config_str, &config)) {
-        diag->Error(DiagMessage() << "invalid config '" << config_str << "' for -c option");
+        diag->Error(android::DiagMessage()
+                    << "invalid config '" << config_str << "' for -c option");
         return {};
       }
 
       if (config.density != 0) {
-        diag->Warn(DiagMessage() << "ignoring density '" << config << "' for -c option");
+        diag->Warn(android::DiagMessage() << "ignoring density '" << config << "' for -c option");
       } else {
         filter->AddConfig(config);
       }
@@ -331,7 +334,7 @@
 }
 
 std::optional<AppInfo> ExtractAppInfoFromBinaryManifest(const xml::XmlResource& xml_res,
-                                                        IDiagnostics* diag) {
+                                                        android::IDiagnostics* diag) {
   // Make sure the first element is <manifest> with package attribute.
   const xml::Element* manifest_el = xml_res.root.get();
   if (manifest_el == nullptr) {
@@ -341,20 +344,21 @@
   AppInfo app_info;
 
   if (!manifest_el->namespace_uri.empty() || manifest_el->name != "manifest") {
-    diag->Error(DiagMessage(xml_res.file.source) << "root tag must be <manifest>");
+    diag->Error(android::DiagMessage(xml_res.file.source) << "root tag must be <manifest>");
     return {};
   }
 
   const xml::Attribute* package_attr = manifest_el->FindAttribute({}, "package");
   if (!package_attr) {
-    diag->Error(DiagMessage(xml_res.file.source) << "<manifest> must have a 'package' attribute");
+    diag->Error(android::DiagMessage(xml_res.file.source)
+                << "<manifest> must have a 'package' attribute");
     return {};
   }
 
   std::string error_msg;
   std::optional<std::string> maybe_package = ExtractCompiledString(*package_attr, &error_msg);
   if (!maybe_package) {
-    diag->Error(DiagMessage(xml_res.file.source.WithLine(manifest_el->line_number))
+    diag->Error(android::DiagMessage(xml_res.file.source.WithLine(manifest_el->line_number))
                 << "invalid package name: " << error_msg);
     return {};
   }
@@ -364,7 +368,7 @@
           manifest_el->FindAttribute(xml::kSchemaAndroid, "versionCode")) {
     std::optional<uint32_t> maybe_code = ExtractCompiledInt(*version_code_attr, &error_msg);
     if (!maybe_code) {
-      diag->Error(DiagMessage(xml_res.file.source.WithLine(manifest_el->line_number))
+      diag->Error(android::DiagMessage(xml_res.file.source.WithLine(manifest_el->line_number))
                   << "invalid android:versionCode: " << error_msg);
       return {};
     }
@@ -375,8 +379,8 @@
       manifest_el->FindAttribute(xml::kSchemaAndroid, "versionCodeMajor")) {
     std::optional<uint32_t> maybe_code = ExtractCompiledInt(*version_code_major_attr, &error_msg);
     if (!maybe_code) {
-      diag->Error(DiagMessage(xml_res.file.source.WithLine(manifest_el->line_number))
-                      << "invalid android:versionCodeMajor: " << error_msg);
+      diag->Error(android::DiagMessage(xml_res.file.source.WithLine(manifest_el->line_number))
+                  << "invalid android:versionCodeMajor: " << error_msg);
       return {};
     }
     app_info.version_code_major = maybe_code.value();
@@ -386,7 +390,7 @@
           manifest_el->FindAttribute(xml::kSchemaAndroid, "revisionCode")) {
     std::optional<uint32_t> maybe_code = ExtractCompiledInt(*revision_code_attr, &error_msg);
     if (!maybe_code) {
-      diag->Error(DiagMessage(xml_res.file.source.WithLine(manifest_el->line_number))
+      diag->Error(android::DiagMessage(xml_res.file.source.WithLine(manifest_el->line_number))
                   << "invalid android:revisionCode: " << error_msg);
       return {};
     }
@@ -397,7 +401,7 @@
     std::optional<std::string> maybe_split_name =
         ExtractCompiledString(*split_name_attr, &error_msg);
     if (!maybe_split_name) {
-      diag->Error(DiagMessage(xml_res.file.source.WithLine(manifest_el->line_number))
+      diag->Error(android::DiagMessage(xml_res.file.source.WithLine(manifest_el->line_number))
                   << "invalid split name: " << error_msg);
       return {};
     }
@@ -409,7 +413,7 @@
             uses_sdk_el->FindAttribute(xml::kSchemaAndroid, "minSdkVersion")) {
       std::optional<int> maybe_sdk = ExtractSdkVersion(*min_sdk, &error_msg);
       if (!maybe_sdk) {
-        diag->Error(DiagMessage(xml_res.file.source.WithLine(uses_sdk_el->line_number))
+        diag->Error(android::DiagMessage(xml_res.file.source.WithLine(uses_sdk_el->line_number))
                     << "invalid android:minSdkVersion: " << error_msg);
         return {};
       }
diff --git a/tools/aapt2/cmd/Util.h b/tools/aapt2/cmd/Util.h
index 1b98eb4..7af27f5 100644
--- a/tools/aapt2/cmd/Util.h
+++ b/tools/aapt2/cmd/Util.h
@@ -19,11 +19,10 @@
 
 #include <regex>
 
-#include "androidfw/StringPiece.h"
-
 #include "AppInfo.h"
-#include "Diagnostics.h"
 #include "SdkConstants.h"
+#include "androidfw/IDiagnostics.h"
+#include "androidfw/StringPiece.h"
 #include "filter/ConfigFilter.h"
 #include "split/TableSplitter.h"
 #include "xml/XmlDom.h"
@@ -33,18 +32,18 @@
 // Parses a configuration density (ex. hdpi, xxhdpi, 234dpi, anydpi, etc).
 // Returns Nothing and logs a human friendly error message if the string was not legal.
 std::optional<uint16_t> ParseTargetDensityParameter(const android::StringPiece& arg,
-                                                    IDiagnostics* diag);
+                                                    android::IDiagnostics* diag);
 
 // Parses a string of the form 'path/to/output.apk:<config>[,<config>...]' and fills in
 // `out_path` with the path and `out_split` with the set of ConfigDescriptions.
 // Returns false and logs a human friendly error message if the string was not legal.
-bool ParseSplitParameter(const android::StringPiece& arg, IDiagnostics* diag, std::string* out_path,
-                         SplitConstraints* out_split);
+bool ParseSplitParameter(const android::StringPiece& arg, android::IDiagnostics* diag,
+                         std::string* out_path, SplitConstraints* out_split);
 
 // Parses a set of config filter strings of the form 'en,fr-rFR' and returns an IConfigFilter.
 // Returns nullptr and logs a human friendly error message if the string was not legal.
 std::unique_ptr<IConfigFilter> ParseConfigFilterParameters(const std::vector<std::string>& args,
-                                                           IDiagnostics* diag);
+                                                           android::IDiagnostics* diag);
 
 // Adjust the SplitConstraints so that their SDK version is stripped if it
 // is less than or equal to the min_sdk. Otherwise the resources that have had
@@ -60,7 +59,7 @@
 
 // Extracts relevant info from the AndroidManifest.xml.
 std::optional<AppInfo> ExtractAppInfoFromBinaryManifest(const xml::XmlResource& xml_res,
-                                                        IDiagnostics* diag);
+                                                        android::IDiagnostics* diag);
 
 // Returns a copy of 'name' which conforms to the regex '[a-zA-Z]+[a-zA-Z0-9_]*' by
 // replacing nonconforming characters with underscores.
diff --git a/tools/aapt2/cmd/Util_test.cpp b/tools/aapt2/cmd/Util_test.cpp
index ac1f981..91accfe 100644
--- a/tools/aapt2/cmd/Util_test.cpp
+++ b/tools/aapt2/cmd/Util_test.cpp
@@ -102,7 +102,7 @@
 
 
 TEST (UtilTest, ParseSplitParameters) {
-  IDiagnostics* diagnostics = test::ContextBuilder().Build().get()->GetDiagnostics();
+  android::IDiagnostics* diagnostics = test::ContextBuilder().Build().get()->GetDiagnostics();
   std::string path;
   SplitConstraints constraints;
   ConfigDescription expected_configuration;
@@ -356,7 +356,7 @@
 TEST (UtilTest, AdjustSplitConstraintsForMinSdk) {
   std::unique_ptr<IAaptContext> context = test::ContextBuilder().Build();
 
-  IDiagnostics* diagnostics = context.get()->GetDiagnostics();
+  android::IDiagnostics* diagnostics = context.get()->GetDiagnostics();
   std::vector<SplitConstraints> test_constraints;
   std::string path;
 
