diff --git a/tools/winscope/src/flickerlib/WindowManagerState.ts b/tools/winscope/src/flickerlib/WindowManagerState.ts index 8bed56f25..ef388febb 100644 --- a/tools/winscope/src/flickerlib/WindowManagerState.ts +++ b/tools/winscope/src/flickerlib/WindowManagerState.ts @@ -18,7 +18,8 @@ import { KeyguardControllerState, RootWindowContainer, WindowManagerPolicy, - WindowManagerState + WindowManagerState, + WINDOW_MANAGER_KIND, } from "./common" import WindowContainer from "./windows/WindowContainer" @@ -54,7 +55,7 @@ WindowManagerState.fromProto = function (proto: any, timestamp: number = 0, wher } function addAttributes(entry: WindowManagerState, proto: any) { - entry.kind = entry.constructor.name; + entry.kind = WINDOW_MANAGER_KIND; // There no JVM/JS translation for Longs yet entry.timestampMs = entry.timestamp.toString(); entry.rects = entry.windowStates.reverse().map(it => it.rect); diff --git a/tools/winscope/src/flickerlib/common.js b/tools/winscope/src/flickerlib/common.js index cca16f464..5633cad33 100644 --- a/tools/winscope/src/flickerlib/common.js +++ b/tools/winscope/src/flickerlib/common.js @@ -52,6 +52,7 @@ const WindowState = require('flicker').com.android.server.wm.traces.common. windowmanager.windows.WindowState; const WindowToken = require('flicker').com.android.server.wm.traces.common. windowmanager.windows.WindowToken; +const WINDOW_MANAGER_KIND = 'WindowManagerState'; // SF const Layer = require('flicker').com.android.server.wm.traces.common. @@ -72,6 +73,7 @@ const Transform = require('flicker').com.android.server.wm.traces.common. layers.Transform; const Display = require('flicker').com.android.server.wm.traces.common. layers.Display; +const SURFACE_FLINGER_KIND = 'SurfaceFlingerLayer'; // Common const Size = require('flicker').com.android.server.wm.traces.common.Size; @@ -271,6 +273,7 @@ export { WindowManagerPolicy, WindowManagerTrace, WindowManagerState, + WINDOW_MANAGER_KIND, // SF BaseLayerTraceEntry, Layer, @@ -281,6 +284,7 @@ export { Matrix22, Matrix33, Display, + SURFACE_FLINGER_KIND, // Tags Tag, TagState, diff --git a/tools/winscope/src/flickerlib/layers/LayerTraceEntry.ts b/tools/winscope/src/flickerlib/layers/LayerTraceEntry.ts index 8213c2ded..ffa723d46 100644 --- a/tools/winscope/src/flickerlib/layers/LayerTraceEntry.ts +++ b/tools/winscope/src/flickerlib/layers/LayerTraceEntry.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import { Display, LayerTraceEntry, LayerTraceEntryBuilder, toRect, toSize, toTransform } from "../common" +import { Display, LayerTraceEntry, LayerTraceEntryBuilder, toRect, toSize, toTransform, SURFACE_FLINGER_KIND } from "../common" import Layer from './Layer' import { VISIBLE_CHIP, RELATIVE_Z_PARENT_CHIP, MISSING_LAYER } from '../treeview/Chips' @@ -31,7 +31,7 @@ LayerTraceEntry.fromProto = function (protos: any[], displayProtos: any[], } function addAttributes(entry: LayerTraceEntry, protos: any) { - entry.kind = "entry" + entry.kind = SURFACE_FLINGER_KIND; // There no JVM/JS translation for Longs yet entry.timestampMs = entry.timestamp.toString() entry.rects = entry.visibleLayers diff --git a/tools/winscope/src/ime_processing.js b/tools/winscope/src/ime_processing.js index f26f3e5cb..2670ee3f0 100644 --- a/tools/winscope/src/ime_processing.js +++ b/tools/winscope/src/ime_processing.js @@ -22,6 +22,7 @@ import {getFilter} from '@/utils/utils'; import {TRACE_TYPES} from '@/decode'; +import {WINDOW_MANAGER_KIND} from '@/flickerlib/common'; function combineWmSfWithImeDataIfExisting(dataFiles) { // TODO(b/237744706): Add tests for this function @@ -83,7 +84,7 @@ function combineWmSfPropertiesIntoImeData(imeTraceFile, wmOrSfTraceFile) { let wmStateOrSfLayer = wmOrSfData[wmOrSfIntersectIndex]; if (wmStateOrSfLayer) { // filter to only relevant nodes & fields - if (wmStateOrSfLayer.kind === 'WindowManagerState') { + if (wmStateOrSfLayer.kind === WINDOW_MANAGER_KIND) { wmStateOrSfLayer = filterWmStateForIme(wmStateOrSfLayer); imeTraceFile.data[i].wmProperties = wmStateOrSfLayer; } else { @@ -96,7 +97,6 @@ function combineWmSfPropertiesIntoImeData(imeTraceFile, wmOrSfTraceFile) { // put SF entry in hierarchy view imeTraceFile.data[i].children.push(wmStateOrSfLayer); } - console.log('after pruning:', wmStateOrSfLayer); if (wmStateOrSfLayer) { imeTraceFile.data[0].hasWmSfProperties = true; // Note: hasWmSfProperties is added into data because the diff --git a/tools/winscope/src/transform_ime.js b/tools/winscope/src/transform_ime.js index 2287bf5d3..7792a3d22 100644 --- a/tools/winscope/src/transform_ime.js +++ b/tools/winscope/src/transform_ime.js @@ -14,7 +14,7 @@ function transform_ime_trace_clients(entries) { function transform_entry_clients(entry) { return transform({ obj: entry, - kind: 'entry', + kind: 'InputMethodClient entry', name: nanos_to_string(entry.elapsedRealtimeNanos) + " - " + entry.where, children: [ [[entry.client], transform_client_dump] @@ -49,7 +49,7 @@ function transform_ime_trace_service(entries) { function transform_entry_service(entry) { return transform({ obj: entry, - kind: 'entry', + kind: 'InputMethodService entry', name: nanos_to_string(entry.elapsedRealtimeNanos) + " - " + entry.where, children: [ [[entry.inputMethodService], transform_service_dump] @@ -84,7 +84,7 @@ function transform_ime_trace_managerservice(entries) { function transform_entry_managerservice(entry) { return transform({ obj: entry, - kind: 'entry', + kind: 'InputMethodManagerService entry', name: nanos_to_string(entry.elapsedRealtimeNanos) + " - " + entry.where, children: [ [[entry.inputMethodManagerService], transform_managerservice_dump]