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:
@@ -14,6 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { asRawTreeViewObject } from '../utils/diff.js'
|
||||||
import { nanosToString, TimeUnits } from "../utils/utils.js"
|
import { nanosToString, TimeUnits } from "../utils/utils.js"
|
||||||
import { getWMPropertiesForDisplay } from './mixin'
|
import { getWMPropertiesForDisplay } from './mixin'
|
||||||
|
|
||||||
@@ -26,7 +27,6 @@ import {
|
|||||||
|
|
||||||
import WindowContainer from "./windows/WindowContainer"
|
import WindowContainer from "./windows/WindowContainer"
|
||||||
|
|
||||||
|
|
||||||
WindowManagerState.fromProto = function ({proto, timestamp = 0, where = ""}): WindowManagerState {
|
WindowManagerState.fromProto = function ({proto, timestamp = 0, where = ""}): WindowManagerState {
|
||||||
var inputMethodWIndowAppToken = ""
|
var inputMethodWIndowAppToken = ""
|
||||||
if (proto.inputMethodWindow != null) {
|
if (proto.inputMethodWindow != null) {
|
||||||
@@ -44,8 +44,6 @@ WindowManagerState.fromProto = function ({proto, timestamp = 0, where = ""}): Wi
|
|||||||
inputMethodWIndowAppToken,
|
inputMethodWIndowAppToken,
|
||||||
proto.rootWindowContainer.isHomeRecentsComponent,
|
proto.rootWindowContainer.isHomeRecentsComponent,
|
||||||
proto.displayFrozen,
|
proto.displayFrozen,
|
||||||
proto.rotation,
|
|
||||||
proto.lastOrientation,
|
|
||||||
proto.rootWindowContainer.pendingActivities.map(it => it.title),
|
proto.rootWindowContainer.pendingActivities.map(it => it.title),
|
||||||
rootWindowContainer,
|
rootWindowContainer,
|
||||||
keyguardControllerState,
|
keyguardControllerState,
|
||||||
@@ -53,11 +51,16 @@ WindowManagerState.fromProto = function ({proto, timestamp = 0, where = ""}): Wi
|
|||||||
)
|
)
|
||||||
|
|
||||||
entry.obj = getWMPropertiesForDisplay(proto)
|
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.name = nanosToString(entry.timestamp, TimeUnits.MILLI_SECONDS)
|
||||||
entry.shortName = entry.name
|
entry.shortName = entry.name
|
||||||
entry.children = entry.root.childrenWindows.reverse()
|
entry.children = entry.root.childrenWindows.reverse()
|
||||||
entry.chips = []
|
entry.chips = []
|
||||||
entry.visible = true
|
entry.visible = true
|
||||||
|
entry.rawTreeViewObject = asRawTreeViewObject(entry)
|
||||||
return entry
|
return entry
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,8 +104,8 @@ function newKeyguardControllerState(proto): KeyguardControllerState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new KeyguardControllerState(
|
return new KeyguardControllerState(
|
||||||
proto?.aodShowing ?? false,
|
proto?.isAodShowing ?? false,
|
||||||
proto?.keyguardShowing ?? false,
|
proto?.isKeyguardShowing ?? false,
|
||||||
keyguardOccludedStates
|
keyguardOccludedStates
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,42 +17,42 @@
|
|||||||
// Imports all the compiled common Flicker library classes and exports them
|
// Imports all the compiled common Flicker library classes and exports them
|
||||||
// as clean es6 modules rather than having them be commonjs modules
|
// as clean es6 modules rather than having them be commonjs modules
|
||||||
|
|
||||||
const WindowManagerTrace = require('flicker').com.android.server.wm.flicker.
|
const WindowManagerTrace = require('flicker').com.android.server.wm.traces.common.
|
||||||
common.traces.windowmanager.WindowManagerTrace;
|
windowmanager.WindowManagerTrace;
|
||||||
const WindowManagerState = require('flicker').com.android.server.wm.
|
const WindowManagerState = require('flicker').com.android.server.wm.traces.common.
|
||||||
flicker.common.traces.windowmanager.WindowManagerState;
|
windowmanager.WindowManagerState;
|
||||||
|
|
||||||
const Activity = require('flicker').com.android.server.wm.flicker.common.
|
const Activity = require('flicker').com.android.server.wm.traces.common.
|
||||||
traces.windowmanager.windows.Activity;
|
windowmanager.windows.Activity;
|
||||||
const ActivityTask = require('flicker').com.android.server.wm.flicker.common.
|
const ActivityTask = require('flicker').com.android.server.wm.traces.common.
|
||||||
traces.windowmanager.windows.ActivityTask;
|
windowmanager.windows.ActivityTask;
|
||||||
const Configuration = require('flicker').com.android.server.wm.flicker.common.
|
const Configuration = require('flicker').com.android.server.wm.traces.common.
|
||||||
traces.windowmanager.windows.Configuration;
|
windowmanager.windows.Configuration;
|
||||||
const ConfigurationContainer = require('flicker').com.android.server.wm.flicker.common.
|
const ConfigurationContainer = require('flicker').com.android.server.wm.traces.common.
|
||||||
traces.windowmanager.windows.ConfigurationContainer;
|
windowmanager.windows.ConfigurationContainer;
|
||||||
const DisplayArea = require('flicker').com.android.server.wm.flicker.common.
|
const DisplayArea = require('flicker').com.android.server.wm.traces.common.
|
||||||
traces.windowmanager.windows.DisplayArea;
|
windowmanager.windows.DisplayArea;
|
||||||
const DisplayContent = require('flicker').com.android.server.wm.flicker.common.
|
const DisplayContent = require('flicker').com.android.server.wm.traces.common.
|
||||||
traces.windowmanager.windows.DisplayContent;
|
windowmanager.windows.DisplayContent;
|
||||||
const KeyguardControllerState = require('flicker').com.android.server.wm.flicker.common.
|
const KeyguardControllerState = require('flicker').com.android.server.wm.traces.common.
|
||||||
traces.windowmanager.windows.KeyguardControllerState;
|
windowmanager.windows.KeyguardControllerState;
|
||||||
const RootWindowContainer = require('flicker').com.android.server.wm.flicker.common.
|
const RootWindowContainer = require('flicker').com.android.server.wm.traces.common.
|
||||||
traces.windowmanager.windows.RootWindowContainer;
|
windowmanager.windows.RootWindowContainer;
|
||||||
const WindowConfiguration = require('flicker').com.android.server.wm.flicker.common.
|
const WindowConfiguration = require('flicker').com.android.server.wm.traces.common.
|
||||||
traces.windowmanager.windows.WindowConfiguration;
|
windowmanager.windows.WindowConfiguration;
|
||||||
const WindowContainer = require('flicker').com.android.server.wm.flicker.common.
|
const WindowContainer = require('flicker').com.android.server.wm.traces.common.
|
||||||
traces.windowmanager.windows.WindowContainer;
|
windowmanager.windows.WindowContainer;
|
||||||
const WindowContainerChild = require('flicker').com.android.server.wm.flicker.common.
|
const WindowContainerChild = require('flicker').com.android.server.wm.traces.common.
|
||||||
traces.windowmanager.windows.WindowContainerChild;
|
windowmanager.windows.WindowContainerChild;
|
||||||
const WindowManagerPolicy = require('flicker').com.android.server.wm.flicker.common.
|
const WindowManagerPolicy = require('flicker').com.android.server.wm.traces.common.
|
||||||
traces.windowmanager.windows.WindowManagerPolicy;
|
windowmanager.windows.WindowManagerPolicy;
|
||||||
const WindowState = require('flicker').com.android.server.wm.flicker.common.
|
const WindowState = require('flicker').com.android.server.wm.traces.common.
|
||||||
traces.windowmanager.windows.WindowState;
|
windowmanager.windows.WindowState;
|
||||||
const WindowToken = require('flicker').com.android.server.wm.flicker.common.
|
const WindowToken = require('flicker').com.android.server.wm.traces.common.
|
||||||
traces.windowmanager.windows.WindowToken;
|
windowmanager.windows.WindowToken;
|
||||||
|
|
||||||
const Rect = require('flicker').com.android.server.wm.flicker.common.Rect;
|
const Rect = require('flicker').com.android.server.wm.traces.common.Rect;
|
||||||
const Bounds = require('flicker').com.android.server.wm.flicker.common.Bounds;
|
const Bounds = require('flicker').com.android.server.wm.traces.common.Bounds;
|
||||||
|
|
||||||
function toRect(proto) {
|
function toRect(proto) {
|
||||||
if (proto == null) {
|
if (proto == null) {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { getWMPropertiesForDisplay, shortenName } from '../mixin'
|
import { getWMPropertiesForDisplay, shortenName } from '../mixin'
|
||||||
|
import { asRawTreeViewObject } from '../../utils/diff.js'
|
||||||
import { Activity } from "../common"
|
import { Activity } from "../common"
|
||||||
import WindowContainer from "./WindowContainer"
|
import WindowContainer from "./WindowContainer"
|
||||||
|
|
||||||
@@ -46,6 +47,7 @@ Activity.fromProto = function (proto, parent: WindowContainer): Activity {
|
|||||||
entry.obj = getWMPropertiesForDisplay(proto)
|
entry.obj = getWMPropertiesForDisplay(proto)
|
||||||
entry.shortName = shortenName(entry.name)
|
entry.shortName = shortenName(entry.name)
|
||||||
entry.children = entry.childrenWindows
|
entry.children = entry.childrenWindows
|
||||||
|
entry.rawTreeViewObject = asRawTreeViewObject(entry)
|
||||||
return entry
|
return entry
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { getWMPropertiesForDisplay, shortenName } from '../mixin'
|
import { getWMPropertiesForDisplay, shortenName } from '../mixin'
|
||||||
|
import { asRawTreeViewObject } from '../../utils/diff.js'
|
||||||
import { ActivityTask, toRect } from "../common"
|
import { ActivityTask, toRect } from "../common"
|
||||||
import WindowContainer from "./WindowContainer"
|
import WindowContainer from "./WindowContainer"
|
||||||
|
|
||||||
@@ -55,6 +56,7 @@ ActivityTask.fromProto = function (proto, isActivityInTree: Boolean): ActivityTa
|
|||||||
entry.obj = getWMPropertiesForDisplay(proto)
|
entry.obj = getWMPropertiesForDisplay(proto)
|
||||||
entry.shortName = shortenName(entry.name)
|
entry.shortName = shortenName(entry.name)
|
||||||
entry.children = entry.childrenWindows
|
entry.children = entry.childrenWindows
|
||||||
|
entry.rawTreeViewObject = asRawTreeViewObject(entry)
|
||||||
return entry
|
return entry
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { getWMPropertiesForDisplay, shortenName } from '../mixin'
|
import { getWMPropertiesForDisplay, shortenName } from '../mixin'
|
||||||
|
import { asRawTreeViewObject } from '../../utils/diff.js'
|
||||||
import { DisplayArea } from "../common"
|
import { DisplayArea } from "../common"
|
||||||
import WindowContainer from "./WindowContainer"
|
import WindowContainer from "./WindowContainer"
|
||||||
|
|
||||||
@@ -36,6 +37,7 @@ DisplayArea.fromProto = function (proto, isActivityInTree: Boolean): DisplayArea
|
|||||||
entry.obj = getWMPropertiesForDisplay(proto)
|
entry.obj = getWMPropertiesForDisplay(proto)
|
||||||
entry.shortName = shortenName(entry.name)
|
entry.shortName = shortenName(entry.name)
|
||||||
entry.children = entry.childrenWindows
|
entry.children = entry.childrenWindows
|
||||||
|
entry.rawTreeViewObject = asRawTreeViewObject(entry)
|
||||||
return entry
|
return entry
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { getWMPropertiesForDisplay, shortenName } from '../mixin'
|
import { getWMPropertiesForDisplay, shortenName } from '../mixin'
|
||||||
|
import { asRawTreeViewObject } from '../../utils/diff.js'
|
||||||
import { toRect, DisplayContent, Rect } from "../common"
|
import { toRect, DisplayContent, Rect } from "../common"
|
||||||
import WindowContainer from "./WindowContainer"
|
import WindowContainer from "./WindowContainer"
|
||||||
|
|
||||||
@@ -52,6 +53,8 @@ DisplayContent.fromProto = function (proto, isActivityInTree: Boolean): DisplayC
|
|||||||
proto.focusedApp,
|
proto.focusedApp,
|
||||||
proto.appTransition?.lastUsedAppTransition ?? "",
|
proto.appTransition?.lastUsedAppTransition ?? "",
|
||||||
proto.appTransition?.appTransitionState ?? "",
|
proto.appTransition?.appTransitionState ?? "",
|
||||||
|
proto.displayRotation?.rotation ?? 0,
|
||||||
|
proto.displayRotation?.lastOrientation ?? 0,
|
||||||
windowContainer
|
windowContainer
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -63,6 +66,7 @@ DisplayContent.fromProto = function (proto, isActivityInTree: Boolean): DisplayC
|
|||||||
entry.obj = getWMPropertiesForDisplay(proto)
|
entry.obj = getWMPropertiesForDisplay(proto)
|
||||||
entry.shortName = shortenName(entry.name)
|
entry.shortName = shortenName(entry.name)
|
||||||
entry.children = entry.childrenWindows
|
entry.children = entry.childrenWindows
|
||||||
|
entry.rawTreeViewObject = asRawTreeViewObject(entry)
|
||||||
return entry
|
return entry
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { getWMPropertiesForDisplay, shortenName } from '../mixin'
|
import { getWMPropertiesForDisplay, shortenName } from '../mixin'
|
||||||
|
import { asRawTreeViewObject } from '../../utils/diff.js'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Configuration,
|
Configuration,
|
||||||
@@ -58,6 +59,7 @@ WindowContainer.fromProto = function ({
|
|||||||
// properties by changing the target element in the hierarchy tree view.
|
// properties by changing the target element in the hierarchy tree view.
|
||||||
entry.obj = getWMPropertiesForDisplay(proto)
|
entry.obj = getWMPropertiesForDisplay(proto)
|
||||||
entry.shortName = shortenName(entry.name)
|
entry.shortName = shortenName(entry.name)
|
||||||
|
entry.rawTreeViewObject = asRawTreeViewObject(entry)
|
||||||
return entry
|
return entry
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { getWMPropertiesForDisplay, shortenName } from '../mixin'
|
import { getWMPropertiesForDisplay, shortenName } from '../mixin'
|
||||||
|
import { asRawTreeViewObject } from '../../utils/diff.js'
|
||||||
import { toRect, WindowState } from "../common"
|
import { toRect, WindowState } from "../common"
|
||||||
import { VISIBLE_CHIP } from '../treeview/Chips'
|
import { VISIBLE_CHIP } from '../treeview/Chips'
|
||||||
import WindowContainer from "./WindowContainer"
|
import WindowContainer from "./WindowContainer"
|
||||||
@@ -75,12 +76,13 @@ import WindowContainer from "./WindowContainer"
|
|||||||
|
|
||||||
entry.obj = getWMPropertiesForDisplay(proto)
|
entry.obj = getWMPropertiesForDisplay(proto)
|
||||||
entry.shortName = shortenName(entry.name)
|
entry.shortName = shortenName(entry.name)
|
||||||
entry.visible = entry.isVisible ?? false
|
entry.visible = entry.isSurfaceShown ?? false
|
||||||
entry.chips = entry.isVisible ? [VISIBLE_CHIP] : []
|
entry.chips = entry.isSurfaceShown ? [VISIBLE_CHIP] : []
|
||||||
entry.children = entry.childrenWindows
|
entry.children = entry.childrenWindows
|
||||||
if (entry.isVisible) {
|
if (entry.isSurfaceShown) {
|
||||||
entry.rect = entry.rects[0]
|
entry.rect = entry.rects[0]
|
||||||
}
|
}
|
||||||
|
entry.rawTreeViewObject = asRawTreeViewObject(entry)
|
||||||
return entry
|
return entry
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { getWMPropertiesForDisplay, shortenName } from '../mixin'
|
import { getWMPropertiesForDisplay, shortenName } from '../mixin'
|
||||||
|
import { asRawTreeViewObject } from '../../utils/diff.js'
|
||||||
import { WindowToken } from "../common"
|
import { WindowToken } from "../common"
|
||||||
import WindowContainer from "./WindowContainer"
|
import WindowContainer from "./WindowContainer"
|
||||||
|
|
||||||
@@ -36,6 +37,7 @@ WindowToken.fromProto = function (proto, isActivityInTree: Boolean): WindowToken
|
|||||||
entry.obj = getWMPropertiesForDisplay(proto)
|
entry.obj = getWMPropertiesForDisplay(proto)
|
||||||
entry.shortName = shortenName(entry.name)
|
entry.shortName = shortenName(entry.name)
|
||||||
entry.children = entry.childrenWindows
|
entry.children = entry.childrenWindows
|
||||||
|
entry.rawTreeViewObject = asRawTreeViewObject(entry)
|
||||||
return entry
|
return entry
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,21 @@ export const DiffType = Object.freeze({
|
|||||||
MODIFIED: 'modified',
|
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) {
|
export function defaultModifiedCheck(newNode, oldNode) {
|
||||||
if (!newNode && !oldNode) {
|
if (!newNode && !oldNode) {
|
||||||
return false;
|
return false;
|
||||||
@@ -44,16 +59,16 @@ function isPrimitive(test) {
|
|||||||
|
|
||||||
export class DiffGenerator {
|
export class DiffGenerator {
|
||||||
constructor(tree) {
|
constructor(tree) {
|
||||||
if (tree.asRawTreeViewObject) {
|
if (tree.rawTreeViewObject) {
|
||||||
this.tree = tree.asRawTreeViewObject();
|
this.tree = tree.rawTreeViewObject;
|
||||||
} else {
|
} else {
|
||||||
this.tree = tree;
|
this.tree = tree;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compareWith(tree) {
|
compareWith(tree) {
|
||||||
if (tree?.asRawTreeViewObject) {
|
if (tree?.rawTreeViewObject) {
|
||||||
this.diffWithTree = tree.asRawTreeViewObject();
|
this.diffWithTree = tree.rawTreeViewObject;
|
||||||
} else {
|
} else {
|
||||||
this.diffWithTree = tree;
|
this.diffWithTree = tree;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ const webpackConfig = {
|
|||||||
new KotlinWebpackPlugin({
|
new KotlinWebpackPlugin({
|
||||||
src: [
|
src: [
|
||||||
path.join(__dirname, '../../../platform_testing/libraries/flicker/' +
|
path.join(__dirname, '../../../platform_testing/libraries/flicker/' +
|
||||||
'src/com/android/server/wm/flicker/common/'),
|
'src/com/android/server/wm/traces/common/'),
|
||||||
],
|
],
|
||||||
output: 'kotlin_build',
|
output: 'kotlin_build',
|
||||||
moduleName: 'flicker',
|
moduleName: 'flicker',
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ module.exports = {
|
|||||||
new KotlinWebpackPlugin({
|
new KotlinWebpackPlugin({
|
||||||
src: [
|
src: [
|
||||||
path.join(__dirname, '../../../platform_testing/libraries/flicker/' +
|
path.join(__dirname, '../../../platform_testing/libraries/flicker/' +
|
||||||
'src/com/android/server/wm/flicker/common/'),
|
'src/com/android/server/wm/traces/common/'),
|
||||||
],
|
],
|
||||||
output: 'kotlin_build',
|
output: 'kotlin_build',
|
||||||
moduleName: 'flicker',
|
moduleName: 'flicker',
|
||||||
|
|||||||
Reference in New Issue
Block a user