Backwards compat for TaskFragment + overlap fix
Add backwards compatibility for traces that didn't use the TaskFragment
on winscope. Moreover, fix the overlap calculation (using wrong object
type)
Bug: 185516271
Test: yarn run dev and open older SF and WM traces
Change-Id: I8d6c98a53cf4c5062dd7a366ef467755907dc0ed
(cherry picked from commit 752cec2b96)
This commit is contained in:
@@ -23,7 +23,7 @@ Task.fromProto = function (proto, isActivityInTree: Boolean): Task {
|
|||||||
if (proto == null) {
|
if (proto == null) {
|
||||||
return null
|
return null
|
||||||
} else {
|
} else {
|
||||||
const windowContainerProto = proto?.taskFragment.windowContainer ?? proto.windowContainer
|
const windowContainerProto = proto.taskFragment?.windowContainer ?? proto.windowContainer
|
||||||
const children = windowContainerProto.children.reverse()
|
const children = windowContainerProto.children.reverse()
|
||||||
.filter(it => it != null)
|
.filter(it => it != null)
|
||||||
.map(it => WindowContainer.childrenFromProto(it, isActivityInTree))
|
.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)
|
throw "Window container should not be null: " + JSON.stringify(proto)
|
||||||
}
|
}
|
||||||
const entry = new Task(
|
const entry = new Task(
|
||||||
proto?.taskFragment.activityType ?? proto.activityType,
|
proto.taskFragment?.activityType ?? proto.activityType,
|
||||||
proto.fillsParent,
|
proto.fillsParent,
|
||||||
toRect(proto.bounds),
|
toRect(proto.bounds),
|
||||||
proto.id,
|
proto.id,
|
||||||
proto.rootTaskId,
|
proto.rootTaskId,
|
||||||
proto.taskFragment.displayId,
|
proto.taskFragment?.displayId,
|
||||||
toRect(proto.lastNonFullscreenBounds),
|
toRect(proto.lastNonFullscreenBounds),
|
||||||
proto.realActivity,
|
proto.realActivity,
|
||||||
proto.origActivity,
|
proto.origActivity,
|
||||||
@@ -48,8 +48,8 @@ Task.fromProto = function (proto, isActivityInTree: Boolean): Task {
|
|||||||
proto.surfaceWidth,
|
proto.surfaceWidth,
|
||||||
proto.surfaceHeight,
|
proto.surfaceHeight,
|
||||||
proto.createdByOrganizer,
|
proto.createdByOrganizer,
|
||||||
proto?.taskFragment.minWidth ?? proto.minWidth,
|
proto.taskFragment?.minWidth ?? proto.minWidth,
|
||||||
proto?.taskFragment.minHeight ?? proto.minHeight,
|
proto.taskFragment?.minHeight ?? proto.minHeight,
|
||||||
windowContainer
|
windowContainer
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -242,8 +242,8 @@ function fill_occlusion_state(layerMap, rootLayers, includesCompositionState) {
|
|||||||
const visible = is_visible(layer, layer.hidden, includesCompositionState);
|
const visible = is_visible(layer, layer.hidden, includesCompositionState);
|
||||||
if (visible) {
|
if (visible) {
|
||||||
const fullyOccludes = (testLayer) => contains(testLayer, layer) && !layer.cornerRadius;
|
const fullyOccludes = (testLayer) => contains(testLayer, layer) && !layer.cornerRadius;
|
||||||
const partiallyOccludes = (testLayer) => overlaps(screen_bounds(testLayer), screen_bounds(layer));
|
const partiallyOccludes = (testLayer) => overlaps(testLayer, layer);
|
||||||
const covers = (testLayer) => overlaps(screen_bounds(testLayer), screen_bounds(layer));
|
const covers = (testLayer) => overlaps(testLayer, layer);
|
||||||
|
|
||||||
layer.occludedBy = globalState.opaqueRects.filter(fullyOccludes).map((layer) => layer.id);
|
layer.occludedBy = globalState.opaqueRects.filter(fullyOccludes).map((layer) => layer.id);
|
||||||
layer.partiallyOccludedBy = globalState.opaqueRects.filter(partiallyOccludes)
|
layer.partiallyOccludedBy = globalState.opaqueRects.filter(partiallyOccludes)
|
||||||
|
|||||||
Reference in New Issue
Block a user