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) {
|
||||
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
|
||||
)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user