ui: Highlight flamegraph issue on heap_graph_non_finalized_graph, take 2

The initial change was aosp/2019015. The feedback on that was to
show a modal indicating that the flamegraph is not finalised.

The end result looks like this:
https://screenshot.googleplex.com/ZNqu6LYsvTYaLMi

Bug: 222270825
Change-Id: Ic684be1a86637101984a557e07a3922507d401f0
diff --git a/ui/src/controller/flamegraph_controller.ts b/ui/src/controller/flamegraph_controller.ts
index cb7ea7e..cb74e41 100644
--- a/ui/src/controller/flamegraph_controller.ts
+++ b/ui/src/controller/flamegraph_controller.ts
@@ -101,7 +101,7 @@
     if (hasAreaChanged) {
       const upids = [];
       if (!area) {
-        publishFlamegraphDetails(
+        this.checkCompletionAndPublishFlamegraph(
             {...frontendGlobals.flamegraphDetails, isInAreaSelection: false});
         return;
       }
@@ -114,7 +114,7 @@
         upids.push((trackState.config as PerfSampleConfig).upid);
       }
       if (upids.length === 0) {
-        publishFlamegraphDetails(
+        this.checkCompletionAndPublishFlamegraph(
             {...frontendGlobals.flamegraphDetails, isInAreaSelection: false});
         return;
       }
@@ -228,7 +228,17 @@
     this.flamegraphDetails.expandedCallsite = expandedCallsite;
     this.flamegraphDetails.viewingOption = viewingOption;
     this.flamegraphDetails.isInAreaSelection = hasAreaChanged;
-    publishFlamegraphDetails(this.flamegraphDetails);
+    this.checkCompletionAndPublishFlamegraph(this.flamegraphDetails);
+  }
+
+  private async checkCompletionAndPublishFlamegraph(flamegraphDetails:
+                                                        FlamegraphDetails) {
+    flamegraphDetails.graphIncomplete =
+        (await this.args.engine.query(`select value from stats
+       where severity = 'error' and name = 'heap_graph_non_finalized_graph'`))
+            .firstRow({value: NUM})
+            .value > 0;
+    publishFlamegraphDetails(flamegraphDetails);
   }
 
   async getFlamegraphData(