@@ -107,9 +114,7 @@
\ No newline at end of file
diff --git a/tools/winscope/src/TraceView.vue b/tools/winscope/src/TraceView.vue
index 69cb3e562..872caf916 100644
--- a/tools/winscope/src/TraceView.vue
+++ b/tools/winscope/src/TraceView.vue
@@ -45,7 +45,11 @@
@@ -98,7 +102,11 @@
-
+
@@ -335,6 +343,11 @@ export default {
isEntryTagMatch(entryItem) {
return this.matchItems(this.presentTags, entryItem) || this.matchItems(this.presentErrors, entryItem);
},
+
+ /** determines whether left/right arrow keys should move cursor in input field */
+ updateInputMode(isInputMode) {
+ this.store.isInputMode = isInputMode;
+ },
},
created() {
this.setData(this.file.data[this.file.selectedIndex ?? 0]);
diff --git a/tools/winscope/src/mixins/Timeline.js b/tools/winscope/src/mixins/Timeline.js
index c3ea7a698..d938bcbb0 100644
--- a/tools/winscope/src/mixins/Timeline.js
+++ b/tools/winscope/src/mixins/Timeline.js
@@ -169,7 +169,7 @@ export default {
}
//sort transitions in ascending start position in order to handle overlap
- transitions.sort((a, b) => (a.startPos > b.startPos) ? 1: -1);
+ transitions.sort((a, b) => (a.startPos > b.startPos) ? 1 : -1);
//compare each transition to the ones that came before
for (let curr=0; curr this.position(error.timestamp));
+ const errorPositions = this.errors.map(
+ error => ({ pos: this.position(error.timestamp), ts: error.timestamp })
+ );
return Object.freeze(errorPositions);
},
},
@@ -342,6 +344,16 @@ export default {
this.$store.dispatch('updateTimelineTime', timestamp);
},
+ /**
+ * Handles the error click event.
+ * When an error in the timeline is clicked this function will update the timeline
+ * to match the error timestamp.
+ * @param {number} errorTimestamp
+ */
+ onErrorClick(errorTimestamp) {
+ this.$store.dispatch('updateTimelineTime', errorTimestamp);
+ },
+
/**
* Generate a block object that can be used by the timeline SVG to render
* a transformed block that starts at `startTs` and ends at `endTs`.
@@ -373,8 +385,11 @@ export default {
const transitionColor = transitionMap.get(transitionType).color;
var tooltip = `${transitionDesc}. Start: ${nanos_to_string(startTs)}. End: ${nanos_to_string(endTs)}.`;
- if (layerId !== 0 && taskId === 0 && windowToken === "") tooltip += " SF only.";
- else if ((taskId !== 0 || windowToken !== "") && 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/transform.js b/tools/winscope/src/transform.js
index 96e4785ef..51bedafd2 100644
--- a/tools/winscope/src/transform.js
+++ b/tools/winscope/src/transform.js
@@ -15,6 +15,7 @@
*/
import {DiffType} from './utils/diff.js';
+import {regExpTimestampSearch} from './utils/consts';
// kind - a type used for categorization of different levels
// name - name of the node
@@ -400,5 +401,18 @@ function get_visible_chip() {
return {short: 'V', long: 'visible', class: 'default'};
}
+// Returns closest timestamp in timeline based on search input*/
+function getClosestTimestamp(searchInput, timeline) {
+ if (regExpTimestampSearch.test(searchInput)) {
+ var roundedTimestamp = parseInt(searchInput);
+ } else {
+ var roundedTimestamp = string_to_nanos(searchInput);
+ }
+ const closestTimestamp = timeline.reduce((prev, curr) => {
+ return Math.abs(curr-roundedTimestamp) < Math.abs(prev-roundedTimestamp) ? curr : prev;
+ });
+ return closestTimestamp;
+}
+
// eslint-disable-next-line camelcase
-export {transform, ObjectTransformer, nanos_to_string, string_to_nanos, get_visible_chip};
+export {transform, ObjectTransformer, nanos_to_string, string_to_nanos, get_visible_chip, getClosestTimestamp};
diff --git a/tools/winscope/src/utils/consts.js b/tools/winscope/src/utils/consts.js
index b083f0f4d..52124ce90 100644
--- a/tools/winscope/src/utils/consts.js
+++ b/tools/winscope/src/utils/consts.js
@@ -60,4 +60,7 @@ const transitionMap = new Map([
[TransitionType.APP_PAIRS_EXIT, {desc: 'Exiting app pairs mode', color: 'rgb(45, 110, 32)'}],
])
-export { WebContentScriptMessageType, NAVIGATION_STYLE, SEARCH_TYPE, logLevel, transitionMap };
+//used to split timestamp search input by unit, to convert to nanoseconds
+const regExpTimestampSearch = new RegExp(/^\d+$/);
+
+export { WebContentScriptMessageType, NAVIGATION_STYLE, SEARCH_TYPE, logLevel, transitionMap, regExpTimestampSearch };