Merge "metrics: Add touch_flow_event_queuing_delay.sql"
diff --git a/CHANGELOG b/CHANGELOG
index 7fc812f..51843f5 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,12 +1,14 @@
 Unreleased:
   Tracing service and probes:
-    *
+    * Removed DCHECK that would cause crashes when a debug build of the service
+      is used with a producer built with -DNDEBUG.
   Trace Processor:
     *
   UI:
     *
   SDK:
-    *
+    * Changed DCHECK and DLOGs to be always disabled in SDK builds, regardless
+      of NDEBUG.
 
 
 v19.0 - 2021-09-02:
diff --git a/gn/BUILD.gn b/gn/BUILD.gn
index 15fa31b..92f1107 100644
--- a/gn/BUILD.gn
+++ b/gn/BUILD.gn
@@ -43,6 +43,9 @@
   perfetto_force_dlog_on = perfetto_force_dlog == "on"
   perfetto_force_dlog_off = perfetto_force_dlog == "off"
 
+  perfetto_force_dcheck_on = perfetto_force_dcheck == "on"
+  perfetto_force_dcheck_off = perfetto_force_dcheck == "off"
+
   # We can't just use (is_linux || is_android) in perfetto.gni because that
   # doesn't work in Android Mac host builds. We lose the GN notion of OS once
   # we run the tools/gen_xxx generators.
@@ -71,6 +74,8 @@
     "PERFETTO_COMPONENT_BUILD=$perfetto_component_build",
     "PERFETTO_FORCE_DLOG_ON=$perfetto_force_dlog_on",
     "PERFETTO_FORCE_DLOG_OFF=$perfetto_force_dlog_off",
+    "PERFETTO_FORCE_DCHECK_ON=$perfetto_force_dcheck_on",
+    "PERFETTO_FORCE_DCHECK_OFF=$perfetto_force_dcheck_off",
     "PERFETTO_VERBOSE_LOGS=$perfetto_verbose_logs_enabled",
     "PERFETTO_VERSION_GEN=$enable_perfetto_version_gen",
     "PERFETTO_TP_PERCENTILE=$enable_perfetto_trace_processor_percentile",
diff --git a/gn/perfetto.gni b/gn/perfetto.gni
index ebed8f3..c6817aa 100644
--- a/gn/perfetto.gni
+++ b/gn/perfetto.gni
@@ -217,6 +217,16 @@
   # console.
   perfetto_force_dlog = perfetto_force_dlog_default
 
+  # Whether DCHECKs should be enabled or not. Values: "on" | "off" | "".
+  # By default ("") DCHECKs are enabled only:
+  # - If DCHECK_ALWAYS_ON is defined (which is mainly a Chromium-ism).
+  # - On debug builds (i.e. if NDEBUG is NOT defined) but only in Chromium,
+  #   Android and standalone builds.
+  # - On all other builds (e.g., SDK) it's off regardless of NDEBUG (unless
+  #   DCHECK_ALWAYS_ON is defined).
+  # See base/logging.h for the implementation of all this.
+  perfetto_force_dcheck = ""
+
   # Installs a signal handler for the most common crash signals which unwinds
   # the stack and prints the stack trace on stderr. Requires a dependency on
   # libbacktrace when enabled.
diff --git a/include/perfetto/base/build_configs/android_tree/perfetto_build_flags.h b/include/perfetto/base/build_configs/android_tree/perfetto_build_flags.h
index a114665..2867007 100644
--- a/include/perfetto/base/build_configs/android_tree/perfetto_build_flags.h
+++ b/include/perfetto/base/build_configs/android_tree/perfetto_build_flags.h
@@ -30,6 +30,8 @@
 #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_COMPONENT_BUILD() (0)
 #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_FORCE_DLOG_ON() (0)
 #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_FORCE_DLOG_OFF() (0)
+#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_FORCE_DCHECK_ON() (0)
+#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_FORCE_DCHECK_OFF() (0)
 #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_VERBOSE_LOGS() (1)
 #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_VERSION_GEN() (1)
 #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_TP_PERCENTILE() (0)
diff --git a/include/perfetto/base/build_configs/bazel/perfetto_build_flags.h b/include/perfetto/base/build_configs/bazel/perfetto_build_flags.h
index 393c2b2..d448829 100644
--- a/include/perfetto/base/build_configs/bazel/perfetto_build_flags.h
+++ b/include/perfetto/base/build_configs/bazel/perfetto_build_flags.h
@@ -30,6 +30,8 @@
 #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_COMPONENT_BUILD() (0)
 #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_FORCE_DLOG_ON() (0)
 #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_FORCE_DLOG_OFF() (0)
