ui: Show process and thread track names as track labels

If a trace contains thread or process track descriptors with names, use
them as track labels instead of "Process NNN" or "Thread NNN".

Bug: 155076522
Change-Id: I6e4abfaace54c99f22e1433c81a45c2ea6f07d21
diff --git a/ui/src/controller/trace_controller.ts b/ui/src/controller/trace_controller.ts
index 912b7bf..a480b09 100644
--- a/ui/src/controller/trace_controller.ts
+++ b/ui/src/controller/trace_controller.ts
@@ -280,7 +280,7 @@
     globals.dispatchMultiple(actions);
 
     // Make sure the helper views are available before we start adding tracks.
-    await this.initaliseHelperViews();
+    await this.initialiseHelperViews();
 
     {
       // When we reload from a permalink don't create extra tracks:
@@ -603,8 +603,8 @@
           tid,
           upid,
           pid,
-          thread.name as threadName,
-          process.name as processName,
+          ifnull(thread_track.name, thread.name) as threadName,
+          ifnull(process_track.name, process.name) as processName,
           total_dur as totalDur,
           ifnull(has_sched, false) as hasSched
         from
@@ -612,7 +612,9 @@
           left join (select utid, count(1), true as has_sched
               from sched group by utid
           ) using(utid)
+          left join process_track using(upid)
           left join process using(upid)
+          left join thread_track using(utid)
           left join (select upid, sum(dur) as total_dur
               from sched join thread using(utid)
               group by upid
@@ -914,7 +916,7 @@
     globals.publish('OverviewData', slicesData);
   }
 
-  async initaliseHelperViews() {
+  async initialiseHelperViews() {
     const engine = assertExists<Engine>(this.engine);
     this.updateStatus('Creating helper views');
     let event = 'sched_waking';