Use Google3 style guide with .clang-format

Test: style change only, builds ok
Change-Id: I885180e24cb2e7b58cfb4967c3bcb40058ce4078
diff --git a/tools/aapt2/java/AnnotationProcessor.h b/tools/aapt2/java/AnnotationProcessor.h
index cfc32f3..5419608 100644
--- a/tools/aapt2/java/AnnotationProcessor.h
+++ b/tools/aapt2/java/AnnotationProcessor.h
@@ -52,34 +52,36 @@
  *
  */
 class AnnotationProcessor {
-public:
-    /**
-     * Adds more comments. Since resources can have various values with different configurations,
-     * we need to collect all the comments.
-     */
-    void appendComment(const StringPiece& comment);
+ public:
+  /**
+   * Adds more comments. Since resources can have various values with different
+   * configurations,
+   * we need to collect all the comments.
+   */
+  void appendComment(const StringPiece& comment);
 
-    void appendNewLine();
+  void appendNewLine();
 
-    /**
-     * Writes the comments and annotations to the stream, with the given prefix before each line.
-     */
-    void writeToStream(std::ostream* out, const StringPiece& prefix) const;
+  /**
+   * Writes the comments and annotations to the stream, with the given prefix
+   * before each line.
+   */
+  void writeToStream(std::ostream* out, const StringPiece& prefix) const;
 
-private:
-    enum : uint32_t {
-        kDeprecated = 0x01,
-        kSystemApi = 0x02,
-    };
+ private:
+  enum : uint32_t {
+    kDeprecated = 0x01,
+    kSystemApi = 0x02,
+  };
 
-    std::stringstream mComment;
-    std::stringstream mAnnotations;
-    bool mHasComments = false;
-    uint32_t mAnnotationBitMask = 0;
+  std::stringstream mComment;
+  std::stringstream mAnnotations;
+  bool mHasComments = false;
+  uint32_t mAnnotationBitMask = 0;
 
-    void appendCommentLine(std::string& line);
+  void appendCommentLine(std::string& line);
 };
 
-} // namespace aapt
+}  // namespace aapt
 
 #endif /* AAPT_JAVA_ANNOTATIONPROCESSOR_H */
diff --git a/tools/aapt2/java/ClassDefinition.h b/tools/aapt2/java/ClassDefinition.h
index e84c274..bd7e7b2 100644
--- a/tools/aapt2/java/ClassDefinition.h
+++ b/tools/aapt2/java/ClassDefinition.h
@@ -33,46 +33,43 @@
 constexpr static const char* kIndent = "  ";
 
 class ClassMember {
-public:
-    virtual ~ClassMember() = default;
+ public:
+  virtual ~ClassMember() = default;
 
-    AnnotationProcessor* getCommentBuilder() {
-        return &mProcessor;
-    }
+  AnnotationProcessor* getCommentBuilder() { return &mProcessor; }
 
-    virtual bool empty() const = 0;
+  virtual bool empty() const = 0;
 
-    virtual void writeToStream(const StringPiece& prefix, bool final, std::ostream* out) const {
-        mProcessor.writeToStream(out, prefix);
-    }
+  virtual void writeToStream(const StringPiece& prefix, bool final,
+                             std::ostream* out) const {
+    mProcessor.writeToStream(out, prefix);
+  }
 
-private:
-    AnnotationProcessor mProcessor;
+ private:
+  AnnotationProcessor mProcessor;
 };
 
 template <typename T>
 class PrimitiveMember : public ClassMember {
-public:
-    PrimitiveMember(const StringPiece& name, const T& val) :
-            mName(name.toString()), mVal(val) {
-    }
+ public:
+  PrimitiveMember(const StringPiece& name, const T& val)
+      : mName(name.toString()), mVal(val) {}
 
-    bool empty() const override {
-        return false;
-    }
+  bool empty() const override { return false; }
 
-    void writeToStream(const StringPiece& prefix, bool final, std::ostream* out) const override {
-        ClassMember::writeToStream(prefix, final, out);
+  void writeToStream(const StringPiece& prefix, bool final,
+                     std::ostream* out) const override {
+    ClassMember::writeToStream(prefix, final, out);
 
-        *out << prefix << "public static " << (final ? "final " : "")
-             << "int " << mName << "=" << mVal << ";";
-    }
+    *out << prefix << "public static " << (final ? "final " : "") << "int "
+         << mName << "=" << mVal << ";";
+  }
 
-private:
-    std::string mName;
-    T mVal;
+ private:
+  std::string mName;
+  T mVal;
 
-    DISALLOW_COPY_AND_ASSIGN(PrimitiveMember);
+  DISALLOW_COPY_AND_ASSIGN(PrimitiveMember);
 };
 
 /**
@@ -80,27 +77,25 @@
  */
 template <>
 class PrimitiveMember<std::string> : public ClassMember {
-public:
-    PrimitiveMember(const StringPiece& name, const std::string& val) :
-            mName(name.toString()), mVal(val) {
-    }
+ public:
+  PrimitiveMember(const StringPiece& name, const std::string& val)
+      : mName(name.toString()), mVal(val) {}
 
-    bool empty() const override {
-        return false;
-    }
+  bool empty() const override { return false; }
 
-    void writeToStream(const StringPiece& prefix, bool final, std::ostream* out) const override {
-        ClassMember::writeToStream(prefix, final, out);
+  void writeToStream(const StringPiece& prefix, bool final,
+                     std::ostream* out) const override {
+    ClassMember::writeToStream(prefix, final, out);
 
-        *out << prefix << "public static " << (final ? "final " : "")
-             << "String " << mName << "=\"" << mVal << "\";";
-    }
+    *out << prefix << "public static " << (final ? "final " : "") << "String "
+         << mName << "=\"" << mVal << "\";";
+  }
 
-private:
-    std::string mName;
-    std::string mVal;
+ private:
+  std::string mName;
+  std::string mVal;
 
-    DISALLOW_COPY_AND_ASSIGN(PrimitiveMember);
+  DISALLOW_COPY_AND_ASSIGN(PrimitiveMember);
 };
 
 using IntMember = PrimitiveMember<uint32_t>;