+#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_FORCE_DCHECK_ON() (0)
+#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_FORCE_DCHECK_OFF() (0)
 #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_VERBOSE_LOGS() (1)
 #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_VERSION_GEN() (1)
 #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_TP_PERCENTILE() (1)
diff --git a/include/perfetto/base/logging.h b/include/perfetto/base/logging.h
index 8641a1c..6e128be 100644
--- a/include/perfetto/base/logging.h
+++ b/include/perfetto/base/logging.h
@@ -29,12 +29,17 @@
 #pragma GCC system_header
 #endif
 
-// TODO(primiano): move this to base/build_config.h, turn into
-// PERFETTO_BUILDFLAG(DCHECK_IS_ON) and update call sites to use that instead.
-#if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
-#define PERFETTO_DCHECK_IS_ON() 0
-#else
+#if PERFETTO_BUILDFLAG(PERFETTO_FORCE_DCHECK_ON)
 #define PERFETTO_DCHECK_IS_ON() 1
+#elif PERFETTO_BUILDFLAG(PERFETTO_FORCE_DCHECK_OFF)
+#define PERFETTO_DCHECK_IS_ON() 0
+#elif defined(DCHECK_ALWAYS_ON) ||                                         \
+    (!defined(NDEBUG) && (PERFETTO_BUILDFLAG(PERFETTO_STANDALONE_BUILD) || \
+                          PERFETTO_BUILDFLAG(PERFETTO_CHROMIUM_BUILD) ||   \
+                          PERFETTO_BUILDFLAG(PERFETTO_ANDROID_BUILD)))
+#define PERFETTO_DCHECK_IS_ON() 1
+#else
+#define PERFETTO_DCHECK_IS_ON() 0
 #endif
 
 #if PERFETTO_BUILDFLAG(PERFETTO_FORCE_DLOG_ON)
diff --git a/protos/perfetto/ipc/producer_port.proto b/protos/perfetto/ipc/producer_port.proto
index 9be72ea..f072be0 100644
--- a/protos/perfetto/ipc/producer_port.proto
+++ b/protos/perfetto/ipc/producer_port.proto
@@ -128,16 +128,11 @@
   // If provided, overrides the service's SMB scraping setting for the producer.
   optional ProducerSMBScrapingMode smb_scraping_mode = 4;
 
-  enum ProducerBuildFlags {
-    BUILD_FLAGS_UNSPECIFIED = 0;
-    BUILD_FLAGS_DCHECKS_ON = 1;
-    BUILD_FLAGS_DCHECKS_OFF = 2;
-  }
-
-  // If provided, reports the build flags of the producer. It's used merely for
-  // error reporting, to print a log message when a producer connects to a
-  // service that has mismatching build flags.
-  optional ProducerBuildFlags build_flags = 5;
+  // Was build_flags = BUILD_FLAGS_DCHECKS_ON|OFF. It was used to emit an error
+  // when DCHECKs level didn't match between service and producer (in turn that
+  // would crash the service when applying patches).
+  // Removed in v20 as part of b/197340286.
+  reserved 5;
 
   // ---------------------------------------------------
   // All fields below have been introduced in Android R.
diff --git a/src/protozero/scattered_stream_writer.cc b/src/protozero/scattered_stream_writer.cc
index 16dd895..3487fb0 100644
--- a/src/protozero/scattered_stream_writer.cc
+++ b/src/protozero/scattered_stream_writer.cc
@@ -67,6 +67,15 @@
   uint8_t* begin = write_ptr_;
   write_ptr_ += size;
 #if PERFETTO_DCHECK_IS_ON()
+  // In the past, the service had a matching DCHECK in
+  // TraceBuffer::TryPatchChunkContents, which was assuming that service and all
+  // producers are built with matching DCHECK levels. This turned out to be a
+  // source of problems and was removed in b/197340286. This memset is useless
+  // these days and is here only to maintain ABI compatibility between producers
+  // that use a v20+ SDK and older versions of the service that were built in
+  // debug mode. At some point around 2023 it should be safe to remove it.
+  // (running a debug version of traced in production seems a bad idea
+  // regardless).
   memset(begin, 0, size);
 #endif
   return begin;
