From 75c9565e5e9dc4710713ecec1ffb00ef1b6e65fc Mon Sep 17 00:00:00 2001 From: Hongming Jin Date: Fri, 22 Jan 2021 10:51:21 -0800 Subject: [PATCH 001/127] Add feature to load accessibility trace file. Test: manual test Bug: 157601519 Change-Id: I0383a0232beead1e363a750adccb23911fb8e38a --- tools/winscope/src/AccessibilityTraceView.vue | 35 +++++++++++++ tools/winscope/src/DataView.vue | 9 +++- tools/winscope/src/decode.js | 28 ++++++++++ tools/winscope/src/mixins/FileType.js | 4 ++ tools/winscope/src/traces/Accessibility.ts | 33 ++++++++++++ tools/winscope/src/transform_accessibility.js | 52 +++++++++++++++++++ 6 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 tools/winscope/src/AccessibilityTraceView.vue create mode 100644 tools/winscope/src/traces/Accessibility.ts create mode 100644 tools/winscope/src/transform_accessibility.js diff --git a/tools/winscope/src/AccessibilityTraceView.vue b/tools/winscope/src/AccessibilityTraceView.vue new file mode 100644 index 000000000..036699e94 --- /dev/null +++ b/tools/winscope/src/AccessibilityTraceView.vue @@ -0,0 +1,35 @@ + + + + + \ No newline at end of file diff --git a/tools/winscope/src/DataView.vue b/tools/winscope/src/DataView.vue index 3ad4c6738..f98f443ba 100644 --- a/tools/winscope/src/DataView.vue +++ b/tools/winscope/src/DataView.vue @@ -30,7 +30,12 @@ save_alt - + + \ No newline at end of file From 5062b341aec284a771afbd0bc72b7fcc1981f7f8 Mon Sep 17 00:00:00 2001 From: Priyanka Date: Mon, 19 Jul 2021 09:51:46 +0000 Subject: [PATCH 018/127] Fixed timeline for uploaded trace + dump files. Now when uploading and opening trace and dump files at the same time, the timeline should be fully interactive in Global, Focused and Targeted modes. Timestamps should appear and change as you click along the timeline. Test: Start a trace. Run a dump on another Winscope instance. End the first trace. Download the files from both instances, upload and open them on a separate instance. Check that the timestamp changes when selecting different parts of the timeline in different modes. bottom of Winscope. Bug: b/163105631 Change-Id: I979dfe5eea9937b64f17ab62b2c068fac507ec87 --- tools/winscope/src/Overlay.vue | 9 +++++++-- tools/winscope/src/decode.js | 6 +++--- tools/winscope/src/main.js | 3 +++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/tools/winscope/src/Overlay.vue b/tools/winscope/src/Overlay.vue index 4bb051e49..0f60280ca 100644 --- a/tools/winscope/src/Overlay.vue +++ b/tools/winscope/src/Overlay.vue @@ -91,7 +91,8 @@ name="navigationStyle" md-dense > - @@ -412,7 +413,11 @@ export default { } if (this.navigationStyle === NAVIGATION_STYLE.FOCUSED) { - return this.focusedFile; + //dumps do not have a timeline, so if scrolling over a dump, show merged timeline + if (this.focusedFile.timeline) { + return this.focusedFile; + } + return this.mergedTimeline; } if (this.navigationStyle === NAVIGATION_STYLE.CUSTOM) { diff --git a/tools/winscope/src/decode.js b/tools/winscope/src/decode.js index 6c95adfd6..953971478 100644 --- a/tools/winscope/src/decode.js +++ b/tools/winscope/src/decode.js @@ -320,7 +320,7 @@ const FILE_DECODERS = { mime: 'application/octet-stream', protoType: SfDumpMessage, transform: SurfaceFlingerDump.fromProto, - timeline: false, + timeline: true, }, }, [FILE_TYPES.WINDOW_MANAGER_DUMP]: { @@ -331,7 +331,7 @@ const FILE_DECODERS = { mime: 'application/octet-stream', protoType: WmDumpMessage, transform: WindowManagerDump.fromProto, - timeline: false, + timeline: true, }, }, [FILE_TYPES.WAYLAND_DUMP]: { @@ -342,7 +342,7 @@ const FILE_DECODERS = { mime: 'application/octet-stream', protoType: WaylandDumpMessage, transform: transform_wl_outputstate, - timeline: false, + timeline: true, }, }, [FILE_TYPES.SCREEN_RECORDING]: { diff --git a/tools/winscope/src/main.js b/tools/winscope/src/main.js index 9c1816505..907e7de0e 100644 --- a/tools/winscope/src/main.js +++ b/tools/winscope/src/main.js @@ -252,6 +252,9 @@ const store = new Vuex.Store({ }, updateTimelineTime(context, timestamp) { for (const file of context.getters.files) { + //dumps do not have a timeline, so only look at files with timelines to update the timestamp + if (!file.timeline) continue; + const type = file.type; const entryIndex = findLastMatchingSorted( file.timeline, From 81ed153564a2505dc89f4309195b6c05cdf8c8a8 Mon Sep 17 00:00:00 2001 From: Priyanka Date: Fri, 16 Jul 2021 14:57:30 +0000 Subject: [PATCH 019/127] Properties view expansion no longer tied to hierarchy view expansion. If an element is selected in the hierarchy view, its properties are displayed in the property view. If the element is subsequently collapsed in the hierarchy, the properties remain expanded. Test: Run a WM trace. Select an element in the hierarchy view. Check its properties are visible. Collapse the element. The properties should not collapse. Bug: 187320866 Change-Id: I7b8fab7d5fa5e502ff1668381be42259a421431c --- tools/winscope/src/TraceView.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/winscope/src/TraceView.vue b/tools/winscope/src/TraceView.vue index 715e719fd..3e343a68f 100644 --- a/tools/winscope/src/TraceView.vue +++ b/tools/winscope/src/TraceView.vue @@ -109,7 +109,6 @@ :item="selectedTree" :filter="propertyFilter" :collapseChildren="true" - :useGlobalCollapsedState="true" :elementView="PropertiesTreeElement" /> From 1937a3827545e498e40d24d3c8b4582d6d936824 Mon Sep 17 00:00:00 2001 From: Priyanka Date: Fri, 16 Jul 2021 14:06:56 +0000 Subject: [PATCH 020/127] If only one trace is run, do not display navigation options for timeline. Test: Run one trace. Check that there is no navigation drop down list to the left of the timeline. Run multiple traces. Check that the navigation drop down list now appears. Bug: 162716882 Change-Id: Ic466dd6b5e9f5e08fad515d31122206b6bd9898f --- tools/winscope/src/Overlay.vue | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tools/winscope/src/Overlay.vue b/tools/winscope/src/Overlay.vue index 4bb051e49..c8cfa8137 100644 --- a/tools/winscope/src/Overlay.vue +++ b/tools/winscope/src/Overlay.vue @@ -81,8 +81,9 @@ @@ -376,7 +377,7 @@ export default { default: const split = this.navigationStyle.split('-'); if (split[0] !== NAVIGATION_STYLE.TARGETED) { - throw new Error('Unexpected nagivation type'); + throw new Error('Unexpected navigation type'); } const fileType = split[1]; @@ -398,7 +399,7 @@ export default { default: const split = this.navigationStyle.split('-'); if (split[0] !== NAVIGATION_STYLE.TARGETED) { - throw new Error('Unexpected nagivation type'); + throw new Error('Unexpected navigation type'); } const fileType = split[1]; @@ -425,12 +426,15 @@ export default { .traces[this.navigationStyle.split('-')[1]]; } - throw new Error('Unexpected Nagivation Style'); + throw new Error('Unexpected Navigation Style'); }, isCropped() { return this.crop != null && (this.crop.left !== 0 || this.crop.right !== 1); }, + multipleTraces() { + return this.timelineFiles.length > 1; + }, }, updated() { this.$nextTick(() => { @@ -589,7 +593,7 @@ export default { default: const split = this.navigationStyle.split('-'); if (split[0] !== NAVIGATION_STYLE.TARGETED) { - throw new Error('Unexpected nagivation type'); + throw new Error('Unexpected navigation type'); } const fileType = split[1]; @@ -816,7 +820,7 @@ export default { margin-top: 4px; } -.nagivation-style-selection-field { +.navigation-style-selection-field { width: 90px; margin-right: 10px; margin-bottom: 0; From cccfe2697eaa74e7090ea5a8b9f33080e6cfef4d Mon Sep 17 00:00:00 2001 From: Nataniel Borges Date: Wed, 21 Jul 2021 12:48:34 +0200 Subject: [PATCH 021/127] Display transform on the SF traces The transform flicker object doesn't have a "isNotEmpty" property (return undefined) and was being ignored. Instead check if object.isEmpty === true to allow objects without a isNotEmpty property to be displayed Bug: 176906864 Test: compile winscope, take a SF trace, check if the layers have a trasnform property Change-Id: Ia466dd6b5e9f5e08fad515d31122206b6bd9898a --- tools/winscope/src/flickerlib/ObjectFormatter.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/winscope/src/flickerlib/ObjectFormatter.ts b/tools/winscope/src/flickerlib/ObjectFormatter.ts index e23684360..b67bfe608 100644 --- a/tools/winscope/src/flickerlib/ObjectFormatter.ts +++ b/tools/winscope/src/flickerlib/ObjectFormatter.ts @@ -88,7 +88,8 @@ export default class ObjectFormatter { if (value || (this.displayDefaults && value !== undefined && value !== null)) { // flicker obj if (value.prettyPrint) { - if (value.isNotEmpty || this.displayDefaults) { + const isEmpty = value.isEmpty === true; + if (!isEmpty || this.displayDefaults) { result[key] = value.prettyPrint() } } else { From 80ea5541011f00fbc85eb356f6047aa57b961d54 Mon Sep 17 00:00:00 2001 From: Shashwat Date: Wed, 21 Jul 2021 12:56:20 +0000 Subject: [PATCH 022/127] Fix [Object object] appearing on surfaceflinger trace When traversing tree of the transformObject, _transform function with some fields did not have a key and instead had a terminal class. This has been updated to display the key string. Bug: 190176285 Test: Using a pb file giving a object object previously and clicking show diff on all, see that no object object appears now. Change-Id: I7fa3db3a631209e1d5e1f771a93d7b3e57694309 --- tools/winscope/src/transform.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/winscope/src/transform.js b/tools/winscope/src/transform.js index 6acc4d85e..2af0955bb 100644 --- a/tools/winscope/src/transform.js +++ b/tools/winscope/src/transform.js @@ -309,7 +309,7 @@ class ObjectTransformer { transformedObj = { kind: '', - name: name + ': ' + child.name, + name: (isTerminal(name) ? compareWithName : name) + ': ' + child.name, stableId, children: child.children, combined: true, From 68ad98ea8ddf7184be97ee7173f85f67cc18f284 Mon Sep 17 00:00:00 2001 From: Priyanka Date: Thu, 22 Jul 2021 16:27:40 +0000 Subject: [PATCH 023/127] Property changes now show up on hierarchy view. Entries that have a modification are now highlighted in cyan on the hierarchy view. Test: Find any entry, run a trace - if any properties change at a particular timestamp they should be highlighted as cyan on the hierarchy view. Bug: b/162302603 Change-Id: I1d187ac669f1ff479b7f4e46903576380454a709 --- tools/winscope/src/TraceView.vue | 10 +++++----- tools/winscope/src/TreeView.vue | 6 +++--- tools/winscope/src/utils/diff.js | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/winscope/src/TraceView.vue b/tools/winscope/src/TraceView.vue index 3e343a68f..88bcabd3d 100644 --- a/tools/winscope/src/TraceView.vue +++ b/tools/winscope/src/TraceView.vue @@ -32,7 +32,7 @@ >

Hierarchy

Show Diff @@ -116,7 +116,7 @@ filter_none - No element selected in the hierachy. + No element selected in the hierarchy. @@ -178,7 +178,7 @@ export default { item: null, tree: null, highlight: null, - showHierachyDiff: false, + showHierarchyDiff: false, displayDefaults: false, showPropertiesDiff: false, PropertiesTreeElement, @@ -219,7 +219,7 @@ export default { } }, generateTreeFromItem(item) { - if (!this.showHierachyDiff || !this.diffVisualizationAvailable) { + if (!this.showHierarchyDiff || !this.diffVisualizationAvailable) { return item; } @@ -314,7 +314,7 @@ export default { selectedIndex() { this.setData(this.file.data[this.file.selectedIndex ?? 0]); }, - showHierachyDiff() { + showHierarchyDiff() { this.tree = this.generateTreeFromItem(this.item); }, showPropertiesDiff() { diff --git a/tools/winscope/src/TreeView.vue b/tools/winscope/src/TreeView.vue index 929240e27..ff574a59c 100644 --- a/tools/winscope/src/TreeView.vue +++ b/tools/winscope/src/TreeView.vue @@ -100,7 +100,7 @@ v-on:selected="immediateChildSelected = true" v-on:unselected="immediateChildSelected = false" :elementView="elementView" - v-on:collapseSibbling="collapseSibbling" + v-on:collapseSibling="collapseSibling" v-on:collapseAllOtherNodes="collapseAllOtherNodes" v-on:closeAllContextMenus="closeAllContextMenus" ref="children" @@ -352,9 +352,9 @@ export default { }, collapseAllOtherNodes() { this.$emit('collapseAllOtherNodes'); - this.$emit('collapseSibbling', this.item); + this.$emit('collapseSibling', this.item); }, - collapseSibbling(item) { + collapseSibling(item) { if (!this.$refs.children) { return; } diff --git a/tools/winscope/src/utils/diff.js b/tools/winscope/src/utils/diff.js index bc96383bd..76d70e58d 100644 --- a/tools/winscope/src/utils/diff.js +++ b/tools/winscope/src/utils/diff.js @@ -35,7 +35,7 @@ export function defaultModifiedCheck(newNode, oldNode) { return true; } - return JSON.stringify(newNode.obj) !== JSON.stringify(oldNode.obj); + return !newNode.equals(oldNode); } export class DiffGenerator { From 2aa5a1d15eb8ddacf1e950f9ce4f099ad4a544f3 Mon Sep 17 00:00:00 2001 From: Nataniel Borges Date: Tue, 20 Jul 2021 21:19:53 +0200 Subject: [PATCH 024/127] Introduce a .winscope extension for all winscope files This extension will be used to better integrate winscope traces and ABT, allowing trace files to be opened directly from ABT or buganizer Bug: 192663722 Bug: 162813517 Test: (for winscope) build winscope, record traces, download traces, check if traces have the .winscope extension. (for flicker) run atest Flickertests. (for abt) on new extension, check if .winscope files show as "open in winscope" on buganizer Change-Id: Iab7a80d0675aefe1a80d10a0f8b512506d063bba --- tools/winscope/adb_proxy/winscope_proxy.py | 36 +++++++++++++--------- tools/winscope/src/mixins/SaveAsZip.js | 25 ++++++++++++++- tools/winscope/trace.sh | 13 ++++---- tools/winscope/webpack.spec.config.js | 2 +- 4 files changed, 53 insertions(+), 23 deletions(-) diff --git a/tools/winscope/adb_proxy/winscope_proxy.py b/tools/winscope/adb_proxy/winscope_proxy.py index 5bfc531e2..09845f077 100755 --- a/tools/winscope/adb_proxy/winscope_proxy.py +++ b/tools/winscope/adb_proxy/winscope_proxy.py @@ -55,6 +55,12 @@ WINSCOPE_TOKEN_HEADER = "Winscope-Token" # Location to save the proxy security token WINSCOPE_TOKEN_LOCATION = os.path.expanduser('~/.config/winscope/.token') +# Winscope traces extension +WINSCOPE_EXT = ".winscope" + +# Winscope traces directory +WINSCOPE_DIR = "/data/misc/wmtrace/" + # Max interval between the client keep-alive requests in seconds KEEP_ALIVE_INTERVAL_S = 5 @@ -111,51 +117,51 @@ class TraceTarget: # Order of files matters as they will be expected in that order and decoded in that order TRACE_TARGETS = { "window_trace": TraceTarget( - File("/data/misc/wmtrace/wm_trace.pb", "window_trace"), + File(f'{WINSCOPE_DIR}wm_trace{WINSCOPE_EXT}', "window_trace"), 'su root cmd window tracing start\necho "WM trace started."', 'su root cmd window tracing stop >/dev/null 2>&1' ), "accessibility_trace": TraceTarget( - File("/data/misc/a11ytrace/a11y_trace.pb", "accessibility_trace"), + File(f'/data/misc/a11ytrace/a11y_trace{WINSCOPE_EXT}', "accessibility_trace"), 'su root cmd accessibility start-trace\necho "Accessibility trace started."', 'su root cmd accessibility stop-trace >/dev/null 2>&1' ), "layers_trace": TraceTarget( - File("/data/misc/wmtrace/layers_trace.pb", "layers_trace"), + File(f'{WINSCOPE_DIR}layers_trace{WINSCOPE_EXT}', "layers_trace"), 'su root service call SurfaceFlinger 1025 i32 1\necho "SF trace started."', 'su root service call SurfaceFlinger 1025 i32 0 >/dev/null 2>&1' ), "screen_recording": TraceTarget( - File("/data/local/tmp/screen.winscope.mp4", "screen_recording"), - 'screenrecord --bit-rate 8M /data/local/tmp/screen.winscope.mp4 >/dev/null 2>&1 &\necho "ScreenRecorder started."', + File(f'/data/local/tmp/screen{WINSCOPE_EXT}.mp4', "screen_recording"), + f'screenrecord --bit-rate 8M /data/local/tmp/screen{WINSCOPE_EXT}.mp4 >/dev/null 2>&1 &\necho "ScreenRecorder started."', 'pkill -l SIGINT screenrecord >/dev/null 2>&1' ), "transaction": TraceTarget( [ - File("/data/misc/wmtrace/transaction_trace.pb", "transactions"), - FileMatcher("/data/misc/wmtrace/", "transaction_merges_*.pb", + File(f'{WINSCOPE_DIR}transaction_trace{WINSCOPE_EXT}', "transactions"), + FileMatcher(WINSCOPE_DIR, f'transaction_merges_*{WINSCOPE_EXT}', "transaction_merges"), ], 'su root service call SurfaceFlinger 1020 i32 1\necho "SF transactions recording started."', 'su root service call SurfaceFlinger 1020 i32 0 >/dev/null 2>&1' ), "proto_log": TraceTarget( - File("/data/misc/wmtrace/wm_log.pb", "proto_log"), + File(f'{WINSCOPE_DIR}wm_log{WINSCOPE_EXT}', "proto_log"), 'su root cmd window logging start\necho "WM logging started."', 'su root cmd window logging stop >/dev/null 2>&1' ), "ime_trace_clients": TraceTarget( - File("/data/misc/wmtrace/ime_trace_clients.pb", "ime_trace_clients"), + File(f'{WINSCOPE_DIR}ime_trace_clients{WINSCOPE_EXT}', "ime_trace_clients"), 'su root ime tracing start\necho "Clients IME trace started."', 'su root ime tracing stop >/dev/null 2>&1' ), "ime_trace_service": TraceTarget( - File("/data/misc/wmtrace/ime_trace_service.pb", "ime_trace_service"), + File(f'{WINSCOPE_DIR}ime_trace_service{WINSCOPE_EXT}', "ime_trace_service"), 'su root ime tracing start\necho "Service IME trace started."', 'su root ime tracing stop >/dev/null 2>&1' ), "ime_trace_managerservice": TraceTarget( - File("/data/misc/wmtrace/ime_trace_managerservice.pb", "ime_trace_managerservice"), + File(f'{WINSCOPE_DIR}ime_trace_managerservice{WINSCOPE_EXT}', "ime_trace_managerservice"), 'su root ime tracing start\necho "ManagerService IME trace started."', 'su root ime tracing stop >/dev/null 2>&1' ), @@ -204,12 +210,12 @@ class DumpTarget: DUMP_TARGETS = { "window_dump": DumpTarget( - File("/data/local/tmp/wm_dump.pb", "window_dump"), - 'su root dumpsys window --proto > /data/local/tmp/wm_dump.pb' + File(f'/data/local/tmp/wm_dump{WINSCOPE_EXT}', "window_dump"), + f'su root dumpsys window --proto > /data/local/tmp/wm_dump{WINSCOPE_EXT}' ), "layers_dump": DumpTarget( - File("/data/local/tmp/sf_dump.pb", "layers_dump"), - 'su root dumpsys SurfaceFlinger --proto > /data/local/tmp/sf_dump.pb' + File(f'/data/local/tmp/sf_dump{WINSCOPE_EXT}', "layers_dump"), + f'su root dumpsys SurfaceFlinger --proto > /data/local/tmp/sf_dump{WINSCOPE_EXT}' ) } diff --git a/tools/winscope/src/mixins/SaveAsZip.js b/tools/winscope/src/mixins/SaveAsZip.js index 8b8b6e14c..dc575394b 100644 --- a/tools/winscope/src/mixins/SaveAsZip.js +++ b/tools/winscope/src/mixins/SaveAsZip.js @@ -33,14 +33,37 @@ export default { document.body.removeChild(a); }, + /** + * Returns the file name, if the file has an extension use its default, + * otherwise use ".mp4" for screen recording (name from proxy script) and + * ".winscope" for traces + * @param {*} fileName + */ + getFileName(fileName) { + var re = /(?:\.([^.]+))?$/; + var extension = re.exec(fileName)[1]; + if (!extension) { + extension = ""; + } + switch (extension) { + case "": { + if (fileName == "Screen recording") { + return fileName + ".mp4" + } + return fileName + ".winscope" + } + default: return fileName + } + }, async downloadAsZip(traces) { const zip = new JSZip(); for (const trace of traces) { const traceFolder = zip.folder(trace.type); for (const file of trace.files) { + var fileName = this.getFileName(file.filename); const blob = await fetch(file.blobUrl).then((r) => r.blob()); - traceFolder.file(file.filename, blob); + traceFolder.file(fileName, blob); } } diff --git a/tools/winscope/trace.sh b/tools/winscope/trace.sh index 3f5008d15..ff0174850 100755 --- a/tools/winscope/trace.sh +++ b/tools/winscope/trace.sh @@ -30,8 +30,9 @@ for arg in "$@"; do esac done -outfileTrans=${outfile}_transactiontrace.pb -outfileSurf=${outfile}_layerstrace.pb +WINSCOPE_EXT=.winscope +outfileTrans=${outfile}_transactiontrace$WINSCOPE_EXT +outfileSurf=${outfile}_layerstrace$WINSCOPE_EXT outfileTrans_abs="$(cd "$(dirname "$outfileTrans")"; pwd)/$(basename "$outfileTrans")" outfileSurf_abs="$(cd "$(dirname "$outfileSurf")"; pwd)/$(basename "$outfileSurf")" @@ -39,8 +40,8 @@ outfileSurf_abs="$(cd "$(dirname "$outfileSurf")"; pwd)/$(basename "$outfileSurf if [ "$help" != "" ]; then echo "usage: $0 [-h | --help] [OUTFILE]" echo - echo "Records Transaction traces (default transactiontrace.pb)." - echo "Records Surface traces (default layerstrace.pb)." + echo "Records Transaction traces (default transactiontrace$WINSCOPE_EXT)." + echo "Records Surface traces (default layerstrace$WINSCOPE_EXT)." echo "To view the traces, use $WINSCOPE_URL." exit 1 fi @@ -75,8 +76,8 @@ start_tracing read -p "Press ENTER to stop recording" -s x echo stop_tracing -adb exec-out su root cat /data/misc/wmtrace/transaction_trace.pb >"$outfileTrans" -adb exec-out su root cat /data/misc/wmtrace/layers_trace.pb >"$outfileSurf" +adb exec-out su root cat /data/misc/wmtrace/transaction_trace$WINSCOPE_EXT >"$outfileTrans" +adb exec-out su root cat /data/misc/wmtrace/layers_trace$WINSCOPE_EXT >"$outfileSurf" echo echo "To view the trace, go to $WINSCOPE_URL, and open" diff --git a/tools/winscope/webpack.spec.config.js b/tools/winscope/webpack.spec.config.js index dcbcbf9e1..080da8005 100644 --- a/tools/winscope/webpack.spec.config.js +++ b/tools/winscope/webpack.spec.config.js @@ -64,7 +64,7 @@ module.exports = { }, }, { - test: /\.pb/, + test: /\.(pb|winscope)/, loader: 'file-loader', options: { paths: [ From baa6a95f7830a6ffffc4ed2ed3ae4713e00f756f Mon Sep 17 00:00:00 2001 From: Priyanka Date: Mon, 26 Jul 2021 09:08:03 +0000 Subject: [PATCH 025/127] Add a seek timestamp searchbar. A timestamp can now be searched for in -d-h-m-ms form or in nanoseconds - clicking the search button should select the closest timestamp in the timeline and change the traces. Test: search for a timestamp and ensure the traces change accordingly. Bug: 194275191 Change-Id: If2e5cb5863f9a59bc88acbb63f259818b7b624cc --- tools/winscope/src/Overlay.vue | 23 ++++++++++++++++++++++- tools/winscope/src/TraceView.vue | 10 +++++----- tools/winscope/src/transform.js | 20 +++++++++++++++++++- 3 files changed, 46 insertions(+), 7 deletions(-) diff --git a/tools/winscope/src/Overlay.vue b/tools/winscope/src/Overlay.vue index f25b1fcf4..28a118d7f 100644 --- a/tools/winscope/src/Overlay.vue +++ b/tools/winscope/src/Overlay.vue @@ -67,6 +67,15 @@
+ + + + + + Search +
Hierarchy Show Diff @@ -116,7 +116,7 @@ filter_none - No element selected in the hierachy. + No element selected in the hierarchy.
@@ -178,7 +178,7 @@ export default { item: null, tree: null, highlight: null, - showHierachyDiff: false, + showHierarchyDiff: false, displayDefaults: false, showPropertiesDiff: false, PropertiesTreeElement, @@ -219,7 +219,7 @@ export default { } }, generateTreeFromItem(item) { - if (!this.showHierachyDiff || !this.diffVisualizationAvailable) { + if (!this.showHierarchyDiff || !this.diffVisualizationAvailable) { return item; } @@ -314,7 +314,7 @@ export default { selectedIndex() { this.setData(this.file.data[this.file.selectedIndex ?? 0]); }, - showHierachyDiff() { + showHierarchyDiff() { this.tree = this.generateTreeFromItem(this.item); }, showPropertiesDiff() { diff --git a/tools/winscope/src/transform.js b/tools/winscope/src/transform.js index 6acc4d85e..367ac8614 100644 --- a/tools/winscope/src/transform.js +++ b/tools/winscope/src/transform.js @@ -376,6 +376,24 @@ function nanos_to_string(elapsedRealtimeNanos) { return parts.reverse().join(''); } +function string_to_nanos(stringTime) { + //isolate the times for each unit in an array + var times = stringTime.split(/\D+/).filter(unit => unit.length > 0); + + //add zeroes to start of array if only partial timestamp is input + while (times.length<5) { + times.unshift("0"); + } + + var units = [24*60*60, 60*60, 60, 1, 0.001]; + var nanos = 0; + //multiply the times by the relevant unit and sum + for (var x=0; x<5; x++) { + nanos += units[x]*parseInt(times[x]); + } + return nanos*(10**9); +} + // Returns a UI element used highlight a visible entry. // eslint-disable-next-line camelcase function get_visible_chip() { @@ -383,4 +401,4 @@ function get_visible_chip() { } // eslint-disable-next-line camelcase -export {transform, ObjectTransformer, nanos_to_string, get_visible_chip}; +export {transform, ObjectTransformer, nanos_to_string, string_to_nanos, get_visible_chip}; From 6dec8374fdd51490da5ca958766d22a9437d51bd Mon Sep 17 00:00:00 2001 From: Priyanka Date: Wed, 4 Aug 2021 15:55:37 +0000 Subject: [PATCH 026/127] Dumps now show the visual displays. Fixed a bug where dumps were no longer showing the visual displays due to empty rects. Bug: b/195526761 Test: Run a dump or upload a dump file - the visual display should appear as expected. Change-Id: I66ae35249514ac8bd34fb6465269de047ae26f00 --- tools/winscope/src/NodeContextMenu.vue | 2 +- tools/winscope/src/dumps/SurfaceFlinger.ts | 17 ++++++++++------- tools/winscope/src/dumps/WindowManager.ts | 4 +++- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/tools/winscope/src/NodeContextMenu.vue b/tools/winscope/src/NodeContextMenu.vue index cba46eb5c..18d86e4bd 100644 --- a/tools/winscope/src/NodeContextMenu.vue +++ b/tools/winscope/src/NodeContextMenu.vue @@ -5,7 +5,7 @@ diff --git a/tools/winscope/src/TreeView.vue b/tools/winscope/src/TreeView.vue index ff574a59c..0c6356cc6 100644 --- a/tools/winscope/src/TreeView.vue +++ b/tools/winscope/src/TreeView.vue @@ -464,11 +464,11 @@ export default { return this.initialDepth || 0; }, nodeOffsetStyle() { - const offest = levelOffset * (this.depth + this.isLeaf) + 'px'; + const offset = levelOffset * (this.depth + this.isLeaf) + 'px'; return { - marginLeft: '-' + offest, - paddingLeft: offest, + marginLeft: '-' + offset, + paddingLeft: offset, }; }, }, diff --git a/tools/winscope/src/components/TagDisplay/Arrow.vue b/tools/winscope/src/components/TagDisplay/Arrow.vue new file mode 100644 index 000000000..8059de429 --- /dev/null +++ b/tools/winscope/src/components/TagDisplay/Arrow.vue @@ -0,0 +1,34 @@ + + + + + \ No newline at end of file diff --git a/tools/winscope/src/components/TagDisplay/TransitionContainer.vue b/tools/winscope/src/components/TagDisplay/TransitionContainer.vue new file mode 100644 index 000000000..10fa8fff7 --- /dev/null +++ b/tools/winscope/src/components/TagDisplay/TransitionContainer.vue @@ -0,0 +1,87 @@ + + + + \ No newline at end of file diff --git a/tools/winscope/src/mixins/Timeline.js b/tools/winscope/src/mixins/Timeline.js index 40fd341ce..40f7a385c 100644 --- a/tools/winscope/src/mixins/Timeline.js +++ b/tools/winscope/src/mixins/Timeline.js @@ -14,6 +14,8 @@ * limitations under the License. */ +import _ from "lodash"; +import { nanos_to_string } from "../transform"; /** * Represents a continuous section of the timeline that is rendered into the @@ -33,10 +35,42 @@ class Block { } } +//Represents a continuous section of the tag display that relates to a specific transition +class Transition { + /** + * Create a transition. + * @param {number} startPos - The position of the start tag as a percentage + * of the timeline width. + * @param {number} width - The width of the transition as a percentage of the + * timeline width. + * @param {string} color - the color of transition depending on type. + * @param {number} overlap - number of transitions with which this transition overlaps. + * @param {string} tooltip - The tooltip of the transition, minus the type of transition. + */ + constructor(startPos, width, color, overlap, tooltip) { + this.startPos = startPos; + this.width = width; + this.color = color; + this.overlap = overlap; + this.tooltip = tooltip; + } +} + /** * This Mixin should only be injected into components which have the following: * - An element in the template referenced as 'timeline' (this.$refs.timeline). */ +const transitionMap = new Map([ + ['ROTATION', {desc: 'Rotation', color: '#9900ffff'}], + ['PIP_ENTER', {desc: 'Entering PIP mode', color: '#4a86e8ff'}], + ['PIP_RESIZE', {desc: 'Resizing PIP mode', color: '#2b9e94ff'}], + ['PIP_EXIT', {desc: 'Exiting PIP mode', color: 'darkblue'}], + ['APP_LAUNCH', {desc: 'Launching app', color: '#ef6befff'}], + ['APP_CLOSE', {desc: 'Closing app', color: '#d10ddfff'}], + ['IME_APPEAR', {desc: 'IME appearing', color: '#ff9900ff'}], + ['IME_DISAPPEAR', {desc: 'IME disappearing', color: '#ad6800ff'}], +]); + export default { name: 'timeline', props: { @@ -53,6 +87,15 @@ export default { 'scale': { type: Array, }, + 'tags': { + type: Array, + }, + 'errorTimestamps': { + type: Array, + }, + 'flickerMode': { + type: Boolean, + } }, data() { return { @@ -99,6 +142,61 @@ export default { return Object.freeze(blocks); }, + + //Generates list of transitions to be displayed in flicker mode + timelineTransitions() { + const transitions = []; + + //group tags by transition 'id' property + const groupedTags = _.mapValues( + _.groupBy(this.tags, 'id'), clist => clist.map(tag => _.omit(tag, 'id'))) + ; + + for (const transitionId in groupedTags) { + const id = groupedTags[transitionId]; + //there are two tags per id; check which tag is the start, which is end + const transitionStartTime = (id[0].isStartTag) ? id[0].timestamp : id[1].timestamp; + const transitionEndTime = (!id[0].isStartTag) ? id[0].timestamp : id[1].timestamp; + + //do not freeze new transition, as overlap still to be handled (defaulted to 0) + const transition = this.generateTransition( + transitionStartTime, + transitionEndTime, + id[0].transition, + 0 + ); + transitions.push(transition); + } + + //sort transitions in ascending start position in order to handle overlap + transitions.sort((a, b) => (a.startPos > b.startPos) ? 1: -1); + + //compare each transition to the ones that came before + for (let curr=0; curr0 + && transitions[curr].overlap === Math.max(overlapStore) + ) transitions[curr].overlap++; + } + + return Object.freeze(transitions); + }, + errorPositions() { + if (!this.flickerMode) return []; + const errorPositions = this.errorTimestamps.map(timestamp => this.position(timestamp)); + return Object.freeze(errorPositions); + }, }, methods: { position(item) { @@ -143,6 +241,10 @@ export default { return pos * (this.crop.right - this.crop.left) + this.crop.left; }, + objectWidth(startTs, endTs) { + return this.position(endTs) - this.position(startTs) + this.pointWidth; + }, + /** * Converts a position as a percentage of the timeline width to a timestamp. * @param {number} position - target position as a percentage of the @@ -249,9 +351,25 @@ export default { * scale parameter. */ generateTimelineBlock(startTs, endTs) { - const blockWidth = this.position(endTs) - this.position(startTs) + - this.pointWidth; + const blockWidth = this.objectWidth(startTs, endTs); return Object.freeze(new Block(this.position(startTs), blockWidth)); }, + /** + * Generate a transition object that can be used by the tag-timeline to render + * a transformed transition that starts at `startTs` and ends at `endTs`. + * @param {number} startPos - The timestamp at which the transition starts. + * @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. + * @return {Transition} A transition object transformed to the timeline's crop and + * scale parameter. + */ + generateTransition(startTs, endTs, transitionType, overlap) { + const transitionWidth = this.objectWidth(startTs, endTs); + const transitionDesc = transitionMap.get(transitionType).desc; + const transitionColor = transitionMap.get(transitionType).color; + const tooltip = `${transitionDesc}. Start: ${nanos_to_string(startTs)}. End: ${nanos_to_string(endTs)}.`; + return new Transition(this.position(startTs), transitionWidth, transitionColor, overlap, tooltip); + }, }, -}; +}; \ No newline at end of file diff --git a/tools/winscope/src/utils/consts.js b/tools/winscope/src/utils/consts.js index 86799d926..4e0939d85 100644 --- a/tools/winscope/src/utils/consts.js +++ b/tools/winscope/src/utils/consts.js @@ -29,6 +29,7 @@ const NAVIGATION_STYLE = { FOCUSED: 'Focused', CUSTOM: 'Custom', TARGETED: 'Targeted', + FLICKER: 'Flicker', }; const logLevel = { From 7512a62755e44e1156fa13df55df3d7b4124a6ef Mon Sep 17 00:00:00 2001 From: Aurimas Liutikas Date: Mon, 9 Aug 2021 16:15:27 -0700 Subject: [PATCH 032/127] Add explicit exported tags Bug: 195988762 Test: make javac-check Change-Id: Ifd07672da0141c74ad32613a17691c6cd09e54de --- samples/MultiDisplay/AndroidManifest.xml | 8 +++++--- samples/ShortcutDemo/launcher/AndroidManifest.xml | 3 ++- samples/WiFiDirectDemo/AndroidManifest.xml | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/samples/MultiDisplay/AndroidManifest.xml b/samples/MultiDisplay/AndroidManifest.xml index 81aa43b9a..18f9f8854 100644 --- a/samples/MultiDisplay/AndroidManifest.xml +++ b/samples/MultiDisplay/AndroidManifest.xml @@ -27,7 +27,8 @@ android:label="@string/md_launcher" android:theme="@style/LauncherTheme" android:launchMode="singleTop" - android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density"> + android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density" + android:exported="true"> @@ -39,7 +40,8 @@ + android:permission="android.permission.BIND_WALLPAPER" + android:exported="true"> @@ -52,4 +54,4 @@ - \ No newline at end of file + diff --git a/samples/ShortcutDemo/launcher/AndroidManifest.xml b/samples/ShortcutDemo/launcher/AndroidManifest.xml index 581079a52..b024385b3 100644 --- a/samples/ShortcutDemo/launcher/AndroidManifest.xml +++ b/samples/ShortcutDemo/launcher/AndroidManifest.xml @@ -21,7 +21,8 @@ - + diff --git a/samples/WiFiDirectDemo/AndroidManifest.xml b/samples/WiFiDirectDemo/AndroidManifest.xml index 759c4cc38..eb2a90f51 100644 --- a/samples/WiFiDirectDemo/AndroidManifest.xml +++ b/samples/WiFiDirectDemo/AndroidManifest.xml @@ -22,6 +22,7 @@ android:theme="@android:style/Theme.Holo"> Date: Wed, 11 Aug 2021 14:22:56 +0000 Subject: [PATCH 033/127] Store transition types in enum Store transition types in enum so easier to type check in Typescript if necessary later on. Bug: b/196203538 Test: check that the tag trace attached to the bug still uploads correctly Change-Id: I2994f58ceb1d49bd82af54fb075369bd70dc1394 --- tools/winscope/src/flickerlib/tags/Tag.ts | 20 ++++++++++--- .../src/flickerlib/tags/TransitionType.ts | 28 +++++++++++++++++++ tools/winscope/src/mixins/Timeline.js | 17 +++++------ tools/winscope/src/utils/consts.js | 2 +- 4 files changed, 54 insertions(+), 13 deletions(-) create mode 100644 tools/winscope/src/flickerlib/tags/TransitionType.ts diff --git a/tools/winscope/src/flickerlib/tags/Tag.ts b/tools/winscope/src/flickerlib/tags/Tag.ts index 283105d5e..8ecebc65c 100644 --- a/tools/winscope/src/flickerlib/tags/Tag.ts +++ b/tools/winscope/src/flickerlib/tags/Tag.ts @@ -15,18 +15,30 @@ */ -import { Tag } from "../common" +import { Tag } from "../common"; +import TransitionType from "./TransitionType"; + +const transitionTypeMap = new Map([ + ['ROTATION', TransitionType.ROTATION], + ['PIP_ENTER', TransitionType.PIP_ENTER], + ['PIP_RESIZE', TransitionType.PIP_RESIZE], + ['PIP_EXIT', TransitionType.PIP_EXIT], + ['APP_LAUNCH', TransitionType.APP_LAUNCH], + ['APP_CLOSE', TransitionType.APP_CLOSE], + ['IME_APPEAR', TransitionType.IME_APPEAR], + ['IME_DISAPPEAR', TransitionType.IME_DISAPPEAR], +]); Tag.fromProto = function (proto: any): Tag { const tag = new Tag( proto.id, - proto.transition, + transitionTypeMap.get(proto.transition), proto.isStartTag, proto.layerId, proto.windowToken, proto.taskId ); - return tag -} + return tag; +}; export default Tag; diff --git a/tools/winscope/src/flickerlib/tags/TransitionType.ts b/tools/winscope/src/flickerlib/tags/TransitionType.ts new file mode 100644 index 000000000..aebc72f57 --- /dev/null +++ b/tools/winscope/src/flickerlib/tags/TransitionType.ts @@ -0,0 +1,28 @@ +/* + * Copyright 2021, The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +enum TransitionType { + ROTATION = 'ROTATION', + PIP_ENTER = 'PIP_ENTER', + PIP_RESIZE ='PIP_RESIZE', + PIP_EXIT = 'PIP_EXIT', + APP_LAUNCH = 'APP_LAUNCH', + APP_CLOSE = 'APP_CLOSE', + IME_APPEAR = 'IME_APPEAR', + IME_DISAPPEAR = 'IME_DISAPPEAR', +}; + +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 40f7a385c..a915872ae 100644 --- a/tools/winscope/src/mixins/Timeline.js +++ b/tools/winscope/src/mixins/Timeline.js @@ -16,6 +16,7 @@ import _ from "lodash"; import { nanos_to_string } from "../transform"; +import TransitionType from "../flickerlib/tags/TransitionType"; /** * Represents a continuous section of the timeline that is rendered into the @@ -61,14 +62,14 @@ class Transition { * - An element in the template referenced as 'timeline' (this.$refs.timeline). */ const transitionMap = new Map([ - ['ROTATION', {desc: 'Rotation', color: '#9900ffff'}], - ['PIP_ENTER', {desc: 'Entering PIP mode', color: '#4a86e8ff'}], - ['PIP_RESIZE', {desc: 'Resizing PIP mode', color: '#2b9e94ff'}], - ['PIP_EXIT', {desc: 'Exiting PIP mode', color: 'darkblue'}], - ['APP_LAUNCH', {desc: 'Launching app', color: '#ef6befff'}], - ['APP_CLOSE', {desc: 'Closing app', color: '#d10ddfff'}], - ['IME_APPEAR', {desc: 'IME appearing', color: '#ff9900ff'}], - ['IME_DISAPPEAR', {desc: 'IME disappearing', color: '#ad6800ff'}], + [TransitionType.ROTATION, {desc: 'Rotation', color: '#9900ffff'}], + [TransitionType.PIP_ENTER, {desc: 'Entering PIP mode', color: '#4a86e8ff'}], + [TransitionType.PIP_RESIZE, {desc: 'Resizing PIP mode', color: '#2b9e94ff'}], + [TransitionType.PIP_EXIT, {desc: 'Exiting PIP mode', color: 'darkblue'}], + [TransitionType.APP_LAUNCH, {desc: 'Launching app', color: '#ef6befff'}], + [TransitionType.APP_CLOSE, {desc: 'Closing app', color: '#d10ddfff'}], + [TransitionType.IME_APPEAR, {desc: 'IME appearing', color: '#ff9900ff'}], + [TransitionType.IME_DISAPPEAR, {desc: 'IME disappearing', color: '#ad6800ff'}], ]); export default { diff --git a/tools/winscope/src/utils/consts.js b/tools/winscope/src/utils/consts.js index 4e0939d85..155cc36a7 100644 --- a/tools/winscope/src/utils/consts.js +++ b/tools/winscope/src/utils/consts.js @@ -39,6 +39,6 @@ const logLevel = { WARN: 'warn', ERROR: 'error', WTF: 'wtf', -} +}; export { WebContentScriptMessageType, NAVIGATION_STYLE, logLevel }; From 5e19d0217f7fbdd55a8249af789f24ba4067480e Mon Sep 17 00:00:00 2001 From: Pablo Gamito Date: Thu, 12 Aug 2021 16:59:13 +0000 Subject: [PATCH 034/127] Make sure all entries are shown in the proto section Problem was that we were relying on getProperties to iterate through all the properties to format them, but getProperties would filter out any falsy value so all properties that had fasly values were pre-filtered out regardless of if show defaults was toggled or not. We also make sure that null and undefined fields are shown when show defaults is enabled Test: Check proto section of entries in winscope to see all missing entries Fixes: 187463843 Change-Id: Iaf6ef1b855edafb0dfbd324e73bbd5c3ce1b2f59 --- .../src/flickerlib/ObjectFormatter.ts | 33 +++++++++++++++---- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/tools/winscope/src/flickerlib/ObjectFormatter.ts b/tools/winscope/src/flickerlib/ObjectFormatter.ts index b67bfe608..44aa0554a 100644 --- a/tools/winscope/src/flickerlib/ObjectFormatter.ts +++ b/tools/winscope/src/flickerlib/ObjectFormatter.ts @@ -44,6 +44,13 @@ export default class ObjectFormatter { return obj; } + /** + * Get the true properties of an entry excluding functions, kotlin gernerated + * variables, explicitly excluded properties, and flicker objects already in + * the hierarchy that shouldn't be traversed when formatting the entry + * @param entry The entry for which we want to get the properties for + * @return The "true" properties of the entry as described above + */ static getProperties(entry: any): string[] { var props = []; let obj = entry; @@ -58,13 +65,12 @@ export default class ObjectFormatter { if (it.startsWith(`_`)) return false; // some predefined properties used only internally (e.g., children, ref, diff) if (this.INVALID_ELEMENT_PROPERTIES.includes(it)) return false; - // Flicker object properties or arrays - if (!entry[it]) return false; - const value = entry[it] + + const value = entry[it]; // only non-empty arrays of non-flicker objects (otherwise they are in hierarchy) - if (Array.isArray(value) && value.length > 0) return !value[0].stableId + if (Array.isArray(value) && value.length > 0) return !value[0].stableId; // non-flicker object - return !value.stableId; + return !(value?.stableId); }); properties.forEach(function (prop) { if (typeof(entry[prop]) !== 'function' && props.indexOf(prop) === -1) { @@ -76,6 +82,12 @@ export default class ObjectFormatter { return props; } + /** + * Format a Winscope entry to be displayed in the UI + * Accounts for different user display settings (e.g. hiding empty/default values) + * @param obj The raw object to format + * @return The formatted object + */ static format(obj: any): {} { const properties = this.getProperties(obj); const sortedProperties = properties.sort() @@ -85,7 +97,14 @@ export default class ObjectFormatter { const key = entry; const value: any = obj[key]; - if (value || (this.displayDefaults && value !== undefined && value !== null)) { + if (value === null || value === undefined) { + if (this.displayDefaults) { + result[key] = value + } + return + } + + if (value || this.displayDefaults) { // flicker obj if (value.prettyPrint) { const isEmpty = value.isEmpty === true; @@ -247,4 +266,4 @@ export default class ObjectFormatter { return flags.join(' | '); } -} \ No newline at end of file +} From 796ea0a96aa6b42df06caa68130225da42846166 Mon Sep 17 00:00:00 2001 From: Nataniel Borges Date: Tue, 17 Aug 2021 14:56:38 +0000 Subject: [PATCH 035/127] Fix no files returned by proxy on second consecutive tracing Python map function returns an iterator that cannot be reused. Convert it into a list instead to support multiple usages. Also, add an error message to the ocnsole if no files are returned Test: run proxy, start/stop trace 2+ times in a row Change-Id: I09e4a4a28315b28f8d6eabdbfe60890cdfb8510c --- tools/winscope/adb_proxy/winscope_proxy.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/winscope/adb_proxy/winscope_proxy.py b/tools/winscope/adb_proxy/winscope_proxy.py index f25ba9f7a..8c16e9647 100755 --- a/tools/winscope/adb_proxy/winscope_proxy.py +++ b/tools/winscope/adb_proxy/winscope_proxy.py @@ -93,6 +93,7 @@ class FileMatcher: matchingFiles = call_adb( f"shell su root find {self.path} -name {self.matcher}", device_id) + log.debug("Found file %s", matchingFiles.split('\n')[:-1]) return matchingFiles.split('\n')[:-1] def get_filetype(self): @@ -102,8 +103,8 @@ class FileMatcher: class WinscopeFileMatcher(FileMatcher): def __init__(self, path, matcher, filetype) -> None: self.path = path - self.internal_matchers = map(lambda ext: FileMatcher(path, f'{matcher}{ext}', filetype), - WINSCOPE_EXTS) + self.internal_matchers = list(map(lambda ext: FileMatcher(path, f'{matcher}{ext}', filetype), + WINSCOPE_EXTS)) self.type = filetype def get_filepaths(self, device_id): @@ -111,6 +112,7 @@ class WinscopeFileMatcher(FileMatcher): files = matcher.get_filepaths(device_id) if len(files) > 0: return files + log.debug("No files found") return [] @@ -447,6 +449,9 @@ class FetchFilesEndpoint(DeviceRequestEndpoint): buf = base64.encodebytes(tmp.read()).decode("utf-8") file_buffers[file_type].append(buf) + if (len(file_buffers) == 0): + log.error("Proxy didn't find any file to fetch") + # server.send_header('X-Content-Type-Options', 'nosniff') # add_standard_headers(server) j = json.dumps(file_buffers) From 9236a95bd643e8499a2be07a7893c064332d035e Mon Sep 17 00:00:00 2001 From: Priyanka Date: Wed, 18 Aug 2021 09:23:13 +0000 Subject: [PATCH 036/127] Fix flat and visible checkboxes on trace views. Now ticking the flat checkbox displays all entries without indentation, and only visible entries are shown upon ticking only visible. Bug: b/196951608 Test: upload a WM or SF trace and tick flat - all entries should be aligned to left of Hierarchy box. Change-Id: Iedb755d94895afcdca334871e980064c79430206 --- .../winscope/src/SurfaceFlingerTraceView.vue | 2 +- tools/winscope/src/TraceView.vue | 1 + tools/winscope/src/TreeView.vue | 37 +++++++++++++------ 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/tools/winscope/src/SurfaceFlingerTraceView.vue b/tools/winscope/src/SurfaceFlingerTraceView.vue index 94234ba71..b40aab155 100644 --- a/tools/winscope/src/SurfaceFlingerTraceView.vue +++ b/tools/winscope/src/SurfaceFlingerTraceView.vue @@ -21,7 +21,7 @@ import TraceView from '@/TraceView.vue'; export default { - name: 'WindowManagerTraceView', + name: 'SurfaceFlingerTraceView', props: ['store', 'file'], components: { TraceView, diff --git a/tools/winscope/src/TraceView.vue b/tools/winscope/src/TraceView.vue index 88bcabd3d..6c281a573 100644 --- a/tools/winscope/src/TraceView.vue +++ b/tools/winscope/src/TraceView.vue @@ -55,6 +55,7 @@ :selected="hierarchySelected" :filter="hierarchyFilter" :flattened="store.flattened" + :onlyVisible="store.onlyVisible" :items-clickable="true" :useGlobalCollapsedState="true" :simplify-names="store.simplifyNames" diff --git a/tools/winscope/src/TreeView.vue b/tools/winscope/src/TreeView.vue index 0c6356cc6..ff3c04fc7 100644 --- a/tools/winscope/src/TreeView.vue +++ b/tools/winscope/src/TreeView.vue @@ -31,7 +31,7 @@