fix possible buffer overrun and memory leak

Use snprintf instead of sprintf and fclose() before return.

Change-Id: I3ed193464cc0dc90e9935ae19162667ad367628b
Update Dalvik process state through VMRuntime.

We now update Dalvik's process state through VMRuntime when the
process state changes in ActivityThread. This is used to determine
when to do trimming and will be used to determine when to do
compaction in the near future.

Bug: 8981901

Change-Id: I5eea272ba4ec2d1ed789b058d6457cb3c1fcf777
Fix inconsistency in LoggingPrintStream.

LoggingPrintStream prints "null" for null strings from
print(String) but throws an NPE from println(String).

Fix this by delegating to the underlying builder (and avoiding
the "fast" path when the input String == null)

bug: https://code.google.com/p/android/issues/detail?id=63380
Change-Id: I89c5c12db6ed5af8037d46f67369b38c5b4cbc9f
Merge "Update Dalvik process state through VMRuntime."
Merge "Fix inconsistency in LoggingPrintStream."
Merge "fix possible buffer overrun and memory leak"
Merge pull request #2 from android/master

base:master upstream changes