diff --git a/src/tracing/core/trace_buffer.cc b/src/tracing/core/trace_buffer.cc
index ce6fa34..4b72d42 100644
--- a/src/tracing/core/trace_buffer.cc
+++ b/src/tracing/core/trace_buffer.cc
@@ -452,12 +452,6 @@
       return false;
     }
 
-    // DCHECK that we are writing into a zero-filled size field and not into
-    // valid data. It relies on ScatteredStreamWriter::ReserveBytes() to
-    // zero-fill reservations in debug builds.
-    char zero[Patch::kSize]{};
-    PERFETTO_DCHECK(memcmp(ptr, &zero, Patch::kSize) == 0);
-
     memcpy(ptr, &patches[i].data[0], Patch::kSize);
   }
   TRACE_BUFFER_DLOG(
diff --git a/src/tracing/ipc/producer/producer_ipc_client_impl.cc b/src/tracing/ipc/producer/producer_ipc_client_impl.cc
index 8da7b22..61181d8 100644
--- a/src/tracing/ipc/producer/producer_ipc_client_impl.cc
+++ b/src/tracing/ipc/producer/producer_ipc_client_impl.cc
@@ -174,13 +174,6 @@
 #endif
   }
 
-#if PERFETTO_DCHECK_IS_ON()
-  req.set_build_flags(
-      protos::gen::InitializeConnectionRequest::BUILD_FLAGS_DCHECKS_ON);
-#else
-  req.set_build_flags(
-      protos::gen::InitializeConnectionRequest::BUILD_FLAGS_DCHECKS_OFF);
-#endif
   req.set_sdk_version(base::GetVersionString());
   producer_port_.InitializeConnection(req, std::move(on_init), shm_fd);
 
diff --git a/src/tracing/ipc/service/producer_ipc_service.cc b/src/tracing/ipc/service/producer_ipc_service.cc
index 27f6a37..0e7be12 100644
--- a/src/tracing/ipc/service/producer_ipc_service.cc
+++ b/src/tracing/ipc/service/producer_ipc_service.cc
@@ -84,17 +84,6 @@
       break;
   }
 
