Extended android.os.Debug.dumpNativeHeap to include /proc/self/maps contents

Change-Id: I86da98bc48111007d8226d8d0dbc7be470bde877
diff --git a/core/jni/android_os_Debug.cpp b/core/jni/android_os_Debug.cpp
index 4a877d2..2297834 100644
--- a/core/jni/android_os_Debug.cpp
+++ b/core/jni/android_os_Debug.cpp
@@ -397,8 +397,22 @@
         ptr += infoSize;
     }
 
-    fprintf(fp, "END\n");
     free_malloc_leak_info(info);
+
+    fprintf(fp, "MAPS\n");
+    const char* maps = "/proc/self/maps";
+    FILE* in = fopen(maps, "r");
+    if (in == NULL) {
+        fprintf(fp, "Could not open %s\n", maps);
+        return;
+    }
+    char buf[BUFSIZ];
+    while (size_t n = fread(buf, sizeof(char), BUFSIZ, in)) {
+        fwrite(buf, sizeof(char), n, fp);
+    }
+    fclose(in);
+
+    fprintf(fp, "END\n");
 }
 #endif /*HAVE_ANDROID_OS*/