Pass through excludesCompositionState flag to layer creation

So that Flicker lib components can fallback on the bounds when the composition information for visible region is known to not be available

Test: collect a trace without composition enabled and make sure we still have visible layers
Bug: 250998831
Change-Id: I74b6796a508cd4aa72bf0042bf9825434689f6e5
This commit is contained in:
Pablo Gamito
2022-12-16 13:15:05 +00:00
parent 38dbb6c195
commit bee470988b
3 changed files with 16 additions and 13 deletions

View File

@@ -19,7 +19,7 @@ import { Layer, LayerProperties, Rect, toActiveBuffer, toColor, toRect, toRectF,
import { shortenName } from '../mixin'
import Transform from './Transform'
Layer.fromProto = function (proto: any): Layer {
Layer.fromProto = function (proto: any, excludesCompositionState = false): Layer {
const visibleRegion = toRegion(proto.visibleRegion)
const activeBuffer = toActiveBuffer(proto.activeBuffer)
const bounds = toRectF(proto.bounds)
@@ -45,11 +45,11 @@ Layer.fromProto = function (proto: any): Layer {
const properties = new LayerProperties(
visibleRegion,
activeBuffer,
activeBuffer,
/* flags */ proto.flags,
bounds,
color,
/* isOpaque */ proto.isOpaque,
bounds,
color,
/* isOpaque */ proto.isOpaque,
/* shadowRadius */ proto.shadowRadius,
/* cornerRadius */ proto.cornerRadius,
/* type */ proto.type ?? ``,
@@ -70,13 +70,14 @@ Layer.fromProto = function (proto: any): Layer {
requestedColor,
cornerRadiusCrop,
inputTransform,
inputRegion
inputRegion,
excludesCompositionState
);
const entry = new Layer(
/* name */ proto.name ?? ``,
/* name */ proto.name ?? ``,
/* id */ proto.id,
/*parentId */ proto.parent,
/*parentId */ proto.parent,
/* z */ proto.z,
/* currFrame */ proto.currFrame,
properties

View File

@@ -28,9 +28,10 @@ LayerTraceEntry.fromProto = function (
hwcBlob: string,
where = "",
realToElapsedTimeOffsetNs: bigint|undefined = undefined,
useElapsedTime = false
useElapsedTime = false,
excludesCompositionState = false
): LayerTraceEntry {
const layers = protos.map(it => Layer.fromProto(it));
const layers = protos.map(it => Layer.fromProto(it, excludesCompositionState));
const displays = (displayProtos || []).map(it => newDisplay(it));
const builder = new LayerTraceEntryBuilder(
`${elapsedTimestamp}`,

View File

@@ -37,8 +37,8 @@ class ParserSurfaceFlinger extends Parser {
const decoded = <any>LayersTraceFileProto.decode(buffer);
if (Object.prototype.hasOwnProperty.call(decoded, "realToElapsedTimeOffsetNanos")) {
this.realToElapsedTimeOffsetNs = BigInt(decoded.realToElapsedTimeOffsetNanos);
}
else {
} else {
console.warn("Missing realToElapsedTimeOffsetNanos property on SF trace proto");
this.realToElapsedTimeOffsetNs = undefined;
}
return decoded.entry;
@@ -68,7 +68,8 @@ class ParserSurfaceFlinger extends Parser {
entryProto.hwcBlob,
entryProto.where,
this.realToElapsedTimeOffsetNs,
timestampType === TimestampType.ELAPSED /*useElapsedTime*/
timestampType === TimestampType.ELAPSED /*useElapsedTime*/,
entryProto.excludesCompositionState ?? false
);
}