1// Copyright (C) 2023 The Android Open Source Project 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15import {Plugin, PluginContextTrace, PluginDescriptor} from '../../public'; 16 17class LargeScreensPerf implements Plugin { 18 async onTraceLoad(ctx: PluginContextTrace): Promise<void> { 19 ctx.registerCommand({ 20 id: 'dev.perfetto.LargeScreensPerf#PinUnfoldLatencyTracks', 21 name: 'Pin: Unfold latency tracks', 22 callback: () => { 23 ctx.timeline.pinTracksByPredicate((tags) => { 24 return ( 25 !!tags.name?.includes('UnfoldTransition') || 26 tags.name?.includes('Screen on blocked') || 27 tags.name?.includes('hingeAngle') || 28 tags.name?.includes('UnfoldLightRevealOverlayAnimation') || 29 tags.name?.startsWith('waitForAllWindowsDrawn') || 30 tags.name?.endsWith('UNFOLD_ANIM>') || 31 tags.name?.endsWith('UNFOLD>') || 32 tags.name == 'Waiting for KeyguardDrawnCallback#onDrawn' || 33 tags.name == 'FoldedState' || 34 tags.name == 'FoldUpdate' 35 ); 36 }); 37 }, 38 }); 39 } 40} 41 42export const plugin: PluginDescriptor = { 43 pluginId: 'dev.perfetto.LargeScreensPerf', 44 plugin: LargeScreensPerf, 45}; 46