Add layer filter to winscope

Uses the same semantics as property filter but is applied to the
hierarchy. If a filter is matches, the nodes children will be shown.

Example: filter by layer ids: 12,14,15
filter by layer name: Wallpaper

Test: open transaction trace and layer trace in winscope
Fixes: 152647597
Change-Id: I2bee5bbf5e4b14efb6aadee5775b46499e8f2ec9
This commit is contained in:
Vishnu Nair
2020-03-27 15:32:29 -07:00
parent 3219aad274
commit c778b9bdb7
2 changed files with 35 additions and 29 deletions

View File

@@ -30,10 +30,6 @@ import jsonProtoDefs from 'frameworks/base/core/proto/android/server/windowmanag
import protobuf from 'protobufjs'
var protoDefs = protobuf.Root.fromJSON(jsonProtoDefs);
var TraceMessage = protoDefs.lookupType(
"com.android.server.wm.WindowManagerTraceFileProto");
var ServiceMessage = protoDefs.lookupType(
"com.android.server.wm.WindowManagerServiceDumpProto");
export default {
name: 'tree-view',
@@ -84,14 +80,19 @@ export default {
];
},
filterMatches(c) {
// If a filter is set, consider the item matches if the current item or any of its
// children matches.
if (this.filter) {
return this.filter(c, this.applyingFlattened);
var thisMatches = this.filter(c);
const childMatches = (child) => this.filterMatches(child);
return thisMatches || (!this.applyingFlattened &&
c.children && c.children.some(childMatches));
}
return true;
},
childFilter(c) {
if (this.filter && this.filter.includeChildren) {
if (this.filterMatches(c)) {
if (this.filter) {
if (this.filter(c)) {
// Filter matched c, don't apply further filtering on c's children.
return undefined;
}