AAPT2: Rename to match new style

Use Google3 naming style to match new
projects' and open source google projects' style.

Preferred to do this in a massive CL so as to avoid
style inconsistencies that plague legacy code bases.
This is a relatively NEW code base, may as well keep
it up to date.

Test: name/style refactor - existing tests pass
Change-Id: Ie80ecb78d46ec53efdfca2336bb57d96cbb7fb87
diff --git a/tools/aapt2/compile/Compile.cpp b/tools/aapt2/compile/Compile.cpp
index 2ea63d0..a06140c 100644
--- a/tools/aapt2/compile/Compile.cpp
+++ b/tools/aapt2/compile/Compile.cpp
@@ -14,6 +14,11 @@
  * limitations under the License.
  */
 
+#include <dirent.h>
+
+#include <fstream>
+#include <string>
+
 #include "ConfigDescription.h"
 #include "Diagnostics.h"
 #include "Flags.h"
@@ -33,14 +38,10 @@
 #include "xml/XmlDom.h"
 #include "xml/XmlPullParser.h"
 
-#include <google/protobuf/io/coded_stream.h>
-#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
-
-#include <android-base/errors.h>
-#include <android-base/file.h>
-#include <dirent.h>
-#include <fstream>
-#include <string>
+#include "android-base/errors.h"
+#include "android-base/file.h"
+#include "google/protobuf/io/coded_stream.h"
+#include "google/protobuf/io/zero_copy_stream_impl_lite.h"
 
 using google::protobuf::io::CopyingOutputStreamAdaptor;
 using google::protobuf::io::ZeroCopyOutputStream;
@@ -49,7 +50,7 @@
 
 struct ResourcePathData {
   Source source;
-  std::string resourceDir;
+  std::string resource_dir;
   std::string name;
   std::string extension;
 
@@ -58,7 +59,7 @@
   // version qualifiers. We want to preserve the original input so the output is
   // easily
   // computed before hand.
-  std::string configStr;
+  std::string config_str;
   ConfigDescription config;
 };
 
@@ -66,60 +67,60 @@
  * Resource file paths are expected to look like:
  * [--/res/]type[-config]/name
  */
