diff --git a/tools/winscope/src/DataInput.vue b/tools/winscope/src/DataInput.vue index 53dda6cbc..d059b6acf 100644 --- a/tools/winscope/src/DataInput.vue +++ b/tools/winscope/src/DataInput.vue @@ -374,9 +374,6 @@ export default { const selectedFile = this.getMostLikelyCandidateFile(dataType, files); - if (selectedFile.data) { - selectedFile.data = Object.freeze(selectedFile.data); - } this.$set(this.dataFiles, dataType, Object.freeze(selectedFile)); diff --git a/tools/winscope/src/DataView.vue b/tools/winscope/src/DataView.vue index 6154fa2cc..4ba2e524f 100644 --- a/tools/winscope/src/DataView.vue +++ b/tools/winscope/src/DataView.vue @@ -57,6 +57,14 @@ :presentErrors="presentErrors" ref="view" /> + diff --git a/tools/winscope/src/ImeAdditionalProperties.vue b/tools/winscope/src/ImeAdditionalProperties.vue new file mode 100644 index 000000000..0d1f9d3b2 --- /dev/null +++ b/tools/winscope/src/ImeAdditionalProperties.vue @@ -0,0 +1,210 @@ + + + + + + diff --git a/tools/winscope/src/ImeTraceView.vue b/tools/winscope/src/ImeTraceView.vue new file mode 100644 index 000000000..daf454ad0 --- /dev/null +++ b/tools/winscope/src/ImeTraceView.vue @@ -0,0 +1,52 @@ + + + + + diff --git a/tools/winscope/src/TraceView.vue b/tools/winscope/src/TraceView.vue index 4c36466a8..ecefd1525 100644 --- a/tools/winscope/src/TraceView.vue +++ b/tools/winscope/src/TraceView.vue @@ -25,7 +25,7 @@
- +
+ +
+ + +

WM & SF Properties

+
+
+ +
+
+
@@ -156,6 +173,7 @@ import FlatCard from './components/FlatCard.vue'; import PropertiesTreeElement from './PropertiesTreeElement.vue'; import SurfaceFlingerPropertyGroups from '@/SurfaceFlingerPropertyGroups.vue'; import PropertiesTableView from './PropertiesTableView'; +import ImeAdditionalProperties from '@/ImeAdditionalProperties'; import {ObjectTransformer} from './transform.js'; import {DiffGenerator, defaultModifiedCheck} from './utils/diff.js'; @@ -192,7 +210,7 @@ function findEntryInTree(tree, id) { export default { name: 'traceview', - props: ['store', 'file', 'summarizer', 'presentTags', 'presentErrors', 'propertyGroups'], + props: ['store', 'file', 'summarizer', 'presentTags', 'presentErrors', 'propertyGroups', 'imeAdditionalProperties'], data() { return { propertyFilterString: '', @@ -473,6 +491,7 @@ export default { 'flat-card': FlatCard, 'sf-property-groups': SurfaceFlingerPropertyGroups, 'properties-table-view': PropertiesTableView, + 'ime-additional-properties': ImeAdditionalProperties, }, }; @@ -568,4 +587,16 @@ export default { flex-direction: column; flex: 1; } + +.height-fifty { + height: 50%; +} + +.ime-additional-properties { + padding-top: 10px; + display: flex; + flex-direction: column; + flex: 1; + height: 50%; +} diff --git a/tools/winscope/src/ime_processing.js b/tools/winscope/src/ime_processing.js index e229f2f88..19d3c029c 100644 --- a/tools/winscope/src/ime_processing.js +++ b/tools/winscope/src/ime_processing.js @@ -24,6 +24,7 @@ import {getFilter} from '@/utils/utils'; import {TRACE_TYPES} from '@/decode'; function combineWmSfWithImeDataIfExisting(dataFiles) { + // TODO(b/237744706): Add tests for this function console.log('before combining', dataFiles); let filesAsDict; if (Array.isArray(dataFiles)) { @@ -79,22 +80,80 @@ function combineWmSfPropertiesIntoImeData(imeTraceFile, wmOrSfTraceFile) { let wmStateOrSfLayer = wmOrSfData[wmOrSfIntersectIndex]; if (wmStateOrSfLayer) { // filter to only relevant nodes & fields - // console.log('before pruning:', wmStateOrSfLayer); - if (wmStateOrSfLayer.kind !== 'WindowManagerState') { + if (wmStateOrSfLayer.kind === 'WindowManagerState') { + wmStateOrSfLayer = filterWmStateForIme(wmStateOrSfLayer); + imeTraceFile.data[i].wmProperties = wmStateOrSfLayer; + } else { wmStateOrSfLayer = filterSfLayerForIme(wmStateOrSfLayer); } - // console.log('after pruning:', wmStateOrSfLayer); + console.log('after pruning:', wmStateOrSfLayer); if (wmStateOrSfLayer) { imeTraceFile.data[i].children.push(wmStateOrSfLayer); + imeTraceFile.data[0].hasWmSfProperties = true; + // Note: hasWmSfProperties is added into data because the + // imeTraceFile object is inextensible if it's from file input } } } } + +function filterWmStateForIme(wmState) { + // create and return a custom entry that just contains relevant properties + const displayContent = wmState.children[0]; + return { + 'kind': 'WM State Properties', + 'name': wmState.name, + 'shortName': wmState.shortName, // not sure what this would be yet + 'timestamp': wmState.timestamp, // not sure what this would be yet + 'stableId': wmState.stableId, + 'focusedApp': wmState.focusedApp, + 'focusedWindow': wmState.focusedWindow, + 'focusedActivity': wmState.focusedActivity, + 'inputMethodControlTarget': displayContent.proto.inputMethodControlTarget, + 'inputMethodInputTarget': displayContent.proto.inputMethodInputTarget, + 'inputMethodTarget': displayContent.proto.inputMethodTarget, + 'imeInsetsSourceProvider': displayContent.proto.imeInsetsSourceProvider, + }; +} + function filterSfLayerForIme(sfLayer) { - const filter = getFilter('ImeContainer'); - // prune all children that don't match filter - return pruneChildrenByFilter(sfLayer, filter); + const parentTaskName = findParentTaskNameOfImeContainer(sfLayer); + let resultLayer; + if (parentTaskName === '') { + // there is no ImeContainer; check for ime-snapshot + const snapshotFilter = getFilter('IME-snapshot'); + resultLayer = pruneChildrenByFilter(sfLayer, snapshotFilter); + } else { + const imeParentTaskFilter = getFilter(parentTaskName); + // prune all children that are not part of the "parent task" of ImeContainer + resultLayer = pruneChildrenByFilter(sfLayer, imeParentTaskFilter); + } + resultLayer.kind = 'SurfaceFlinger Properties'; + return resultLayer; +} + +function findParentTaskNameOfImeContainer(curr) { + const isImeContainer = getFilter('ImeContainer'); + if (isImeContainer(curr)) { + let parent = curr.parent; + const isTask = getFilter('Task'); + while (parent && !isTask(parent)) { + if (parent.parent != null) { + parent = parent.parent; + } + // else 'parent' is already the root node; use it + } + return parent.name; + } + // search for ImeContainer in children + for (const child of curr.children) { + const result = findParentTaskNameOfImeContainer(child); + if (result !== '') { + return result; + } + } + return ''; } function pruneChildrenByFilter(curr, filter) { diff --git a/tools/winscope/src/mixins/FileType.js b/tools/winscope/src/mixins/FileType.js index a41613565..8365fa01e 100644 --- a/tools/winscope/src/mixins/FileType.js +++ b/tools/winscope/src/mixins/FileType.js @@ -43,6 +43,11 @@ const mixin = { return file.type == TRACE_TYPES.SURFACE_FLINGER || file.type == DUMP_TYPES.SURFACE_FLINGER; }, + showInImeTraceView(file) { + return file.type == TRACE_TYPES.IME_CLIENTS || + file.type == TRACE_TYPES.IME_SERVICE || + file.type == TRACE_TYPES.IME_MANAGERSERVICE; + }, isVideo(file) { return file.type == TRACE_TYPES.SCREEN_RECORDING; }, diff --git a/tools/winscope/src/transform_ime.js b/tools/winscope/src/transform_ime.js index 718a05461..2287bf5d3 100644 --- a/tools/winscope/src/transform_ime.js +++ b/tools/winscope/src/transform_ime.js @@ -20,7 +20,8 @@ function transform_entry_clients(entry) { [[entry.client], transform_client_dump] ], timestamp: entry.elapsedRealtimeNanos, - stableId: 'entry' + stableId: 'entry', + freeze: false, }); } @@ -54,7 +55,8 @@ function transform_entry_service(entry) { [[entry.inputMethodService], transform_service_dump] ], timestamp: entry.elapsedRealtimeNanos, - stableId: 'entry' + stableId: 'entry', + freeze: false, }); } @@ -88,7 +90,8 @@ function transform_entry_managerservice(entry) { [[entry.inputMethodManagerService], transform_managerservice_dump] ], timestamp: entry.elapsedRealtimeNanos, - stableId: 'entry' + stableId: 'entry', + freeze: false, }); }