@@ -109,80 +104,75 @@
 
 template <typename T>
 class PrimitiveArrayMember : public ClassMember {
-public:
-    explicit PrimitiveArrayMember(const StringPiece& name) :
-            mName(name.toString()) {
+ public:
+  explicit PrimitiveArrayMember(const StringPiece& name)
+      : mName(name.toString()) {}
+
+  void addElement(const T& val) { mElements.push_back(val); }
+
+  bool empty() const override { return false; }
+
+  void writeToStream(const StringPiece& prefix, bool final,
+                     std::ostream* out) const override {
+    ClassMember::writeToStream(prefix, final, out);
+
+    *out << prefix << "public static final int[] " << mName << "={";
+
+    const auto begin = mElements.begin();
+    const auto end = mElements.end();
+    for (auto current = begin; current != end; ++current) {
+      if (std::distance(begin, current) % kAttribsPerLine == 0) {
+        *out << "\n" << prefix << kIndent << kIndent;
+      }
+
+      *out << *current;
+      if (std::distance(current, end) > 1) {
+        *out << ", ";
+      }
     }
+    *out << "\n" << prefix << kIndent << "};";
+  }
 
-    void addElement(const T& val) {
-        mElements.push_back(val);
-    }
+ private:
+  std::string mName;
+  std::vector<T> mElements;
 
-    bool empty() const override {
-        return false;
-    }
-
-    void writeToStream(const StringPiece& prefix, bool final, std::ostream* out) const override {
-        ClassMember::writeToStream(prefix, final, out);
-
-        *out << prefix << "public static final int[] " << mName << "={";
-
-        const auto begin = mElements.begin();
-        const auto end = mElements.end();
-        for (auto current = begin; current != end; ++current) {
-            if (std::distance(begin, current) % kAttribsPerLine == 0) {
-                *out << "\n" << prefix << kIndent << kIndent;
-            }
-
-            *out << *current;
-            if (std::distance(current, end) > 1) {
-                *out << ", ";
-            }
-        }
-        *out << "\n" << prefix << kIndent <<"};";
-    }
-
-private:
-    std::string mName;
-    std::vector<T> mElements;
-
-    DISALLOW_COPY_AND_ASSIGN(PrimitiveArrayMember);
+  DISALLOW_COPY_AND_ASSIGN(PrimitiveArrayMember);
 };
 
 using ResourceArrayMember = PrimitiveArrayMember<ResourceId>;
 
-enum class ClassQualifier {
-    None,
-    Static
-};
+enum class ClassQualifier { None, Static };
 
 class ClassDefinition : public ClassMember {
-public:
-    static bool writeJavaFile(const ClassDefinition* def,
-                              const StringPiece& package,
-                              bool final,
-                              std::ostream* out);
+ public:
+  static bool writeJavaFile(const ClassDefinition* def,
+                            const StringPiece& package, bool final,
+                            std::ostream* out);
 
-    ClassDefinition(const StringPiece& name, ClassQualifier qualifier, bool createIfEmpty) :
-            mName(name.toString()), mQualifier(qualifier), mCreateIfEmpty(createIfEmpty) {
-    }
+  ClassDefinition(const StringPiece& name, ClassQualifier qualifier,
+                  bool createIfEmpty)
+      : mName(name.toString()),
+        mQualifier(qualifier),
+        mCreateIfEmpty(createIfEmpty) {}
 
-    void addMember(std::unique_ptr<ClassMember> member) {
-        mMembers.push_back(std::move(member));
-    }
+  void addMember(std::unique_ptr<ClassMember> member) {
+    mMembers.push_back(std::move(member));
+  }
 
-    bool empty() const override;
-    void writeToStream(const StringPiece& prefix, bool final, std::ostream* out) const override;
+  bool empty() const override;
+  void writeToStream(const StringPiece& prefix, bool final,
+                     std::ostream* out) const override;
 
-private:
-    std::string mName;
-    ClassQualifier mQualifier;
-    bool mCreateIfEmpty;
-    std::vector<std::unique_ptr<ClassMember>> mMembers;
+ private:
+  std::string mName;
+  ClassQualifier mQualifier;
+  bool mCreateIfEmpty;
+  std::vector<std::unique_ptr<ClassMember>> mMembers;
 
-    DISALLOW_COPY_AND_ASSIGN(ClassDefinition);
+  DISALLOW_COPY_AND_ASSIGN(ClassDefinition);
 };
 
-} // namespace aapt
+}  // namespace aapt
 
 #endif /* AAPT_JAVA_CLASSDEFINITION_H */
