• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.windowmanager.windows
18 
19 /**
20  * Represents the attributes of a WindowState in the window manager hierarchy
21  *
22  * This is a generic object that is reused by both Flicker and Winscope and cannot
23  * access internal Java/Android functionality
24  *
25  */
26 data class WindowLayoutParams(
27     val type: Int,
28     val x: Int,
29     val y: Int,
30     val width: Int,
31     val height: Int,
32     val horizontalMargin: Float,
33     val verticalMargin: Float,
34     val gravity: Int,
35     val softInputMode: Int,
36     val format: Int,
37     val windowAnimations: Int,
38     val alpha: Float,
39     val screenBrightness: Float,
40     val buttonBrightness: Float,
41     val rotationAnimation: Int,
42     val preferredRefreshRate: Float,
43     val preferredDisplayModeId: Int,
44     val hasSystemUiListeners: Boolean,
45     val inputFeatureFlags: Int,
46     val userActivityTimeout: Long,
47     val colorMode: Int,
48     val flags: Int,
49     val privateFlags: Int,
50     val systemUiVisibilityFlags: Int,
51     val subtreeSystemUiVisibilityFlags: Int,
52     val appearance: Int,
53     val behavior: Int,
54     val fitInsetsTypes: Int,
55     val fitInsetsSides: Int,
56     val fitIgnoreVisibility: Boolean
57 ) {
58     val isValidNavBarType: Boolean = this.type == TYPE_NAVIGATION_BAR
59 
60     companion object {
61         /**
62          * @see WindowManager.LayoutParams
63          */
64         private const val TYPE_NAVIGATION_BAR = 2019
65     }
66 
equalsnull67     override fun equals(other: Any?): Boolean {
68         if (this === other) return true
69         if (other !is WindowLayoutParams) return false
70 
71         if (type != other.type) return false
72         if (x != other.x) return false
73         if (y != other.y) return false
74         if (width != other.width) return false
75         if (height != other.height) return false
76         if (horizontalMargin != other.horizontalMargin) return false
77         if (verticalMargin != other.verticalMargin) return false
78         if (gravity != other.gravity) return false
79         if (softInputMode != other.softInputMode) return false
80         if (format != other.format) return false
81         if (windowAnimations != other.windowAnimations) return false
82         if (alpha != other.alpha) return false
83         if (screenBrightness != other.screenBrightness) return false
84         if (buttonBrightness != other.buttonBrightness) return false
85         if (rotationAnimation != other.rotationAnimation) return false
86         if (preferredRefreshRate != other.preferredRefreshRate) return false
87         if (preferredDisplayModeId != other.preferredDisplayModeId) return false
88         if (hasSystemUiListeners != other.hasSystemUiListeners) return false
89         if (inputFeatureFlags != other.inputFeatureFlags) return false
90         if (userActivityTimeout != other.userActivityTimeout) return false
91         if (colorMode != other.colorMode) return false
92         if (flags != other.flags) return false
93         if (privateFlags != other.privateFlags) return false
94         if (systemUiVisibilityFlags != other.systemUiVisibilityFlags) return false
95         if (subtreeSystemUiVisibilityFlags != other.subtreeSystemUiVisibilityFlags) return false
96         if (appearance != other.appearance) return false
97         if (behavior != other.behavior) return false
98         if (fitInsetsTypes != other.fitInsetsTypes) return false
99         if (fitInsetsSides != other.fitInsetsSides) return false
100         if (fitIgnoreVisibility != other.fitIgnoreVisibility) return false
101         if (isValidNavBarType != other.isValidNavBarType) return false
102 
103         return true
104     }
105 
hashCodenull106     override fun hashCode(): Int {
107         var result = type
108         result = 31 * result + x
109         result = 31 * result + y
110         result = 31 * result + width
111         result = 31 * result + height
112         result = 31 * result + horizontalMargin.hashCode()
113         result = 31 * result + verticalMargin.hashCode()
114         result = 31 * result + gravity
115         result = 31 * result + softInputMode
116         result = 31 * result + format
117         result = 31 * result + windowAnimations
118         result = 31 * result + alpha.hashCode()
119         result = 31 * result + screenBrightness.hashCode()
120         result = 31 * result + buttonBrightness.hashCode()
121         result = 31 * result + rotationAnimation
122         result = 31 * result + preferredRefreshRate.hashCode()
123         result = 31 * result + preferredDisplayModeId
124         result = 31 * result + hasSystemUiListeners.hashCode()
125         result = 31 * result + inputFeatureFlags
126         result = 31 * result + userActivityTimeout.hashCode()
127         result = 31 * result + colorMode
128         result = 31 * result + flags
129         result = 31 * result + privateFlags
130         result = 31 * result + systemUiVisibilityFlags
131         result = 31 * result + subtreeSystemUiVisibilityFlags
132         result = 31 * result + appearance
133         result = 31 * result + behavior
134         result = 31 * result + fitInsetsTypes
135         result = 31 * result + fitInsetsSides
136         result = 31 * result + fitIgnoreVisibility.hashCode()
137         result = 31 * result + isValidNavBarType.hashCode()
138         return result
139     }
140 }