Skip to content

Commit

Permalink
AndroidNetwork plugin: ensure battery_stats metric is run before refe…
Browse files Browse the repository at this point in the history
…rencing its output

For users that disable the "run metric on load" UI flags, the network
plugin results in an error. The UI is fine after dismissing the error
dialog, but let's get rid of the dialog at the cost of running the
metric anyway.

Imo this is a stopgap, we shouldn't even run plugins on traces that
don't contain the relevant events (such as running android plugins on
desktop linux traces).

Bug: 322498817
Change-Id: Ic91750f92bfc0d4623c630c6f16a9f5a8e49abd1
  • Loading branch information
rsavitski committed Jan 29, 2024
1 parent 332b581 commit 8245a8c
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,6 @@ const MODEM_RIL_STRENGTH = `
USING SPAN_JOIN(RilSignalStrength PARTITIONED track_id, ScreenOn)`;

const MODEM_RIL_CHANNELS_PREAMBLE = `
SELECT IMPORT('android.battery_stats');
CREATE OR REPLACE PERFETTO FUNCTION EXTRACT_KEY_VALUE(source STRING, key_name STRING) RETURNS STRING AS
SELECT SUBSTR(trimmed, INSTR(trimmed, "=")+1, INSTR(trimmed, ",") - INSTR(trimmed, "=") - 1)
FROM (SELECT SUBSTR($source, INSTR($source, $key_name)) AS trimmed);`;
Expand Down Expand Up @@ -943,6 +941,7 @@ class AndroidLongBatteryTracing implements Plugin {
WHERE track_name = "${track}"`,
groupId);

await e.query(`SELECT IMPORT('android.battery_stats');`);
return flatten([
query('Top App', 'battery_stats.top'),
this.addSliceTrack(
Expand Down

0 comments on commit 8245a8c

Please sign in to comment.