-#if PERFETTO_DCHECK_IS_ON()
-  if (req.build_flags() ==
-      protos::gen::InitializeConnectionRequest::BUILD_FLAGS_DCHECKS_OFF) {
-    PERFETTO_LOG(
-        "The producer is built with NDEBUG but the service binary was built "
-        "with the DEBUG flag. This will likely cause crashes.");
-    // The other way round (DEBUG producer with NDEBUG service) is expected to
-    // work.
-  }
-#endif
-
   // If the producer provided an SMB, tell the service to attempt to adopt it.
   std::unique_ptr<SharedMemory> shmem;
   if (req.producer_provided_shmem()) {
diff --git a/test/trace_processor/chrome/scroll_flow_event_queuing_delay.out b/test/trace_processor/chrome/scroll_flow_event_queuing_delay.out
index 610f04b..519e25c 100644
--- a/test/trace_processor/chrome/scroll_flow_event_queuing_delay.out
+++ b/test/trace_processor/chrome/scroll_flow_event_queuing_delay.out
@@ -1,26 +1,26 @@
 
-"trace_id","step","next_step","ancestor_end","maybe_next_ancestor_ts","queuing_time_ns"
-2721,"AsyncBegin","Begin",545007000403,545010006403,3006000
-2721,"Begin","STEP_SEND_INPUT_EVENT_UI",545010323403,545010006403,0
-2721,"STEP_SEND_INPUT_EVENT_UI","STEP_HANDLE_INPUT_EVENT_IMPL",545010323403,545010685611,362208
-2721,"STEP_HANDLE_INPUT_EVENT_IMPL","STEP_DID_HANDLE_INPUT_AND_OVERSCROLL",545010695611,545021699611,11004000
-2721,"STEP_DID_HANDLE_INPUT_AND_OVERSCROLL","STEP_SWAP_BUFFERS",545021748611,545022454611,706000
-2721,"STEP_SWAP_BUFFERS","STEP_DRAW_AND_SWAP",545022459611,545034641829,12182218
-2721,"STEP_DRAW_AND_SWAP","End",545034646829,545044471829,9825000
-2721,"End","AsyncBegin",545044474829,"[NULL]","[NULL]"
-2725,"AsyncBegin","Begin",545024000403,545025279403,1279000
-2725,"Begin","STEP_SEND_INPUT_EVENT_UI",545025746403,545025279403,0
-2725,"STEP_SEND_INPUT_EVENT_UI","STEP_HANDLE_INPUT_EVENT_IMPL",545025746403,545025698611,0
-2725,"STEP_HANDLE_INPUT_EVENT_IMPL","STEP_DID_HANDLE_INPUT_AND_OVERSCROLL",545025713611,545033251611,7538000
-2725,"STEP_DID_HANDLE_INPUT_AND_OVERSCROLL","STEP_SWAP_BUFFERS",545033344611,545034007611,663000
-2725,"STEP_SWAP_BUFFERS","STEP_DRAW_AND_SWAP",545034012611,545047703829,13691218
-2725,"STEP_DRAW_AND_SWAP","End",545047704829,545055892829,8188000
-2725,"End","AsyncBegin",545055893829,"[NULL]","[NULL]"
-2727,"AsyncBegin","Begin",545032000403,545033878403,1878000
-2727,"Begin","STEP_SEND_INPUT_EVENT_UI",545034128403,545033878403,0
-2727,"STEP_SEND_INPUT_EVENT_UI","STEP_HANDLE_INPUT_EVENT_IMPL",545034128403,545034224611,96208
-2727,"STEP_HANDLE_INPUT_EVENT_IMPL","STEP_DID_HANDLE_INPUT_AND_OVERSCROLL",545034237611,545044106611,9869000
-2727,"STEP_DID_HANDLE_INPUT_AND_OVERSCROLL","STEP_SWAP_BUFFERS",545044160611,545046053611,1893000
-2727,"STEP_SWAP_BUFFERS","STEP_DRAW_AND_SWAP",545046061611,545047694829,1633218
-2727,"STEP_DRAW_AND_SWAP","End",545047701829,545055884829,8183000
-2727,"End","AsyncBegin",545055886829,"[NULL]","[NULL]"
+"trace_id","jank","step","next_step","ancestor_end","maybe_next_ancestor_ts","queuing_time_ns"
+2954,0,"AsyncBegin","Begin",546175000403,546176663403,1663000
+2954,0,"Begin","STEP_SEND_INPUT_EVENT_UI",546176884403,546176663403,0
+2954,0,"STEP_SEND_INPUT_EVENT_UI","STEP_HANDLE_INPUT_EVENT_IMPL",546176884403,546176948611,64208
+2954,0,"STEP_HANDLE_INPUT_EVENT_IMPL","STEP_DID_HANDLE_INPUT_AND_OVERSCROLL",546176961611,546183503611,6542000
+2954,0,"STEP_DID_HANDLE_INPUT_AND_OVERSCROLL","STEP_SWAP_BUFFERS",546183547611,546184802611,1255000
+2954,0,"STEP_SWAP_BUFFERS","STEP_DRAW_AND_SWAP",546184809611,546186327829,1518218
+2954,0,"STEP_DRAW_AND_SWAP","End",546186335829,546205976829,19641000
+2954,0,"End","AsyncBegin",546205978829,"[NULL]","[NULL]"
+2956,1,"AsyncBegin","Begin",546183000403,546186878403,3878000
+2956,1,"Begin","STEP_SEND_INPUT_EVENT_UI",546187103403,546186878403,0
+2956,1,"STEP_SEND_INPUT_EVENT_UI","STEP_HANDLE_INPUT_EVENT_IMPL",546187103403,546187138611,35208
+2956,1,"STEP_HANDLE_INPUT_EVENT_IMPL","STEP_DID_HANDLE_INPUT_AND_OVERSCROLL",546187149611,546194427611,7278000
+2956,1,"STEP_DID_HANDLE_INPUT_AND_OVERSCROLL","STEP_SWAP_BUFFERS",546194464611,546195772611,1308000
+2956,1,"STEP_SWAP_BUFFERS","STEP_DRAW_AND_SWAP",546195778611,546207402829,11624218
+2956,1,"STEP_DRAW_AND_SWAP","End",546207409829,546228297829,20888000
+2956,1,"End","AsyncBegin",546228304829,"[NULL]","[NULL]"
+2960,0,"AsyncBegin","Begin",546200000403,546201377403,1377000
+2960,0,"Begin","STEP_SEND_INPUT_EVENT_UI",546201586403,546201377403,0
+2960,0,"STEP_SEND_INPUT_EVENT_UI","STEP_HANDLE_INPUT_EVENT_IMPL",546201586403,546201665611,79208
+2960,0,"STEP_HANDLE_INPUT_EVENT_IMPL","STEP_DID_HANDLE_INPUT_AND_OVERSCROLL",546201677611,546205643611,3966000
+2960,0,"STEP_DID_HANDLE_INPUT_AND_OVERSCROLL","STEP_SWAP_BUFFERS",546205696611,546206945611,1249000
+2960,0,"STEP_SWAP_BUFFERS","STEP_DRAW_AND_SWAP",546206953611,546220078829,13125218
+2960,0,"STEP_DRAW_AND_SWAP","End",546220079829,546240099829,20020000
+2960,0,"End","AsyncBegin",546240100829,"[NULL]","[NULL]"
diff --git a/test/trace_processor/chrome/scroll_flow_event_queuing_delay.sql b/test/trace_processor/chrome/scroll_flow_event_queuing_delay.sql
index fdbb40c..50e79b8 100644
--- a/test/trace_processor/chrome/scroll_flow_event_queuing_delay.sql
+++ b/test/trace_processor/chrome/scroll_flow_event_queuing_delay.sql
@@ -16,15 +16,16 @@
 SELECT RUN_METRIC('chrome/scroll_flow_event_queuing_delay.sql')
   AS suppress_query_output;
 
--- trace 2725 is janky and 2721 and 2727 surround it (both are not janky). We
+-- trace 2956 is janky and 2954 and 2960 surround it (both are not janky). We
 -- just manually computed these values to ensure the queuing time is correct.
 SELECT
   trace_id,
+  jank,
   step,
   next_step,
   ancestor_end,
   maybe_next_ancestor_ts,
   queuing_time_ns
 FROM scroll_flow_event_queuing_delay
-WHERE trace_id = 2721 OR trace_id = 2725 OR trace_id = 2727
+WHERE trace_id = 2954 OR trace_id = 2956 OR trace_id = 2960
 ORDER BY trace_id, ts;
diff --git a/ui/package-lock.json b/ui/package-lock.json
index f97eb59..dba56b4 100644
--- a/ui/package-lock.json
+++ b/ui/package-lock.json
@@ -4743,9 +4743,9 @@
       "dev": true
     },
     "path-parse": {
-      "version": "1.0.6",
-      "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
-      "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
+      "version": "1.0.7",
+      "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
+      "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
       "dev": true
     },
     "path-type": {
diff --git a/ui/release/channels.json b/ui/release/channels.json
index 002dddc..720f774 100644
--- a/ui/release/channels.json
+++ b/ui/release/channels.json
@@ -2,7 +2,7 @@
   "channels": [
     {
       "name": "stable",
-      "rev": "591dd93364193ae4c08db5f8d2e967d6dba13e2b"
+      "rev": "61570477350a8e341a1f2f03f17e9fdfc1a84b1a"
     },
     {
       "name": "canary",
diff --git a/ui/src/assets/common.scss b/ui/src/assets/common.scss
index e99453a..abe729e 100644
--- a/ui/src/assets/common.scss
+++ b/ui/src/assets/common.scss
@@ -727,7 +727,7 @@
   }
 }
 
-.spinner {
+.pivot-table-spinner {
   display: inline-block;
   vertical-align: middle;
   box-sizing: border-box;
diff --git a/ui/src/common/state.ts b/ui/src/common/state.ts
index 2935d2d..fe76fe5 100644
--- a/ui/src/common/state.ts
+++ b/ui/src/common/state.ts
@@ -106,8 +106,7 @@
   // temporarily == T1 until T2 has been loaded (consistently to what happens
   // with all other state fields).
   uuid?: string;
-  // if |localOnly| is true then the trace should not be shared or stored in the
-  // browser cache.
+  // if |localOnly| is true then the trace should not be shared or downloaded.
   localOnly?: boolean;
 }
 
diff --git a/ui/src/controller/adb.ts b/ui/src/controller/adb.ts
index 5c1cdbb..42d8138 100644
--- a/ui/src/controller/adb.ts
+++ b/ui/src/controller/adb.ts
@@ -293,7 +293,7 @@
         stream.onClose = () => {};
         resolve(stream);
       };
-      stream.onClose = () => reject();
+      stream.onClose = () => reject(`Failed to openStream svc=${svc}`);
     });
   }
 