diff --git a/tools/aapt2/java/JavaClassGenerator.h b/tools/aapt2/java/JavaClassGenerator.h
index 901a86e..2fdf268 100644
--- a/tools/aapt2/java/JavaClassGenerator.h
+++ b/tools/aapt2/java/JavaClassGenerator.h
@@ -31,72 +31,74 @@
 class ClassDefinition;
 
 struct JavaClassGeneratorOptions {
-    /*
-     * Specifies whether to use the 'final' modifier
-     * on resource entries. Default is true.
-     */
-    bool useFinal = true;
+  /*
+   * Specifies whether to use the 'final' modifier
+   * on resource entries. Default is true.
+   */
+  bool useFinal = true;
 
-    enum class SymbolTypes {
-        kAll,
-        kPublicPrivate,
-        kPublic,
-    };
+  enum class SymbolTypes {
+    kAll,
+    kPublicPrivate,
+    kPublic,
+  };
 
-    SymbolTypes types = SymbolTypes::kAll;
+  SymbolTypes types = SymbolTypes::kAll;
 
-    /**
-     * A list of JavaDoc annotations to add to the comments of all generated classes.
-     */
-    std::vector<std::string> javadocAnnotations;
+  /**
+   * A list of JavaDoc annotations to add to the comments of all generated
+   * classes.
+   */
+  std::vector<std::string> javadocAnnotations;
 };
 
 /*
  * Generates the R.java file for a resource table.
  */
 class JavaClassGenerator {
-public:
-    JavaClassGenerator(IAaptContext* context, ResourceTable* table,
-                       const JavaClassGeneratorOptions& options);
+ public:
+  JavaClassGenerator(IAaptContext* context, ResourceTable* table,
+                     const JavaClassGeneratorOptions& options);
 
-    /*
-     * Writes the R.java file to `out`. Only symbols belonging to `package` are written.
-     * All symbols technically belong to a single package, but linked libraries will
-     * have their names mangled, denoting that they came from a different package.
-     * We need to generate these symbols in a separate file.
-     * Returns true on success.
-     */
-    bool generate(const StringPiece& packageNameToGenerate, std::ostream* out);
+  /*
+   * Writes the R.java file to `out`. Only symbols belonging to `package` are
+   * written.
+   * All symbols technically belong to a single package, but linked libraries
+   * will
+   * have their names mangled, denoting that they came from a different package.
+   * We need to generate these symbols in a separate file.
+   * Returns true on success.
+   */
+  bool generate(const StringPiece& packageNameToGenerate, std::ostream* out);
 
-    bool generate(const StringPiece& packageNameToGenerate,
-                  const StringPiece& outputPackageName,
-                  std::ostream* out);
+  bool generate(const StringPiece& packageNameToGenerate,
+                const StringPiece& outputPackageName, std::ostream* out);
 
-    const std::string& getError() const;
+  const std::string& getError() const;
 
-private:
-    bool addMembersToTypeClass(const StringPiece& packageNameToGenerate,
-                               const ResourceTablePackage* package,
-                               const ResourceTableType* type,
-                               ClassDefinition* outTypeClassDef);
+ private:
+  bool addMembersToTypeClass(const StringPiece& packageNameToGenerate,
+                             const ResourceTablePackage* package,
+                             const ResourceTableType* type,
+                             ClassDefinition* outTypeClassDef);
 
-    void addMembersToStyleableClass(const StringPiece& packageNameToGenerate,
-                                    const std::string& entryName,
-                                    const Styleable* styleable,
-                                    ClassDefinition* outStyleableClassDef);
+  void addMembersToStyleableClass(const StringPiece& packageNameToGenerate,
+                                  const std::string& entryName,
+                                  const Styleable* styleable,
+                                  ClassDefinition* outStyleableClassDef);
 
-    bool skipSymbol(SymbolState state);
+  bool skipSymbol(SymbolState state);
 
-    IAaptContext* mContext;
-    ResourceTable* mTable;
-    JavaClassGeneratorOptions mOptions;
-    std::string mError;
+  IAaptContext* mContext;
+  ResourceTable* mTable;
+  JavaClassGeneratorOptions mOptions;
+  std::string mError;
 };
 
 inline const std::string& JavaClassGenerator::getError() const {
-    return mError;
+  return mError;
 }
 
