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  * Representation of a Display in the SF trace
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 ) {
equalsnull33     override fun equals(other: Any?): Boolean {
34         if (this === other) return true
35         if (other !is Display) return false
36 
37         if (id != other.id) return false
38         if (name != other.name) return false
39         if (layerStackId != other.layerStackId) return false
40         if (size != other.size) return false
41         if (layerStackSpace != other.layerStackSpace) return false
42         if (transform != other.transform) return false
43 
44         return true
45     }
46 
hashCodenull47     override fun hashCode(): Int {
48         var result = id.toInt()
49         result = 31 * result + name.hashCode()
50         result = 31 * result + layerStackId
51         result = 31 * result + size.hashCode()
52         result = 31 * result + layerStackSpace.hashCode()
53         result = 31 * result + transform.hashCode()
54         return result
55     }
56 
57     companion object {
58         val EMPTY = Display(
59             id = 0.toULong(),
60             name = "EMPTY",
61             layerStackId = -1,
62             size = Size.EMPTY,
63             layerStackSpace = Rect.EMPTY,
64             transform = Transform.EMPTY
65         )
66     }
67 }