Fix some typescript incompatiblity with google3 Fix: - ban-const-enum - curly - no-inferrable-new-expression - semicolon - no-undefined-type-alias - no-unused-variable - array-type - angular-output-is-readonly - no-inferrable-primitive-types - ban-passing-async-function-to-describe KI: - enforce-comments-on-exported-symbols - no-any - class-as-namespace - angular-no-manual-lifecycle-hook-method-calls Bug: 311642700 Test: npm run test:unit:ci Change-Id: I6f799d3631e18e9e65ec66d40e456c0fece3c98a
diff --git a/tools/winscope/src/abt_chrome_extension/messages.ts b/tools/winscope/src/abt_chrome_extension/messages.ts index fec7e17..895f7b4 100644 --- a/tools/winscope/src/abt_chrome_extension/messages.ts +++ b/tools/winscope/src/abt_chrome_extension/messages.ts
@@ -95,7 +95,7 @@ * Defines of the issue access limit. See: * http://go/buganizer/concepts/access-control#accesslimit */ -export const enum IssueAccessLimit { +export enum IssueAccessLimit { INTERNAL = '', VISIBLE_TO_PARTNERS = 'Visible to Partners', VISIBLE_TO_PUBLIC = 'Visible to Public',
diff --git a/tools/winscope/src/app/components/adb_proxy_component.ts b/tools/winscope/src/app/components/adb_proxy_component.ts index 3aa68b8..18fe2b5 100644 --- a/tools/winscope/src/app/components/adb_proxy_component.ts +++ b/tools/winscope/src/app/components/adb_proxy_component.ts
@@ -156,10 +156,10 @@ proxy: ProxyClient = proxyClient; @Output() - proxyChange = new EventEmitter<ProxyClient>(); + readonly proxyChange = new EventEmitter<ProxyClient>(); @Output() - addKey = new EventEmitter<string>(); + readonly addKey = new EventEmitter<string>(); states = ProxyState; proxyKeyItem = '';
diff --git a/tools/winscope/src/app/components/app_component.ts b/tools/winscope/src/app/components/app_component.ts index 9e99f28..f424c77 100644 --- a/tools/winscope/src/app/components/app_component.ts +++ b/tools/winscope/src/app/components/app_component.ts
@@ -315,7 +315,7 @@ currentTimestamp?: Timestamp; activeView?: View; activeTrace?: Trace<object>; - filenameFormControl: FormControl = new FormControl( + filenameFormControl = new FormControl( 'winscope', Validators.compose([Validators.required, Validators.pattern(FileUtils.DOWNLOAD_FILENAME_REGEX)]) );
diff --git a/tools/winscope/src/app/components/bottomnav/bottom_drawer_component.ts b/tools/winscope/src/app/components/bottomnav/bottom_drawer_component.ts index de0bf06..b3fca41 100644 --- a/tools/winscope/src/app/components/bottomnav/bottom_drawer_component.ts +++ b/tools/winscope/src/app/components/bottomnav/bottom_drawer_component.ts
@@ -163,6 +163,10 @@ } } +/** + * Container for Material drawers + * @docs-private + */ @Component({ selector: 'mat-drawer-container', exportAs: 'matDrawerContainer',
diff --git a/tools/winscope/src/app/components/collect_traces_component.ts b/tools/winscope/src/app/components/collect_traces_component.ts index 9a8377c..bdcf14f 100644 --- a/tools/winscope/src/app/components/collect_traces_component.ts +++ b/tools/winscope/src/app/components/collect_traces_component.ts
@@ -360,7 +360,7 @@ @Input() dumpConfig: TraceConfigurationMap | undefined; @Input() storage: Storage | undefined; - @Output() filesCollected = new EventEmitter<File[]>(); + @Output() readonly filesCollected = new EventEmitter<File[]>(); constructor(@Inject(ChangeDetectorRef) private changeDetectorRef: ChangeDetectorRef) {}
diff --git a/tools/winscope/src/app/components/timeline/expanded-timeline/abstract_timeline_row_component.ts b/tools/winscope/src/app/components/timeline/expanded-timeline/abstract_timeline_row_component.ts index f41a9ec..c2f3bbc 100644 --- a/tools/winscope/src/app/components/timeline/expanded-timeline/abstract_timeline_row_component.ts +++ b/tools/winscope/src/app/components/timeline/expanded-timeline/abstract_timeline_row_component.ts
@@ -26,7 +26,7 @@ abstract wrapperRef: ElementRef; abstract canvasRef: ElementRef; - canvasDrawer: CanvasDrawer = new CanvasDrawer(); + canvasDrawer = new CanvasDrawer(); getCanvas(): HTMLCanvasElement { return this.canvasRef.nativeElement;
diff --git a/tools/winscope/src/app/components/timeline/expanded-timeline/default_timeline_row_component.ts b/tools/winscope/src/app/components/timeline/expanded-timeline/default_timeline_row_component.ts index 9b126bf..27bcfde 100644 --- a/tools/winscope/src/app/components/timeline/expanded-timeline/default_timeline_row_component.ts +++ b/tools/winscope/src/app/components/timeline/expanded-timeline/default_timeline_row_component.ts
@@ -44,7 +44,7 @@ @Input() selectedEntry: TraceEntry<{}> | undefined = undefined; @Input() selectionRange!: TimeRange; - @Output() onTracePositionUpdate = new EventEmitter<TracePosition>(); + @Output() readonly onTracePositionUpdate = new EventEmitter<TracePosition>(); @ViewChild('canvas', {static: false}) canvasRef!: ElementRef; @ViewChild('wrapper', {static: false}) wrapperRef!: ElementRef;
diff --git a/tools/winscope/src/app/components/timeline/expanded-timeline/expanded_timeline_component.ts b/tools/winscope/src/app/components/timeline/expanded-timeline/expanded_timeline_component.ts index 63827ec..57b5de6 100644 --- a/tools/winscope/src/app/components/timeline/expanded-timeline/expanded_timeline_component.ts +++ b/tools/winscope/src/app/components/timeline/expanded-timeline/expanded_timeline_component.ts
@@ -154,7 +154,7 @@ }) export class ExpandedTimelineComponent { @Input() timelineData!: TimelineData; - @Output() onTracePositionUpdate = new EventEmitter<TracePosition>(); + @Output() readonly onTracePositionUpdate = new EventEmitter<TracePosition>(); @ViewChild('canvas', {static: false}) canvasRef!: ElementRef<HTMLCanvasElement>; @ViewChild('expandedTimelineWrapper', {static: false}) warpperRef!: ElementRef;
diff --git a/tools/winscope/src/app/components/timeline/expanded-timeline/transition_timeline_component.ts b/tools/winscope/src/app/components/timeline/expanded-timeline/transition_timeline_component.ts index 4f7909c..0eb262b 100644 --- a/tools/winscope/src/app/components/timeline/expanded-timeline/transition_timeline_component.ts +++ b/tools/winscope/src/app/components/timeline/expanded-timeline/transition_timeline_component.ts
@@ -49,7 +49,7 @@ @Input() selectedEntry: TraceEntry<Transition> | undefined = undefined; @Input() selectionRange!: TimeRange; - @Output() onTracePositionUpdate = new EventEmitter<TracePosition>(); + @Output() readonly onTracePositionUpdate = new EventEmitter<TracePosition>(); @ViewChild('canvas', {static: false}) override canvasRef!: ElementRef; @ViewChild('wrapper', {static: false}) override wrapperRef!: ElementRef;
diff --git a/tools/winscope/src/app/components/timeline/expanded-timeline/transition_timeline_component_test.ts b/tools/winscope/src/app/components/timeline/expanded-timeline/transition_timeline_component_test.ts index 841d4c7..2c2b149 100644 --- a/tools/winscope/src/app/components/timeline/expanded-timeline/transition_timeline_component_test.ts +++ b/tools/winscope/src/app/components/timeline/expanded-timeline/transition_timeline_component_test.ts
@@ -36,7 +36,6 @@ describe('TransitionTimelineComponent', () => { let fixture: ComponentFixture<TransitionTimelineComponent>; let component: TransitionTimelineComponent; - let htmlElement: HTMLElement; beforeEach(async () => { await TestBed.configureTestingModule({ @@ -60,7 +59,6 @@ .compileComponents(); fixture = TestBed.createComponent(TransitionTimelineComponent); component = fixture.componentInstance; - htmlElement = fixture.nativeElement; }); it('can be created', () => { @@ -150,11 +148,11 @@ }); it('can draw selected entry', async () => { - const transition = { + const transition: Transition = { createTime: {unixNanos: 35n}, finishTime: {unixNanos: 85n}, aborted: true, - } as Transition; + }; component.trace = new TraceBuilder() .setType(TraceType.TRANSITION) .setEntries([transition]) @@ -192,11 +190,11 @@ }); it('can draw hovering entry', async () => { - const transition = { + const transition: Transition = { createTime: {unixNanos: 35n}, finishTime: {unixNanos: 85n}, aborted: true, - } as Transition; + }; component.trace = new TraceBuilder() .setType(TraceType.TRANSITION) .setEntries([transition])
diff --git a/tools/winscope/src/app/components/timeline/mini-timeline/drawer/canvas_mouse_handler_impl.ts b/tools/winscope/src/app/components/timeline/mini-timeline/drawer/canvas_mouse_handler_impl.ts index 28faa91..a0fc183 100644 --- a/tools/winscope/src/app/components/timeline/mini-timeline/drawer/canvas_mouse_handler_impl.ts +++ b/tools/winscope/src/app/components/timeline/mini-timeline/drawer/canvas_mouse_handler_impl.ts
@@ -20,6 +20,10 @@ import {DraggableCanvasObject} from './draggable_canvas_object'; import {MiniTimelineDrawer} from './mini_timeline_drawer'; +/** + * Canvas mouse handling implementation + * @docs-private + */ export class CanvasMouseHandlerImpl implements CanvasMouseHandler { // Ordered top most element to bottom most private draggableObjects: DraggableCanvasObject[] = []; @@ -30,7 +34,7 @@ constructor( private drawer: MiniTimelineDrawer, - private defaultCursor: string = 'auto', + private defaultCursor = 'auto', private onUnhandledMouseDown: (point: Point) => void = (point) => {} ) { this.drawer.canvas.addEventListener('mousemove', (event) => {
diff --git a/tools/winscope/src/app/components/timeline/mini-timeline/drawer/mini_timeline_drawer_impl.ts b/tools/winscope/src/app/components/timeline/mini-timeline/drawer/mini_timeline_drawer_impl.ts index b0d4995..1d373c6 100644 --- a/tools/winscope/src/app/components/timeline/mini-timeline/drawer/mini_timeline_drawer_impl.ts +++ b/tools/winscope/src/app/components/timeline/mini-timeline/drawer/mini_timeline_drawer_impl.ts
@@ -27,6 +27,10 @@ import {MiniTimelineDrawer} from './mini_timeline_drawer'; import {MiniTimelineDrawerInput} from './mini_timeline_drawer_input'; +/** + * Mini timeline drawer implementation + * @docs-private + */ export class MiniTimelineDrawerImpl implements MiniTimelineDrawer { ctx: CanvasRenderingContext2D; handler: CanvasMouseHandler; @@ -191,7 +195,6 @@ } private drawTimelineGuides() { - const edgeBarHeight = (this.innerHeight * 1) / 2; const edgeBarWidth = 4; const boldBarHeight = (this.innerHeight * 1) / 5;
diff --git a/tools/winscope/src/app/components/timeline/mini-timeline/mini_timeline_component.ts b/tools/winscope/src/app/components/timeline/mini-timeline/mini_timeline_component.ts index 3804747..67a9a8f 100644 --- a/tools/winscope/src/app/components/timeline/mini-timeline/mini_timeline_component.ts +++ b/tools/winscope/src/app/components/timeline/mini-timeline/mini_timeline_component.ts
@@ -93,8 +93,8 @@ @Input() currentTracePosition!: TracePosition; @Input() selectedTraces!: TraceType[]; - @Output() onTracePositionUpdate = new EventEmitter<TracePosition>(); - @Output() onSeekTimestampUpdate = new EventEmitter<Timestamp | undefined>(); + @Output() readonly onTracePositionUpdate = new EventEmitter<TracePosition>(); + @Output() readonly onSeekTimestampUpdate = new EventEmitter<Timestamp | undefined>(); @ViewChild('miniTimelineWrapper', {static: false}) miniTimelineWrapper!: ElementRef; @ViewChild('canvas', {static: false}) canvasRef!: ElementRef; @@ -197,18 +197,15 @@ this.onZoomChanged(this.timelineData.getFullTimeRange()); } - zoomIn(zoomOn: Timestamp | undefined = undefined) { + zoomIn(zoomOn?: Timestamp) { this.zoom({nominator: 3n, denominator: 4n}, zoomOn); } - zoomOut(zoomOn: Timestamp | undefined = undefined) { + zoomOut(zoomOn?: Timestamp) { this.zoom({nominator: 5n, denominator: 4n}, zoomOn); } - zoom( - zoomRatio: {nominator: bigint; denominator: bigint}, - zoomOn: Timestamp | undefined = undefined - ) { + zoom(zoomRatio: {nominator: bigint; denominator: bigint}, zoomOn?: Timestamp) { const fullRange = this.timelineData.getFullTimeRange(); const currentZoomRange = this.timelineData.getZoomRange(); const currentZoomWidth = currentZoomRange.to.minus(currentZoomRange.from);
diff --git a/tools/winscope/src/app/components/timeline/mini-timeline/slider_component.ts b/tools/winscope/src/app/components/timeline/mini-timeline/slider_component.ts index 1c46105..602b5db 100644 --- a/tools/winscope/src/app/components/timeline/mini-timeline/slider_component.ts +++ b/tools/winscope/src/app/components/timeline/mini-timeline/slider_component.ts
@@ -123,7 +123,7 @@ @Input() zoomRange: TimeRange | undefined; @Input() currentPosition: TracePosition | undefined; - @Output() onZoomChanged = new EventEmitter<TimeRange>(); + @Output() readonly onZoomChanged = new EventEmitter<TimeRange>(); dragging = false; sliderWidth = 0;
diff --git a/tools/winscope/src/app/components/timeline/mini-timeline/transformer_test.ts b/tools/winscope/src/app/components/timeline/mini-timeline/transformer_test.ts index 604560f..c33566a 100644 --- a/tools/winscope/src/app/components/timeline/mini-timeline/transformer_test.ts +++ b/tools/winscope/src/app/components/timeline/mini-timeline/transformer_test.ts
@@ -66,7 +66,6 @@ const transformer = new Transformer(fromRange, toRange); const rangeStart = fromRange.from.getValueNs(); - const rangeEnd = fromRange.to.getValueNs(); const range = fromRange.to.getValueNs() - fromRange.from.getValueNs(); expect(transformer.untransform(toRange.from).getValueNs()).toBe(fromRange.from.getValueNs());
diff --git a/tools/winscope/src/app/components/timeline/timeline_component.ts b/tools/winscope/src/app/components/timeline/timeline_component.ts index baa3b26..466faa3 100644 --- a/tools/winscope/src/app/components/timeline/timeline_component.ts +++ b/tools/winscope/src/app/components/timeline/timeline_component.ts
@@ -321,7 +321,7 @@ @Input() timelineData!: TimelineData; @Input() availableTraces: TraceType[] = []; - @Output() collapsedTimelineSizeChanged = new EventEmitter<number>(); + @Output() readonly collapsedTimelineSizeChanged = new EventEmitter<number>(); @ViewChild('collapsedTimeline') private collapsedTimelineRef!: ElementRef;
diff --git a/tools/winscope/src/app/components/trace_config_component.ts b/tools/winscope/src/app/components/trace_config_component.ts index 30d8a23..43d0726 100644 --- a/tools/winscope/src/app/components/trace_config_component.ts +++ b/tools/winscope/src/app/components/trace_config_component.ts
@@ -106,7 +106,7 @@ objectKeys = Object.keys; @Input() traceConfig: TraceConfigurationMap | undefined; - @Output() traceConfigChange = new EventEmitter<TraceConfigurationMap>(); + @Output() readonly traceConfigChange = new EventEmitter<TraceConfigurationMap>(); advancedConfigTraces() { const advancedConfigs: string[] = [];
diff --git a/tools/winscope/src/app/components/upload_traces_component.ts b/tools/winscope/src/app/components/upload_traces_component.ts index cb70c6f..d317027 100644 --- a/tools/winscope/src/app/components/upload_traces_component.ts +++ b/tools/winscope/src/app/components/upload_traces_component.ts
@@ -257,7 +257,9 @@ return this.ngZone.run(() => { let hasFilesWithViewers = false; this.tracePipeline.getTraces().forEachTrace((trace) => { - if (TraceTypeUtils.isTraceTypeWithViewer(trace.type)) hasFilesWithViewers = true; + if (TraceTypeUtils.isTraceTypeWithViewer(trace.type)) { + hasFilesWithViewers = true; + } }); return hasFilesWithViewers;
diff --git a/tools/winscope/src/app/timeline_data.ts b/tools/winscope/src/app/timeline_data.ts index 13e6e2e..8ad881f 100644 --- a/tools/winscope/src/app/timeline_data.ts +++ b/tools/winscope/src/app/timeline_data.ts
@@ -248,7 +248,7 @@ return trace.getEntry(currentIndex + 1); } - private lastReturnedCurrentEntries: Map<TraceType, TraceEntry<any> | undefined> = new Map(); + private lastReturnedCurrentEntries = new Map<TraceType, TraceEntry<any> | undefined>(); findCurrentEntryFor(type: TraceType): TraceEntry<{}> | undefined { const position = this.getCurrentPosition(); if (!position) {
diff --git a/tools/winscope/src/parsers/abstract_parser.ts b/tools/winscope/src/parsers/abstract_parser.ts index 54e0c77..8837799 100644 --- a/tools/winscope/src/parsers/abstract_parser.ts +++ b/tools/winscope/src/parsers/abstract_parser.ts
@@ -27,7 +27,7 @@ import {ParsingUtils} from './parsing_utils'; abstract class AbstractParser<T extends object = object> implements Parser<T> { - private timestamps: Map<TimestampType, Timestamp[]> = new Map<TimestampType, Timestamp[]>(); + private timestamps = new Map<TimestampType, Timestamp[]>(); protected traceFile: TraceFile; protected decodedEntries: any[] = []; protected shouldAddDefaultsToProto = true; // TODO(b/311643292): remove when refactoring complete
diff --git a/tools/winscope/src/parsers/abstract_traces_parser.ts b/tools/winscope/src/parsers/abstract_traces_parser.ts index e8531ba..fda5669 100644 --- a/tools/winscope/src/parsers/abstract_traces_parser.ts +++ b/tools/winscope/src/parsers/abstract_traces_parser.ts
@@ -21,8 +21,7 @@ import {TraceType} from 'trace/trace_type'; export abstract class AbstractTracesParser<T> implements Parser<T> { - private timestampsSet: boolean = false; - private timestamps: Map<TimestampType, Timestamp[]> = new Map<TimestampType, Timestamp[]>(); + private timestamps = new Map<TimestampType, Timestamp[]>(); abstract parse(): Promise<void>; @@ -64,8 +63,6 @@ this.timestamps.set(type, timestamps); } } - - this.timestampsSet = true; } protected abstract getTimestamp(type: TimestampType, decodedEntry: any): undefined | Timestamp;
diff --git a/tools/winscope/src/parsers/hierarchy_tree_builder.ts b/tools/winscope/src/parsers/hierarchy_tree_builder.ts index ac24320..281e40e 100644 --- a/tools/winscope/src/parsers/hierarchy_tree_builder.ts +++ b/tools/winscope/src/parsers/hierarchy_tree_builder.ts
@@ -93,7 +93,7 @@ private buildHierarchyTreeNode( id: string, name: string, - children: ReadonlyArray<HierarchyTreeNode>, + children: readonly HierarchyTreeNode[], propertiesProvider: PropertiesProvider ): HierarchyTreeNode { const node = new HierarchyTreeNode(id, name, propertiesProvider); @@ -111,7 +111,7 @@ protected abstract makeRootChildren( children: PropertiesProvider[], identifierToChild: Map<string | number, PropertiesProvider[]> - ): ReadonlyArray<HierarchyTreeNode>; + ): readonly HierarchyTreeNode[]; protected abstract getIdentifierValue(identifier: PropertyTreeNode): string | number; protected abstract getSubtreeName(propertyTreeName: string): string;
diff --git a/tools/winscope/src/parsers/input_method/hierarchy_tree_builder_input_method.ts b/tools/winscope/src/parsers/input_method/hierarchy_tree_builder_input_method.ts index a4a0c03..8c30924 100644 --- a/tools/winscope/src/parsers/input_method/hierarchy_tree_builder_input_method.ts +++ b/tools/winscope/src/parsers/input_method/hierarchy_tree_builder_input_method.ts
@@ -30,7 +30,7 @@ protected override makeRootChildren( children: PropertiesProvider[], identifierToChild: Map<string | number, PropertiesProvider[]> - ): ReadonlyArray<HierarchyTreeNode> { + ): readonly HierarchyTreeNode[] { if (children.length === 0) return []; return [this.buildSubtree(children[0], identifierToChild)]; }
diff --git a/tools/winscope/src/parsers/parser_protolog.ts b/tools/winscope/src/parsers/parser_protolog.ts index 83a044f..7c55ec0 100644 --- a/tools/winscope/src/parsers/parser_protolog.ts +++ b/tools/winscope/src/parsers/parser_protolog.ts
@@ -65,9 +65,14 @@ return []; } - fileProto.log.sort((a: any, b: any) => { - return Number(a.elapsedRealtimeNanos) - Number(b.elapsedRealtimeNanos); - }); + fileProto.log.sort( + ( + a: com.android.internal.protolog.IProtoLogMessage, + b: com.android.internal.protolog.IProtoLogMessage + ) => { + return Number(a.elapsedRealtimeNanos) - Number(b.elapsedRealtimeNanos); + } + ); return fileProto.log; }
diff --git a/tools/winscope/src/parsers/perfetto/fake_proto_builder.ts b/tools/winscope/src/parsers/perfetto/fake_proto_builder.ts index a8e43ef..a37222d 100644 --- a/tools/winscope/src/parsers/perfetto/fake_proto_builder.ts +++ b/tools/winscope/src/parsers/perfetto/fake_proto_builder.ts
@@ -49,7 +49,7 @@ intValue: bigint | undefined, realValue: number | undefined, stringValue: string | undefined - ): any { + ): string | bigint | number | boolean | null | undefined { switch (valueType) { case 'bool': return Boolean(intValue); @@ -64,7 +64,7 @@ case 'uint': return intValue; default: - // do nothing + throw new Error(`Unsupported type ${valueType}`); } } }
diff --git a/tools/winscope/src/parsers/perfetto/parser_protolog.ts b/tools/winscope/src/parsers/perfetto/parser_protolog.ts index 6362166..adcd0ab 100644 --- a/tools/winscope/src/parsers/perfetto/parser_protolog.ts +++ b/tools/winscope/src/parsers/perfetto/parser_protolog.ts
@@ -24,10 +24,10 @@ import {AbstractParser} from './abstract_parser'; class PerfettoLogMessageTableRow { - message: string = '<NO_MESSAGE>'; - tag: string = '<NO_TAG>'; - level: string = '<NO_LEVEL>'; - location: string = '<NO_LOC>'; + message = '<NO_MESSAGE>'; + tag = '<NO_TAG>'; + level = '<NO_LEVEL>'; + location = '<NO_LOC>'; timestamp: bigint = 0n; constructor(timestamp: bigint, tag: string, level: string, message: string) {
diff --git a/tools/winscope/src/parsers/perfetto/parser_transitions.ts b/tools/winscope/src/parsers/perfetto/parser_transitions.ts index e8f4ff8..51d097f 100644 --- a/tools/winscope/src/parsers/perfetto/parser_transitions.ts +++ b/tools/winscope/src/parsers/perfetto/parser_transitions.ts
@@ -61,7 +61,7 @@ transitionProto.finishTransactionId.toString(), TransitionType.Companion.fromInt(Number(transitionProto.type)), transitionProto.targets.map( - (it: any) => + (it: perfetto.protos.ShellTransition.ITarget) => new TransitionChange( TransitionType.Companion.fromInt(Number(it.mode)), Number(it.layerId),
diff --git a/tools/winscope/src/parsers/perfetto/parser_transitions_test.ts b/tools/winscope/src/parsers/perfetto/parser_transitions_test.ts index 02113d5..84b4324 100644 --- a/tools/winscope/src/parsers/perfetto/parser_transitions_test.ts +++ b/tools/winscope/src/parsers/perfetto/parser_transitions_test.ts
@@ -16,23 +16,19 @@ import {assertDefined} from 'common/assert_utils'; import {ElapsedTimestamp, RealTimestamp, TimestampType} from 'common/time'; import {Transition, TransitionType} from 'flickerlib/common'; -import {TraceBuilder} from 'test/unit/trace_builder'; import {UnitTestUtils} from 'test/unit/utils'; import {Parser} from 'trace/parser'; -import {Trace} from 'trace/trace'; import {TraceType} from 'trace/trace_type'; describe('Perfetto ParserTransitions', () => { describe('valid trace', () => { let parser: Parser<Transition>; - let trace: Trace<Transition>; beforeAll(async () => { parser = await UnitTestUtils.getPerfettoParser( TraceType.TRANSITION, 'traces/perfetto/shell_transitions_trace.perfetto-trace' ); - trace = new TraceBuilder().setType(TraceType.TRANSITION).setParser(parser).build(); }); it('has expected trace type', () => {
diff --git a/tools/winscope/src/parsers/surface_flinger/computations/rects_computation.ts b/tools/winscope/src/parsers/surface_flinger/computations/rects_computation.ts index 60ae840..e956622 100644 --- a/tools/winscope/src/parsers/surface_flinger/computations/rects_computation.ts +++ b/tools/winscope/src/parsers/surface_flinger/computations/rects_computation.ts
@@ -23,7 +23,7 @@ import {PropertyTreeNode} from 'trace/tree_node/property_tree_node'; class RectSfFactory { - makeDisplayRects(displays: ReadonlyArray<PropertyTreeNode>): TraceRect[] { + makeDisplayRects(displays: readonly PropertyTreeNode[]): TraceRect[] { const nameCounts = new Map<string, number>(); return displays.map((display, index) => { const size = display.getChildByName('size');
diff --git a/tools/winscope/src/parsers/surface_flinger/computations/visibility_properties_computation.ts b/tools/winscope/src/parsers/surface_flinger/computations/visibility_properties_computation.ts index e947f8b..0b19985 100644 --- a/tools/winscope/src/parsers/surface_flinger/computations/visibility_properties_computation.ts +++ b/tools/winscope/src/parsers/surface_flinger/computations/visibility_properties_computation.ts
@@ -277,12 +277,6 @@ return colorNode; } - private getBounds(layer: HierarchyTreeNode): Rect | undefined { - const boundsNode = layer.getEagerPropertyByName('bounds'); - if (boundsNode) this.getRect(boundsNode); - return undefined; - } - private getDisplaySize(layer: HierarchyTreeNode): Rect { const displaySize = new Rect(0, 0, 0, 0); const matchingDisplay = this.displays.find(
diff --git a/tools/winscope/src/parsers/surface_flinger/hierarchy_tree_builder_sf.ts b/tools/winscope/src/parsers/surface_flinger/hierarchy_tree_builder_sf.ts index 94cb1f2..df7a690 100644 --- a/tools/winscope/src/parsers/surface_flinger/hierarchy_tree_builder_sf.ts +++ b/tools/winscope/src/parsers/surface_flinger/hierarchy_tree_builder_sf.ts
@@ -50,7 +50,7 @@ protected override makeRootChildren( children: PropertiesProvider[], identifierToChild: Map<string | number, PropertiesProvider[]> - ): ReadonlyArray<HierarchyTreeNode> { + ): readonly HierarchyTreeNode[] { const rootLayers = children.filter((layer) => { const hasParent = assertDefined(layer.getEagerProperties().getChildByName('parent')).getValue() !== -1;
diff --git a/tools/winscope/src/parsers/surface_flinger/parser_surface_flinger_dump_test.ts b/tools/winscope/src/parsers/surface_flinger/parser_surface_flinger_dump_test.ts index ad03f78..f3db235 100644 --- a/tools/winscope/src/parsers/surface_flinger/parser_surface_flinger_dump_test.ts +++ b/tools/winscope/src/parsers/surface_flinger/parser_surface_flinger_dump_test.ts
@@ -22,7 +22,6 @@ describe('ParserSurfaceFlingerDump', () => { describe('trace with elapsed + real timestamp', () => { let parser: Parser<HierarchyTreeNode>; - const DUMP_REAL_TIME = 1659176624505188647n; beforeAll(async () => { parser = (await UnitTestUtils.getParser(
diff --git a/tools/winscope/src/parsers/view_capture/hierarchy_tree_builder_vc.ts b/tools/winscope/src/parsers/view_capture/hierarchy_tree_builder_vc.ts index cac8bf4..e056e19 100644 --- a/tools/winscope/src/parsers/view_capture/hierarchy_tree_builder_vc.ts +++ b/tools/winscope/src/parsers/view_capture/hierarchy_tree_builder_vc.ts
@@ -36,7 +36,7 @@ protected override makeRootChildren( children: PropertiesProvider[], identifierToChild: Map<string | number, PropertiesProvider[]> - ): ReadonlyArray<HierarchyTreeNode> { + ): readonly HierarchyTreeNode[] { const rootChildrenHashcodes = assertDefined( assertDefined(this.root).getEagerProperties().getChildByName('children') )
diff --git a/tools/winscope/src/parsers/view_capture/parser_view_capture_window.ts b/tools/winscope/src/parsers/view_capture/parser_view_capture_window.ts index a114bd7..27e5439 100644 --- a/tools/winscope/src/parsers/view_capture/parser_view_capture_window.ts +++ b/tools/winscope/src/parsers/view_capture/parser_view_capture_window.ts
@@ -72,7 +72,7 @@ SetRootTransformProperties: new SetRootTransformProperties(), }; - private timestamps: Map<TimestampType, Timestamp[]> = new Map<TimestampType, Timestamp[]>(); + private timestamps = new Map<TimestampType, Timestamp[]>(); constructor( private readonly descriptors: string[], @@ -173,7 +173,9 @@ const eagerOperations: Array<Operation<PropertyTreeNode>> = [ ParserViewCaptureWindow.Operations.AddDefaultsNodeEager, ]; - if (isRoot) eagerOperations.push(ParserViewCaptureWindow.Operations.SetRootTransformProperties); + if (isRoot) { + eagerOperations.push(ParserViewCaptureWindow.Operations.SetRootTransformProperties); + } const eagerProperties = this.makeEagerPropertiesTree(node); const lazyPropertiesStrategy = this.makeLazyPropertiesStrategy(node); @@ -206,7 +208,9 @@ let obj = node; do { Object.getOwnPropertyNames(obj).forEach((it) => { - if (!ParserViewCaptureWindow.EAGER_PROPERTIES.includes(it)) denyList.push(it); + if (!ParserViewCaptureWindow.EAGER_PROPERTIES.includes(it)) { + denyList.push(it); + } }); obj = Object.getPrototypeOf(obj); } while (obj);
diff --git a/tools/winscope/src/parsers/window_manager/custom_query_utils_test.ts b/tools/winscope/src/parsers/window_manager/custom_query_utils_test.ts index d677e9c..08e5004 100644 --- a/tools/winscope/src/parsers/window_manager/custom_query_utils_test.ts +++ b/tools/winscope/src/parsers/window_manager/custom_query_utils_test.ts
@@ -17,34 +17,35 @@ import {CustomQueryType} from 'trace/custom_query'; import {TraceType} from 'trace/trace_type'; -describe('WmCustomQueryUtils', async () => { - it('parseWindowsTokenAndTitle()', async () => { - const trace = await UnitTestUtils.getTrace( - TraceType.WINDOW_MANAGER, - 'traces/elapsed_and_real_timestamp/WindowManager.pb' - ); - const tokenAndTitles = await trace - .sliceEntries(0, 1) - .customQuery(CustomQueryType.WM_WINDOWS_TOKEN_AND_TITLE); +describe('WmCustomQueryUtils', () => + (async () => { + it('parseWindowsTokenAndTitle()', async () => { + const trace = await UnitTestUtils.getTrace( + TraceType.WINDOW_MANAGER, + 'traces/elapsed_and_real_timestamp/WindowManager.pb' + ); + const tokenAndTitles = await trace + .sliceEntries(0, 1) + .customQuery(CustomQueryType.WM_WINDOWS_TOKEN_AND_TITLE); - expect(tokenAndTitles.length).toEqual(69); + expect(tokenAndTitles.length).toEqual(69); - // RootWindowContainerProto - expect(tokenAndTitles).toContain({token: '478edff', title: 'WindowContainer'}); - // DisplayContentProto - expect(tokenAndTitles).toContain({token: '1f3454e', title: 'Built-in Screen'}); - // DisplayAreaProto - expect(tokenAndTitles).toContain({token: 'c06766f', title: 'Leaf:36:36'}); - // WindowTokenProto - expect(tokenAndTitles).toContain({token: '509ad2f', title: '509ad2f'}); - // WindowStateProto - expect(tokenAndTitles).toContain({token: 'b3b210d', title: 'ScreenDecorOverlay'}); - // TaskProto - expect(tokenAndTitles).toContain({token: '7493986', title: 'Task'}); - // ActivityRecordProto - expect(tokenAndTitles).toContain({ - token: 'f7092ed', - title: 'com.google.android.apps.nexuslauncher/.NexusLauncherActivity', + // RootWindowContainerProto + expect(tokenAndTitles).toContain({token: '478edff', title: 'WindowContainer'}); + // DisplayContentProto + expect(tokenAndTitles).toContain({token: '1f3454e', title: 'Built-in Screen'}); + // DisplayAreaProto + expect(tokenAndTitles).toContain({token: 'c06766f', title: 'Leaf:36:36'}); + // WindowTokenProto + expect(tokenAndTitles).toContain({token: '509ad2f', title: '509ad2f'}); + // WindowStateProto + expect(tokenAndTitles).toContain({token: 'b3b210d', title: 'ScreenDecorOverlay'}); + // TaskProto + expect(tokenAndTitles).toContain({token: '7493986', title: 'Task'}); + // ActivityRecordProto + expect(tokenAndTitles).toContain({ + token: 'f7092ed', + title: 'com.google.android.apps.nexuslauncher/.NexusLauncherActivity', + }); }); - }); -}); + })());
diff --git a/tools/winscope/src/parsers/window_manager/hierarchy_tree_builder_wm.ts b/tools/winscope/src/parsers/window_manager/hierarchy_tree_builder_wm.ts index 2fc7334..20a52a2 100644 --- a/tools/winscope/src/parsers/window_manager/hierarchy_tree_builder_wm.ts +++ b/tools/winscope/src/parsers/window_manager/hierarchy_tree_builder_wm.ts
@@ -35,8 +35,8 @@ protected override makeRootChildren( children: PropertiesProvider[], - identifierToChild: Map<any, PropertiesProvider[]> - ): ReadonlyArray<HierarchyTreeNode> { + identifierToChild: Map<string | number, PropertiesProvider[]> + ): readonly HierarchyTreeNode[] { if (children.length === 0) return []; return this.buildSubtree(children[0], identifierToChild).getAllChildren(); }
diff --git a/tools/winscope/src/trace/tree_node/property_tree_builder_from_proto.ts b/tools/winscope/src/trace/tree_node/property_tree_builder_from_proto.ts index eafd031..4fe2fba 100644 --- a/tools/winscope/src/trace/tree_node/property_tree_builder_from_proto.ts +++ b/tools/winscope/src/trace/tree_node/property_tree_builder_from_proto.ts
@@ -19,7 +19,7 @@ export class PropertyTreeBuilderFromProto { private denylistProperties: string[] = []; - private duplicateCount: number = 0; + private duplicateCount = 0; private proto: any | undefined; private rootId: string | number = 'UnknownRootId'; private rootName: string | undefined = 'UnknownRootName';
diff --git a/tools/winscope/src/trace/tree_node/tree_node.ts b/tools/winscope/src/trace/tree_node/tree_node.ts index ffd8718..5dd067f 100644 --- a/tools/winscope/src/trace/tree_node/tree_node.ts +++ b/tools/winscope/src/trace/tree_node/tree_node.ts
@@ -42,7 +42,7 @@ return this.children.find((child) => child.name === name); } - getAllChildren(): ReadonlyArray<this> { + getAllChildren(): readonly this[] { return this.children; }
diff --git a/tools/winscope/src/trace_processor/bigint_math.ts b/tools/winscope/src/trace_processor/bigint_math.ts index dd1e550..0039a43 100644 --- a/tools/winscope/src/trace_processor/bigint_math.ts +++ b/tools/winscope/src/trace_processor/bigint_math.ts
@@ -24,7 +24,7 @@ result <<= 1n; } return result; - }; + } // Returns the largest integral power of 2 which is not greater than n. // If n is less than or equal to 0, returns 1. @@ -34,7 +34,7 @@ result <<= 1n; } return result; - }; + } // Returns the largest integral value x where 2^x is not greater than n. static log2(n: bigint): number {
diff --git a/tools/winscope/src/trace_processor/engine.ts b/tools/winscope/src/trace_processor/engine.ts index 865f37a..c6454a2 100644 --- a/tools/winscope/src/trace_processor/engine.ts +++ b/tools/winscope/src/trace_processor/engine.ts
@@ -26,12 +26,9 @@ } from './protos'; import { createQueryResult, - LONG, - LONG_NULL, NUM, QueryError, QueryResult, - STR, WritableQueryResult, } from './query_result';
diff --git a/tools/winscope/src/trace_processor/query_result.ts b/tools/winscope/src/trace_processor/query_result.ts index 0185cf1..4daa72c 100644 --- a/tools/winscope/src/trace_processor/query_result.ts +++ b/tools/winscope/src/trace_processor/query_result.ts
@@ -63,13 +63,13 @@ export const STR = 'str'; export const NUM_NULL: number|null = 1; export const STR_NULL: string|null = 'str_null'; -export const BLOB: Uint8Array = new Uint8Array(); +export const BLOB = new Uint8Array(); export const BLOB_NULL: Uint8Array|null = new Uint8Array(); export const LONG: bigint = 0n; export const LONG_NULL: bigint|null = 1n; -export type ColumnType = string|number|bigint|null|Uint8Array; -export type SqlValue = ColumnType; +export type ColumnType = string|number|bigint|Uint8Array; +export type SqlValue = ColumnType|null; const SHIFT_32BITS = 32n; @@ -158,7 +158,7 @@ // One row extracted from an SQL result: export interface Row { - [key: string]: ColumnType; + [key: string]: ColumnType|null; } // The methods that any iterator has to implement. @@ -173,7 +173,7 @@ // for (const it = queryResult.iter({}); it.valid(); it.next()) { // for (const columnName : queryResult.columns()) { // console.log(it.get(columnName)); - get(columnName: string): ColumnType; + get(columnName: string): ColumnType|null; } // A RowIterator is a type that has all the fields defined in the query spec @@ -185,7 +185,7 @@ // console.log(iter.name, iter.surname); export type RowIterator<T extends Row> = RowIteratorBase&T; -function columnTypeToString(t: ColumnType): string { +function columnTypeToString(t: ColumnType|null): string { switch (t) { case NUM: return 'NUM'; @@ -208,7 +208,7 @@ } } -function isCompatible(actual: CellType, expected: ColumnType): boolean { +function isCompatible(actual: CellType, expected: ColumnType|null): boolean { switch (actual) { case CellType.CELL_NULL: return expected === NUM_NULL || expected === STR_NULL || @@ -692,7 +692,7 @@ } - get(columnName: string): ColumnType { + get(columnName: string): ColumnType|null { const res = this.rowData[columnName]; if (res === undefined) { throw new Error( @@ -866,7 +866,7 @@ next: () => void; valid: () => boolean; - get: (columnName: string) => ColumnType; + get: (columnName: string) => ColumnType|null; constructor(querySpec: Row, res: QueryResultImpl) { const thisAsRow = this as {} as Row;
diff --git a/tools/winscope/src/trace_processor/wasm_engine_proxy.ts b/tools/winscope/src/trace_processor/wasm_engine_proxy.ts index 90add37..2cf01f6 100644 --- a/tools/winscope/src/trace_processor/wasm_engine_proxy.ts +++ b/tools/winscope/src/trace_processor/wasm_engine_proxy.ts
@@ -15,7 +15,6 @@ import {assertExists, assertTrue} from './logging'; import {Engine, LoadingTracker} from './engine'; -import {EngineWorkerInitMessage} from './worker_messages'; let bundlePath: string; let idleWasmWorker: Worker;
diff --git a/tools/winscope/src/viewers/common/ime_ui_data.ts b/tools/winscope/src/viewers/common/ime_ui_data.ts index c4c2b9a..b378b12 100644 --- a/tools/winscope/src/viewers/common/ime_ui_data.ts +++ b/tools/winscope/src/viewers/common/ime_ui_data.ts
@@ -23,7 +23,7 @@ export class ImeUiData { dependencies: TraceType[]; - highlightedItem: string = ''; + highlightedItem = ''; pinnedItems: UiHierarchyTreeNode[] = []; hierarchyUserOptions: UserOptions = {}; propertiesUserOptions: UserOptions = {};
diff --git a/tools/winscope/src/viewers/common/presenter_input_method.ts b/tools/winscope/src/viewers/common/presenter_input_method.ts index 5194751..b73b0b7 100644 --- a/tools/winscope/src/viewers/common/presenter_input_method.ts +++ b/tools/winscope/src/viewers/common/presenter_input_method.ts
@@ -58,7 +58,7 @@ readonly notifyViewCallback: NotifyImeViewCallbackType; protected readonly dependencies: TraceType[]; protected uiData: ImeUiData; - protected highlightedItem: string = ''; + protected highlightedItem = ''; protected entry: HierarchyTreeNode | undefined; protected hierarchyUserOptions: UserOptions = PersistentStoreProxy.new<UserOptions>( 'ImeHierarchyOptions',
diff --git a/tools/winscope/src/viewers/common/ui_property_tree_node.ts b/tools/winscope/src/viewers/common/ui_property_tree_node.ts index deb37a9..3082141 100644 --- a/tools/winscope/src/viewers/common/ui_property_tree_node.ts +++ b/tools/winscope/src/viewers/common/ui_property_tree_node.ts
@@ -22,7 +22,7 @@ export class UiPropertyTreeNode extends PropertyTreeNode implements DiffNode { private diff: DiffType = DiffType.NONE; private displayName: string = this.name; - private oldValue: string = 'null'; + private oldValue = 'null'; static from(node: PropertyTreeNode): UiPropertyTreeNode { const displayNode = new UiPropertyTreeNode(
diff --git a/tools/winscope/src/viewers/common/variable_height_scroll_directive.ts b/tools/winscope/src/viewers/common/variable_height_scroll_directive.ts index 5fa4448..b33b4b0 100644 --- a/tools/winscope/src/viewers/common/variable_height_scroll_directive.ts +++ b/tools/winscope/src/viewers/common/variable_height_scroll_directive.ts
@@ -18,14 +18,12 @@ import {VariableHeightScrollStrategy} from './variable_height_scroll_strategy'; export abstract class VariableHeightScrollDirective<T extends object> { - private scrollItemsInternal: T[] = []; abstract scrollStrategy: VariableHeightScrollStrategy; @Input() set scrollItems(items: T[]) { if (this.scrollItems !== items) { this.scrollStrategy.updateItems(items); - this.scrollItemsInternal = items; } } }
diff --git a/tools/winscope/src/viewers/common/variable_height_scroll_strategy.ts b/tools/winscope/src/viewers/common/variable_height_scroll_strategy.ts index e1fb200..6993d28 100644 --- a/tools/winscope/src/viewers/common/variable_height_scroll_strategy.ts +++ b/tools/winscope/src/viewers/common/variable_height_scroll_strategy.ts
@@ -108,7 +108,7 @@ return; } - let cacheUpdated: boolean = false; + let cacheUpdated = false; for (const node of this.wrapper.childNodes) { if (node && node.nodeName === 'DIV') {
diff --git a/tools/winscope/src/viewers/components/coordinates_table_component_test.ts b/tools/winscope/src/viewers/components/coordinates_table_component_test.ts index 005a25c..5f05324 100644 --- a/tools/winscope/src/viewers/components/coordinates_table_component_test.ts +++ b/tools/winscope/src/viewers/components/coordinates_table_component_test.ts
@@ -20,7 +20,6 @@ describe('CoordinatesTableComponent', () => { let fixture: ComponentFixture<CoordinatesTableComponent>; let component: CoordinatesTableComponent; - let htmlElement: HTMLElement; beforeAll(async () => { await TestBed.configureTestingModule({ @@ -32,7 +31,6 @@ beforeEach(() => { fixture = TestBed.createComponent(CoordinatesTableComponent); component = fixture.componentInstance; - htmlElement = fixture.nativeElement; }); it('can be created', () => {
diff --git a/tools/winscope/src/viewers/components/hierarchy_component.ts b/tools/winscope/src/viewers/components/hierarchy_component.ts index e8f6acb..0a1fa30 100644 --- a/tools/winscope/src/viewers/components/hierarchy_component.ts +++ b/tools/winscope/src/viewers/components/hierarchy_component.ts
@@ -155,7 +155,7 @@ @Input() subtrees: UiHierarchyTreeNode[] = []; @Input() tableProperties: TableProperties | undefined; @Input() dependencies: TraceType[] = []; - @Input() highlightedItem: string = ''; + @Input() highlightedItem = ''; @Input() pinnedItems: UiHierarchyTreeNode[] = []; @Input() store: PersistentStore | undefined; @Input() userOptions: UserOptions = {}; @@ -180,7 +180,7 @@ } onUserOptionChange() { - const event: CustomEvent = new CustomEvent(ViewerEvents.HierarchyUserOptionsChange, { + const event = new CustomEvent(ViewerEvents.HierarchyUserOptionsChange, { bubbles: true, detail: {userOptions: this.userOptions}, }); @@ -188,7 +188,7 @@ } onFilterChange() { - const event: CustomEvent = new CustomEvent(ViewerEvents.HierarchyFilterChange, { + const event = new CustomEvent(ViewerEvents.HierarchyFilterChange, { bubbles: true, detail: {filterString: this.filterString}, }); @@ -196,7 +196,7 @@ } onHighlightedItemChange(newId: string) { - const event: CustomEvent = new CustomEvent(ViewerEvents.HighlightedChange, { + const event = new CustomEvent(ViewerEvents.HighlightedChange, { bubbles: true, detail: {id: newId}, }); @@ -204,7 +204,7 @@ } onSelectedTreeChange(item: UiHierarchyTreeNode) { - const event: CustomEvent = new CustomEvent(ViewerEvents.SelectedTreeChange, { + const event = new CustomEvent(ViewerEvents.SelectedTreeChange, { bubbles: true, detail: {selectedItem: item}, }); @@ -212,7 +212,7 @@ } onPinnedItemChange(item: UiHierarchyTreeNode) { - const event: CustomEvent = new CustomEvent(ViewerEvents.HierarchyPinnedChange, { + const event = new CustomEvent(ViewerEvents.HierarchyPinnedChange, { bubbles: true, detail: {pinnedItem: item}, });
diff --git a/tools/winscope/src/viewers/components/properties_component.ts b/tools/winscope/src/viewers/components/properties_component.ts index e1425e8..5636a30 100644 --- a/tools/winscope/src/viewers/components/properties_component.ts +++ b/tools/winscope/src/viewers/components/properties_component.ts
@@ -131,7 +131,7 @@ @Input() userOptions: UserOptions = {}; @Input() propertiesTree: UiPropertyTreeNode | undefined; - @Input() highlightedProperty: string = ''; + @Input() highlightedProperty = ''; @Input() curatedProperties: CuratedProperties | undefined; @Input() displayPropertyGroups = false; @Input() isProtoDump = false; @@ -141,7 +141,7 @@ constructor(@Inject(ElementRef) private elementRef: ElementRef) {} filterTree() { - const event: CustomEvent = new CustomEvent(ViewerEvents.PropertiesFilterChange, { + const event = new CustomEvent(ViewerEvents.PropertiesFilterChange, { bubbles: true, detail: {filterString: this.filterString}, }); @@ -149,7 +149,7 @@ } onHighlightedPropertyChange(newId: string) { - const event: CustomEvent = new CustomEvent(ViewerEvents.HighlightedPropertyChange, { + const event = new CustomEvent(ViewerEvents.HighlightedPropertyChange, { bubbles: true, detail: {id: newId}, }); @@ -157,7 +157,7 @@ } updateTree() { - const event: CustomEvent = new CustomEvent(ViewerEvents.PropertiesUserOptionsChange, { + const event = new CustomEvent(ViewerEvents.PropertiesUserOptionsChange, { bubbles: true, detail: {userOptions: this.userOptions}, });
diff --git a/tools/winscope/src/viewers/components/properties_table_component_test.ts b/tools/winscope/src/viewers/components/properties_table_component_test.ts index 9dcb8ea..c819a0a 100644 --- a/tools/winscope/src/viewers/components/properties_table_component_test.ts +++ b/tools/winscope/src/viewers/components/properties_table_component_test.ts
@@ -19,7 +19,6 @@ describe('PropertiesTableComponent', () => { let fixture: ComponentFixture<PropertiesTableComponent>; let component: PropertiesTableComponent; - let htmlElement: HTMLElement; beforeAll(async () => { await TestBed.configureTestingModule({ @@ -31,7 +30,6 @@ beforeEach(() => { fixture = TestBed.createComponent(PropertiesTableComponent); component = fixture.componentInstance; - htmlElement = fixture.nativeElement; }); it('can be created', () => {
diff --git a/tools/winscope/src/viewers/components/rects/canvas.ts b/tools/winscope/src/viewers/components/rects/canvas.ts index 0c89665..e13c237 100644 --- a/tools/winscope/src/viewers/components/rects/canvas.ts +++ b/tools/winscope/src/viewers/components/rects/canvas.ts
@@ -344,7 +344,7 @@ private propagateUpdateHighlightedItem(event: MouseEvent, newId: string) { event.preventDefault(); - const highlightedChangeEvent: CustomEvent = new CustomEvent(ViewerEvents.HighlightedChange, { + const highlightedChangeEvent = new CustomEvent(ViewerEvents.HighlightedChange, { bubbles: true, detail: {id: newId}, });
diff --git a/tools/winscope/src/viewers/components/rects/mapper3d.ts b/tools/winscope/src/viewers/components/rects/mapper3d.ts index 25a0e41..74f0afc 100644 --- a/tools/winscope/src/viewers/components/rects/mapper3d.ts +++ b/tools/winscope/src/viewers/components/rects/mapper3d.ts
@@ -32,11 +32,11 @@ private static readonly ZOOM_FACTOR_STEP = 0.2; private rects: UiRect[] = []; - private highlightedRectId: string = ''; + private highlightedRectId = ''; private cameraRotationFactor = Mapper3D.CAMERA_ROTATION_FACTOR_INIT; private zSpacingFactor = Mapper3D.Z_SPACING_FACTOR_INIT; private zoomFactor = Mapper3D.ZOOM_FACTOR_INIT; - private panScreenDistance: Distance2D = new Distance2D(0, 0); + private panScreenDistance = new Distance2D(0, 0); private showOnlyVisibleMode = false; // by default show all private currentGroupId = 0; // default stack id is usually 0 @@ -64,12 +64,12 @@ this.zSpacingFactor = Math.min(Math.max(factor, 0), 1); } - increaseZoomFactor(times: number = 1) { + increaseZoomFactor(times = 1) { this.zoomFactor += Mapper3D.ZOOM_FACTOR_STEP * times; this.zoomFactor = Math.min(this.zoomFactor, Mapper3D.ZOOM_FACTOR_MAX); } - decreaseZoomFactor(times: number = 1) { + decreaseZoomFactor(times = 1) { this.zoomFactor -= Mapper3D.ZOOM_FACTOR_STEP * times; this.zoomFactor = Math.max(this.zoomFactor, Mapper3D.ZOOM_FACTOR_MIN); }
diff --git a/tools/winscope/src/viewers/components/rects/rects_component.ts b/tools/winscope/src/viewers/components/rects/rects_component.ts index eaf4a6b..0cd8a3a 100644 --- a/tools/winscope/src/viewers/components/rects/rects_component.ts +++ b/tools/winscope/src/viewers/components/rects/rects_component.ts
@@ -204,13 +204,13 @@ }) export class RectsComponent implements OnInit, OnDestroy { @Input() title = 'title'; - @Input() zoomFactor: number = 1; + @Input() zoomFactor = 1; @Input() store?: PersistentStore; @Input() isStackBased = false; @Input() rects: UiRect[] = []; @Input() miniRects: UiRect[] | undefined; @Input() displays: DisplayIdentifier[] = []; - @Input() highlightedItem: string = ''; + @Input() highlightedItem = ''; private stackSelected = false; private internalRects: UiRect[] = []; @@ -219,7 +219,7 @@ private storeKeyZSpacingFactor = ''; private internalDisplays: DisplayIdentifier[] = []; private internalGroupIds = new Set<number>(); - private internalHighlightedItem: string = ''; + private internalHighlightedItem = ''; private currentDisplay: DisplayIdentifier | undefined; private mapper3d: Mapper3D; private largeRectsCanvas?: Canvas;
diff --git a/tools/winscope/src/viewers/components/transform_matrix_component_test.ts b/tools/winscope/src/viewers/components/transform_matrix_component_test.ts index 14e2af7..53c32b7 100644 --- a/tools/winscope/src/viewers/components/transform_matrix_component_test.ts +++ b/tools/winscope/src/viewers/components/transform_matrix_component_test.ts
@@ -19,7 +19,6 @@ describe('TransformMatrixComponent', () => { let fixture: ComponentFixture<TransformMatrixComponent>; let component: TransformMatrixComponent; - let htmlElement: HTMLElement; beforeAll(async () => { await TestBed.configureTestingModule({ @@ -32,7 +31,6 @@ beforeEach(() => { fixture = TestBed.createComponent(TransformMatrixComponent); component = fixture.componentInstance; - htmlElement = fixture.nativeElement; }); it('can be created', () => {
diff --git a/tools/winscope/src/viewers/components/tree_component.ts b/tools/winscope/src/viewers/components/tree_component.ts index 11d0534..b485a6a 100644 --- a/tools/winscope/src/viewers/components/tree_component.ts +++ b/tools/winscope/src/viewers/components/tree_component.ts
@@ -98,7 +98,7 @@ @Input() store?: PersistentStore; @Input() isFlattened? = false; @Input() initialDepth = 0; - @Input() highlightedItem: string = ''; + @Input() highlightedItem = ''; @Input() pinnedItems?: UiHierarchyTreeNode[] = []; @Input() itemsClickable?: boolean; @@ -107,11 +107,11 @@ @Input() showNode = (node: UiPropertyTreeNode | UiHierarchyTreeNode) => true; - @Output() highlightedChange = new EventEmitter<string>(); - @Output() selectedTreeChange = new EventEmitter<UiHierarchyTreeNode>(); - @Output() pinnedItemChange = new EventEmitter<UiHierarchyTreeNode>(); - @Output() hoverStart = new EventEmitter<void>(); - @Output() hoverEnd = new EventEmitter<void>(); + @Output() readonly highlightedChange = new EventEmitter<string>(); + @Output() readonly selectedTreeChange = new EventEmitter<UiHierarchyTreeNode>(); + @Output() readonly pinnedItemChange = new EventEmitter<UiHierarchyTreeNode>(); + @Output() readonly hoverStart = new EventEmitter<void>(); + @Output() readonly hoverEnd = new EventEmitter<void>(); localExpandedState = true; nodeHover = false; @@ -160,7 +160,9 @@ isLeaf(node?: UiPropertyTreeNode | UiHierarchyTreeNode): boolean { if (node === undefined) return true; - if (node instanceof UiHierarchyTreeNode) return node.getAllChildren().length === 0; + if (node instanceof UiHierarchyTreeNode) { + return node.getAllChildren().length === 0; + } return node.formattedValue().length > 0 || node.getAllChildren().length === 0; }
diff --git a/tools/winscope/src/viewers/components/tree_node_component.ts b/tools/winscope/src/viewers/components/tree_node_component.ts index c64f971..8c5c0b0 100644 --- a/tools/winscope/src/viewers/components/tree_node_component.ts +++ b/tools/winscope/src/viewers/components/tree_node_component.ts
@@ -68,13 +68,13 @@ @Input() isLeaf?: boolean; @Input() flattened?: boolean; @Input() isExpanded?: boolean; - @Input() isPinned: boolean = false; - @Input() isInPinnedSection: boolean = false; - @Input() isSelected: boolean = false; + @Input() isPinned = false; + @Input() isInPinnedSection = false; + @Input() isSelected = false; - @Output() toggleTreeChange = new EventEmitter<void>(); - @Output() expandTreeChange = new EventEmitter<boolean>(); - @Output() pinNodeChange = new EventEmitter<UiHierarchyTreeNode>(); + @Output() readonly toggleTreeChange = new EventEmitter<void>(); + @Output() readonly expandTreeChange = new EventEmitter<boolean>(); + @Output() readonly pinNodeChange = new EventEmitter<UiHierarchyTreeNode>(); collapseDiffClass = ''; private el: HTMLElement;
diff --git a/tools/winscope/src/viewers/components/tree_node_data_view_component_test.ts b/tools/winscope/src/viewers/components/tree_node_data_view_component_test.ts index 12ccb7c..841527f 100644 --- a/tools/winscope/src/viewers/components/tree_node_data_view_component_test.ts +++ b/tools/winscope/src/viewers/components/tree_node_data_view_component_test.ts
@@ -20,7 +20,6 @@ describe('TreeNodeDataViewComponent', () => { let fixture: ComponentFixture<TreeNodeDataViewComponent>; let component: TreeNodeDataViewComponent; - let htmlElement: HTMLElement; beforeAll(async () => { await TestBed.configureTestingModule({ @@ -33,7 +32,6 @@ beforeEach(() => { fixture = TestBed.createComponent(TreeNodeDataViewComponent); component = fixture.componentInstance; - htmlElement = fixture.nativeElement; }); it('can be created', () => {
diff --git a/tools/winscope/src/viewers/components/tree_node_properties_data_view_component_test.ts b/tools/winscope/src/viewers/components/tree_node_properties_data_view_component_test.ts index c50f044..13e25fe 100644 --- a/tools/winscope/src/viewers/components/tree_node_properties_data_view_component_test.ts +++ b/tools/winscope/src/viewers/components/tree_node_properties_data_view_component_test.ts
@@ -19,7 +19,6 @@ describe('TreeNodePropertiesDataViewComponent', () => { let fixture: ComponentFixture<TreeNodePropertiesDataViewComponent>; let component: TreeNodePropertiesDataViewComponent; - let htmlElement: HTMLElement; beforeAll(async () => { await TestBed.configureTestingModule({ @@ -31,7 +30,6 @@ beforeEach(() => { fixture = TestBed.createComponent(TreeNodePropertiesDataViewComponent); component = fixture.componentInstance; - htmlElement = fixture.nativeElement; }); it('can be created', () => {
diff --git a/tools/winscope/src/viewers/viewer_surface_flinger/presenter.ts b/tools/winscope/src/viewers/viewer_surface_flinger/presenter.ts index 8ede1f0..d3d53ea 100644 --- a/tools/winscope/src/viewers/viewer_surface_flinger/presenter.ts +++ b/tools/winscope/src/viewers/viewer_surface_flinger/presenter.ts
@@ -57,8 +57,8 @@ private uiData: UiData; private hierarchyFilter: TreeNodeFilter = UiTreeUtils.makeNodeFilter(''); private propertiesFilter: TreeNodeFilter = UiTreeUtils.makeNodeFilter(''); - private highlightedItem: string = ''; - private highlightedProperty: string = ''; + private highlightedItem = ''; + private highlightedProperty = ''; private pinnedItems: UiHierarchyTreeNode[] = []; private pinnedIds: string[] = []; private selectedHierarchyTree: UiHierarchyTreeNode | undefined; @@ -376,7 +376,7 @@ return summary; } - private mapNodeArrayToString(nodes: ReadonlyArray<PropertyTreeNode>): string { + private mapNodeArrayToString(nodes: readonly PropertyTreeNode[]): string { return nodes.map((reason) => reason.formattedValue()).join(', '); }
diff --git a/tools/winscope/src/viewers/viewer_surface_flinger/ui_data.ts b/tools/winscope/src/viewers/viewer_surface_flinger/ui_data.ts index 7d2312e..2d458d7 100644 --- a/tools/winscope/src/viewers/viewer_surface_flinger/ui_data.ts +++ b/tools/winscope/src/viewers/viewer_surface_flinger/ui_data.ts
@@ -26,8 +26,8 @@ dependencies: TraceType[]; rects: UiRect[] = []; displays: DisplayIdentifier[] = []; - highlightedItem: string = ''; - highlightedProperty: string = ''; + highlightedItem = ''; + highlightedProperty = ''; pinnedItems: UiHierarchyTreeNode[] = []; hierarchyUserOptions: UserOptions = {}; propertiesUserOptions: UserOptions = {};
diff --git a/tools/winscope/src/viewers/viewer_transitions/viewer_transitions_component.ts b/tools/winscope/src/viewers/viewer_transitions/viewer_transitions_component.ts index 799a446..a3efd1c 100644 --- a/tools/winscope/src/viewers/viewer_transitions/viewer_transitions_component.ts +++ b/tools/winscope/src/viewers/viewer_transitions/viewer_transitions_component.ts
@@ -415,5 +415,9 @@ private elementRef: ElementRef; } -const bigIntMax = (...args: Array<bigint>) => args.reduce((m, e) => (e > m ? e : m)); -const bigIntMin = (...args: Array<bigint>) => args.reduce((m, e) => (e < m ? e : m)); +function bigIntMax(...args: Array<bigint>) { + return args.reduce((m, e) => (e > m ? e : m)); +} +function bigIntMin(...args: Array<bigint>) { + return args.reduce((m, e) => (e < m ? e : m)); +}
diff --git a/tools/winscope/src/viewers/viewer_window_manager/presenter.ts b/tools/winscope/src/viewers/viewer_window_manager/presenter.ts index 07639f1..231affe 100644 --- a/tools/winscope/src/viewers/viewer_window_manager/presenter.ts +++ b/tools/winscope/src/viewers/viewer_window_manager/presenter.ts
@@ -52,8 +52,8 @@ private uiData: UiData; private hierarchyFilter: TreeNodeFilter = UiTreeUtils.makeNodeFilter(''); private propertiesFilter: TreeNodeFilter = UiTreeUtils.makeNodeFilter(''); - private highlightedItem: string = ''; - private highlightedProperty: string = ''; + private highlightedItem = ''; + private highlightedProperty = ''; private pinnedItems: UiHierarchyTreeNode[] = []; private pinnedIds: string[] = []; private selectedHierarchyTree: UiHierarchyTreeNode | undefined; @@ -120,7 +120,9 @@ await event.visit(WinscopeEventType.TRACE_POSITION_UPDATE, async (event) => { const entry = TraceEntryFinder.findCorrespondingEntry(this.trace, event.position); this.currentHierarchyTree = await entry?.getValue(); - if (entry) this.currentHierarchyTreeName = TimeUtils.format(entry.getTimestamp()); + if (entry) { + this.currentHierarchyTreeName = TimeUtils.format(entry.getTimestamp()); + } this.previousEntry = entry && entry.getIndex() > 0 ? this.trace.getEntry(entry.getIndex() - 1) : undefined; @@ -256,7 +258,9 @@ const uiTree = UiHierarchyTreeNode.from(hierarchyTree); - if (this.currentHierarchyTreeName) uiTree.setDisplayName(this.currentHierarchyTreeName); + if (this.currentHierarchyTreeName) { + uiTree.setDisplayName(this.currentHierarchyTreeName); + } const formatter = new UiTreeFormatter<UiHierarchyTreeNode>().setUiTree(uiTree);
diff --git a/tools/winscope/src/viewers/viewer_window_manager/ui_data.ts b/tools/winscope/src/viewers/viewer_window_manager/ui_data.ts index e32e53e..0e27745 100644 --- a/tools/winscope/src/viewers/viewer_window_manager/ui_data.ts +++ b/tools/winscope/src/viewers/viewer_window_manager/ui_data.ts
@@ -24,8 +24,8 @@ dependencies: TraceType[]; rects: UiRect[] = []; displays: DisplayIdentifier[] = []; - highlightedItem: string = ''; - highlightedProperty: string = ''; + highlightedItem = ''; + highlightedProperty = ''; pinnedItems: UiHierarchyTreeNode[] = []; hierarchyUserOptions: UserOptions = {}; propertiesUserOptions: UserOptions = {};