/* * Copyright (C) 2022 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import {Component, Input} from '@angular/core'; import {Layer} from 'trace/flickerlib/common'; @Component({ selector: 'property-groups', template: `

Visibility

Flags: &ngsp; {{ item.verboseFlags ? item.verboseFlags : item.flags }}

{{ reason.key }}: &ngsp; {{ reason.value }}

Geometry

Calculated

Transform:

Crop: &ngsp; {{ item.bounds }}

Final Bounds: &ngsp; {{ item.screenBounds }}

Requested

Transform:

Crop: &ngsp; {{ item.crop ? item.crop : '[empty]' }}

Buffer

Size: &ngsp; {{ item.activeBuffer }}

Frame Number: &ngsp; {{ item.currFrame }}

Transform: &ngsp; {{ item.bufferTransform }}

Destination Frame: &ngsp; {{ getDestinationFrame() }}

Destination Frame ignored because item has eIgnoreDestinationFrame flag set.

Hierarchy

z-order: &ngsp; {{ item.z }}

relative parent: &ngsp; {{ item.zOrderRelativeOfId == -1 ? 'none' : item.zOrderRelativeOfId }}

Effects

Calculated

Color: &ngsp; {{ item.color }}

Shadow: &ngsp; {{ item.shadowRadius }} px

Corner Radius: &ngsp; {{ formatFloat(item.cornerRadius) }} px

Corner Radius Crop: &ngsp; {{ item.cornerRadiusCrop }}

Blur: &ngsp; {{ item.proto?.backgroundBlurRadius ? item.proto?.backgroundBlurRadius : 0 }} px

Requested

Color: &ngsp; {{ item.requestedColor }}

Shadow: &ngsp; {{ item.proto?.requestedShadowRadius ? item.proto?.requestedShadowRadius : 0 }} px

Corner Radius: &ngsp; {{ item.proto?.requestedCornerRadius ? formatFloat(item.proto?.requestedCornerRadius) : 0 }} px

Input

To Display Transform:

Touchable Region: &ngsp; {{ item.inputRegion }}

Config

Focusable: &ngsp; {{ item.proto?.inputWindowInfo.focusable }}

Crop touch region with item: &ngsp; {{ item.proto?.inputWindowInfo.cropLayerId <= 0 ? "none" : item.proto?.inputWindowInfo.cropLayerId }}

Replace touch region with crop: &ngsp; {{ item.proto?.inputWindowInfo.replaceTouchableRegionWithCrop }}

Input channel: &ngsp; not set

`, styles: [ ` .group { display: flex; flex-direction: row; padding: 8px; } .group-header { width: 80px; color: gray; } .left-column { flex: 1; padding: 0 5px; } .right-column { flex: 1; border: 1px solid var(--border-color); border-left-width: 5px; padding: 0 5px; } .column-header { color: gray; } `, ], }) export class PropertyGroupsComponent { @Input() item!: Layer; hasInputChannel() { return this.item.proto?.inputWindowInfo; } getDestinationFrame() { const frame = this.item.proto?.destinationFrame; if (frame) { return ` left: ${frame.left}, top: ${frame.top}, right: ${frame.right}, bottom: ${frame.bottom}`; } else return ''; } hasIgnoreDestinationFrame() { return (this.item.flags & 0x400) === 0x400; } formatFloat(num: number) { return Math.round(num * 100) / 100; } summary(): TreeSummary { const summary = []; if (this.item?.visibilityReason?.length > 0) { let reason = ''; if (Array.isArray(this.item.visibilityReason)) { reason = this.item.visibilityReason.join(', '); } else { reason = this.item.visibilityReason; } summary.push({key: 'Invisible due to', value: reason}); } if (this.item?.occludedBy?.length > 0) { summary.push({ key: 'Occluded by', value: this.item.occludedBy.map((it: any) => it.id).join(', '), }); } if (this.item?.partiallyOccludedBy?.length > 0) { summary.push({ key: 'Partially occluded by', value: this.item.partiallyOccludedBy.map((it: any) => it.id).join(', '), }); } if (this.item?.coveredBy?.length > 0) { summary.push({ key: 'Covered by', value: this.item.coveredBy.map((it: any) => it.id).join(', '), }); } return summary; } } type TreeSummary = Array<{key: string; value: string}>;