[5] Modify "kind" attribute of trace entries

- Add constants to flickerlib's common.js defining the "kind" of
WindowManager and SurfaceFlinger entries
- Modify flickerlib's WindowManagerState and LayerTraceEntry,
as well as ime_processing.js, to use these constants
- Modify the "kind" of IME entries directly in transform_ime.js.
In the future, these should also be constants defined in flickerlib

Bug: 236226833
Test: manual on local build

Change-Id: I310f301e82ae976a202ca1c8cc40c7b686a9723f
This commit is contained in:
Hui Ling Shi
2022-06-21 07:55:50 +00:00
parent 9ba943f1b0
commit 6fbc98df12
5 changed files with 14 additions and 9 deletions

View File

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

View File

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

View File

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

View File

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

View File

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