Determine if the WM entry is complete or not

Use the same logic from CTS tests

Read the information from flickerlib and display in winscope

Test: yarn run dev and open a few WM traces
Bug: 167521440
Change-Id: I96cb956968066afaabb3acf53615db53bdfabe37
This commit is contained in:
Nataniel Borges
2020-10-23 14:22:19 +02:00
parent 5e4ca356ae
commit 9534747390
12 changed files with 82 additions and 48 deletions

View File

@@ -14,6 +14,7 @@
* limitations under the License.
*/
import { asRawTreeViewObject } from '../utils/diff.js'
import { nanosToString, TimeUnits } from "../utils/utils.js"
import { getWMPropertiesForDisplay } from './mixin'
@@ -26,7 +27,6 @@ import {
import WindowContainer from "./windows/WindowContainer"
WindowManagerState.fromProto = function ({proto, timestamp = 0, where = ""}): WindowManagerState {
var inputMethodWIndowAppToken = ""
if (proto.inputMethodWindow != null) {
@@ -44,8 +44,6 @@ WindowManagerState.fromProto = function ({proto, timestamp = 0, where = ""}): Wi
inputMethodWIndowAppToken,
proto.rootWindowContainer.isHomeRecentsComponent,
proto.displayFrozen,
proto.rotation,
proto.lastOrientation,
proto.rootWindowContainer.pendingActivities.map(it => it.title),
rootWindowContainer,
keyguardControllerState,
@@ -53,11 +51,16 @@ WindowManagerState.fromProto = function ({proto, timestamp = 0, where = ""}): Wi
)
entry.obj = getWMPropertiesForDisplay(proto)
entry.obj["isComplete"] = entry.isComplete()
if (!entry.obj.isComplete) {
entry.obj["isIncompleteReason"] = entry.getIsIncompleteReason()
}
entry.name = nanosToString(entry.timestamp, TimeUnits.MILLI_SECONDS)
entry.shortName = entry.name
entry.children = entry.root.childrenWindows.reverse()
entry.chips = []
entry.visible = true
entry.rawTreeViewObject = asRawTreeViewObject(entry)
return entry
}
@@ -101,8 +104,8 @@ function newKeyguardControllerState(proto): KeyguardControllerState {
}
return new KeyguardControllerState(
proto?.aodShowing ?? false,
proto?.keyguardShowing ?? false,
proto?.isAodShowing ?? false,
proto?.isKeyguardShowing ?? false,
keyguardOccludedStates
)
}

View File

