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
This commit is contained in:
Priyanka
2021-09-08 14:46:57 +00:00
parent a497569cc1
commit b415682b29
6 changed files with 35 additions and 15 deletions

View File

@@ -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;
},

View File

@@ -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: {

View File

@@ -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 {

View File

@@ -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;

View File

@@ -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);
},

View File

@@ -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 };