Add support for parsing the ROOT_FINALIZING record.

Test: m ahat-test, with a ROOT_FINALIZING record manually inserted into L.hprof
Test: Open a heap dump from Android K that contains ROOT_FINALIZING.

Change-Id: I484f2f4e1d90e22a3d5e5f83073566945c15f8d0
diff --git a/tools/ahat/src/heapdump/Parser.java b/tools/ahat/src/heapdump/Parser.java
index 3d5f95f..9dc4eb4 100644
--- a/tools/ahat/src/heapdump/Parser.java
+++ b/tools/ahat/src/heapdump/Parser.java
@@ -409,6 +409,12 @@
                   break;
                 }
 
+                case 0x8a: { // ROOT FINALIZING (ANDROID)
+                  long objectId = hprof.getId();
+                  roots.add(new RootData(objectId, RootType.FINALIZING));
+                  break;
+                }
+
                 case 0x8b: { // ROOT DEBUGGER (ANDROID)
                   long objectId = hprof.getId();
                   roots.add(new RootData(objectId, RootType.DEBUGGER));
diff --git a/tools/ahat/src/heapdump/RootType.java b/tools/ahat/src/heapdump/RootType.java
index 7165b83..af552ea 100644
--- a/tools/ahat/src/heapdump/RootType.java
+++ b/tools/ahat/src/heapdump/RootType.java
@@ -29,7 +29,8 @@
   DEBUGGER        (1 <<  9),
   VM_INTERNAL     (1 << 10),
   UNKNOWN         (1 << 11),
-  JNI_MONITOR     (1 << 12);
+  JNI_MONITOR     (1 << 12),
+  FINALIZING      (1 << 13);
 
   public final int mask;
 
diff --git a/tools/ahat/test-dump/L.hprof b/tools/ahat/test-dump/L.hprof
index cf82557..1acdf79 100644
--- a/tools/ahat/test-dump/L.hprof
+++ b/tools/ahat/test-dump/L.hprof
Binary files differ
diff --git a/tools/ahat/test-dump/README.txt b/tools/ahat/test-dump/README.txt
index 344271c..e7ea584 100644
--- a/tools/ahat/test-dump/README.txt
+++ b/tools/ahat/test-dump/README.txt
@@ -1,5 +1,7 @@
 
 Main.java - A program used to generate a heap dump used for tests.
-L.hprof - A version of the test dump generated on Android L.
+L.hprof - A version of the test dump generated on Android L,
+          with one of the ROOT_DEBUGGER records manually changed to a
+          ROOT_FINALIZING record.
 O.hprof - A version of the test dump generated on Android O.
 RI.hprof - A version of the test dump generated on the reference implementation.