@@ -17,42 +17,42 @@
// Imports all the compiled common Flicker library classes and exports them
// as clean es6 modules rather than having them be commonjs modules
const WindowManagerTrace = require('flicker').com.android.server.wm.flicker.
common.traces.windowmanager.WindowManagerTrace;
const WindowManagerState = require('flicker').com.android.server.wm.
flicker.common.traces.windowmanager.WindowManagerState;
const WindowManagerTrace = require('flicker').com.android.server.wm.traces.common.
windowmanager.WindowManagerTrace;
const WindowManagerState = require('flicker').com.android.server.wm.traces.common.
windowmanager.WindowManagerState;
const Activity = require('flicker').com.android.server.wm.flicker.common.
traces.windowmanager.windows.Activity;
const ActivityTask = require('flicker').com.android.server.wm.flicker.common.
traces.windowmanager.windows.ActivityTask;
const Configuration = require('flicker').com.android.server.wm.flicker.common.
traces.windowmanager.windows.Configuration;
const ConfigurationContainer = require('flicker').com.android.server.wm.flicker.common.
traces.windowmanager.windows.ConfigurationContainer;
const DisplayArea = require('flicker').com.android.server.wm.flicker.common.
traces.windowmanager.windows.DisplayArea;
const DisplayContent = require('flicker').com.android.server.wm.flicker.common.
traces.windowmanager.windows.DisplayContent;
const KeyguardControllerState = require('flicker').com.android.server.wm.flicker.common.
traces.windowmanager.windows.KeyguardControllerState;
const RootWindowContainer = require('flicker').com.android.server.wm.flicker.common.
traces.windowmanager.windows.RootWindowContainer;
const WindowConfiguration = require('flicker').com.android.server.wm.flicker.common.
traces.windowmanager.windows.WindowConfiguration;
const WindowContainer = require('flicker').com.android.server.wm.flicker.common.
traces.windowmanager.windows.WindowContainer;
const WindowContainerChild = require('flicker').com.android.server.wm.flicker.common.
traces.windowmanager.windows.WindowContainerChild;
const WindowManagerPolicy = require('flicker').com.android.server.wm.flicker.common.
traces.windowmanager.windows.WindowManagerPolicy;
const WindowState = require('flicker').com.android.server.wm.flicker.common.
traces.windowmanager.windows.WindowState;
const WindowToken = require('flicker').com.android.server.wm.flicker.common.
traces.windowmanager.windows.WindowToken;
const Activity = require('flicker').com.android.server.wm.traces.common.
windowmanager.windows.Activity;
const ActivityTask = require('flicker').com.android.server.wm.traces.common.
windowmanager.windows.ActivityTask;
const Configuration = require('flicker').com.android.server.wm.traces.common.
windowmanager.windows.Configuration;
const ConfigurationContainer = require('flicker').com.android.server.wm.traces.common.
windowmanager.windows.ConfigurationContainer;
const DisplayArea = require('flicker').com.android.server.wm.traces.common.
windowmanager.windows.DisplayArea;
const DisplayContent = require('flicker').com.android.server.wm.traces.common.
windowmanager.windows.DisplayContent;
const KeyguardControllerState = require('flicker').com.android.server.wm.traces.common.
windowmanager.windows.KeyguardControllerState;
const RootWindowContainer = require('flicker').com.android.server.wm.traces.common.
windowmanager.windows.RootWindowContainer;
const WindowConfiguration = require('flicker').com.android.server.wm.traces.common.
windowmanager.windows.WindowConfiguration;
const WindowContainer = require('flicker').com.android.server.wm.traces.common.
windowmanager.windows.WindowContainer;
const WindowContainerChild = require('flicker').com.android.server.wm.traces.common.
windowmanager.windows.WindowContainerChild;
const WindowManagerPolicy = require('flicker').com.android.server.wm.traces.common.
windowmanager.windows.WindowManagerPolicy;
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 Rect = require('flicker').com.android.server.wm.flicker.common.Rect;
const Bounds = require('flicker').com.android.server.wm.flicker.common.Bounds;
const Rect = require('flicker').com.android.server.wm.traces.common.Rect;
const Bounds = require('flicker').com.android.server.wm.traces.common.Bounds;
function toRect(proto) {
if (proto == null) {

View File

@@ -15,6 +15,7 @@
*/
import { getWMPropertiesForDisplay, shortenName } from '../mixin'
import { asRawTreeViewObject } from '../../utils/diff.js'
import { Activity } from "../common"
import WindowContainer from "./WindowContainer"
@@ -46,6 +47,7 @@ Activity.fromProto = function (proto, parent: WindowContainer): Activity {
entry.obj = getWMPropertiesForDisplay(proto)
entry.shortName = shortenName(entry.name)
entry.children = entry.childrenWindows
entry.rawTreeViewObject = asRawTreeViewObject(entry)
return entry
}
}

View File

@@ -15,6 +15,7 @@
*/
import { getWMPropertiesForDisplay, shortenName } from '../mixin'
import { asRawTreeViewObject } from '../../utils/diff.js'
import { ActivityTask, toRect } from "../common"
import WindowContainer from "./WindowContainer"
@@ -55,6 +56,7 @@ ActivityTask.fromProto = function (proto, isActivityInTree: Boolean): ActivityTa
entry.obj = getWMPropertiesForDisplay(proto)
entry.shortName = shortenName(entry.name)
entry.children = entry.childrenWindows
entry.rawTreeViewObject = asRawTreeViewObject(entry)
return entry
}
}

View File

@@ -15,6 +15,7 @@
*/
import { getWMPropertiesForDisplay, shortenName } from '../mixin'
import { asRawTreeViewObject } from '../../utils/diff.js'
import { DisplayArea } from "../common"
import WindowContainer from "./WindowContainer"
@@ -36,6 +37,7 @@ DisplayArea.fromProto = function (proto, isActivityInTree: Boolean): DisplayArea
entry.obj = getWMPropertiesForDisplay(proto)
entry.shortName = shortenName(entry.name)
entry.children = entry.childrenWindows
entry.rawTreeViewObject = asRawTreeViewObject(entry)
return entry
}
}

View File

@@ -15,6 +15,7 @@
*/
import { getWMPropertiesForDisplay, shortenName } from '../mixin'
import { asRawTreeViewObject } from '../../utils/diff.js'
import { toRect, DisplayContent, Rect } from "../common"
import WindowContainer from "./WindowContainer"
@@ -52,6 +53,8 @@ DisplayContent.fromProto = function (proto, isActivityInTree: Boolean): DisplayC
proto.focusedApp,
proto.appTransition?.lastUsedAppTransition ?? "",
proto.appTransition?.appTransitionState ?? "",
proto.displayRotation?.rotation ?? 0,
proto.displayRotation?.lastOrientation ?? 0,
windowContainer
)
@@ -63,6 +66,7 @@ DisplayContent.fromProto = function (proto, isActivityInTree: Boolean): DisplayC
entry.obj = getWMPropertiesForDisplay(proto)
entry.shortName = shortenName(entry.name)
entry.children = entry.childrenWindows
entry.rawTreeViewObject = asRawTreeViewObject(entry)
return entry
}
}

