Added --debug-mode flag to AAPT2
Bug: 74968793
Test: Tested for correct debuggable attribute presense with and without
flag
Change-Id: I0148d1caba62db8cf258926f1d9e87a849aa283f
(cherry picked from commit 444f9bb6a18ff34b69cba504c8658b7013eaa53a)
diff --git a/tools/aapt2/link/ManifestFixer.cpp b/tools/aapt2/link/ManifestFixer.cpp
index 713db5b..165702c 100644
--- a/tools/aapt2/link/ManifestFixer.cpp
+++ b/tools/aapt2/link/ManifestFixer.cpp
@@ -354,6 +354,14 @@
uses_static_library_action.Action(RequiredAndroidAttribute("version"));
uses_static_library_action.Action(RequiredAndroidAttribute("certDigest"));
+ if (options_.debug_mode) {
+ application_action.Action([&](xml::Element* el) -> bool {
+ xml::Attribute *attr = el->FindOrCreateAttribute(xml::kSchemaAndroid, "debuggable");
+ attr->value = "true";
+ return true;
+ });
+ }
+
application_action["meta-data"] = meta_data_action;
application_action["activity"] = component_action;