diff options
author | 2017-09-29 14:49:15 -0700 | |
---|---|---|
committer | 2017-10-04 14:26:55 -0700 | |
commit | 4670805ea441edb8b280f9312571e7799f1284cf (patch) | |
tree | 593cfa51011a51f443e9dbaa5934ea159e7ae1d7 | |
parent | 65e91ce6c3aac8e350cbf5e1de2d2b13c78d792b (diff) |
AAPT2: Move format related files under same directory
Test: make aapt2_tests
Change-Id: Id72cdfc12ba3add294048e60c55f2461344464bf
-rw-r--r-- | tools/aapt2/Android.bp | 14 | ||||
-rw-r--r-- | tools/aapt2/LoadedApk.cpp | 6 | ||||
-rw-r--r-- | tools/aapt2/LoadedApk.h | 34 | ||||
-rw-r--r-- | tools/aapt2/ResourceUtils.cpp | 6 | ||||
-rw-r--r-- | tools/aapt2/cmd/Compile.cpp | 6 | ||||
-rw-r--r-- | tools/aapt2/cmd/Dump.cpp | 4 | ||||
-rw-r--r-- | tools/aapt2/cmd/Link.cpp | 12 | ||||
-rw-r--r-- | tools/aapt2/cmd/Optimize.cpp | 4 | ||||
-rw-r--r-- | tools/aapt2/compile/PngChunkFilter.cpp | 4 | ||||
-rw-r--r-- | tools/aapt2/format/Archive.cpp (renamed from tools/aapt2/flatten/Archive.cpp) | 18 | ||||
-rw-r--r-- | tools/aapt2/format/Archive.h (renamed from tools/aapt2/flatten/Archive.h) | 6 | ||||
-rw-r--r-- | tools/aapt2/format/binary/BinaryResourceParser.cpp (renamed from tools/aapt2/unflatten/BinaryResourceParser.cpp) | 166 | ||||
-rw-r--r-- | tools/aapt2/format/binary/BinaryResourceParser.h (renamed from tools/aapt2/unflatten/BinaryResourceParser.h) | 51 | ||||
-rw-r--r-- | tools/aapt2/format/binary/ChunkWriter.h (renamed from tools/aapt2/flatten/ChunkWriter.h) | 21 | ||||
-rw-r--r-- | tools/aapt2/format/binary/ResChunkPullParser.cpp (renamed from tools/aapt2/unflatten/ResChunkPullParser.cpp) | 7 | ||||
-rw-r--r-- | tools/aapt2/format/binary/ResChunkPullParser.h (renamed from tools/aapt2/unflatten/ResChunkPullParser.h) | 55 | ||||
-rw-r--r-- | tools/aapt2/format/binary/ResourceTypeExtensions.h (renamed from tools/aapt2/flatten/ResourceTypeExtensions.h) | 12 | ||||
-rw-r--r-- | tools/aapt2/format/binary/TableFlattener.cpp (renamed from tools/aapt2/flatten/TableFlattener.cpp) | 46 | ||||
-rw-r--r-- | tools/aapt2/format/binary/TableFlattener.h (renamed from tools/aapt2/flatten/TableFlattener.h) | 9 | ||||
-rw-r--r-- | tools/aapt2/format/binary/TableFlattener_test.cpp (renamed from tools/aapt2/flatten/TableFlattener_test.cpp) | 112 | ||||
-rw-r--r-- | tools/aapt2/format/binary/XmlFlattener.cpp (renamed from tools/aapt2/flatten/XmlFlattener.cpp) | 26 | ||||
-rw-r--r-- | tools/aapt2/format/binary/XmlFlattener.h (renamed from tools/aapt2/flatten/XmlFlattener.h) | 13 | ||||
-rw-r--r-- | tools/aapt2/format/binary/XmlFlattener_test.cpp (renamed from tools/aapt2/flatten/XmlFlattener_test.cpp) | 5 | ||||
-rw-r--r-- | tools/aapt2/format/proto/ProtoDeserialize.cpp (renamed from tools/aapt2/proto/ProtoDeserialize.cpp) | 10 | ||||
-rw-r--r-- | tools/aapt2/format/proto/ProtoDeserialize.h (renamed from tools/aapt2/proto/ProtoDeserialize.h) | 6 | ||||
-rw-r--r-- | tools/aapt2/format/proto/ProtoSerialize.cpp (renamed from tools/aapt2/proto/ProtoSerialize.cpp) | 2 | ||||
-rw-r--r-- | tools/aapt2/format/proto/ProtoSerialize.h (renamed from tools/aapt2/proto/ProtoSerialize.h) | 6 | ||||
-rw-r--r-- | tools/aapt2/format/proto/ProtoSerialize_test.cpp (renamed from tools/aapt2/proto/ProtoSerialize_test.cpp) | 4 | ||||
-rw-r--r-- | tools/aapt2/io/Util.h | 2 | ||||
-rw-r--r-- | tools/aapt2/optimize/MultiApkGenerator.cpp | 4 | ||||
-rw-r--r-- | tools/aapt2/optimize/MultiApkGenerator_test.cpp | 4 | ||||
-rw-r--r-- | tools/aapt2/xml/XmlDom_test.cpp | 2 |
32 files changed, 310 insertions, 367 deletions
diff --git a/tools/aapt2/Android.bp b/tools/aapt2/Android.bp index 7a8a4eea1aa6..ff51d5146eb8 100644 --- a/tools/aapt2/Android.bp +++ b/tools/aapt2/Android.bp @@ -83,9 +83,13 @@ cc_library_host_static { "configuration/ConfigurationParser.cpp", "filter/AbiFilter.cpp", "filter/ConfigFilter.cpp", - "flatten/Archive.cpp", - "flatten/TableFlattener.cpp", - "flatten/XmlFlattener.cpp", + "format/Archive.cpp", + "format/binary/BinaryResourceParser.cpp", + "format/binary/ResChunkPullParser.cpp", + "format/binary/TableFlattener.cpp", + "format/binary/XmlFlattener.cpp", + "format/proto/ProtoDeserialize.cpp", + "format/proto/ProtoSerialize.cpp", "io/BigBufferStreams.cpp", "io/File.cpp", "io/FileInputStream.cpp", @@ -106,13 +110,9 @@ cc_library_host_static { "optimize/ResourceDeduper.cpp", "optimize/VersionCollapser.cpp", "process/SymbolTable.cpp", - "proto/ProtoDeserialize.cpp", - "proto/ProtoSerialize.cpp", "split/TableSplitter.cpp", "text/Unicode.cpp", "text/Utf8Iterator.cpp", - "unflatten/BinaryResourceParser.cpp", - "unflatten/ResChunkPullParser.cpp", "util/BigBuffer.cpp", "util/Files.cpp", "util/Util.cpp", diff --git a/tools/aapt2/LoadedApk.cpp b/tools/aapt2/LoadedApk.cpp index 6f2b86528b5b..c1815c82b5b5 100644 --- a/tools/aapt2/LoadedApk.cpp +++ b/tools/aapt2/LoadedApk.cpp @@ -18,9 +18,9 @@ #include "ResourceValues.h" #include "ValueVisitor.h" -#include "flatten/Archive.h" -#include "flatten/TableFlattener.h" -#include "flatten/XmlFlattener.h" +#include "format/Archive.h" +#include "format/binary/TableFlattener.h" +#include "format/binary/XmlFlattener.h" #include "io/BigBufferInputStream.h" #include "io/Util.h" #include "xml/XmlDom.h" diff --git a/tools/aapt2/LoadedApk.h b/tools/aapt2/LoadedApk.h index d779b7e7663f..d2dd5cf2bc67 100644 --- a/tools/aapt2/LoadedApk.h +++ b/tools/aapt2/LoadedApk.h @@ -21,27 +21,35 @@ #include "ResourceTable.h" #include "filter/Filter.h" -#include "flatten/Archive.h" -#include "flatten/TableFlattener.h" +#include "format/Archive.h" +#include "format/binary/BinaryResourceParser.h" +#include "format/binary/TableFlattener.h" #include "io/ZipArchive.h" -#include "unflatten/BinaryResourceParser.h" #include "xml/XmlDom.h" namespace aapt { -/** Info about an APK loaded in memory. */ +// Info about an APK loaded in memory. class LoadedApk { public: - LoadedApk(const Source& source, std::unique_ptr<io::IFileCollection> apk, - std::unique_ptr<ResourceTable> table) - : source_(source), apk_(std::move(apk)), table_(std::move(table)) { + LoadedApk( + const Source& source, + std::unique_ptr<io::IFileCollection> apk, + std::unique_ptr<ResourceTable> table) + : source_(source), apk_(std::move(apk)), table_(std::move(table)) {} + virtual ~LoadedApk() = default; + + io::IFileCollection* GetFileCollection() { + return apk_.get(); } - io::IFileCollection* GetFileCollection() { return apk_.get(); } - - ResourceTable* GetResourceTable() { return table_.get(); } + ResourceTable* GetResourceTable() { + return table_.get(); + } - const Source& GetSource() { return source_; } + const Source& GetSource() { + return source_; + } /** * Writes the APK on disk at the given path, while also removing the resource @@ -70,11 +78,11 @@ class LoadedApk { const android::StringPiece& path); private: + DISALLOW_COPY_AND_ASSIGN(LoadedApk); + Source source_; std::unique_ptr<io::IFileCollection> apk_; std::unique_ptr<ResourceTable> table_; - - DISALLOW_COPY_AND_ASSIGN(LoadedApk); }; } // namespace aapt diff --git a/tools/aapt2/ResourceUtils.cpp b/tools/aapt2/ResourceUtils.cpp index f193fe0c6593..6fac6e9dfefe 100644 --- a/tools/aapt2/ResourceUtils.cpp +++ b/tools/aapt2/ResourceUtils.cpp @@ -23,12 +23,12 @@ #include "NameMangler.h" #include "SdkConstants.h" -#include "flatten/ResourceTypeExtensions.h" +#include "format/binary/ResourceTypeExtensions.h" #include "util/Files.h" #include "util/Util.h" -using android::StringPiece; -using android::StringPiece16; +using ::android::StringPiece; +using ::android::StringPiece16; namespace aapt { namespace ResourceUtils { diff --git a/tools/aapt2/cmd/Compile.cpp b/tools/aapt2/cmd/Compile.cpp index 0690dc1b8ec6..a5e6aefd1e0f 100644 --- a/tools/aapt2/cmd/Compile.cpp +++ b/tools/aapt2/cmd/Compile.cpp @@ -35,12 +35,12 @@ #include "compile/Png.h" #include "compile/PseudolocaleGenerator.h" #include "compile/XmlIdCollector.h" -#include "flatten/Archive.h" -#include "flatten/XmlFlattener.h" +#include "format/Archive.h" +#include "format/binary/XmlFlattener.h" +#include "format/proto/ProtoSerialize.h" #include "io/BigBufferOutputStream.h" #include "io/FileInputStream.h" #include "io/Util.h" -#include "proto/ProtoSerialize.h" #include "util/Files.h" #include "util/Maybe.h" #include "util/Util.h" diff --git a/tools/aapt2/cmd/Dump.cpp b/tools/aapt2/cmd/Dump.cpp index 0dedc91d2d2e..44032f6a730d 100644 --- a/tools/aapt2/cmd/Dump.cpp +++ b/tools/aapt2/cmd/Dump.cpp @@ -21,10 +21,10 @@ #include "Debug.h" #include "Diagnostics.h" #include "Flags.h" +#include "format/binary/BinaryResourceParser.h" +#include "format/proto/ProtoDeserialize.h" #include "io/ZipArchive.h" #include "process/IResourceTableConsumer.h" -#include "proto/ProtoDeserialize.h" -#include "unflatten/BinaryResourceParser.h" #include "util/Files.h" using ::android::StringPiece; diff --git a/tools/aapt2/cmd/Link.cpp b/tools/aapt2/cmd/Link.cpp index f72069cc967a..88e0f699fd58 100644 --- a/tools/aapt2/cmd/Link.cpp +++ b/tools/aapt2/cmd/Link.cpp @@ -38,9 +38,12 @@ #include "cmd/Util.h" #include "compile/IdAssigner.h" #include "filter/ConfigFilter.h" -#include "flatten/Archive.h" -#include "flatten/TableFlattener.h" -#include "flatten/XmlFlattener.h" +#include "format/Archive.h" +#include "format/binary/BinaryResourceParser.h" +#include "format/binary/TableFlattener.h" +#include "format/binary/XmlFlattener.h" +#include "format/proto/ProtoDeserialize.h" +#include "format/proto/ProtoSerialize.h" #include "io/BigBufferInputStream.h" #include "io/FileInputStream.h" #include "io/FileSystem.h" @@ -58,10 +61,7 @@ #include "optimize/VersionCollapser.h" #include "process/IResourceTableConsumer.h" #include "process/SymbolTable.h" -#include "proto/ProtoDeserialize.h" -#include "proto/ProtoSerialize.h" #include "split/TableSplitter.h" -#include "unflatten/BinaryResourceParser.h" #include "util/Files.h" #include "xml/XmlDom.h" diff --git a/tools/aapt2/cmd/Optimize.cpp b/tools/aapt2/cmd/Optimize.cpp index 56b61d04ff9e..67ac67a9367e 100644 --- a/tools/aapt2/cmd/Optimize.cpp +++ b/tools/aapt2/cmd/Optimize.cpp @@ -31,8 +31,8 @@ #include "cmd/Util.h" #include "configuration/ConfigurationParser.h" #include "filter/AbiFilter.h" -#include "flatten/TableFlattener.h" -#include "flatten/XmlFlattener.h" +#include "format/binary/TableFlattener.h" +#include "format/binary/XmlFlattener.h" #include "io/BigBufferInputStream.h" #include "io/Util.h" #include "optimize/MultiApkGenerator.h" diff --git a/tools/aapt2/compile/PngChunkFilter.cpp b/tools/aapt2/compile/PngChunkFilter.cpp index 5af91fdc71b9..bc2e6990433c 100644 --- a/tools/aapt2/compile/PngChunkFilter.cpp +++ b/tools/aapt2/compile/PngChunkFilter.cpp @@ -21,8 +21,8 @@ #include "io/Io.h" -using android::StringPiece; -using android::base::StringPrintf; +using ::android::StringPiece; +using ::android::base::StringPrintf; namespace aapt { diff --git a/tools/aapt2/flatten/Archive.cpp b/tools/aapt2/format/Archive.cpp index 5f8bd063f9b0..d152a9cc7e62 100644 --- a/tools/aapt2/flatten/Archive.cpp +++ b/tools/aapt2/format/Archive.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "flatten/Archive.h" +#include "format/Archive.h" #include <cstdio> #include <memory> @@ -106,9 +106,13 @@ class DirectoryWriter : public IArchiveWriter { return !in->HadError(); } - bool HadError() const override { return !error_.empty(); } + bool HadError() const override { + return !error_.empty(); + } - std::string GetError() const override { return error_; } + std::string GetError() const override { + return error_; + } private: DISALLOW_COPY_AND_ASSIGN(DirectoryWriter); @@ -221,9 +225,13 @@ class ZipFileWriter : public IArchiveWriter { } } - bool HadError() const override { return !error_.empty(); } + bool HadError() const override { + return !error_.empty(); + } - std::string GetError() const override { return error_; } + std::string GetError() const override { + return error_; + } virtual ~ZipFileWriter() { if (writer_) { diff --git a/tools/aapt2/flatten/Archive.h b/tools/aapt2/format/Archive.h index 4ee4ce71a5c5..4e8a39df9165 100644 --- a/tools/aapt2/flatten/Archive.h +++ b/tools/aapt2/format/Archive.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef AAPT_FLATTEN_ARCHIVE_H -#define AAPT_FLATTEN_ARCHIVE_H +#ifndef AAPT_FORMAT_ARCHIVE_H +#define AAPT_FORMAT_ARCHIVE_H #include <fstream> #include <memory> @@ -78,4 +78,4 @@ std::unique_ptr<IArchiveWriter> CreateZipFileArchiveWriter(IDiagnostics* diag, } // namespace aapt -#endif /* AAPT_FLATTEN_ARCHIVE_H */ +#endif /* AAPT_FORMAT_ARCHIVE_H */ diff --git a/tools/aapt2/unflatten/BinaryResourceParser.cpp b/tools/aapt2/format/binary/BinaryResourceParser.cpp index b87278b5ce2f..95eec4ae8248 100644 --- a/tools/aapt2/unflatten/BinaryResourceParser.cpp +++ b/tools/aapt2/format/binary/BinaryResourceParser.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "unflatten/BinaryResourceParser.h" +#include "format/binary/BinaryResourceParser.h" #include <algorithm> #include <map> @@ -31,15 +31,15 @@ #include "ResourceValues.h" #include "Source.h" #include "ValueVisitor.h" -#include "unflatten/ResChunkPullParser.h" +#include "format/binary/ResChunkPullParser.h" #include "util/Util.h" -namespace aapt { - using namespace android; using ::android::base::StringPrintf; +namespace aapt { + namespace { // Visitor that converts a reference's resource ID to a resource name, given a mapping from @@ -118,15 +118,11 @@ bool BinaryResourceParser::Parse() { return true; } -/** - * Parses the resource table, which contains all the packages, types, and - * entries. - */ +// Parses the resource table, which contains all the packages, types, and entries. bool BinaryResourceParser::ParseTable(const ResChunk_header* chunk) { const ResTable_header* table_header = ConvertTo<ResTable_header>(chunk); if (!table_header) { - context_->GetDiagnostics()->Error(DiagMessage(source_) - << "corrupt ResTable_header chunk"); + context_->GetDiagnostics()->Error(DiagMessage(source_) << "corrupt ResTable_header chunk"); return false; } @@ -136,21 +132,20 @@ bool BinaryResourceParser::ParseTable(const ResChunk_header* chunk) { switch (util::DeviceToHost16(parser.chunk()->type)) { case android::RES_STRING_POOL_TYPE: if (value_pool_.getError() == NO_INIT) { - status_t err = value_pool_.setTo( - parser.chunk(), util::DeviceToHost32(parser.chunk()->size)); + status_t err = + value_pool_.setTo(parser.chunk(), util::DeviceToHost32(parser.chunk()->size)); if (err != NO_ERROR) { - context_->GetDiagnostics()->Error( - DiagMessage(source_) << "corrupt string pool in ResTable: " - << value_pool_.getError()); + context_->GetDiagnostics()->Error(DiagMessage(source_) + << "corrupt string pool in ResTable: " + << value_pool_.getError()); return false; } // Reserve some space for the strings we are going to add. - table_->string_pool.HintWillAdd(value_pool_.size(), - value_pool_.styleCount()); + table_->string_pool.HintWillAdd(value_pool_.size(), value_pool_.styleCount()); } else { - context_->GetDiagnostics()->Warn( - DiagMessage(source_) << "unexpected string pool in ResTable"); + context_->GetDiagnostics()->Warn(DiagMessage(source_) + << "unexpected string pool in ResTable"); } break; @@ -169,8 +164,8 @@ bool BinaryResourceParser::ParseTable(const ResChunk_header* chunk) { } if (parser.event() == ResChunkPullParser::Event::kBadDocument) { - context_->GetDiagnostics()->Error( - DiagMessage(source_) << "corrupt resource table: " << parser.error()); + context_->GetDiagnostics()->Error(DiagMessage(source_) + << "corrupt resource table: " << parser.error()); return false; } return true; @@ -187,26 +182,25 @@ bool BinaryResourceParser::ParsePackage(const ResChunk_header* chunk) { uint32_t package_id = util::DeviceToHost32(package_header->id); if (package_id > std::numeric_limits<uint8_t>::max()) { - context_->GetDiagnostics()->Error( - DiagMessage(source_) << "package ID is too big (" << package_id << ")"); + context_->GetDiagnostics()->Error(DiagMessage(source_) + << "package ID is too big (" << package_id << ")"); return false; } // Extract the package name. - size_t len = strnlen16((const char16_t*)package_header->name, - arraysize(package_header->name)); + size_t len = strnlen16((const char16_t*)package_header->name, arraysize(package_header->name)); std::u16string package_name; package_name.resize(len); for (size_t i = 0; i < len; i++) { package_name[i] = util::DeviceToHost16(package_header->name[i]); } - ResourceTablePackage* package = table_->CreatePackage( - util::Utf16ToUtf8(package_name), static_cast<uint8_t>(package_id)); + ResourceTablePackage* package = + table_->CreatePackage(util::Utf16ToUtf8(package_name), static_cast<uint8_t>(package_id)); if (!package) { - context_->GetDiagnostics()->Error( - DiagMessage(source_) << "incompatible package '" << package_name - << "' with ID " << package_id); + context_->GetDiagnostics()->Error(DiagMessage(source_) + << "incompatible package '" << package_name << "' with ID " + << package_id); return false; } @@ -221,23 +215,21 @@ bool BinaryResourceParser::ParsePackage(const ResChunk_header* chunk) { switch (util::DeviceToHost16(parser.chunk()->type)) { case android::RES_STRING_POOL_TYPE: if (type_pool_.getError() == NO_INIT) { - status_t err = type_pool_.setTo( - parser.chunk(), util::DeviceToHost32(parser.chunk()->size)); + status_t err = + type_pool_.setTo(parser.chunk(), util::DeviceToHost32(parser.chunk()->size)); if (err != NO_ERROR) { context_->GetDiagnostics()->Error(DiagMessage(source_) << "corrupt type string pool in " - << "ResTable_package: " - << type_pool_.getError()); + << "ResTable_package: " << type_pool_.getError()); return false; } } else if (key_pool_.getError() == NO_INIT) { - status_t err = key_pool_.setTo( - parser.chunk(), util::DeviceToHost32(parser.chunk()->size)); + status_t err = + key_pool_.setTo(parser.chunk(), util::DeviceToHost32(parser.chunk()->size)); if (err != NO_ERROR) { context_->GetDiagnostics()->Error(DiagMessage(source_) << "corrupt key string pool in " - << "ResTable_package: " - << key_pool_.getError()); + << "ResTable_package: " << key_pool_.getError()); return false; } } else { @@ -272,8 +264,8 @@ bool BinaryResourceParser::ParsePackage(const ResChunk_header* chunk) { } if (parser.event() == ResChunkPullParser::Event::kBadDocument) { - context_->GetDiagnostics()->Error( - DiagMessage(source_) << "corrupt ResTable_package: " << parser.error()); + context_->GetDiagnostics()->Error(DiagMessage(source_) + << "corrupt ResTable_package: " << parser.error()); return false; } @@ -286,22 +278,19 @@ bool BinaryResourceParser::ParsePackage(const ResChunk_header* chunk) { bool BinaryResourceParser::ParseTypeSpec(const ResChunk_header* chunk) { if (type_pool_.getError() != NO_ERROR) { - context_->GetDiagnostics()->Error(DiagMessage(source_) - << "missing type string pool"); + context_->GetDiagnostics()->Error(DiagMessage(source_) << "missing type string pool"); return false; } const ResTable_typeSpec* type_spec = ConvertTo<ResTable_typeSpec>(chunk); if (!type_spec) { - context_->GetDiagnostics()->Error(DiagMessage(source_) - << "corrupt ResTable_typeSpec chunk"); + context_->GetDiagnostics()->Error(DiagMessage(source_) << "corrupt ResTable_typeSpec chunk"); return false; } if (type_spec->id == 0) { context_->GetDiagnostics()->Error(DiagMessage(source_) - << "ResTable_typeSpec has invalid id: " - << type_spec->id); + << "ResTable_typeSpec has invalid id: " << type_spec->id); return false; } return true; @@ -310,14 +299,12 @@ bool BinaryResourceParser::ParseTypeSpec(const ResChunk_header* chunk) { bool BinaryResourceParser::ParseType(const ResourceTablePackage* package, const ResChunk_header* chunk) { if (type_pool_.getError() != NO_ERROR) { - context_->GetDiagnostics()->Error(DiagMessage(source_) - << "missing type string pool"); + context_->GetDiagnostics()->Error(DiagMessage(source_) << "missing type string pool"); return false; } if (key_pool_.getError() != NO_ERROR) { - context_->GetDiagnostics()->Error(DiagMessage(source_) - << "missing key string pool"); + context_->GetDiagnostics()->Error(DiagMessage(source_) << "missing key string pool"); return false; } @@ -325,15 +312,13 @@ bool BinaryResourceParser::ParseType(const ResourceTablePackage* package, // a lot and has its own code to handle variable size. const ResTable_type* type = ConvertTo<ResTable_type, kResTableTypeMinSize>(chunk); if (!type) { - context_->GetDiagnostics()->Error(DiagMessage(source_) - << "corrupt ResTable_type chunk"); + context_->GetDiagnostics()->Error(DiagMessage(source_) << "corrupt ResTable_type chunk"); return false; } if (type->id == 0) { context_->GetDiagnostics()->Error(DiagMessage(source_) - << "ResTable_type has invalid id: " - << (int)type->id); + << "ResTable_type has invalid id: " << (int)type->id); return false; } @@ -344,9 +329,9 @@ bool BinaryResourceParser::ParseType(const ResourceTablePackage* package, const ResourceType* parsed_type = ParseResourceType(type_str); if (!parsed_type) { - context_->GetDiagnostics()->Error( - DiagMessage(source_) << "invalid type name '" << type_str - << "' for type with ID " << (int)type->id); + context_->GetDiagnostics()->Error(DiagMessage(source_) + << "invalid type name '" << type_str << "' for type with ID " + << (int)type->id); return false; } @@ -357,12 +342,10 @@ bool BinaryResourceParser::ParseType(const ResourceTablePackage* package, continue; } - const ResourceName name( - package->name, *parsed_type, - util::GetString(key_pool_, util::DeviceToHost32(entry->key.index))); + const ResourceName name(package->name, *parsed_type, + util::GetString(key_pool_, util::DeviceToHost32(entry->key.index))); - const ResourceId res_id(package->id.value(), type->id, - static_cast<uint16_t>(it.index())); + const ResourceId res_id(package->id.value(), type->id, static_cast<uint16_t>(it.index())); std::unique_ptr<Value> resource_value; if (entry->flags & ResTable_entry::FLAG_COMPLEX) { @@ -377,10 +360,9 @@ bool BinaryResourceParser::ParseType(const ResourceTablePackage* package, } if (!resource_value) { - context_->GetDiagnostics()->Error( - DiagMessage(source_) << "failed to parse value for resource " << name - << " (" << res_id << ") with configuration '" - << config << "'"); + context_->GetDiagnostics()->Error(DiagMessage(source_) + << "failed to parse value for resource " << name << " (" + << res_id << ") with configuration '" << config << "'"); return false; } @@ -433,19 +415,19 @@ std::unique_ptr<Item> BinaryResourceParser::ParseValue(const ResourceNameRef& na if (file_ref != nullptr) { file_ref->file = files_->FindFile(*file_ref->path); if (file_ref->file == nullptr) { - context_->GetDiagnostics()->Warn(DiagMessage() << "resource " << name << " for config '" - << config << "' is a file reference to '" - << *file_ref->path - << "' but no such path exists"); + context_->GetDiagnostics()->Warn(DiagMessage() + << "resource " << name << " for config '" << config + << "' is a file reference to '" << *file_ref->path + << "' but no such path exists"); } } } return item; } -std::unique_ptr<Value> BinaryResourceParser::ParseMapEntry( - const ResourceNameRef& name, const ConfigDescription& config, - const ResTable_map_entry* map) { +std::unique_ptr<Value> BinaryResourceParser::ParseMapEntry(const ResourceNameRef& name, + const ConfigDescription& config, + const ResTable_map_entry* map) { switch (name.type) { case ResourceType::kStyle: return ParseStyle(name, config, map); @@ -470,9 +452,9 @@ std::unique_ptr<Value> BinaryResourceParser::ParseMapEntry( return {}; } -std::unique_ptr<Style> BinaryResourceParser::ParseStyle( - const ResourceNameRef& name, const ConfigDescription& config, - const ResTable_map_entry* map) { +std::unique_ptr<Style> BinaryResourceParser::ParseStyle(const ResourceNameRef& name, + const ConfigDescription& config, + const ResTable_map_entry* map) { std::unique_ptr<Style> style = util::make_unique<Style>(); if (util::DeviceToHost32(map->parent.ident) != 0) { // The parent is a regular reference to a resource. @@ -495,19 +477,16 @@ std::unique_ptr<Style> BinaryResourceParser::ParseStyle( return style; } -std::unique_ptr<Attribute> BinaryResourceParser::ParseAttr( - const ResourceNameRef& name, const ConfigDescription& config, - const ResTable_map_entry* map) { - const bool is_weak = - (util::DeviceToHost16(map->flags) & ResTable_entry::FLAG_WEAK) != 0; +std::unique_ptr<Attribute> BinaryResourceParser::ParseAttr(const ResourceNameRef& name, + const ConfigDescription& config, + const ResTable_map_entry* map) { + const bool is_weak = (util::DeviceToHost16(map->flags) & ResTable_entry::FLAG_WEAK) != 0; std::unique_ptr<Attribute> attr = util::make_unique<Attribute>(is_weak); // First we must discover what type of attribute this is. Find the type mask. - auto type_mask_iter = - std::find_if(begin(map), end(map), [](const ResTable_map& entry) -> bool { - return util::DeviceToHost32(entry.name.ident) == - ResTable_map::ATTR_TYPE; - }); + auto type_mask_iter = std::find_if(begin(map), end(map), [](const ResTable_map& entry) -> bool { + return util::DeviceToHost32(entry.name.ident) == ResTable_map::ATTR_TYPE; + }); if (type_mask_iter != end(map)) { attr->type_mask = util::DeviceToHost32(type_mask_iter->value.data); @@ -526,8 +505,7 @@ std::unique_ptr<Attribute> BinaryResourceParser::ParseAttr( continue; } - if (attr->type_mask & - (ResTable_map::TYPE_ENUM | ResTable_map::TYPE_FLAGS)) { + if (attr->type_mask & (ResTable_map::TYPE_ENUM | ResTable_map::TYPE_FLAGS)) { Attribute::Symbol symbol; symbol.value = util::DeviceToHost32(map_entry.value.data); symbol.symbol = Reference(util::DeviceToHost32(map_entry.name.ident)); @@ -539,9 +517,9 @@ std::unique_ptr<Attribute> BinaryResourceParser::ParseAttr( return attr; } -std::unique_ptr<Array> BinaryResourceParser::ParseArray( - const ResourceNameRef& name, const ConfigDescription& config, - const ResTable_map_entry* map) { +std::unique_ptr<Array> BinaryResourceParser::ParseArray(const ResourceNameRef& name, + const ConfigDescription& config, + const ResTable_map_entry* map) { std::unique_ptr<Array> array = util::make_unique<Array>(); for (const ResTable_map& map_entry : map) { array->elements.push_back(ParseValue(name, config, map_entry.value)); @@ -549,9 +527,9 @@ std::unique_ptr<Array> BinaryResourceParser::ParseArray( return array; } -std::unique_ptr<Plural> BinaryResourceParser::ParsePlural( - const ResourceNameRef& name, const ConfigDescription& config, - const ResTable_map_entry* map) { +std::unique_ptr<Plural> BinaryResourceParser::ParsePlural(const ResourceNameRef& name, + const ConfigDescription& config, + const ResTable_map_entry* map) { std::unique_ptr<Plural> plural = util::make_unique<Plural>(); for (const ResTable_map& map_entry : map) { std::unique_ptr<Item> item = ParseValue(name, config, map_entry.value); diff --git a/tools/aapt2/unflatten/BinaryResourceParser.h b/tools/aapt2/format/binary/BinaryResourceParser.h index c41ada09e551..dc9a3847a9c6 100644 --- a/tools/aapt2/unflatten/BinaryResourceParser.h +++ b/tools/aapt2/format/binary/BinaryResourceParser.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef AAPT_BINARY_RESOURCE_PARSER_H -#define AAPT_BINARY_RESOURCE_PARSER_H +#ifndef AAPT_FORMAT_BINARY_RESOURCEPARSER_H +#define AAPT_FORMAT_BINARY_RESOURCEPARSER_H #include <string> @@ -32,25 +32,17 @@ namespace aapt { struct SymbolTable_entry; -/* - * Parses a binary resource table (resources.arsc) and adds the entries - * to a ResourceTable. This is different than the libandroidfw ResTable - * in that it scans the table from top to bottom and doesn't require - * support for random access. It is also able to parse non-runtime - * chunks and types. - */ +// Parses a binary resource table (resources.arsc) and adds the entries to a ResourceTable. +// This is different than the libandroidfw ResTable in that it scans the table from top to bottom +// and doesn't require support for random access. class BinaryResourceParser { public: - /* - * Creates a parser, which will read `len` bytes from `data`, and - * add any resources parsed to `table`. `source` is for logging purposes. - */ + // Creates a parser, which will read `len` bytes from `data`, and add any resources parsed to + // `table`. `source` is for logging purposes. BinaryResourceParser(IAaptContext* context, ResourceTable* table, const Source& source, const void* data, size_t data_len, io::IFileCollection* files = nullptr); - /* - * Parses the binary resource table and returns true if successful. - */ + // Parses the binary resource table and returns true if successful. bool Parse(); private: @@ -59,31 +51,25 @@ class BinaryResourceParser { bool ParseTable(const android::ResChunk_header* chunk); bool ParsePackage(const android::ResChunk_header* chunk); bool ParseTypeSpec(const android::ResChunk_header* chunk); - bool ParseType(const ResourceTablePackage* package, - const android::ResChunk_header* chunk); + bool ParseType(const ResourceTablePackage* package, const android::ResChunk_header* chunk); bool ParseLibrary(const android::ResChunk_header* chunk); std::unique_ptr<Item> ParseValue(const ResourceNameRef& name, const ConfigDescription& config, const android::Res_value& value); - std::unique_ptr<Value> ParseMapEntry(const ResourceNameRef& name, - const ConfigDescription& config, + std::unique_ptr<Value> ParseMapEntry(const ResourceNameRef& name, const ConfigDescription& config, const android::ResTable_map_entry* map); - std::unique_ptr<Style> ParseStyle(const ResourceNameRef& name, - const ConfigDescription& config, + std::unique_ptr<Style> ParseStyle(const ResourceNameRef& name, const ConfigDescription& config, const android::ResTable_map_entry* map); - std::unique_ptr<Attribute> ParseAttr(const ResourceNameRef& name, - const ConfigDescription& config, + std::unique_ptr<Attribute> ParseAttr(const ResourceNameRef& name, const ConfigDescription& config, const android::ResTable_map_entry* map); - std::unique_ptr<Array> ParseArray(const ResourceNameRef& name, - const ConfigDescription& config, + std::unique_ptr<Array> ParseArray(const ResourceNameRef& name, const ConfigDescription& config, const android::ResTable_map_entry* map); - std::unique_ptr<Plural> ParsePlural(const ResourceNameRef& name, - const ConfigDescription& config, + std::unique_ptr<Plural> ParsePlural(const ResourceNameRef& name, const ConfigDescription& config, const android::ResTable_map_entry* map); /** @@ -125,13 +111,10 @@ class BinaryResourceParser { namespace android { -/** - * Iterator functionality for ResTable_map_entry. - */ +// Iterator functionality for ResTable_map_entry. inline const ResTable_map* begin(const ResTable_map_entry* map) { - return (const ResTable_map*)((const uint8_t*)map + - aapt::util::DeviceToHost32(map->size)); + return (const ResTable_map*)((const uint8_t*)map + ::aapt::util::DeviceToHost32(map->size)); } inline const ResTable_map* end(const ResTable_map_entry* map) { @@ -140,4 +123,4 @@ inline const ResTable_map* end(const ResTable_map_entry* map) { } // namespace android -#endif // AAPT_BINARY_RESOURCE_PARSER_H +#endif // AAPT_FORMAT_BINARY_RESOURCEPARSER_H diff --git a/tools/aapt2/flatten/ChunkWriter.h b/tools/aapt2/format/binary/ChunkWriter.h index 968d3eef48ec..1892a295dcf5 100644 --- a/tools/aapt2/flatten/ChunkWriter.h +++ b/tools/aapt2/format/binary/ChunkWriter.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef AAPT_FLATTEN_CHUNKWRITER_H -#define AAPT_FLATTEN_CHUNKWRITER_H +#ifndef AAPT_FORMAT_BINARY_CHUNKWRITER_H +#define AAPT_FORMAT_BINARY_CHUNKWRITER_H #include "android-base/macros.h" #include "androidfw/ResourceTypes.h" @@ -27,7 +27,8 @@ namespace aapt { class ChunkWriter { public: - explicit inline ChunkWriter(BigBuffer* buffer) : buffer_(buffer) {} + explicit inline ChunkWriter(BigBuffer* buffer) : buffer_(buffer) { + } ChunkWriter(ChunkWriter&&) = default; ChunkWriter& operator=(ChunkWriter&&) = default; @@ -46,11 +47,17 @@ class ChunkWriter { return buffer_->NextBlock<T>(count); } - inline BigBuffer* buffer() { return buffer_; } + inline BigBuffer* buffer() { + return buffer_; + } - inline android::ResChunk_header* chunk_header() { return header_; } + inline android::ResChunk_header* chunk_header() { + return header_; + } - inline size_t size() { return buffer_->size() - start_size_; } + inline size_t size() { + return buffer_->size() - start_size_; + } inline android::ResChunk_header* Finish() { buffer_->Align4(); @@ -77,4 +84,4 @@ inline android::ResChunk_header* ChunkWriter::StartChunk(uint16_t type) { } // namespace aapt -#endif /* AAPT_FLATTEN_CHUNKWRITER_H */ +#endif /* AAPT_FORMAT_BINARY_CHUNKWRITER_H */ diff --git a/tools/aapt2/unflatten/ResChunkPullParser.cpp b/tools/aapt2/format/binary/ResChunkPullParser.cpp index 8d92bd94b0ae..fd6919d1de60 100644 --- a/tools/aapt2/unflatten/ResChunkPullParser.cpp +++ b/tools/aapt2/format/binary/ResChunkPullParser.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "unflatten/ResChunkPullParser.h" +#include "format/binary/ResChunkPullParser.h" #include <inttypes.h> #include <cstddef> @@ -44,9 +44,8 @@ ResChunkPullParser::Event ResChunkPullParser::Next() { if (event_ == Event::kStartDocument) { current_chunk_ = data_; } else { - current_chunk_ = - (const ResChunk_header*)(((const char*)current_chunk_) + - util::DeviceToHost32(current_chunk_->size)); + current_chunk_ = (const ResChunk_header*)(((const char*)current_chunk_) + + util::DeviceToHost32(current_chunk_->size)); } const std::ptrdiff_t diff = (const char*)current_chunk_ - (const char*)data_; diff --git a/tools/aapt2/unflatten/ResChunkPullParser.h b/tools/aapt2/format/binary/ResChunkPullParser.h index 58277531034c..5ff13598a31d 100644 --- a/tools/aapt2/unflatten/ResChunkPullParser.h +++ b/tools/aapt2/format/binary/ResChunkPullParser.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef AAPT_RES_CHUNK_PULL_PARSER_H -#define AAPT_RES_CHUNK_PULL_PARSER_H +#ifndef AAPT_FORMAT_BINARY_RESCHUNKPULLPARSER_H +#define AAPT_FORMAT_BINARY_RESCHUNKPULLPARSER_H #include <string> @@ -26,18 +26,13 @@ namespace aapt { -/** - * A pull parser, modeled after XmlPullParser, that reads - * android::ResChunk_header structs from a block of data. - * - * An android::ResChunk_header specifies a type, headerSize, - * and size. The pull parser will verify that the chunk's size - * doesn't extend beyond the available data, and will iterate - * over each chunk in the given block of data. - * - * Processing nested chunks is done by creating a new ResChunkPullParser - * pointing to the data portion of a chunk. - */ +// A pull parser, modeled after XmlPullParser, that reads android::ResChunk_header structs from a +// block of data. +// An android::ResChunk_header specifies a type, headerSize, and size. The pull parser will verify +// that the chunk's size doesn't extend beyond the available data, and will iterate over each chunk +// in the given block of data. +// Processing nested chunks is done by creating a new ResChunkPullParser pointing to the data +// portion of a chunk. class ResChunkPullParser { public: enum class Event { @@ -48,24 +43,18 @@ class ResChunkPullParser { kChunk, }; - /** - * Returns false if the event is EndDocument or BadDocument. - */ + // Returns false if the event is EndDocument or BadDocument. static bool IsGoodEvent(Event event); - /** - * Create a ResChunkPullParser to read android::ResChunk_headers - * from the memory pointed to by data, of len bytes. - */ + // Create a ResChunkPullParser to read android::ResChunk_headers from the memory pointed to by + // data, of len bytes. ResChunkPullParser(const void* data, size_t len); Event event() const; const std::string& error() const; const android::ResChunk_header* chunk() const; - /** - * Move to the next android::ResChunk_header. - */ + // Move to the next android::ResChunk_header. Event Next(); private: @@ -86,15 +75,12 @@ inline static const T* ConvertTo(const android::ResChunk_header* chunk) { return reinterpret_cast<const T*>(chunk); } -inline static const uint8_t* GetChunkData( - const android::ResChunk_header* chunk) { - return reinterpret_cast<const uint8_t*>(chunk) + - util::DeviceToHost16(chunk->headerSize); +inline static const uint8_t* GetChunkData(const android::ResChunk_header* chunk) { + return reinterpret_cast<const uint8_t*>(chunk) + util::DeviceToHost16(chunk->headerSize); } inline static uint32_t GetChunkDataLen(const android::ResChunk_header* chunk) { - return util::DeviceToHost32(chunk->size) - - util::DeviceToHost16(chunk->headerSize); + return util::DeviceToHost32(chunk->size) - util::DeviceToHost16(chunk->headerSize); } // @@ -109,13 +95,16 @@ inline ResChunkPullParser::ResChunkPullParser(const void* data, size_t len) : event_(Event::kStartDocument), data_(reinterpret_cast<const android::ResChunk_header*>(data)), len_(len), - current_chunk_(nullptr) {} + current_chunk_(nullptr) { +} inline ResChunkPullParser::Event ResChunkPullParser::event() const { return event_; } -inline const std::string& ResChunkPullParser::error() const { return error_; } +inline const std::string& ResChunkPullParser::error() const { + return error_; +} inline const android::ResChunk_header* ResChunkPullParser::chunk() const { return current_chunk_; @@ -123,4 +112,4 @@ inline const android::ResChunk_header* ResChunkPullParser::chunk() const { } // namespace aapt -#endif // AAPT_RES_CHUNK_PULL_PARSER_H +#endif // AAPT_FORMAT_BINARY_RESCHUNKPULLPARSER_H diff --git a/tools/aapt2/flatten/ResourceTypeExtensions.h b/tools/aapt2/format/binary/ResourceTypeExtensions.h index 6359b4143f1e..7f58df808cc7 100644 --- a/tools/aapt2/flatten/ResourceTypeExtensions.h +++ b/tools/aapt2/format/binary/ResourceTypeExtensions.h @@ -14,18 +14,14 @@ * limitations under the License. */ -#ifndef AAPT_RESOURCE_TYPE_EXTENSIONS_H -#define AAPT_RESOURCE_TYPE_EXTENSIONS_H +#ifndef AAPT_FORMAT_BINARY_RESOURCETYPEEXTENSIONS_H +#define AAPT_FORMAT_BINARY_RESOURCETYPEEXTENSIONS_H #include "androidfw/ResourceTypes.h" namespace aapt { -/** - * An alternative struct to use instead of ResTable_map_entry. This one is a - * standard_layout - * struct. - */ +// An alternative struct to use instead of ResTable_map_entry. This one is a standard_layout struct. struct ResTable_entry_ext { android::ResTable_entry entry; android::ResTable_ref parent; @@ -34,4 +30,4 @@ struct ResTable_entry_ext { } // namespace aapt -#endif // AAPT_RESOURCE_TYPE_EXTENSIONS_H +#endif // AAPT_FORMAT_BINARY_RESOURCETYPEEXTENSIONS_H diff --git a/tools/aapt2/flatten/TableFlattener.cpp b/tools/aapt2/format/binary/TableFlattener.cpp index 097727c9f470..57565a53794b 100644 --- a/tools/aapt2/flatten/TableFlattener.cpp +++ b/tools/aapt2/format/binary/TableFlattener.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "flatten/TableFlattener.h" +#include "format/binary/TableFlattener.h" #include <algorithm> #include <numeric> @@ -28,8 +28,8 @@ #include "ResourceValues.h" #include "SdkConstants.h" #include "ValueVisitor.h" -#include "flatten/ChunkWriter.h" -#include "flatten/ResourceTypeExtensions.h" +#include "format/binary/ChunkWriter.h" +#include "format/binary/ResourceTypeExtensions.h" #include "util/BigBuffer.h" using namespace android; @@ -81,7 +81,8 @@ class MapFlattenVisitor : public ValueVisitor { using ValueVisitor::Visit; MapFlattenVisitor(ResTable_entry_ext* out_entry, BigBuffer* buffer) - : out_entry_(out_entry), buffer_(buffer) {} + : out_entry_(out_entry), buffer_(buffer) { + } void Visit(Attribute* attr) override { { @@ -92,15 +93,13 @@ class MapFlattenVisitor : public ValueVisitor { if (attr->min_int != std::numeric_limits<int32_t>::min()) { Reference key = Reference(ResourceId(ResTable_map::ATTR_MIN)); - BinaryPrimitive val(Res_value::TYPE_INT_DEC, - static_cast<uint32_t>(attr->min_int)); + BinaryPrimitive val(Res_value::TYPE_INT_DEC, static_cast<uint32_t>(attr->min_int)); FlattenEntry(&key, &val); } if (attr->max_int != std::numeric_limits<int32_t>::max()) { Reference key = Reference(ResourceId(ResTable_map::ATTR_MAX)); - BinaryPrimitive val(Res_value::TYPE_INT_DEC, - static_cast<uint32_t>(attr->max_int)); + BinaryPrimitive val(Res_value::TYPE_INT_DEC, static_cast<uint32_t>(attr->max_int)); FlattenEntry(&key, &val); } @@ -188,7 +187,9 @@ class MapFlattenVisitor : public ValueVisitor { * Call this after visiting a Value. This will finish any work that * needs to be done to prepare the entry. */ - void Finish() { out_entry_->count = util::HostToDevice32(entry_count_); } + void Finish() { + out_entry_->count = util::HostToDevice32(entry_count_); + } private: DISALLOW_COPY_AND_ASSIGN(MapFlattenVisitor); @@ -223,7 +224,8 @@ class PackageFlattener { diag_(context->GetDiagnostics()), package_(package), shared_libs_(shared_libs), - use_sparse_entries_(use_sparse_entries) {} + use_sparse_entries_(use_sparse_entries) { + } bool FlattenPackage(BigBuffer* buffer) { ChunkWriter pkg_writer(buffer); @@ -271,9 +273,9 @@ class PackageFlattener { template <typename T, bool IsItem> T* WriteEntry(FlatEntry* entry, BigBuffer* buffer) { - static_assert(std::is_same<ResTable_entry, T>::value || - std::is_same<ResTable_entry_ext, T>::value, - "T must be ResTable_entry or ResTable_entry_ext"); + static_assert( + std::is_same<ResTable_entry, T>::value || std::is_same<ResTable_entry_ext, T>::value, + "T must be ResTable_entry or ResTable_entry_ext"); T* result = buffer->NextBlock<T>(); ResTable_entry* out_entry = (ResTable_entry*)result; @@ -302,8 +304,7 @@ class PackageFlattener { CHECK(item->Flatten(outValue)) << "flatten failed"; outValue->size = util::HostToDevice16(sizeof(*outValue)); } else { - ResTable_entry_ext* out_entry = - WriteEntry<ResTable_entry_ext, false>(entry, buffer); + ResTable_entry_ext* out_entry = WriteEntry<ResTable_entry_ext, false>(entry, buffer); MapFlattenVisitor visitor(out_entry, buffer); entry->value->Accept(&visitor); visitor.Finish(); @@ -318,8 +319,7 @@ class PackageFlattener { CHECK(num_total_entries <= std::numeric_limits<uint16_t>::max()); ChunkWriter type_writer(buffer); - ResTable_type* type_header = - type_writer.StartChunk<ResTable_type>(RES_TABLE_TYPE_TYPE); + ResTable_type* type_header = type_writer.StartChunk<ResTable_type>(RES_TABLE_TYPE_TYPE); type_header->id = type->id.value(); type_header->config = config; type_header->config.swapHtoD(); @@ -395,8 +395,7 @@ class PackageFlattener { sorted_types.push_back(type.get()); } - std::sort(sorted_types.begin(), sorted_types.end(), - cmp_ids<ResourceTableType>); + std::sort(sorted_types.begin(), sorted_types.end(), cmp_ids<ResourceTableType>); return sorted_types; } @@ -411,13 +410,11 @@ class PackageFlattener { return sorted_entries; } - bool FlattenTypeSpec(ResourceTableType* type, - std::vector<ResourceEntry*>* sorted_entries, + bool FlattenTypeSpec(ResourceTableType* type, std::vector<ResourceEntry*>* sorted_entries, BigBuffer* buffer) { ChunkWriter type_spec_writer(buffer); ResTable_typeSpec* spec_header = - type_spec_writer.StartChunk<ResTable_typeSpec>( - RES_TABLE_TYPE_SPEC_TYPE); + type_spec_writer.StartChunk<ResTable_typeSpec>(RES_TABLE_TYPE_SPEC_TYPE); spec_header->id = type->id.value(); if (sorted_entries->empty()) { @@ -443,8 +440,7 @@ class PackageFlattener { // Populate the config masks for this entry. if (entry->symbol_status.state == SymbolState::kPublic) { - config_masks[entry->id.value()] |= - util::HostToDevice32(ResTable_typeSpec::SPEC_PUBLIC); + config_masks[entry->id.value()] |= util::HostToDevice32(ResTable_typeSpec::SPEC_PUBLIC); } const size_t config_count = entry->values.size(); diff --git a/tools/aapt2/flatten/TableFlattener.h b/tools/aapt2/format/binary/TableFlattener.h index 223aef8119c0..88cbddfd14ab 100644 --- a/tools/aapt2/flatten/TableFlattener.h +++ b/tools/aapt2/format/binary/TableFlattener.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef AAPT_FLATTEN_TABLEFLATTENER_H -#define AAPT_FLATTEN_TABLEFLATTENER_H +#ifndef AAPT_FORMAT_BINARY_TABLEFLATTENER_H +#define AAPT_FORMAT_BINARY_TABLEFLATTENER_H #include "android-base/macros.h" @@ -40,7 +40,8 @@ struct TableFlattenerOptions { class TableFlattener : public IResourceTableConsumer { public: explicit TableFlattener(const TableFlattenerOptions& options, BigBuffer* buffer) - : options_(options), buffer_(buffer) {} + : options_(options), buffer_(buffer) { + } bool Consume(IAaptContext* context, ResourceTable* table) override; @@ -53,4 +54,4 @@ class TableFlattener : public IResourceTableConsumer { } // namespace aapt -#endif /* AAPT_FLATTEN_TABLEFLATTENER_H */ +#endif /* AAPT_FORMAT_BINARY_TABLEFLATTENER_H */ diff --git a/tools/aapt2/flatten/TableFlattener_test.cpp b/tools/aapt2/format/binary/TableFlattener_test.cpp index 4fdb2eced59b..6d7597372234 100644 --- a/tools/aapt2/flatten/TableFlattener_test.cpp +++ b/tools/aapt2/format/binary/TableFlattener_test.cpp @@ -14,14 +14,14 @@ * limitations under the License. */ -#include "flatten/TableFlattener.h" +#include "format/binary/TableFlattener.h" #include "android-base/stringprintf.h" #include "ResourceUtils.h" #include "SdkConstants.h" +#include "format/binary/BinaryResourceParser.h" #include "test/Test.h" -#include "unflatten/BinaryResourceParser.h" #include "util/Util.h" using namespace android; @@ -34,10 +34,8 @@ namespace aapt { class TableFlattenerTest : public ::testing::Test { public: void SetUp() override { - context_ = test::ContextBuilder() - .SetCompilationPackage("com.app.test") - .SetPackageId(0x7f) - .Build(); + context_ = + test::ContextBuilder().SetCompilationPackage("com.app.test").SetPackageId(0x7f).Build(); } ::testing::AssertionResult Flatten(IAaptContext* context, const TableFlattenerOptions& options, @@ -80,12 +78,10 @@ class TableFlattenerTest : public ::testing::Test { return ::testing::AssertionSuccess(); } - ::testing::AssertionResult Exists(ResTable* table, - const StringPiece& expected_name, + ::testing::AssertionResult Exists(ResTable* table, const StringPiece& expected_name, const ResourceId& expected_id, const ConfigDescription& expected_config, - const uint8_t expected_data_type, - const uint32_t expected_data, + const uint8_t expected_data_type, const uint32_t expected_data, const uint32_t expected_spec_flags) { const ResourceName expected_res_name = test::ParseNameOrDie(expected_name); @@ -94,28 +90,26 @@ class TableFlattenerTest : public ::testing::Test { ResTable_config config; Res_value val; uint32_t spec_flags; - if (table->getResource(expected_id.id, &val, false, 0, &spec_flags, - &config) < 0) { + if (table->getResource(expected_id.id, &val, false, 0, &spec_flags, &config) < 0) { return ::testing::AssertionFailure() << "could not find resource with"; } if (expected_data_type != val.dataType) { return ::testing::AssertionFailure() << "expected data type " << std::hex << (int)expected_data_type - << " but got data type " << (int)val.dataType << std::dec - << " instead"; + << " but got data type " << (int)val.dataType << std::dec << " instead"; } if (expected_data != val.data) { return ::testing::AssertionFailure() - << "expected data " << std::hex << expected_data - << " but got data " << val.data << std::dec << " instead"; + << "expected data " << std::hex << expected_data << " but got data " << val.data + << std::dec << " instead"; } if (expected_spec_flags != spec_flags) { return ::testing::AssertionFailure() - << "expected specFlags " << std::hex << expected_spec_flags - << " but got specFlags " << spec_flags << std::dec << " instead"; + << "expected specFlags " << std::hex << expected_spec_flags << " but got specFlags " + << spec_flags << std::dec << " instead"; } ResTable::resource_name actual_name; @@ -127,16 +121,14 @@ class TableFlattenerTest : public ::testing::Test { if (!resName) { return ::testing::AssertionFailure() << "expected name '" << expected_res_name << "' but got '" - << StringPiece16(actual_name.package, actual_name.packageLen) - << ":" << StringPiece16(actual_name.type, actual_name.typeLen) - << "/" << StringPiece16(actual_name.name, actual_name.nameLen) - << "'"; + << StringPiece16(actual_name.package, actual_name.packageLen) << ":" + << StringPiece16(actual_name.type, actual_name.typeLen) << "/" + << StringPiece16(actual_name.name, actual_name.nameLen) << "'"; } if (expected_config != config) { - return ::testing::AssertionFailure() << "expected config '" - << expected_config << "' but got '" - << ConfigDescription(config) << "'"; + return ::testing::AssertionFailure() << "expected config '" << expected_config + << "' but got '" << ConfigDescription(config) << "'"; } return ::testing::AssertionSuccess(); } @@ -152,57 +144,46 @@ TEST_F(TableFlattenerTest, FlattenFullyLinkedTable) { .AddSimple("com.app.test:id/one", ResourceId(0x7f020000)) .AddSimple("com.app.test:id/two", ResourceId(0x7f020001)) .AddValue("com.app.test:id/three", ResourceId(0x7f020002), - test::BuildReference("com.app.test:id/one", - ResourceId(0x7f020000))) + test::BuildReference("com.app.test:id/one", ResourceId(0x7f020000))) .AddValue("com.app.test:integer/one", ResourceId(0x7f030000), - util::make_unique<BinaryPrimitive>( - uint8_t(Res_value::TYPE_INT_DEC), 1u)) + util::make_unique<BinaryPrimitive>(uint8_t(Res_value::TYPE_INT_DEC), 1u)) .AddValue("com.app.test:integer/one", test::ParseConfigOrDie("v1"), ResourceId(0x7f030000), - util::make_unique<BinaryPrimitive>( - uint8_t(Res_value::TYPE_INT_DEC), 2u)) + util::make_unique<BinaryPrimitive>(uint8_t(Res_value::TYPE_INT_DEC), 2u)) .AddString("com.app.test:string/test", ResourceId(0x7f040000), "foo") - .AddString("com.app.test:layout/bar", ResourceId(0x7f050000), - "res/layout/bar.xml") + .AddString("com.app.test:layout/bar", ResourceId(0x7f050000), "res/layout/bar.xml") .Build(); ResTable res_table; ASSERT_TRUE(Flatten(context_.get(), {}, table.get(), &res_table)); - EXPECT_TRUE(Exists(&res_table, "com.app.test:id/one", ResourceId(0x7f020000), - {}, Res_value::TYPE_INT_BOOLEAN, 0u, 0u)); + EXPECT_TRUE(Exists(&res_table, "com.app.test:id/one", ResourceId(0x7f020000), {}, + Res_value::TYPE_INT_BOOLEAN, 0u, 0u)); - EXPECT_TRUE(Exists(&res_table, "com.app.test:id/two", ResourceId(0x7f020001), - {}, Res_value::TYPE_INT_BOOLEAN, 0u, 0u)); + EXPECT_TRUE(Exists(&res_table, "com.app.test:id/two", ResourceId(0x7f020001), {}, + Res_value::TYPE_INT_BOOLEAN, 0u, 0u)); - EXPECT_TRUE(Exists(&res_table, "com.app.test:id/three", - ResourceId(0x7f020002), {}, Res_value::TYPE_REFERENCE, - 0x7f020000u, 0u)); + EXPECT_TRUE(Exists(&res_table, "com.app.test:id/three", ResourceId(0x7f020002), {}, + Res_value::TYPE_REFERENCE, 0x7f020000u, 0u)); - EXPECT_TRUE(Exists(&res_table, "com.app.test:integer/one", - ResourceId(0x7f030000), {}, Res_value::TYPE_INT_DEC, 1u, - ResTable_config::CONFIG_VERSION)); + EXPECT_TRUE(Exists(&res_table, "com.app.test:integer/one", ResourceId(0x7f030000), {}, + Res_value::TYPE_INT_DEC, 1u, ResTable_config::CONFIG_VERSION)); - EXPECT_TRUE(Exists(&res_table, "com.app.test:integer/one", - ResourceId(0x7f030000), test::ParseConfigOrDie("v1"), - Res_value::TYPE_INT_DEC, 2u, + EXPECT_TRUE(Exists(&res_table, "com.app.test:integer/one", ResourceId(0x7f030000), + test::ParseConfigOrDie("v1"), Res_value::TYPE_INT_DEC, 2u, ResTable_config::CONFIG_VERSION)); std::u16string foo_str = u"foo"; - ssize_t idx = res_table.getTableStringBlock(0)->indexOfString(foo_str.data(), - foo_str.size()); + ssize_t idx = res_table.getTableStringBlock(0)->indexOfString(foo_str.data(), foo_str.size()); ASSERT_GE(idx, 0); - EXPECT_TRUE(Exists(&res_table, "com.app.test:string/test", - ResourceId(0x7f040000), {}, Res_value::TYPE_STRING, - (uint32_t)idx, 0u)); + EXPECT_TRUE(Exists(&res_table, "com.app.test:string/test", ResourceId(0x7f040000), {}, + Res_value::TYPE_STRING, (uint32_t)idx, 0u)); std::u16string bar_path = u"res/layout/bar.xml"; - idx = res_table.getTableStringBlock(0)->indexOfString(bar_path.data(), - bar_path.size()); + idx = res_table.getTableStringBlock(0)->indexOfString(bar_path.data(), bar_path.size()); ASSERT_GE(idx, 0); - EXPECT_TRUE(Exists(&res_table, "com.app.test:layout/bar", - ResourceId(0x7f050000), {}, Res_value::TYPE_STRING, - (uint32_t)idx, 0u)); + EXPECT_TRUE(Exists(&res_table, "com.app.test:layout/bar", ResourceId(0x7f050000), {}, + Res_value::TYPE_STRING, (uint32_t)idx, 0u)); } TEST_F(TableFlattenerTest, FlattenEntriesWithGapsInIds) { @@ -216,11 +197,10 @@ TEST_F(TableFlattenerTest, FlattenEntriesWithGapsInIds) { ResTable res_table; ASSERT_TRUE(Flatten(context_.get(), {}, table.get(), &res_table)); - EXPECT_TRUE(Exists(&res_table, "com.app.test:id/one", ResourceId(0x7f020001), - {}, Res_value::TYPE_INT_BOOLEAN, 0u, 0u)); - EXPECT_TRUE(Exists(&res_table, "com.app.test:id/three", - ResourceId(0x7f020003), {}, Res_value::TYPE_INT_BOOLEAN, - 0u, 0u)); + EXPECT_TRUE(Exists(&res_table, "com.app.test:id/one", ResourceId(0x7f020001), {}, + Res_value::TYPE_INT_BOOLEAN, 0u, 0u)); + EXPECT_TRUE(Exists(&res_table, "com.app.test:id/three", ResourceId(0x7f020003), {}, + Res_value::TYPE_INT_BOOLEAN, 0u, 0u)); } TEST_F(TableFlattenerTest, FlattenMinMaxAttributes) { @@ -231,8 +211,7 @@ TEST_F(TableFlattenerTest, FlattenMinMaxAttributes) { std::unique_ptr<ResourceTable> table = test::ResourceTableBuilder() .SetPackageId("android", 0x01) - .AddValue("android:attr/foo", ResourceId(0x01010000), - util::make_unique<Attribute>(attr)) + .AddValue("android:attr/foo", ResourceId(0x01010000), util::make_unique<Attribute>(attr)) .Build(); ResourceTable result; @@ -308,9 +287,12 @@ TEST_F(TableFlattenerTest, FlattenSparseEntryWithMinSdkO) { ASSERT_THAT(value, NotNull()); EXPECT_EQ(0u, value->value.data); - ASSERT_THAT(test::GetValueForConfig<BinaryPrimitive>(&sparse_table, "android:string/foo_1", sparse_config), IsNull()); + ASSERT_THAT(test::GetValueForConfig<BinaryPrimitive>(&sparse_table, "android:string/foo_1", + sparse_config), + IsNull()); - value = test::GetValueForConfig<BinaryPrimitive>(&sparse_table, "android:string/foo_4", sparse_config); + value = test::GetValueForConfig<BinaryPrimitive>(&sparse_table, "android:string/foo_4", + sparse_config); ASSERT_THAT(value, NotNull()); EXPECT_EQ(4u, value->value.data); } diff --git a/tools/aapt2/flatten/XmlFlattener.cpp b/tools/aapt2/format/binary/XmlFlattener.cpp index b3b308a29fc5..f8f09ab0d2a5 100644 --- a/tools/aapt2/flatten/XmlFlattener.cpp +++ b/tools/aapt2/format/binary/XmlFlattener.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "flatten/XmlFlattener.h" +#include "format/binary/XmlFlattener.h" #include <algorithm> #include <map> @@ -26,8 +26,8 @@ #include "utils/misc.h" #include "SdkConstants.h" -#include "flatten/ChunkWriter.h" -#include "flatten/ResourceTypeExtensions.h" +#include "format/binary/ChunkWriter.h" +#include "format/binary/ResourceTypeExtensions.h" #include "xml/XmlDom.h" using namespace android; @@ -71,7 +71,8 @@ class XmlFlattenerVisitor : public xml::Visitor { std::vector<StringFlattenDest> string_refs; XmlFlattenerVisitor(BigBuffer* buffer, XmlFlattenerOptions options) - : buffer_(buffer), options_(options) {} + : buffer_(buffer), options_(options) { + } void Visit(xml::Text* node) override { if (util::TrimWhitespace(node->text).empty()) { @@ -152,15 +153,14 @@ class XmlFlattenerVisitor : public xml::Visitor { private: DISALLOW_COPY_AND_ASSIGN(XmlFlattenerVisitor); - void AddString(const StringPiece& str, uint32_t priority, - android::ResStringPool_ref* dest, + void AddString(const StringPiece& str, uint32_t priority, android::ResStringPool_ref* dest, bool treat_empty_string_as_null = false) { if (str.empty() && treat_empty_string_as_null) { // Some parts of the runtime treat null differently than empty string. dest->index = util::DeviceToHost32(-1); } else { - string_refs.push_back(StringFlattenDest{ - pool.MakeRef(str, StringPool::Context(priority)), dest}); + string_refs.push_back( + StringFlattenDest{pool.MakeRef(str, StringPool::Context(priority)), dest}); } } @@ -208,8 +208,7 @@ class XmlFlattenerVisitor : public xml::Visitor { uint16_t attribute_index = 1; for (const xml::Attribute* xml_attr : filtered_attrs_) { // Assign the indices for specific attributes. - if (xml_attr->compiled_attribute && - xml_attr->compiled_attribute.value().id && + if (xml_attr->compiled_attribute && xml_attr->compiled_attribute.value().id && xml_attr->compiled_attribute.value().id.value() == kIdAttr) { flat_elem->idIndex = util::HostToDevice16(attribute_index); } else if (xml_attr->namespace_uri.empty()) { @@ -241,9 +240,8 @@ class XmlFlattenerVisitor : public xml::Visitor { // Lookup the StringPool for this package and make the reference there. const xml::AaptAttribute& aapt_attr = xml_attr->compiled_attribute.value(); - StringPool::Ref name_ref = - package_pools[aapt_attr.id.value().package_id()].MakeRef( - xml_attr->name, StringPool::Context(aapt_attr.id.value().id)); + StringPool::Ref name_ref = package_pools[aapt_attr.id.value().package_id()].MakeRef( + xml_attr->name, StringPool::Context(aapt_attr.id.value().id)); // Add it to the list of strings to flatten. AddString(name_ref, &flat_attr->name); @@ -272,7 +270,7 @@ class XmlFlattenerVisitor : public xml::Visitor { flat_attr->typedValue.dataType = android::Res_value::TYPE_STRING; AddString(str_builder.ToString(), kLowPriority, - (ResStringPool_ref*) &flat_attr->typedValue.data); + (ResStringPool_ref*)&flat_attr->typedValue.data); } flat_attr->typedValue.size = util::HostToDevice16(sizeof(flat_attr->typedValue)); diff --git a/tools/aapt2/flatten/XmlFlattener.h b/tools/aapt2/format/binary/XmlFlattener.h index 87557f29f3be..6a4883512907 100644 --- a/tools/aapt2/flatten/XmlFlattener.h +++ b/tools/aapt2/format/binary/XmlFlattener.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef AAPT_FLATTEN_XMLFLATTENER_H -#define AAPT_FLATTEN_XMLFLATTENER_H +#ifndef AAPT_FORMAT_BINARY_XMLFLATTENER_H +#define AAPT_FORMAT_BINARY_XMLFLATTENER_H #include "android-base/macros.h" @@ -26,16 +26,15 @@ namespace aapt { struct XmlFlattenerOptions { - /** - * Keep attribute raw string values along with typed values. - */ + // Keep attribute raw string values along with typed values. bool keep_raw_values = false; }; class XmlFlattener : public IXmlResourceConsumer { public: XmlFlattener(BigBuffer* buffer, XmlFlattenerOptions options) - : buffer_(buffer), options_(options) {} + : buffer_(buffer), options_(options) { + } bool Consume(IAaptContext* context, xml::XmlResource* resource) override; @@ -50,4 +49,4 @@ class XmlFlattener : public IXmlResourceConsumer { } // namespace aapt -#endif /* AAPT_FLATTEN_XMLFLATTENER_H */ +#endif /* AAPT_FORMAT_BINARY_XMLFLATTENER_H */ diff --git a/tools/aapt2/flatten/XmlFlattener_test.cpp b/tools/aapt2/format/binary/XmlFlattener_test.cpp index a57e3178accd..0450f6c16de5 100644 --- a/tools/aapt2/flatten/XmlFlattener_test.cpp +++ b/tools/aapt2/format/binary/XmlFlattener_test.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "flatten/XmlFlattener.h" +#include "format/binary/XmlFlattener.h" #include "androidfw/ResourceTypes.h" @@ -55,8 +55,7 @@ class XmlFlattenerTest : public ::testing::Test { .Build(); } - ::testing::AssertionResult Flatten(xml::XmlResource* doc, - android::ResXMLTree* out_tree, + ::testing::AssertionResult Flatten(xml::XmlResource* doc, android::ResXMLTree* out_tree, const XmlFlattenerOptions& options = {}) { using namespace android; // For NO_ERROR on windows because it is a macro. diff --git a/tools/aapt2/proto/ProtoDeserialize.cpp b/tools/aapt2/format/proto/ProtoDeserialize.cpp index dc138818fcc5..c14f09a3b103 100644 --- a/tools/aapt2/proto/ProtoDeserialize.cpp +++ b/tools/aapt2/format/proto/ProtoDeserialize.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "proto/ProtoDeserialize.h" +#include "format/proto/ProtoDeserialize.h" #include "android-base/logging.h" #include "android-base/macros.h" @@ -699,11 +699,11 @@ std::unique_ptr<Value> DeserializeValueFromPb(const pb::Value& pb_value, } break; default: - LOG(FATAL) << "unknown compound value: " << (int) pb_compound_value.value_case(); + LOG(FATAL) << "unknown compound value: " << (int)pb_compound_value.value_case(); break; } } else { - LOG(FATAL) << "unknown value: " << (int) pb_value.value_case(); + LOG(FATAL) << "unknown value: " << (int)pb_value.value_case(); return {}; } @@ -764,7 +764,7 @@ std::unique_ptr<Item> DeserializeItemFromPb(const pb::Item& pb_item, } break; default: - LOG(FATAL) << "unknown item: " << (int) pb_item.value_case(); + LOG(FATAL) << "unknown item: " << (int)pb_item.value_case(); break; } return {}; @@ -840,7 +840,7 @@ bool DeserializeXmlFromPb(const pb::XmlNode& pb_node, xml::Element* out_el, Stri } break; default: - LOG(FATAL) << "unknown XmlNode " << (int) pb_child.node_case(); + LOG(FATAL) << "unknown XmlNode " << (int)pb_child.node_case(); break; } } diff --git a/tools/aapt2/proto/ProtoDeserialize.h b/tools/aapt2/format/proto/ProtoDeserialize.h index 3d76ea4ba0aa..c8a7199eb8b5 100644 --- a/tools/aapt2/proto/ProtoDeserialize.h +++ b/tools/aapt2/format/proto/ProtoDeserialize.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef AAPT_PROTO_PROTODESERIALIZE_H -#define AAPT_PROTO_PROTODESERIALIZE_H +#ifndef AAPT_FORMAT_PROTO_PROTODESERIALIZE_H +#define AAPT_FORMAT_PROTO_PROTODESERIALIZE_H #include "android-base/macros.h" #include "androidfw/ResourceTypes.h" @@ -75,4 +75,4 @@ class CompiledFileInputStream { } // namespace aapt -#endif /* AAPT_PROTO_PROTODESERIALIZE_H */ +#endif /* AAPT_FORMAT_PROTO_PROTODESERIALIZE_H */ diff --git a/tools/aapt2/proto/ProtoSerialize.cpp b/tools/aapt2/format/proto/ProtoSerialize.cpp index d36d6680a7df..c0d36141d457 100644 --- a/tools/aapt2/proto/ProtoSerialize.cpp +++ b/tools/aapt2/format/proto/ProtoSerialize.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "proto/ProtoSerialize.h" +#include "format/proto/ProtoSerialize.h" #include "google/protobuf/io/zero_copy_stream_impl_lite.h" diff --git a/tools/aapt2/proto/ProtoSerialize.h b/tools/aapt2/format/proto/ProtoSerialize.h index 4bf7e1c2a26d..1694b16f3277 100644 --- a/tools/aapt2/proto/ProtoSerialize.h +++ b/tools/aapt2/format/proto/ProtoSerialize.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#ifndef AAPT_FLATTEN_TABLEPROTOSERIALIZER_H -#define AAPT_FLATTEN_TABLEPROTOSERIALIZER_H +#ifndef AAPT_FORMAT_PROTO_PROTOSERIALIZE_H +#define AAPT_FORMAT_PROTO_PROTOSERIALIZE_H #include "android-base/macros.h" #include "google/protobuf/io/coded_stream.h" @@ -86,4 +86,4 @@ class CompiledFileOutputStream { } // namespace aapt -#endif /* AAPT_FLATTEN_TABLEPROTOSERIALIZER_H */ +#endif /* AAPT_FORMAT_PROTO_PROTOSERIALIZE_H */ diff --git a/tools/aapt2/proto/ProtoSerialize_test.cpp b/tools/aapt2/format/proto/ProtoSerialize_test.cpp index b263aff41db0..2154d5a9ab2c 100644 --- a/tools/aapt2/proto/ProtoSerialize_test.cpp +++ b/tools/aapt2/format/proto/ProtoSerialize_test.cpp @@ -14,12 +14,12 @@ * limitations under the License. */ -#include "proto/ProtoSerialize.h" +#include "format/proto/ProtoSerialize.h" #include "google/protobuf/io/zero_copy_stream_impl_lite.h" #include "ResourceUtils.h" -#include "proto/ProtoDeserialize.h" +#include "format/proto/ProtoDeserialize.h" #include "test/Test.h" using ::android::StringPiece; diff --git a/tools/aapt2/io/Util.h b/tools/aapt2/io/Util.h index ec1ddb8a07aa..02ee876014f7 100644 --- a/tools/aapt2/io/Util.h +++ b/tools/aapt2/io/Util.h @@ -21,7 +21,7 @@ #include "google/protobuf/message_lite.h" -#include "flatten/Archive.h" +#include "format/Archive.h" #include "io/File.h" #include "io/Io.h" #include "process/IResourceTableConsumer.h" diff --git a/tools/aapt2/optimize/MultiApkGenerator.cpp b/tools/aapt2/optimize/MultiApkGenerator.cpp index 8e4b82c6c261..680308871af7 100644 --- a/tools/aapt2/optimize/MultiApkGenerator.cpp +++ b/tools/aapt2/optimize/MultiApkGenerator.cpp @@ -27,8 +27,8 @@ #include "configuration/ConfigurationParser.h" #include "filter/AbiFilter.h" #include "filter/Filter.h" -#include "flatten/Archive.h" -#include "flatten/XmlFlattener.h" +#include "format/Archive.h" +#include "format/binary/XmlFlattener.h" #include "optimize/VersionCollapser.h" #include "process/IResourceTableConsumer.h" #include "split/TableSplitter.h" diff --git a/tools/aapt2/optimize/MultiApkGenerator_test.cpp b/tools/aapt2/optimize/MultiApkGenerator_test.cpp index e8e6adc490e9..c8f3524748b6 100644 --- a/tools/aapt2/optimize/MultiApkGenerator_test.cpp +++ b/tools/aapt2/optimize/MultiApkGenerator_test.cpp @@ -25,8 +25,8 @@ #include "ResourceTable.h" #include "configuration/ConfigurationParser.h" #include "filter/Filter.h" -#include "flatten/Archive.h" -#include "flatten/TableFlattener.h" +#include "format/Archive.h" +#include "format/binary/TableFlattener.h" #include "process/IResourceTableConsumer.h" #include "test/Context.h" #include "test/Test.h" diff --git a/tools/aapt2/xml/XmlDom_test.cpp b/tools/aapt2/xml/XmlDom_test.cpp index 6b97ae67c363..4ba04430ced3 100644 --- a/tools/aapt2/xml/XmlDom_test.cpp +++ b/tools/aapt2/xml/XmlDom_test.cpp @@ -18,7 +18,7 @@ #include <string> -#include "flatten/XmlFlattener.h" +#include "format/binary/XmlFlattener.h" #include "io/StringInputStream.h" #include "test/Test.h" |