diff --git a/tools/winscope/src/flickerlib/windows/Task.ts b/tools/winscope/src/flickerlib/windows/Task.ts index 7159f313e..76f7c0037 100644 --- a/tools/winscope/src/flickerlib/windows/Task.ts +++ b/tools/winscope/src/flickerlib/windows/Task.ts @@ -23,7 +23,7 @@ Task.fromProto = function (proto, isActivityInTree: Boolean): Task { if (proto == null) { return null } else { - const windowContainerProto = proto?.taskFragment.windowContainer ?? proto.windowContainer + const windowContainerProto = proto.taskFragment?.windowContainer ?? proto.windowContainer const children = windowContainerProto.children.reverse() .filter(it => it != null) .map(it => WindowContainer.childrenFromProto(it, isActivityInTree)) @@ -33,12 +33,12 @@ Task.fromProto = function (proto, isActivityInTree: Boolean): Task { throw "Window container should not be null: " + JSON.stringify(proto) } const entry = new Task( - proto?.taskFragment.activityType ?? proto.activityType, + proto.taskFragment?.activityType ?? proto.activityType, proto.fillsParent, toRect(proto.bounds), proto.id, proto.rootTaskId, - proto.taskFragment.displayId, + proto.taskFragment?.displayId, toRect(proto.lastNonFullscreenBounds), proto.realActivity, proto.origActivity, @@ -48,8 +48,8 @@ Task.fromProto = function (proto, isActivityInTree: Boolean): Task { proto.surfaceWidth, proto.surfaceHeight, proto.createdByOrganizer, - proto?.taskFragment.minWidth ?? proto.minWidth, - proto?.taskFragment.minHeight ?? proto.minHeight, + proto.taskFragment?.minWidth ?? proto.minWidth, + proto.taskFragment?.minHeight ?? proto.minHeight, windowContainer ) diff --git a/tools/winscope/src/sf_visibility.js b/tools/winscope/src/sf_visibility.js index 7ef8837f9..cc29f4188 100644 --- a/tools/winscope/src/sf_visibility.js +++ b/tools/winscope/src/sf_visibility.js @@ -242,8 +242,8 @@ function fill_occlusion_state(layerMap, rootLayers, includesCompositionState) { const visible = is_visible(layer, layer.hidden, includesCompositionState); if (visible) { const fullyOccludes = (testLayer) => contains(testLayer, layer) && !layer.cornerRadius; - const partiallyOccludes = (testLayer) => overlaps(screen_bounds(testLayer), screen_bounds(layer)); - const covers = (testLayer) => overlaps(screen_bounds(testLayer), screen_bounds(layer)); + const partiallyOccludes = (testLayer) => overlaps(testLayer, layer); + const covers = (testLayer) => overlaps(testLayer, layer); layer.occludedBy = globalState.opaqueRects.filter(fullyOccludes).map((layer) => layer.id); layer.partiallyOccludedBy = globalState.opaqueRects.filter(partiallyOccludes)