• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1--
2-- Copyright 2022 The Android Open Source Project
3--
4-- Licensed under the Apache License, Version 2.0 (the "License");
5-- you may not use this file except in compliance with the License.
6-- You may obtain a copy of the License at
7--
8--     https://www.apache.org/licenses/LICENSE-2.0
9--
10-- Unless required by applicable law or agreed to in writing, software
11-- distributed under the License is distributed on an "AS IS" BASIS,
12-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-- See the License for the specific language governing permissions and
14-- limitations under the License.
15--
16
17-- Provides a list of broadcast names and processes they were sent to by the
18-- system_server process on U+ devices.
19--
20-- @column type          The name of the broadcast type which was sent.
21-- @column process_name  The process name the broadcast was sent to.
22-- @column queue_name    The name of the broacast queue the broadcast was
23--                       dispatched from.
24CREATE VIEW experimental_android_broadcasts_minsdk_u AS
25WITH
26broadcast_queues AS (
27  SELECT process_track.id, process_track.name AS queue_name
28  FROM process_track
29  JOIN process USING (upid)
30  WHERE
31    process_track.name GLOB 'BroadcastQueue.mRunning*'
32    AND process.name = 'system_server'
33),
34broadcast_process_running AS (
35  SELECT ts, dur, str_split(slice.name, '/', 0) AS process_name, queue_name
36  FROM slice
37  JOIN broadcast_queues ON broadcast_queues.id = slice.track_id
38  WHERE slice.name GLOB '* running'
39)
40SELECT str_split(slice.name, '/', 0) AS type, process_name, queue_name
41FROM broadcast_process_running
42JOIN broadcast_queues USING (queue_name)
43JOIN slice ON (
44  broadcast_process_running.ts < slice.ts
45  AND slice.ts < broadcast_process_running.ts + broadcast_process_running.dur
46  AND slice.track_id = broadcast_queues.id
47  )
48WHERE slice.name GLOB '* scheduled';
49