AAPT2: optionally keep resources without default value
Teach "aapt2 link" about a new flag --no-resource-removal. When given,
aapt2 will not filter out resources that lack default values. This is
useful mostly when building overlay packages that define resources for
non-default configurations, such as only for values-sv.
Test: manual: build package with resource only in values-vs, verify apk with aapt2 dump
Change-Id: Idc513bcb3f43bbff7f073163562c3dfccdb9bc9b
diff --git a/tools/aapt2/cmd/Link.h b/tools/aapt2/cmd/Link.h
index a42c0f2..950dac20 100644
--- a/tools/aapt2/cmd/Link.h
+++ b/tools/aapt2/cmd/Link.h
@@ -59,6 +59,7 @@
bool no_version_vectors = false;
bool no_version_transitions = false;
bool no_resource_deduping = false;
+ bool no_resource_removal = false;
bool no_xml_namespaces = false;
bool do_not_compress_anything = false;
std::unordered_set<std::string> extensions_to_not_compress;
@@ -136,6 +137,9 @@
AddOptionalSwitch("--no-resource-deduping", "Disables automatic deduping of resources with\n"
"identical values across compatible configurations.",
&options_.no_resource_deduping);
+ AddOptionalSwitch("--no-resource-removal", "Disables automatic removal of resources without\n"
+ "defaults. Use this only when building runtime resource overlay packages.",
+ &options_.no_resource_removal);
AddOptionalSwitch("--enable-sparse-encoding",
"This decreases APK size at the cost of resource retrieval performance.",
&options_.table_flattener_options.use_sparse_entries);
@@ -280,4 +284,4 @@
}// namespace aapt
-#endif //AAPT2_LINK_H
\ No newline at end of file
+#endif //AAPT2_LINK_H