ui: add per-process service and provider binding tracks to ProcessState

Add the android.process_bindings stdlib module deriving active service and content provider intervals and concurrent counts from framework track events, and attach expandable Bound by / Binds to and Provider bound by / Provider binds to tracks with per-peer slice breakdowns under Process state.
diff --git a/Android.bp b/Android.bp
index 5de3270..c571d13 100644
--- a/Android.bp
+++ b/Android.bp
@@ -19666,6 +19666,7 @@
         "src/trace_processor/perfetto_sql/stdlib/android/oom_adjuster.sql",
         "src/trace_processor/perfetto_sql/stdlib/android/package_lookup.sql",
         "src/trace_processor/perfetto_sql/stdlib/android/power_rails.sql",
+        "src/trace_processor/perfetto_sql/stdlib/android/process_bindings.sql",
         "src/trace_processor/perfetto_sql/stdlib/android/process_metadata.sql",
         "src/trace_processor/perfetto_sql/stdlib/android/process_state.sql",
         "src/trace_processor/perfetto_sql/stdlib/android/process_uid_state.sql",
diff --git a/BUILD b/BUILD
index 5c2206e..46ebbc0 100644
--- a/BUILD
+++ b/BUILD
@@ -4257,6 +4257,7 @@
         "src/trace_processor/perfetto_sql/stdlib/android/oom_adjuster.sql",
         "src/trace_processor/perfetto_sql/stdlib/android/package_lookup.sql",
         "src/trace_processor/perfetto_sql/stdlib/android/power_rails.sql",
+        "src/trace_processor/perfetto_sql/stdlib/android/process_bindings.sql",
         "src/trace_processor/perfetto_sql/stdlib/android/process_metadata.sql",
         "src/trace_processor/perfetto_sql/stdlib/android/process_state.sql",
         "src/trace_processor/perfetto_sql/stdlib/android/process_uid_state.sql",
diff --git a/src/trace_processor/perfetto_sql/stdlib/android/BUILD.gn b/src/trace_processor/perfetto_sql/stdlib/android/BUILD.gn
index a675c19..1b9d488 100644
--- a/src/trace_processor/perfetto_sql/stdlib/android/BUILD.gn
+++ b/src/trace_processor/perfetto_sql/stdlib/android/BUILD.gn
@@ -62,6 +62,7 @@
     "oom_adjuster.sql",
     "package_lookup.sql",
     "power_rails.sql",
+    "process_bindings.sql",
     "process_metadata.sql",
     "process_state.sql",
     "process_uid_state.sql",