-} // namespace aapt
+}  // namespace aapt
 
-#endif // AAPT_JAVA_CLASS_GENERATOR_H
+#endif  // AAPT_JAVA_CLASS_GENERATOR_H
diff --git a/tools/aapt2/java/ManifestClassGenerator.h b/tools/aapt2/java/ManifestClassGenerator.h
index f565289..1817648 100644
--- a/tools/aapt2/java/ManifestClassGenerator.h
+++ b/tools/aapt2/java/ManifestClassGenerator.h
@@ -26,8 +26,9 @@
 
 namespace aapt {
 
-std::unique_ptr<ClassDefinition> generateManifestClass(IDiagnostics* diag, xml::XmlResource* res);
+std::unique_ptr<ClassDefinition> generateManifestClass(IDiagnostics* diag,
+                                                       xml::XmlResource* res);
 
-} // namespace aapt
+}  // namespace aapt
 
 #endif /* AAPT_JAVA_MANIFESTCLASSGENERATOR_H */
diff --git a/tools/aapt2/java/ProguardRules.h b/tools/aapt2/java/ProguardRules.h
index c2d2bd9..7578ec2 100644
--- a/tools/aapt2/java/ProguardRules.h
+++ b/tools/aapt2/java/ProguardRules.h
@@ -30,29 +30,31 @@
 namespace proguard {
 
 class KeepSet {
-public:
-    inline void addClass(const Source& source, const std::string& className) {
-        mKeepSet[className].insert(source);
-    }
+ public:
+  inline void addClass(const Source& source, const std::string& className) {
+    mKeepSet[className].insert(source);
+  }
 
-    inline void addMethod(const Source& source, const std::string& methodName) {
-        mKeepMethodSet[methodName].insert(source);
-    }
+  inline void addMethod(const Source& source, const std::string& methodName) {
+    mKeepMethodSet[methodName].insert(source);
+  }
 
-private:
-    friend bool writeKeepSet(std::ostream* out, const KeepSet& keepSet);
+ private:
+  friend bool writeKeepSet(std::ostream* out, const KeepSet& keepSet);
 
-    std::map<std::string, std::set<Source>> mKeepSet;
-    std::map<std::string, std::set<Source>> mKeepMethodSet;
+  std::map<std::string, std::set<Source>> mKeepSet;
+  std::map<std::string, std::set<Source>> mKeepMethodSet;
 };
 
-bool collectProguardRulesForManifest(const Source& source, xml::XmlResource* res, KeepSet* keepSet,
+bool collectProguardRulesForManifest(const Source& source,
+                                     xml::XmlResource* res, KeepSet* keepSet,
                                      bool mainDexOnly = false);
-bool collectProguardRules(const Source& source, xml::XmlResource* res, KeepSet* keepSet);
+bool collectProguardRules(const Source& source, xml::XmlResource* res,
+                          KeepSet* keepSet);
 
 bool writeKeepSet(std::ostream* out, const KeepSet& keepSet);
 
-} // namespace proguard
-} // namespace aapt
+}  // namespace proguard
+}  // namespace aapt
 
-#endif // AAPT_PROGUARD_RULES_H
+#endif  // AAPT_PROGUARD_RULES_H