From b415682b29d2ffaad1e08c8ee418460cfe3cdff3 Mon Sep 17 00:00:00 2001 From: Priyanka Date: Wed, 8 Sep 2021 14:46:57 +0000 Subject: [PATCH] Add display support for tag fields and app pairs. LayerId now present on windows, and window token will be added to tags where possible, so display support added on frontend. Also, app pairs transitions added to colour code. Bug: b/199274556 Test: upload a trace to ensure everything still displays as normal. Change-Id: I5d0c2e26ac5f18090d0fe6e8df5f4e1305822c41 --- tools/winscope/src/TraceView.vue | 13 ++++++++++--- tools/winscope/src/TreeView.vue | 17 +++++++++++------ tools/winscope/src/flickerlib/tags/Tag.ts | 2 ++ .../src/flickerlib/tags/TransitionType.ts | 2 ++ tools/winscope/src/mixins/Timeline.js | 14 ++++++++------ tools/winscope/src/utils/consts.js | 2 ++ 6 files changed, 35 insertions(+), 15 deletions(-) diff --git a/tools/winscope/src/TraceView.vue b/tools/winscope/src/TraceView.vue index ab77d3542..69cb3e562 100644 --- a/tools/winscope/src/TraceView.vue +++ b/tools/winscope/src/TraceView.vue @@ -312,15 +312,22 @@ export default { return prevEntry; }, + /** Checks for match in window manager properties taskId, layerId, or windowToken, + * or surface flinger property id + */ + isPropertyMatch(flickerItem, entryItem) { + return flickerItem.taskId === entryItem.taskId || + flickerItem.windowToken === entryItem.windowToken || + flickerItem.layerId === entryItem.layerId || + flickerItem.layerId === entryItem.id; + }, /** Performs check for id match between entry and present tags/errors * must be carried out for every present tag/error */ matchItems(flickerItems, entryItem) { var match = false; flickerItems.forEach(flickerItem => { - if (flickerItem.taskId===entryItem.taskId || flickerItem.layerId===entryItem.id) { - match = true; - } + if (this.isPropertyMatch(flickerItem, entryItem)) match = true; }); return match; }, diff --git a/tools/winscope/src/TreeView.vue b/tools/winscope/src/TreeView.vue index 846924e6e..473799c5a 100644 --- a/tools/winscope/src/TreeView.vue +++ b/tools/winscope/src/TreeView.vue @@ -446,9 +446,14 @@ export default { } }, - /** Check if tag/error id matches entry id */ - isIdMatch(a, b) { - return a.taskId===b.taskId || a.layerId===b.id; + /** Checks for match in window manager properties taskId, layerId, or windowToken, + * or surface flinger property id + */ + isPropertyMatch(flickerItem, entryItem) { + return flickerItem.taskId === entryItem.taskId || + flickerItem.windowToken === entryItem.windowToken || + flickerItem.layerId === entryItem.layerId || + flickerItem.layerId === entryItem.id; }, /** Performs check for id match between entry and present tags/errors * exits once match has been found @@ -456,7 +461,7 @@ export default { matchItems(flickerItems) { var match = false; flickerItems.every(flickerItem => { - if (this.isIdMatch(flickerItem, this.item)) { + if (this.isPropertyMatch(flickerItem, this.item)) { match = true; return false; } @@ -476,7 +481,7 @@ export default { var transitions = []; var ids = []; this.currentTags.forEach(tag => { - if (!ids.includes(tag.id) && this.isIdMatch(tag, this.item)) { + if (!ids.includes(tag.id) && this.isPropertyMatch(tag, this.item)) { transitions.push(tag.transition); ids.push(tag.id); } @@ -484,7 +489,7 @@ export default { return transitions; }, getCurrentErrorTags() { - return this.currentErrors.filter(error => this.isIdMatch(error, this.item)); + return this.currentErrors.filter(error => this.isPropertyMatch(error, this.item)); }, }, computed: { diff --git a/tools/winscope/src/flickerlib/tags/Tag.ts b/tools/winscope/src/flickerlib/tags/Tag.ts index 8ecebc65c..3873ca39f 100644 --- a/tools/winscope/src/flickerlib/tags/Tag.ts +++ b/tools/winscope/src/flickerlib/tags/Tag.ts @@ -27,6 +27,8 @@ const transitionTypeMap = new Map([ ['APP_CLOSE', TransitionType.APP_CLOSE], ['IME_APPEAR', TransitionType.IME_APPEAR], ['IME_DISAPPEAR', TransitionType.IME_DISAPPEAR], + ['APP_PAIRS_ENTER', TransitionType.APP_PAIRS_ENTER], + ['APP_PAIRS_EXIT', TransitionType.APP_PAIRS_EXIT], ]); Tag.fromProto = function (proto: any): Tag { diff --git a/tools/winscope/src/flickerlib/tags/TransitionType.ts b/tools/winscope/src/flickerlib/tags/TransitionType.ts index aebc72f57..e0e22b31f 100644 --- a/tools/winscope/src/flickerlib/tags/TransitionType.ts +++ b/tools/winscope/src/flickerlib/tags/TransitionType.ts @@ -23,6 +23,8 @@ enum TransitionType { APP_CLOSE = 'APP_CLOSE', IME_APPEAR = 'IME_APPEAR', IME_DISAPPEAR = 'IME_DISAPPEAR', + APP_PAIRS_ENTER = 'APP_PAIRS_ENTER', + APP_PAIRS_EXIT = 'APP_PAIRS_EXIT', }; export default TransitionType; \ No newline at end of file diff --git a/tools/winscope/src/mixins/Timeline.js b/tools/winscope/src/mixins/Timeline.js index b3702c55b..c3ea7a698 100644 --- a/tools/winscope/src/mixins/Timeline.js +++ b/tools/winscope/src/mixins/Timeline.js @@ -162,7 +162,8 @@ export default { id[0].transition, 0, id[0].layerId, - id[0].taskId + id[0].taskId, + id[0].windowToken ); transitions.push(transition); } @@ -360,19 +361,20 @@ export default { * @param {number} endTs - The timestamp at which the transition ends. * @param {string} transitionType - The type of transition. * @param {number} overlap - The degree to which the transition overlaps with others. - * @param {number} layerId - Determines if transition is associated with SF trace. - * @param {number} taskId - Determines if transition is associated with WM trace. + * @param {number} layerId - Helps determine if transition is associated with SF trace. + * @param {number} taskId - Helps determine if transition is associated with WM trace. + * @param {number} windowToken - Helps determine if transition is associated with WM trace. * @return {Transition} A transition object transformed to the timeline's crop and * scale parameter. */ - generateTransition(startTs, endTs, transitionType, overlap, layerId, taskId) { + generateTransition(startTs, endTs, transitionType, overlap, layerId, taskId, windowToken) { const transitionWidth = this.objectWidth(startTs, endTs); const transitionDesc = transitionMap.get(transitionType).desc; const transitionColor = transitionMap.get(transitionType).color; var tooltip = `${transitionDesc}. Start: ${nanos_to_string(startTs)}. End: ${nanos_to_string(endTs)}.`; - if (layerId!==0 && taskId===0) tooltip += " SF only."; - else if (taskId!==0 && layerId===0) tooltip += " WM only."; + if (layerId !== 0 && taskId === 0 && windowToken === "") tooltip += " SF only."; + else if ((taskId !== 0 || windowToken !== "") && layerId === 0) tooltip += " WM only."; return new Transition(this.position(startTs), startTs, endTs, transitionWidth, transitionColor, overlap, tooltip); }, diff --git a/tools/winscope/src/utils/consts.js b/tools/winscope/src/utils/consts.js index e43a2c1c6..b083f0f4d 100644 --- a/tools/winscope/src/utils/consts.js +++ b/tools/winscope/src/utils/consts.js @@ -56,6 +56,8 @@ const transitionMap = new Map([ [TransitionType.APP_CLOSE, {desc: 'Closing app', color: '#d10ddfff'}], [TransitionType.IME_APPEAR, {desc: 'IME appearing', color: '#ff9900ff'}], [TransitionType.IME_DISAPPEAR, {desc: 'IME disappearing', color: '#ad6800ff'}], + [TransitionType.APP_PAIRS_ENTER, {desc: 'Entering app pairs mode', color: 'rgb(58, 151, 39)'}], + [TransitionType.APP_PAIRS_EXIT, {desc: 'Exiting app pairs mode', color: 'rgb(45, 110, 32)'}], ]) export { WebContentScriptMessageType, NAVIGATION_STYLE, SEARCH_TYPE, logLevel, transitionMap };