diff --git a/src/trace_processor/perfetto_sql/stdlib/android/process_bindings.sql b/src/trace_processor/perfetto_sql/stdlib/android/process_bindings.sql
new file mode 100644
index 0000000..242fe67
--- /dev/null
+++ b/src/trace_processor/perfetto_sql/stdlib/android/process_bindings.sql
@@ -0,0 +1,667 @@
+--
+-- Copyright 2026 The Android Open Source Project
+--
+-- Licensed under the Apache License, Version 2.0 (the "License");
+-- you may not use this file except in compliance with the License.
+-- You may obtain a copy of the License at
+--
+--     https://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+
+INCLUDE PERFETTO MODULE android.process_metadata;
+
+-- Active Android service binding intervals derived from framework
+-- service_state track events, segmented per (bind_id, host process epoch).
+CREATE PERFETTO TABLE _android_service_connections AS
+WITH
+  bounds AS (SELECT trace_start() AS start_ts, 9223372036854775807 AS inf_ts),
+  raw_slices AS (
+    SELECT s.id AS slice_id, s.ts, s.name, s.arg_set_id
+    FROM slice AS s
+    WHERE
+      s.category = 'service_state'
+      AND s.name IN (
+        'service_binding',
+        'service_connection_added',
+        'service_connection_removed',
+        'service_destroy'
+      )
+  ),
+  decoded_events AS (
+    SELECT
+      s.slice_id,
+      s.ts,
+      s.name,
+      max(iif(a.key = 'service_state_changed_event.bind_id', a.int_value, NULL)) AS bind_id,
+      max(
+        iif(
+          a.key = 'service_state_changed_event.caller_upid'
+          AND a.int_value > 0,
+          a.int_value,
+          NULL
+        )
+      ) AS caller_upid,
+      max(
+        iif(
+          a.key = 'service_state_changed_event.upid'
+          AND a.int_value > 0,
+          a.int_value,
+          NULL
+        )
+      ) AS host_upid,
+      max(
+        iif(
+          a.key = 'service_state_changed_event.component_name',
+          a.string_value,
+          NULL
+        )
+      ) AS component_name,
+      max(
+        iif(
+          a.key = 'service_state_changed_event.intent_action'
+          AND a.string_value != '',
+          a.string_value,
+          NULL
+        )
+      ) AS intent_action,
+      group_concat(
+        iif(
+          a.flat_key IN (
+            'service_state_changed_event.bind_flags_32',
+            'service_state_changed_event.bind_flags_32_to_64'
+          )
+          AND a.string_value IS NOT NULL,
+          replace(a.string_value, 'SERVICE_BIND_FLAG_', ''),
+          NULL
+        ),
+        ','
+      ) AS bind_flags
+    FROM raw_slices AS s
+    JOIN args AS a USING (arg_set_id)
+    GROUP BY
+      s.slice_id,
+      s.ts,
+      s.name
+  ),
+  bind_summary AS (
+    SELECT
+      e.bind_id,
+      min(iif(e.name = 'service_binding', e.ts, NULL)) AS bind_ts,
+      min(iif(e.name = 'service_connection_removed', e.ts, NULL)) AS remove_ts,
+      max(e.caller_upid) AS client_upid,
+      max(iif(e.name = 'service_connection_removed', e.host_upid, NULL)) AS removed_host_upid,
+      max(e.component_name) AS component_name,
+      max(e.intent_action) AS intent_action,
+      max(iif(e.name = 'service_connection_added', e.bind_flags, NULL)) AS added_flags,
+      max(e.bind_flags) AS any_flags
+    FROM decoded_events AS e
+    WHERE
+      e.bind_id IS NOT NULL
+      AND e.name != 'service_destroy'
+    GROUP BY
+      e.bind_id
+  ),
+  raw_host_attaches AS (
+    SELECT
+      e.bind_id,
+      e.ts,
+      e.slice_id,
+      e.host_upid,
+      lag(e.host_upid) OVER (PARTITION BY e.bind_id ORDER BY e.ts, e.slice_id) AS prev_host_upid,
+      row_number() OVER (PARTITION BY e.bind_id ORDER BY e.ts, e.slice_id) AS attach_ord
+    FROM decoded_events AS e
+    WHERE
+      e.bind_id IS NOT NULL
+      AND e.name IN ('service_binding', 'service_connection_added')
+      AND e.host_upid IS NOT NULL
+  ),
+  dedup_attaches AS (
+    SELECT
+      a.bind_id,
+      iif(
+        a.attach_ord = 1,
+        coalesce(bs.bind_ts, (SELECT start_ts FROM bounds)),
+        a.ts
+      ) AS epoch_ts,
+      a.slice_id,
+      a.host_upid
+    FROM raw_host_attaches AS a
+    JOIN bind_summary AS bs USING (bind_id)
+    WHERE
+      a.prev_host_upid IS NULL
+      OR a.prev_host_upid != a.host_upid
+  ),
+  all_epochs AS (
+    SELECT
+      d.bind_id,
+      d.epoch_ts,
+      lead(d.epoch_ts) OVER (
+        PARTITION BY
+          d.bind_id
+        ORDER BY d.epoch_ts, d.slice_id
+      ) AS next_epoch_ts,
+      d.host_upid
+    FROM dedup_attaches AS d
+    UNION ALL
+    -- Pre-trace bindings that only emitted service_connection_removed.
+    SELECT
+      bs.bind_id,
+      (SELECT start_ts FROM bounds) AS epoch_ts,
+      NULL AS next_epoch_ts,
+      bs.removed_host_upid AS host_upid
+    FROM bind_summary AS bs
+    WHERE
+      bs.removed_host_upid IS NOT NULL
+      AND NOT EXISTS (
+        SELECT 1 FROM dedup_attaches AS d WHERE d.bind_id = bs.bind_id
+      )
+  ),
+  epochs_and_destroys AS (
+    SELECT
+      0 AS is_destroy,
+      ep.bind_id,
+      ep.epoch_ts AS ts,
+      ep.next_epoch_ts,
+      ep.host_upid,
+      bs.component_name,
+      NULL AS destroy_ts
+    FROM all_epochs AS ep
+    JOIN bind_summary AS bs USING (bind_id)
+    WHERE
+      bs.client_upid IS NOT NULL
+    UNION ALL
+    SELECT
+      1 AS is_destroy,
+      NULL AS bind_id,
+      e.ts,
+      NULL AS next_epoch_ts,
+      NULL AS host_upid,
+      e.component_name,
+      e.ts AS destroy_ts
+    FROM decoded_events AS e
+    WHERE
+      e.name = 'service_destroy'
+      AND e.component_name IS NOT NULL
+  ),
+  epochs_with_destroy AS (
+    SELECT
+      x.bind_id,
+      x.ts AS epoch_ts,
+      x.next_epoch_ts,
+      x.host_upid,
+      min(x.destroy_ts) OVER (
+        PARTITION BY
+          x.component_name
+        ORDER BY x.ts DESC, x.is_destroy DESC
+        ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
+      ) AS next_destroy_ts
+    FROM epochs_and_destroys AS x
+  ),
+  resolved_intervals AS (
+    SELECT
+      ep.bind_id,
+      ep.epoch_ts AS ts,
+      min(
+        coalesce(ep.next_epoch_ts, b.inf_ts),
+        coalesce(bs.remove_ts, b.inf_ts),
+        coalesce(ep.next_destroy_ts, b.inf_ts),
+        coalesce(cp.end_ts, b.inf_ts),
+        coalesce(hp.end_ts, b.inf_ts)
+      ) AS raw_end_ts,
+      b.inf_ts,
+      bs.client_upid,
+      ep.host_upid AS server_upid,
+      bs.component_name,
+      bs.intent_action,
+      coalesce(bs.added_flags, bs.any_flags) AS bind_flags
+    FROM epochs_with_destroy AS ep
+    JOIN bind_summary AS bs USING (bind_id)
+    JOIN process AS cp ON cp.upid = bs.client_upid
+    JOIN process AS hp ON hp.upid = ep.host_upid
+    CROSS JOIN bounds AS b
+    WHERE
+      ep.bind_id IS NOT NULL
+  )
+SELECT
+  row_number() OVER (ORDER BY r.ts, r.bind_id) AS id,
+  r.ts,
+  iif(r.raw_end_ts = r.inf_ts, -1, r.raw_end_ts - r.ts) AS dur,
+  r.bind_id,
+  r.client_upid,
+  r.server_upid,
+  r.component_name,
+  r.intent_action,
+  r.bind_flags
+FROM resolved_intervals AS r
+WHERE
+  r.raw_end_ts = r.inf_ts
+  OR r.raw_end_ts > r.ts;
+
+-- Active Android ContentProvider connection intervals derived from framework
+-- provider_state track events.
+CREATE PERFETTO TABLE _android_content_provider_connections AS
+WITH
+  bounds AS (SELECT trace_start() AS start_ts, 9223372036854775807 AS inf_ts),
+  raw_slices AS (
+    SELECT s.id AS slice_id, s.ts, s.name, s.arg_set_id
+    FROM slice AS s
+    WHERE
+      s.category = 'provider_state'
+      AND s.name IN (
+        'provider_acquired',
+        'provider_released',
+        'provider_published',
+        'provider_died'
+      )
+  ),
+  decoded_events AS (
+    SELECT
+      s.slice_id,
+      s.ts,
+      s.name,
+      max(
+        iif(
+          a.key = 'provider_state_changed_event.caller_upid'
+          AND a.int_value > 0,
+          a.int_value,
+          NULL
+        )
+      ) AS caller_upid,
+      max(
+        iif(
+          a.key = 'provider_state_changed_event.upid'
+          AND a.int_value > 0,
+          a.int_value,
+          NULL
+        )
+      ) AS host_upid,
+      max(
+        iif(
+          a.key = 'provider_state_changed_event.authority',
+          a.string_value,
+          NULL
+        )
+      ) AS authority,
+      max(
+        iif(a.key = 'provider_state_changed_event.is_stable', a.int_value, NULL)
+      ) AS is_stable
+    FROM raw_slices AS s
+    JOIN args AS a USING (arg_set_id)
+    GROUP BY
+      s.slice_id,
+      s.ts,
+      s.name
+  ),
+  pubs_indexed AS (
+    SELECT
+      e.authority,
+      e.ts AS pub_ts,
+      e.host_upid AS pub_host_upid,
+      row_number() OVER (PARTITION BY e.authority ORDER BY e.ts, e.slice_id) AS pub_ord
+    FROM decoded_events AS e
+    WHERE
+      e.name = 'provider_published'
+      AND e.authority IS NOT NULL
+      AND e.host_upid IS NOT NULL
+  ),
+  acq_and_pub AS (
+    SELECT
+      0 AS is_pub,
+      e.slice_id,
+      e.ts,
+      e.caller_upid,
+      e.host_upid,
+      e.authority,
+      e.is_stable
+    FROM decoded_events AS e
+    WHERE
+      e.name = 'provider_acquired'
+      AND e.caller_upid IS NOT NULL
+      AND e.authority IS NOT NULL
+    UNION ALL
+    SELECT
+      1 AS is_pub,
+      p.pub_ord AS slice_id,
+      p.pub_ts AS ts,
+      NULL AS caller_upid,
+      p.pub_host_upid AS host_upid,
+      p.authority,
+      NULL AS is_stable
+    FROM pubs_indexed AS p
+  ),
+  acq_with_pub_idx AS (
+    SELECT
+      x.slice_id,
+      x.ts,
+      x.caller_upid,
+      x.host_upid,
+      x.authority,
+      x.is_stable,
+      sum(x.is_pub) OVER (
+        PARTITION BY
+          x.authority
+        ORDER BY x.ts, x.is_pub, x.slice_id
+        ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
+      ) AS pubs_before
+    FROM acq_and_pub AS x
+  ),
+  resolved_acquires AS (
+    SELECT
+      a.slice_id,
+      a.ts,
+      a.caller_upid,
+      coalesce(a.host_upid, p.pub_host_upid) AS host_upid,
+      a.authority,
+      a.is_stable
+    FROM acq_with_pub_idx AS a
+    LEFT JOIN pubs_indexed AS p
+      ON a.host_upid IS NULL
+      AND p.authority = a.authority
+      AND p.pub_ord = a.pubs_before + 1
+      AND p.pub_ts - a.ts <= 10000000000
+    WHERE
+      a.caller_upid IS NOT NULL
+  ),
+  depth_stream AS (
+    SELECT
+      a.ts,
+      a.slice_id,
+      1 AS delta,
+      a.caller_upid,
+      a.host_upid,
+      a.authority,
+      a.is_stable
+    FROM resolved_acquires AS a
+    WHERE
+      a.host_upid IS NOT NULL
+    UNION ALL
+    SELECT
+      e.ts,
+      e.slice_id,
+      -1 AS delta,
+      e.caller_upid,
+      e.host_upid,
+      e.authority,
+      e.is_stable
+    FROM decoded_events AS e
+    WHERE
+      e.name = 'provider_released'
+      AND e.caller_upid IS NOT NULL
+      AND e.authority IS NOT NULL
+  ),
+  depth_calc AS (
+    SELECT
+      d.*,
+      sum(d.delta) OVER (
+        PARTITION BY
+          d.caller_upid,
+          d.authority
+        ORDER BY d.ts, d.slice_id
+        ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
+      ) AS raw_depth
+    FROM depth_stream AS d
+  ),
+  pre_trace_counts AS (
+    SELECT caller_upid, authority, max(0, -min(raw_depth)) AS pre_cnt
+    FROM depth_calc
+    GROUP BY
+      caller_upid,
+      authority
+  ),
+  numbered_releases AS (
+    SELECT
+      d.caller_upid,
+      d.authority,
+      d.ts AS rel_ts,
+      d.host_upid AS rel_host_upid,
+      d.is_stable AS rel_is_stable,
+      row_number() OVER (
+        PARTITION BY
+          d.caller_upid,
+          d.authority
+        ORDER BY d.ts, d.slice_id
+      ) AS ord
+    FROM depth_calc AS d
+    WHERE
+      d.delta = -1
+  ),
+  numbered_acquires AS (
+    SELECT
+      d.caller_upid,
+      d.authority,
+      d.ts AS acq_ts,
+      d.host_upid AS acq_host_upid,
+      d.is_stable AS acq_is_stable,
+      p.pre_cnt
+      + row_number() OVER (
+        PARTITION BY
+          d.caller_upid,
+          d.authority
+        ORDER BY d.ts, d.slice_id
+      ) AS ord
+    FROM depth_calc AS d
+    JOIN pre_trace_counts AS p USING (caller_upid, authority)
+    WHERE
+      d.delta = 1
+    UNION ALL
+    -- Pre-trace acquisitions proven by early releases before matching acquires.
+    SELECT
+      r.caller_upid,
+      r.authority,
+      (SELECT start_ts FROM bounds) AS acq_ts,
+      r.rel_host_upid AS acq_host_upid,
+      r.rel_is_stable AS acq_is_stable,
+      r.ord
+    FROM numbered_releases AS r
+    JOIN pre_trace_counts AS p USING (caller_upid, authority)
+    WHERE
+      r.ord <= p.pre_cnt
+      AND r.rel_host_upid IS NOT NULL
+  ),
+  paired_fifo AS (
+    SELECT
+      a.acq_ts AS ts,
+      r.rel_ts,
+      a.caller_upid AS client_upid,
+      a.acq_host_upid AS server_upid,
+      a.authority,
+      a.acq_is_stable AS is_stable
+    FROM numbered_acquires AS a
+    LEFT JOIN numbered_releases AS r
+      ON r.caller_upid = a.caller_upid
+      AND r.authority = a.authority
+      AND r.ord = a.ord
+  ),
+  fifo_and_dies AS (
+    SELECT
+      0 AS is_die,
+      f.ts,
+      f.rel_ts,
+      f.client_upid,
+      f.server_upid,
+      f.authority,
+      f.is_stable,
+      NULL AS die_ts
+    FROM paired_fifo AS f
+    UNION ALL
+    SELECT
+      1 AS is_die,
+      e.ts,
+      NULL AS rel_ts,
+      NULL AS client_upid,
+      NULL AS server_upid,
+      e.authority,
+      NULL AS is_stable,
+      e.ts AS die_ts
+    FROM decoded_events AS e
+    WHERE
+      e.name = 'provider_died'
+      AND e.authority IS NOT NULL
+  ),
+  fifo_with_die AS (
+    SELECT
+      x.ts,
+      x.rel_ts,
+      x.client_upid,
+      x.server_upid,
+      x.authority,
+      x.is_stable,
+      min(x.die_ts) OVER (
+        PARTITION BY
+          x.authority
+        ORDER BY x.ts DESC, x.is_die DESC
+        ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
+      ) AS next_die_ts
+    FROM fifo_and_dies AS x
+  ),
+  resolved_intervals AS (
+    SELECT
+      f.ts,
+      min(
+        coalesce(f.rel_ts, b.inf_ts),
+        coalesce(f.next_die_ts, b.inf_ts),
+        coalesce(cp.end_ts, b.inf_ts),
+        coalesce(hp.end_ts, b.inf_ts)
+      ) AS raw_end_ts,
+      b.inf_ts,
+      f.client_upid,
+      f.server_upid,
+      f.authority,
+      f.is_stable
+    FROM fifo_with_die AS f
+    JOIN process AS cp ON cp.upid = f.client_upid
+    JOIN process AS hp ON hp.upid = f.server_upid
+    CROSS JOIN bounds AS b
+    WHERE
+      f.client_upid IS NOT NULL
+  )
+SELECT
+  row_number() OVER (ORDER BY r.ts, r.client_upid, r.server_upid) AS id,
+  r.ts,
+  iif(r.raw_end_ts = r.inf_ts, -1, r.raw_end_ts - r.ts) AS dur,
+  r.client_upid,
+  r.server_upid,
+  r.authority,
+  r.is_stable
+FROM resolved_intervals AS r
+WHERE
+  r.raw_end_ts = r.inf_ts
+  OR r.raw_end_ts > r.ts;
+
+-- Unified service and content provider binding intervals with endpoint metadata.
+CREATE PERFETTO TABLE _android_process_bindings AS
+WITH
+  proc_meta AS (
+    SELECT
+      p.upid,
+      p.pid,
+      m.uid,
+      coalesce(m.process_name, p.name) AS process_name
+    FROM process AS p
+    LEFT JOIN android_process_metadata AS m USING (upid)
+  ),
+  raw_bindings AS (
+    SELECT
+      'service' AS binding_kind,
+      s.ts,
+      s.dur,
+      s.client_upid,
+      s.server_upid,
+      coalesce(s.component_name, 'service') AS target,
+      s.intent_action,
+      s.bind_flags,
+      CAST(NULL AS STRING) AS stability
+    FROM _android_service_connections AS s
+    UNION ALL
+    SELECT
+      'provider' AS binding_kind,
+      c.ts,
+      c.dur,
+      c.client_upid,
+      c.server_upid,
+      coalesce(c.authority, 'provider') AS target,
+      CAST(NULL AS STRING) AS intent_action,
+      CAST(NULL AS STRING) AS bind_flags,
+      CASE
+        WHEN c.is_stable IS NULL THEN NULL
+        WHEN c.is_stable != 0 THEN 'stable'
+        ELSE 'unstable'
+      END AS stability
+    FROM _android_content_provider_connections AS c
+  )
+SELECT
+  row_number() OVER (
+    ORDER BY r.ts, r.binding_kind, r.client_upid, r.server_upid, r.target
+  ) AS id,
+  r.ts,
+  r.dur,
+  r.binding_kind,
+  r.client_upid,
+  cp.pid AS client_pid,
+  cp.uid AS client_uid,
+  cp.process_name AS client_process_name,
+  r.server_upid,
+  sp.pid AS server_pid,
+  sp.uid AS server_uid,
+  sp.process_name AS server_process_name,
+  r.target,
+  r.intent_action,
+  r.bind_flags,
+  r.stability
+FROM raw_bindings AS r
+JOIN proc_meta AS cp ON cp.upid = r.client_upid
+JOIN proc_meta AS sp ON sp.upid = r.server_upid;
+
+CREATE PERFETTO INDEX _android_process_bindings_server_idx ON _android_process_bindings(
+  server_upid
+);
+
+CREATE PERFETTO INDEX _android_process_bindings_client_idx ON _android_process_bindings(
+  client_upid
+);
+
+-- Concurrent incoming ('bound_by') and outgoing ('binds_to') binding counts per
+-- process and binding kind ('service' or 'provider').
+CREATE PERFETTO TABLE _android_process_binding_counts AS
+FROM (
+  SELECT
+    ts,
+    iif(dur < 0, trace_end() - ts, dur) AS dur,
+    binding_kind,
+    'bound_by' AS direction,
+    server_upid AS upid
+  FROM _android_process_bindings
+  WHERE
+    iif(dur < 0, trace_end() - ts, dur) > 0
+  UNION ALL
+  SELECT
+    ts,
+    iif(dur < 0, trace_end() - ts, dur) AS dur,
+    binding_kind,
+    'binds_to' AS direction,
+    client_upid AS upid
+  FROM _android_process_bindings
+  WHERE
+    iif(dur < 0, trace_end() - ts, dur) > 0
+)
+|> INTERVAL FLATTEN PER binding_kind,
+direction,
+upid
+  AGGREGATE COUNT(*) AS count
+|> INTERVAL FILL GAPS WITH (
+  SELECT trace_start() AS ts, trace_dur() AS dur, 0 AS count
+) PER binding_kind,
+direction,
+upid
+|> SELECT ts, binding_kind, direction, upid, count
+|> ORDER BY ts;
+
+CREATE PERFETTO INDEX _android_process_binding_counts_idx ON _android_process_binding_counts(
+  upid
+);
diff --git a/test/trace_processor/diff_tests/stdlib/android/tests.py b/test/trace_processor/diff_tests/stdlib/android/tests.py
index 62de348..2fd7e90 100644
--- a/test/trace_processor/diff_tests/stdlib/android/tests.py
+++ b/test/trace_processor/diff_tests/stdlib/android/tests.py
@@ -3412,6 +3412,308 @@
         5000,-1,200,"EXITED","RECEIVER",2000,21,"[NULL]"
         """))
 
+  def test_android_process_bindings_service_connections(self):
+    return DiffTestBlueprint(
+        trace=TextProto(r"""
+        packet {
+          timestamp: 500
+          process_tree {
+            processes { pid: 100 ppid: 1 cmdline: "com.example.client" }
+            processes { pid: 200 ppid: 1 cmdline: "com.example.server" }
+            processes { pid: 300 ppid: 1 cmdline: "com.example.other" }
+            processes { pid: 1000 ppid: 1 cmdline: "system_server" }
+          }
+        }
+        packet {
+          timestamp: 500
+          track_descriptor {
+            uuid: 10
+            thread { pid: 1000 tid: 1000 thread_name: "system_server" }
+          }
+        }
+        packet {
+          timestamp: 1000
+          trusted_packet_sequence_id: 1
+          track_event {
+            type: TYPE_INSTANT
+            track_uuid: 10
+            categories: "service_state"
+            name: "service_binding"
+            [com.android.internal.FrameworksBaseTrackEvent.service_state_changed_event] {
+              bind_id: 1
+              caller_pid: 100
+              pid: -1
+              component_name: "com.example.server/.WorkService"
+              intent_action: "com.example.ACTION_WORK"
+              bind_flags_32: 1
+            }
+          }
+        }
+        packet {
+          timestamp: 1500
+          trusted_packet_sequence_id: 1
+          track_event {
+            type: TYPE_INSTANT
+            track_uuid: 10
+            categories: "service_state"
+            name: "service_connection_added"
+            [com.android.internal.FrameworksBaseTrackEvent.service_state_changed_event] {
+              bind_id: 1
+              pid: 200
+              component_name: "com.example.server/.WorkService"
+              bind_flags_32: 5
+            }
+          }
+        }
+        packet {
+          timestamp: 4000
+          trusted_packet_sequence_id: 1
+          track_event {
+            type: TYPE_INSTANT
+            track_uuid: 10
+            categories: "service_state"
+            name: "service_connection_removed"
+            [com.android.internal.FrameworksBaseTrackEvent.service_state_changed_event] {
+              bind_id: 1
+              caller_pid: 100
+              pid: 200
+              component_name: "com.example.server/.WorkService"
+              bind_flags_32: 5
+            }
+          }
+        }
+        packet {
+          timestamp: 2000
+          trusted_packet_sequence_id: 1
+          track_event {
+            type: TYPE_INSTANT
+            track_uuid: 10
+            categories: "service_state"
+            name: "service_binding"
+            [com.android.internal.FrameworksBaseTrackEvent.service_state_changed_event] {
+              bind_id: 2
+              caller_pid: 100
+              pid: 300
+              component_name: "com.example.other/.ForceStoppedService"
+              bind_flags_32: 1
+            }
+          }
+        }
+        packet {
+          timestamp: 5000
+          trusted_packet_sequence_id: 1
+          track_event {
+            type: TYPE_INSTANT
+            track_uuid: 10
+            categories: "service_state"
+            name: "service_destroy"
+            [com.android.internal.FrameworksBaseTrackEvent.service_state_changed_event] {
+              pid: -1
+              component_name: "com.example.other/.ForceStoppedService"
+            }
+          }
+        }
+        packet {
+          timestamp: 6000
+          trusted_packet_sequence_id: 1
+          track_event {
+            type: TYPE_INSTANT
+            track_uuid: 10
+            categories: "service_state"
+            name: "service_binding"
+            [com.android.internal.FrameworksBaseTrackEvent.service_state_changed_event] {
+              bind_id: 3
+              caller_pid: 100
+              pid: 200
+              component_name: "com.example.server/.OpenService"
+              bind_flags_32: 1
+            }
+          }
+        }
+        """),
+        query="""
+        INCLUDE PERFETTO MODULE android.process_bindings;
+        SELECT
+          b.ts,
+          b.dur,
+          b.binding_kind,
+          b.client_pid,
+          b.server_pid,
+          b.target,
+          b.bind_flags
+        FROM _android_process_bindings AS b
+        ORDER BY b.id;
+        """,
+        out=Csv("""
+        "ts","dur","binding_kind","client_pid","server_pid","target","bind_flags"
+        1000,3000,"service",100,200,"com.example.server/.WorkService","AUTO_CREATE,NOT_FOREGROUND"
+        2000,3000,"service",100,300,"com.example.other/.ForceStoppedService","AUTO_CREATE"
+        6000,-1,"service",100,200,"com.example.server/.OpenService","AUTO_CREATE"
+        """))
+
+  def test_android_process_bindings_provider_and_counts(self):
+    return DiffTestBlueprint(
+        trace=TextProto(r"""
+        packet {
+          timestamp: 500
+          process_tree {
+            processes { pid: 100 ppid: 1 cmdline: "com.example.client" }
+            processes { pid: 400 ppid: 1 cmdline: "com.example.provider" }
+            processes { pid: 1000 ppid: 1 cmdline: "system_server" }
+          }
+        }
+        packet {
+          timestamp: 500
+          track_descriptor {
+            uuid: 10
+            thread { pid: 1000 tid: 1000 thread_name: "system_server" }
+          }
+        }
+        packet {
+          timestamp: 500
+          trusted_packet_sequence_id: 1
+          track_event {
+            type: TYPE_INSTANT
+            track_uuid: 10
+            name: "trace_begin"
+          }
+        }
+        packet {
+          timestamp: 1000
+          trusted_packet_sequence_id: 1
+          track_event {
+            type: TYPE_INSTANT
+            track_uuid: 10
+            categories: "provider_state"
+            name: "provider_acquired"
+            [com.android.internal.FrameworksBaseTrackEvent.provider_state_changed_event] {
+              caller_pid: 100
+              pid: -1
+              authority: "com.example.provider.auth"
+              is_stable: 1
+            }
+          }
+        }
+        packet {
+          timestamp: 1200
+          trusted_packet_sequence_id: 1
+          track_event {
+            type: TYPE_INSTANT
+            track_uuid: 10
+            categories: "provider_state"
+            name: "provider_published"
+            [com.android.internal.FrameworksBaseTrackEvent.provider_state_changed_event] {
+              pid: 400
+              authority: "com.example.provider.auth"
+            }
+          }
+        }
+        packet {
+          timestamp: 3500
+          trusted_packet_sequence_id: 1
+          track_event {
+            type: TYPE_INSTANT
+            track_uuid: 10
+            categories: "provider_state"
+            name: "provider_released"
+            [com.android.internal.FrameworksBaseTrackEvent.provider_state_changed_event] {
+              caller_pid: 100
+              pid: 400
+              authority: "com.example.provider.auth"
+              is_stable: 1
+            }
+          }
+        }
+        packet {
+          timestamp: 5000
+          trusted_packet_sequence_id: 1
+          track_event {
+            type: TYPE_INSTANT
+            track_uuid: 10
+            categories: "provider_state"
+            name: "provider_acquired"
+            [com.android.internal.FrameworksBaseTrackEvent.provider_state_changed_event] {
+              caller_pid: 100
+              pid: 400
+              authority: "com.example.provider.auth"
+              is_stable: 0
+            }
+          }
+        }
+        packet {
+          timestamp: 2000
+          trusted_packet_sequence_id: 1
+          track_event {
+            type: TYPE_INSTANT
+            track_uuid: 10
+            categories: "service_state"
+            name: "service_binding"
+            [com.android.internal.FrameworksBaseTrackEvent.service_state_changed_event] {
+              bind_id: 10
+              caller_pid: 100
+              pid: 400
+              component_name: "com.example.provider/.SyncService"
+              bind_flags_32: 1
+            }
+          }
+        }
+        packet {
+          timestamp: 6000
+          trusted_packet_sequence_id: 1
+          track_event {
+            type: TYPE_INSTANT
+            track_uuid: 10
+            categories: "service_state"
+            name: "service_connection_removed"
+            [com.android.internal.FrameworksBaseTrackEvent.service_state_changed_event] {
+              bind_id: 10
+              caller_pid: 100
+              pid: 400
+              component_name: "com.example.provider/.SyncService"
+              bind_flags_32: 1
+            }
+          }
+        }
+        packet {
+          timestamp: 7000
+          trusted_packet_sequence_id: 1
+          track_event {
+            type: TYPE_INSTANT
+            track_uuid: 10
+            name: "trace_end_marker"
+          }
+        }
+        """),
+        query="""
+        INCLUDE PERFETTO MODULE android.process_bindings;
+        SELECT
+          c.ts,
+          c.binding_kind,
+          c.direction,
+          p.pid,
+          c.count
+        FROM _android_process_binding_counts AS c
+        JOIN process AS p USING (upid)
+        ORDER BY c.binding_kind, c.direction, p.pid, c.ts;
+        """,
+        out=Csv("""
+        "ts","binding_kind","direction","pid","count"
+        500,"provider","binds_to",100,0
+        1000,"provider","binds_to",100,1
+        3500,"provider","binds_to",100,0
+        5000,"provider","binds_to",100,1
+        500,"provider","bound_by",400,0
+        1000,"provider","bound_by",400,1
+        3500,"provider","bound_by",400,0
+        5000,"provider","bound_by",400,1
+        500,"service","binds_to",100,0
+        2000,"service","binds_to",100,1
+        6000,"service","binds_to",100,0
+        500,"service","bound_by",400,0
+        2000,"service","bound_by",400,1
+        6000,"service","bound_by",400,0
+        """))
+
   def test_is_relevant_notifications_blocking_call(self):
     # Must keep the same slices as android_sysui_notifications_blocking_calls
     # (see test_android_sysui_notifications_blocking_calls).
diff --git a/ui/src/plugins/com.android.ProcessState/aggregators.ts b/ui/src/plugins/com.android.ProcessState/aggregators.ts
index 90d8fec..9a7059f 100644
--- a/ui/src/plugins/com.android.ProcessState/aggregators.ts
+++ b/ui/src/plugins/com.android.ProcessState/aggregators.ts
@@ -42,11 +42,61 @@
 /** Track tag `type` of the per-state concurrency counters. */
 export const TAG_COUNT_TRACK = 'android_process_state_count';
 
+/** Track tag `type` of the per-process incoming binding tracks. */
+export const TAG_BOUND_BY_TRACK = 'android_bound_by';
+
+/** Track tag `type` of the per-process outgoing binding tracks. */
+export const TAG_BINDS_TO_TRACK = 'android_binds_to';
+
 /** Track URI for a single process's proc-state timeline. */
 export function processTrackUri(upid: number): string {
   return `com.android.ProcessState#process.${upid}`;
 }
 
+export function boundByTrackUri(serverUpid: number): string {
+  return `${processTrackUri(serverUpid)}.bound_by`;
+}
+
+export function boundByPeerTrackUri(
+  serverUpid: number,
+  clientUpid: number,
+): string {
+  return `${boundByTrackUri(serverUpid)}.${clientUpid}`;
+}
+
+export function bindsToTrackUri(clientUpid: number): string {
+  return `${processTrackUri(clientUpid)}.binds_to`;
+}
+
+export function bindsToPeerTrackUri(
+  clientUpid: number,
+  serverUpid: number,
+): string {
+  return `${bindsToTrackUri(clientUpid)}.${serverUpid}`;
+}
+
+export function providerBoundByTrackUri(serverUpid: number): string {
+  return `${processTrackUri(serverUpid)}.provider_bound_by`;
+}
+
+export function providerBoundByPeerTrackUri(
+  serverUpid: number,
+  clientUpid: number,
+): string {
+  return `${providerBoundByTrackUri(serverUpid)}.${clientUpid}`;
+}
+
+export function providerBindsToTrackUri(clientUpid: number): string {
+  return `${processTrackUri(clientUpid)}.provider_binds_to`;
+}
+
+export function providerBindsToPeerTrackUri(
+  clientUpid: number,
+  serverUpid: number,
+): string {
+  return `${providerBindsToTrackUri(clientUpid)}.${serverUpid}`;
+}
+
 // Which slice of the interval table the selection refers to. Selecting
 // per-process tracks scopes by process; selecting the concurrency counters
 // scopes by state, which is what makes "drag over the CACHED_EMPTY counter and
diff --git a/ui/src/plugins/com.android.ProcessState/details_panel.ts b/ui/src/plugins/com.android.ProcessState/details_panel.ts
index 1b8742f..194276a 100644
--- a/ui/src/plugins/com.android.ProcessState/details_panel.ts
+++ b/ui/src/plugins/com.android.ProcessState/details_panel.ts
@@ -27,6 +27,12 @@
 import {GridLayout} from '../../widgets/grid_layout';
 import {Section} from '../../widgets/section';
 import {Tree, TreeNode} from '../../widgets/tree';
+import {
+  bindsToPeerTrackUri,
+  boundByPeerTrackUri,
+  providerBindsToPeerTrackUri,
+  providerBoundByPeerTrackUri,
+} from './aggregators';
 
 export interface ProcessStateRow extends Row {
   readonly id: number;
@@ -95,3 +101,128 @@
     );
   }
 }
+
+export interface BindingSliceRow extends Row {
+  readonly id: number;
+  readonly ts: bigint;
+  readonly dur: bigint;
+  readonly binding_kind: string;
+  readonly client_upid: number;
+  readonly client_pid: number;
+  readonly client_process_name: string | null;
+  readonly server_upid: number;
+  readonly server_pid: number;
+  readonly server_process_name: string | null;
+  readonly target: string;
+  readonly intent_action: string | null;
+  readonly bind_flags: string | null;
+  readonly stability: string | null;
+}
+
+export class BindingSliceDetailsPanel implements TrackEventDetailsPanel {
+  constructor(
+    private readonly trace: Trace,
+    private readonly row: BindingSliceRow,
+    private readonly direction: 'bound_by' | 'binds_to',
+    private readonly ownerUri?: string,
+  ) {}
+
+  render() {
+    const {trace, row, direction, ownerUri} = this;
+    const formatEndpoint = (name: string | null, pid: number): string =>
+      name !== null ? `${name} (pid ${pid})` : `pid ${pid}`;
+
+    const renderEndpoint = (
+      text: string,
+      targetUri: string,
+      isSameDirection: boolean,
+      peerTitle: string,
+    ): m.Children => {
+      if (isSameDirection && ownerUri === undefined) {
+        return text;
+      }
+      const resolvedUri = isSameDirection ? ownerUri! : targetUri;
+      if (trace.tracks.getTrack(resolvedUri) === undefined) {
+        return text;
+      }
+      return m(
+        Anchor,
+        {
+          icon: Icons.UpdateSelection,
+          title: isSameDirection ? 'Show in process group' : peerTitle,
+          onclick: () =>
+            trace.selection.selectTrackEvent(resolvedUri, row.id, {
+              scrollToSelection: true,
+            }),
+        },
+        text,
+      );
+    };
+
+    return m(
+      DetailsShell,
+      {title: 'Binding slice'},
+      m(
+        GridLayout,
+        m(
+          Section,
+          {title: 'Details'},
+          m(Tree, [
+            m(TreeNode, {left: 'ID', right: row.id}),
+            m(TreeNode, {
+              left: 'Start time',
+              right: m(Timestamp, {trace, ts: Time.fromRaw(row.ts)}),
+            }),
+            m(TreeNode, {
+              left: 'Duration',
+              right: m(DurationWidget, {trace, dur: row.dur}),
+            }),
+            m(TreeNode, {left: 'Kind', right: row.binding_kind}),
+            m(TreeNode, {
+              left: 'Client',
+              right: renderEndpoint(
+                formatEndpoint(row.client_process_name, row.client_pid),
+                row.binding_kind === 'provider'
+                  ? providerBindsToPeerTrackUri(
+                      row.client_upid,
+                      row.server_upid,
+                    )
+                  : bindsToPeerTrackUri(row.client_upid, row.server_upid),
+                direction === 'binds_to',
+                row.binding_kind === 'provider'
+                  ? "Go to client's Provider binds to slice"
+                  : "Go to client's Binds to slice",
+              ),
+            }),
+            m(TreeNode, {
+              left: 'Server',
+              right: renderEndpoint(
+                formatEndpoint(row.server_process_name, row.server_pid),
+                row.binding_kind === 'provider'
+                  ? providerBoundByPeerTrackUri(
+                      row.server_upid,
+                      row.client_upid,
+                    )
+                  : boundByPeerTrackUri(row.server_upid, row.client_upid),
+                direction === 'bound_by',
+                row.binding_kind === 'provider'
+                  ? "Go to server's Provider bound by slice"
+                  : "Go to server's Bound by slice",
+              ),
+            }),
+            m(TreeNode, {left: 'Target', right: row.target}),
+            row.intent_action !== null &&
+              row.intent_action !== '' &&
+              m(TreeNode, {left: 'Intent action', right: row.intent_action}),
+            row.bind_flags !== null &&
+              row.bind_flags !== '' &&
+              m(TreeNode, {left: 'Bind flags', right: row.bind_flags}),
+            row.stability !== null &&
+              row.stability !== '' &&
+              m(TreeNode, {left: 'Stability', right: row.stability}),
+          ]),
+        ),
+      ),
+    );
+  }
+}
diff --git a/ui/src/plugins/com.android.ProcessState/index.ts b/ui/src/plugins/com.android.ProcessState/index.ts
index c3b3d18..4f81bed 100644
--- a/ui/src/plugins/com.android.ProcessState/index.ts
+++ b/ui/src/plugins/com.android.ProcessState/index.ts
@@ -13,12 +13,14 @@
 // limitations under the License.
 
 import {HSLColor} from '../../base/color';
+import {getOrCreate} from '../../base/utils';
 import {createAggregationTab} from '../../components/aggregation_adapter';
 import {
   getColorForSlice,
   GRAY,
   makeColorScheme,
 } from '../../components/colorizer';
+import {CounterTrack} from '../../components/tracks/counter_track';
 import {SliceTrack} from '../../components/tracks/slice_track';
 import type {PerfettoPlugin} from '../../public/plugin';
 import type {Trace} from '../../public/trace';
@@ -35,15 +37,28 @@
 } from '../../trace_processor/query_result';
 import ProcessThreadGroupsPlugin from '../dev.perfetto.ProcessThreadGroups';
 import {
+  bindsToPeerTrackUri,
+  bindsToTrackUri,
+  boundByPeerTrackUri,
+  boundByTrackUri,
   ProcessExitsAggregator,
   ProcessStartsAggregator,
   ProcessStateResidencyAggregator,
   ProcessStateTransitionsAggregator,
   processTrackUri,
+  providerBindsToPeerTrackUri,
+  providerBindsToTrackUri,
+  providerBoundByPeerTrackUri,
+  providerBoundByTrackUri,
+  TAG_BINDS_TO_TRACK,
+  TAG_BOUND_BY_TRACK,
   TAG_COUNT_TRACK,
   TAG_PROCESS_TRACK,
 } from './aggregators';
-import {ProcessStateDetailsPanel} from './details_panel';
+import {
+  BindingSliceDetailsPanel,
+  ProcessStateDetailsPanel,
+} from './details_panel';
 import {ProcessStateCountTrack} from './state_count_track';
 
 const BASE_SCHEMA = {
@@ -89,6 +104,31 @@
   state: STR,
 } as const;
 
+const BINDING_SCHEMA = {
+  id: NUM,
+  ts: LONG,
+  dur: LONG,
+  binding_kind: STR,
+  client_upid: NUM,
+  client_pid: NUM,
+  client_uid: NUM_NULL,
+  client_process_name: STR_NULL,
+  server_upid: NUM,
+  server_pid: NUM,
+  server_uid: NUM_NULL,
+  server_process_name: STR_NULL,
+  target: STR,
+  intent_action: STR_NULL,
+  bind_flags: STR_NULL,
+  stability: STR_NULL,
+} as const;
+
+interface BindingPeer {
+  readonly peerUpid: number;
+  readonly peerPid: number;
+  readonly peerName: string | null;
+}
+
 const SLATE = makeColorScheme(new HSLColor([210, 18, 48]));
 
 // The per-process tracks come in their hundreds, so keep them compact.
@@ -97,8 +137,8 @@
 // Below every other process-scoped track (-50..30) so it appears first.
 const PROCESS_GROUP_SORT_ORDER = -100;
 
-// Keeps the freezer lanes out of the aggregators, which scope by the state
-// track's tag.
+// Keeps the freezer and binding lanes out of the aggregators, which scope by
+// the state track's tag.
 const TAG_FREEZER_TRACK = 'android_freezer';
 
 /**
@@ -113,7 +153,7 @@
   static readonly id = 'com.android.ProcessState';
   static readonly description =
     'Visualizes Android framework process states: per-state concurrency ' +
-    'counters, and per-process state and freezer timelines.';
+    'counters, and per-process state, freezer, and binding timelines.';
   static readonly dependencies = [ProcessThreadGroupsPlugin];
 
   async onTraceLoad(ctx: Trace): Promise<void> {
@@ -121,9 +161,11 @@
       return;
     }
 
+    const hasBindings = await this.hasProcessBindingData(ctx);
     await ctx.engine.query(`
       INCLUDE PERFETTO MODULE android.process_state;
       INCLUDE PERFETTO MODULE android.freezer;
+      ${hasBindings ? 'INCLUDE PERFETTO MODULE android.process_bindings;' : ''}
     `);
 
     ctx.selection.registerAreaSelectionTab(
@@ -144,7 +186,7 @@
       isSummary: true,
     });
     group.addChildLast(await this.createConcurrencyTracks(ctx));
-    group.addChildLast(await this.createProcessTracks(ctx));
+    group.addChildLast(await this.createProcessTracks(ctx, hasBindings));
     ctx.defaultWorkspace.addChildInOrder(group);
   }
 
@@ -158,6 +200,16 @@
     return result.ok && result.value.firstRow({cnt: NUM}).cnt > 0;
   }
 
+  private async hasProcessBindingData(ctx: Trace): Promise<boolean> {
+    const result = await ctx.engine.query(`
+      SELECT
+        EXISTS(SELECT 1 FROM slice WHERE category = 'service_state')
+        OR EXISTS(SELECT 1 FROM slice WHERE category = 'provider_state')
+        AS hasBindings
+    `);
+    return result.firstRow({hasBindings: NUM}).hasBindings > 0;
+  }
+
   // One counter per proc state, showing how many processes were in that state
   // at any point in time. Ordered by declaration order in the proto.
   private async createConcurrencyTracks(ctx: Trace): Promise<TrackNode> {
@@ -193,12 +245,15 @@
     return summary;
   }
 
-  // One timeline per process, with its freezer timeline as a child when the
-  // trace has freezer data for it. Ordered by uid so that the successive
+  // One timeline per process, with its freezer and binding timelines as
+  // children when present. Ordered by uid so that the successive
   // processes of a respawning app sit next to each other - that adjacency is
   // the only thing tying an app's lifetimes together, since each restart gets
   // its own upid.
-  private async createProcessTracks(ctx: Trace): Promise<TrackNode> {
+  private async createProcessTracks(
+    ctx: Trace,
+    hasBindings: boolean,
+  ): Promise<TrackNode> {
     const byProcess = new TrackNode({name: 'By process', isSummary: true});
     const groups = ctx.plugins.getPlugin(ProcessThreadGroupsPlugin);
 
@@ -217,6 +272,81 @@
         pid
     `);
 
+    const serviceBoundByPeersByUpid = new Map<number, BindingPeer[]>();
+    const serviceBindsToPeersByUpid = new Map<number, BindingPeer[]>();
+    const providerBoundByPeersByUpid = new Map<number, BindingPeer[]>();
+    const providerBindsToPeersByUpid = new Map<number, BindingPeer[]>();
+    if (hasBindings) {
+      const collectPeers = async (
+        sql: string,
+        serviceOut: Map<number, BindingPeer[]>,
+        providerOut: Map<number, BindingPeer[]>,
+      ) => {
+        const res = await ctx.engine.query(sql);
+        for (
+          const it = res.iter({
+            binding_kind: STR,
+            upid: NUM,
+            peer_upid: NUM,
+            peer_pid: NUM,
+            peer_name: STR_NULL,
+          });
+          it.valid();
+          it.next()
+        ) {
+          const out = it.binding_kind === 'provider' ? providerOut : serviceOut;
+          getOrCreate(out, it.upid, () => []).push({
+            peerUpid: it.peer_upid,
+            peerPid: it.peer_pid,
+            peerName: it.peer_name,
+          });
+        }
+      };
+
+      await collectPeers(
+        `
+          SELECT
+            binding_kind,
+            server_upid AS upid,
+            client_upid AS peer_upid,
+            client_pid AS peer_pid,
+            client_process_name AS peer_name
+          FROM _android_process_bindings
+          GROUP BY binding_kind, server_upid, client_upid
+          ORDER BY
+            binding_kind,
+            server_upid,
+            client_uid NULLS LAST,
+            client_process_name NULLS LAST,
+            min(ts),
+            client_pid
+        `,
+        serviceBoundByPeersByUpid,
+        providerBoundByPeersByUpid,
+      );
+      await collectPeers(
+        `
+          SELECT
+            binding_kind,
+            client_upid AS upid,
+            server_upid AS peer_upid,
+            server_pid AS peer_pid,
+            server_process_name AS peer_name
+          FROM _android_process_bindings
+          GROUP BY binding_kind, client_upid, server_upid
+          ORDER BY
+            binding_kind,
+            client_upid,
+            server_uid NULLS LAST,
+            server_process_name NULLS LAST,
+            min(ts),
+            server_pid
+        `,
+        serviceBindsToPeersByUpid,
+        providerBindsToPeersByUpid,
+      );
+    }
+
     for (
       const it = processes.iter({
         upid: NUM,
@@ -321,6 +451,84 @@
         );
       }
 
+      const serviceBoundByPeers = serviceBoundByPeersByUpid.get(upid);
+      if (serviceBoundByPeers !== undefined) {
+        this.attachBindingTracks(ctx, processGroup, overviewNode, groupNode, {
+          upid,
+          bindingKind: 'service',
+          direction: 'bound_by',
+          rootUri: boundByTrackUri(upid),
+          rootName: 'Bound by',
+          tag: TAG_BOUND_BY_TRACK,
+          rootDescription: `Number of active incoming service bindings to ${name} (${pid}) over time.`,
+          selfCol: 'server_upid',
+          peerCol: 'client_upid',
+          peers: serviceBoundByPeers,
+          peerUri: (clientUpid) => boundByPeerTrackUri(upid, clientUpid),
+          peerDescription: (peerLabel) =>
+            `Incoming service bindings from ${peerLabel} to ${name} (${pid}).`,
+        });
+      }
+
+      const serviceBindsToPeers = serviceBindsToPeersByUpid.get(upid);
+      if (serviceBindsToPeers !== undefined) {
+        this.attachBindingTracks(ctx, processGroup, overviewNode, groupNode, {
+          upid,
+          bindingKind: 'service',
+          direction: 'binds_to',
+          rootUri: bindsToTrackUri(upid),
+          rootName: 'Binds to',
+          tag: TAG_BINDS_TO_TRACK,
+          rootDescription: `Number of active outgoing service bindings from ${name} (${pid}) over time.`,
+          selfCol: 'client_upid',
+          peerCol: 'server_upid',
+          peers: serviceBindsToPeers,
+          peerUri: (serverUpid) => bindsToPeerTrackUri(upid, serverUpid),
+          peerDescription: (peerLabel) =>
+            `Outgoing service bindings from ${name} (${pid}) to ${peerLabel}.`,
+        });
+      }
+
+      const providerBoundByPeers = providerBoundByPeersByUpid.get(upid);
+      if (providerBoundByPeers !== undefined) {
+        this.attachBindingTracks(ctx, processGroup, overviewNode, groupNode, {
+          upid,
+          bindingKind: 'provider',
+          direction: 'bound_by',
+          rootUri: providerBoundByTrackUri(upid),
+          rootName: 'Provider bound by',
+          tag: TAG_BOUND_BY_TRACK,
+          rootDescription: `Number of active incoming content provider connections to ${name} (${pid}) over time.`,
+          selfCol: 'server_upid',
+          peerCol: 'client_upid',
+          peers: providerBoundByPeers,
+          peerUri: (clientUpid) =>
+            providerBoundByPeerTrackUri(upid, clientUpid),
+          peerDescription: (peerLabel) =>
+            `Incoming content provider connections from ${peerLabel} to ${name} (${pid}).`,
+        });
+      }
+
+      const providerBindsToPeers = providerBindsToPeersByUpid.get(upid);
+      if (providerBindsToPeers !== undefined) {
+        this.attachBindingTracks(ctx, processGroup, overviewNode, groupNode, {
+          upid,
+          bindingKind: 'provider',
+          direction: 'binds_to',
+          rootUri: providerBindsToTrackUri(upid),
+          rootName: 'Provider binds to',
+          tag: TAG_BINDS_TO_TRACK,
+          rootDescription: `Number of active outgoing content provider connections from ${name} (${pid}) over time.`,
+          selfCol: 'client_upid',
+          peerCol: 'server_upid',
+          peers: providerBindsToPeers,
+          peerUri: (serverUpid) =>
+            providerBindsToPeerTrackUri(upid, serverUpid),
+          peerDescription: (peerLabel) =>
+            `Outgoing content provider connections from ${name} (${pid}) to ${peerLabel}.`,
+        });
+      }
+
       byProcess.addChildLast(overviewNode);
       processGroup?.addChildInOrder(groupNode);
     }
@@ -328,6 +536,97 @@
     return byProcess;
   }
 
+  private attachBindingTracks(
+    ctx: Trace,
+    processGroup: TrackNode | undefined,
+    overviewParent: TrackNode,
+    groupParent: TrackNode,
+    opts: {
+      upid: number;
+      bindingKind: 'service' | 'provider';
+      direction: 'bound_by' | 'binds_to';
+      rootUri: string;
+      rootName: string;
+      tag: string;
+      rootDescription: string;
+      selfCol: 'server_upid' | 'client_upid';
+      peerCol: 'client_upid' | 'server_upid';
+      peers: ReadonlyArray<BindingPeer>;
+      peerUri: (peerUpid: number) => string;
+      peerDescription: (peerLabel: string) => string;
+    },
+  ): void {
+    const overviewRootUri = this.registerProcessTrack(ctx, processGroup, {
+      uri: opts.rootUri,
+      tag: opts.tag,
+      upid: opts.upid,
+      description: opts.rootDescription,
+      create: (trackUri) =>
+        CounterTrack.create({
+          trace: ctx,
+          uri: trackUri,
+          sqlSource: `
+            SELECT ts, count AS value
+            FROM _android_process_binding_counts
+            WHERE binding_kind = '${opts.bindingKind}'
+              AND direction = '${opts.direction}'
+              AND upid = ${opts.upid}
+          `,
+        }),
+    });
+    const overviewRootNode = new TrackNode({
+      uri: overviewRootUri,
+      name: opts.rootName,
+    });
+    const groupRootNode = new TrackNode({
+      uri: opts.rootUri,
+      name: opts.rootName,
+    });
+
+    for (const peer of opts.peers) {
+      const peerLabel =
+        peer.peerName !== null
+          ? `${peer.peerName} ${peer.peerPid}`
+          : `${peer.peerPid}`;
+      const childUri = opts.peerUri(peer.peerUpid);
+      const overviewChildUri = this.registerProcessTrack(ctx, processGroup, {
+        uri: childUri,
+        tag: opts.tag,
+        upid: opts.upid,
+        description: opts.peerDescription(peerLabel),
+        create: (trackUri, ownerUri) =>
+          SliceTrack.create({
+            trace: ctx,
+            uri: trackUri,
+            dataset: new SourceDataset({
+              schema: BINDING_SCHEMA,
+              src: `
+                SELECT *
+                FROM _android_process_bindings
+                WHERE binding_kind = '${opts.bindingKind}'
+                  AND ${opts.selfCol} = ${opts.upid}
+              `,
+              filter: {col: opts.peerCol, eq: peer.peerUpid},
+            }),
+            sliceLayout: COMPACT_SLICES,
+            sliceName: (row) => row.target,
+            colorizer: (row) => getColorForSlice(row.target),
+            detailsPanel: (row) =>
+              new BindingSliceDetailsPanel(ctx, row, opts.direction, ownerUri),
+          }),
+      });
+      overviewRootNode.addChildLast(
+        new TrackNode({uri: overviewChildUri, name: peerLabel}),
+      );
+      groupRootNode.addChildLast(
+        new TrackNode({uri: childUri, name: peerLabel}),
+      );
+    }
+
+    overviewParent.addChildLast(overviewRootNode);
+    groupParent.addChildLast(groupRootNode);
+  }
+
   // Registers a process-scoped track. The process group owns it when there is
   // one; the 'By process' overview then gets a mirror under `${uri}.overview`
   // that links back to the owner, which alone keeps rootTableName so that