View File

@@ -15,6 +15,7 @@
*/
import { getWMPropertiesForDisplay, shortenName } from '../mixin'
import { asRawTreeViewObject } from '../../utils/diff.js'
import {
Configuration,
@@ -58,6 +59,7 @@ WindowContainer.fromProto = function ({
// properties by changing the target element in the hierarchy tree view.
entry.obj = getWMPropertiesForDisplay(proto)
entry.shortName = shortenName(entry.name)
entry.rawTreeViewObject = asRawTreeViewObject(entry)
return entry
}
}

View File

@@ -15,6 +15,7 @@
*/
import { getWMPropertiesForDisplay, shortenName } from '../mixin'
import { asRawTreeViewObject } from '../../utils/diff.js'
import { toRect, WindowState } from "../common"
import { VISIBLE_CHIP } from '../treeview/Chips'
import WindowContainer from "./WindowContainer"
@@ -75,12 +76,13 @@ import WindowContainer from "./WindowContainer"
entry.obj = getWMPropertiesForDisplay(proto)
entry.shortName = shortenName(entry.name)
entry.visible = entry.isVisible ?? false
entry.chips = entry.isVisible ? [VISIBLE_CHIP] : []
entry.visible = entry.isSurfaceShown ?? false
entry.chips = entry.isSurfaceShown ? [VISIBLE_CHIP] : []
entry.children = entry.childrenWindows
if (entry.isVisible) {
if (entry.isSurfaceShown) {
entry.rect = entry.rects[0]
}
entry.rawTreeViewObject = asRawTreeViewObject(entry)
return entry
}
}

View File

@@ -15,6 +15,7 @@
*/
import { getWMPropertiesForDisplay, shortenName } from '../mixin'
import { asRawTreeViewObject } from '../../utils/diff.js'
import { WindowToken } from "../common"
import WindowContainer from "./WindowContainer"
@@ -36,6 +37,7 @@ WindowToken.fromProto = function (proto, isActivityInTree: Boolean): WindowToken
entry.obj = getWMPropertiesForDisplay(proto)
entry.shortName = shortenName(entry.name)
entry.children = entry.childrenWindows
entry.rawTreeViewObject = asRawTreeViewObject(entry)
return entry
}
}

View File

@@ -26,6 +26,21 @@ export const DiffType = Object.freeze({
MODIFIED: 'modified',
});
export function asRawTreeViewObject(obj) {
const children = obj.children?.map(child => child.rawTreeViewObject) ?? []
return {
kind: obj.kind,
name: obj.name,
shortName: obj.shortName,
stableId: obj.stableId,
chips: obj.chips,
obj: obj.obj,
children,
ref: obj,
};
}
export function defaultModifiedCheck(newNode, oldNode) {
if (!newNode && !oldNode) {
return false;
@@ -44,16 +59,16 @@ function isPrimitive(test) {
export class DiffGenerator {
constructor(tree) {
if (tree.asRawTreeViewObject) {
this.tree = tree.asRawTreeViewObject();
if (tree.rawTreeViewObject) {
this.tree = tree.rawTreeViewObject;
} else {
this.tree = tree;
}
}
compareWith(tree) {
if (tree?.asRawTreeViewObject) {
this.diffWithTree = tree.asRawTreeViewObject();
if (tree?.rawTreeViewObject) {
this.diffWithTree = tree.rawTreeViewObject;
} else {
this.diffWithTree = tree;
}

View File

@@ -133,7 +133,7 @@ const webpackConfig = {
new KotlinWebpackPlugin({
src: [
path.join(__dirname, '../../../platform_testing/libraries/flicker/' +
'src/com/android/server/wm/flicker/common/'),
'src/com/android/server/wm/traces/common/'),
],
output: 'kotlin_build',
moduleName: 'flicker',

View File

@@ -96,7 +96,7 @@ module.exports = {
new KotlinWebpackPlugin({
src: [
path.join(__dirname, '../../../platform_testing/libraries/flicker/' +
'src/com/android/server/wm/flicker/common/'),
'src/com/android/server/wm/traces/common/'),
],
output: 'kotlin_build',
moduleName: 'flicker',