From 6744711cbab87bf2157eac5fb6df2b7e8f0b132e Mon Sep 17 00:00:00 2001 From: Hui Ling Shi Date: Tue, 14 Jun 2022 07:25:47 +0000 Subject: [PATCH] [2] Add IME processing for ADB-captured traces IME processing refers to adding WM and SF properties into corresponding IME entries. Shared functions for this are in 'ime_processing.js', called when IME and WM / SF traces are input via both ADB or file upload. - WM and SF entries are displayed as nodes in the 'Hierarchy' sub-panel of IME panels. - The SF entry is pruned to only the branch containing 'ImeContainer' node. - The WM entry is not yet filtered. Screenshots: - Before: https://screenshot.googleplex.com/BYU279cqkTQ5iBP.png - After: https://screenshot.googleplex.com/3Uhj3XBcpp9Cc6u.png - Note: screenshots only show 1 IME panel; same changes are made to all 3 IME panels Bug: 236226833 Test: manual via local Winscope CL[1]: If64aff9e899363188010633758e36be474666984 Change-Id: I31d96a43769d64d1e0151b8d620d9d5beaaf7e79 --- tools/winscope/src/DataInput.vue | 5 + tools/winscope/src/TraceView.vue | 23 +--- tools/winscope/src/ime_processing.js | 122 ++++++++++++++++++ tools/winscope/src/proxyclient/ProxyClient.ts | 4 + tools/winscope/src/utils/utils.js | 45 ++++++- 5 files changed, 171 insertions(+), 28 deletions(-) create mode 100644 tools/winscope/src/ime_processing.js diff --git a/tools/winscope/src/DataInput.vue b/tools/winscope/src/DataInput.vue index c4f1cf082..53dda6cbc 100644 --- a/tools/winscope/src/DataInput.vue +++ b/tools/winscope/src/DataInput.vue @@ -128,6 +128,7 @@ import { UndetectableFileType, } from './decode.js'; import {WebContentScriptMessageType} from './utils/consts'; +import {combineWmSfWithImeDataIfExisting} from './ime_processing.js'; export default { name: 'datainput', @@ -392,6 +393,10 @@ export default { if (tmpTraceName !== undefined) { this.traceName = tmpTraceName; } + + if (this.store.betaFeatures.newImePanels) { + combineWmSfWithImeDataIfExisting(this.dataFiles); + } }, getFileNameWithoutZipExtension(file) { diff --git a/tools/winscope/src/TraceView.vue b/tools/winscope/src/TraceView.vue index 498a8352f..4c36466a8 100644 --- a/tools/winscope/src/TraceView.vue +++ b/tools/winscope/src/TraceView.vue @@ -160,7 +160,7 @@ import PropertiesTableView from './PropertiesTableView'; import {ObjectTransformer} from './transform.js'; import {DiffGenerator, defaultModifiedCheck} from './utils/diff.js'; import {TRACE_TYPES, DUMP_TYPES} from './decode.js'; -import {isPropertyMatch, stableIdCompatibilityFixup} from './utils/utils.js'; +import {isPropertyMatch, stableIdCompatibilityFixup, getFilter} from './utils/utils.js'; import {CompatibleFeatures} from './utils/compatibility.js'; import {getPropertiesForDisplay} from './flickerlib/mixin'; import ObjectFormatter from './flickerlib/ObjectFormatter'; @@ -476,27 +476,6 @@ export default { }, }; -function getFilter(filterString) { - const filterStrings = filterString.split(','); - const positive = []; - const negative = []; - filterStrings.forEach((f) => { - if (f.startsWith('!')) { - const regex = new RegExp(f.substring(1), "i"); - negative.push((s) => !regex.test(s)); - } else { - const regex = new RegExp(f, "i"); - positive.push((s) => regex.test(s)); - } - }); - const filter = (item) => { - const apply = (f) => f(String(item.name)); - return (positive.length === 0 || positive.some(apply)) && - (negative.length === 0 || negative.every(apply)); - }; - return filter; -} -