Implement native dump for "am dumpheap -n".

This adds the ability to generate a trivial heap dump on demand.  If
the appropriate system properties aren't set, the output file will
instead contain instructions for enabling them.

The data returned by get_malloc_leak_info() is processed and written
to the specified file.  The output looks something like:

 Android Native Heap Dump v1.0

 Total memory: 2981301
 Allocation records: 2152

 z 1  sz    65557  num    1  bt 8010dd78 afd12618 ...
 z 1  sz    52008  num    3  bt 8010dd78 afd12618 ...
 z 1  sz    24428  num    1  bt 8010dd78 8010de84 ...
 ...2149 more...
 END

(the "..." is actually the remaining entries in the stack backtrace;
I truncated it here)

"z" indicates whether the allocation was made pre- or post-zygote,
"sz" is the size allocated, and "num" is the number of allocations
made of that size with the specified backtrace.

Change-Id: I2d60f07444fce5f7178b3f51c928c8faa0b051bd
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 53883b1..aa207e8 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -3047,8 +3047,7 @@
                 }
             }
         } else {
-            // TODO
-            Slog.w(TAG, "Native heap dump not yet implemented");
+            Debug.dumpNativeHeap(dhd.fd.getFileDescriptor());
         }
     }