1 /* 2 * Copyright (C) 2021 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.server.wm.traces.common.layers 18 19 import com.android.server.wm.traces.common.Rect 20 import com.android.server.wm.traces.common.Size 21 22 /** 23 * Wrapper for DisplayProto (frameworks/native/services/surfaceflinger/layerproto/display.proto) 24 */ 25 data class Display( 26 val id: ULong, 27 val name: String, 28 val layerStackId: Int, 29 val size: Size, 30 val layerStackSpace: Rect, 31 val transform: Transform, 32 val isVirtual: Boolean 33 ) { 34 val isOff = layerStackId == BLANK_LAYER_STACK 35 equalsnull36 override fun equals(other: Any?): Boolean { 37 if (this === other) return true 38 if (other !is Display) return false 39 40 if (id != other.id) return false 41 if (name != other.name) return false 42 if (layerStackId != other.layerStackId) return false 43 if (size != other.size) return false 44 if (layerStackSpace != other.layerStackSpace) return false 45 if (transform != other.transform) return false 46 if (isVirtual != other.isVirtual) return false 47 48 return true 49 } 50 hashCodenull51 override fun hashCode(): Int { 52 var result = id.toInt() 53 result = 31 * result + name.hashCode() 54 result = 31 * result + layerStackId 55 result = 31 * result + size.hashCode() 56 result = 31 * result + layerStackSpace.hashCode() 57 result = 31 * result + transform.hashCode() 58 result = 31 * result + isVirtual.hashCode() 59 return result 60 } 61 62 companion object { 63 const val BLANK_LAYER_STACK = - 1 64 65 val EMPTY = Display( 66 id = 0.toULong(), 67 name = "EMPTY", 68 layerStackId = BLANK_LAYER_STACK, 69 size = Size.EMPTY, 70 layerStackSpace = Rect.EMPTY, 71 transform = Transform.EMPTY, 72 isVirtual = false 73 ) 74 } 75 }