Merge "Fix parsing of WM trace in critical mode"
This commit is contained in:
committed by
Android (Google) Code Review
commit
82ac2cd45c
@@ -235,7 +235,7 @@ class WindowManagerTraceSelectedConfig:
|
||||
# defaults set for all configs
|
||||
self.selectedConfigs = {
|
||||
"wmbuffersize": "16000",
|
||||
"tracinglevel": "all",
|
||||
"tracinglevel": "debug",
|
||||
"tracingtype": "frame",
|
||||
}
|
||||
|
||||
|
||||
@@ -243,8 +243,8 @@ const WM_SELECTED_CONFIG = {
|
||||
'transaction',
|
||||
],
|
||||
'tracinglevel': [
|
||||
'all',
|
||||
'trim',
|
||||
'verbose',
|
||||
'debug',
|
||||
'critical',
|
||||
],
|
||||
};
|
||||
|
||||
@@ -537,6 +537,7 @@ function decodeAndTransformProto(buffer, params, displayDefaults) {
|
||||
// From S onwards, returns a LayerTrace object, iterating over multiple items allows
|
||||
// winscope to handle both the new and legacy formats
|
||||
// TODO Refactor the decode.js code into a set of decoders to clean up the code
|
||||
let lastError = null;
|
||||
for (var x = 0; x < objTypesProto.length; x++) {
|
||||
const objType = objTypesProto[x];
|
||||
const transform = transforms[x];
|
||||
@@ -546,9 +547,14 @@ function decodeAndTransformProto(buffer, params, displayDefaults) {
|
||||
const transformed = transform(decoded);
|
||||
return transformed;
|
||||
} catch (e) {
|
||||
lastError = e;
|
||||
// check next parser
|
||||
}
|
||||
}
|
||||
|
||||
if (lastError) {
|
||||
throw lastError;
|
||||
}
|
||||
throw new UndetectableFileType('Unable to parse file');
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,8 @@ function createWindowManagerPolicy(proto: any): WindowManagerPolicy {
|
||||
function createRootWindowContainer(proto: any): RootWindowContainer {
|
||||
const windowContainer = WindowContainer.fromProto(
|
||||
/* proto */ proto.windowContainer,
|
||||
/* childrenProto */ proto.windowContainer.children.reverse()
|
||||
/* childrenProto */ proto.windowContainer?.children?.reverse() ?? [],
|
||||
/* isActivityInTree */ false
|
||||
);
|
||||
|
||||
if (windowContainer == null) {
|
||||
|
||||
@@ -25,7 +25,7 @@ Activity.fromProto = function (proto: any): Activity {
|
||||
} else {
|
||||
const windowContainer = WindowContainer.fromProto(
|
||||
/* proto */ proto.windowToken.windowContainer,
|
||||
/* protoChildren */ proto.windowToken.windowContainer.children.reverse(),
|
||||
/* protoChildren */ proto.windowToken.windowContainer?.children?.reverse() ?? [],
|
||||
/* isActivityInTree */ true,
|
||||
/* nameOverride */ null,
|
||||
/* identifierOverride */ proto.identifier
|
||||
|
||||
@@ -24,7 +24,7 @@ DisplayArea.fromProto = function (proto: any, isActivityInTree: Boolean): Displa
|
||||
} else {
|
||||
const windowContainer = WindowContainer.fromProto(
|
||||
/* proto */ proto.windowContainer,
|
||||
/* protoChildren */ proto.windowContainer.children.reverse(),
|
||||
/* protoChildren */ proto.windowContainer?.children?.reverse() ?? [],
|
||||
/* isActivityInTree */ isActivityInTree,
|
||||
/* nameOverride */ proto.name
|
||||
);
|
||||
|
||||
@@ -24,7 +24,7 @@ DisplayContent.fromProto = function (proto: any, isActivityInTree: Boolean): Dis
|
||||
} else {
|
||||
const windowContainer = WindowContainer.fromProto(
|
||||
/* proto */ proto.rootDisplayArea.windowContainer,
|
||||
/* protoChildren */ proto.rootDisplayArea.windowContainer.children.reverse(),
|
||||
/* protoChildren */ proto.rootDisplayArea.windowContainer?.children?.reverse() ?? [],
|
||||
/* isActivityInTree */ isActivityInTree,
|
||||
/* nameOverride */ proto.displayInfo?.name ?? null
|
||||
);
|
||||
|
||||
@@ -25,7 +25,7 @@ Task.fromProto = function (proto: any, isActivityInTree: Boolean): Task {
|
||||
const windowContainerProto = proto.taskFragment?.windowContainer ?? proto.windowContainer;
|
||||
const windowContainer = WindowContainer.fromProto(
|
||||
/* proto */ windowContainerProto,
|
||||
/* protoChildren */ windowContainerProto.children.reverse(),
|
||||
/* protoChildren */ windowContainerProto?.children?.reverse() ?? [],
|
||||
/* isActivityInTree */ isActivityInTree
|
||||
);
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ TaskFragment.fromProto = function (proto: any, isActivityInTree: Boolean): TaskF
|
||||
} else {
|
||||
const windowContainer = WindowContainer.fromProto(
|
||||
/* proto */ proto.windowContainer,
|
||||
/* protoChildren */ proto.windowContainer.children.reverse(),
|
||||
/* protoChildren */ proto.windowContainer?.children?.reverse() ?? [],
|
||||
/* isActivityInTree */ isActivityInTree);
|
||||
const entry = new TaskFragment(
|
||||
proto.activityType,
|
||||
|
||||
@@ -47,7 +47,8 @@ WindowContainer.fromProto = function (
|
||||
|
||||
const children = protoChildren
|
||||
.filter(it => it != null)
|
||||
.map(it => WindowContainer.childrenFromProto(it, isActivityInTree));
|
||||
.map(it => WindowContainer.childrenFromProto(it, isActivityInTree))
|
||||
.filter(it => it != null);
|
||||
|
||||
const identifier = identifierOverride ?? proto.identifier;
|
||||
var name = nameOverride ?? identifier?.title ?? "";
|
||||
|
||||
@@ -29,7 +29,7 @@ import WindowContainer from "./WindowContainer"
|
||||
const name = getName(identifierName);
|
||||
const windowContainer = WindowContainer.fromProto(
|
||||
/* proto */ proto.windowContainer,
|
||||
/* protoChildren */ proto.windowContainer.children.reverse(),
|
||||
/* protoChildren */ proto.windowContainer?.children.reverse() ?? [],
|
||||
/* isActivityInTree */ isActivityInTree,
|
||||
/* nameOverride */ name,
|
||||
/* identifierOverride */ proto.identifier
|
||||
|
||||
@@ -25,7 +25,7 @@ WindowToken.fromProto = function (proto: any, isActivityInTree: Boolean): Window
|
||||
|
||||
const windowContainer = WindowContainer.fromProto(
|
||||
/* proto */ proto.windowContainer,
|
||||
/* protoChildren */ proto.windowContainer.children.reverse(),
|
||||
/* protoChildren */ proto.windowContainer?.children?.reverse() ?? [],
|
||||
/* isActivityInTree */ isActivityInTree,
|
||||
/* nameOverride */ null,
|
||||
/* identifierOverride */ null,
|
||||
|
||||
Reference in New Issue
Block a user