diff --git a/ui/src/controller/logs_controller.ts b/ui/src/controller/logs_controller.ts
index e87319d..50deb2b 100644
--- a/ui/src/controller/logs_controller.ts
+++ b/ui/src/controller/logs_controller.ts
@@ -81,7 +81,7 @@
           ts,
           prio,
           ifnull(tag, '[NULL]') as tag,
-          msg
+          ifnull(msg, '[NULL]') as msg
         from android_logs
         where ${vizSqlBounds}
         order by ts
diff --git a/ui/src/controller/trace_controller.ts b/ui/src/controller/trace_controller.ts
index 1a9febc..5a07355 100644
--- a/ui/src/controller/trace_controller.ts
+++ b/ui/src/controller/trace_controller.ts
@@ -389,6 +389,7 @@
       publishHasFtrace(hasFtrace);
     }
 
+    globals.dispatch(Actions.removeDebugTrack({}));
     globals.dispatch(Actions.sortThreadTracks({}));
     await this.selectFirstHeapProfile();
 
diff --git a/ui/src/controller/track_decider.ts b/ui/src/controller/track_decider.ts
index 1c738ea..5caf63f 100644
--- a/ui/src/controller/track_decider.ts
+++ b/ui/src/controller/track_decider.ts
@@ -817,7 +817,7 @@
           tid,
           thread.name as threadName,
           max(slice.depth) as maxDepth,
