• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 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 android.tools.traces.wm
18 
19 import android.graphics.Rect
20 import android.tools.withCache
21 
22 class InsetsSource private constructor(val type: Int, val frame: Rect, val visible: Boolean) {
equalsnull23     override fun equals(other: Any?): Boolean {
24         if (this === other) return true
25         if (other !is InsetsSource) return false
26 
27         if (type != other.type) return false
28         if (frame != other.frame) return false
29         if (visible != other.visible) return false
30 
31         return true
32     }
33 
hashCodenull34     override fun hashCode(): Int {
35         var result = type.hashCode()
36         result = 31 * result + frame.hashCode()
37         result = 31 * result + visible.hashCode()
38         return result
39     }
40 
toStringnull41     override fun toString(): String {
42         return "InsetsSource(type=$type, frame=$frame, visible=$visible)"
43     }
44 
45     companion object {
<lambda>null46         fun from(type: Int, frame: Rect, visible: Boolean): InsetsSource = withCache {
47             InsetsSource(type, frame, visible)
48         }
49     }
50 }
51