Merge "Ignore window manager dumps with no timestamp in timeline" into udc-dev am: 1a4ebace28
Original change: https://googleplex-android-review.googlesource.com/c/platform/development/+/23660823 Change-Id: Iea8d12d2da04d8ca26492bc0169cb7296c0af64e Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -107,9 +107,11 @@ export class MiniTimelineComponent {
|
|||||||
|
|
||||||
private getTracesToShow(): Traces {
|
private getTracesToShow(): Traces {
|
||||||
const traces = new Traces();
|
const traces = new Traces();
|
||||||
this.selectedTraces.forEach((type) => {
|
this.selectedTraces
|
||||||
traces.setTrace(type, assertDefined(this.timelineData.getTraces().getTrace(type)));
|
.filter((type) => this.timelineData.getTraces().getTrace(type) !== undefined)
|
||||||
});
|
.forEach((type) => {
|
||||||
|
traces.setTrace(type, assertDefined(this.timelineData.getTraces().getTrace(type)));
|
||||||
|
});
|
||||||
return traces;
|
return traces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -476,6 +476,9 @@ export class TimelineComponent implements TracePositionUpdateListener {
|
|||||||
if (!this.internalActiveTrace) {
|
if (!this.internalActiveTrace) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (this.timelineData.getTraces().getTrace(this.internalActiveTrace) === undefined) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return this.timelineData.getPreviousEntryFor(this.internalActiveTrace) !== undefined;
|
return this.timelineData.getPreviousEntryFor(this.internalActiveTrace) !== undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -483,6 +486,9 @@ export class TimelineComponent implements TracePositionUpdateListener {
|
|||||||
if (!this.internalActiveTrace) {
|
if (!this.internalActiveTrace) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (this.timelineData.getTraces().getTrace(this.internalActiveTrace) === undefined) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return this.timelineData.getNextEntryFor(this.internalActiveTrace) !== undefined;
|
return this.timelineData.getNextEntryFor(this.internalActiveTrace) !== undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ export interface TimeRange {
|
|||||||
from: Timestamp;
|
from: Timestamp;
|
||||||
to: Timestamp;
|
to: Timestamp;
|
||||||
}
|
}
|
||||||
|
const INVALID_TIMESTAMP = 0n
|
||||||
|
|
||||||
export class TimelineData {
|
export class TimelineData {
|
||||||
private traces = new Traces();
|
private traces = new Traces();
|
||||||
@@ -45,7 +46,21 @@ export class TimelineData {
|
|||||||
initialize(traces: Traces, screenRecordingVideo: Blob | undefined) {
|
initialize(traces: Traces, screenRecordingVideo: Blob | undefined) {
|
||||||
this.clear();
|
this.clear();
|
||||||
|
|
||||||
this.traces = traces;
|
this.traces = new Traces();
|
||||||
|
traces.forEachTrace((trace, type) => {
|
||||||
|
if (type === TraceType.WINDOW_MANAGER) {
|
||||||
|
// Filter out WindowManager dumps with no timestamp from timeline
|
||||||
|
if (
|
||||||
|
trace.lengthEntries === 1 &&
|
||||||
|
trace.getEntry(0).getTimestamp().getValueNs() === INVALID_TIMESTAMP
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.traces.setTrace(type, trace);
|
||||||
|
});
|
||||||
|
|
||||||
this.screenRecordingVideo = screenRecordingVideo;
|
this.screenRecordingVideo = screenRecordingVideo;
|
||||||
this.firstEntry = this.findFirstEntry();
|
this.firstEntry = this.findFirstEntry();
|
||||||
this.lastEntry = this.findLastEntry();
|
this.lastEntry = this.findLastEntry();
|
||||||
@@ -265,6 +280,7 @@ export class TimelineData {
|
|||||||
|
|
||||||
private getFirstEntryOfActiveViewTraces(): TraceEntry<{}> | undefined {
|
private getFirstEntryOfActiveViewTraces(): TraceEntry<{}> | undefined {
|
||||||
const activeEntries = this.activeViewTraceTypes
|
const activeEntries = this.activeViewTraceTypes
|
||||||
|
.filter((it) => this.traces.getTrace(it) !== undefined)
|
||||||
.map((traceType) => assertDefined(this.traces.getTrace(traceType)))
|
.map((traceType) => assertDefined(this.traces.getTrace(traceType)))
|
||||||
.filter((trace) => trace.lengthEntries > 0)
|
.filter((trace) => trace.lengthEntries > 0)
|
||||||
.map((trace) => trace.getEntry(0))
|
.map((trace) => trace.getEntry(0))
|
||||||
|
|||||||
@@ -59,6 +59,20 @@ describe('TimelineData', () => {
|
|||||||
expect(timelineData.getCurrentPosition()).toBeDefined();
|
expect(timelineData.getCurrentPosition()).toBeDefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('ignores dumps with no timestamp', () => {
|
||||||
|
expect(timelineData.getCurrentPosition()).toBeUndefined();
|
||||||
|
|
||||||
|
const traces = new TracesBuilder()
|
||||||
|
.setTimestamps(TraceType.SURFACE_FLINGER, [timestamp10, timestamp11])
|
||||||
|
.setTimestamps(TraceType.WINDOW_MANAGER, [new Timestamp(TimestampType.REAL, 0n)])
|
||||||
|
.build();
|
||||||
|
|
||||||
|
timelineData.initialize(traces, undefined);
|
||||||
|
expect(timelineData.getTraces().getTrace(TraceType.WINDOW_MANAGER)).toBeUndefined();
|
||||||
|
expect(timelineData.getFullTimeRange().from).toBe(timestamp10);
|
||||||
|
expect(timelineData.getFullTimeRange().to).toBe(timestamp11);
|
||||||
|
});
|
||||||
|
|
||||||
it('uses first entry by default', () => {
|
it('uses first entry by default', () => {
|
||||||
timelineData.initialize(traces, undefined);
|
timelineData.initialize(traces, undefined);
|
||||||
expect(timelineData.getCurrentPosition()).toEqual(position10);
|
expect(timelineData.getCurrentPosition()).toEqual(position10);
|
||||||
|
|||||||
Reference in New Issue
Block a user