Add a --debug-mode option to aapt.

When passed (with no needed parameters) to the aapt command line,
aapt will insert debuggable=true in the application node of the manifest
automatically.

This is to be used by the SDK tools to make true "debug" builds
that require no code/file change.

Change-Id: I6f0a7af7b7d51f26bb0ec012e6f142a6060b8618
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index bd84e23..9c5fcda2 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -678,6 +678,13 @@
                 bundle->getMaxSdkVersion());
     }
 
+    if (bundle->getDebugMode()) {
+        sp<XMLNode> application = root->getChildElement(String16(), String16("application"));
+        if (application != NULL) {
+            addTagAttribute(application, RESOURCES_ANDROID_NAMESPACE, "debuggable", "true");
+        }
+    }
+
     // Deal with manifest package name overrides
     const char* manifestPackageNameOverride = bundle->getManifestPackageNameOverride();
     if (manifestPackageNameOverride != NULL) {