diff options
22 files changed, 99 insertions, 99 deletions
diff --git a/tools/aapt2/ResourceParser.cpp b/tools/aapt2/ResourceParser.cpp index 931a14b1f650..3d9be59dd960 100644 --- a/tools/aapt2/ResourceParser.cpp +++ b/tools/aapt2/ResourceParser.cpp @@ -342,7 +342,7 @@ bool ResourceParser::FlattenXmlSubtree( } } - // Sanity check to make sure we processed all the nodes. + // Validity check to make sure we processed all the nodes. CHECK(node_stack.size() == 1u); CHECK(node_stack.back() == &root); diff --git a/tools/aapt2/ResourceUtils.cpp b/tools/aapt2/ResourceUtils.cpp index 469128b1e50b..7dfc983b54ba 100644 --- a/tools/aapt2/ResourceUtils.cpp +++ b/tools/aapt2/ResourceUtils.cpp @@ -740,7 +740,7 @@ std::unique_ptr<Item> ParseBinaryResValue(const ResourceType& type, const Config if (type == ResourceType::kId) { if (res_value.dataType != android::Res_value::TYPE_REFERENCE && res_value.dataType != android::Res_value::TYPE_DYNAMIC_REFERENCE) { - // plain "id" resources are actually encoded as dummy values (aapt1 uses an empty string, + // plain "id" resources are actually encoded as unused values (aapt1 uses an empty string, // while aapt2 uses a false boolean). return util::make_unique<Id>(); } diff --git a/tools/aapt2/cmd/Link.cpp b/tools/aapt2/cmd/Link.cpp index fb7f6d717c72..f9c54f645e2c 100644 --- a/tools/aapt2/cmd/Link.cpp +++ b/tools/aapt2/cmd/Link.cpp @@ -1401,7 +1401,7 @@ class Linker { return MergeExportedSymbols(compiled_file.source, compiled_file.exported_symbols); } - // Takes a path to load as a ZIP file and merges the files within into the master ResourceTable. + // Takes a path to load as a ZIP file and merges the files within into the main ResourceTable. // If override is true, conflicting resources are allowed to override each other, in order of last // seen. // An io::IFileCollection is created from the ZIP file and added to the set of @@ -1432,7 +1432,7 @@ class Linker { return !error; } - // Takes a path to load and merge into the master ResourceTable. If override is true, + // Takes a path to load and merge into the main ResourceTable. If override is true, // conflicting resources are allowed to override each other, in order of last seen. // If the file path ends with .flata, .jar, .jack, or .zip the file is treated // as ZIP archive and the files within are merged individually. @@ -1449,7 +1449,7 @@ class Linker { return MergeFile(file, override); } - // Takes an AAPT Container file (.apc/.flat) to load and merge into the master ResourceTable. + // Takes an AAPT Container file (.apc/.flat) to load and merge into the main ResourceTable. // If override is true, conflicting resources are allowed to override each other, in order of last // seen. // All other file types are ignored. This is because these files could be coming from a zip, diff --git a/tools/aapt2/cmd/Optimize.cpp b/tools/aapt2/cmd/Optimize.cpp index e36668e5a043..5b18a3789d76 100644 --- a/tools/aapt2/cmd/Optimize.cpp +++ b/tools/aapt2/cmd/Optimize.cpp @@ -132,8 +132,8 @@ class Optimizer { if (context_->IsVerbose()) { context_->GetDiagnostics()->Note(DiagMessage() << "Optimizing APK..."); } - if (!options_.resources_blacklist.empty()) { - ResourceFilter filter(options_.resources_blacklist); + if (!options_.resources_exclude_list.empty()) { + ResourceFilter filter(options_.resources_exclude_list); if (!filter.Consume(context_, apk->GetResourceTable())) { context_->GetDiagnostics()->Error(DiagMessage() << "failed filtering resources"); return 1; @@ -328,7 +328,7 @@ bool ParseConfig(const std::string& content, IAaptContext* context, OptimizeOpti } for (StringPiece directive : util::Tokenize(directives, ',')) { if (directive == "remove") { - options->resources_blacklist.insert(resource_name.ToResourceName()); + options->resources_exclude_list.insert(resource_name.ToResourceName()); } else if (directive == "no_collapse" || directive == "no_obfuscate") { options->table_flattener_options.name_collapse_exemptions.insert( resource_name.ToResourceName()); diff --git a/tools/aapt2/cmd/Optimize.h b/tools/aapt2/cmd/Optimize.h index 5070ccc8afbf..3afc46b04af6 100644 --- a/tools/aapt2/cmd/Optimize.h +++ b/tools/aapt2/cmd/Optimize.h @@ -36,8 +36,8 @@ struct OptimizeOptions { // Details of the app extracted from the AndroidManifest.xml AppInfo app_info; - // Blacklist of unused resources that should be removed from the apk. - std::unordered_set<ResourceName> resources_blacklist; + // Exclude list of unused resources that should be removed from the apk. + std::unordered_set<ResourceName> resources_exclude_list; // Split APK options. TableSplitterOptions table_splitter_options; diff --git a/tools/aapt2/compile/PngChunkFilter.cpp b/tools/aapt2/compile/PngChunkFilter.cpp index bc2e6990433c..4db2392b4eab 100644 --- a/tools/aapt2/compile/PngChunkFilter.cpp +++ b/tools/aapt2/compile/PngChunkFilter.cpp @@ -35,7 +35,7 @@ constexpr uint32_t u32(uint8_t a, uint8_t b, uint8_t c, uint8_t d) { ((uint32_t)d); } -// Whitelist of PNG chunk types that we want to keep in the resulting PNG. +// Allow list of PNG chunk types that we want to keep in the resulting PNG. enum PngChunkTypes { kPngChunkIHDR = u32(73, 72, 68, 82), kPngChunkIDAT = u32(73, 68, 65, 84), @@ -56,7 +56,7 @@ static uint32_t Peek32LE(const char* data) { return word; } -static bool IsPngChunkWhitelisted(uint32_t type) { +static bool IsPngChunkAllowed(uint32_t type) { switch (type) { case kPngChunkIHDR: case kPngChunkIDAT: @@ -128,7 +128,7 @@ bool PngChunkFilter::Next(const void** buffer, size_t* len) { // Do we strip this chunk? const uint32_t chunk_type = Peek32LE(data_.data() + window_end_ + sizeof(uint32_t)); - if (IsPngChunkWhitelisted(chunk_type)) { + if (IsPngChunkAllowed(chunk_type)) { // Advance the window to include this chunk. window_end_ += kMinChunkHeaderSize + chunk_len; diff --git a/tools/aapt2/configuration/ConfigurationParser_test.cpp b/tools/aapt2/configuration/ConfigurationParser_test.cpp index 2ef8b999a192..e5b3107877cb 100644 --- a/tools/aapt2/configuration/ConfigurationParser_test.cpp +++ b/tools/aapt2/configuration/ConfigurationParser_test.cpp @@ -187,7 +187,7 @@ TEST_F(ConfigurationParserTest, ForPath_NoFile) { TEST_F(ConfigurationParserTest, ExtractConfiguration) { Maybe<PostProcessingConfiguration> maybe_config = - ExtractConfiguration(kValidConfig, "dummy.xml", &diag_); + ExtractConfiguration(kValidConfig, "fake.xml", &diag_); PostProcessingConfiguration config = maybe_config.value(); diff --git a/tools/aapt2/dump/DumpManifest.cpp b/tools/aapt2/dump/DumpManifest.cpp index 53d9ffe21949..71c70da96109 100644 --- a/tools/aapt2/dump/DumpManifest.cpp +++ b/tools/aapt2/dump/DumpManifest.cpp @@ -188,7 +188,7 @@ class ManifestExtractor { /** Retrieves the resource assigned to the specified resource id if one exists. */ Value* FindValueById(const ResourceTable* table, const ResourceId& res_id, - const ConfigDescription& config = DummyConfig()) { + const ConfigDescription& config = DefaultConfig()) { if (table) { for (auto& package : table->packages) { if (package->id && package->id.value() == res_id.package_id()) { @@ -210,7 +210,7 @@ class ManifestExtractor { } /** Attempts to resolve the reference to a non-reference value. */ - Value* ResolveReference(Reference* ref, const ConfigDescription& config = DummyConfig()) { + Value* ResolveReference(Reference* ref, const ConfigDescription& config = DefaultConfig()) { const int kMaxIterations = 40; int i = 0; while (ref && ref->id && i++ < kMaxIterations) { @@ -231,10 +231,10 @@ class ManifestExtractor { * this will attempt to resolve the reference to an integer value. **/ int32_t* GetAttributeInteger(xml::Attribute* attr, - const ConfigDescription& config = DummyConfig()) { + const ConfigDescription& config = DefaultConfig()) { if (attr != nullptr) { if (attr->compiled_value) { - // Resolve references using the dummy configuration + // Resolve references using the configuration Value* value = attr->compiled_value.get(); if (ValueCast<Reference>(value)) { value = ResolveReference(ValueCast<Reference>(value), config); @@ -257,7 +257,7 @@ class ManifestExtractor { * exist or cannot be resolved to an integer value. **/ int32_t GetAttributeIntegerDefault(xml::Attribute* attr, int32_t def, - const ConfigDescription& config = DummyConfig()) { + const ConfigDescription& config = DefaultConfig()) { auto value = GetAttributeInteger(attr, config); if (value) { return *value; @@ -270,10 +270,10 @@ class ManifestExtractor { * this will attempt to resolve the reference to a string value. **/ const std::string* GetAttributeString(xml::Attribute* attr, - const ConfigDescription& config = DummyConfig()) { + const ConfigDescription& config = DefaultConfig()) { if (attr != nullptr) { if (attr->compiled_value) { - // Resolve references using the dummy configuration + // Resolve references using the configuration Value* value = attr->compiled_value.get(); if (ValueCast<Reference>(value)) { value = ResolveReference(ValueCast<Reference>(value), config); @@ -305,7 +305,7 @@ class ManifestExtractor { * exist or cannot be resolved to an string value. **/ std::string GetAttributeStringDefault(xml::Attribute* attr, std::string def, - const ConfigDescription& config = DummyConfig()) { + const ConfigDescription& config = DefaultConfig()) { auto value = GetAttributeString(attr, config); if (value) { return *value; @@ -322,7 +322,7 @@ class ManifestExtractor { friend Element; /** Creates a default configuration used to retrieve resources. */ - static ConfigDescription DummyConfig() { + static ConfigDescription DefaultConfig() { ConfigDescription config; config.orientation = android::ResTable_config::ORIENTATION_PORT; config.density = android::ResTable_config::DENSITY_MEDIUM; @@ -1871,7 +1871,7 @@ bool ManifestExtractor::Dump(text::Printer* printer, IDiagnostics* diag) { // Collect all the unique locales of the apk if (locales_.find(locale_str) == locales_.end()) { - ConfigDescription config = ManifestExtractor::DummyConfig(); + ConfigDescription config = ManifestExtractor::DefaultConfig(); config.setBcp47Locale(locale_str.data()); locales_.insert(std::make_pair(locale_str, config)); } @@ -1880,7 +1880,7 @@ bool ManifestExtractor::Dump(text::Printer* printer, IDiagnostics* diag) { uint16_t density = (value->config.density == 0) ? (uint16_t) 160 : value->config.density; if (densities_.find(density) == densities_.end()) { - ConfigDescription config = ManifestExtractor::DummyConfig(); + ConfigDescription config = ManifestExtractor::DefaultConfig(); config.density = density; densities_.insert(std::make_pair(density, config)); } diff --git a/tools/aapt2/jni/aapt2_jni.cpp b/tools/aapt2/jni/aapt2_jni.cpp index ba9646f9aeb4..ec3c5431c7a3 100644 --- a/tools/aapt2/jni/aapt2_jni.cpp +++ b/tools/aapt2/jni/aapt2_jni.cpp @@ -139,5 +139,5 @@ JNIEXPORT jint JNICALL Java_com_android_tools_aapt2_Aapt2Jni_nativeLink(JNIEnv* JNIEXPORT void JNICALL Java_com_android_tools_aapt2_Aapt2Jni_ping( JNIEnv *env, jclass aapt_obj) { - // This is just a dummy method to see if the library has been loaded. + // This is just a no-op method to see if the library has been loaded. } diff --git a/tools/aapt2/link/ManifestFixer.cpp b/tools/aapt2/link/ManifestFixer.cpp index 49f8e1bcd30b..dac21d7e9200 100644 --- a/tools/aapt2/link/ManifestFixer.cpp +++ b/tools/aapt2/link/ManifestFixer.cpp @@ -570,8 +570,8 @@ bool ManifestFixer::Consume(IAaptContext* context, xml::XmlResource* doc) { } xml::XmlActionExecutorPolicy policy = options_.warn_validation - ? xml::XmlActionExecutorPolicy::kWhitelistWarning - : xml::XmlActionExecutorPolicy::kWhitelist; + ? xml::XmlActionExecutorPolicy::kAllowListWarning + : xml::XmlActionExecutorPolicy::kAllowList; if (!executor.Execute(policy, context->GetDiagnostics(), doc)) { return false; } diff --git a/tools/aapt2/link/TableMerger.cpp b/tools/aapt2/link/TableMerger.cpp index c25e4503a208..ad56092754aa 100644 --- a/tools/aapt2/link/TableMerger.cpp +++ b/tools/aapt2/link/TableMerger.cpp @@ -31,11 +31,11 @@ namespace aapt { TableMerger::TableMerger(IAaptContext* context, ResourceTable* out_table, const TableMergerOptions& options) - : context_(context), master_table_(out_table), options_(options) { + : context_(context), main_table_(out_table), options_(options) { // Create the desired package that all tables will be merged into. - master_package_ = - master_table_->CreatePackage(context_->GetCompilationPackage(), context_->GetPackageId()); - CHECK(master_package_ != nullptr) << "package name or ID already taken"; + main_package_ = + main_table_->CreatePackage(context_->GetCompilationPackage(), context_->GetPackageId()); + CHECK(main_package_ != nullptr) << "package name or ID already taken"; } bool TableMerger::Merge(const Source& src, ResourceTable* table, bool overlay) { @@ -235,7 +235,7 @@ bool TableMerger::DoMerge(const Source& src, ResourceTablePackage* src_package, bool error = false; for (auto& src_type : src_package->types) { - ResourceTableType* dst_type = master_package_->FindOrCreateType(src_type->type); + ResourceTableType* dst_type = main_package_->FindOrCreateType(src_type->type); if (!MergeType(context_, src, dst_type, src_type.get())) { error = true; continue; @@ -279,7 +279,7 @@ bool TableMerger::DoMerge(const Source& src, ResourceTablePackage* src_package, if (dst_config_value) { CollisionResult collision_result = MergeConfigValue( context_, res_name, overlay, options_.override_styles_instead_of_overlaying, - dst_config_value, src_config_value.get(), &master_table_->string_pool); + dst_config_value, src_config_value.get(), &main_table_->string_pool); if (collision_result == CollisionResult::kConflict) { error = true; continue; @@ -298,7 +298,7 @@ bool TableMerger::DoMerge(const Source& src, ResourceTablePackage* src_package, if (mangle_package) { new_file_ref = CloneAndMangleFile(src_package->name, *f); } else { - new_file_ref = std::unique_ptr<FileReference>(f->Clone(&master_table_->string_pool)); + new_file_ref = std::unique_ptr<FileReference>(f->Clone(&main_table_->string_pool)); } dst_config_value->value = std::move(new_file_ref); @@ -307,7 +307,7 @@ bool TableMerger::DoMerge(const Source& src, ResourceTablePackage* src_package, ? dst_config_value->value->GetComment() : Maybe<std::string>(); dst_config_value->value = std::unique_ptr<Value>( - src_config_value->value->Clone(&master_table_->string_pool)); + src_config_value->value->Clone(&main_table_->string_pool)); // Keep the comment from the original resource and ignore all comments from overlaying // resources @@ -328,14 +328,14 @@ std::unique_ptr<FileReference> TableMerger::CloneAndMangleFile( std::string mangled_entry = NameMangler::MangleEntry(package, entry.to_string()); std::string newPath = prefix.to_string() + mangled_entry + suffix.to_string(); std::unique_ptr<FileReference> new_file_ref = - util::make_unique<FileReference>(master_table_->string_pool.MakeRef(newPath)); + util::make_unique<FileReference>(main_table_->string_pool.MakeRef(newPath)); new_file_ref->SetComment(file_ref.GetComment()); new_file_ref->SetSource(file_ref.GetSource()); new_file_ref->type = file_ref.type; new_file_ref->file = file_ref.file; return new_file_ref; } - return std::unique_ptr<FileReference>(file_ref.Clone(&master_table_->string_pool)); + return std::unique_ptr<FileReference>(file_ref.Clone(&main_table_->string_pool)); } bool TableMerger::MergeFile(const ResourceFile& file_desc, bool overlay, io::IFile* file) { diff --git a/tools/aapt2/link/TableMerger.h b/tools/aapt2/link/TableMerger.h index a35a134a887d..e01a0c186392 100644 --- a/tools/aapt2/link/TableMerger.h +++ b/tools/aapt2/link/TableMerger.h @@ -80,9 +80,9 @@ class TableMerger { DISALLOW_COPY_AND_ASSIGN(TableMerger); IAaptContext* context_; - ResourceTable* master_table_; + ResourceTable* main_table_; TableMergerOptions options_; - ResourceTablePackage* master_package_; + ResourceTablePackage* main_package_; std::set<std::string> merged_packages_; bool MergeImpl(const Source& src, ResourceTable* src_table, bool overlay, bool allow_new); diff --git a/tools/aapt2/link/XmlCompatVersioner.cpp b/tools/aapt2/link/XmlCompatVersioner.cpp index 20ebdc696814..6937ca961f06 100644 --- a/tools/aapt2/link/XmlCompatVersioner.cpp +++ b/tools/aapt2/link/XmlCompatVersioner.cpp @@ -143,8 +143,8 @@ std::vector<std::unique_ptr<xml::XmlResource>> XmlCompatVersioner::Process( // Iterate from smallest to largest API version. for (ApiVersion api : apis_referenced) { - std::set<ApiVersion> dummy; - versioned_docs.push_back(ProcessDoc(api, api_range.end, doc, &dummy)); + std::set<ApiVersion> tmp; + versioned_docs.push_back(ProcessDoc(api, api_range.end, doc, &tmp)); } return versioned_docs; } diff --git a/tools/aapt2/optimize/ResourceFilter.cpp b/tools/aapt2/optimize/ResourceFilter.cpp index 250b65197a7d..08c045bf68f7 100644 --- a/tools/aapt2/optimize/ResourceFilter.cpp +++ b/tools/aapt2/optimize/ResourceFilter.cpp @@ -20,8 +20,8 @@ namespace aapt { -ResourceFilter::ResourceFilter(const std::unordered_set<ResourceName>& blacklist) - : blacklist_(blacklist) { +ResourceFilter::ResourceFilter(const std::unordered_set<ResourceName>& exclude_list) + : exclude_list_(exclude_list) { } bool ResourceFilter::Consume(IAaptContext* context, ResourceTable* table) { @@ -29,7 +29,7 @@ bool ResourceFilter::Consume(IAaptContext* context, ResourceTable* table) { for (auto& type : package->types) { for (auto it = type->entries.begin(); it != type->entries.end(); ) { ResourceName resource = ResourceName({}, type->type, (*it)->name); - if (blacklist_.find(resource) != blacklist_.end()) { + if (exclude_list_.find(resource) != exclude_list_.end()) { it = type->entries.erase(it); } else { ++it; diff --git a/tools/aapt2/optimize/ResourceFilter.h b/tools/aapt2/optimize/ResourceFilter.h index d4baf654b0ff..a2645333e497 100644 --- a/tools/aapt2/optimize/ResourceFilter.h +++ b/tools/aapt2/optimize/ResourceFilter.h @@ -25,16 +25,16 @@ namespace aapt { -// Removes non-whitelisted entries from resource table. +// Removes exclude-listed entries from resource table. class ResourceFilter : public IResourceTableConsumer { public: - explicit ResourceFilter(const std::unordered_set<ResourceName>& blacklist); + explicit ResourceFilter(const std::unordered_set<ResourceName>& exclude_list); bool Consume(IAaptContext* context, ResourceTable* table) override; private: DISALLOW_COPY_AND_ASSIGN(ResourceFilter); - std::unordered_set<ResourceName> blacklist_; + std::unordered_set<ResourceName> exclude_list_; }; } // namespace aapt diff --git a/tools/aapt2/optimize/ResourceFilter_test.cpp b/tools/aapt2/optimize/ResourceFilter_test.cpp index ef57f9c56dab..34d8fd280fa9 100644 --- a/tools/aapt2/optimize/ResourceFilter_test.cpp +++ b/tools/aapt2/optimize/ResourceFilter_test.cpp @@ -31,22 +31,22 @@ TEST(ResourceFilterTest, SomeValuesAreFilteredOut) { std::unique_ptr<ResourceTable> table = test::ResourceTableBuilder() - .AddString("android:string/notblacklisted", ResourceId{}, default_config, "value") - .AddString("android:string/blacklisted", ResourceId{}, default_config, "value") - .AddString("android:string/notblacklisted2", ResourceId{}, default_config, "value") - .AddString("android:string/blacklisted2", ResourceId{}, default_config, "value") + .AddString("android:string/notexclude_listed", ResourceId{}, default_config, "value") + .AddString("android:string/exclude_listed", ResourceId{}, default_config, "value") + .AddString("android:string/notexclude_listed2", ResourceId{}, default_config, "value") + .AddString("android:string/exclude_listed2", ResourceId{}, default_config, "value") .Build(); - std::unordered_set<ResourceName> blacklist = { - ResourceName({}, ResourceType::kString, "blacklisted"), - ResourceName({}, ResourceType::kString, "blacklisted2"), + std::unordered_set<ResourceName> exclude_list = { + ResourceName({}, ResourceType::kString, "exclude_listed"), + ResourceName({}, ResourceType::kString, "exclude_listed2"), }; - ASSERT_TRUE(ResourceFilter(blacklist).Consume(context.get(), table.get())); - EXPECT_THAT(table, HasValue("android:string/notblacklisted", default_config)); - EXPECT_THAT(table, HasValue("android:string/notblacklisted2", default_config)); - EXPECT_THAT(table, Not(HasValue("android:string/blacklisted", default_config))); - EXPECT_THAT(table, Not(HasValue("android:string/blacklisted2", default_config))); + ASSERT_TRUE(ResourceFilter(exclude_list).Consume(context.get(), table.get())); + EXPECT_THAT(table, HasValue("android:string/notexclude_listed", default_config)); + EXPECT_THAT(table, HasValue("android:string/notexclude_listed2", default_config)); + EXPECT_THAT(table, Not(HasValue("android:string/exclude_listed", default_config))); + EXPECT_THAT(table, Not(HasValue("android:string/exclude_listed2", default_config))); } TEST(ResourceFilterTest, TypeIsCheckedBeforeFiltering) { @@ -55,21 +55,21 @@ TEST(ResourceFilterTest, TypeIsCheckedBeforeFiltering) { std::unique_ptr<ResourceTable> table = test::ResourceTableBuilder() - .AddString("android:string/notblacklisted", ResourceId{}, default_config, "value") - .AddString("android:string/blacklisted", ResourceId{}, default_config, "value") - .AddString("android:drawable/notblacklisted", ResourceId{}, default_config, "value") - .AddString("android:drawable/blacklisted", ResourceId{}, default_config, "value") + .AddString("android:string/notexclude_listed", ResourceId{}, default_config, "value") + .AddString("android:string/exclude_listed", ResourceId{}, default_config, "value") + .AddString("android:drawable/notexclude_listed", ResourceId{}, default_config, "value") + .AddString("android:drawable/exclude_listed", ResourceId{}, default_config, "value") .Build(); - std::unordered_set<ResourceName> blacklist = { - ResourceName({}, ResourceType::kString, "blacklisted"), + std::unordered_set<ResourceName> exclude_list = { + ResourceName({}, ResourceType::kString, "exclude_listed"), }; - ASSERT_TRUE(ResourceFilter(blacklist).Consume(context.get(), table.get())); - EXPECT_THAT(table, HasValue("android:string/notblacklisted", default_config)); - EXPECT_THAT(table, HasValue("android:drawable/blacklisted", default_config)); - EXPECT_THAT(table, HasValue("android:drawable/notblacklisted", default_config)); - EXPECT_THAT(table, Not(HasValue("android:string/blacklisted", default_config))); + ASSERT_TRUE(ResourceFilter(exclude_list).Consume(context.get(), table.get())); + EXPECT_THAT(table, HasValue("android:string/notexclude_listed", default_config)); + EXPECT_THAT(table, HasValue("android:drawable/exclude_listed", default_config)); + EXPECT_THAT(table, HasValue("android:drawable/notexclude_listed", default_config)); + EXPECT_THAT(table, Not(HasValue("android:string/exclude_listed", default_config))); } } // namespace aapt diff --git a/tools/aapt2/test/Common.cpp b/tools/aapt2/test/Common.cpp index b54c155ddc2f..23c22185a53f 100644 --- a/tools/aapt2/test/Common.cpp +++ b/tools/aapt2/test/Common.cpp @@ -21,7 +21,7 @@ using android::ConfigDescription; namespace aapt { namespace test { -struct DummyDiagnosticsImpl : public IDiagnostics { +struct TestDiagnosticsImpl : public IDiagnostics { void Log(Level level, DiagMessageActual& actual_msg) override { switch (level) { case Level::Note: @@ -39,7 +39,7 @@ struct DummyDiagnosticsImpl : public IDiagnostics { }; IDiagnostics* GetDiagnostics() { - static DummyDiagnosticsImpl diag; + static TestDiagnosticsImpl diag; return &diag; } diff --git a/tools/aapt2/trace/TraceBuffer.h b/tools/aapt2/trace/TraceBuffer.h index 8618e0eeb731..ba751dd72f41 100644 --- a/tools/aapt2/trace/TraceBuffer.h +++ b/tools/aapt2/trace/TraceBuffer.h @@ -40,7 +40,7 @@ public: void BeginTrace(const std::string& tag); void EndTrace(); -// A master trace is required to flush events to disk. Events are formatted in systrace +// A main trace is required to flush events to disk. Events are formatted in systrace // json format. class FlushTrace { public: diff --git a/tools/aapt2/util/Maybe_test.cpp b/tools/aapt2/util/Maybe_test.cpp index 2057ddcc9e45..4c921f13a3ca 100644 --- a/tools/aapt2/util/Maybe_test.cpp +++ b/tools/aapt2/util/Maybe_test.cpp @@ -22,32 +22,32 @@ namespace aapt { -struct Dummy { - Dummy() { +struct Fake { + Fake() { data = new int; *data = 1; - std::cerr << "Construct Dummy{0x" << (void*)this << "} with data=0x" + std::cerr << "Construct Fake{0x" << (void*)this << "} with data=0x" << (void*)data << std::endl; } - Dummy(const Dummy& rhs) { + Fake(const Fake& rhs) { data = nullptr; if (rhs.data) { data = new int; *data = *rhs.data; } - std::cerr << "CopyConstruct Dummy{0x" << (void*)this << "} from Dummy{0x" + std::cerr << "CopyConstruct Fake{0x" << (void*)this << "} from Fake{0x" << (const void*)&rhs << "}" << std::endl; } - Dummy(Dummy&& rhs) { + Fake(Fake&& rhs) { data = rhs.data; rhs.data = nullptr; - std::cerr << "MoveConstruct Dummy{0x" << (void*)this << "} from Dummy{0x" + std::cerr << "MoveConstruct Fake{0x" << (void*)this << "} from Fake{0x" << (const void*)&rhs << "}" << std::endl; } - Dummy& operator=(const Dummy& rhs) { + Fake& operator=(const Fake& rhs) { delete data; data = nullptr; @@ -55,22 +55,22 @@ struct Dummy { data = new int; *data = *rhs.data; } - std::cerr << "CopyAssign Dummy{0x" << (void*)this << "} from Dummy{0x" + std::cerr << "CopyAssign Fake{0x" << (void*)this << "} from Fake{0x" << (const void*)&rhs << "}" << std::endl; return *this; } - Dummy& operator=(Dummy&& rhs) { + Fake& operator=(Fake&& rhs) { delete data; data = rhs.data; rhs.data = nullptr; - std::cerr << "MoveAssign Dummy{0x" << (void*)this << "} from Dummy{0x" + std::cerr << "MoveAssign Fake{0x" << (void*)this << "} from Fake{0x" << (const void*)&rhs << "}" << std::endl; return *this; } - ~Dummy() { - std::cerr << "Destruct Dummy{0x" << (void*)this << "} with data=0x" + ~Fake() { + std::cerr << "Destruct Fake{0x" << (void*)this << "} with data=0x" << (void*)data << std::endl; delete data; } @@ -100,15 +100,15 @@ TEST(MaybeTest, MakeSomething) { } TEST(MaybeTest, Lifecycle) { - Maybe<Dummy> val = make_nothing<Dummy>(); + Maybe<Fake> val = make_nothing<Fake>(); - Maybe<Dummy> val2 = make_value(Dummy()); + Maybe<Fake> val2 = make_value(Fake()); } TEST(MaybeTest, MoveAssign) { - Maybe<Dummy> val; + Maybe<Fake> val; { - Maybe<Dummy> val2 = Dummy(); + Maybe<Fake> val2 = Fake(); val = std::move(val2); } } diff --git a/tools/aapt2/xml/XmlActionExecutor.cpp b/tools/aapt2/xml/XmlActionExecutor.cpp index cb844f085ecc..fab17c949dd8 100644 --- a/tools/aapt2/xml/XmlActionExecutor.cpp +++ b/tools/aapt2/xml/XmlActionExecutor.cpp @@ -74,11 +74,11 @@ bool XmlNodeAction::Execute(XmlActionExecutorPolicy policy, std::vector<StringPi for (const StringPiece& element : *bread_crumb) { error_msg << "<" << element << ">"; } - if (policy == XmlActionExecutorPolicy::kWhitelistWarning) { + if (policy == XmlActionExecutorPolicy::kAllowListWarning) { // Treat the error only as a warning. diag->Warn(error_msg); } else { - // Policy is XmlActionExecutorPolicy::kWhitelist, we should fail. + // Policy is XmlActionExecutorPolicy::kAllowList, we should fail. diag->Error(error_msg); error = true; } @@ -94,7 +94,7 @@ bool XmlActionExecutor::Execute(XmlActionExecutorPolicy policy, IDiagnostics* di Element* el = doc->root.get(); if (!el) { - if (policy == XmlActionExecutorPolicy::kWhitelist) { + if (policy == XmlActionExecutorPolicy::kAllowList) { source_diag.Error(DiagMessage() << "no root XML tag found"); return false; } @@ -109,7 +109,7 @@ bool XmlActionExecutor::Execute(XmlActionExecutorPolicy policy, IDiagnostics* di return iter->second.Execute(policy, &bread_crumb, &source_diag, el); } - if (policy == XmlActionExecutorPolicy::kWhitelist) { + if (policy == XmlActionExecutorPolicy::kAllowList) { DiagMessage error_msg(el->line_number); error_msg << "unexpected root element "; PrintElementToDiagMessage(el, &error_msg); diff --git a/tools/aapt2/xml/XmlActionExecutor.h b/tools/aapt2/xml/XmlActionExecutor.h index f689b2a3eaa8..a0ad1dadeddf 100644 --- a/tools/aapt2/xml/XmlActionExecutor.h +++ b/tools/aapt2/xml/XmlActionExecutor.h @@ -37,12 +37,12 @@ enum class XmlActionExecutorPolicy { // The actions defined must match and run. If an element is found that does not match an action, // an error occurs. // Note: namespaced elements are always ignored. - kWhitelist, + kAllowList, // The actions defined should match and run. if an element is found that does not match an // action, a warning is printed. // Note: namespaced elements are always ignored. - kWhitelistWarning, + kAllowListWarning, }; // Contains the actions to perform at this XML node. This is a recursive data structure that diff --git a/tools/aapt2/xml/XmlActionExecutor_test.cpp b/tools/aapt2/xml/XmlActionExecutor_test.cpp index d39854e5fe4e..d47b49590f5c 100644 --- a/tools/aapt2/xml/XmlActionExecutor_test.cpp +++ b/tools/aapt2/xml/XmlActionExecutor_test.cpp @@ -60,10 +60,10 @@ TEST(XmlActionExecutorTest, FailsWhenUndefinedHierarchyExists) { StdErrDiagnostics diag; doc = test::BuildXmlDom("<manifest><application /><activity /></manifest>"); - ASSERT_FALSE(executor.Execute(XmlActionExecutorPolicy::kWhitelist, &diag, doc.get())); + ASSERT_FALSE(executor.Execute(XmlActionExecutorPolicy::kAllowList, &diag, doc.get())); doc = test::BuildXmlDom("<manifest><application><activity /></application></manifest>"); - ASSERT_FALSE(executor.Execute(XmlActionExecutorPolicy::kWhitelist, &diag, doc.get())); + ASSERT_FALSE(executor.Execute(XmlActionExecutorPolicy::kAllowList, &diag, doc.get())); } } // namespace xml |