-static Maybe<ResourcePathData> extractResourcePathData(const std::string& path,
-                                                       std::string* outError) {
-  std::vector<std::string> parts = util::split(path, file::sDirSep);
+static Maybe<ResourcePathData> ExtractResourcePathData(const std::string& path,
+                                                       std::string* out_error) {
+  std::vector<std::string> parts = util::Split(path, file::sDirSep);
   if (parts.size() < 2) {
-    if (outError) *outError = "bad resource path";
+    if (out_error) *out_error = "bad resource path";
     return {};
   }
 
   std::string& dir = parts[parts.size() - 2];
-  StringPiece dirStr = dir;
+  StringPiece dir_str = dir;
 
-  StringPiece configStr;
+  StringPiece config_str;
   ConfigDescription config;
-  size_t dashPos = dir.find('-');
-  if (dashPos != std::string::npos) {
-    configStr = dirStr.substr(dashPos + 1, dir.size() - (dashPos + 1));
-    if (!ConfigDescription::parse(configStr, &config)) {
-      if (outError) {
-        std::stringstream errStr;
-        errStr << "invalid configuration '" << configStr << "'";
-        *outError = errStr.str();
+  size_t dash_pos = dir.find('-');
+  if (dash_pos != std::string::npos) {
+    config_str = dir_str.substr(dash_pos + 1, dir.size() - (dash_pos + 1));
+    if (!ConfigDescription::Parse(config_str, &config)) {
+      if (out_error) {
+        std::stringstream err_str;
+        err_str << "invalid configuration '" << config_str << "'";
+        *out_error = err_str.str();
       }
       return {};
     }
-    dirStr = dirStr.substr(0, dashPos);
+    dir_str = dir_str.substr(0, dash_pos);
   }
 
   std::string& filename = parts[parts.size() - 1];
   StringPiece name = filename;
   StringPiece extension;
-  size_t dotPos = filename.find('.');
-  if (dotPos != std::string::npos) {
-    extension = name.substr(dotPos + 1, filename.size() - (dotPos + 1));
-    name = name.substr(0, dotPos);
+  size_t dot_pos = filename.find('.');
+  if (dot_pos != std::string::npos) {
+    extension = name.substr(dot_pos + 1, filename.size() - (dot_pos + 1));
+    name = name.substr(0, dot_pos);
   }
 
-  return ResourcePathData{Source(path),         dirStr.toString(),
-                          name.toString(),      extension.toString(),
-                          configStr.toString(), config};
+  return ResourcePathData{Source(path),          dir_str.ToString(),
+                          name.ToString(),       extension.ToString(),
+                          config_str.ToString(), config};
 }
 
 struct CompileOptions {
-  std::string outputPath;
-  Maybe<std::string> resDir;
+  std::string output_path;
+  Maybe<std::string> res_dir;
   bool pseudolocalize = false;
-  bool legacyMode = false;
+  bool legacy_mode = false;
   bool verbose = false;
 };
 
-static std::string buildIntermediateFilename(const ResourcePathData& data) {
+static std::string BuildIntermediateFilename(const ResourcePathData& data) {
   std::stringstream name;
-  name << data.resourceDir;
-  if (!data.configStr.empty()) {
-    name << "-" << data.configStr;
+  name << data.resource_dir;
+  if (!data.config_str.empty()) {
+    name << "-" << data.config_str;
   }
   name << "_" << data.name;
   if (!data.extension.empty()) {
@@ -129,92 +130,93 @@
   return name.str();
 }
 
-static bool isHidden(const StringPiece& filename) {
-  return util::stringStartsWith(filename, ".");
+static bool IsHidden(const StringPiece& filename) {
+  return util::StartsWith(filename, ".");
 }
 
 /**
  * Walks the res directory structure, looking for resource files.
  */
-static bool loadInputFilesFromDir(IAaptContext* context,
-                                  const CompileOptions& options,
-                                  std::vector<ResourcePathData>* outPathData) {
-  const std::string& rootDir = options.resDir.value();
-  std::unique_ptr<DIR, decltype(closedir)*> d(opendir(rootDir.data()),
+static bool LoadInputFilesFromDir(
+    IAaptContext* context, const CompileOptions& options,
+    std::vector<ResourcePathData>* out_path_data) {
+  const std::string& root_dir = options.res_dir.value();
+  std::unique_ptr<DIR, decltype(closedir)*> d(opendir(root_dir.data()),
                                               closedir);
   if (!d) {
-    context->getDiagnostics()->error(DiagMessage() << strerror(errno));
+    context->GetDiagnostics()->Error(DiagMessage() << strerror(errno));
     return false;
   }
 
   while (struct dirent* entry = readdir(d.get())) {
-    if (isHidden(entry->d_name)) {
+    if (IsHidden(entry->d_name)) {
       continue;
     }
 
-    std::string prefixPath = rootDir;
-    file::appendPath(&prefixPath, entry->d_name);
+    std::string prefix_path = root_dir;
+    file::AppendPath(&prefix_path, entry->d_name);
 
-    if (file::getFileType(prefixPath) != file::FileType::kDirectory) {
+    if (file::GetFileType(prefix_path) != file::FileType::kDirectory) {
       continue;
     }
 
-    std::unique_ptr<DIR, decltype(closedir)*> subDir(opendir(prefixPath.data()),
-                                                     closedir);
-    if (!subDir) {
-      context->getDiagnostics()->error(DiagMessage() << strerror(errno));
+    std::unique_ptr<DIR, decltype(closedir)*> subdir(
+        opendir(prefix_path.data()), closedir);
+    if (!subdir) {
+      context->GetDiagnostics()->Error(DiagMessage() << strerror(errno));
       return false;
     }
 
-    while (struct dirent* leafEntry = readdir(subDir.get())) {
-      if (isHidden(leafEntry->d_name)) {
+    while (struct dirent* leaf_entry = readdir(subdir.get())) {
+      if (IsHidden(leaf_entry->d_name)) {
         continue;
       }
 
-      std::string fullPath = prefixPath;
-      file::appendPath(&fullPath, leafEntry->d_name);
+      std::string full_path = prefix_path;
+      file::AppendPath(&full_path, leaf_entry->d_name);
 
-      std::string errStr;
-      Maybe<ResourcePathData> pathData =
-          extractResourcePathData(fullPath, &errStr);
-      if (!pathData) {
-        context->getDiagnostics()->error(DiagMessage() << errStr);
+      std::string err_str;
+      Maybe<ResourcePathData> path_data =
+          ExtractResourcePathData(full_path, &err_str);
+      if (!path_data) {
+        context->GetDiagnostics()->Error(DiagMessage() << err_str);
         return false;
       }
 
-      outPathData->push_back(std::move(pathData.value()));
+      out_path_data->push_back(std::move(path_data.value()));
     }
   }
   return true;
 }
 
-static bool compileTable(IAaptContext* context, const CompileOptions& options,
-                         const ResourcePathData& pathData,
+static bool CompileTable(IAaptContext* context, const CompileOptions& options,
+                         const ResourcePathData& path_data,
                          IArchiveWriter* writer,
-                         const std::string& outputPath) {
+                         const std::string& output_path) {
   ResourceTable table;
   {
-    std::ifstream fin(pathData.source.path, std::ifstream::binary);
+    std::ifstream fin(path_data.source.path, std::ifstream::binary);
     if (!fin) {
-      context->getDiagnostics()->error(DiagMessage(pathData.source)
+      context->GetDiagnostics()->Error(DiagMessage(path_data.source)
                                        << strerror(errno));
       return false;
     }
 
     // Parse the values file from XML.
-    xml::XmlPullParser xmlParser(fin);
+    xml::XmlPullParser xml_parser(fin);
 
-    ResourceParserOptions parserOptions;
-    parserOptions.errorOnPositionalArguments = !options.legacyMode;
+    ResourceParserOptions parser_options;
+    parser_options.error_on_positional_arguments = !options.legacy_mode;
 
     // If the filename includes donottranslate, then the default translatable is
     // false.
-    parserOptions.translatable =
-        pathData.name.find("donottranslate") == std::string::npos;
+    parser_options.translatable =
+        path_data.name.find("donottranslate") == std::string::npos;
 
-    ResourceParser resParser(context->getDiagnostics(), &table, pathData.source,
-                             pathData.config, parserOptions);
-    if (!resParser.parse(&xmlParser)) {
+    ResourceParser res_parser(context->GetDiagnostics(), &table,
+                              path_data.source, path_data.config,
+                              parser_options);
+    if (!res_parser.Parse(&xml_parser)) {
       return false;
     }
 
@@ -226,242 +228,241 @@
     // These are created as weak symbols, and are only generated from default
     // configuration
     // strings and plurals.
-    PseudolocaleGenerator pseudolocaleGenerator;
-    if (!pseudolocaleGenerator.consume(context, &table)) {
+    PseudolocaleGenerator pseudolocale_generator;
+    if (!pseudolocale_generator.Consume(context, &table)) {
       return false;
     }
   }
 
   // Ensure we have the compilation package at least.
-  table.createPackage(context->getCompilationPackage());
+  table.CreatePackage(context->GetCompilationPackage());
 
   // Assign an ID to any package that has resources.
   for (auto& pkg : table.packages) {
     if (!pkg->id) {
       // If no package ID was set while parsing (public identifiers), auto
       // assign an ID.
-      pkg->id = context->getPackageId();
+      pkg->id = context->GetPackageId();
     }
   }
 
   // Create the file/zip entry.
-  if (!writer->startEntry(outputPath, 0)) {
-    context->getDiagnostics()->error(DiagMessage(outputPath)
+  if (!writer->StartEntry(output_path, 0)) {
+    context->GetDiagnostics()->Error(DiagMessage(output_path)
                                      << "failed to open");
     return false;
   }
 
   // Make sure CopyingOutputStreamAdaptor is deleted before we call
-  // writer->finishEntry().
+  // writer->FinishEntry().
   {
     // Wrap our IArchiveWriter with an adaptor that implements the
     // ZeroCopyOutputStream
     // interface.
-    CopyingOutputStreamAdaptor copyingAdaptor(writer);
+    CopyingOutputStreamAdaptor copying_adaptor(writer);
 
-    std::unique_ptr<pb::ResourceTable> pbTable = serializeTableToPb(&table);
-    if (!pbTable->SerializeToZeroCopyStream(&copyingAdaptor)) {
-      context->getDiagnostics()->error(DiagMessage(outputPath)
+    std::unique_ptr<pb::ResourceTable> pb_table = SerializeTableToPb(&table);
+    if (!pb_table->SerializeToZeroCopyStream(&copying_adaptor)) {
+      context->GetDiagnostics()->Error(DiagMessage(output_path)
                                        << "failed to write");
       return false;
     }
   }
 
-  if (!writer->finishEntry()) {
-    context->getDiagnostics()->error(DiagMessage(outputPath)
+  if (!writer->FinishEntry()) {
+    context->GetDiagnostics()->Error(DiagMessage(output_path)
                                      << "failed to finish entry");
     return false;
   }
   return true;
 }
 
-static bool writeHeaderAndBufferToWriter(const StringPiece& outputPath,
+static bool WriteHeaderAndBufferToWriter(const StringPiece& output_path,
                                          const ResourceFile& file,
                                          const BigBuffer& buffer,
                                          IArchiveWriter* writer,
                                          IDiagnostics* diag) {
   // Start the entry so we can write the header.
-  if (!writer->startEntry(outputPath, 0)) {
-    diag->error(DiagMessage(outputPath) << "failed to open file");
+  if (!writer->StartEntry(output_path, 0)) {
+    diag->Error(DiagMessage(output_path) << "failed to open file");
     return false;
   }
 
   // Make sure CopyingOutputStreamAdaptor is deleted before we call
-  // writer->finishEntry().
+  // writer->FinishEntry().
   {
     // Wrap our IArchiveWriter with an adaptor that implements the
     // ZeroCopyOutputStream
     // interface.
-    CopyingOutputStreamAdaptor copyingAdaptor(writer);
-    CompiledFileOutputStream outputStream(&copyingAdaptor);
+    CopyingOutputStreamAdaptor copying_adaptor(writer);
+    CompiledFileOutputStream output_stream(&copying_adaptor);
 
     // Number of CompiledFiles.
-    outputStream.WriteLittleEndian32(1);
+    output_stream.WriteLittleEndian32(1);
 
-    std::unique_ptr<pb::CompiledFile> compiledFile =
-        serializeCompiledFileToPb(file);
-    outputStream.WriteCompiledFile(compiledFile.get());
-    outputStream.WriteData(&buffer);
+    std::unique_ptr<pb::CompiledFile> compiled_file =
+        SerializeCompiledFileToPb(file);
+    output_stream.WriteCompiledFile(compiled_file.get());
+    output_stream.WriteData(&buffer);
 
-    if (outputStream.HadError()) {
-      diag->error(DiagMessage(outputPath) << "failed to write data");
+    if (output_stream.HadError()) {
+      diag->Error(DiagMessage(output_path) << "failed to write data");
       return false;
     }
   }
 
-  if (!writer->finishEntry()) {
-    diag->error(DiagMessage(outputPath) << "failed to finish writing data");
+  if (!writer->FinishEntry()) {
+    diag->Error(DiagMessage(output_path) << "failed to finish writing data");
     return false;
   }
   return true;
 }
 
-static bool writeHeaderAndMmapToWriter(const StringPiece& outputPath,
+static bool WriteHeaderAndMmapToWriter(const StringPiece& output_path,
                                        const ResourceFile& file,
                                        const android::FileMap& map,
                                        IArchiveWriter* writer,
                                        IDiagnostics* diag) {
   // Start the entry so we can write the header.
-  if (!writer->startEntry(outputPath, 0)) {
-    diag->error(DiagMessage(outputPath) << "failed to open file");
+  if (!writer->StartEntry(output_path, 0)) {
+    diag->Error(DiagMessage(output_path) << "failed to open file");
     return false;
   }
 
   // Make sure CopyingOutputStreamAdaptor is deleted before we call
-  // writer->finishEntry().
+  // writer->FinishEntry().
   {
     // Wrap our IArchiveWriter with an adaptor that implements the
-    // ZeroCopyOutputStream
-    // interface.
-    CopyingOutputStreamAdaptor copyingAdaptor(writer);
-    CompiledFileOutputStream outputStream(&copyingAdaptor);
+    // ZeroCopyOutputStream interface.
+    CopyingOutputStreamAdaptor copying_adaptor(writer);
+    CompiledFileOutputStream output_stream(&copying_adaptor);
 
     // Number of CompiledFiles.
-    outputStream.WriteLittleEndian32(1);
+    output_stream.WriteLittleEndian32(1);
 
-    std::unique_ptr<pb::CompiledFile> compiledFile =
-        serializeCompiledFileToPb(file);
-    outputStream.WriteCompiledFile(compiledFile.get());
-    outputStream.WriteData(map.getDataPtr(), map.getDataLength());
+    std::unique_ptr<pb::CompiledFile> compiled_file =
+        SerializeCompiledFileToPb(file);
+    output_stream.WriteCompiledFile(compiled_file.get());
+    output_stream.WriteData(map.getDataPtr(), map.getDataLength());
 
-    if (outputStream.HadError()) {
-      diag->error(DiagMessage(outputPath) << "failed to write data");
+    if (output_stream.HadError()) {
+      diag->Error(DiagMessage(output_path) << "failed to write data");
       return false;
     }
   }
 
-  if (!writer->finishEntry()) {
-    diag->error(DiagMessage(outputPath) << "failed to finish writing data");
+  if (!writer->FinishEntry()) {
+    diag->Error(DiagMessage(output_path) << "failed to finish writing data");
     return false;
   }
   return true;
 }
 
-static bool flattenXmlToOutStream(IAaptContext* context,
-                                  const StringPiece& outputPath,
-                                  xml::XmlResource* xmlRes,
+static bool FlattenXmlToOutStream(IAaptContext* context,
+                                  const StringPiece& output_path,
+                                  xml::XmlResource* xmlres,
                                   CompiledFileOutputStream* out) {
   BigBuffer buffer(1024);
-  XmlFlattenerOptions xmlFlattenerOptions;
-  xmlFlattenerOptions.keepRawValues = true;
-  XmlFlattener flattener(&buffer, xmlFlattenerOptions);
-  if (!flattener.consume(context, xmlRes)) {
+  XmlFlattenerOptions xml_flattener_options;
+  xml_flattener_options.keep_raw_values = true;
+  XmlFlattener flattener(&buffer, xml_flattener_options);
+  if (!flattener.Consume(context, xmlres)) {
     return false;
   }
 
-  std::unique_ptr<pb::CompiledFile> pbCompiledFile =
-      serializeCompiledFileToPb(xmlRes->file);
-  out->WriteCompiledFile(pbCompiledFile.get());
+  std::unique_ptr<pb::CompiledFile> pb_compiled_file =
+      SerializeCompiledFileToPb(xmlres->file);
+  out->WriteCompiledFile(pb_compiled_file.get());
   out->WriteData(&buffer);
 
   if (out->HadError()) {
-    context->getDiagnostics()->error(DiagMessage(outputPath)
+    context->GetDiagnostics()->Error(DiagMessage(output_path)
                                      << "failed to write data");
     return false;
   }
   return true;
 }
 
-static bool compileXml(IAaptContext* context, const CompileOptions& options,
-                       const ResourcePathData& pathData, IArchiveWriter* writer,
-                       const std::string& outputPath) {
-  if (context->verbose()) {
-    context->getDiagnostics()->note(DiagMessage(pathData.source)
+static bool CompileXml(IAaptContext* context, const CompileOptions& options,
+                       const ResourcePathData& path_data,
+                       IArchiveWriter* writer, const std::string& output_path) {
+  if (context->IsVerbose()) {
+    context->GetDiagnostics()->Note(DiagMessage(path_data.source)
                                     << "compiling XML");
   }
 
-  std::unique_ptr<xml::XmlResource> xmlRes;
+  std::unique_ptr<xml::XmlResource> xmlres;
   {
-    std::ifstream fin(pathData.source.path, std::ifstream::binary);
+    std::ifstream fin(path_data.source.path, std::ifstream::binary);
     if (!fin) {
-      context->getDiagnostics()->error(DiagMessage(pathData.source)
+      context->GetDiagnostics()->Error(DiagMessage(path_data.source)
                                        << strerror(errno));
       return false;
     }
 
-    xmlRes = xml::inflate(&fin, context->getDiagnostics(), pathData.source);
+    xmlres = xml::Inflate(&fin, context->GetDiagnostics(), path_data.source);
 
     fin.close();
   }
 
-  if (!xmlRes) {
+  if (!xmlres) {
     return false;
   }
 
-  xmlRes->file.name =
-      ResourceName({}, *parseResourceType(pathData.resourceDir), pathData.name);
-  xmlRes->file.config = pathData.config;
-  xmlRes->file.source = pathData.source;
+  xmlres->file.name = ResourceName(
+      {}, *ParseResourceType(path_data.resource_dir), path_data.name);
+  xmlres->file.config = path_data.config;
+  xmlres->file.source = path_data.source;
 
   // Collect IDs that are defined here.
   XmlIdCollector collector;
-  if (!collector.consume(context, xmlRes.get())) {
+  if (!collector.Consume(context, xmlres.get())) {
     return false;
   }
 
   // Look for and process any <aapt:attr> tags and create sub-documents.
-  InlineXmlFormatParser inlineXmlFormatParser;
-  if (!inlineXmlFormatParser.consume(context, xmlRes.get())) {
+  InlineXmlFormatParser inline_xml_format_parser;
+  if (!inline_xml_format_parser.Consume(context, xmlres.get())) {
     return false;
   }
 
   // Start the entry so we can write the header.
-  if (!writer->startEntry(outputPath, 0)) {
-    context->getDiagnostics()->error(DiagMessage(outputPath)
+  if (!writer->StartEntry(output_path, 0)) {
+    context->GetDiagnostics()->Error(DiagMessage(output_path)
                                      << "failed to open file");
     return false;
   }
 
   // Make sure CopyingOutputStreamAdaptor is deleted before we call
-  // writer->finishEntry().
+  // writer->FinishEntry().
   {
     // Wrap our IArchiveWriter with an adaptor that implements the
     // ZeroCopyOutputStream
     // interface.
-    CopyingOutputStreamAdaptor copyingAdaptor(writer);
-    CompiledFileOutputStream outputStream(&copyingAdaptor);
+    CopyingOutputStreamAdaptor copying_adaptor(writer);
+    CompiledFileOutputStream output_stream(&copying_adaptor);
 
-    std::vector<std::unique_ptr<xml::XmlResource>>& inlineDocuments =
-        inlineXmlFormatParser.getExtractedInlineXmlDocuments();
+    std::vector<std::unique_ptr<xml::XmlResource>>& inline_documents =
+        inline_xml_format_parser.GetExtractedInlineXmlDocuments();
 
     // Number of CompiledFiles.
-    outputStream.WriteLittleEndian32(1 + inlineDocuments.size());
+    output_stream.WriteLittleEndian32(1 + inline_documents.size());
 
-    if (!flattenXmlToOutStream(context, outputPath, xmlRes.get(),
-                               &outputStream)) {
+    if (!FlattenXmlToOutStream(context, output_path, xmlres.get(),
+                               &output_stream)) {
       return false;
     }
 
-    for (auto& inlineXmlDoc : inlineDocuments) {
-      if (!flattenXmlToOutStream(context, outputPath, inlineXmlDoc.get(),
-                                 &outputStream)) {
+    for (auto& inline_xml_doc : inline_documents) {
+      if (!FlattenXmlToOutStream(context, output_path, inline_xml_doc.get(),
+                                 &output_stream)) {
         return false;
       }
     }
   }
 
-  if (!writer->finishEntry()) {
-    context->getDiagnostics()->error(DiagMessage(outputPath)
+  if (!writer->FinishEntry()) {
+    context->GetDiagnostics()->Error(DiagMessage(output_path)
                                      << "failed to finish writing data");
     return false;
   }
@@ -470,69 +471,69 @@
 
 class BigBufferOutputStream : public io::OutputStream {
  public:
-  explicit BigBufferOutputStream(BigBuffer* buffer) : mBuffer(buffer) {}
+  explicit BigBufferOutputStream(BigBuffer* buffer) : buffer_(buffer) {}
 
   bool Next(void** data, int* len) override {
     size_t count;
-    *data = mBuffer->nextBlock(&count);
+    *data = buffer_->NextBlock(&count);
     *len = static_cast<int>(count);
     return true;
   }
 
-  void BackUp(int count) override { mBuffer->backUp(count); }
+  void BackUp(int count) override { buffer_->BackUp(count); }
 
-  int64_t ByteCount() const override { return mBuffer->size(); }
+  int64_t ByteCount() const override { return buffer_->size(); }
 
   bool HadError() const override { return false; }
 
  private:
-  BigBuffer* mBuffer;
+  BigBuffer* buffer_;
 
   DISALLOW_COPY_AND_ASSIGN(BigBufferOutputStream);
 };
 
-static bool compilePng(IAaptContext* context, const CompileOptions& options,
-                       const ResourcePathData& pathData, IArchiveWriter* writer,
-                       const std::string& outputPath) {
-  if (context->verbose()) {
-    context->getDiagnostics()->note(DiagMessage(pathData.source)
+static bool CompilePng(IAaptContext* context, const CompileOptions& options,
+                       const ResourcePathData& path_data,
+                       IArchiveWriter* writer, const std::string& output_path) {
+  if (context->IsVerbose()) {
+    context->GetDiagnostics()->Note(DiagMessage(path_data.source)
                                     << "compiling PNG");
   }
 
   BigBuffer buffer(4096);
-  ResourceFile resFile;
-  resFile.name =
-      ResourceName({}, *parseResourceType(pathData.resourceDir), pathData.name);
-  resFile.config = pathData.config;
-  resFile.source = pathData.source;
+  ResourceFile res_file;
+  res_file.name = ResourceName({}, *ParseResourceType(path_data.resource_dir),
+                               path_data.name);
+  res_file.config = path_data.config;
+  res_file.source = path_data.source;
 
   {
     std::string content;
-    if (!android::base::ReadFileToString(pathData.source.path, &content)) {
-      context->getDiagnostics()->error(
-          DiagMessage(pathData.source)
+    if (!android::base::ReadFileToString(path_data.source.path, &content)) {
+      context->GetDiagnostics()->Error(
+          DiagMessage(path_data.source)
           << android::base::SystemErrorCodeToString(errno));
       return false;
     }
 
-    BigBuffer crunchedPngBuffer(4096);
-    BigBufferOutputStream crunchedPngBufferOut(&crunchedPngBuffer);
+    BigBuffer crunched_png_buffer(4096);
+    BigBufferOutputStream crunched_png_buffer_out(&crunched_png_buffer);
 
     // Ensure that we only keep the chunks we care about if we end up
     // using the original PNG instead of the crunched one.
-    PngChunkFilter pngChunkFilter(content);
-    std::unique_ptr<Image> image = readPng(context, &pngChunkFilter);
+    PngChunkFilter png_chunk_filter(content);
+    std::unique_ptr<Image> image = ReadPng(context, &png_chunk_filter);
     if (!image) {
       return false;
     }
 
-    std::unique_ptr<NinePatch> ninePatch;
-    if (pathData.extension == "9.png") {
+    std::unique_ptr<NinePatch> nine_patch;
+    if (path_data.extension == "9.png") {
       std::string err;
-      ninePatch = NinePatch::create(image->rows.get(), image->width,
-                                    image->height, &err);
-      if (!ninePatch) {
-        context->getDiagnostics()->error(DiagMessage() << err);
+      nine_patch = NinePatch::Create(image->rows.get(), image->width,
+                                     image->height, &err);
+      if (!nine_patch) {
+        context->GetDiagnostics()->Error(DiagMessage() << err);
         return false;
       }
 
@@ -549,89 +550,91 @@
         memmove(image->rows[h], image->rows[h] + 4, image->width * 4);
       }
 
-      if (context->verbose()) {
-        context->getDiagnostics()->note(DiagMessage(pathData.source)
-                                        << "9-patch: " << *ninePatch);
+      if (context->IsVerbose()) {
+        context->GetDiagnostics()->Note(DiagMessage(path_data.source)
+                                        << "9-patch: " << *nine_patch);
       }
     }
 
     // Write the crunched PNG.
-    if (!writePng(context, image.get(), ninePatch.get(), &crunchedPngBufferOut,
-                  {})) {
+    if (!WritePng(context, image.get(), nine_patch.get(),
+                  &crunched_png_buffer_out, {})) {
       return false;
     }
 
-    if (ninePatch != nullptr ||
-        crunchedPngBufferOut.ByteCount() <= pngChunkFilter.ByteCount()) {
+    if (nine_patch != nullptr ||
+        crunched_png_buffer_out.ByteCount() <= png_chunk_filter.ByteCount()) {
       // No matter what, we must use the re-encoded PNG, even if it is larger.
       // 9-patch images must be re-encoded since their borders are stripped.
-      buffer.appendBuffer(std::move(crunchedPngBuffer));
+      buffer.AppendBuffer(std::move(crunched_png_buffer));
     } else {
       // The re-encoded PNG is larger than the original, and there is
       // no mandatory transformation. Use the original.
-      if (context->verbose()) {
-        context->getDiagnostics()->note(
-            DiagMessage(pathData.source)
+      if (context->IsVerbose()) {
+        context->GetDiagnostics()->Note(
+            DiagMessage(path_data.source)
             << "original PNG is smaller than crunched PNG"
             << ", using original");
       }
 
-      PngChunkFilter pngChunkFilterAgain(content);
-      BigBuffer filteredPngBuffer(4096);
-      BigBufferOutputStream filteredPngBufferOut(&filteredPngBuffer);
-      io::copy(&filteredPngBufferOut, &pngChunkFilterAgain);
-      buffer.appendBuffer(std::move(filteredPngBuffer));
+      PngChunkFilter png_chunk_filter_again(content);
+      BigBuffer filtered_png_buffer(4096);
+      BigBufferOutputStream filtered_png_buffer_out(&filtered_png_buffer);
+      io::Copy(&filtered_png_buffer_out, &png_chunk_filter_again);
+      buffer.AppendBuffer(std::move(filtered_png_buffer));
     }
 
-    if (context->verbose()) {
+    if (context->IsVerbose()) {
       // 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 legacyStream(content);
-      BigBuffer legacyBuffer(4096);
-      Png png(context->getDiagnostics());
-      if (!png.process(pathData.source, &legacyStream, &legacyBuffer, {})) {
+      std::stringstream legacy_stream(content);
+      BigBuffer legacy_buffer(4096);
+      Png png(context->GetDiagnostics());
+      if (!png.process(path_data.source, &legacy_stream, &legacy_buffer, {})) {
         return false;
       }
 
-      context->getDiagnostics()->note(DiagMessage(pathData.source)
-                                      << "legacy=" << legacyBuffer.size()
+      context->GetDiagnostics()->Note(DiagMessage(path_data.source)
+                                      << "legacy=" << legacy_buffer.size()
                                       << " new=" << buffer.size());
     }
   }
 
-  if (!writeHeaderAndBufferToWriter(outputPath, resFile, buffer, writer,
-                                    context->getDiagnostics())) {
+  if (!WriteHeaderAndBufferToWriter(output_path, res_file, buffer, writer,
+                                    context->GetDiagnostics())) {
     return false;
   }
   return true;
 }
 
-static bool compileFile(IAaptContext* context, const CompileOptions& options,
-                        const ResourcePathData& pathData,
-                        IArchiveWriter* writer, const std::string& outputPath) {
-  if (context->verbose()) {
-    context->getDiagnostics()->note(DiagMessage(pathData.source)
+static bool CompileFile(IAaptContext* context, const CompileOptions& options,
+                        const ResourcePathData& path_data,
+                        IArchiveWriter* writer,
+                        const std::string& output_path) {
+  if (context->IsVerbose()) {
+    context->GetDiagnostics()->Note(DiagMessage(path_data.source)
                                     << "compiling file");
   }
 
   BigBuffer buffer(256);
-  ResourceFile resFile;
-  resFile.name =
-      ResourceName({}, *parseResourceType(pathData.resourceDir), pathData.name);
-  resFile.config = pathData.config;
-  resFile.source = pathData.source;
+  ResourceFile res_file;
+  res_file.name = ResourceName({}, *ParseResourceType(path_data.resource_dir),
+                               path_data.name);
+  res_file.config = path_data.config;
+  res_file.source = path_data.source;
 
-  std::string errorStr;
-  Maybe<android::FileMap> f = file::mmapPath(pathData.source.path, &errorStr);
+  std::string error_str;
+  Maybe<android::FileMap> f = file::MmapPath(path_data.source.path, &error_str);
   if (!f) {
-    context->getDiagnostics()->error(DiagMessage(pathData.source) << errorStr);
+    context->GetDiagnostics()->Error(DiagMessage(path_data.source)
+                                     << error_str);
     return false;
   }
 
-  if (!writeHeaderAndMmapToWriter(outputPath, resFile, f.value(), writer,
-                                  context->getDiagnostics())) {
+  if (!WriteHeaderAndMmapToWriter(output_path, res_file, f.value(), writer,
+                                  context->GetDiagnostics())) {
     return false;
   }
   return true;
@@ -639,155 +642,156 @@
 
 class CompileContext : public IAaptContext {
  public:
-  void setVerbose(bool val) { mVerbose = val; }
+  void SetVerbose(bool val) { verbose_ = val; }
 
-  bool verbose() override { return mVerbose; }
+  bool IsVerbose() override { return verbose_; }
 
-  IDiagnostics* getDiagnostics() override { return &mDiagnostics; }
+  IDiagnostics* GetDiagnostics() override { return &diagnostics_; }
 
-  NameMangler* getNameMangler() override {
+  NameMangler* GetNameMangler() override {
     abort();
     return nullptr;
   }
 
-  const std::string& getCompilationPackage() override {
+  const std::string& GetCompilationPackage() override {
     static std::string empty;
     return empty;
   }
 
-  uint8_t getPackageId() override { return 0x0; }
+  uint8_t GetPackageId() override { return 0x0; }
 
-  SymbolTable* getExternalSymbols() override {
+  SymbolTable* GetExternalSymbols() override {
     abort();
     return nullptr;
   }
 
-  int getMinSdkVersion() override { return 0; }
+  int GetMinSdkVersion() override { return 0; }
 
  private:
-  StdErrDiagnostics mDiagnostics;
-  bool mVerbose = false;
+  StdErrDiagnostics diagnostics_;
+  bool verbose_ = false;
 };
 
 /**
  * Entry point for compilation phase. Parses arguments and dispatches to the
  * correct steps.
  */
-int compile(const std::vector<StringPiece>& args) {
+int Compile(const std::vector<StringPiece>& args) {
   CompileContext context;
   CompileOptions options;
 
   bool verbose = false;
   Flags flags =
       Flags()
-          .requiredFlag("-o", "Output path", &options.outputPath)
-          .optionalFlag("--dir", "Directory to scan for resources",
-                        &options.resDir)
-          .optionalSwitch("--pseudo-localize",
+          .RequiredFlag("-o", "Output path", &options.output_path)
+          .OptionalFlag("--dir", "Directory to scan for resources",
+                        &options.res_dir)
+          .OptionalSwitch("--pseudo-localize",
                           "Generate resources for pseudo-locales "
                           "(en-XA and ar-XB)",
                           &options.pseudolocalize)
-          .optionalSwitch(
+          .OptionalSwitch(
               "--legacy",
               "Treat errors that used to be valid in AAPT as warnings",
-              &options.legacyMode)
-          .optionalSwitch("-v", "Enables verbose logging", &verbose);
-  if (!flags.parse("aapt2 compile", args, &std::cerr)) {
+              &options.legacy_mode)
+          .OptionalSwitch("-v", "Enables verbose logging", &verbose);
+  if (!flags.Parse("aapt2 compile", args, &std::cerr)) {
     return 1;
   }
 
-  context.setVerbose(verbose);
+  context.SetVerbose(verbose);
 
-  std::unique_ptr<IArchiveWriter> archiveWriter;
+  std::unique_ptr<IArchiveWriter> archive_writer;
 
-  std::vector<ResourcePathData> inputData;
-  if (options.resDir) {
-    if (!flags.getArgs().empty()) {
+  std::vector<ResourcePathData> input_data;
+  if (options.res_dir) {
+    if (!flags.GetArgs().empty()) {
       // Can't have both files and a resource directory.
-      context.getDiagnostics()->error(DiagMessage()
+      context.GetDiagnostics()->Error(DiagMessage()
                                       << "files given but --dir specified");
-      flags.usage("aapt2 compile", &std::cerr);
+      flags.Usage("aapt2 compile", &std::cerr);
       return 1;
     }
 
-    if (!loadInputFilesFromDir(&context, options, &inputData)) {
+    if (!LoadInputFilesFromDir(&context, options, &input_data)) {
       return 1;
     }
 
-    archiveWriter = createZipFileArchiveWriter(context.getDiagnostics(),
-                                               options.outputPath);
+    archive_writer = CreateZipFileArchiveWriter(context.GetDiagnostics(),
+                                                options.output_path);
 
   } else {
-    inputData.reserve(flags.getArgs().size());
+    input_data.reserve(flags.GetArgs().size());
 
     // Collect data from the path for each input file.
-    for (const std::string& arg : flags.getArgs()) {
-      std::string errorStr;
-      if (Maybe<ResourcePathData> pathData =
-              extractResourcePathData(arg, &errorStr)) {
-        inputData.push_back(std::move(pathData.value()));
+    for (const std::string& arg : flags.GetArgs()) {
+      std::string error_str;
+      if (Maybe<ResourcePathData> path_data =
+              ExtractResourcePathData(arg, &error_str)) {
+        input_data.push_back(std::move(path_data.value()));
       } else {
-        context.getDiagnostics()->error(DiagMessage() << errorStr << " (" << arg
-                                                      << ")");
+        context.GetDiagnostics()->Error(DiagMessage() << error_str << " ("
+                                                      << arg << ")");
         return 1;
       }
     }
 
-    archiveWriter = createDirectoryArchiveWriter(context.getDiagnostics(),
-                                                 options.outputPath);
+    archive_writer = CreateDirectoryArchiveWriter(context.GetDiagnostics(),
+                                                  options.output_path);
   }
 
-  if (!archiveWriter) {
+  if (!archive_writer) {
     return 1;
   }
 
   bool error = false;
-  for (ResourcePathData& pathData : inputData) {
+  for (ResourcePathData& path_data : input_data) {
     if (options.verbose) {
-      context.getDiagnostics()->note(DiagMessage(pathData.source)
+      context.GetDiagnostics()->Note(DiagMessage(path_data.source)
                                      << "processing");
     }
 
-    if (pathData.resourceDir == "values") {
+    if (path_data.resource_dir == "values") {
       // Overwrite the extension.
-      pathData.extension = "arsc";
+      path_data.extension = "arsc";
 
-      const std::string outputFilename = buildIntermediateFilename(pathData);
-      if (!compileTable(&context, options, pathData, archiveWriter.get(),
-                        outputFilename)) {
+      const std::string output_filename = BuildIntermediateFilename(path_data);
+      if (!CompileTable(&context, options, path_data, archive_writer.get(),
+                        output_filename)) {
         error = true;
       }
 
     } else {
-      const std::string outputFilename = buildIntermediateFilename(pathData);
-      if (const ResourceType* type = parseResourceType(pathData.resourceDir)) {
+      const std::string output_filename = BuildIntermediateFilename(path_data);
+      if (const ResourceType* type =
+              ParseResourceType(path_data.resource_dir)) {
         if (*type != ResourceType::kRaw) {
-          if (pathData.extension == "xml") {
-            if (!compileXml(&context, options, pathData, archiveWriter.get(),
-                            outputFilename)) {
+          if (path_data.extension == "xml") {
+            if (!CompileXml(&context, options, path_data, archive_writer.get(),
+                            output_filename)) {
               error = true;
             }
-          } else if (pathData.extension == "png" ||
-                     pathData.extension == "9.png") {
-            if (!compilePng(&context, options, pathData, archiveWriter.get(),
-                            outputFilename)) {
+          } else if (path_data.extension == "png" ||
+                     path_data.extension == "9.png") {
+            if (!CompilePng(&context, options, path_data, archive_writer.get(),
+                            output_filename)) {
               error = true;
             }
           } else {
-            if (!compileFile(&context, options, pathData, archiveWriter.get(),
-                             outputFilename)) {
+            if (!CompileFile(&context, options, path_data, archive_writer.get(),
+                             output_filename)) {
               error = true;
             }
           }
         } else {
-          if (!compileFile(&context, options, pathData, archiveWriter.get(),
-                           outputFilename)) {
+          if (!CompileFile(&context, options, path_data, archive_writer.get(),
+                           output_filename)) {
             error = true;
           }
         }
       } else {
-        context.getDiagnostics()->error(
-            DiagMessage() << "invalid file path '" << pathData.source << "'");
+        context.GetDiagnostics()->Error(
+            DiagMessage() << "invalid file path '" << path_data.source << "'");
         error = true;
       }
     }
diff --git a/tools/aapt2/compile/IdAssigner.cpp b/tools/aapt2/compile/IdAssigner.cpp
index 73eb066..17c22c5 100644
--- a/tools/aapt2/compile/IdAssigner.cpp
+++ b/tools/aapt2/compile/IdAssigner.cpp
@@ -15,13 +15,15 @@
  */
 
 #include "compile/IdAssigner.h"
+
+#include <map>
+
+#include "android-base/logging.h"
+
 #include "ResourceTable.h"
 #include "process/IResourceTableConsumer.h"
 #include "util/Util.h"
 
-#include <cassert>
-#include <map>
-
 namespace aapt {
 
 /**
@@ -29,44 +31,44 @@
  * ResourceEntry,
  * as long as there is no existing ID or the ID is the same.
  */
-static bool assignId(IDiagnostics* diag, const ResourceId& id,
+static bool AssignId(IDiagnostics* diag, const ResourceId& id,
                      const ResourceName& name, ResourceTablePackage* pkg,
                      ResourceTableType* type, ResourceEntry* entry) {
-  if (pkg->id.value() == id.packageId()) {
-    if (!type->id || type->id.value() == id.typeId()) {
-      type->id = id.typeId();
+  if (pkg->id.value() == id.package_id()) {
+    if (!type->id || type->id.value() == id.type_id()) {
+      type->id = id.type_id();
 
-      if (!entry->id || entry->id.value() == id.entryId()) {
-        entry->id = id.entryId();
+      if (!entry->id || entry->id.value() == id.entry_id()) {
+        entry->id = id.entry_id();
         return true;
       }
     }
   }
 
-  const ResourceId existingId(pkg->id.value(), type->id ? type->id.value() : 0,
-                              entry->id ? entry->id.value() : 0);
-  diag->error(DiagMessage() << "can't assign ID " << id << " to resource "
-                            << name << " with conflicting ID " << existingId);
+  const ResourceId existing_id(pkg->id.value(), type->id ? type->id.value() : 0,
+                               entry->id ? entry->id.value() : 0);
+  diag->Error(DiagMessage() << "can't assign ID " << id << " to resource "
+                            << name << " with conflicting ID " << existing_id);
   return false;
 }
 
-bool IdAssigner::consume(IAaptContext* context, ResourceTable* table) {
-  std::map<ResourceId, ResourceName> assignedIds;
+bool IdAssigner::Consume(IAaptContext* context, ResourceTable* table) {
+  std::map<ResourceId, ResourceName> assigned_ids;
 
   for (auto& package : table->packages) {
-    assert(package->id && "packages must have manually assigned IDs");
+    CHECK(bool(package->id)) << "packages must have manually assigned IDs";
 
     for (auto& type : package->types) {
       for (auto& entry : type->entries) {
         const ResourceName name(package->name, type->type, entry->name);
 
-        if (mAssignedIdMap) {
+        if (assigned_id_map_) {
           // Assign the pre-assigned stable ID meant for this resource.
-          const auto iter = mAssignedIdMap->find(name);
-          if (iter != mAssignedIdMap->end()) {
-            const ResourceId assignedId = iter->second;
+          const auto iter = assigned_id_map_->find(name);
+          if (iter != assigned_id_map_->end()) {
+            const ResourceId assigned_id = iter->second;
             const bool result =
-                assignId(context->getDiagnostics(), assignedId, name,
+                AssignId(context->GetDiagnostics(), assigned_id, name,
                          package.get(), type.get(), entry.get());
             if (!result) {
               return false;
@@ -76,14 +78,14 @@
 
         if (package->id && type->id && entry->id) {
           // If the ID is set for this resource, then reserve it.
-          ResourceId resourceId(package->id.value(), type->id.value(),
-                                entry->id.value());
-          auto result = assignedIds.insert({resourceId, name});
-          const ResourceName& existingName = result.first->second;
+          ResourceId resource_id(package->id.value(), type->id.value(),
+                                 entry->id.value());
+          auto result = assigned_ids.insert({resource_id, name});
+          const ResourceName& existing_name = result.first->second;
           if (!result.second) {
-            context->getDiagnostics()->error(
+            context->GetDiagnostics()->Error(
                 DiagMessage() << "resource " << name << " has same ID "
-                              << resourceId << " as " << existingName);
+                              << resource_id << " as " << existing_name);
             return false;
           }
         }
@@ -91,20 +93,20 @@
     }
   }
 
-  if (mAssignedIdMap) {
+  if (assigned_id_map_) {
     // Reserve all the IDs mentioned in the stable ID map. That way we won't
     // assign
     // IDs that were listed in the map if they don't exist in the table.
-    for (const auto& stableIdEntry : *mAssignedIdMap) {
-      const ResourceName& preAssignedName = stableIdEntry.first;
-      const ResourceId& preAssignedId = stableIdEntry.second;
-      auto result = assignedIds.insert({preAssignedId, preAssignedName});
-      const ResourceName& existingName = result.first->second;
-      if (!result.second && existingName != preAssignedName) {
-        context->getDiagnostics()->error(
-            DiagMessage() << "stable ID " << preAssignedId << " for resource "
-                          << preAssignedName << " is already taken by resource "
-                          << existingName);
+    for (const auto& stable_id_entry : *assigned_id_map_) {
+      const ResourceName& pre_assigned_name = stable_id_entry.first;
+      const ResourceId& pre_assigned_id = stable_id_entry.second;
+      auto result = assigned_ids.insert({pre_assigned_id, pre_assigned_name});
+      const ResourceName& existing_name = result.first->second;
+      if (!result.second && existing_name != pre_assigned_name) {
+        context->GetDiagnostics()->Error(
+            DiagMessage() << "stable ID " << pre_assigned_id << " for resource "
+                          << pre_assigned_name
+                          << " is already taken by resource " << existing_name);
         return false;
       }
     }
@@ -114,21 +116,21 @@
   // if possible,
   // unless those IDs have been reserved.
 
-  const auto assignedIdsIterEnd = assignedIds.end();
+  const auto assigned_ids_iter_end = assigned_ids.end();
   for (auto& package : table->packages) {
-    assert(package->id && "packages must have manually assigned IDs");
+    CHECK(bool(package->id)) << "packages must have manually assigned IDs";
 
     // Build a half filled ResourceId object, which will be used to find the
     // closest matching
     // reserved ID in the assignedId map. From that point the next available
     // type ID can be
     // found.
-    ResourceId resourceId(package->id.value(), 0, 0);
-    uint8_t nextExpectedTypeId = 1;
+    ResourceId resource_id(package->id.value(), 0, 0);
+    uint8_t next_expected_type_id = 1;
 
     // Find the closest matching ResourceId that is <= the one with only the
     // package set.
-    auto nextTypeIter = assignedIds.lower_bound(resourceId);
+    auto next_type_iter = assigned_ids.lower_bound(resource_id);
     for (auto& type : package->types) {
       if (!type->id) {
         // We need to assign a type ID. Iterate over the reserved IDs until we
@@ -136,41 +138,41 @@
         // some type ID that is a distance of 2 greater than the last one we've
         // seen.
         // That means there is an available type ID between these reserved IDs.
-        while (nextTypeIter != assignedIdsIterEnd) {
-          if (nextTypeIter->first.packageId() != package->id.value()) {
+        while (next_type_iter != assigned_ids_iter_end) {
+          if (next_type_iter->first.package_id() != package->id.value()) {
             break;
           }
 
-          const uint8_t typeId = nextTypeIter->first.typeId();
-          if (typeId > nextExpectedTypeId) {
+          const uint8_t type_id = next_type_iter->first.type_id();
+          if (type_id > next_expected_type_id) {
             // There is a gap in the type IDs, so use the missing one.
-            type->id = nextExpectedTypeId++;
+            type->id = next_expected_type_id++;
             break;
           }
 
           // Set our expectation to be the next type ID after the reserved one
           // we
           // just saw.
-          nextExpectedTypeId = typeId + 1;
+          next_expected_type_id = type_id + 1;
 
           // Move to the next reserved ID.
-          ++nextTypeIter;
+          ++next_type_iter;
         }
 
         if (!type->id) {
           // We must have hit the end of the reserved IDs and not found a gap.
           // That means the next ID is available.
-          type->id = nextExpectedTypeId++;
+          type->id = next_expected_type_id++;
         }
       }
 
-      resourceId = ResourceId(package->id.value(), type->id.value(), 0);
-      uint16_t nextExpectedEntryId = 0;
+      resource_id = ResourceId(package->id.value(), type->id.value(), 0);
+      uint16_t next_expected_entry_id = 0;
 
       // Find the closest matching ResourceId that is <= the one with only the
       // package
       // and type set.
-      auto nextEntryIter = assignedIds.lower_bound(resourceId);
+      auto next_entry_iter = assigned_ids.lower_bound(resource_id);
       for (auto& entry : type->entries) {
         if (!entry->id) {
           // We need to assign an entry ID. Iterate over the reserved IDs until
@@ -179,32 +181,32 @@
           // we've seen.
           // That means there is an available entry ID between these reserved
           // IDs.
-          while (nextEntryIter != assignedIdsIterEnd) {
-            if (nextEntryIter->first.packageId() != package->id.value() ||
-                nextEntryIter->first.typeId() != type->id.value()) {
+          while (next_entry_iter != assigned_ids_iter_end) {
+            if (next_entry_iter->first.package_id() != package->id.value() ||
+                next_entry_iter->first.type_id() != type->id.value()) {
               break;
             }
 
-            const uint16_t entryId = nextEntryIter->first.entryId();
-            if (entryId > nextExpectedEntryId) {
+            const uint16_t entry_id = next_entry_iter->first.entry_id();
+            if (entry_id > next_expected_entry_id) {
               // There is a gap in the entry IDs, so use the missing one.
-              entry->id = nextExpectedEntryId++;
+              entry->id = next_expected_entry_id++;
               break;
             }
 
             // Set our expectation to be the next type ID after the reserved one
             // we
             // just saw.
-            nextExpectedEntryId = entryId + 1;
+            next_expected_entry_id = entry_id + 1;
 
             // Move to the next reserved entry ID.
-            ++nextEntryIter;
+            ++next_entry_iter;
           }
 
           if (!entry->id) {
             // We must have hit the end of the reserved IDs and not found a gap.
             // That means the next ID is available.
-            entry->id = nextExpectedEntryId++;
+            entry->id = next_expected_entry_id++;
           }
         }
       }
diff --git a/tools/aapt2/compile/IdAssigner.h b/tools/aapt2/compile/IdAssigner.h
index d399064..371ec01 100644
--- a/tools/aapt2/compile/IdAssigner.h
+++ b/tools/aapt2/compile/IdAssigner.h
@@ -17,11 +17,12 @@
 #ifndef AAPT_COMPILE_IDASSIGNER_H
 #define AAPT_COMPILE_IDASSIGNER_H
 
+#include <unordered_map>
+
 #include "Resource.h"
 #include "process/IResourceTableConsumer.h"
 
-#include <android-base/macros.h>
-#include <unordered_map>
+#include "android-base/macros.h"
 
 namespace aapt {
 
@@ -34,12 +35,13 @@
  public:
   IdAssigner() = default;
   explicit IdAssigner(const std::unordered_map<ResourceName, ResourceId>* map)
-      : mAssignedIdMap(map) {}
+      : assigned_id_map_(map) {}
 
-  bool consume(IAaptContext* context, ResourceTable* table) override;
+  bool Consume(IAaptContext* context, ResourceTable* table) override;
 
  private:
-  const std::unordered_map<ResourceName, ResourceId>* mAssignedIdMap = nullptr;
+  const std::unordered_map<ResourceName, ResourceId>* assigned_id_map_ =
+      nullptr;
 };
 
 }  // namespace aapt
diff --git a/tools/aapt2/compile/IdAssigner_test.cpp b/tools/aapt2/compile/IdAssigner_test.cpp
index ff7bf5c..d465091 100644
--- a/tools/aapt2/compile/IdAssigner_test.cpp
+++ b/tools/aapt2/compile/IdAssigner_test.cpp
@@ -15,128 +15,129 @@
  */
 
 #include "compile/IdAssigner.h"
+
 #include "test/Test.h"
 
 namespace aapt {
 
-::testing::AssertionResult verifyIds(ResourceTable* table);
+::testing::AssertionResult VerifyIds(ResourceTable* table);
 
 TEST(IdAssignerTest, AssignIds) {
   std::unique_ptr<ResourceTable> table = test::ResourceTableBuilder()
-                                             .addSimple("android:attr/foo")
-                                             .addSimple("android:attr/bar")
-                                             .addSimple("android:id/foo")
-                                             .setPackageId("android", 0x01)
-                                             .build();
+                                             .AddSimple("android:attr/foo")
+                                             .AddSimple("android:attr/bar")
+                                             .AddSimple("android:id/foo")
+                                             .SetPackageId("android", 0x01)
+                                             .Build();
 
-  std::unique_ptr<IAaptContext> context = test::ContextBuilder().build();
+  std::unique_ptr<IAaptContext> context = test::ContextBuilder().Build();
   IdAssigner assigner;
 
-  ASSERT_TRUE(assigner.consume(context.get(), table.get()));
-  ASSERT_TRUE(verifyIds(table.get()));
+  ASSERT_TRUE(assigner.Consume(context.get(), table.get()));
+  ASSERT_TRUE(VerifyIds(table.get()));
 }
 
 TEST(IdAssignerTest, AssignIdsWithReservedIds) {
   std::unique_ptr<ResourceTable> table =
       test::ResourceTableBuilder()
-          .addSimple("android:id/foo", ResourceId(0x01010000))
-          .addSimple("android:dimen/two")
-          .addSimple("android:integer/three")
-          .addSimple("android:string/five")
-          .addSimple("android:attr/fun", ResourceId(0x01040000))
-          .addSimple("android:attr/foo", ResourceId(0x01040006))
-          .addSimple("android:attr/bar")
-          .addSimple("android:attr/baz")
-          .addSimple("app:id/biz")
-          .setPackageId("android", 0x01)
-          .setPackageId("app", 0x7f)
-          .build();
+          .AddSimple("android:id/foo", ResourceId(0x01010000))
+          .AddSimple("android:dimen/two")
+          .AddSimple("android:integer/three")
+          .AddSimple("android:string/five")
+          .AddSimple("android:attr/fun", ResourceId(0x01040000))
+          .AddSimple("android:attr/foo", ResourceId(0x01040006))
+          .AddSimple("android:attr/bar")
+          .AddSimple("android:attr/baz")
+          .AddSimple("app:id/biz")
+          .SetPackageId("android", 0x01)
+          .SetPackageId("app", 0x7f)
+          .Build();
 
-  std::unique_ptr<IAaptContext> context = test::ContextBuilder().build();
+  std::unique_ptr<IAaptContext> context = test::ContextBuilder().Build();
   IdAssigner assigner;
 
-  ASSERT_TRUE(assigner.consume(context.get(), table.get()));
-  ASSERT_TRUE(verifyIds(table.get()));
+  ASSERT_TRUE(assigner.Consume(context.get(), table.get()));
+  ASSERT_TRUE(VerifyIds(table.get()));
 
-  Maybe<ResourceTable::SearchResult> maybeResult;
+  Maybe<ResourceTable::SearchResult> maybe_result;
 
   // Expect to fill in the gaps between 0x0101XXXX and 0x0104XXXX.
 
-  maybeResult = table->findResource(test::parseNameOrDie("android:dimen/two"));
-  AAPT_ASSERT_TRUE(maybeResult);
-  EXPECT_EQ(make_value<uint8_t>(2), maybeResult.value().type->id);
+  maybe_result = table->FindResource(test::ParseNameOrDie("android:dimen/two"));
+  AAPT_ASSERT_TRUE(maybe_result);
+  EXPECT_EQ(make_value<uint8_t>(2), maybe_result.value().type->id);
 
-  maybeResult =
-      table->findResource(test::parseNameOrDie("android:integer/three"));
-  AAPT_ASSERT_TRUE(maybeResult);
-  EXPECT_EQ(make_value<uint8_t>(3), maybeResult.value().type->id);
+  maybe_result =
+      table->FindResource(test::ParseNameOrDie("android:integer/three"));
+  AAPT_ASSERT_TRUE(maybe_result);
+  EXPECT_EQ(make_value<uint8_t>(3), maybe_result.value().type->id);
 
   // Expect to bypass the reserved 0x0104XXXX IDs and use the next 0x0105XXXX
   // IDs.
 
-  maybeResult =
-      table->findResource(test::parseNameOrDie("android:string/five"));
-  AAPT_ASSERT_TRUE(maybeResult);
-  EXPECT_EQ(make_value<uint8_t>(5), maybeResult.value().type->id);
+  maybe_result =
+      table->FindResource(test::ParseNameOrDie("android:string/five"));
+  AAPT_ASSERT_TRUE(maybe_result);
+  EXPECT_EQ(make_value<uint8_t>(5), maybe_result.value().type->id);
 
   // Expect to fill in the gaps between 0x01040000 and 0x01040006.
 
-  maybeResult = table->findResource(test::parseNameOrDie("android:attr/bar"));
-  AAPT_ASSERT_TRUE(maybeResult);
-  EXPECT_EQ(make_value<uint16_t>(1), maybeResult.value().entry->id);
+  maybe_result = table->FindResource(test::ParseNameOrDie("android:attr/bar"));
+  AAPT_ASSERT_TRUE(maybe_result);
+  EXPECT_EQ(make_value<uint16_t>(1), maybe_result.value().entry->id);
 
-  maybeResult = table->findResource(test::parseNameOrDie("android:attr/baz"));
-  AAPT_ASSERT_TRUE(maybeResult);
-  EXPECT_EQ(make_value<uint16_t>(2), maybeResult.value().entry->id);
+  maybe_result = table->FindResource(test::ParseNameOrDie("android:attr/baz"));
+  AAPT_ASSERT_TRUE(maybe_result);
+  EXPECT_EQ(make_value<uint16_t>(2), maybe_result.value().entry->id);
 }
 
 TEST(IdAssignerTest, FailWhenNonUniqueIdsAssigned) {
   std::unique_ptr<ResourceTable> table =
       test::ResourceTableBuilder()
-          .addSimple("android:attr/foo", ResourceId(0x01040006))
-          .addSimple("android:attr/bar", ResourceId(0x01040006))
-          .setPackageId("android", 0x01)
-          .setPackageId("app", 0x7f)
-          .build();
+          .AddSimple("android:attr/foo", ResourceId(0x01040006))
+          .AddSimple("android:attr/bar", ResourceId(0x01040006))
+          .SetPackageId("android", 0x01)
+          .SetPackageId("app", 0x7f)
+          .Build();
 
-  std::unique_ptr<IAaptContext> context = test::ContextBuilder().build();
+  std::unique_ptr<IAaptContext> context = test::ContextBuilder().Build();
   IdAssigner assigner;
 
-  ASSERT_FALSE(assigner.consume(context.get(), table.get()));
+  ASSERT_FALSE(assigner.Consume(context.get(), table.get()));
 }
 
 TEST(IdAssignerTest, AssignIdsWithIdMap) {
   std::unique_ptr<ResourceTable> table = test::ResourceTableBuilder()
-                                             .addSimple("android:attr/foo")
-                                             .addSimple("android:attr/bar")
-                                             .setPackageId("android", 0x01)
-                                             .build();
+                                             .AddSimple("android:attr/foo")
+                                             .AddSimple("android:attr/bar")
+                                             .SetPackageId("android", 0x01)
+                                             .Build();
 
-  std::unique_ptr<IAaptContext> context = test::ContextBuilder().build();
-  std::unordered_map<ResourceName, ResourceId> idMap = {
-      {test::parseNameOrDie("android:attr/foo"), ResourceId(0x01010002)}};
-  IdAssigner assigner(&idMap);
-  ASSERT_TRUE(assigner.consume(context.get(), table.get()));
-  ASSERT_TRUE(verifyIds(table.get()));
+  std::unique_ptr<IAaptContext> context = test::ContextBuilder().Build();
+  std::unordered_map<ResourceName, ResourceId> id_map = {
+      {test::ParseNameOrDie("android:attr/foo"), ResourceId(0x01010002)}};
+  IdAssigner assigner(&id_map);
+  ASSERT_TRUE(assigner.Consume(context.get(), table.get()));
+  ASSERT_TRUE(VerifyIds(table.get()));
   Maybe<ResourceTable::SearchResult> result =
-      table->findResource(test::parseNameOrDie("android:attr/foo"));
+      table->FindResource(test::ParseNameOrDie("android:attr/foo"));
   AAPT_ASSERT_TRUE(result);
 
-  const ResourceTable::SearchResult& searchResult = result.value();
-  EXPECT_EQ(make_value<uint8_t>(0x01), searchResult.package->id);
-  EXPECT_EQ(make_value<uint8_t>(0x01), searchResult.type->id);
-  EXPECT_EQ(make_value<uint16_t>(0x0002), searchResult.entry->id);
+  const ResourceTable::SearchResult& search_result = result.value();
+  EXPECT_EQ(make_value<uint8_t>(0x01), search_result.package->id);
+  EXPECT_EQ(make_value<uint8_t>(0x01), search_result.type->id);
+  EXPECT_EQ(make_value<uint16_t>(0x0002), search_result.entry->id);
 }
 
-::testing::AssertionResult verifyIds(ResourceTable* table) {
-  std::set<uint8_t> packageIds;
+::testing::AssertionResult VerifyIds(ResourceTable* table) {
+  std::set<uint8_t> package_ids;
   for (auto& package : table->packages) {
     if (!package->id) {
       return ::testing::AssertionFailure() << "package " << package->name
                                            << " has no ID";
     }
 
-    if (!packageIds.insert(package->id.value()).second) {
+    if (!package_ids.insert(package->id.value()).second) {
       return ::testing::AssertionFailure()
              << "package " << package->name << " has non-unique ID " << std::hex
              << (int)package->id.value() << std::dec;
@@ -144,7 +145,7 @@
   }
 
   for (auto& package : table->packages) {
-    std::set<uint8_t> typeIds;
+    std::set<uint8_t> type_ids;
     for (auto& type : package->types) {
       if (!type->id) {
         return ::testing::AssertionFailure() << "type " << type->type
@@ -152,7 +153,7 @@
                                              << " has no ID";
       }
 
-      if (!typeIds.insert(type->id.value()).second) {
+      if (!type_ids.insert(type->id.value()).second) {
         return ::testing::AssertionFailure()
                << "type " << type->type << " of package " << package->name
                << " has non-unique ID " << std::hex << (int)type->id.value()
@@ -161,7 +162,7 @@
     }
 
     for (auto& type : package->types) {
-      std::set<uint16_t> entryIds;
+      std::set<uint16_t> entry_ids;
       for (auto& entry : type->entries) {
         if (!entry->id) {
           return ::testing::AssertionFailure()
@@ -169,7 +170,7 @@
                  << " of package " << package->name << " has no ID";
         }
 
-        if (!entryIds.insert(entry->id.value()).second) {
+        if (!entry_ids.insert(entry->id.value()).second) {
           return ::testing::AssertionFailure()
                  << "entry " << entry->name << " of type " << type->type
                  << " of package " << package->name << " has non-unique ID "
diff --git a/tools/aapt2/compile/Image.h b/tools/aapt2/compile/Image.h
index 4cf2ea7..db0b945 100644
--- a/tools/aapt2/compile/Image.h
+++ b/tools/aapt2/compile/Image.h
@@ -17,12 +17,13 @@
 #ifndef AAPT_COMPILE_IMAGE_H
 #define AAPT_COMPILE_IMAGE_H
 
-#include <android-base/macros.h>
 #include <cstdint>
 #include <memory>
 #include <string>
 #include <vector>
 
+#include "android-base/macros.h"
+
 namespace aapt {
 
 /**
@@ -113,15 +114,15 @@
  */
 class NinePatch {
  public:
-  static std::unique_ptr<NinePatch> create(uint8_t** rows, const int32_t width,
+  static std::unique_ptr<NinePatch> Create(uint8_t** rows, const int32_t width,
                                            const int32_t height,
-                                           std::string* errOut);
+                                           std::string* err_out);
 
   /**
    * Packs the RGBA_8888 data pointed to by pixel into a uint32_t
    * with format 0xAARRGGBB (the way 9-patch expects it).
    */
-  static uint32_t packRGBA(const uint8_t* pixel);
+  static uint32_t PackRGBA(const uint8_t* pixel);
 
   /**
    * 9-patch content padding/insets. All positions are relative to the 9-patch
@@ -136,7 +137,7 @@
    * See
    * https://developer.android.com/about/versions/android-4.3.html#OpticalBounds
    */
-  Bounds layoutBounds;
+  Bounds layout_bounds;
 
   /**
    * Outline of the image, calculated based on opacity.
@@ -147,51 +148,51 @@
    * The computed radius of the outline. If non-zero, the outline is a
    * rounded-rect.
    */
-  float outlineRadius = 0.0f;
+  float outline_radius = 0.0f;
 
   /**
    * The largest alpha value within the outline.
    */
-  uint32_t outlineAlpha = 0x000000ffu;
+  uint32_t outline_alpha = 0x000000ffu;
 
   /**
    * Horizontal regions of the image that are stretchable.
    * All positions are relative to the 9-patch
    * NOT including the 1px thick source border.
    */
-  std::vector<Range> horizontalStretchRegions;
+  std::vector<Range> horizontal_stretch_regions;
 
   /**
    * Vertical regions of the image that are stretchable.
    * All positions are relative to the 9-patch
    * NOT including the 1px thick source border.
    */
-  std::vector<Range> verticalStretchRegions;
+  std::vector<Range> vertical_stretch_regions;
 
   /**
    * The colors within each region, fixed or stretchable.
    * For w*h regions, the color of region (x,y) is addressable
    * via index y*w + x.
    */
-  std::vector<uint32_t> regionColors;
+  std::vector<uint32_t> region_colors;
 
   /**
    * Returns serialized data containing the original basic 9-patch meta data.
    * Optical layout bounds and round rect outline data must be serialized
-   * separately using serializeOpticalLayoutBounds() and
-   * serializeRoundedRectOutline().
+   * separately using SerializeOpticalLayoutBounds() and
+   * SerializeRoundedRectOutline().
    */
-  std::unique_ptr<uint8_t[]> serializeBase(size_t* outLen) const;
+  std::unique_ptr<uint8_t[]> SerializeBase(size_t* out_len) const;
 
   /**
    * Serializes the layout bounds.
    */
-  std::unique_ptr<uint8_t[]> serializeLayoutBounds(size_t* outLen) const;
+  std::unique_ptr<uint8_t[]> SerializeLayoutBounds(size_t* out_len) const;
 
   /**
    * Serializes the rounded-rect outline.
    */
-  std::unique_ptr<uint8_t[]> serializeRoundedRectOutline(size_t* outLen) const;
+  std::unique_ptr<uint8_t[]> SerializeRoundedRectOutline(size_t* out_len) const;
 
  private:
   explicit NinePatch() = default;
@@ -201,7 +202,7 @@
 
 ::std::ostream& operator<<(::std::ostream& out, const Range& range);
 ::std::ostream& operator<<(::std::ostream& out, const Bounds& bounds);
-::std::ostream& operator<<(::std::ostream& out, const NinePatch& ninePatch);
+::std::ostream& operator<<(::std::ostream& out, const NinePatch& nine_patch);
 
 }  // namespace aapt
 
diff --git a/tools/aapt2/compile/InlineXmlFormatParser.cpp b/tools/aapt2/compile/InlineXmlFormatParser.cpp
index 56f72b5..786494b 100644
--- a/tools/aapt2/compile/InlineXmlFormatParser.cpp
+++ b/tools/aapt2/compile/InlineXmlFormatParser.cpp
@@ -15,16 +15,18 @@
  */
 
 #include "compile/InlineXmlFormatParser.h"
+
+#include <sstream>
+#include <string>
+
+#include "android-base/macros.h"
+
 #include "Debug.h"
 #include "ResourceUtils.h"
 #include "util/Util.h"
 #include "xml/XmlDom.h"
 #include "xml/XmlUtil.h"
 
-#include <android-base/macros.h>
-#include <sstream>
-#include <string>
-
 namespace aapt {
 
 namespace {
@@ -34,38 +36,38 @@
  */
 class Visitor : public xml::PackageAwareVisitor {
  public:
-  using xml::PackageAwareVisitor::visit;
+  using xml::PackageAwareVisitor::Visit;
 
   struct InlineDeclaration {
     xml::Element* el;
-    std::string attrNamespaceUri;
-    std::string attrName;
+    std::string attr_namespace_uri;
+    std::string attr_name;
   };
 
-  explicit Visitor(IAaptContext* context, xml::XmlResource* xmlResource)
-      : mContext(context), mXmlResource(xmlResource) {}
+  explicit Visitor(IAaptContext* context, xml::XmlResource* xml_resource)
+      : context_(context), xml_resource_(xml_resource) {}
 
-  void visit(xml::Element* el) override {
-    if (el->namespaceUri != xml::kSchemaAapt || el->name != "attr") {
-      xml::PackageAwareVisitor::visit(el);
+  void Visit(xml::Element* el) override {
+    if (el->namespace_uri != xml::kSchemaAapt || el->name != "attr") {
+      xml::PackageAwareVisitor::Visit(el);
       return;
     }
 
-    const Source& src = mXmlResource->file.source.withLine(el->lineNumber);
+    const Source& src = xml_resource_->file.source.WithLine(el->line_number);
 
-    xml::Attribute* attr = el->findAttribute({}, "name");
+    xml::Attribute* attr = el->FindAttribute({}, "name");
     if (!attr) {
-      mContext->getDiagnostics()->error(DiagMessage(src)
+      context_->GetDiagnostics()->Error(DiagMessage(src)
                                         << "missing 'name' attribute");
-      mError = true;
+      error_ = true;
       return;
     }
 
-    Maybe<Reference> ref = ResourceUtils::parseXmlAttributeName(attr->value);
+    Maybe<Reference> ref = ResourceUtils::ParseXmlAttributeName(attr->value);
     if (!ref) {
-      mContext->getDiagnostics()->error(
+      context_->GetDiagnostics()->Error(
           DiagMessage(src) << "invalid XML attribute '" << attr->value << "'");
-      mError = true;
+      error_ = true;
       return;
     }
 
@@ -76,63 +78,63 @@
     // the local package if the user specified name="style" or something. This
     // should just
     // be the default namespace.
-    Maybe<xml::ExtractedPackage> maybePkg =
-        transformPackageAlias(name.package, {});
-    if (!maybePkg) {
-      mContext->getDiagnostics()->error(DiagMessage(src)
+    Maybe<xml::ExtractedPackage> maybe_pkg =
+        TransformPackageAlias(name.package, {});
+    if (!maybe_pkg) {
+      context_->GetDiagnostics()->Error(DiagMessage(src)
                                         << "invalid namespace prefix '"
                                         << name.package << "'");
-      mError = true;
+      error_ = true;
       return;
     }
 
-    const xml::ExtractedPackage& pkg = maybePkg.value();
-    const bool privateNamespace =
-        pkg.privateNamespace || ref.value().privateReference;
+    const xml::ExtractedPackage& pkg = maybe_pkg.value();
+    const bool private_namespace =
+        pkg.private_namespace || ref.value().private_reference;
 
     InlineDeclaration decl;
     decl.el = el;
-    decl.attrName = name.entry;
+    decl.attr_name = name.entry;
     if (!pkg.package.empty()) {
-      decl.attrNamespaceUri =
-          xml::buildPackageNamespace(pkg.package, privateNamespace);
+      decl.attr_namespace_uri =
+          xml::BuildPackageNamespace(pkg.package, private_namespace);
     }
 
-    mInlineDeclarations.push_back(std::move(decl));
+    inline_declarations_.push_back(std::move(decl));
   }
 
-  const std::vector<InlineDeclaration>& getInlineDeclarations() const {
-    return mInlineDeclarations;
+  const std::vector<InlineDeclaration>& GetInlineDeclarations() const {
+    return inline_declarations_;
   }
 
-  bool hasError() const { return mError; }
+  bool HasError() const { return error_; }
 
  private:
   DISALLOW_COPY_AND_ASSIGN(Visitor);
 
-  IAaptContext* mContext;
-  xml::XmlResource* mXmlResource;
-  std::vector<InlineDeclaration> mInlineDeclarations;
-  bool mError = false;
+  IAaptContext* context_;
+  xml::XmlResource* xml_resource_;
+  std::vector<InlineDeclaration> inline_declarations_;
+  bool error_ = false;
 };
 
 }  // namespace
 
-bool InlineXmlFormatParser::consume(IAaptContext* context,
+bool InlineXmlFormatParser::Consume(IAaptContext* context,
                                     xml::XmlResource* doc) {
   Visitor visitor(context, doc);
-  doc->root->accept(&visitor);
-  if (visitor.hasError()) {
+  doc->root->Accept(&visitor);
+  if (visitor.HasError()) {
     return false;
   }
 
-  size_t nameSuffixCounter = 0;
+  size_t name_suffix_counter = 0;
   for (const Visitor::InlineDeclaration& decl :
-       visitor.getInlineDeclarations()) {
-    auto newDoc = util::make_unique<xml::XmlResource>();
-    newDoc->file.config = doc->file.config;
-    newDoc->file.source = doc->file.source.withLine(decl.el->lineNumber);
-    newDoc->file.name = doc->file.name;
+       visitor.GetInlineDeclarations()) {
+    auto new_doc = util::make_unique<xml::XmlResource>();
+    new_doc->file.config = doc->file.config;
+    new_doc->file.source = doc->file.source.WithLine(decl.el->line_number);
+    new_doc->file.name = doc->file.name;
 
     // Modify the new entry name. We need to suffix the entry with a number to
     // avoid
@@ -140,63 +142,64 @@
     // won't show up
     // in R.java.
 
-    newDoc->file.name.entry = NameMangler::mangleEntry(
-        {}, newDoc->file.name.entry + "__" + std::to_string(nameSuffixCounter));
+    new_doc->file.name.entry =
+        NameMangler::MangleEntry({}, new_doc->file.name.entry + "__" +
+                                         std::to_string(name_suffix_counter));
 
     // Extracted elements must be the only child of <aapt:attr>.
     // Make sure there is one root node in the children (ignore empty text).
     for (auto& child : decl.el->children) {
-      const Source childSource = doc->file.source.withLine(child->lineNumber);
-      if (xml::Text* t = xml::nodeCast<xml::Text>(child.get())) {
-        if (!util::trimWhitespace(t->text).empty()) {
-          context->getDiagnostics()->error(
-              DiagMessage(childSource)
+      const Source child_source = doc->file.source.WithLine(child->line_number);
+      if (xml::Text* t = xml::NodeCast<xml::Text>(child.get())) {
+        if (!util::TrimWhitespace(t->text).empty()) {
+          context->GetDiagnostics()->Error(
+              DiagMessage(child_source)
               << "can't extract text into its own resource");
           return false;
         }
-      } else if (newDoc->root) {
-        context->getDiagnostics()->error(
-            DiagMessage(childSource)
+      } else if (new_doc->root) {
+        context->GetDiagnostics()->Error(
+            DiagMessage(child_source)
             << "inline XML resources must have a single root");
         return false;
       } else {
-        newDoc->root = std::move(child);
-        newDoc->root->parent = nullptr;
+        new_doc->root = std::move(child);
+        new_doc->root->parent = nullptr;
       }
     }
 
     // Walk up and find the parent element.
     xml::Node* node = decl.el;
-    xml::Element* parentEl = nullptr;
+    xml::Element* parent_el = nullptr;
     while (node->parent &&
-           (parentEl = xml::nodeCast<xml::Element>(node->parent)) == nullptr) {
+           (parent_el = xml::NodeCast<xml::Element>(node->parent)) == nullptr) {
       node = node->parent;
     }
 
-    if (!parentEl) {
-      context->getDiagnostics()->error(
-          DiagMessage(newDoc->file.source)
+    if (!parent_el) {
+      context->GetDiagnostics()->Error(
+          DiagMessage(new_doc->file.source)
           << "no suitable parent for inheriting attribute");
       return false;
     }
 
     // Add the inline attribute to the parent.
-    parentEl->attributes.push_back(
-        xml::Attribute{decl.attrNamespaceUri, decl.attrName,
-                       "@" + newDoc->file.name.toString()});
+    parent_el->attributes.push_back(
+        xml::Attribute{decl.attr_namespace_uri, decl.attr_name,
+                       "@" + new_doc->file.name.ToString()});
 
     // Delete the subtree.
-    for (auto iter = parentEl->children.begin();
-         iter != parentEl->children.end(); ++iter) {
+    for (auto iter = parent_el->children.begin();
+         iter != parent_el->children.end(); ++iter) {
       if (iter->get() == node) {
-        parentEl->children.erase(iter);
+        parent_el->children.erase(iter);
         break;
       }
     }
 
-    mQueue.push_back(std::move(newDoc));
+    queue_.push_back(std::move(new_doc));
 
-    nameSuffixCounter++;
+    name_suffix_counter++;
   }
   return true;
 }
diff --git a/tools/aapt2/compile/InlineXmlFormatParser.h b/tools/aapt2/compile/InlineXmlFormatParser.h
index cd8794b..1a658fd 100644
--- a/tools/aapt2/compile/InlineXmlFormatParser.h
+++ b/tools/aapt2/compile/InlineXmlFormatParser.h
@@ -17,12 +17,13 @@
 #ifndef AAPT_COMPILE_INLINEXMLFORMATPARSER_H
 #define AAPT_COMPILE_INLINEXMLFORMATPARSER_H
 
-#include "process/IResourceTableConsumer.h"
-
-#include <android-base/macros.h>
 #include <memory>
 #include <vector>
 
+#include "android-base/macros.h"
+
+#include "process/IResourceTableConsumer.h"
+
 namespace aapt {
 
 /**
@@ -50,17 +51,17 @@
  public:
   explicit InlineXmlFormatParser() = default;
 
-  bool consume(IAaptContext* context, xml::XmlResource* doc) override;
+  bool Consume(IAaptContext* context, xml::XmlResource* doc) override;
 
   std::vector<std::unique_ptr<xml::XmlResource>>&
-  getExtractedInlineXmlDocuments() {
-    return mQueue;
+  GetExtractedInlineXmlDocuments() {
+    return queue_;
   }
 
  private:
   DISALLOW_COPY_AND_ASSIGN(InlineXmlFormatParser);
 
-  std::vector<std::unique_ptr<xml::XmlResource>> mQueue;
+  std::vector<std::unique_ptr<xml::XmlResource>> queue_;
 };
 
 }  // namespace aapt
diff --git a/tools/aapt2/compile/InlineXmlFormatParser_test.cpp b/tools/aapt2/compile/InlineXmlFormatParser_test.cpp
index 4adb21c..348796c 100644
--- a/tools/aapt2/compile/InlineXmlFormatParser_test.cpp
+++ b/tools/aapt2/compile/InlineXmlFormatParser_test.cpp
@@ -15,13 +15,14 @@
  */
 
 #include "compile/InlineXmlFormatParser.h"
+
 #include "test/Test.h"
 
 namespace aapt {
 
 TEST(InlineXmlFormatParserTest, PassThrough) {
-  std::unique_ptr<IAaptContext> context = test::ContextBuilder().build();
-  std::unique_ptr<xml::XmlResource> doc = test::buildXmlDom(R"EOF(
+  std::unique_ptr<IAaptContext> context = test::ContextBuilder().Build();
+  std::unique_ptr<xml::XmlResource> doc = test::BuildXmlDom(R"EOF(
       <View xmlns:android="http://schemas.android.com/apk/res/android">
         <View android:text="hey">
           <View android:id="hi" />
@@ -29,13 +30,13 @@
       </View>)EOF");
 
   InlineXmlFormatParser parser;
-  ASSERT_TRUE(parser.consume(context.get(), doc.get()));
-  EXPECT_EQ(0u, parser.getExtractedInlineXmlDocuments().size());
+  ASSERT_TRUE(parser.Consume(context.get(), doc.get()));
+  EXPECT_EQ(0u, parser.GetExtractedInlineXmlDocuments().size());
 }
 
 TEST(InlineXmlFormatParserTest, ExtractOneXmlResource) {
-  std::unique_ptr<IAaptContext> context = test::ContextBuilder().build();
-  std::unique_ptr<xml::XmlResource> doc = test::buildXmlDom(R"EOF(
+  std::unique_ptr<IAaptContext> context = test::ContextBuilder().Build();
+  std::unique_ptr<xml::XmlResource> doc = test::BuildXmlDom(R"EOF(
       <View1 xmlns:android="http://schemas.android.com/apk/res/android"
             xmlns:aapt="http://schemas.android.com/aapt">
         <aapt:attr name="android:text">
@@ -45,48 +46,48 @@
         </aapt:attr>
       </View1>)EOF");
 
-  doc->file.name = test::parseNameOrDie("layout/main");
+  doc->file.name = test::ParseNameOrDie("layout/main");
 
   InlineXmlFormatParser parser;
-  ASSERT_TRUE(parser.consume(context.get(), doc.get()));
+  ASSERT_TRUE(parser.Consume(context.get(), doc.get()));
 
   // One XML resource should have been extracted.
-  EXPECT_EQ(1u, parser.getExtractedInlineXmlDocuments().size());
+  EXPECT_EQ(1u, parser.GetExtractedInlineXmlDocuments().size());
 
-  xml::Element* el = xml::findRootElement(doc.get());
+  xml::Element* el = xml::FindRootElement(doc.get());
   ASSERT_NE(nullptr, el);
 
   EXPECT_EQ("View1", el->name);
 
   // The <aapt:attr> tag should be extracted.
-  EXPECT_EQ(nullptr, el->findChild(xml::kSchemaAapt, "attr"));
+  EXPECT_EQ(nullptr, el->FindChild(xml::kSchemaAapt, "attr"));
 
   // The 'android:text' attribute should be set with a reference.
-  xml::Attribute* attr = el->findAttribute(xml::kSchemaAndroid, "text");
+  xml::Attribute* attr = el->FindAttribute(xml::kSchemaAndroid, "text");
   ASSERT_NE(nullptr, attr);
 
-  ResourceNameRef nameRef;
-  ASSERT_TRUE(ResourceUtils::parseReference(attr->value, &nameRef));
+  ResourceNameRef name_ref;
+  ASSERT_TRUE(ResourceUtils::ParseReference(attr->value, &name_ref));
 
-  xml::XmlResource* extractedDoc =
-      parser.getExtractedInlineXmlDocuments()[0].get();
-  ASSERT_NE(nullptr, extractedDoc);
+  xml::XmlResource* extracted_doc =
+      parser.GetExtractedInlineXmlDocuments()[0].get();
+  ASSERT_NE(nullptr, extracted_doc);
 
   // Make sure the generated reference is correct.
-  EXPECT_EQ(nameRef.package, extractedDoc->file.name.package);
-  EXPECT_EQ(nameRef.type, extractedDoc->file.name.type);
-  EXPECT_EQ(nameRef.entry, extractedDoc->file.name.entry);
+  EXPECT_EQ(name_ref.package, extracted_doc->file.name.package);
+  EXPECT_EQ(name_ref.type, extracted_doc->file.name.type);
+  EXPECT_EQ(name_ref.entry, extracted_doc->file.name.entry);
 
   // Verify the structure of the extracted XML.
-  el = xml::findRootElement(extractedDoc);
+  el = xml::FindRootElement(extracted_doc);
   ASSERT_NE(nullptr, el);
   EXPECT_EQ("View2", el->name);
-  EXPECT_NE(nullptr, el->findChild({}, "View3"));
+  EXPECT_NE(nullptr, el->FindChild({}, "View3"));
 }
 
 TEST(InlineXmlFormatParserTest, ExtractTwoXmlResources) {
-  std::unique_ptr<IAaptContext> context = test::ContextBuilder().build();
-  std::unique_ptr<xml::XmlResource> doc = test::buildXmlDom(R"EOF(
+  std::unique_ptr<IAaptContext> context = test::ContextBuilder().Build();
+  std::unique_ptr<xml::XmlResource> doc = test::BuildXmlDom(R"EOF(
       <View1 xmlns:android="http://schemas.android.com/apk/res/android"
             xmlns:aapt="http://schemas.android.com/aapt">
         <aapt:attr name="android:text">
@@ -100,41 +101,41 @@
         </aapt:attr>
       </View1>)EOF");
 
-  doc->file.name = test::parseNameOrDie("layout/main");
+  doc->file.name = test::ParseNameOrDie("layout/main");
 
   InlineXmlFormatParser parser;
-  ASSERT_TRUE(parser.consume(context.get(), doc.get()));
-  ASSERT_EQ(2u, parser.getExtractedInlineXmlDocuments().size());
+  ASSERT_TRUE(parser.Consume(context.get(), doc.get()));
+  ASSERT_EQ(2u, parser.GetExtractedInlineXmlDocuments().size());
 
-  xml::Element* el = xml::findRootElement(doc.get());
+  xml::Element* el = xml::FindRootElement(doc.get());
   ASSERT_NE(nullptr, el);
 
   EXPECT_EQ("View1", el->name);
 
-  xml::Attribute* attrText = el->findAttribute(xml::kSchemaAndroid, "text");
-  ASSERT_NE(nullptr, attrText);
+  xml::Attribute* attr_text = el->FindAttribute(xml::kSchemaAndroid, "text");
+  ASSERT_NE(nullptr, attr_text);
 
-  xml::Attribute* attrDrawable =
-      el->findAttribute(xml::kSchemaAndroid, "drawable");
-  ASSERT_NE(nullptr, attrDrawable);
+  xml::Attribute* attr_drawable =
+      el->FindAttribute(xml::kSchemaAndroid, "drawable");
+  ASSERT_NE(nullptr, attr_drawable);
 
   // The two extracted resources should have different names.
-  EXPECT_NE(attrText->value, attrDrawable->value);
+  EXPECT_NE(attr_text->value, attr_drawable->value);
 
   // The child <aapt:attr> elements should be gone.
-  EXPECT_EQ(nullptr, el->findChild(xml::kSchemaAapt, "attr"));
+  EXPECT_EQ(nullptr, el->FindChild(xml::kSchemaAapt, "attr"));
 
-  xml::XmlResource* extractedDocText =
-      parser.getExtractedInlineXmlDocuments()[0].get();
-  ASSERT_NE(nullptr, extractedDocText);
-  el = xml::findRootElement(extractedDocText);
+  xml::XmlResource* extracted_doc_text =
+      parser.GetExtractedInlineXmlDocuments()[0].get();
+  ASSERT_NE(nullptr, extracted_doc_text);
+  el = xml::FindRootElement(extracted_doc_text);
   ASSERT_NE(nullptr, el);
   EXPECT_EQ("View2", el->name);
 
-  xml::XmlResource* extractedDocDrawable =
-      parser.getExtractedInlineXmlDocuments()[1].get();
-  ASSERT_NE(nullptr, extractedDocDrawable);
-  el = xml::findRootElement(extractedDocDrawable);
+  xml::XmlResource* extracted_doc_drawable =
+      parser.GetExtractedInlineXmlDocuments()[1].get();
+  ASSERT_NE(nullptr, extracted_doc_drawable);
+  el = xml::FindRootElement(extracted_doc_drawable);
   ASSERT_NE(nullptr, el);
   EXPECT_EQ("vector", el->name);
 }
diff --git a/tools/aapt2/compile/NinePatch.cpp b/tools/aapt2/compile/NinePatch.cpp
index 8842eb7..eab5c97 100644
--- a/tools/aapt2/compile/NinePatch.cpp
+++ b/tools/aapt2/compile/NinePatch.cpp
@@ -15,14 +15,16 @@
  */
 
 #include "compile/Image.h"
-#include "util/StringPiece.h"
-#include "util/Util.h"
 
-#include <androidfw/ResourceTypes.h>
 #include <sstream>
 #include <string>
 #include <vector>
 
+#include "androidfw/ResourceTypes.h"
+
+#include "util/StringPiece.h"
+#include "util/Util.h"
+
 namespace aapt {
 
 // Colors in the format 0xAARRGGBB (the way 9-patch expects it).
@@ -36,7 +38,7 @@
 /**
  * Returns the alpha value encoded in the 0xAARRGBB encoded pixel.
  */
-static uint32_t getAlpha(uint32_t color);
+static uint32_t get_alpha(uint32_t color);
 
 /**
  * Determines whether a color on an ImageLine is valid.
@@ -53,19 +55,19 @@
    * Returns true if the color specified is a neutral color
    * (no padding, stretching, or optical bounds).
    */
-  virtual bool isNeutralColor(uint32_t color) const = 0;
+  virtual bool IsNeutralColor(uint32_t color) const = 0;
 
   /**
    * Returns true if the color is either a neutral color
    * or one denoting padding, stretching, or optical bounds.
    */
-  bool isValidColor(uint32_t color) const {
+  bool IsValidColor(uint32_t color) const {
     switch (color) {
       case kPrimaryColor:
       case kSecondaryColor:
         return true;
     }
-    return isNeutralColor(color);
+    return IsNeutralColor(color);
   }
 };
 
@@ -81,42 +83,43 @@
 //
 // class ImageLine {
 // public:
-//      virtual int32_t getLength() const = 0;
-//      virtual uint32_t getColor(int32_t idx) const = 0;
+//      virtual int32_t GetLength() const = 0;
+//      virtual uint32_t GetColor(int32_t idx) const = 0;
 // };
 //
 template <typename ImageLine>
-static bool fillRanges(const ImageLine* imageLine,
-                       const ColorValidator* colorValidator,
-                       std::vector<Range>* primaryRanges,
-                       std::vector<Range>* secondaryRanges, std::string* err) {
-  const int32_t length = imageLine->getLength();
+static bool FillRanges(const ImageLine* image_line,
+                       const ColorValidator* color_validator,
+                       std::vector<Range>* primary_ranges,
+                       std::vector<Range>* secondary_ranges,
+                       std::string* out_err) {
+  const int32_t length = image_line->GetLength();
 
-  uint32_t lastColor = 0xffffffffu;
+  uint32_t last_color = 0xffffffffu;
   for (int32_t idx = 1; idx < length - 1; idx++) {
-    const uint32_t color = imageLine->getColor(idx);
-    if (!colorValidator->isValidColor(color)) {
-      *err = "found an invalid color";
+    const uint32_t color = image_line->GetColor(idx);
+    if (!color_validator->IsValidColor(color)) {
+      *out_err = "found an invalid color";
       return false;
     }
 
-    if (color != lastColor) {
+    if (color != last_color) {
       // We are ending a range. Which range?
       // note: encode the x offset without the final 1 pixel border.
-      if (lastColor == kPrimaryColor) {
-        primaryRanges->back().end = idx - 1;
-      } else if (lastColor == kSecondaryColor) {
-        secondaryRanges->back().end = idx - 1;
+      if (last_color == kPrimaryColor) {
+        primary_ranges->back().end = idx - 1;
+      } else if (last_color == kSecondaryColor) {
+        secondary_ranges->back().end = idx - 1;
       }
 
       // We are starting a range. Which range?
       // note: encode the x offset without the final 1 pixel border.
       if (color == kPrimaryColor) {
-        primaryRanges->push_back(Range(idx - 1, length - 2));
+        primary_ranges->push_back(Range(idx - 1, length - 2));
       } else if (color == kSecondaryColor) {
-        secondaryRanges->push_back(Range(idx - 1, length - 2));
+        secondary_ranges->push_back(Range(idx - 1, length - 2));
       }
-      lastColor = color;
+      last_color = color;
     }
   }
   return true;
@@ -128,19 +131,19 @@
  */
 class HorizontalImageLine {
  public:
-  explicit HorizontalImageLine(uint8_t** rows, int32_t xOffset, int32_t yOffset,
+  explicit HorizontalImageLine(uint8_t** rows, int32_t xoffset, int32_t yoffset,
                                int32_t length)
-      : mRows(rows), mXOffset(xOffset), mYOffset(yOffset), mLength(length) {}
+      : rows_(rows), xoffset_(xoffset), yoffset_(yoffset), length_(length) {}
 
-  inline int32_t getLength() const { return mLength; }
+  inline int32_t GetLength() const { return length_; }
 
-  inline uint32_t getColor(int32_t idx) const {
-    return NinePatch::packRGBA(mRows[mYOffset] + (idx + mXOffset) * 4);
+  inline uint32_t GetColor(int32_t idx) const {
+    return NinePatch::PackRGBA(rows_[yoffset_] + (idx + xoffset_) * 4);
   }
 
  private:
-  uint8_t** mRows;
-  int32_t mXOffset, mYOffset, mLength;
+  uint8_t** rows_;
+  int32_t xoffset_, yoffset_, length_;
 
   DISALLOW_COPY_AND_ASSIGN(HorizontalImageLine);
 };
@@ -151,179 +154,180 @@
  */
 class VerticalImageLine {
  public:
-  explicit VerticalImageLine(uint8_t** rows, int32_t xOffset, int32_t yOffset,
+  explicit VerticalImageLine(uint8_t** rows, int32_t xoffset, int32_t yoffset,
                              int32_t length)
-      : mRows(rows), mXOffset(xOffset), mYOffset(yOffset), mLength(length) {}
+      : rows_(rows), xoffset_(xoffset), yoffset_(yoffset), length_(length) {}
 
-  inline int32_t getLength() const { return mLength; }
+  inline int32_t GetLength() const { return length_; }
 
-  inline uint32_t getColor(int32_t idx) const {
-    return NinePatch::packRGBA(mRows[mYOffset + idx] + (mXOffset * 4));
+  inline uint32_t GetColor(int32_t idx) const {
+    return NinePatch::PackRGBA(rows_[yoffset_ + idx] + (xoffset_ * 4));
   }
 
  private:
-  uint8_t** mRows;
-  int32_t mXOffset, mYOffset, mLength;
+  uint8_t** rows_;
+  int32_t xoffset_, yoffset_, length_;
 
   DISALLOW_COPY_AND_ASSIGN(VerticalImageLine);
 };
 
 class DiagonalImageLine {
  public:
-  explicit DiagonalImageLine(uint8_t** rows, int32_t xOffset, int32_t yOffset,
-                             int32_t xStep, int32_t yStep, int32_t length)
-      : mRows(rows),
-        mXOffset(xOffset),
-        mYOffset(yOffset),
-        mXStep(xStep),
-        mYStep(yStep),
-        mLength(length) {}
+  explicit DiagonalImageLine(uint8_t** rows, int32_t xoffset, int32_t yoffset,
+                             int32_t xstep, int32_t ystep, int32_t length)
+      : rows_(rows),
+        xoffset_(xoffset),
+        yoffset_(yoffset),
+        xstep_(xstep),
+        ystep_(ystep),
+        length_(length) {}
 
-  inline int32_t getLength() const { return mLength; }
+  inline int32_t GetLength() const { return length_; }
 
-  inline uint32_t getColor(int32_t idx) const {
-    return NinePatch::packRGBA(mRows[mYOffset + (idx * mYStep)] +
-                               ((idx + mXOffset) * mXStep) * 4);
+  inline uint32_t GetColor(int32_t idx) const {
+    return NinePatch::PackRGBA(rows_[yoffset_ + (idx * ystep_)] +
+                               ((idx + xoffset_) * xstep_) * 4);
   }
 
  private:
-  uint8_t** mRows;
-  int32_t mXOffset, mYOffset, mXStep, mYStep, mLength;
+  uint8_t** rows_;
+  int32_t xoffset_, yoffset_, xstep_, ystep_, length_;
 
   DISALLOW_COPY_AND_ASSIGN(DiagonalImageLine);
 };
 
 class TransparentNeutralColorValidator : public ColorValidator {
  public:
-  bool isNeutralColor(uint32_t color) const override {
-    return getAlpha(color) == 0;
+  bool IsNeutralColor(uint32_t color) const override {
+    return get_alpha(color) == 0;
   }
 };
 
 class WhiteNeutralColorValidator : public ColorValidator {
  public:
-  bool isNeutralColor(uint32_t color) const override {
+  bool IsNeutralColor(uint32_t color) const override {
     return color == kColorOpaqueWhite;
   }
 };
 
-inline static uint32_t getAlpha(uint32_t color) {
+inline static uint32_t get_alpha(uint32_t color) {
   return (color & 0xff000000u) >> 24;
 }
 
-static bool populateBounds(const std::vector<Range>& padding,
-                           const std::vector<Range>& layoutBounds,
-                           const std::vector<Range>& stretchRegions,
-                           const int32_t length, int32_t* paddingStart,
-                           int32_t* paddingEnd, int32_t* layoutStart,
-                           int32_t* layoutEnd, const StringPiece& edgeName,
-                           std::string* err) {
+static bool PopulateBounds(const std::vector<Range>& padding,
+                           const std::vector<Range>& layout_bounds,
+                           const std::vector<Range>& stretch_regions,
+                           const int32_t length, int32_t* padding_start,
+                           int32_t* padding_end, int32_t* layout_start,
+                           int32_t* layout_end, const StringPiece& edge_name,
+                           std::string* out_err) {
   if (padding.size() > 1) {
-    std::stringstream errStream;
-    errStream << "too many padding sections on " << edgeName << " border";
-    *err = errStream.str();
+    std::stringstream err_stream;
+    err_stream << "too many padding sections on " << edge_name << " border";
+    *out_err = err_stream.str();
     return false;
   }
 
-  *paddingStart = 0;
-  *paddingEnd = 0;
+  *padding_start = 0;
+  *padding_end = 0;
   if (!padding.empty()) {
     const Range& range = padding.front();
-    *paddingStart = range.start;
-    *paddingEnd = length - range.end;
-  } else if (!stretchRegions.empty()) {
+    *padding_start = range.start;
+    *padding_end = length - range.end;
+  } else if (!stretch_regions.empty()) {
     // No padding was defined. Compute the padding from the first and last
     // stretch regions.
-    *paddingStart = stretchRegions.front().start;
-    *paddingEnd = length - stretchRegions.back().end;
+    *padding_start = stretch_regions.front().start;
+    *padding_end = length - stretch_regions.back().end;
   }
 
-  if (layoutBounds.size() > 2) {
-    std::stringstream errStream;
-    errStream << "too many layout bounds sections on " << edgeName << " border";
-    *err = errStream.str();
+  if (layout_bounds.size() > 2) {
+    std::stringstream err_stream;
+    err_stream << "too many layout bounds sections on " << edge_name
+               << " border";
+    *out_err = err_stream.str();
     return false;
   }
 
-  *layoutStart = 0;
-  *layoutEnd = 0;
-  if (layoutBounds.size() >= 1) {
-    const Range& range = layoutBounds.front();
+  *layout_start = 0;
+  *layout_end = 0;
+  if (layout_bounds.size() >= 1) {
+    const Range& range = layout_bounds.front();
     // If there is only one layout bound segment, it might not start at 0, but
     // then it should
     // end at length.
     if (range.start != 0 && range.end != length) {
-      std::stringstream errStream;
-      errStream << "layout bounds on " << edgeName
-                << " border must start at edge";
-      *err = errStream.str();
+      std::stringstream err_stream;
+      err_stream << "layout bounds on " << edge_name
+                 << " border must start at edge";
+      *out_err = err_stream.str();
       return false;
     }
-    *layoutStart = range.end;
+    *layout_start = range.end;
 
-    if (layoutBounds.size() >= 2) {
-      const Range& range = layoutBounds.back();
+    if (layout_bounds.size() >= 2) {
+      const Range& range = layout_bounds.back();
       if (range.end != length) {
-        std::stringstream errStream;
-        errStream << "layout bounds on " << edgeName
-                  << " border must start at edge";
-        *err = errStream.str();
+        std::stringstream err_stream;
+        err_stream << "layout bounds on " << edge_name
+                   << " border must start at edge";
+        *out_err = err_stream.str();
         return false;
       }
-      *layoutEnd = length - range.start;
+      *layout_end = length - range.start;
     }
   }
   return true;
 }
 
-static int32_t calculateSegmentCount(const std::vector<Range>& stretchRegions,
+static int32_t CalculateSegmentCount(const std::vector<Range>& stretch_regions,
                                      int32_t length) {
-  if (stretchRegions.size() == 0) {
+  if (stretch_regions.size() == 0) {
     return 0;
   }
 
-  const bool startIsFixed = stretchRegions.front().start != 0;
-  const bool endIsFixed = stretchRegions.back().end != length;
+  const bool start_is_fixed = stretch_regions.front().start != 0;
+  const bool end_is_fixed = stretch_regions.back().end != length;
   int32_t modifier = 0;
-  if (startIsFixed && endIsFixed) {
+  if (start_is_fixed && end_is_fixed) {
     modifier = 1;
-  } else if (!startIsFixed && !endIsFixed) {
+  } else if (!start_is_fixed && !end_is_fixed) {
     modifier = -1;
   }
-  return static_cast<int32_t>(stretchRegions.size()) * 2 + modifier;
+  return static_cast<int32_t>(stretch_regions.size()) * 2 + modifier;
 }
 
-static uint32_t getRegionColor(uint8_t** rows, const Bounds& region) {
+static uint32_t GetRegionColor(uint8_t** rows, const Bounds& region) {
   // Sample the first pixel to compare against.
-  const uint32_t expectedColor =
-      NinePatch::packRGBA(rows[region.top] + region.left * 4);
+  const uint32_t expected_color =
+      NinePatch::PackRGBA(rows[region.top] + region.left * 4);
   for (int32_t y = region.top; y < region.bottom; y++) {
     const uint8_t* row = rows[y];
     for (int32_t x = region.left; x < region.right; x++) {
-      const uint32_t color = NinePatch::packRGBA(row + x * 4);
-      if (getAlpha(color) == 0) {
+      const uint32_t color = NinePatch::PackRGBA(row + x * 4);
+      if (get_alpha(color) == 0) {
         // The color is transparent.
         // If the expectedColor is not transparent, NO_COLOR.
-        if (getAlpha(expectedColor) != 0) {
+        if (get_alpha(expected_color) != 0) {
           return android::Res_png_9patch::NO_COLOR;
         }
-      } else if (color != expectedColor) {
+      } else if (color != expected_color) {
         return android::Res_png_9patch::NO_COLOR;
       }
     }
   }
 
-  if (getAlpha(expectedColor) == 0) {
+  if (get_alpha(expected_color) == 0) {
     return android::Res_png_9patch::TRANSPARENT_COLOR;
   }
-  return expectedColor;
+  return expected_color;
 }
 
-// Fills outColors with each 9-patch section's colour. If the whole section is
+// Fills out_colors with each 9-patch section's color. If the whole section is
 // transparent,
-// it gets the special TRANSPARENT colour. If the whole section is the same
-// colour, it is assigned
-// that colour. Otherwise it gets the special NO_COLOR colour.
+// it gets the special TRANSPARENT color. If the whole section is the same
+// color, it is assigned
+// that color. Otherwise it gets the special NO_COLOR color.
 //
 // Note that the rows contain the 9-patch 1px border, and the indices in the
 // stretch regions are
@@ -332,63 +336,63 @@
 // the indices must be offset by 1.
 //
 // width and height also include the 9-patch 1px border.
-static void calculateRegionColors(
-    uint8_t** rows, const std::vector<Range>& horizontalStretchRegions,
-    const std::vector<Range>& verticalStretchRegions, const int32_t width,
-    const int32_t height, std::vector<uint32_t>* outColors) {
-  int32_t nextTop = 0;
+static void CalculateRegionColors(
+    uint8_t** rows, const std::vector<Range>& horizontal_stretch_regions,
+    const std::vector<Range>& vertical_stretch_regions, const int32_t width,
+    const int32_t height, std::vector<uint32_t>* out_colors) {
+  int32_t next_top = 0;
   Bounds bounds;
-  auto rowIter = verticalStretchRegions.begin();
-  while (nextTop != height) {
-    if (rowIter != verticalStretchRegions.end()) {
-      if (nextTop != rowIter->start) {
+  auto row_iter = vertical_stretch_regions.begin();
+  while (next_top != height) {
+    if (row_iter != vertical_stretch_regions.end()) {
+      if (next_top != row_iter->start) {
         // This is a fixed segment.
         // Offset the bounds by 1 to accommodate the border.
-        bounds.top = nextTop + 1;
-        bounds.bottom = rowIter->start + 1;
-        nextTop = rowIter->start;
+        bounds.top = next_top + 1;
+        bounds.bottom = row_iter->start + 1;
+        next_top = row_iter->start;
       } else {
         // This is a stretchy segment.
         // Offset the bounds by 1 to accommodate the border.
-        bounds.top = rowIter->start + 1;
-        bounds.bottom = rowIter->end + 1;
-        nextTop = rowIter->end;
-        ++rowIter;
+        bounds.top = row_iter->start + 1;
+        bounds.bottom = row_iter->end + 1;
+        next_top = row_iter->end;
+        ++row_iter;
       }
     } else {
       // This is the end, fixed section.
       // Offset the bounds by 1 to accommodate the border.
-      bounds.top = nextTop + 1;
+      bounds.top = next_top + 1;
       bounds.bottom = height + 1;
-      nextTop = height;
+      next_top = height;
     }
 
-    int32_t nextLeft = 0;
-    auto colIter = horizontalStretchRegions.begin();
-    while (nextLeft != width) {
-      if (colIter != horizontalStretchRegions.end()) {
-        if (nextLeft != colIter->start) {
+    int32_t next_left = 0;
+    auto col_iter = horizontal_stretch_regions.begin();
+    while (next_left != width) {
+      if (col_iter != horizontal_stretch_regions.end()) {
+        if (next_left != col_iter->start) {
           // This is a fixed segment.
           // Offset the bounds by 1 to accommodate the border.
-          bounds.left = nextLeft + 1;
-          bounds.right = colIter->start + 1;
-          nextLeft = colIter->start;
+          bounds.left = next_left + 1;
+          bounds.right = col_iter->start + 1;
+          next_left = col_iter->start;
         } else {
           // This is a stretchy segment.
           // Offset the bounds by 1 to accommodate the border.
-          bounds.left = colIter->start + 1;
-          bounds.right = colIter->end + 1;
-          nextLeft = colIter->end;
-          ++colIter;
+          bounds.left = col_iter->start + 1;
+          bounds.right = col_iter->end + 1;
+          next_left = col_iter->end;
+          ++col_iter;
         }
       } else {
         // This is the end, fixed section.
         // Offset the bounds by 1 to accommodate the border.
-        bounds.left = nextLeft + 1;
+        bounds.left = next_left + 1;
         bounds.right = width + 1;
-        nextLeft = width;
+        next_left = width;
       }
-      outColors->push_back(getRegionColor(rows, bounds));
+      out_colors->push_back(GetRegionColor(rows, bounds));
     }
   }
 }
@@ -397,12 +401,12 @@
 // alpha value begins
 // (on both sides).
 template <typename ImageLine>
-static void findOutlineInsets(const ImageLine* imageLine, int32_t* outStart,
-                              int32_t* outEnd) {
-  *outStart = 0;
-  *outEnd = 0;
+static void FindOutlineInsets(const ImageLine* image_line, int32_t* out_start,
+                              int32_t* out_end) {
+  *out_start = 0;
+  *out_end = 0;
 
-  const int32_t length = imageLine->getLength();
+  const int32_t length = image_line->GetLength();
   if (length < 3) {
     return;
   }
@@ -413,179 +417,181 @@
   const int32_t mid2 = length / 2;
   const int32_t mid1 = mid2 + (length % 2);
 
-  uint32_t maxAlpha = 0;
-  for (int32_t i = 0; i < mid1 && maxAlpha != 0xff; i++) {
-    uint32_t alpha = getAlpha(imageLine->getColor(i));
-    if (alpha > maxAlpha) {
-      maxAlpha = alpha;
-      *outStart = i;
+  uint32_t max_alpha = 0;
+  for (int32_t i = 0; i < mid1 && max_alpha != 0xff; i++) {
+    uint32_t alpha = get_alpha(image_line->GetColor(i));
+    if (alpha > max_alpha) {
+      max_alpha = alpha;
+      *out_start = i;
     }
   }
 
-  maxAlpha = 0;
-  for (int32_t i = length - 1; i >= mid2 && maxAlpha != 0xff; i--) {
-    uint32_t alpha = getAlpha(imageLine->getColor(i));
-    if (alpha > maxAlpha) {
-      maxAlpha = alpha;
-      *outEnd = length - (i + 1);
+  max_alpha = 0;
+  for (int32_t i = length - 1; i >= mid2 && max_alpha != 0xff; i--) {
+    uint32_t alpha = get_alpha(image_line->GetColor(i));
+    if (alpha > max_alpha) {
+      max_alpha = alpha;
+      *out_end = length - (i + 1);
     }
   }
   return;
 }
 
 template <typename ImageLine>
-static uint32_t findMaxAlpha(const ImageLine* imageLine) {
-  const int32_t length = imageLine->getLength();
-  uint32_t maxAlpha = 0;
-  for (int32_t idx = 0; idx < length && maxAlpha != 0xff; idx++) {
-    uint32_t alpha = getAlpha(imageLine->getColor(idx));
-    if (alpha > maxAlpha) {
-      maxAlpha = alpha;
+static uint32_t FindMaxAlpha(const ImageLine* image_line) {
+  const int32_t length = image_line->GetLength();
+  uint32_t max_alpha = 0;
+  for (int32_t idx = 0; idx < length && max_alpha != 0xff; idx++) {
+    uint32_t alpha = get_alpha(image_line->GetColor(idx));
+    if (alpha > max_alpha) {
+      max_alpha = alpha;
     }
   }
-  return maxAlpha;
+  return max_alpha;
 }
 
 // Pack the pixels in as 0xAARRGGBB (as 9-patch expects it).
-uint32_t NinePatch::packRGBA(const uint8_t* pixel) {
+uint32_t NinePatch::PackRGBA(const uint8_t* pixel) {
   return (pixel[3] << 24) | (pixel[0] << 16) | (pixel[1] << 8) | pixel[2];
 }
 
-std::unique_ptr<NinePatch> NinePatch::create(uint8_t** rows,
+std::unique_ptr<NinePatch> NinePatch::Create(uint8_t** rows,
                                              const int32_t width,
                                              const int32_t height,
-                                             std::string* err) {
+                                             std::string* out_err) {
   if (width < 3 || height < 3) {
-    *err = "image must be at least 3x3 (1x1 image with 1 pixel border)";
+    *out_err = "image must be at least 3x3 (1x1 image with 1 pixel border)";
     return {};
   }
 
-  std::vector<Range> horizontalPadding;
-  std::vector<Range> horizontalOpticalBounds;
-  std::vector<Range> verticalPadding;
-  std::vector<Range> verticalOpticalBounds;
-  std::vector<Range> unexpectedRanges;
-  std::unique_ptr<ColorValidator> colorValidator;
+  std::vector<Range> horizontal_padding;
+  std::vector<Range> horizontal_layout_bounds;
+  std::vector<Range> vertical_padding;
+  std::vector<Range> vertical_layout_bounds;
+  std::vector<Range> unexpected_ranges;
+  std::unique_ptr<ColorValidator> color_validator;
 
   if (rows[0][3] == 0) {
-    colorValidator = util::make_unique<TransparentNeutralColorValidator>();
-  } else if (packRGBA(rows[0]) == kColorOpaqueWhite) {
-    colorValidator = util::make_unique<WhiteNeutralColorValidator>();
+    color_validator = util::make_unique<TransparentNeutralColorValidator>();
+  } else if (PackRGBA(rows[0]) == kColorOpaqueWhite) {
+    color_validator = util::make_unique<WhiteNeutralColorValidator>();
   } else {
-    *err = "top-left corner pixel must be either opaque white or transparent";
+    *out_err =
+        "top-left corner pixel must be either opaque white or transparent";
     return {};
   }
 
   // Private constructor, can't use make_unique.
-  auto ninePatch = std::unique_ptr<NinePatch>(new NinePatch());
+  auto nine_patch = std::unique_ptr<NinePatch>(new NinePatch());
 
-  HorizontalImageLine topRow(rows, 0, 0, width);
-  if (!fillRanges(&topRow, colorValidator.get(),
-                  &ninePatch->horizontalStretchRegions, &unexpectedRanges,
-                  err)) {
+  HorizontalImageLine top_row(rows, 0, 0, width);
+  if (!FillRanges(&top_row, color_validator.get(),
+                  &nine_patch->horizontal_stretch_regions, &unexpected_ranges,
+                  out_err)) {
     return {};
   }
 
-  if (!unexpectedRanges.empty()) {
-    const Range& range = unexpectedRanges[0];
-    std::stringstream errStream;
-    errStream << "found unexpected optical bounds (red pixel) on top border "
-              << "at x=" << range.start + 1;
-    *err = errStream.str();
+  if (!unexpected_ranges.empty()) {
+    const Range& range = unexpected_ranges[0];
+    std::stringstream err_stream;
+    err_stream << "found unexpected optical bounds (red pixel) on top border "
+               << "at x=" << range.start + 1;
+    *out_err = err_stream.str();
     return {};
   }
 
-  VerticalImageLine leftCol(rows, 0, 0, height);
-  if (!fillRanges(&leftCol, colorValidator.get(),
-                  &ninePatch->verticalStretchRegions, &unexpectedRanges, err)) {
+  VerticalImageLine left_col(rows, 0, 0, height);
+  if (!FillRanges(&left_col, color_validator.get(),
+                  &nine_patch->vertical_stretch_regions, &unexpected_ranges,
+                  out_err)) {
     return {};
   }
 
-  if (!unexpectedRanges.empty()) {
-    const Range& range = unexpectedRanges[0];
-    std::stringstream errStream;
-    errStream << "found unexpected optical bounds (red pixel) on left border "
-              << "at y=" << range.start + 1;
+  if (!unexpected_ranges.empty()) {
+    const Range& range = unexpected_ranges[0];
+    std::stringstream err_stream;
+    err_stream << "found unexpected optical bounds (red pixel) on left border "
+               << "at y=" << range.start + 1;
     return {};
   }
 
-  HorizontalImageLine bottomRow(rows, 0, height - 1, width);
-  if (!fillRanges(&bottomRow, colorValidator.get(), &horizontalPadding,
-                  &horizontalOpticalBounds, err)) {
+  HorizontalImageLine bottom_row(rows, 0, height - 1, width);
+  if (!FillRanges(&bottom_row, color_validator.get(), &horizontal_padding,
+                  &horizontal_layout_bounds, out_err)) {
     return {};
   }
 
-  if (!populateBounds(horizontalPadding, horizontalOpticalBounds,
-                      ninePatch->horizontalStretchRegions, width - 2,
-                      &ninePatch->padding.left, &ninePatch->padding.right,
-                      &ninePatch->layoutBounds.left,
-                      &ninePatch->layoutBounds.right, "bottom", err)) {
+  if (!PopulateBounds(horizontal_padding, horizontal_layout_bounds,
+                      nine_patch->horizontal_stretch_regions, width - 2,
+                      &nine_patch->padding.left, &nine_patch->padding.right,
+                      &nine_patch->layout_bounds.left,
+                      &nine_patch->layout_bounds.right, "bottom", out_err)) {
     return {};
   }
 
-  VerticalImageLine rightCol(rows, width - 1, 0, height);
-  if (!fillRanges(&rightCol, colorValidator.get(), &verticalPadding,
-                  &verticalOpticalBounds, err)) {
+  VerticalImageLine right_col(rows, width - 1, 0, height);
+  if (!FillRanges(&right_col, color_validator.get(), &vertical_padding,
+                  &vertical_layout_bounds, out_err)) {
     return {};
   }
 
-  if (!populateBounds(verticalPadding, verticalOpticalBounds,
-                      ninePatch->verticalStretchRegions, height - 2,
-                      &ninePatch->padding.top, &ninePatch->padding.bottom,
-                      &ninePatch->layoutBounds.top,
-                      &ninePatch->layoutBounds.bottom, "right", err)) {
+  if (!PopulateBounds(vertical_padding, vertical_layout_bounds,
+                      nine_patch->vertical_stretch_regions, height - 2,
+                      &nine_patch->padding.top, &nine_patch->padding.bottom,
+                      &nine_patch->layout_bounds.top,
+                      &nine_patch->layout_bounds.bottom, "right", out_err)) {
     return {};
   }
 
   // Fill the region colors of the 9-patch.
-  const int32_t numRows =
-      calculateSegmentCount(ninePatch->horizontalStretchRegions, width - 2);
-  const int32_t numCols =
-      calculateSegmentCount(ninePatch->verticalStretchRegions, height - 2);
-  if ((int64_t)numRows * (int64_t)numCols > 0x7f) {
-    *err = "too many regions in 9-patch";
+  const int32_t num_rows =
+      CalculateSegmentCount(nine_patch->horizontal_stretch_regions, width - 2);
+  const int32_t num_cols =
+      CalculateSegmentCount(nine_patch->vertical_stretch_regions, height - 2);
+  if ((int64_t)num_rows * (int64_t)num_cols > 0x7f) {
+    *out_err = "too many regions in 9-patch";
     return {};
   }
 
-  ninePatch->regionColors.reserve(numRows * numCols);
-  calculateRegionColors(rows, ninePatch->horizontalStretchRegions,
-                        ninePatch->verticalStretchRegions, width - 2,
-                        height - 2, &ninePatch->regionColors);
+  nine_patch->region_colors.reserve(num_rows * num_cols);
+  CalculateRegionColors(rows, nine_patch->horizontal_stretch_regions,
+                        nine_patch->vertical_stretch_regions, width - 2,
+                        height - 2, &nine_patch->region_colors);
 
   // Compute the outline based on opacity.
 
   // Find left and right extent of 9-patch content on center row.
-  HorizontalImageLine midRow(rows, 1, height / 2, width - 2);
-  findOutlineInsets(&midRow, &ninePatch->outline.left,
-                    &ninePatch->outline.right);
+  HorizontalImageLine mid_row(rows, 1, height / 2, width - 2);
+  FindOutlineInsets(&mid_row, &nine_patch->outline.left,
+                    &nine_patch->outline.right);
 
   // Find top and bottom extent of 9-patch content on center column.
-  VerticalImageLine midCol(rows, width / 2, 1, height - 2);
-  findOutlineInsets(&midCol, &ninePatch->outline.top,
-                    &ninePatch->outline.bottom);
+  VerticalImageLine mid_col(rows, width / 2, 1, height - 2);
+  FindOutlineInsets(&mid_col, &nine_patch->outline.top,
+                    &nine_patch->outline.bottom);
 
-  const int32_t outlineWidth =
-      (width - 2) - ninePatch->outline.left - ninePatch->outline.right;
-  const int32_t outlineHeight =
-      (height - 2) - ninePatch->outline.top - ninePatch->outline.bottom;
+  const int32_t outline_width =
+      (width - 2) - nine_patch->outline.left - nine_patch->outline.right;
+  const int32_t outline_height =
+      (height - 2) - nine_patch->outline.top - nine_patch->outline.bottom;
 
   // Find the largest alpha value within the outline area.
-  HorizontalImageLine outlineMidRow(
-      rows, 1 + ninePatch->outline.left,
-      1 + ninePatch->outline.top + (outlineHeight / 2), outlineWidth);
-  VerticalImageLine outlineMidCol(
-      rows, 1 + ninePatch->outline.left + (outlineWidth / 2),
-      1 + ninePatch->outline.top, outlineHeight);
-  ninePatch->outlineAlpha =
-      std::max(findMaxAlpha(&outlineMidRow), findMaxAlpha(&outlineMidCol));
+  HorizontalImageLine outline_mid_row(
+      rows, 1 + nine_patch->outline.left,
+      1 + nine_patch->outline.top + (outline_height / 2), outline_width);
+  VerticalImageLine outline_mid_col(
+      rows, 1 + nine_patch->outline.left + (outline_width / 2),
+      1 + nine_patch->outline.top, outline_height);
+  nine_patch->outline_alpha =
+      std::max(FindMaxAlpha(&outline_mid_row), FindMaxAlpha(&outline_mid_col));
 
   // Assuming the image is a round rect, compute the radius by marching
   // diagonally from the top left corner towards the center.
-  DiagonalImageLine diagonal(rows, 1 + ninePatch->outline.left,
-                             1 + ninePatch->outline.top, 1, 1,
-                             std::min(outlineWidth, outlineHeight));
-  int32_t topLeft, bottomRight;
-  findOutlineInsets(&diagonal, &topLeft, &bottomRight);
+  DiagonalImageLine diagonal(rows, 1 + nine_patch->outline.left,
+                             1 + nine_patch->outline.top, 1, 1,
+                             std::min(outline_width, outline_height));
+  int32_t top_left, bottom_right;
+  FindOutlineInsets(&diagonal, &top_left, &bottom_right);
 
   /* Determine source radius based upon inset:
    *     sqrt(r^2 + r^2) = sqrt(i^2 + i^2) + r
@@ -593,15 +599,15 @@
    *     (sqrt(2) - 1) * r = sqrt(2) * i
    *     r = sqrt(2) / (sqrt(2) - 1) * i
    */
-  ninePatch->outlineRadius = 3.4142f * topLeft;
-  return ninePatch;
+  nine_patch->outline_radius = 3.4142f * top_left;
+  return nine_patch;
 }
 
-std::unique_ptr<uint8_t[]> NinePatch::serializeBase(size_t* outLen) const {
+std::unique_ptr<uint8_t[]> NinePatch::SerializeBase(size_t* outLen) const {
   android::Res_png_9patch data;
-  data.numXDivs = static_cast<uint8_t>(horizontalStretchRegions.size()) * 2;
-  data.numYDivs = static_cast<uint8_t>(verticalStretchRegions.size()) * 2;
-  data.numColors = static_cast<uint8_t>(regionColors.size());
+  data.numXDivs = static_cast<uint8_t>(horizontal_stretch_regions.size()) * 2;
+  data.numYDivs = static_cast<uint8_t>(vertical_stretch_regions.size()) * 2;
+  data.numColors = static_cast<uint8_t>(region_colors.size());
   data.paddingLeft = padding.left;
   data.paddingRight = padding.right;
   data.paddingTop = padding.top;
@@ -609,8 +615,8 @@
 
   auto buffer = std::unique_ptr<uint8_t[]>(new uint8_t[data.serializedSize()]);
   android::Res_png_9patch::serialize(
-      data, (const int32_t*)horizontalStretchRegions.data(),
-      (const int32_t*)verticalStretchRegions.data(), regionColors.data(),
+      data, (const int32_t*)horizontal_stretch_regions.data(),
+      (const int32_t*)vertical_stretch_regions.data(), region_colors.data(),
       buffer.get());
   // Convert to file endianness.
   reinterpret_cast<android::Res_png_9patch*>(buffer.get())->deviceToFile();
@@ -619,32 +625,32 @@
   return buffer;
 }
 
-std::unique_ptr<uint8_t[]> NinePatch::serializeLayoutBounds(
-    size_t* outLen) const {
-  size_t chunkLen = sizeof(uint32_t) * 4;
-  auto buffer = std::unique_ptr<uint8_t[]>(new uint8_t[chunkLen]);
+std::unique_ptr<uint8_t[]> NinePatch::SerializeLayoutBounds(
+    size_t* out_len) const {
+  size_t chunk_len = sizeof(uint32_t) * 4;
+  auto buffer = std::unique_ptr<uint8_t[]>(new uint8_t[chunk_len]);
   uint8_t* cursor = buffer.get();
 
-  memcpy(cursor, &layoutBounds.left, sizeof(layoutBounds.left));
-  cursor += sizeof(layoutBounds.left);
+  memcpy(cursor, &layout_bounds.left, sizeof(layout_bounds.left));
+  cursor += sizeof(layout_bounds.left);
 
-  memcpy(cursor, &layoutBounds.top, sizeof(layoutBounds.top));
-  cursor += sizeof(layoutBounds.top);
+  memcpy(cursor, &layout_bounds.top, sizeof(layout_bounds.top));
+  cursor += sizeof(layout_bounds.top);
 
-  memcpy(cursor, &layoutBounds.right, sizeof(layoutBounds.right));
-  cursor += sizeof(layoutBounds.right);
+  memcpy(cursor, &layout_bounds.right, sizeof(layout_bounds.right));
+  cursor += sizeof(layout_bounds.right);
 
-  memcpy(cursor, &layoutBounds.bottom, sizeof(layoutBounds.bottom));
-  cursor += sizeof(layoutBounds.bottom);
+  memcpy(cursor, &layout_bounds.bottom, sizeof(layout_bounds.bottom));
+  cursor += sizeof(layout_bounds.bottom);
 
-  *outLen = chunkLen;
+  *out_len = chunk_len;
   return buffer;
 }
 
-std::unique_ptr<uint8_t[]> NinePatch::serializeRoundedRectOutline(
-    size_t* outLen) const {
-  size_t chunkLen = sizeof(uint32_t) * 6;
-  auto buffer = std::unique_ptr<uint8_t[]>(new uint8_t[chunkLen]);
+std::unique_ptr<uint8_t[]> NinePatch::SerializeRoundedRectOutline(
+    size_t* out_len) const {
+  size_t chunk_len = sizeof(uint32_t) * 6;
+  auto buffer = std::unique_ptr<uint8_t[]>(new uint8_t[chunk_len]);
   uint8_t* cursor = buffer.get();
 
   memcpy(cursor, &outline.left, sizeof(outline.left));
@@ -659,12 +665,12 @@
   memcpy(cursor, &outline.bottom, sizeof(outline.bottom));
   cursor += sizeof(outline.bottom);
 
-  *((float*)cursor) = outlineRadius;
-  cursor += sizeof(outlineRadius);
+  *((float*)cursor) = outline_radius;
+  cursor += sizeof(outline_radius);
 
-  *((uint32_t*)cursor) = outlineAlpha;
+  *((uint32_t*)cursor) = outline_alpha;
 
-  *outLen = chunkLen;
+  *out_len = chunk_len;
   return buffer;
 }
 
@@ -677,16 +683,16 @@
              << " r=" << bounds.right << " b=" << bounds.bottom;
 }
 
-::std::ostream& operator<<(::std::ostream& out, const NinePatch& ninePatch) {
+::std::ostream& operator<<(::std::ostream& out, const NinePatch& nine_patch) {
   return out << "horizontalStretch:"
-             << util::joiner(ninePatch.horizontalStretchRegions, " ")
+             << util::Joiner(nine_patch.horizontal_stretch_regions, " ")
              << " verticalStretch:"
-             << util::joiner(ninePatch.verticalStretchRegions, " ")
-             << " padding: " << ninePatch.padding
-             << ", bounds: " << ninePatch.layoutBounds
-             << ", outline: " << ninePatch.outline
-             << " rad=" << ninePatch.outlineRadius
-             << " alpha=" << ninePatch.outlineAlpha;
+             << util::Joiner(nine_patch.vertical_stretch_regions, " ")
+             << " padding: " << nine_patch.padding
+             << ", bounds: " << nine_patch.layout_bounds
+             << ", outline: " << nine_patch.outline
+             << " rad=" << nine_patch.outline_radius
+             << " alpha=" << nine_patch.outline_alpha;
 }
 
 }  // namespace aapt
diff --git a/tools/aapt2/compile/NinePatch_test.cpp b/tools/aapt2/compile/NinePatch_test.cpp
index b8eda09..f54bb2e 100644
--- a/tools/aapt2/compile/NinePatch_test.cpp
+++ b/tools/aapt2/compile/NinePatch_test.cpp
@@ -15,6 +15,7 @@
  */
 
 #include "compile/Image.h"
+
 #include "test/Test.h"
 
 namespace aapt {
@@ -182,169 +183,168 @@
 
 TEST(NinePatchTest, Minimum3x3) {
   std::string err;
-  EXPECT_EQ(nullptr, NinePatch::create(k2x2, 2, 2, &err));
+  EXPECT_EQ(nullptr, NinePatch::Create(k2x2, 2, 2, &err));
   EXPECT_FALSE(err.empty());
 }
 
 TEST(NinePatchTest, MixedNeutralColors) {
   std::string err;
-  EXPECT_EQ(nullptr, NinePatch::create(kMixedNeutralColor3x3, 3, 3, &err));
+  EXPECT_EQ(nullptr, NinePatch::Create(kMixedNeutralColor3x3, 3, 3, &err));
   EXPECT_FALSE(err.empty());
 }
 
 TEST(NinePatchTest, TransparentNeutralColor) {
   std::string err;
   EXPECT_NE(nullptr,
-            NinePatch::create(kTransparentNeutralColor3x3, 3, 3, &err));
+            NinePatch::Create(kTransparentNeutralColor3x3, 3, 3, &err));
 }
 
 TEST(NinePatchTest, SingleStretchRegion) {
   std::string err;
-  std::unique_ptr<NinePatch> ninePatch =
-      NinePatch::create(kSingleStretch7x6, 7, 6, &err);
-  ASSERT_NE(nullptr, ninePatch);
+  std::unique_ptr<NinePatch> nine_patch =
+      NinePatch::Create(kSingleStretch7x6, 7, 6, &err);
+  ASSERT_NE(nullptr, nine_patch);
 
-  ASSERT_EQ(1u, ninePatch->horizontalStretchRegions.size());
-  ASSERT_EQ(1u, ninePatch->verticalStretchRegions.size());
+  ASSERT_EQ(1u, nine_patch->horizontal_stretch_regions.size());
+  ASSERT_EQ(1u, nine_patch->vertical_stretch_regions.size());
 
-  EXPECT_EQ(Range(1, 4), ninePatch->horizontalStretchRegions.front());
-  EXPECT_EQ(Range(1, 3), ninePatch->verticalStretchRegions.front());
+  EXPECT_EQ(Range(1, 4), nine_patch->horizontal_stretch_regions.front());
+  EXPECT_EQ(Range(1, 3), nine_patch->vertical_stretch_regions.front());
 }
 
 TEST(NinePatchTest, MultipleStretchRegions) {
   std::string err;
-  std::unique_ptr<NinePatch> ninePatch =
-      NinePatch::create(kMultipleStretch10x7, 10, 7, &err);
-  ASSERT_NE(nullptr, ninePatch);
+  std::unique_ptr<NinePatch> nine_patch =
+      NinePatch::Create(kMultipleStretch10x7, 10, 7, &err);
+  ASSERT_NE(nullptr, nine_patch);
 
-  ASSERT_EQ(3u, ninePatch->horizontalStretchRegions.size());
-  ASSERT_EQ(2u, ninePatch->verticalStretchRegions.size());
+  ASSERT_EQ(3u, nine_patch->horizontal_stretch_regions.size());
+  ASSERT_EQ(2u, nine_patch->vertical_stretch_regions.size());
 
-  EXPECT_EQ(Range(1, 2), ninePatch->horizontalStretchRegions[0]);
-  EXPECT_EQ(Range(3, 5), ninePatch->horizontalStretchRegions[1]);
-  EXPECT_EQ(Range(6, 7), ninePatch->horizontalStretchRegions[2]);
+  EXPECT_EQ(Range(1, 2), nine_patch->horizontal_stretch_regions[0]);
+  EXPECT_EQ(Range(3, 5), nine_patch->horizontal_stretch_regions[1]);
+  EXPECT_EQ(Range(6, 7), nine_patch->horizontal_stretch_regions[2]);
 
-  EXPECT_EQ(Range(0, 2), ninePatch->verticalStretchRegions[0]);
-  EXPECT_EQ(Range(3, 5), ninePatch->verticalStretchRegions[1]);
+  EXPECT_EQ(Range(0, 2), nine_patch->vertical_stretch_regions[0]);
+  EXPECT_EQ(Range(3, 5), nine_patch->vertical_stretch_regions[1]);
 }
 
 TEST(NinePatchTest, InferPaddingFromStretchRegions) {
   std::string err;
-  std::unique_ptr<NinePatch> ninePatch =
-      NinePatch::create(kMultipleStretch10x7, 10, 7, &err);
-  ASSERT_NE(nullptr, ninePatch);
-  EXPECT_EQ(Bounds(1, 0, 1, 0), ninePatch->padding);
+  std::unique_ptr<NinePatch> nine_patch =
+      NinePatch::Create(kMultipleStretch10x7, 10, 7, &err);
+  ASSERT_NE(nullptr, nine_patch);
+  EXPECT_EQ(Bounds(1, 0, 1, 0), nine_patch->padding);
 }
 
 TEST(NinePatchTest, Padding) {
   std::string err;
-  std::unique_ptr<NinePatch> ninePatch =
-      NinePatch::create(kPadding6x5, 6, 5, &err);
-  ASSERT_NE(nullptr, ninePatch);
-  EXPECT_EQ(Bounds(1, 1, 1, 1), ninePatch->padding);
+  std::unique_ptr<NinePatch> nine_patch =
+      NinePatch::Create(kPadding6x5, 6, 5, &err);
+  ASSERT_NE(nullptr, nine_patch);
+  EXPECT_EQ(Bounds(1, 1, 1, 1), nine_patch->padding);
 }
 
 TEST(NinePatchTest, LayoutBoundsAreOnWrongEdge) {
   std::string err;
-  EXPECT_EQ(nullptr, NinePatch::create(kLayoutBoundsWrongEdge3x3, 3, 3, &err));
+  EXPECT_EQ(nullptr, NinePatch::Create(kLayoutBoundsWrongEdge3x3, 3, 3, &err));
   EXPECT_FALSE(err.empty());
 }
 
 TEST(NinePatchTest, LayoutBoundsMustTouchEdges) {
   std::string err;
   EXPECT_EQ(nullptr,
-            NinePatch::create(kLayoutBoundsNotEdgeAligned5x5, 5, 5, &err));
+            NinePatch::Create(kLayoutBoundsNotEdgeAligned5x5, 5, 5, &err));
   EXPECT_FALSE(err.empty());
 }
 
 TEST(NinePatchTest, LayoutBounds) {
   std::string err;
-  std::unique_ptr<NinePatch> ninePatch =
-      NinePatch::create(kLayoutBounds5x5, 5, 5, &err);
-  ASSERT_NE(nullptr, ninePatch);
-  EXPECT_EQ(Bounds(1, 1, 1, 1), ninePatch->layoutBounds);
+  std::unique_ptr<NinePatch> nine_patch =
+      NinePatch::Create(kLayoutBounds5x5, 5, 5, &err);
+  ASSERT_NE(nullptr, nine_patch);
+  EXPECT_EQ(Bounds(1, 1, 1, 1), nine_patch->layout_bounds);
 
-  ninePatch = NinePatch::create(kAsymmetricLayoutBounds5x5, 5, 5, &err);
-  ASSERT_NE(nullptr, ninePatch);
-  EXPECT_EQ(Bounds(1, 1, 0, 0), ninePatch->layoutBounds);
+  nine_patch = NinePatch::Create(kAsymmetricLayoutBounds5x5, 5, 5, &err);
+  ASSERT_NE(nullptr, nine_patch);
+  EXPECT_EQ(Bounds(1, 1, 0, 0), nine_patch->layout_bounds);
 }
 
 TEST(NinePatchTest, PaddingAndLayoutBounds) {
   std::string err;
-  std::unique_ptr<NinePatch> ninePatch =
-      NinePatch::create(kPaddingAndLayoutBounds5x5, 5, 5, &err);
-  ASSERT_NE(nullptr, ninePatch);
-  EXPECT_EQ(Bounds(1, 1, 1, 1), ninePatch->padding);
-  EXPECT_EQ(Bounds(1, 1, 1, 1), ninePatch->layoutBounds);
+  std::unique_ptr<NinePatch> nine_patch =
+      NinePatch::Create(kPaddingAndLayoutBounds5x5, 5, 5, &err);
+  ASSERT_NE(nullptr, nine_patch);
+  EXPECT_EQ(Bounds(1, 1, 1, 1), nine_patch->padding);
+  EXPECT_EQ(Bounds(1, 1, 1, 1), nine_patch->layout_bounds);
 }
 
 TEST(NinePatchTest, RegionColorsAreCorrect) {
   std::string err;
-  std::unique_ptr<NinePatch> ninePatch =
-      NinePatch::create(kColorfulImage5x5, 5, 5, &err);
-  ASSERT_NE(nullptr, ninePatch);
+  std::unique_ptr<NinePatch> nine_patch =
+      NinePatch::Create(kColorfulImage5x5, 5, 5, &err);
+  ASSERT_NE(nullptr, nine_patch);
 
-  std::vector<uint32_t> expectedColors = {
-      NinePatch::packRGBA((uint8_t*)RED),
+  std::vector<uint32_t> expected_colors = {
+      NinePatch::PackRGBA((uint8_t*)RED),
       (uint32_t)android::Res_png_9patch::NO_COLOR,
-      NinePatch::packRGBA((uint8_t*)GREEN),
+      NinePatch::PackRGBA((uint8_t*)GREEN),
       (uint32_t)android::Res_png_9patch::TRANSPARENT_COLOR,
-      NinePatch::packRGBA((uint8_t*)BLUE),
-      NinePatch::packRGBA((uint8_t*)GREEN),
+      NinePatch::PackRGBA((uint8_t*)BLUE),
+      NinePatch::PackRGBA((uint8_t*)GREEN),
   };
-  EXPECT_EQ(expectedColors, ninePatch->regionColors);
+  EXPECT_EQ(expected_colors, nine_patch->region_colors);
 }
 
 TEST(NinePatchTest, OutlineFromOpaqueImage) {
   std::string err;
-  std::unique_ptr<NinePatch> ninePatch =
-      NinePatch::create(kOutlineOpaque10x10, 10, 10, &err);
-  ASSERT_NE(nullptr, ninePatch);
-  EXPECT_EQ(Bounds(2, 2, 2, 2), ninePatch->outline);
-  EXPECT_EQ(0x000000ffu, ninePatch->outlineAlpha);
-  EXPECT_EQ(0.0f, ninePatch->outlineRadius);
+  std::unique_ptr<NinePatch> nine_patch =
+      NinePatch::Create(kOutlineOpaque10x10, 10, 10, &err);
+  ASSERT_NE(nullptr, nine_patch);
+  EXPECT_EQ(Bounds(2, 2, 2, 2), nine_patch->outline);
+  EXPECT_EQ(0x000000ffu, nine_patch->outline_alpha);
+  EXPECT_EQ(0.0f, nine_patch->outline_radius);
 }
 
 TEST(NinePatchTest, OutlineFromTranslucentImage) {
   std::string err;
-  std::unique_ptr<NinePatch> ninePatch =
-      NinePatch::create(kOutlineTranslucent10x10, 10, 10, &err);
-  ASSERT_NE(nullptr, ninePatch);
-  EXPECT_EQ(Bounds(3, 3, 3, 3), ninePatch->outline);
-  EXPECT_EQ(0x000000b3u, ninePatch->outlineAlpha);
-  EXPECT_EQ(0.0f, ninePatch->outlineRadius);
+  std::unique_ptr<NinePatch> nine_patch =
+      NinePatch::Create(kOutlineTranslucent10x10, 10, 10, &err);
+  ASSERT_NE(nullptr, nine_patch);
+  EXPECT_EQ(Bounds(3, 3, 3, 3), nine_patch->outline);
+  EXPECT_EQ(0x000000b3u, nine_patch->outline_alpha);
+  EXPECT_EQ(0.0f, nine_patch->outline_radius);
 }
 
 TEST(NinePatchTest, OutlineFromOffCenterImage) {
   std::string err;
-  std::unique_ptr<NinePatch> ninePatch =
-      NinePatch::create(kOutlineOffsetTranslucent12x10, 12, 10, &err);
-  ASSERT_NE(nullptr, ninePatch);
+  std::unique_ptr<NinePatch> nine_patch =
+      NinePatch::Create(kOutlineOffsetTranslucent12x10, 12, 10, &err);
+  ASSERT_NE(nullptr, nine_patch);
 
   // TODO(adamlesinski): The old AAPT algorithm searches from the outside to the
-  // middle
-  // for each inset. If the outline is shifted, the search may not find a closer
-  // bounds.
+  // middle for each inset. If the outline is shifted, the search may not find a
+  // closer bounds.
   // This check should be:
   //   EXPECT_EQ(Bounds(5, 3, 3, 3), ninePatch->outline);
-  // but until I know what behaviour I'm breaking, I will leave it at the
+  // but until I know what behavior I'm breaking, I will leave it at the
   // incorrect:
-  EXPECT_EQ(Bounds(4, 3, 3, 3), ninePatch->outline);
+  EXPECT_EQ(Bounds(4, 3, 3, 3), nine_patch->outline);
 
-  EXPECT_EQ(0x000000b3u, ninePatch->outlineAlpha);
-  EXPECT_EQ(0.0f, ninePatch->outlineRadius);
+  EXPECT_EQ(0x000000b3u, nine_patch->outline_alpha);
+  EXPECT_EQ(0.0f, nine_patch->outline_radius);
 }
 
 TEST(NinePatchTest, OutlineRadius) {
   std::string err;
-  std::unique_ptr<NinePatch> ninePatch =
-      NinePatch::create(kOutlineRadius5x5, 5, 5, &err);
-  ASSERT_NE(nullptr, ninePatch);
-  EXPECT_EQ(Bounds(0, 0, 0, 0), ninePatch->outline);
-  EXPECT_EQ(3.4142f, ninePatch->outlineRadius);
+  std::unique_ptr<NinePatch> nine_patch =
+      NinePatch::Create(kOutlineRadius5x5, 5, 5, &err);
+  ASSERT_NE(nullptr, nine_patch);
+  EXPECT_EQ(Bounds(0, 0, 0, 0), nine_patch->outline);
+  EXPECT_EQ(3.4142f, nine_patch->outline_radius);
 }
 
-::testing::AssertionResult bigEndianOne(uint8_t* cursor) {
+::testing::AssertionResult BigEndianOne(uint8_t* cursor) {
   if (cursor[0] == 0 && cursor[1] == 0 && cursor[2] == 0 && cursor[3] == 1) {
     return ::testing::AssertionSuccess();
   }
@@ -353,12 +353,12 @@
 
 TEST(NinePatchTest, SerializePngEndianness) {
   std::string err;
-  std::unique_ptr<NinePatch> ninePatch =
-      NinePatch::create(kStretchAndPadding5x5, 5, 5, &err);
-  ASSERT_NE(nullptr, ninePatch);
+  std::unique_ptr<NinePatch> nine_patch =
+      NinePatch::Create(kStretchAndPadding5x5, 5, 5, &err);
+  ASSERT_NE(nullptr, nine_patch);
 
   size_t len;
-  std::unique_ptr<uint8_t[]> data = ninePatch->serializeBase(&len);
+  std::unique_ptr<uint8_t[]> data = nine_patch->SerializeBase(&len);
   ASSERT_NE(nullptr, data);
   ASSERT_NE(0u, len);
 
@@ -368,10 +368,10 @@
   uint8_t* cursor = data.get() + 12;
 
   // Check that padding is big-endian. Expecting value 1.
-  EXPECT_TRUE(bigEndianOne(cursor));
-  EXPECT_TRUE(bigEndianOne(cursor + 4));
-  EXPECT_TRUE(bigEndianOne(cursor + 8));
-  EXPECT_TRUE(bigEndianOne(cursor + 12));
+  EXPECT_TRUE(BigEndianOne(cursor));
+  EXPECT_TRUE(BigEndianOne(cursor + 4));
+  EXPECT_TRUE(BigEndianOne(cursor + 8));
+  EXPECT_TRUE(BigEndianOne(cursor + 12));
 }
 
 }  // namespace aapt
diff --git a/tools/aapt2/compile/Png.cpp b/tools/aapt2/compile/Png.cpp
index 9b5fa7e09..f1bc53e 100644
--- a/tools/aapt2/compile/Png.cpp
+++ b/tools/aapt2/compile/Png.cpp
@@ -89,7 +89,7 @@
 static void writeDataToStream(png_structp writePtr, png_bytep data,
                               png_size_t length) {
   BigBuffer* outBuffer = reinterpret_cast<BigBuffer*>(png_get_io_ptr(writePtr));
-  png_bytep buf = outBuffer->nextBlock<png_byte>(length);
+  png_bytep buf = outBuffer->NextBlock<png_byte>(length);
   memcpy(buf, data, length);
 }
 
@@ -98,13 +98,13 @@
 static void logWarning(png_structp readPtr, png_const_charp warningMessage) {
   IDiagnostics* diag =
       reinterpret_cast<IDiagnostics*>(png_get_error_ptr(readPtr));
-  diag->warn(DiagMessage() << warningMessage);
+  diag->Warn(DiagMessage() << warningMessage);
 }
 
 static bool readPng(IDiagnostics* diag, png_structp readPtr, png_infop infoPtr,
                     PngInfo* outInfo) {
   if (setjmp(png_jmpbuf(readPtr))) {
-    diag->error(DiagMessage() << "failed reading png");
+    diag->Error(DiagMessage() << "failed reading png");
     return false;
   }
 
@@ -373,7 +373,7 @@
     *colorType = PNG_COLOR_TYPE_PALETTE;
   } else {
     if (maxGrayDeviation <= grayscaleTolerance) {
-      diag->note(DiagMessage() << "forcing image to gray (max deviation = "
+      diag->Note(DiagMessage() << "forcing image to gray (max deviation = "
                                << maxGrayDeviation << ")");
       *colorType = isOpaque ? PNG_COLOR_TYPE_GRAY : PNG_COLOR_TYPE_GRAY_ALPHA;
     } else {
@@ -424,7 +424,7 @@
 static bool writePng(IDiagnostics* diag, png_structp writePtr,
                      png_infop infoPtr, PngInfo* info, int grayScaleTolerance) {
   if (setjmp(png_jmpbuf(writePtr))) {
-    diag->error(DiagMessage() << "failed to write png");
+    diag->Error(DiagMessage() << "failed to write png");
     return false;
   }
 
@@ -453,7 +453,7 @@
   png_set_compression_level(writePtr, Z_BEST_COMPRESSION);
 
   if (kDebug) {
-    diag->note(DiagMessage() << "writing image: w = " << info->width
+    diag->Note(DiagMessage() << "writing image: w = " << info->width
                              << ", h = " << info->height);
   }
 
@@ -476,23 +476,23 @@
   if (kDebug) {
     switch (colorType) {
       case PNG_COLOR_TYPE_PALETTE:
-        diag->note(DiagMessage() << "has " << paletteEntries << " colors"
+        diag->Note(DiagMessage() << "has " << paletteEntries << " colors"
                                  << (hasTransparency ? " (with alpha)" : "")
                                  << ", using PNG_COLOR_TYPE_PALLETTE");
         break;
       case PNG_COLOR_TYPE_GRAY:
-        diag->note(DiagMessage()
+        diag->Note(DiagMessage()
                    << "is opaque gray, using PNG_COLOR_TYPE_GRAY");
         break;
       case PNG_COLOR_TYPE_GRAY_ALPHA:
-        diag->note(DiagMessage()
+        diag->Note(DiagMessage()
                    << "is gray + alpha, using PNG_COLOR_TYPE_GRAY_ALPHA");
         break;
       case PNG_COLOR_TYPE_RGB:
-        diag->note(DiagMessage() << "is opaque RGB, using PNG_COLOR_TYPE_RGB");
+        diag->Note(DiagMessage() << "is opaque RGB, using PNG_COLOR_TYPE_RGB");
         break;
       case PNG_COLOR_TYPE_RGB_ALPHA:
-        diag->note(DiagMessage()
+        diag->Note(DiagMessage()
                    << "is RGB + alpha, using PNG_COLOR_TYPE_RGB_ALPHA");
         break;
     }
@@ -527,7 +527,7 @@
 
     // base 9 patch data
     if (kDebug) {
-      diag->note(DiagMessage() << "adding 9-patch info..");
+      diag->Note(DiagMessage() << "adding 9-patch info..");
     }
     strcpy((char*)unknowns[pIndex].name, "npTc");
     unknowns[pIndex].data = (png_byte*)info->serialize9Patch();
@@ -604,7 +604,7 @@
                &interlaceType, &compressionType, nullptr);
 
   if (kDebug) {
-    diag->note(DiagMessage() << "image written: w = " << width
+    diag->Note(DiagMessage() << "image written: w = " << width
                              << ", h = " << height << ", d = " << bitDepth
                              << ", colors = " << colorType
                              << ", inter = " << interlaceType
@@ -1228,13 +1228,13 @@
 
   // Read the PNG signature first.
   if (!input->read(reinterpret_cast<char*>(signature), kPngSignatureSize)) {
-    mDiag->error(DiagMessage() << strerror(errno));
+    mDiag->Error(DiagMessage() << strerror(errno));
     return false;
   }
 
   // If the PNG signature doesn't match, bail early.
   if (png_sig_cmp(signature, 0, kPngSignatureSize) != 0) {
-    mDiag->error(DiagMessage() << "not a valid png file");
+    mDiag->Error(DiagMessage() << "not a valid png file");
     return false;
   }
 
@@ -1247,13 +1247,13 @@
 
   readPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, nullptr, nullptr);
   if (!readPtr) {
-    mDiag->error(DiagMessage() << "failed to allocate read ptr");
+    mDiag->Error(DiagMessage() << "failed to allocate read ptr");
     goto bail;
   }
 
   infoPtr = png_create_info_struct(readPtr);
   if (!infoPtr) {
-    mDiag->error(DiagMessage() << "failed to allocate info ptr");
+    mDiag->Error(DiagMessage() << "failed to allocate info ptr");
     goto bail;
   }
 
@@ -1267,10 +1267,10 @@
     goto bail;
   }
 
-  if (util::stringEndsWith(source.path, ".9.png")) {
+  if (util::EndsWith(source.path, ".9.png")) {
     std::string errorMsg;
     if (!do9Patch(&pngInfo, &errorMsg)) {
-      mDiag->error(DiagMessage() << errorMsg);
+      mDiag->Error(DiagMessage() << errorMsg);
       goto bail;
     }
   }
@@ -1278,13 +1278,13 @@
   writePtr =
       png_create_write_struct(PNG_LIBPNG_VER_STRING, 0, nullptr, nullptr);
   if (!writePtr) {
-    mDiag->error(DiagMessage() << "failed to allocate write ptr");
+    mDiag->Error(DiagMessage() << "failed to allocate write ptr");
     goto bail;
   }
 
   writeInfoPtr = png_create_info_struct(writePtr);
   if (!writeInfoPtr) {
-    mDiag->error(DiagMessage() << "failed to allocate write info ptr");
+    mDiag->Error(DiagMessage() << "failed to allocate write info ptr");
     goto bail;
   }
 
@@ -1295,7 +1295,7 @@
                    flushDataToStream);
 
   if (!writePng(mDiag, writePtr, writeInfoPtr, &pngInfo,
-                options.grayScaleTolerance)) {
+                options.grayscale_tolerance)) {
     goto bail;
   }
 
diff --git a/tools/aapt2/compile/Png.h b/tools/aapt2/compile/Png.h
index f9038af..01c9adb 100644
--- a/tools/aapt2/compile/Png.h
+++ b/tools/aapt2/compile/Png.h
@@ -17,6 +17,11 @@
 #ifndef AAPT_PNG_H
 #define AAPT_PNG_H
 
+#include <iostream>
+#include <string>
+
+#include "android-base/macros.h"
+
 #include "Diagnostics.h"
 #include "Source.h"
 #include "compile/Image.h"
@@ -24,16 +29,15 @@
 #include "process/IResourceTableConsumer.h"
 #include "util/BigBuffer.h"
 
-#include <android-base/macros.h>
-#include <iostream>
-#include <string>
-
 namespace aapt {
 
 struct PngOptions {
-  int grayScaleTolerance = 0;
+  int grayscale_tolerance = 0;
 };
 
+/**
+ * Deprecated. Removing once new PNG crunching code is proved to be correct.
+ */
 class Png {
  public:
   explicit Png(IDiagnostics* diag) : mDiag(diag) {}
@@ -59,18 +63,18 @@
   bool Skip(int count) override;
 
   int64_t ByteCount() const override {
-    return static_cast<int64_t>(mWindowStart);
+    return static_cast<int64_t>(window_start_);
   }
 
-  bool HadError() const override { return mError; }
+  bool HadError() const override { return error_; }
 
  private:
-  bool consumeWindow(const void** buffer, int* len);
+  bool ConsumeWindow(const void** buffer, int* len);
 
-  StringPiece mData;
-  size_t mWindowStart = 0;
-  size_t mWindowEnd = 0;
-  bool mError = false;
+  StringPiece data_;
+  size_t window_start_ = 0;
+  size_t window_end_ = 0;
+  bool error_ = false;
 
   DISALLOW_COPY_AND_ASSIGN(PngChunkFilter);
 };
@@ -78,14 +82,14 @@
 /**
  * Reads a PNG from the InputStream into memory as an RGBA Image.
  */
-std::unique_ptr<Image> readPng(IAaptContext* context, io::InputStream* in);
+std::unique_ptr<Image> ReadPng(IAaptContext* context, io::InputStream* in);
 
 /**
  * Writes the RGBA Image, with optional 9-patch meta-data, into the OutputStream
  * as a PNG.
  */
-bool writePng(IAaptContext* context, const Image* image,
-              const NinePatch* ninePatch, io::OutputStream* out,
+bool WritePng(IAaptContext* context, const Image* image,
+              const NinePatch* nine_patch, io::OutputStream* out,
               const PngOptions& options);
 
 }  // namespace aapt
diff --git a/tools/aapt2/compile/PngChunkFilter.cpp b/tools/aapt2/compile/PngChunkFilter.cpp
index fb7fe92..4cbefb9 100644
--- a/tools/aapt2/compile/PngChunkFilter.cpp
+++ b/tools/aapt2/compile/PngChunkFilter.cpp
@@ -15,6 +15,7 @@
  */
 
 #include "compile/Png.h"
+
 #include "io/Io.h"
 #include "util/StringPiece.h"
 
@@ -39,7 +40,7 @@
   kPngChunksRGB = u32(115, 82, 71, 66),
 };
 
-static uint32_t peek32LE(const char* data) {
+static uint32_t Peek32LE(const char* data) {
   uint32_t word = ((uint32_t)data[0]) & 0x000000ff;
   word <<= 8;
   word |= ((uint32_t)data[1]) & 0x000000ff;
@@ -50,7 +51,7 @@
   return word;
 }
 
-static bool isPngChunkWhitelisted(uint32_t type) {
+static bool IsPngChunkWhitelisted(uint32_t type) {
   switch (type) {
     case kPngChunkIHDR:
     case kPngChunkIDAT:
@@ -64,93 +65,93 @@
   }
 }
 
-PngChunkFilter::PngChunkFilter(const StringPiece& data) : mData(data) {
-  if (util::stringStartsWith(mData, kPngSignature)) {
-    mWindowStart = 0;
-    mWindowEnd = strlen(kPngSignature);
+PngChunkFilter::PngChunkFilter(const StringPiece& data) : data_(data) {
+  if (util::StartsWith(data_, kPngSignature)) {
+    window_start_ = 0;
+    window_end_ = strlen(kPngSignature);
   } else {
-    mError = true;
+    error_ = true;
   }
 }
 
-bool PngChunkFilter::consumeWindow(const void** buffer, int* len) {
-  if (mWindowStart != mWindowEnd) {
+bool PngChunkFilter::ConsumeWindow(const void** buffer, int* len) {
+  if (window_start_ != window_end_) {
     // We have bytes to give from our window.
-    const int bytesRead = (int)(mWindowEnd - mWindowStart);
-    *buffer = mData.data() + mWindowStart;
-    *len = bytesRead;
-    mWindowStart = mWindowEnd;
+    const int bytes_read = (int)(window_end_ - window_start_);
+    *buffer = data_.data() + window_start_;
+    *len = bytes_read;
+    window_start_ = window_end_;
     return true;
   }
   return false;
 }
 
 bool PngChunkFilter::Next(const void** buffer, int* len) {
-  if (mError) {
+  if (error_) {
     return false;
   }
 
   // In case BackUp was called, we must consume the window.
-  if (consumeWindow(buffer, len)) {
+  if (ConsumeWindow(buffer, len)) {
     return true;
   }
 
   // Advance the window as far as possible (until we meet a chunk that
   // we want to strip).
-  while (mWindowEnd < mData.size()) {
+  while (window_end_ < data_.size()) {
     // Chunk length (4 bytes) + type (4 bytes) + crc32 (4 bytes) = 12 bytes.
     const size_t kMinChunkHeaderSize = 3 * sizeof(uint32_t);
 
     // Is there enough room for a chunk header?
-    if (mData.size() - mWindowStart < kMinChunkHeaderSize) {
-      mError = true;
+    if (data_.size() - window_start_ < kMinChunkHeaderSize) {
+      error_ = true;
       return false;
     }
 
     // Verify the chunk length.
-    const uint32_t chunkLen = peek32LE(mData.data() + mWindowEnd);
-    if (((uint64_t)chunkLen) + ((uint64_t)mWindowEnd) + sizeof(uint32_t) >
-        mData.size()) {
+    const uint32_t chunk_len = Peek32LE(data_.data() + window_end_);
+    if (((uint64_t)chunk_len) + ((uint64_t)window_end_) + sizeof(uint32_t) >
+        data_.size()) {
       // Overflow.
-      mError = true;
+      error_ = true;
       return false;
     }
 
     // Do we strip this chunk?
-    const uint32_t chunkType =
-        peek32LE(mData.data() + mWindowEnd + sizeof(uint32_t));
-    if (isPngChunkWhitelisted(chunkType)) {
+    const uint32_t chunk_type =
+        Peek32LE(data_.data() + window_end_ + sizeof(uint32_t));
+    if (IsPngChunkWhitelisted(chunk_type)) {
       // Advance the window to include this chunk.
-      mWindowEnd += kMinChunkHeaderSize + chunkLen;
+      window_end_ += kMinChunkHeaderSize + chunk_len;
     } else {
       // We want to strip this chunk. If we accumulated a window,
       // we must return the window now.
-      if (mWindowStart != mWindowEnd) {
+      if (window_start_ != window_end_) {
         break;
       }
 
       // The window is empty, so we can advance past this chunk
       // and keep looking for the next good chunk,
-      mWindowEnd += kMinChunkHeaderSize + chunkLen;
-      mWindowStart = mWindowEnd;
+      window_end_ += kMinChunkHeaderSize + chunk_len;
+      window_start_ = window_end_;
     }
   }
 
-  if (consumeWindow(buffer, len)) {
+  if (ConsumeWindow(buffer, len)) {
     return true;
   }
   return false;
 }
 
 void PngChunkFilter::BackUp(int count) {
-  if (mError) {
+  if (error_) {
     return;
   }
-  mWindowStart -= count;
+  window_start_ -= count;
 }
 
 bool PngChunkFilter::Skip(int count) {
-  if (mError) {
+  if (error_) {
     return false;
   }
 
diff --git a/tools/aapt2/compile/PngCrunch.cpp b/tools/aapt2/compile/PngCrunch.cpp
index 4a74f7af7..3b46d8b 100644
--- a/tools/aapt2/compile/PngCrunch.cpp
+++ b/tools/aapt2/compile/PngCrunch.cpp
@@ -16,14 +16,17 @@
 
 #include "compile/Png.h"
 
-#include <android-base/errors.h>
-#include <android-base/macros.h>
 #include <png.h>
 #include <zlib.h>
+
 #include <algorithm>
 #include <unordered_map>
 #include <unordered_set>
 
+#include "android-base/errors.h"
+#include "android-base/logging.h"
+#include "android-base/macros.h"
+
 namespace aapt {
 
 // Size in bytes of the PNG signature.
@@ -34,16 +37,16 @@
  */
 class PngReadStructDeleter {
  public:
-  explicit PngReadStructDeleter(png_structp readPtr, png_infop infoPtr)
-      : mReadPtr(readPtr), mInfoPtr(infoPtr) {}
+  PngReadStructDeleter(png_structp read_ptr, png_infop info_ptr)
+      : read_ptr_(read_ptr), info_ptr_(info_ptr) {}
 
   ~PngReadStructDeleter() {
-    png_destroy_read_struct(&mReadPtr, &mInfoPtr, nullptr);
+    png_destroy_read_struct(&read_ptr_, &info_ptr_, nullptr);
   }
 
  private:
-  png_structp mReadPtr;
-  png_infop mInfoPtr;
+  png_structp read_ptr_;
+  png_infop info_ptr_;
 
   DISALLOW_COPY_AND_ASSIGN(PngReadStructDeleter);
 };
@@ -53,226 +56,229 @@
  */
 class PngWriteStructDeleter {
  public:
-  explicit PngWriteStructDeleter(png_structp writePtr, png_infop infoPtr)
-      : mWritePtr(writePtr), mInfoPtr(infoPtr) {}
+  PngWriteStructDeleter(png_structp write_ptr, png_infop info_ptr)
+      : write_ptr_(write_ptr), info_ptr_(info_ptr) {}
 
-  ~PngWriteStructDeleter() { png_destroy_write_struct(&mWritePtr, &mInfoPtr); }
+  ~PngWriteStructDeleter() {
+    png_destroy_write_struct(&write_ptr_, &info_ptr_);
+  }
 
  private:
-  png_structp mWritePtr;
-  png_infop mInfoPtr;
+  png_structp write_ptr_;
+  png_infop info_ptr_;
 
   DISALLOW_COPY_AND_ASSIGN(PngWriteStructDeleter);
 };
 
 // Custom warning logging method that uses IDiagnostics.
-static void logWarning(png_structp pngPtr, png_const_charp warningMsg) {
-  IDiagnostics* diag = (IDiagnostics*)png_get_error_ptr(pngPtr);
-  diag->warn(DiagMessage() << warningMsg);
+static void LogWarning(png_structp png_ptr, png_const_charp warning_msg) {
+  IDiagnostics* diag = (IDiagnostics*)png_get_error_ptr(png_ptr);
+  diag->Warn(DiagMessage() << warning_msg);
 }
 
 // Custom error logging method that uses IDiagnostics.
-static void logError(png_structp pngPtr, png_const_charp errorMsg) {
-  IDiagnostics* diag = (IDiagnostics*)png_get_error_ptr(pngPtr);
-  diag->error(DiagMessage() << errorMsg);
+static void LogError(png_structp png_ptr, png_const_charp error_msg) {
+  IDiagnostics* diag = (IDiagnostics*)png_get_error_ptr(png_ptr);
+  diag->Error(DiagMessage() << error_msg);
 }
 
-static void readDataFromStream(png_structp pngPtr, png_bytep buffer,
+static void ReadDataFromStream(png_structp png_ptr, png_bytep buffer,
                                png_size_t len) {
-  io::InputStream* in = (io::InputStream*)png_get_io_ptr(pngPtr);
+  io::InputStream* in = (io::InputStream*)png_get_io_ptr(png_ptr);
 
-  const void* inBuffer;
-  int inLen;
-  if (!in->Next(&inBuffer, &inLen)) {
+  const void* in_buffer;
+  int in_len;
+  if (!in->Next(&in_buffer, &in_len)) {
     if (in->HadError()) {
       std::string err = in->GetError();
-      png_error(pngPtr, err.c_str());
+      png_error(png_ptr, err.c_str());
     }
     return;
   }
 
-  const size_t bytesRead = std::min(static_cast<size_t>(inLen), len);
-  memcpy(buffer, inBuffer, bytesRead);
-  if (bytesRead != static_cast<size_t>(inLen)) {
-    in->BackUp(inLen - static_cast<int>(bytesRead));
+  const size_t bytes_read = std::min(static_cast<size_t>(in_len), len);
+  memcpy(buffer, in_buffer, bytes_read);
+  if (bytes_read != static_cast<size_t>(in_len)) {
+    in->BackUp(in_len - static_cast<int>(bytes_read));
   }
 }
 
-static void writeDataToStream(png_structp pngPtr, png_bytep buffer,
+static void WriteDataToStream(png_structp png_ptr, png_bytep buffer,
                               png_size_t len) {
-  io::OutputStream* out = (io::OutputStream*)png_get_io_ptr(pngPtr);
+  io::OutputStream* out = (io::OutputStream*)png_get_io_ptr(png_ptr);
 
-  void* outBuffer;
-  int outLen;
+  void* out_buffer;
+  int out_len;
   while (len > 0) {
-    if (!out->Next(&outBuffer, &outLen)) {
+    if (!out->Next(&out_buffer, &out_len)) {
       if (out->HadError()) {
         std::string err = out->GetError();
-        png_error(pngPtr, err.c_str());
+        png_error(png_ptr, err.c_str());
       }
       return;
     }
 
-    const size_t bytesWritten = std::min(static_cast<size_t>(outLen), len);
-    memcpy(outBuffer, buffer, bytesWritten);
+    const size_t bytes_written = std::min(static_cast<size_t>(out_len), len);
+    memcpy(out_buffer, buffer, bytes_written);
 
     // Advance the input buffer.
-    buffer += bytesWritten;
-    len -= bytesWritten;
+    buffer += bytes_written;
+    len -= bytes_written;
 
     // Advance the output buffer.
-    outLen -= static_cast<int>(bytesWritten);
+    out_len -= static_cast<int>(bytes_written);
   }
 
   // If the entire output buffer wasn't used, backup.
-  if (outLen > 0) {
-    out->BackUp(outLen);
+  if (out_len > 0) {
+    out->BackUp(out_len);
   }
 }
 
-std::unique_ptr<Image> readPng(IAaptContext* context, io::InputStream* in) {
+std::unique_ptr<Image> ReadPng(IAaptContext* context, io::InputStream* in) {
   // Read the first 8 bytes of the file looking for the PNG signature.
   // Bail early if it does not match.
   const png_byte* signature;
-  int bufferSize;
-  if (!in->Next((const void**)&signature, &bufferSize)) {
-    context->getDiagnostics()->error(
+  int buffer_size;
+  if (!in->Next((const void**)&signature, &buffer_size)) {
+    context->GetDiagnostics()->Error(
         DiagMessage() << android::base::SystemErrorCodeToString(errno));
     return {};
   }
 
-  if (static_cast<size_t>(bufferSize) < kPngSignatureSize ||
+  if (static_cast<size_t>(buffer_size) < kPngSignatureSize ||
       png_sig_cmp(signature, 0, kPngSignatureSize) != 0) {
-    context->getDiagnostics()->error(
+    context->GetDiagnostics()->Error(
         DiagMessage() << "file signature does not match PNG signature");
     return {};
   }
 
   // Start at the beginning of the first chunk.
-  in->BackUp(bufferSize - static_cast<int>(kPngSignatureSize));
+  in->BackUp(buffer_size - static_cast<int>(kPngSignatureSize));
 
   // Create and initialize the png_struct with the default error and warning
   // handlers.
   // The header version is also passed in to ensure that this was built against
   // the same
   // version of libpng.
-  png_structp readPtr =
+  png_structp read_ptr =
       png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
-  if (readPtr == nullptr) {
-    context->getDiagnostics()->error(
+  if (read_ptr == nullptr) {
+    context->GetDiagnostics()->Error(
         DiagMessage() << "failed to create libpng read png_struct");
     return {};
   }
 
   // Create and initialize the memory for image header and data.
-  png_infop infoPtr = png_create_info_struct(readPtr);
-  if (infoPtr == nullptr) {
-    context->getDiagnostics()->error(
+  png_infop info_ptr = png_create_info_struct(read_ptr);
+  if (info_ptr == nullptr) {
+    context->GetDiagnostics()->Error(
         DiagMessage() << "failed to create libpng read png_info");
-    png_destroy_read_struct(&readPtr, nullptr, nullptr);
+    png_destroy_read_struct(&read_ptr, nullptr, nullptr);
     return {};
   }
 
   // Automatically release PNG resources at end of scope.
-  PngReadStructDeleter pngReadDeleter(readPtr, infoPtr);
+  PngReadStructDeleter png_read_deleter(read_ptr, info_ptr);
 
   // libpng uses longjmp to jump to an error handling routine.
   // setjmp will only return true if it was jumped to, aka there was
   // an error.
-  if (setjmp(png_jmpbuf(readPtr))) {
+  if (setjmp(png_jmpbuf(read_ptr))) {
     return {};
   }
 
   // Handle warnings ourselves via IDiagnostics.
-  png_set_error_fn(readPtr, (png_voidp)context->getDiagnostics(), logError,
-                   logWarning);
+  png_set_error_fn(read_ptr, (png_voidp)context->GetDiagnostics(), LogError,
+                   LogWarning);
 
   // Set up the read functions which read from our custom data sources.
-  png_set_read_fn(readPtr, (png_voidp)in, readDataFromStream);
+  png_set_read_fn(read_ptr, (png_voidp)in, ReadDataFromStream);
 
   // Skip the signature that we already read.
-  png_set_sig_bytes(readPtr, kPngSignatureSize);
+  png_set_sig_bytes(read_ptr, kPngSignatureSize);
 
   // Read the chunk headers.
-  png_read_info(readPtr, infoPtr);
+  png_read_info(read_ptr, info_ptr);
 
   // Extract image meta-data from the various chunk headers.
   uint32_t width, height;
-  int bitDepth, colorType, interlaceMethod, compressionMethod, filterMethod;
-  png_get_IHDR(readPtr, infoPtr, &width, &height, &bitDepth, &colorType,
-               &interlaceMethod, &compressionMethod, &filterMethod);
+  int bit_depth, color_type, interlace_method, compression_method,
+      filter_method;
+  png_get_IHDR(read_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
+               &interlace_method, &compression_method, &filter_method);
 
   // When the image is read, expand it so that it is in RGBA 8888 format
   // so that image handling is uniform.
 
-  if (colorType == PNG_COLOR_TYPE_PALETTE) {
-    png_set_palette_to_rgb(readPtr);
+  if (color_type == PNG_COLOR_TYPE_PALETTE) {
+    png_set_palette_to_rgb(read_ptr);
   }
 
-  if (colorType == PNG_COLOR_TYPE_GRAY && bitDepth < 8) {
-    png_set_expand_gray_1_2_4_to_8(readPtr);
+  if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) {
+    png_set_expand_gray_1_2_4_to_8(read_ptr);
   }
 
-  if (png_get_valid(readPtr, infoPtr, PNG_INFO_tRNS)) {
-    png_set_tRNS_to_alpha(readPtr);
+  if (png_get_valid(read_ptr, info_ptr, PNG_INFO_tRNS)) {
+    png_set_tRNS_to_alpha(read_ptr);
   }
 
-  if (bitDepth == 16) {
-    png_set_strip_16(readPtr);
+  if (bit_depth == 16) {
+    png_set_strip_16(read_ptr);
   }
 
-  if (!(colorType & PNG_COLOR_MASK_ALPHA)) {
-    png_set_add_alpha(readPtr, 0xFF, PNG_FILLER_AFTER);
+  if (!(color_type & PNG_COLOR_MASK_ALPHA)) {
+    png_set_add_alpha(read_ptr, 0xFF, PNG_FILLER_AFTER);
   }
 
-  if (colorType == PNG_COLOR_TYPE_GRAY ||
-      colorType == PNG_COLOR_TYPE_GRAY_ALPHA) {
-    png_set_gray_to_rgb(readPtr);
+  if (color_type == PNG_COLOR_TYPE_GRAY ||
+      color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
+    png_set_gray_to_rgb(read_ptr);
   }
 
-  if (interlaceMethod != PNG_INTERLACE_NONE) {
-    png_set_interlace_handling(readPtr);
+  if (interlace_method != PNG_INTERLACE_NONE) {
+    png_set_interlace_handling(read_ptr);
   }
 
   // Once all the options for reading have been set, we need to flush
   // them to libpng.
-  png_read_update_info(readPtr, infoPtr);
+  png_read_update_info(read_ptr, info_ptr);
 
   // 9-patch uses int32_t to index images, so we cap the image dimensions to
   // something
   // that can always be represented by 9-patch.
   if (width > std::numeric_limits<int32_t>::max() ||
       height > std::numeric_limits<int32_t>::max()) {
-    context->getDiagnostics()->error(DiagMessage()
+    context->GetDiagnostics()->Error(DiagMessage()
                                      << "PNG image dimensions are too large: "
                                      << width << "x" << height);
     return {};
   }
 
-  std::unique_ptr<Image> outputImage = util::make_unique<Image>();
-  outputImage->width = static_cast<int32_t>(width);
-  outputImage->height = static_cast<int32_t>(height);
+  std::unique_ptr<Image> output_image = util::make_unique<Image>();
+  output_image->width = static_cast<int32_t>(width);
+  output_image->height = static_cast<int32_t>(height);
 
-  const size_t rowBytes = png_get_rowbytes(readPtr, infoPtr);
-  assert(rowBytes == 4 * width);  // RGBA
+  const size_t row_bytes = png_get_rowbytes(read_ptr, info_ptr);
+  CHECK(row_bytes == 4 * width);  // RGBA
 
   // Allocate one large block to hold the image.
-  outputImage->data =
-      std::unique_ptr<uint8_t[]>(new uint8_t[height * rowBytes]);
+  output_image->data =
+      std::unique_ptr<uint8_t[]>(new uint8_t[height * row_bytes]);
 
   // Create an array of rows that index into the data block.
-  outputImage->rows = std::unique_ptr<uint8_t* []>(new uint8_t*[height]);
+  output_image->rows = std::unique_ptr<uint8_t* []>(new uint8_t*[height]);
   for (uint32_t h = 0; h < height; h++) {
-    outputImage->rows[h] = outputImage->data.get() + (h * rowBytes);
+    output_image->rows[h] = output_image->data.get() + (h * row_bytes);
   }
 
   // Actually read the image pixels.
-  png_read_image(readPtr, outputImage->rows.get());
+  png_read_image(read_ptr, output_image->rows.get());
 
   // Finish reading. This will read any other chunks after the image data.
-  png_read_end(readPtr, infoPtr);
+  png_read_end(read_ptr, info_ptr);
 
-  return outputImage;
+  return output_image;
 }
 
 /**
@@ -309,57 +315,58 @@
 // - Grayscale + cheap alpha
 // - Grayscale + alpha
 //
-static int pickColorType(int32_t width, int32_t height, bool grayScale,
-                         bool convertibleToGrayScale, bool hasNinePatch,
-                         size_t colorPaletteSize, size_t alphaPaletteSize) {
-  const size_t paletteChunkSize = 16 + colorPaletteSize * 3;
-  const size_t alphaChunkSize = 16 + alphaPaletteSize;
-  const size_t colorAlphaDataChunkSize = 16 + 4 * width * height;
-  const size_t colorDataChunkSize = 16 + 3 * width * height;
-  const size_t grayScaleAlphaDataChunkSize = 16 + 2 * width * height;
-  const size_t paletteDataChunkSize = 16 + width * height;
+static int PickColorType(int32_t width, int32_t height, bool grayscale,
+                         bool convertible_to_grayscale, bool has_nine_patch,
+                         size_t color_palette_size, size_t alpha_palette_size) {
+  const size_t palette_chunk_size = 16 + color_palette_size * 3;
+  const size_t alpha_chunk_size = 16 + alpha_palette_size;
+  const size_t color_alpha_data_chunk_size = 16 + 4 * width * height;
+  const size_t color_data_chunk_size = 16 + 3 * width * height;
+  const size_t grayscale_alpha_data_chunk_size = 16 + 2 * width * height;
+  const size_t palette_data_chunk_size = 16 + width * height;
 
-  if (grayScale) {
-    if (alphaPaletteSize == 0) {
+  if (grayscale) {
+    if (alpha_palette_size == 0) {
       // This is the smallest the data can be.
       return PNG_COLOR_TYPE_GRAY;
-    } else if (colorPaletteSize <= 256 && !hasNinePatch) {
+    } else if (color_palette_size <= 256 && !has_nine_patch) {
       // This grayscale has alpha and can fit within a palette.
       // See if it is worth fitting into a palette.
-      const size_t paletteThreshold = paletteChunkSize + alphaChunkSize +
-                                      paletteDataChunkSize +
-                                      kPaletteOverheadConstant;
-      if (grayScaleAlphaDataChunkSize > paletteThreshold) {
+      const size_t palette_threshold = palette_chunk_size + alpha_chunk_size +
+                                       palette_data_chunk_size +
+                                       kPaletteOverheadConstant;
+      if (grayscale_alpha_data_chunk_size > palette_threshold) {
         return PNG_COLOR_TYPE_PALETTE;
       }
     }
     return PNG_COLOR_TYPE_GRAY_ALPHA;
   }
 
-  if (colorPaletteSize <= 256 && !hasNinePatch) {
+  if (color_palette_size <= 256 && !has_nine_patch) {
     // This image can fit inside a palette. Let's see if it is worth it.
-    size_t totalSizeWithPalette = paletteDataChunkSize + paletteChunkSize;
-    size_t totalSizeWithoutPalette = colorDataChunkSize;
-    if (alphaPaletteSize > 0) {
-      totalSizeWithPalette += alphaPaletteSize;
-      totalSizeWithoutPalette = colorAlphaDataChunkSize;
+    size_t total_size_with_palette =
+        palette_data_chunk_size + palette_chunk_size;
+    size_t total_size_without_palette = color_data_chunk_size;
+    if (alpha_palette_size > 0) {
+      total_size_with_palette += alpha_palette_size;
+      total_size_without_palette = color_alpha_data_chunk_size;
     }
 
-    if (totalSizeWithoutPalette >
-        totalSizeWithPalette + kPaletteOverheadConstant) {
+    if (total_size_without_palette >
+        total_size_with_palette + kPaletteOverheadConstant) {
       return PNG_COLOR_TYPE_PALETTE;
     }
   }
 
-  if (convertibleToGrayScale) {
-    if (alphaPaletteSize == 0) {
+  if (convertible_to_grayscale) {
+    if (alpha_palette_size == 0) {
       return PNG_COLOR_TYPE_GRAY;
     } else {
       return PNG_COLOR_TYPE_GRAY_ALPHA;
     }
   }
 
-  if (alphaPaletteSize == 0) {
+  if (alpha_palette_size == 0) {
     return PNG_COLOR_TYPE_RGB;
   }
   return PNG_COLOR_TYPE_RGBA;
@@ -371,11 +378,11 @@
 // This must be done before writing image data.
 // Image data must be transformed to use the indices assigned within the
 // palette.
-static void writePalette(png_structp writePtr, png_infop writeInfoPtr,
-                         std::unordered_map<uint32_t, int>* colorPalette,
-                         std::unordered_set<uint32_t>* alphaPalette) {
-  assert(colorPalette->size() <= 256);
-  assert(alphaPalette->size() <= 256);
+static void WritePalette(png_structp write_ptr, png_infop write_info_ptr,
+                         std::unordered_map<uint32_t, int>* color_palette,
+                         std::unordered_set<uint32_t>* alpha_palette) {
+  CHECK(color_palette->size() <= 256);
+  CHECK(alpha_palette->size() <= 256);
 
   // Populate the PNG palette struct and assign indices to the color
   // palette.
@@ -384,160 +391,161 @@
   // This will ensure that we can truncate the alpha palette if it is
   // smaller than the color palette.
   int index = 0;
-  for (uint32_t color : *alphaPalette) {
-    (*colorPalette)[color] = index++;
+  for (uint32_t color : *alpha_palette) {
+    (*color_palette)[color] = index++;
   }
 
   // Assign the rest of the entries.
-  for (auto& entry : *colorPalette) {
+  for (auto& entry : *color_palette) {
     if (entry.second == -1) {
       entry.second = index++;
     }
   }
 
   // Create the PNG color palette struct.
-  auto colorPaletteBytes =
-      std::unique_ptr<png_color[]>(new png_color[colorPalette->size()]);
+  auto color_palette_bytes =
+      std::unique_ptr<png_color[]>(new png_color[color_palette->size()]);
 
-  std::unique_ptr<png_byte[]> alphaPaletteBytes;
-  if (!alphaPalette->empty()) {
-    alphaPaletteBytes =
-        std::unique_ptr<png_byte[]>(new png_byte[alphaPalette->size()]);
+  std::unique_ptr<png_byte[]> alpha_palette_bytes;
+  if (!alpha_palette->empty()) {
+    alpha_palette_bytes =
+        std::unique_ptr<png_byte[]>(new png_byte[alpha_palette->size()]);
   }
 
-  for (const auto& entry : *colorPalette) {
+  for (const auto& entry : *color_palette) {
     const uint32_t color = entry.first;
     const int index = entry.second;
-    assert(index >= 0);
-    assert(static_cast<size_t>(index) < colorPalette->size());
+    CHECK(index >= 0);
+    CHECK(static_cast<size_t>(index) < color_palette->size());
 
-    png_colorp slot = colorPaletteBytes.get() + index;
+    png_colorp slot = color_palette_bytes.get() + index;
     slot->red = color >> 24;
     slot->green = color >> 16;
     slot->blue = color >> 8;
 
     const png_byte alpha = color & 0x000000ff;
-    if (alpha != 0xff && alphaPaletteBytes) {
-      assert(static_cast<size_t>(index) < alphaPalette->size());
-      alphaPaletteBytes[index] = alpha;
+    if (alpha != 0xff && alpha_palette_bytes) {
+      CHECK(static_cast<size_t>(index) < alpha_palette->size());
+      alpha_palette_bytes[index] = alpha;
     }
   }
 
-  // The bytes get copied here, so it is safe to release colorPaletteBytes at
+  // The bytes get copied here, so it is safe to release color_palette_bytes at
   // the end of function
   // scope.
-  png_set_PLTE(writePtr, writeInfoPtr, colorPaletteBytes.get(),
-               colorPalette->size());
+  png_set_PLTE(write_ptr, write_info_ptr, color_palette_bytes.get(),
+               color_palette->size());
 
-  if (alphaPaletteBytes) {
-    png_set_tRNS(writePtr, writeInfoPtr, alphaPaletteBytes.get(),
-                 alphaPalette->size(), nullptr);
+  if (alpha_palette_bytes) {
+    png_set_tRNS(write_ptr, write_info_ptr, alpha_palette_bytes.get(),
+                 alpha_palette->size(), nullptr);
   }
 }
 
-// Write the 9-patch custom PNG chunks to writeInfoPtr. This must be done before
+// Write the 9-patch custom PNG chunks to write_info_ptr. This must be done
+// before
 // writing image data.
-static void writeNinePatch(png_structp writePtr, png_infop writeInfoPtr,
-                           const NinePatch* ninePatch) {
+static void WriteNinePatch(png_structp write_ptr, png_infop write_info_ptr,
+                           const NinePatch* nine_patch) {
   // The order of the chunks is important.
   // 9-patch code in older platforms expects the 9-patch chunk to
   // be last.
 
-  png_unknown_chunk unknownChunks[3];
-  memset(unknownChunks, 0, sizeof(unknownChunks));
+  png_unknown_chunk unknown_chunks[3];
+  memset(unknown_chunks, 0, sizeof(unknown_chunks));
 
   size_t index = 0;
-  size_t chunkLen = 0;
+  size_t chunk_len = 0;
 
-  std::unique_ptr<uint8_t[]> serializedOutline =
-      ninePatch->serializeRoundedRectOutline(&chunkLen);
-  strcpy((char*)unknownChunks[index].name, "npOl");
-  unknownChunks[index].size = chunkLen;
-  unknownChunks[index].data = (png_bytep)serializedOutline.get();
-  unknownChunks[index].location = PNG_HAVE_PLTE;
+  std::unique_ptr<uint8_t[]> serialized_outline =
+      nine_patch->SerializeRoundedRectOutline(&chunk_len);
+  strcpy((char*)unknown_chunks[index].name, "npOl");
+  unknown_chunks[index].size = chunk_len;
+  unknown_chunks[index].data = (png_bytep)serialized_outline.get();
+  unknown_chunks[index].location = PNG_HAVE_PLTE;
   index++;
 
-  std::unique_ptr<uint8_t[]> serializedLayoutBounds;
-  if (ninePatch->layoutBounds.nonZero()) {
-    serializedLayoutBounds = ninePatch->serializeLayoutBounds(&chunkLen);
-    strcpy((char*)unknownChunks[index].name, "npLb");
-    unknownChunks[index].size = chunkLen;
-    unknownChunks[index].data = (png_bytep)serializedLayoutBounds.get();
-    unknownChunks[index].location = PNG_HAVE_PLTE;
+  std::unique_ptr<uint8_t[]> serialized_layout_bounds;
+  if (nine_patch->layout_bounds.nonZero()) {
+    serialized_layout_bounds = nine_patch->SerializeLayoutBounds(&chunk_len);
+    strcpy((char*)unknown_chunks[index].name, "npLb");
+    unknown_chunks[index].size = chunk_len;
+    unknown_chunks[index].data = (png_bytep)serialized_layout_bounds.get();
+    unknown_chunks[index].location = PNG_HAVE_PLTE;
     index++;
   }
 
-  std::unique_ptr<uint8_t[]> serializedNinePatch =
-      ninePatch->serializeBase(&chunkLen);
-  strcpy((char*)unknownChunks[index].name, "npTc");
-  unknownChunks[index].size = chunkLen;
-  unknownChunks[index].data = (png_bytep)serializedNinePatch.get();
-  unknownChunks[index].location = PNG_HAVE_PLTE;
+  std::unique_ptr<uint8_t[]> serialized_nine_patch =
+      nine_patch->SerializeBase(&chunk_len);
+  strcpy((char*)unknown_chunks[index].name, "npTc");
+  unknown_chunks[index].size = chunk_len;
+  unknown_chunks[index].data = (png_bytep)serialized_nine_patch.get();
+  unknown_chunks[index].location = PNG_HAVE_PLTE;
   index++;
 
   // Handle all unknown chunks. We are manually setting the chunks here,
   // so we will only ever handle our custom chunks.
-  png_set_keep_unknown_chunks(writePtr, PNG_HANDLE_CHUNK_ALWAYS, nullptr, 0);
+  png_set_keep_unknown_chunks(write_ptr, PNG_HANDLE_CHUNK_ALWAYS, nullptr, 0);
 
   // Set the actual chunks here. The data gets copied, so our buffers can
   // safely go out of scope.
-  png_set_unknown_chunks(writePtr, writeInfoPtr, unknownChunks, index);
+  png_set_unknown_chunks(write_ptr, write_info_ptr, unknown_chunks, index);
 }
 
-bool writePng(IAaptContext* context, const Image* image,
-              const NinePatch* ninePatch, io::OutputStream* out,
+bool WritePng(IAaptContext* context, const Image* image,
+              const NinePatch* nine_patch, io::OutputStream* out,
               const PngOptions& options) {
   // Create and initialize the write png_struct with the default error and
   // warning handlers.
   // The header version is also passed in to ensure that this was built against
   // the same
   // version of libpng.
-  png_structp writePtr =
+  png_structp write_ptr =
       png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
-  if (writePtr == nullptr) {
-    context->getDiagnostics()->error(
+  if (write_ptr == nullptr) {
+    context->GetDiagnostics()->Error(
         DiagMessage() << "failed to create libpng write png_struct");
     return false;
   }
 
   // Allocate memory to store image header data.
-  png_infop writeInfoPtr = png_create_info_struct(writePtr);
-  if (writeInfoPtr == nullptr) {
-    context->getDiagnostics()->error(
+  png_infop write_info_ptr = png_create_info_struct(write_ptr);
+  if (write_info_ptr == nullptr) {
+    context->GetDiagnostics()->Error(
         DiagMessage() << "failed to create libpng write png_info");
-    png_destroy_write_struct(&writePtr, nullptr);
+    png_destroy_write_struct(&write_ptr, nullptr);
     return false;
   }
 
   // Automatically release PNG resources at end of scope.
-  PngWriteStructDeleter pngWriteDeleter(writePtr, writeInfoPtr);
+  PngWriteStructDeleter png_write_deleter(write_ptr, write_info_ptr);
 
   // libpng uses longjmp to jump to error handling routines.
   // setjmp will return true only if it was jumped to, aka, there was an error.
-  if (setjmp(png_jmpbuf(writePtr))) {
+  if (setjmp(png_jmpbuf(write_ptr))) {
     return false;
   }
 
   // Handle warnings with our IDiagnostics.
-  png_set_error_fn(writePtr, (png_voidp)context->getDiagnostics(), logError,
-                   logWarning);
+  png_set_error_fn(write_ptr, (png_voidp)context->GetDiagnostics(), LogError,
+                   LogWarning);
 
   // Set up the write functions which write to our custom data sources.
-  png_set_write_fn(writePtr, (png_voidp)out, writeDataToStream, nullptr);
+  png_set_write_fn(write_ptr, (png_voidp)out, WriteDataToStream, nullptr);
 
   // We want small files and can take the performance hit to achieve this goal.
-  png_set_compression_level(writePtr, Z_BEST_COMPRESSION);
+  png_set_compression_level(write_ptr, Z_BEST_COMPRESSION);
 
   // Begin analysis of the image data.
   // Scan the entire image and determine if:
   // 1. Every pixel has R == G == B (grayscale)
   // 2. Every pixel has A == 255 (opaque)
   // 3. There are no more than 256 distinct RGBA colors (palette).
-  std::unordered_map<uint32_t, int> colorPalette;
-  std::unordered_set<uint32_t> alphaPalette;
-  bool needsToZeroRGBChannelsOfTransparentPixels = false;
-  bool grayScale = true;
-  int maxGrayDeviation = 0;
+  std::unordered_map<uint32_t, int> color_palette;
+  std::unordered_set<uint32_t> alpha_palette;
+  bool needs_to_zero_rgb_channels_of_transparent_pixels = false;
+  bool grayscale = true;
+  int max_gray_deviation = 0;
 
   for (int32_t y = 0; y < image->height; y++) {
     const uint8_t* row = image->rows[y];
@@ -551,60 +559,60 @@
         // The color is completely transparent.
         // For purposes of palettes and grayscale optimization,
         // treat all channels as 0x00.
-        needsToZeroRGBChannelsOfTransparentPixels =
-            needsToZeroRGBChannelsOfTransparentPixels ||
+        needs_to_zero_rgb_channels_of_transparent_pixels =
+            needs_to_zero_rgb_channels_of_transparent_pixels ||
             (red != 0 || green != 0 || blue != 0);
         red = green = blue = 0;
       }
 
       // Insert the color into the color palette.
       const uint32_t color = red << 24 | green << 16 | blue << 8 | alpha;
-      colorPalette[color] = -1;
+      color_palette[color] = -1;
 
       // If the pixel has non-opaque alpha, insert it into the
       // alpha palette.
       if (alpha != 0xff) {
-        alphaPalette.insert(color);
+        alpha_palette.insert(color);
       }
 
       // Check if the image is indeed grayscale.
-      if (grayScale) {
+      if (grayscale) {
         if (red != green || red != blue) {
-          grayScale = false;
+          grayscale = false;
         }
       }
 
       // Calculate the gray scale deviation so that it can be compared
       // with the threshold.
-      maxGrayDeviation = std::max(std::abs(red - green), maxGrayDeviation);
-      maxGrayDeviation = std::max(std::abs(green - blue), maxGrayDeviation);
-      maxGrayDeviation = std::max(std::abs(blue - red), maxGrayDeviation);
+      max_gray_deviation = std::max(std::abs(red - green), max_gray_deviation);
+      max_gray_deviation = std::max(std::abs(green - blue), max_gray_deviation);
+      max_gray_deviation = std::max(std::abs(blue - red), max_gray_deviation);
     }
   }
 
-  if (context->verbose()) {
+  if (context->IsVerbose()) {
     DiagMessage msg;
-    msg << " paletteSize=" << colorPalette.size()
-        << " alphaPaletteSize=" << alphaPalette.size()
-        << " maxGrayDeviation=" << maxGrayDeviation
-        << " grayScale=" << (grayScale ? "true" : "false");
-    context->getDiagnostics()->note(msg);
+    msg << " paletteSize=" << color_palette.size()
+        << " alphaPaletteSize=" << alpha_palette.size()
+        << " maxGrayDeviation=" << max_gray_deviation
+        << " grayScale=" << (grayscale ? "true" : "false");
+    context->GetDiagnostics()->Note(msg);
   }
 
-  const bool convertibleToGrayScale =
-      maxGrayDeviation <= options.grayScaleTolerance;
+  const bool convertible_to_grayscale =
+      max_gray_deviation <= options.grayscale_tolerance;
 
-  const int newColorType = pickColorType(
-      image->width, image->height, grayScale, convertibleToGrayScale,
-      ninePatch != nullptr, colorPalette.size(), alphaPalette.size());
+  const int new_color_type = PickColorType(
+      image->width, image->height, grayscale, convertible_to_grayscale,
+      nine_patch != nullptr, color_palette.size(), alpha_palette.size());
 
-  if (context->verbose()) {
+  if (context->IsVerbose()) {
     DiagMessage msg;
     msg << "encoding PNG ";
-    if (ninePatch) {
+    if (nine_patch) {
       msg << "(with 9-patch) as ";
     }
-    switch (newColorType) {
+    switch (new_color_type) {
       case PNG_COLOR_TYPE_GRAY:
         msg << "GRAY";
         break;
@@ -621,137 +629,138 @@
         msg << "PALETTE";
         break;
       default:
-        msg << "unknown type " << newColorType;
+        msg << "unknown type " << new_color_type;
         break;
     }
-    context->getDiagnostics()->note(msg);
+    context->GetDiagnostics()->Note(msg);
   }
 
-  png_set_IHDR(writePtr, writeInfoPtr, image->width, image->height, 8,
-               newColorType, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
+  png_set_IHDR(write_ptr, write_info_ptr, image->width, image->height, 8,
+               new_color_type, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
                PNG_FILTER_TYPE_DEFAULT);
 
-  if (newColorType & PNG_COLOR_MASK_PALETTE) {
+  if (new_color_type & PNG_COLOR_MASK_PALETTE) {
     // Assigns indices to the palette, and writes the encoded palette to the
     // libpng writePtr.
-    writePalette(writePtr, writeInfoPtr, &colorPalette, &alphaPalette);
-    png_set_filter(writePtr, 0, PNG_NO_FILTERS);
+    WritePalette(write_ptr, write_info_ptr, &color_palette, &alpha_palette);
+    png_set_filter(write_ptr, 0, PNG_NO_FILTERS);
   } else {
-    png_set_filter(writePtr, 0, PNG_ALL_FILTERS);
+    png_set_filter(write_ptr, 0, PNG_ALL_FILTERS);
   }
 
-  if (ninePatch) {
-    writeNinePatch(writePtr, writeInfoPtr, ninePatch);
+  if (nine_patch) {
+    WriteNinePatch(write_ptr, write_info_ptr, nine_patch);
   }
 
   // Flush our updates to the header.
-  png_write_info(writePtr, writeInfoPtr);
+  png_write_info(write_ptr, write_info_ptr);
 
   // Write out each row of image data according to its encoding.
-  if (newColorType == PNG_COLOR_TYPE_PALETTE) {
+  if (new_color_type == PNG_COLOR_TYPE_PALETTE) {
     // 1 byte/pixel.
-    auto outRow = std::unique_ptr<png_byte[]>(new png_byte[image->width]);
+    auto out_row = std::unique_ptr<png_byte[]>(new png_byte[image->width]);
 
     for (int32_t y = 0; y < image->height; y++) {
-      png_const_bytep inRow = image->rows[y];
+      png_const_bytep in_row = image->rows[y];
       for (int32_t x = 0; x < image->width; x++) {
-        int rr = *inRow++;
-        int gg = *inRow++;
-        int bb = *inRow++;
-        int aa = *inRow++;
+        int rr = *in_row++;
+        int gg = *in_row++;
+        int bb = *in_row++;
+        int aa = *in_row++;
         if (aa == 0) {
           // Zero out color channels when transparent.
           rr = gg = bb = 0;
         }
 
         const uint32_t color = rr << 24 | gg << 16 | bb << 8 | aa;
-        const int idx = colorPalette[color];
-        assert(idx != -1);
-        outRow[x] = static_cast<png_byte>(idx);
+        const int idx = color_palette[color];
+        CHECK(idx != -1);
+        out_row[x] = static_cast<png_byte>(idx);
       }
-      png_write_row(writePtr, outRow.get());
+      png_write_row(write_ptr, out_row.get());
     }
-  } else if (newColorType == PNG_COLOR_TYPE_GRAY ||
-             newColorType == PNG_COLOR_TYPE_GRAY_ALPHA) {
-    const size_t bpp = newColorType == PNG_COLOR_TYPE_GRAY ? 1 : 2;
-    auto outRow = std::unique_ptr<png_byte[]>(new png_byte[image->width * bpp]);
+  } else if (new_color_type == PNG_COLOR_TYPE_GRAY ||
+             new_color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
+    const size_t bpp = new_color_type == PNG_COLOR_TYPE_GRAY ? 1 : 2;
+    auto out_row =
+        std::unique_ptr<png_byte[]>(new png_byte[image->width * bpp]);
 
     for (int32_t y = 0; y < image->height; y++) {
-      png_const_bytep inRow = image->rows[y];
+      png_const_bytep in_row = image->rows[y];
       for (int32_t x = 0; x < image->width; x++) {
-        int rr = inRow[x * 4];
-        int gg = inRow[x * 4 + 1];
-        int bb = inRow[x * 4 + 2];
-        int aa = inRow[x * 4 + 3];
+        int rr = in_row[x * 4];
+        int gg = in_row[x * 4 + 1];
+        int bb = in_row[x * 4 + 2];
+        int aa = in_row[x * 4 + 3];
         if (aa == 0) {
           // Zero out the gray channel when transparent.
           rr = gg = bb = 0;
         }
 
-        if (grayScale) {
+        if (grayscale) {
           // The image was already grayscale, red == green == blue.
-          outRow[x * bpp] = inRow[x * 4];
+          out_row[x * bpp] = in_row[x * 4];
         } else {
           // The image is convertible to grayscale, use linear-luminance of
           // sRGB colorspace:
           // https://en.wikipedia.org/wiki/Grayscale#Colorimetric_.28luminance-preserving.29_conversion_to_grayscale
-          outRow[x * bpp] =
+          out_row[x * bpp] =
               (png_byte)(rr * 0.2126f + gg * 0.7152f + bb * 0.0722f);
         }
 
         if (bpp == 2) {
           // Write out alpha if we have it.
-          outRow[x * bpp + 1] = aa;
+          out_row[x * bpp + 1] = aa;
         }
       }
-      png_write_row(writePtr, outRow.get());
+      png_write_row(write_ptr, out_row.get());
     }
-  } else if (newColorType == PNG_COLOR_TYPE_RGB ||
-             newColorType == PNG_COLOR_TYPE_RGBA) {
-    const size_t bpp = newColorType == PNG_COLOR_TYPE_RGB ? 3 : 4;
-    if (needsToZeroRGBChannelsOfTransparentPixels) {
+  } else if (new_color_type == PNG_COLOR_TYPE_RGB ||
+             new_color_type == PNG_COLOR_TYPE_RGBA) {
+    const size_t bpp = new_color_type == PNG_COLOR_TYPE_RGB ? 3 : 4;
+    if (needs_to_zero_rgb_channels_of_transparent_pixels) {
       // The source RGBA data can't be used as-is, because we need to zero out
       // the RGB
       // values of transparent pixels.
-      auto outRow =
+      auto out_row =
           std::unique_ptr<png_byte[]>(new png_byte[image->width * bpp]);
 
       for (int32_t y = 0; y < image->height; y++) {
-        png_const_bytep inRow = image->rows[y];
+        png_const_bytep in_row = image->rows[y];
         for (int32_t x = 0; x < image->width; x++) {
-          int rr = *inRow++;
-          int gg = *inRow++;
-          int bb = *inRow++;
-          int aa = *inRow++;
+          int rr = *in_row++;
+          int gg = *in_row++;
+          int bb = *in_row++;
+          int aa = *in_row++;
           if (aa == 0) {
             // Zero out the RGB channels when transparent.
             rr = gg = bb = 0;
           }
-          outRow[x * bpp] = rr;
-          outRow[x * bpp + 1] = gg;
-          outRow[x * bpp + 2] = bb;
+          out_row[x * bpp] = rr;
+          out_row[x * bpp + 1] = gg;
+          out_row[x * bpp + 2] = bb;
           if (bpp == 4) {
-            outRow[x * bpp + 3] = aa;
+            out_row[x * bpp + 3] = aa;
           }
         }
-        png_write_row(writePtr, outRow.get());
+        png_write_row(write_ptr, out_row.get());
       }
     } else {
       // The source image can be used as-is, just tell libpng whether or not to
       // ignore
       // the alpha channel.
-      if (newColorType == PNG_COLOR_TYPE_RGB) {
+      if (new_color_type == PNG_COLOR_TYPE_RGB) {
         // Delete the extraneous alpha values that we appended to our buffer
         // when reading the original values.
-        png_set_filler(writePtr, 0, PNG_FILLER_AFTER);
+        png_set_filler(write_ptr, 0, PNG_FILLER_AFTER);
       }
-      png_write_image(writePtr, image->rows.get());
+      png_write_image(write_ptr, image->rows.get());
     }
   } else {
-    assert(false && "unreachable");
+    LOG(FATAL) << "unreachable";
   }
 
-  png_write_end(writePtr, writeInfoPtr);
+  png_write_end(write_ptr, write_info_ptr);
   return true;
 }
 
diff --git a/tools/aapt2/compile/PseudolocaleGenerator.cpp b/tools/aapt2/compile/PseudolocaleGenerator.cpp
index d8ed0bb..055a725 100644
--- a/tools/aapt2/compile/PseudolocaleGenerator.cpp
+++ b/tools/aapt2/compile/PseudolocaleGenerator.cpp
@@ -15,27 +15,29 @@
  */
 
 #include "compile/PseudolocaleGenerator.h"
+
+#include <algorithm>
+
 #include "ResourceTable.h"
 #include "ResourceValues.h"
 #include "ValueVisitor.h"
 #include "compile/Pseudolocalizer.h"
 
-#include <algorithm>
-
 namespace aapt {
 
-std::unique_ptr<StyledString> pseudolocalizeStyledString(
+std::unique_ptr<StyledString> PseudolocalizeStyledString(
     StyledString* string, Pseudolocalizer::Method method, StringPool* pool) {
   Pseudolocalizer localizer(method);
 
-  const StringPiece originalText = *string->value->str;
+  const StringPiece original_text = *string->value->str;
 
   StyleString localized;
 
   // Copy the spans. We will update their offsets when we localize.
   localized.spans.reserve(string->value->spans.size());
   for (const StringPool::Span& span : string->value->spans) {
-    localized.spans.push_back(Span{*span.name, span.firstChar, span.lastChar});
+    localized.spans.push_back(
+        Span{*span.name, span.first_char, span.last_char});
   }
 
   // The ranges are all represented with a single value. This is the start of
@@ -49,8 +51,8 @@
     // Since this struct represents the start of one range and end of another,
     // we have
     // the two pointers respectively.
-    uint32_t* updateStart;
-    uint32_t* updateEnd;
+    uint32_t* update_start;
+    uint32_t* update_end;
   };
 
   auto cmp = [](const Range& r, size_t index) -> bool {
@@ -64,109 +66,113 @@
   //
   std::vector<Range> ranges;
   ranges.push_back(Range{0});
-  ranges.push_back(Range{originalText.size() - 1});
+  ranges.push_back(Range{original_text.size() - 1});
   for (size_t i = 0; i < string->value->spans.size(); i++) {
     const StringPool::Span& span = string->value->spans[i];
 
     // Insert or update the Range marker for the start of this span.
     auto iter =
-        std::lower_bound(ranges.begin(), ranges.end(), span.firstChar, cmp);
-    if (iter != ranges.end() && iter->start == span.firstChar) {
-      iter->updateStart = &localized.spans[i].firstChar;
+        std::lower_bound(ranges.begin(), ranges.end(), span.first_char, cmp);
+    if (iter != ranges.end() && iter->start == span.first_char) {
+      iter->update_start = &localized.spans[i].first_char;
     } else {
-      ranges.insert(
-          iter, Range{span.firstChar, &localized.spans[i].firstChar, nullptr});
+      ranges.insert(iter, Range{span.first_char, &localized.spans[i].first_char,
+                                nullptr});
     }
 
     // Insert or update the Range marker for the end of this span.
-    iter = std::lower_bound(ranges.begin(), ranges.end(), span.lastChar, cmp);
-    if (iter != ranges.end() && iter->start == span.lastChar) {
-      iter->updateEnd = &localized.spans[i].lastChar;
+    iter = std::lower_bound(ranges.begin(), ranges.end(), span.last_char, cmp);
+    if (iter != ranges.end() && iter->start == span.last_char) {
+      iter->update_end = &localized.spans[i].last_char;
     } else {
       ranges.insert(
-          iter, Range{span.lastChar, nullptr, &localized.spans[i].lastChar});
+          iter, Range{span.last_char, nullptr, &localized.spans[i].last_char});
     }
   }
 
-  localized.str += localizer.start();
+  localized.str += localizer.Start();
 
   // Iterate over the ranges and localize each section.
   for (size_t i = 0; i < ranges.size(); i++) {
     const size_t start = ranges[i].start;
-    size_t len = originalText.size() - start;
+    size_t len = original_text.size() - start;
     if (i + 1 < ranges.size()) {
       len = ranges[i + 1].start - start;
     }
 
-    if (ranges[i].updateStart) {
-      *ranges[i].updateStart = localized.str.size();
+    if (ranges[i].update_start) {
+      *ranges[i].update_start = localized.str.size();
     }
 
-    if (ranges[i].updateEnd) {
-      *ranges[i].updateEnd = localized.str.size();
+    if (ranges[i].update_end) {
+      *ranges[i].update_end = localized.str.size();
     }
 
-    localized.str += localizer.text(originalText.substr(start, len));
+    localized.str += localizer.Text(original_text.substr(start, len));
   }
 
-  localized.str += localizer.end();
+  localized.str += localizer.End();
 
-  std::unique_ptr<StyledString> localizedString =
-      util::make_unique<StyledString>(pool->makeRef(localized));
-  localizedString->setSource(string->getSource());
-  return localizedString;
+  std::unique_ptr<StyledString> localized_string =
+      util::make_unique<StyledString>(pool->MakeRef(localized));
+  localized_string->SetSource(string->GetSource());
+  return localized_string;
 }
 
 namespace {
 
-struct Visitor : public RawValueVisitor {
-  StringPool* mPool;
-  Pseudolocalizer::Method mMethod;
-  Pseudolocalizer mLocalizer;
-
+class Visitor : public RawValueVisitor {
+ public:
   // Either value or item will be populated upon visiting the value.
-  std::unique_ptr<Value> mValue;
-  std::unique_ptr<Item> mItem;
+  std::unique_ptr<Value> value;
+  std::unique_ptr<Item> item;
 
   Visitor(StringPool* pool, Pseudolocalizer::Method method)
-      : mPool(pool), mMethod(method), mLocalizer(method) {}
+      : pool_(pool), method_(method), localizer_(method) {}
 
-  void visit(Plural* plural) override {
+  void Visit(Plural* plural) override {
     std::unique_ptr<Plural> localized = util::make_unique<Plural>();
     for (size_t i = 0; i < plural->values.size(); i++) {
-      Visitor subVisitor(mPool, mMethod);
+      Visitor sub_visitor(pool_, method_);
       if (plural->values[i]) {
-        plural->values[i]->accept(&subVisitor);
-        if (subVisitor.mValue) {
-          localized->values[i] = std::move(subVisitor.mItem);
+        plural->values[i]->Accept(&sub_visitor);
+        if (sub_visitor.value) {
+          localized->values[i] = std::move(sub_visitor.item);
         } else {
           localized->values[i] =
-              std::unique_ptr<Item>(plural->values[i]->clone(mPool));
+              std::unique_ptr<Item>(plural->values[i]->Clone(pool_));
         }
       }
     }
-    localized->setSource(plural->getSource());
-    localized->setWeak(true);
-    mValue = std::move(localized);
+    localized->SetSource(plural->GetSource());
+    localized->SetWeak(true);
+    value = std::move(localized);
   }
 
-  void visit(String* string) override {
+  void Visit(String* string) override {
     std::string result =
-        mLocalizer.start() + mLocalizer.text(*string->value) + mLocalizer.end();
+        localizer_.Start() + localizer_.Text(*string->value) + localizer_.End();
     std::unique_ptr<String> localized =
-        util::make_unique<String>(mPool->makeRef(result));
-    localized->setSource(string->getSource());
-    localized->setWeak(true);
-    mItem = std::move(localized);
+        util::make_unique<String>(pool_->MakeRef(result));
+    localized->SetSource(string->GetSource());
+    localized->SetWeak(true);
+    item = std::move(localized);
   }
 
-  void visit(StyledString* string) override {
-    mItem = pseudolocalizeStyledString(string, mMethod, mPool);
-    mItem->setWeak(true);
+  void Visit(StyledString* string) override {
+    item = PseudolocalizeStyledString(string, method_, pool_);
+    item->SetWeak(true);
   }
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(Visitor);
+
+  StringPool* pool_;
+  Pseudolocalizer::Method method_;
+  Pseudolocalizer localizer_;
 };
 
-ConfigDescription modifyConfigForPseudoLocale(const ConfigDescription& base,
+ConfigDescription ModifyConfigForPseudoLocale(const ConfigDescription& base,
                                               Pseudolocalizer::Method m) {
   ConfigDescription modified = base;
   switch (m) {
@@ -189,31 +195,31 @@
   return modified;
 }
 
-void pseudolocalizeIfNeeded(const Pseudolocalizer::Method method,
-                            ResourceConfigValue* originalValue,
+void PseudolocalizeIfNeeded(const Pseudolocalizer::Method method,
+                            ResourceConfigValue* original_value,
                             StringPool* pool, ResourceEntry* entry) {
   Visitor visitor(pool, method);
-  originalValue->value->accept(&visitor);
+  original_value->value->Accept(&visitor);
 
-  std::unique_ptr<Value> localizedValue;
-  if (visitor.mValue) {
-    localizedValue = std::move(visitor.mValue);
-  } else if (visitor.mItem) {
-    localizedValue = std::move(visitor.mItem);
+  std::unique_ptr<Value> localized_value;
+  if (visitor.value) {
+    localized_value = std::move(visitor.value);
+  } else if (visitor.item) {
+    localized_value = std::move(visitor.item);
   }
 
-  if (!localizedValue) {
+  if (!localized_value) {
     return;
   }
 
-  ConfigDescription configWithAccent =
-      modifyConfigForPseudoLocale(originalValue->config, method);
+  ConfigDescription config_with_accent =
+      ModifyConfigForPseudoLocale(original_value->config, method);
 
-  ResourceConfigValue* newConfigValue =
-      entry->findOrCreateValue(configWithAccent, originalValue->product);
-  if (!newConfigValue->value) {
+  ResourceConfigValue* new_config_value =
+      entry->FindOrCreateValue(config_with_accent, original_value->product);
+  if (!new_config_value->value) {
     // Only use auto-generated pseudo-localization if none is defined.
-    newConfigValue->value = std::move(localizedValue);
+    new_config_value->value = std::move(localized_value);
   }
 }
 
@@ -222,29 +228,30 @@
  * default locale)
  * and is translateable.
  */
-static bool isPseudolocalizable(ResourceConfigValue* configValue) {
-  const int diff = configValue->config.diff(ConfigDescription::defaultConfig());
+static bool IsPseudolocalizable(ResourceConfigValue* config_value) {
+  const int diff =
+      config_value->config.diff(ConfigDescription::DefaultConfig());
   if (diff & ConfigDescription::CONFIG_LOCALE) {
     return false;
   }
-  return configValue->value->isTranslateable();
+  return config_value->value->IsTranslateable();
 }
 
 }  // namespace
 
-bool PseudolocaleGenerator::consume(IAaptContext* context,
+bool PseudolocaleGenerator::Consume(IAaptContext* context,
                                     ResourceTable* table) {
   for (auto& package : table->packages) {
     for (auto& type : package->types) {
       for (auto& entry : type->entries) {
         std::vector<ResourceConfigValue*> values =
-            entry->findValuesIf(isPseudolocalizable);
+            entry->FindValuesIf(IsPseudolocalizable);
 
         for (ResourceConfigValue* value : values) {
-          pseudolocalizeIfNeeded(Pseudolocalizer::Method::kAccent, value,
-                                 &table->stringPool, entry.get());
-          pseudolocalizeIfNeeded(Pseudolocalizer::Method::kBidi, value,
-                                 &table->stringPool, entry.get());
+          PseudolocalizeIfNeeded(Pseudolocalizer::Method::kAccent, value,
+                                 &table->string_pool, entry.get());
+          PseudolocalizeIfNeeded(Pseudolocalizer::Method::kBidi, value,
+                                 &table->string_pool, entry.get());
         }
       }
     }
diff --git a/tools/aapt2/compile/PseudolocaleGenerator.h b/tools/aapt2/compile/PseudolocaleGenerator.h
index 4e97cb9..ace3786 100644
--- a/tools/aapt2/compile/PseudolocaleGenerator.h
+++ b/tools/aapt2/compile/PseudolocaleGenerator.h
@@ -23,11 +23,11 @@
 
 namespace aapt {
 
-std::unique_ptr<StyledString> pseudolocalizeStyledString(
+std::unique_ptr<StyledString> PseudolocalizeStyledString(
     StyledString* string, Pseudolocalizer::Method method, StringPool* pool);
 
 struct PseudolocaleGenerator : public IResourceTableConsumer {
-  bool consume(IAaptContext* context, ResourceTable* table) override;
+  bool Consume(IAaptContext* context, ResourceTable* table) override;
 };
 
 }  // namespace aapt
diff --git a/tools/aapt2/compile/PseudolocaleGenerator_test.cpp b/tools/aapt2/compile/PseudolocaleGenerator_test.cpp
index 64a3e97..5a9884d 100644
--- a/tools/aapt2/compile/PseudolocaleGenerator_test.cpp
+++ b/tools/aapt2/compile/PseudolocaleGenerator_test.cpp
@@ -15,118 +15,119 @@
  */
 
 #include "compile/PseudolocaleGenerator.h"
+
 #include "test/Test.h"
 #include "util/Util.h"
 
-#include <androidfw/ResourceTypes.h>
-
 namespace aapt {
 
 TEST(PseudolocaleGeneratorTest, PseudolocalizeStyledString) {
   StringPool pool;
-  StyleString originalStyle;
-  originalStyle.str = "Hello world!";
-  originalStyle.spans = {Span{"b", 2, 3}, Span{"b", 6, 7}, Span{"i", 1, 10}};
+  StyleString original_style;
+  original_style.str = "Hello world!";
+  original_style.spans = {Span{"b", 2, 3}, Span{"b", 6, 7}, Span{"i", 1, 10}};
 
-  std::unique_ptr<StyledString> newString = pseudolocalizeStyledString(
-      util::make_unique<StyledString>(pool.makeRef(originalStyle)).get(),
+  std::unique_ptr<StyledString> new_string = PseudolocalizeStyledString(
+      util::make_unique<StyledString>(pool.MakeRef(original_style)).get(),
       Pseudolocalizer::Method::kNone, &pool);
 
-  EXPECT_EQ(originalStyle.str, *newString->value->str);
-  ASSERT_EQ(originalStyle.spans.size(), newString->value->spans.size());
+  EXPECT_EQ(original_style.str, *new_string->value->str);
+  ASSERT_EQ(original_style.spans.size(), new_string->value->spans.size());
 
-  EXPECT_EQ(std::string("He").size(), newString->value->spans[0].firstChar);
-  EXPECT_EQ(std::string("Hel").size(), newString->value->spans[0].lastChar);
-  EXPECT_EQ(std::string("b"), *newString->value->spans[0].name);
+  EXPECT_EQ(std::string("He").size(), new_string->value->spans[0].first_char);
+  EXPECT_EQ(std::string("Hel").size(), new_string->value->spans[0].last_char);
+  EXPECT_EQ(std::string("b"), *new_string->value->spans[0].name);
 
-  EXPECT_EQ(std::string("Hello ").size(), newString->value->spans[1].firstChar);
-  EXPECT_EQ(std::string("Hello w").size(), newString->value->spans[1].lastChar);
-  EXPECT_EQ(std::string("b"), *newString->value->spans[1].name);
+  EXPECT_EQ(std::string("Hello ").size(),
+            new_string->value->spans[1].first_char);
+  EXPECT_EQ(std::string("Hello w").size(),
+            new_string->value->spans[1].last_char);
+  EXPECT_EQ(std::string("b"), *new_string->value->spans[1].name);
 
-  EXPECT_EQ(std::string("H").size(), newString->value->spans[2].firstChar);
+  EXPECT_EQ(std::string("H").size(), new_string->value->spans[2].first_char);
   EXPECT_EQ(std::string("Hello worl").size(),
-            newString->value->spans[2].lastChar);
-  EXPECT_EQ(std::string("i"), *newString->value->spans[2].name);
+            new_string->value->spans[2].last_char);
+  EXPECT_EQ(std::string("i"), *new_string->value->spans[2].name);
 
-  originalStyle.spans.push_back(Span{"em", 0, 11u});
+  original_style.spans.push_back(Span{"em", 0, 11u});
 
-  newString = pseudolocalizeStyledString(
-      util::make_unique<StyledString>(pool.makeRef(originalStyle)).get(),
+  new_string = PseudolocalizeStyledString(
+      util::make_unique<StyledString>(pool.MakeRef(original_style)).get(),
       Pseudolocalizer::Method::kAccent, &pool);
 
-  EXPECT_EQ(std::string("[Ĥéļļö ŵöŕļð¡ one two]"), *newString->value->str);
-  ASSERT_EQ(originalStyle.spans.size(), newString->value->spans.size());
+  EXPECT_EQ(std::string("[Ĥéļļö ŵöŕļð¡ one two]"), *new_string->value->str);
+  ASSERT_EQ(original_style.spans.size(), new_string->value->spans.size());
 
-  EXPECT_EQ(std::string("[Ĥé").size(), newString->value->spans[0].firstChar);
-  EXPECT_EQ(std::string("[Ĥéļ").size(), newString->value->spans[0].lastChar);
+  EXPECT_EQ(std::string("[Ĥé").size(), new_string->value->spans[0].first_char);
+  EXPECT_EQ(std::string("[Ĥéļ").size(), new_string->value->spans[0].last_char);
 
   EXPECT_EQ(std::string("[Ĥéļļö ").size(),
-            newString->value->spans[1].firstChar);
+            new_string->value->spans[1].first_char);
   EXPECT_EQ(std::string("[Ĥéļļö ŵ").size(),
-            newString->value->spans[1].lastChar);
+            new_string->value->spans[1].last_char);
 
-  EXPECT_EQ(std::string("[Ĥ").size(), newString->value->spans[2].firstChar);
+  EXPECT_EQ(std::string("[Ĥ").size(), new_string->value->spans[2].first_char);
   EXPECT_EQ(std::string("[Ĥéļļö ŵöŕļ").size(),
-            newString->value->spans[2].lastChar);
+            new_string->value->spans[2].last_char);
 
-  EXPECT_EQ(std::string("[").size(), newString->value->spans[3].firstChar);
+  EXPECT_EQ(std::string("[").size(), new_string->value->spans[3].first_char);
   EXPECT_EQ(std::string("[Ĥéļļö ŵöŕļð").size(),
-            newString->value->spans[3].lastChar);
+            new_string->value->spans[3].last_char);
 }
 
 TEST(PseudolocaleGeneratorTest, PseudolocalizeOnlyDefaultConfigs) {
   std::unique_ptr<ResourceTable> table =
       test::ResourceTableBuilder()
-          .addString("android:string/one", "one")
-          .addString("android:string/two", ResourceId{},
-                     test::parseConfigOrDie("en"), "two")
-          .addString("android:string/three", "three")
-          .addString("android:string/three", ResourceId{},
-                     test::parseConfigOrDie("en-rXA"), "three")
-          .addString("android:string/four", "four")
-          .build();
+          .AddString("android:string/one", "one")
+          .AddString("android:string/two", ResourceId{},
+                     test::ParseConfigOrDie("en"), "two")
+          .AddString("android:string/three", "three")
+          .AddString("android:string/three", ResourceId{},
+                     test::ParseConfigOrDie("en-rXA"), "three")
+          .AddString("android:string/four", "four")
+          .Build();
 
-  String* val = test::getValue<String>(table.get(), "android:string/four");
+  String* val = test::GetValue<String>(table.get(), "android:string/four");
   ASSERT_NE(nullptr, val);
-  val->setTranslateable(false);
+  val->SetTranslateable(false);
 
-  std::unique_ptr<IAaptContext> context = test::ContextBuilder().build();
+  std::unique_ptr<IAaptContext> context = test::ContextBuilder().Build();
   PseudolocaleGenerator generator;
-  ASSERT_TRUE(generator.consume(context.get(), table.get()));
+  ASSERT_TRUE(generator.Consume(context.get(), table.get()));
 
   // Normal pseudolocalization should take place.
   ASSERT_NE(nullptr,
-            test::getValueForConfig<String>(table.get(), "android:string/one",
-                                            test::parseConfigOrDie("en-rXA")));
+            test::GetValueForConfig<String>(table.get(), "android:string/one",
+                                            test::ParseConfigOrDie("en-rXA")));
   ASSERT_NE(nullptr,
-            test::getValueForConfig<String>(table.get(), "android:string/one",
-                                            test::parseConfigOrDie("ar-rXB")));
+            test::GetValueForConfig<String>(table.get(), "android:string/one",
+                                            test::ParseConfigOrDie("ar-rXB")));
 
   // No default config for android:string/two, so no pseudlocales should exist.
   ASSERT_EQ(nullptr,
-            test::getValueForConfig<String>(table.get(), "android:string/two",
-                                            test::parseConfigOrDie("en-rXA")));
+            test::GetValueForConfig<String>(table.get(), "android:string/two",
+                                            test::ParseConfigOrDie("en-rXA")));
   ASSERT_EQ(nullptr,
-            test::getValueForConfig<String>(table.get(), "android:string/two",
-                                            test::parseConfigOrDie("ar-rXB")));
+            test::GetValueForConfig<String>(table.get(), "android:string/two",
+                                            test::ParseConfigOrDie("ar-rXB")));
 
   // Check that we didn't override manual pseudolocalization.
-  val = test::getValueForConfig<String>(table.get(), "android:string/three",
-                                        test::parseConfigOrDie("en-rXA"));
+  val = test::GetValueForConfig<String>(table.get(), "android:string/three",
+                                        test::ParseConfigOrDie("en-rXA"));
   ASSERT_NE(nullptr, val);
   EXPECT_EQ(std::string("three"), *val->value);
 
   ASSERT_NE(nullptr,
-            test::getValueForConfig<String>(table.get(), "android:string/three",
-                                            test::parseConfigOrDie("ar-rXB")));
+            test::GetValueForConfig<String>(table.get(), "android:string/three",
+                                            test::ParseConfigOrDie("ar-rXB")));
 
   // Check that four's translateable marker was honored.
   ASSERT_EQ(nullptr,
-            test::getValueForConfig<String>(table.get(), "android:string/four",
-                                            test::parseConfigOrDie("en-rXA")));
+            test::GetValueForConfig<String>(table.get(), "android:string/four",
+                                            test::ParseConfigOrDie("en-rXA")));
   ASSERT_EQ(nullptr,
-            test::getValueForConfig<String>(table.get(), "android:string/four",
-                                            test::parseConfigOrDie("ar-rXB")));
+            test::GetValueForConfig<String>(table.get(), "android:string/four",
+                                            test::ParseConfigOrDie("ar-rXB")));
 }
 
 }  // namespace aapt
diff --git a/tools/aapt2/compile/Pseudolocalizer.cpp b/tools/aapt2/compile/Pseudolocalizer.cpp
index c3aec98..f89288f 100644
--- a/tools/aapt2/compile/Pseudolocalizer.cpp
+++ b/tools/aapt2/compile/Pseudolocalizer.cpp
@@ -15,77 +15,78 @@
  */
 
 #include "compile/Pseudolocalizer.h"
+
 #include "util/Util.h"
 
 namespace aapt {
 
 // String basis to generate expansion
-static const std::string k_expansion_string =
+static const std::string kExpansionString =
     "one two three "
     "four five six seven eight nine ten eleven twelve thirteen "
     "fourteen fiveteen sixteen seventeen nineteen twenty";
 
 // Special unicode characters to override directionality of the words
-static const std::string k_rlm = "\u200f";
-static const std::string k_rlo = "\u202e";
-static const std::string k_pdf = "\u202c";
+static const std::string kRlm = "\u200f";
+static const std::string kRlo = "\u202e";
+static const std::string kPdf = "\u202c";
 
 // Placeholder marks
-static const std::string k_placeholder_open = "\u00bb";
-static const std::string k_placeholder_close = "\u00ab";
+static const std::string kPlaceholderOpen = "\u00bb";
+static const std::string kPlaceholderClose = "\u00ab";
 
-static const char k_arg_start = '{';
-static const char k_arg_end = '}';
+static const char kArgStart = '{';
+static const char kArgEnd = '}';
 
 class PseudoMethodNone : public PseudoMethodImpl {
  public:
-  std::string text(const StringPiece& text) override { return text.toString(); }
-  std::string placeholder(const StringPiece& text) override {
-    return text.toString();
+  std::string Text(const StringPiece& text) override { return text.ToString(); }
+  std::string Placeholder(const StringPiece& text) override {
+    return text.ToString();
   }
 };
 
 class PseudoMethodBidi : public PseudoMethodImpl {
  public:
-  std::string text(const StringPiece& text) override;
-  std::string placeholder(const StringPiece& text) override;
+  std::string Text(const StringPiece& text) override;
+  std::string Placeholder(const StringPiece& text) override;
 };
 
 class PseudoMethodAccent : public PseudoMethodImpl {
  public:
-  PseudoMethodAccent() : mDepth(0), mWordCount(0), mLength(0) {}
-  std::string start() override;
-  std::string end() override;
-  std::string text(const StringPiece& text) override;
-  std::string placeholder(const StringPiece& text) override;
+  PseudoMethodAccent() : depth_(0), word_count_(0), length_(0) {}
+  std::string Start() override;
+  std::string End() override;
+  std::string Text(const StringPiece& text) override;
+  std::string Placeholder(const StringPiece& text) override;
 
  private:
-  size_t mDepth;
-  size_t mWordCount;
-  size_t mLength;
+  size_t depth_;
+  size_t word_count_;
+  size_t length_;
 };
 
-Pseudolocalizer::Pseudolocalizer(Method method) : mLastDepth(0) {
-  setMethod(method);
+Pseudolocalizer::Pseudolocalizer(Method method) : last_depth_(0) {
+  SetMethod(method);
 }
 
-void Pseudolocalizer::setMethod(Method method) {
+void Pseudolocalizer::SetMethod(Method method) {
   switch (method) {
     case Method::kNone:
-      mImpl = util::make_unique<PseudoMethodNone>();
+      impl_ = util::make_unique<PseudoMethodNone>();
       break;
     case Method::kAccent:
-      mImpl = util::make_unique<PseudoMethodAccent>();
+      impl_ = util::make_unique<PseudoMethodAccent>();
       break;
     case Method::kBidi:
-      mImpl = util::make_unique<PseudoMethodBidi>();
+      impl_ = util::make_unique<PseudoMethodBidi>();
       break;
   }
 }
 
-std::string Pseudolocalizer::text(const StringPiece& text) {
+std::string Pseudolocalizer::Text(const StringPiece& text) {
   std::string out;
-  size_t depth = mLastDepth;
+  size_t depth = last_depth_;
   size_t lastpos, pos;
   const size_t length = text.size();
   const char* str = text.data();
@@ -101,42 +102,41 @@
       continue;
     }
 
-    if (c == k_arg_start) {
+    if (c == kArgStart) {
       depth++;
-    } else if (c == k_arg_end && depth) {
+    } else if (c == kArgEnd && depth) {
       depth--;
     }
 
-    if (mLastDepth != depth || pos == length - 1) {
-      bool pseudo = ((mLastDepth % 2) == 0);
+    if (last_depth_ != depth || pos == length - 1) {
+      bool pseudo = ((last_depth_ % 2) == 0);
       size_t nextpos = pos;
-      if (!pseudo || depth == mLastDepth) {
+      if (!pseudo || depth == last_depth_) {
         nextpos++;
       }
       size_t size = nextpos - lastpos;
       if (size) {
-        std::string chunk = text.substr(lastpos, size).toString();
+        std::string chunk = text.substr(lastpos, size).ToString();
         if (pseudo) {
-          chunk = mImpl->text(chunk);
-        } else if (str[lastpos] == k_arg_start &&
-                   str[nextpos - 1] == k_arg_end) {
-          chunk = mImpl->placeholder(chunk);
+          chunk = impl_->Text(chunk);
+        } else if (str[lastpos] == kArgStart && str[nextpos - 1] == kArgEnd) {
+          chunk = impl_->Placeholder(chunk);
         }
         out.append(chunk);
       }
-      if (pseudo && depth < mLastDepth) {  // End of message
-        out.append(mImpl->end());
-      } else if (!pseudo && depth > mLastDepth) {  // Start of message
-        out.append(mImpl->start());
+      if (pseudo && depth < last_depth_) {  // End of message
+        out.append(impl_->End());
+      } else if (!pseudo && depth > last_depth_) {  // Start of message
+        out.append(impl_->Start());
       }
       lastpos = nextpos;
-      mLastDepth = depth;
+      last_depth_ = depth;
     }
   }
   return out;
 }
 
-static const char* pseudolocalizeChar(const char c) {
+static const char* PseudolocalizeChar(const char c) {
   switch (c) {
     case 'a':
       return "\u00e5";
@@ -251,7 +251,7 @@
   }
 }
 
-static bool isPossibleNormalPlaceholderEnd(const char c) {
+static bool IsPossibleNormalPlaceholderEnd(const char c) {
   switch (c) {
     case 's':
       return true;
@@ -300,12 +300,12 @@
   }
 }
 
-static std::string pseudoGenerateExpansion(const unsigned int length) {
-  std::string result = k_expansion_string;
+static std::string PseudoGenerateExpansion(const unsigned int length) {
+  std::string result = kExpansionString;
   const char* s = result.data();
   if (result.size() < length) {
     result += " ";
-    result += pseudoGenerateExpansion(length - result.size());
+    result += PseudoGenerateExpansion(length - result.size());
   } else {
     int ext = 0;
     // Should contain only whole words, so looking for a space
@@ -320,25 +320,25 @@
   return result;
 }
 
-std::string PseudoMethodAccent::start() {
+std::string PseudoMethodAccent::Start() {
   std::string result;
-  if (mDepth == 0) {
+  if (depth_ == 0) {
     result = "[";
   }
-  mWordCount = mLength = 0;
-  mDepth++;
+  word_count_ = length_ = 0;
+  depth_++;
   return result;
 }
 
-std::string PseudoMethodAccent::end() {
+std::string PseudoMethodAccent::End() {
   std::string result;
-  if (mLength) {
+  if (length_) {
     result += " ";
-    result += pseudoGenerateExpansion(mWordCount > 3 ? mLength : mLength / 2);
+    result += PseudoGenerateExpansion(word_count_ > 3 ? length_ : length_ / 2);
   }
-  mWordCount = mLength = 0;
-  mDepth--;
-  if (mDepth == 0) {
+  word_count_ = length_ = 0;
+  depth_--;
+  if (depth_ == 0) {
     result += "]";
   }
   return result;
@@ -349,7 +349,7 @@
  *
  * Note: This leaves placeholder syntax untouched.
  */
-std::string PseudoMethodAccent::text(const StringPiece& source) {
+std::string PseudoMethodAccent::Text(const StringPiece& source) {
   const char* s = source.data();
   std::string result;
   const size_t I = source.size();
@@ -365,7 +365,7 @@
         ++i;
         c = s[i];
         chunk.append(&c, 1);
-        if (isPossibleNormalPlaceholderEnd(c)) {
+        if (IsPossibleNormalPlaceholderEnd(c)) {
           end = true;
         } else if (i + 1 < I && c == 't') {
           ++i;
@@ -375,24 +375,24 @@
         }
       }
       // Treat chunk as a placeholder unless it ends with %.
-      result += ((c == '%') ? chunk : placeholder(chunk));
+      result += ((c == '%') ? chunk : Placeholder(chunk));
     } else if (c == '<' || c == '&') {
       // html syntax, no need to pseudolocalize
       bool tag_closed = false;
       while (!tag_closed && i < I) {
         if (c == '&') {
-          std::string escapeText;
-          escapeText.append(&c, 1);
+          std::string escape_text;
+          escape_text.append(&c, 1);
           bool end = false;
-          size_t htmlCodePos = i;
-          while (!end && htmlCodePos < I) {
-            ++htmlCodePos;
-            c = s[htmlCodePos];
-            escapeText.append(&c, 1);
+          size_t html_code_pos = i;
+          while (!end && html_code_pos < I) {
+            ++html_code_pos;
+            c = s[html_code_pos];
+            escape_text.append(&c, 1);
             // Valid html code
             if (c == ';') {
               end = true;
-              i = htmlCodePos;
+              i = html_code_pos;
             }
             // Wrong html code
             else if (!((c == '#' || (c >= 'a' && c <= 'z') ||
@@ -400,8 +400,8 @@
               end = true;
             }
           }
-          result += escapeText;
-          if (escapeText != "&lt;") {
+          result += escape_text;
+          if (escape_text != "&lt;") {
             tag_closed = true;
           }
           continue;
@@ -417,30 +417,30 @@
       }
     } else {
       // This is a pure text that should be pseudolocalized
-      const char* p = pseudolocalizeChar(c);
+      const char* p = PseudolocalizeChar(c);
       if (p != nullptr) {
         result += p;
       } else {
         bool space = isspace(c);
         if (lastspace && !space) {
-          mWordCount++;
+          word_count_++;
         }
         lastspace = space;
         result.append(&c, 1);
       }
       // Count only pseudolocalizable chars and delimiters
-      mLength++;
+      length_++;
     }
   }
   return result;
 }
 
-std::string PseudoMethodAccent::placeholder(const StringPiece& source) {
+std::string PseudoMethodAccent::Placeholder(const StringPiece& source) {
   // Surround a placeholder with brackets
-  return k_placeholder_open + source.toString() + k_placeholder_close;
+  return kPlaceholderOpen + source.ToString() + kPlaceholderClose;
 }
 
-std::string PseudoMethodBidi::text(const StringPiece& source) {
+std::string PseudoMethodBidi::Text(const StringPiece& source) {
   const char* s = source.data();
   std::string result;
   bool lastspace = true;
@@ -450,24 +450,24 @@
     space = isspace(c);
     if (lastspace && !space) {
       // Word start
-      result += k_rlm + k_rlo;
+      result += kRlm + kRlo;
     } else if (!lastspace && space) {
       // Word end
-      result += k_pdf + k_rlm;
+      result += kPdf + kRlm;
     }
     lastspace = space;
     result.append(&c, 1);
   }
   if (!lastspace) {
     // End of last word
-    result += k_pdf + k_rlm;
+    result += kPdf + kRlm;
   }
   return result;
 }
 
-std::string PseudoMethodBidi::placeholder(const StringPiece& source) {
+std::string PseudoMethodBidi::Placeholder(const StringPiece& source) {
   // Surround a placeholder with directionality change sequence
-  return k_rlm + k_rlo + source.toString() + k_pdf + k_rlm;
+  return kRlm + kRlo + source.ToString() + kPdf + kRlm;
 }
 
 }  // namespace aapt
diff --git a/tools/aapt2/compile/Pseudolocalizer.h b/tools/aapt2/compile/Pseudolocalizer.h
index a526877..a6d2ad0 100644
--- a/tools/aapt2/compile/Pseudolocalizer.h
+++ b/tools/aapt2/compile/Pseudolocalizer.h
@@ -17,22 +17,23 @@
 #ifndef AAPT_COMPILE_PSEUDOLOCALIZE_H
 #define AAPT_COMPILE_PSEUDOLOCALIZE_H
 
+#include <memory>
+
+#include "android-base/macros.h"
+
 #include "ResourceValues.h"
 #include "StringPool.h"
 #include "util/StringPiece.h"
 
-#include <android-base/macros.h>
-#include <memory>
-
 namespace aapt {
 
 class PseudoMethodImpl {
  public:
   virtual ~PseudoMethodImpl() {}
-  virtual std::string start() { return {}; }
-  virtual std::string end() { return {}; }
-  virtual std::string text(const StringPiece& text) = 0;
-  virtual std::string placeholder(const StringPiece& text) = 0;
+  virtual std::string Start() { return {}; }
+  virtual std::string End() { return {}; }
+  virtual std::string Text(const StringPiece& text) = 0;
+  virtual std::string Placeholder(const StringPiece& text) = 0;
 };
 
 class Pseudolocalizer {
@@ -44,14 +45,14 @@
   };
 
   explicit Pseudolocalizer(Method method);
-  void setMethod(Method method);
-  std::string start() { return mImpl->start(); }
-  std::string end() { return mImpl->end(); }
-  std::string text(const StringPiece& text);
+  void SetMethod(Method method);
+  std::string Start() { return impl_->Start(); }
+  std::string End() { return impl_->End(); }
+  std::string Text(const StringPiece& text);
 
  private:
-  std::unique_ptr<PseudoMethodImpl> mImpl;
-  size_t mLastDepth;
+  std::unique_ptr<PseudoMethodImpl> impl_;
+  size_t last_depth_;
 };
 
 }  // namespace aapt
diff --git a/tools/aapt2/compile/Pseudolocalizer_test.cpp b/tools/aapt2/compile/Pseudolocalizer_test.cpp
index a152ed6..92eb3b5 100644
--- a/tools/aapt2/compile/Pseudolocalizer_test.cpp
+++ b/tools/aapt2/compile/Pseudolocalizer_test.cpp
@@ -15,33 +15,32 @@
  */
 
 #include "compile/Pseudolocalizer.h"
-#include "util/Util.h"
 
-#include <androidfw/ResourceTypes.h>
-#include <gtest/gtest.h>
+#include "test/Test.h"
+#include "util/Util.h"
 
 namespace aapt {
 
 // In this context, 'Axis' represents a particular field in the configuration,
 // such as language or density.
 
-static ::testing::AssertionResult simpleHelper(const char* input,
+static ::testing::AssertionResult SimpleHelper(const char* input,
                                                const char* expected,
                                                Pseudolocalizer::Method method) {
   Pseudolocalizer pseudo(method);
-  std::string result = pseudo.start() + pseudo.text(input) + pseudo.end();
+  std::string result = pseudo.Start() + pseudo.Text(input) + pseudo.End();
   if (result != expected) {
     return ::testing::AssertionFailure() << expected << " != " << result;
   }
   return ::testing::AssertionSuccess();
 }
 
-static ::testing::AssertionResult compoundHelper(
+static ::testing::AssertionResult CompoundHelper(
     const char* in1, const char* in2, const char* in3, const char* expected,
     Pseudolocalizer::Method method) {
   Pseudolocalizer pseudo(method);
-  std::string result = pseudo.start() + pseudo.text(in1) + pseudo.text(in2) +
-                       pseudo.text(in3) + pseudo.end();
+  std::string result = pseudo.Start() + pseudo.Text(in1) + pseudo.Text(in2) +
+                       pseudo.Text(in3) + pseudo.End();
   if (result != expected) {
     return ::testing::AssertionFailure() << expected << " != " << result;
   }
@@ -49,49 +48,49 @@
 }
 
 TEST(PseudolocalizerTest, NoPseudolocalization) {
-  EXPECT_TRUE(simpleHelper("", "", Pseudolocalizer::Method::kNone));
-  EXPECT_TRUE(simpleHelper("Hello, world", "Hello, world",
+  EXPECT_TRUE(SimpleHelper("", "", Pseudolocalizer::Method::kNone));
+  EXPECT_TRUE(SimpleHelper("Hello, world", "Hello, world",
                            Pseudolocalizer::Method::kNone));
 
-  EXPECT_TRUE(compoundHelper("Hello,", " world", "", "Hello, world",
+  EXPECT_TRUE(CompoundHelper("Hello,", " world", "", "Hello, world",
                              Pseudolocalizer::Method::kNone));
 }
 
 TEST(PseudolocalizerTest, PlaintextAccent) {
-  EXPECT_TRUE(simpleHelper("", "[]", Pseudolocalizer::Method::kAccent));
-  EXPECT_TRUE(simpleHelper("Hello, world", "[Ĥéļļö, ŵöŕļð one two]",
+  EXPECT_TRUE(SimpleHelper("", "[]", Pseudolocalizer::Method::kAccent));
+  EXPECT_TRUE(SimpleHelper("Hello, world", "[Ĥéļļö, ŵöŕļð one two]",
                            Pseudolocalizer::Method::kAccent));
 
-  EXPECT_TRUE(simpleHelper("Hello, %1d", "[Ĥéļļö, »%1d« one two]",
+  EXPECT_TRUE(SimpleHelper("Hello, %1d", "[Ĥéļļö, »%1d« one two]",
                            Pseudolocalizer::Method::kAccent));
 
-  EXPECT_TRUE(simpleHelper("Battery %1d%%", "[βåţţéŕý »%1d«%% one two]",
+  EXPECT_TRUE(SimpleHelper("Battery %1d%%", "[βåţţéŕý »%1d«%% one two]",
                            Pseudolocalizer::Method::kAccent));
   EXPECT_TRUE(
-      simpleHelper("^1 %", "[^1 % one]", Pseudolocalizer::Method::kAccent));
+      SimpleHelper("^1 %", "[^1 % one]", Pseudolocalizer::Method::kAccent));
   EXPECT_TRUE(
-      compoundHelper("", "", "", "[]", Pseudolocalizer::Method::kAccent));
-  EXPECT_TRUE(compoundHelper("Hello,", " world", "", "[Ĥéļļö, ŵöŕļð one two]",
+      CompoundHelper("", "", "", "[]", Pseudolocalizer::Method::kAccent));
+  EXPECT_TRUE(CompoundHelper("Hello,", " world", "", "[Ĥéļļö, ŵöŕļð one two]",
                              Pseudolocalizer::Method::kAccent));
 }
 
 TEST(PseudolocalizerTest, PlaintextBidi) {
-  EXPECT_TRUE(simpleHelper("", "", Pseudolocalizer::Method::kBidi));
-  EXPECT_TRUE(simpleHelper(
+  EXPECT_TRUE(SimpleHelper("", "", Pseudolocalizer::Method::kBidi));
+  EXPECT_TRUE(SimpleHelper(
       "word", "\xe2\x80\x8f\xE2\x80\xaeword\xE2\x80\xac\xe2\x80\x8f",
       Pseudolocalizer::Method::kBidi));
-  EXPECT_TRUE(simpleHelper(
+  EXPECT_TRUE(SimpleHelper(
       "  word  ", "  \xe2\x80\x8f\xE2\x80\xaeword\xE2\x80\xac\xe2\x80\x8f  ",
       Pseudolocalizer::Method::kBidi));
-  EXPECT_TRUE(simpleHelper(
+  EXPECT_TRUE(SimpleHelper(
       "  word  ", "  \xe2\x80\x8f\xE2\x80\xaeword\xE2\x80\xac\xe2\x80\x8f  ",
       Pseudolocalizer::Method::kBidi));
   EXPECT_TRUE(
-      simpleHelper("hello\n  world\n",
+      SimpleHelper("hello\n  world\n",
                    "\xe2\x80\x8f\xE2\x80\xaehello\xE2\x80\xac\xe2\x80\x8f\n"
                    "  \xe2\x80\x8f\xE2\x80\xaeworld\xE2\x80\xac\xe2\x80\x8f\n",
                    Pseudolocalizer::Method::kBidi));
-  EXPECT_TRUE(compoundHelper(
+  EXPECT_TRUE(CompoundHelper(
       "hello", "\n ", " world\n",
       "\xe2\x80\x8f\xE2\x80\xaehello\xE2\x80\xac\xe2\x80\x8f\n"
       "  \xe2\x80\x8f\xE2\x80\xaeworld\xE2\x80\xac\xe2\x80\x8f\n",
@@ -100,33 +99,33 @@
 
 TEST(PseudolocalizerTest, SimpleICU) {
   // Single-fragment messages
-  EXPECT_TRUE(simpleHelper("{placeholder}", "[»{placeholder}«]",
+  EXPECT_TRUE(SimpleHelper("{placeholder}", "[»{placeholder}«]",
                            Pseudolocalizer::Method::kAccent));
-  EXPECT_TRUE(simpleHelper("{USER} is offline", "[»{USER}« îš öƒƒļîñé one two]",
+  EXPECT_TRUE(SimpleHelper("{USER} is offline", "[»{USER}« îš öƒƒļîñé one two]",
                            Pseudolocalizer::Method::kAccent));
-  EXPECT_TRUE(simpleHelper("Copy from {path1} to {path2}",
+  EXPECT_TRUE(SimpleHelper("Copy from {path1} to {path2}",
                            "[Çöþý ƒŕöḿ »{path1}« ţö »{path2}« one two three]",
                            Pseudolocalizer::Method::kAccent));
-  EXPECT_TRUE(simpleHelper("Today is {1,date} {1,time}",
+  EXPECT_TRUE(SimpleHelper("Today is {1,date} {1,time}",
                            "[Ţöðåý îš »{1,date}« »{1,time}« one two]",
                            Pseudolocalizer::Method::kAccent));
 
   // Multi-fragment messages
-  EXPECT_TRUE(compoundHelper("{USER}", " ", "is offline",
+  EXPECT_TRUE(CompoundHelper("{USER}", " ", "is offline",
                              "[»{USER}« îš öƒƒļîñé one two]",
                              Pseudolocalizer::Method::kAccent));
-  EXPECT_TRUE(compoundHelper("Copy from ", "{path1}", " to {path2}",
+  EXPECT_TRUE(CompoundHelper("Copy from ", "{path1}", " to {path2}",
                              "[Çöþý ƒŕöḿ »{path1}« ţö »{path2}« one two three]",
                              Pseudolocalizer::Method::kAccent));
 }
 
 TEST(PseudolocalizerTest, ICUBidi) {
   // Single-fragment messages
-  EXPECT_TRUE(simpleHelper(
+  EXPECT_TRUE(SimpleHelper(
       "{placeholder}",
       "\xe2\x80\x8f\xE2\x80\xae{placeholder}\xE2\x80\xac\xe2\x80\x8f",
       Pseudolocalizer::Method::kBidi));
-  EXPECT_TRUE(simpleHelper(
+  EXPECT_TRUE(SimpleHelper(
       "{COUNT, plural, one {one} other {other}}",
       "{COUNT, plural, "
       "one {\xe2\x80\x8f\xE2\x80\xaeone\xE2\x80\xac\xe2\x80\x8f} "
@@ -136,30 +135,30 @@
 
 TEST(PseudolocalizerTest, Escaping) {
   // Single-fragment messages
-  EXPECT_TRUE(simpleHelper("'{USER'} is offline",
+  EXPECT_TRUE(SimpleHelper("'{USER'} is offline",
                            "['{ÛŠÉŔ'} îš öƒƒļîñé one two three]",
                            Pseudolocalizer::Method::kAccent));
 
   // Multi-fragment messages
-  EXPECT_TRUE(compoundHelper("'{USER}", " ", "''is offline",
+  EXPECT_TRUE(CompoundHelper("'{USER}", " ", "''is offline",
                              "['{ÛŠÉŔ} ''îš öƒƒļîñé one two three]",
                              Pseudolocalizer::Method::kAccent));
 }
 
 TEST(PseudolocalizerTest, PluralsAndSelects) {
-  EXPECT_TRUE(simpleHelper(
+  EXPECT_TRUE(SimpleHelper(
       "{COUNT, plural, one {Delete a file} other {Delete {COUNT} files}}",
       "[{COUNT, plural, one {Ðéļéţé å ƒîļé one two} "
       "other {Ðéļéţé »{COUNT}« ƒîļéš one two}}]",
       Pseudolocalizer::Method::kAccent));
 
   EXPECT_TRUE(
-      simpleHelper("Distance is {COUNT, plural, one {# mile} other {# miles}}",
+      SimpleHelper("Distance is {COUNT, plural, one {# mile} other {# miles}}",
                    "[Ðîšţåñçé îš {COUNT, plural, one {# ḿîļé one two} "
                    "other {# ḿîļéš one two}}]",
                    Pseudolocalizer::Method::kAccent));
 
-  EXPECT_TRUE(simpleHelper(
+  EXPECT_TRUE(SimpleHelper(
       "{1, select, female {{1} added you} "
       "male {{1} added you} other {{1} added you}}",
       "[{1, select, female {»{1}« åððéð ýöû one two} "
@@ -167,7 +166,7 @@
       Pseudolocalizer::Method::kAccent));
 
   EXPECT_TRUE(
-      compoundHelper("{COUNT, plural, one {Delete a file} "
+      CompoundHelper("{COUNT, plural, one {Delete a file} "
                      "other {Delete ",
                      "{COUNT}", " files}}",
                      "[{COUNT, plural, one {Ðéļéţé å ƒîļé one two} "
@@ -177,7 +176,7 @@
 
 TEST(PseudolocalizerTest, NestedICU) {
   EXPECT_TRUE(
-      simpleHelper("{person, select, "
+      SimpleHelper("{person, select, "
                    "female {"
                    "{num_circles, plural,"
                    "=0{{person} didn't add you to any of her circles.}"
@@ -222,9 +221,9 @@
 
 TEST(PseudolocalizerTest, RedefineMethod) {
   Pseudolocalizer pseudo(Pseudolocalizer::Method::kAccent);
-  std::string result = pseudo.text("Hello, ");
-  pseudo.setMethod(Pseudolocalizer::Method::kNone);
-  result += pseudo.text("world!");
+  std::string result = pseudo.Text("Hello, ");
+  pseudo.SetMethod(Pseudolocalizer::Method::kNone);
+  result += pseudo.Text("world!");
   ASSERT_EQ(StringPiece("Ĥéļļö, world!"), result);
 }
 
diff --git a/tools/aapt2/compile/XmlIdCollector.cpp b/tools/aapt2/compile/XmlIdCollector.cpp
index aa8b1df..d61a15a 100644
--- a/tools/aapt2/compile/XmlIdCollector.cpp
+++ b/tools/aapt2/compile/XmlIdCollector.cpp
@@ -15,55 +15,59 @@
  */
 
 #include "compile/XmlIdCollector.h"
-#include "ResourceUtils.h"
-#include "ResourceValues.h"
-#include "xml/XmlDom.h"
 
 #include <algorithm>
 #include <vector>
 
+#include "ResourceUtils.h"
+#include "ResourceValues.h"
+#include "xml/XmlDom.h"
+
 namespace aapt {
 
 namespace {
 
-static bool cmpName(const SourcedResourceName& a, const ResourceNameRef& b) {
+static bool cmp_name(const SourcedResourceName& a, const ResourceNameRef& b) {
   return a.name < b;
 }
 
 struct IdCollector : public xml::Visitor {
-  using xml::Visitor::visit;
+ public:
+  using xml::Visitor::Visit;
 
-  std::vector<SourcedResourceName>* mOutSymbols;
+  explicit IdCollector(std::vector<SourcedResourceName>* out_symbols)
+      : out_symbols_(out_symbols) {}
 
-  explicit IdCollector(std::vector<SourcedResourceName>* outSymbols)
-      : mOutSymbols(outSymbols) {}
-
-  void visit(xml::Element* element) override {
+  void Visit(xml::Element* element) override {
     for (xml::Attribute& attr : element->attributes) {
       ResourceNameRef name;
       bool create = false;
-      if (ResourceUtils::parseReference(attr.value, &name, &create, nullptr)) {
+      if (ResourceUtils::ParseReference(attr.value, &name, &create, nullptr)) {
         if (create && name.type == ResourceType::kId) {
-          auto iter = std::lower_bound(mOutSymbols->begin(), mOutSymbols->end(),
-                                       name, cmpName);
-          if (iter == mOutSymbols->end() || iter->name != name) {
-            mOutSymbols->insert(iter, SourcedResourceName{name.toResourceName(),
-                                                          element->lineNumber});
+          auto iter = std::lower_bound(out_symbols_->begin(),
+                                       out_symbols_->end(), name, cmp_name);
+          if (iter == out_symbols_->end() || iter->name != name) {
+            out_symbols_->insert(iter,
+                                 SourcedResourceName{name.ToResourceName(),
+                                                     element->line_number});
           }
         }
       }
     }
 
-    xml::Visitor::visit(element);
+    xml::Visitor::Visit(element);
   }
+
+ private:
+  std::vector<SourcedResourceName>* out_symbols_;
 };
 
 }  // namespace
 
-bool XmlIdCollector::consume(IAaptContext* context, xml::XmlResource* xmlRes) {
-  xmlRes->file.exportedSymbols.clear();
-  IdCollector collector(&xmlRes->file.exportedSymbols);
-  xmlRes->root->accept(&collector);
+bool XmlIdCollector::Consume(IAaptContext* context, xml::XmlResource* xmlRes) {
+  xmlRes->file.exported_symbols.clear();
+  IdCollector collector(&xmlRes->file.exported_symbols);
+  xmlRes->root->Accept(&collector);
   return true;
 }
 
diff --git a/tools/aapt2/compile/XmlIdCollector.h b/tools/aapt2/compile/XmlIdCollector.h
index 8423f48..8febf0f 100644
--- a/tools/aapt2/compile/XmlIdCollector.h
+++ b/tools/aapt2/compile/XmlIdCollector.h
@@ -23,7 +23,7 @@
 namespace aapt {
 
 struct XmlIdCollector : public IXmlResourceConsumer {
-  bool consume(IAaptContext* context, xml::XmlResource* xmlRes) override;
+  bool Consume(IAaptContext* context, xml::XmlResource* xml_res) override;
 };
 
 }  // namespace aapt
diff --git a/tools/aapt2/compile/XmlIdCollector_test.cpp b/tools/aapt2/compile/XmlIdCollector_test.cpp
index 08ca7b1..98da56d 100644
--- a/tools/aapt2/compile/XmlIdCollector_test.cpp
+++ b/tools/aapt2/compile/XmlIdCollector_test.cpp
@@ -15,18 +15,17 @@
  */
 
 #include "compile/XmlIdCollector.h"
-#include "test/Builders.h"
-#include "test/Context.h"
 
-#include <gtest/gtest.h>
 #include <algorithm>
 
+#include "test/Test.h"
+
 namespace aapt {
 
 TEST(XmlIdCollectorTest, CollectsIds) {
-  std::unique_ptr<IAaptContext> context = test::ContextBuilder().build();
+  std::unique_ptr<IAaptContext> context = test::ContextBuilder().Build();
 
-  std::unique_ptr<xml::XmlResource> doc = test::buildXmlDom(R"EOF(
+  std::unique_ptr<xml::XmlResource> doc = test::BuildXmlDom(R"EOF(
             <View xmlns:android="http://schemas.android.com/apk/res/android"
                   android:id="@+id/foo"
                   text="@+id/bar">
@@ -35,34 +34,34 @@
             </View>)EOF");
 
   XmlIdCollector collector;
-  ASSERT_TRUE(collector.consume(context.get(), doc.get()));
+  ASSERT_TRUE(collector.Consume(context.get(), doc.get()));
 
   EXPECT_EQ(
-      1, std::count(doc->file.exportedSymbols.begin(),
-                    doc->file.exportedSymbols.end(),
-                    SourcedResourceName{test::parseNameOrDie("id/foo"), 3u}));
+      1, std::count(doc->file.exported_symbols.begin(),
+                    doc->file.exported_symbols.end(),
+                    SourcedResourceName{test::ParseNameOrDie("id/foo"), 3u}));
 
   EXPECT_EQ(
-      1, std::count(doc->file.exportedSymbols.begin(),
-                    doc->file.exportedSymbols.end(),
-                    SourcedResourceName{test::parseNameOrDie("id/bar"), 3u}));
+      1, std::count(doc->file.exported_symbols.begin(),
+                    doc->file.exported_symbols.end(),
+                    SourcedResourceName{test::ParseNameOrDie("id/bar"), 3u}));
 
   EXPECT_EQ(
-      1, std::count(doc->file.exportedSymbols.begin(),
-                    doc->file.exportedSymbols.end(),
-                    SourcedResourceName{test::parseNameOrDie("id/car"), 6u}));
+      1, std::count(doc->file.exported_symbols.begin(),
+                    doc->file.exported_symbols.end(),
+                    SourcedResourceName{test::ParseNameOrDie("id/car"), 6u}));
 }
 
 TEST(XmlIdCollectorTest, DontCollectNonIds) {
-  std::unique_ptr<IAaptContext> context = test::ContextBuilder().build();
+  std::unique_ptr<IAaptContext> context = test::ContextBuilder().Build();
 
   std::unique_ptr<xml::XmlResource> doc =
-      test::buildXmlDom("<View foo=\"@+string/foo\"/>");
+      test::BuildXmlDom("<View foo=\"@+string/foo\"/>");
 
   XmlIdCollector collector;
-  ASSERT_TRUE(collector.consume(context.get(), doc.get()));
+  ASSERT_TRUE(collector.Consume(context.get(), doc.get()));
 
-  EXPECT_TRUE(doc->file.exportedSymbols.empty());
+  EXPECT_TRUE(doc->file.exported_symbols.empty());
 }
 
 }  // namespace aapt