-          count(thread_slice.id) > 0 as hasThreadSlice,
+          (count(thread_slice.id) = count(slice.id)) as onlyThreadSlice,
           process.upid as upid,
           process.pid as pid
         from slice
@@ -837,7 +837,7 @@
       maxDepth: NUM,
       upid: NUM_NULL,
       pid: NUM_NULL,
-      hasThreadSlice: NUM,
+      onlyThreadSlice: NUM,
     });
     for (; it.valid(); it.next()) {
       const utid = it.utid;
@@ -848,7 +848,7 @@
       const upid = it.upid;
       const pid = it.pid;
       const maxDepth = it.maxDepth;
-      const hasThreadSlice = it.hasThreadSlice;
+      const onlyThreadSlice = it.onlyThreadSlice;
       const trackKindPriority =
           TrackDecider.inferTrackKindPriority(threadName, tid, pid);
 
@@ -863,7 +863,7 @@
         name,
         trackGroup: uuid,
         trackKindPriority,
-        config: {trackId, maxDepth, tid, isThreadSlice: hasThreadSlice === 1}
+        config: {trackId, maxDepth, tid, isThreadSlice: onlyThreadSlice === 1}
       });
     }
   }
diff --git a/ui/src/frontend/pivot_table.ts b/ui/src/frontend/pivot_table.ts
index ec23d5a..4ebf279 100644
--- a/ui/src/frontend/pivot_table.ts
+++ b/ui/src/frontend/pivot_table.ts
@@ -147,7 +147,7 @@
                 },
                 'Edit'),
               ' ',
-              (pivotTable.isLoadingQuery ? m('div.spinner') : null),
+              (pivotTable.isLoadingQuery ? m('div.pivot-table-spinner') : null),
               (resp !== undefined && !pivotTable.isLoadingQuery ?
                    m('span.code',
                      `Query took ${Math.round(resp.durationMs)} ms`) :
diff --git a/ui/src/frontend/sidebar.ts b/ui/src/frontend/sidebar.ts
index 59844c2..c2b4d2f 100644
--- a/ui/src/frontend/sidebar.ts
+++ b/ui/src/frontend/sidebar.ts
@@ -105,6 +105,9 @@
 from sqlstats, first
 order by started desc`;
 
+const GITILES_URL =
+    'https://android.googlesource.com/platform/external/perfetto';
+
 let lastTabTitle = '';
 
 function createCannedQuery(query: string): (_: Event) => void {
@@ -761,12 +764,11 @@
             '.version',
             m('a',
               {
-                href: `https://github.com/google/perfetto/tree/${
-                    version.SCM_REVISION}/ui`,
+                href: `${GITILES_URL}/+/${version.SCM_REVISION}/ui`,
                 title: `Channel: ${getCurrentChannel()}`,
                 target: '_blank',
               },
-              `${version.VERSION}`),
+              `${version.VERSION.substr(0, 11)}`),
             ),
     );
   }