Added a daemon mode to aapt to receive streams of commands from gradle.

When crunching png, we used to spawn a separate aapt process from java
which is slow and resource intensive.
Introduced a daemon mode to appt which when invoked with -m parameter
will listen from commands on stdin and give report of command execution
on stdout.

One one command is supported so far :
s f1 f2

This command perform a single png crunch, f1 pointing to the input
png file to crunch, and f2 pointing to the path for the resulting
crunced file.

Expected output from the command is "Done" or "Error".

Change-Id: Iaf1d865e8d5ee5d36abe39dea6443715865a98d3
diff --git a/tools/aapt/Main.cpp b/tools/aapt/Main.cpp
index 736ae26..2857b59 100644
--- a/tools/aapt/Main.cpp
+++ b/tools/aapt/Main.cpp
@@ -234,6 +234,7 @@
     case kCommandPackage:      return doPackage(bundle);
     case kCommandCrunch:       return doCrunch(bundle);
     case kCommandSingleCrunch: return doSingleCrunch(bundle);
+    case kCommandDaemon:       return runInDaemonMode(bundle);
     default:
         fprintf(stderr, "%s: requested command not yet supported\n", gProgName);
         return 1;
@@ -275,6 +276,8 @@
         bundle.setCommand(kCommandCrunch);
     else if (argv[1][0] == 's')
         bundle.setCommand(kCommandSingleCrunch);
+    else if (argv[1][0] == 'm')
+        bundle.setCommand(kCommandDaemon);
     else {
         fprintf(stderr, "ERROR: Unknown command '%s'\n", argv[1]);
         wantUsage = true;