Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 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.display; |
| 18 | |
Jeff Brown | 4ccb823 | 2014-01-16 22:16:42 -0800 | [diff] [blame] | 19 | import android.hardware.display.DisplayViewport; |
Jeff Brown | cbad976 | 2012-09-04 21:57:59 -0700 | [diff] [blame] | 20 | import android.util.DisplayMetrics; |
Jeff Brown | 92130f6 | 2012-10-24 21:28:33 -0700 | [diff] [blame] | 21 | import android.view.Display; |
Jeff Brown | 27f1d67 | 2012-10-17 18:32:34 -0700 | [diff] [blame] | 22 | import android.view.Surface; |
Jeff Brown | cbad976 | 2012-09-04 21:57:59 -0700 | [diff] [blame] | 23 | |
Michael Wright | 3f145a2 | 2014-07-22 19:46:03 -0700 | [diff] [blame] | 24 | import java.util.Arrays; |
| 25 | |
Jeff Brown | 4ed8fe7 | 2012-08-30 18:18:29 -0700 | [diff] [blame] | 26 | import libcore.util.Objects; |
| 27 | |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 28 | /** |
| 29 | * Describes the characteristics of a physical display device. |
| 30 | */ |
Jeff Brown | 4ed8fe7 | 2012-08-30 18:18:29 -0700 | [diff] [blame] | 31 | final class DisplayDeviceInfo { |
| 32 | /** |
| 33 | * Flag: Indicates that this display device should be considered the default display |
| 34 | * device of the system. |
| 35 | */ |
Jeff Brown | bd6e150 | 2012-08-28 03:27:37 -0700 | [diff] [blame] | 36 | public static final int FLAG_DEFAULT_DISPLAY = 1 << 0; |
Jeff Brown | 4ed8fe7 | 2012-08-30 18:18:29 -0700 | [diff] [blame] | 37 | |
| 38 | /** |
Jeff Brown | 27f1d67 | 2012-10-17 18:32:34 -0700 | [diff] [blame] | 39 | * Flag: Indicates that the orientation of this display device is coupled to the |
| 40 | * rotation of its associated logical display. |
| 41 | * <p> |
| 42 | * This flag should be applied to the default display to indicate that the user |
| 43 | * physically rotates the display when content is presented in a different orientation. |
| 44 | * The display manager will apply a coordinate transformation assuming that the |
| 45 | * physical orientation of the display matches the logical orientation of its content. |
| 46 | * </p><p> |
| 47 | * The flag should not be set when the display device is mounted in a fixed orientation |
| 48 | * such as on a desk. The display manager will apply a coordinate transformation |
| 49 | * such as a scale and translation to letterbox or pillarbox format under the |
| 50 | * assumption that the physical orientation of the display is invariant. |
| 51 | * </p> |
Jeff Brown | 4ed8fe7 | 2012-08-30 18:18:29 -0700 | [diff] [blame] | 52 | */ |
Jeff Brown | 27f1d67 | 2012-10-17 18:32:34 -0700 | [diff] [blame] | 53 | public static final int FLAG_ROTATES_WITH_CONTENT = 1 << 1; |
Jeff Brown | c5df37c | 2012-09-13 11:45:07 -0700 | [diff] [blame] | 54 | |
| 55 | /** |
Jeff Brown | 77aebfd | 2012-10-01 21:07:03 -0700 | [diff] [blame] | 56 | * Flag: Indicates that this display device has secure video output, such as HDCP. |
Jeff Brown | c5df37c | 2012-09-13 11:45:07 -0700 | [diff] [blame] | 57 | */ |
Jeff Brown | 77aebfd | 2012-10-01 21:07:03 -0700 | [diff] [blame] | 58 | public static final int FLAG_SECURE = 1 << 2; |
| 59 | |
| 60 | /** |
| 61 | * Flag: Indicates that this display device supports compositing |
| 62 | * from gralloc protected buffers. |
| 63 | */ |
| 64 | public static final int FLAG_SUPPORTS_PROTECTED_BUFFERS = 1 << 3; |
Jeff Brown | 4ed8fe7 | 2012-08-30 18:18:29 -0700 | [diff] [blame] | 65 | |
| 66 | /** |
Jeff Brown | a506a6e | 2013-06-04 00:02:38 -0700 | [diff] [blame] | 67 | * Flag: Indicates that the display device is owned by a particular application |
| 68 | * and that no other application should be able to interact with it. |
Jeff Brown | d14c8c9 | 2014-01-07 18:13:09 -0800 | [diff] [blame] | 69 | * Should typically be used together with {@link #FLAG_OWN_CONTENT_ONLY}. |
Jeff Brown | a506a6e | 2013-06-04 00:02:38 -0700 | [diff] [blame] | 70 | */ |
| 71 | public static final int FLAG_PRIVATE = 1 << 4; |
| 72 | |
| 73 | /** |
| 74 | * Flag: Indicates that the display device is not blanked automatically by |
| 75 | * the power manager. |
| 76 | */ |
| 77 | public static final int FLAG_NEVER_BLANK = 1 << 5; |
| 78 | |
| 79 | /** |
Jeff Brown | 7d00aff | 2013-08-02 19:03:49 -0700 | [diff] [blame] | 80 | * Flag: Indicates that the display is suitable for presentations. |
| 81 | */ |
| 82 | public static final int FLAG_PRESENTATION = 1 << 6; |
| 83 | |
| 84 | /** |
Jeff Brown | d14c8c9 | 2014-01-07 18:13:09 -0800 | [diff] [blame] | 85 | * Flag: Only show this display's own content; do not mirror |
| 86 | * the content of another display. |
| 87 | */ |
| 88 | public static final int FLAG_OWN_CONTENT_ONLY = 1 << 7; |
| 89 | |
| 90 | /** |
Adam Powell | 49e7ff9 | 2015-05-14 16:18:53 -0700 | [diff] [blame] | 91 | * Flag: This display device has a round shape. |
| 92 | */ |
| 93 | public static final int FLAG_ROUND = 1 << 8; |
| 94 | |
| 95 | /** |
Jeff Brown | d728bf5 | 2012-09-08 18:05:28 -0700 | [diff] [blame] | 96 | * Touch attachment: Display does not receive touch. |
| 97 | */ |
| 98 | public static final int TOUCH_NONE = 0; |
| 99 | |
| 100 | /** |
| 101 | * Touch attachment: Touch input is via the internal interface. |
| 102 | */ |
| 103 | public static final int TOUCH_INTERNAL = 1; |
| 104 | |
| 105 | /** |
| 106 | * Touch attachment: Touch input is via an external interface, such as USB. |
| 107 | */ |
| 108 | public static final int TOUCH_EXTERNAL = 2; |
| 109 | |
| 110 | /** |
Jeff Brown | 10acf6d | 2015-04-14 14:20:47 -0700 | [diff] [blame] | 111 | * Diff result: The {@link #state} fields differ. |
| 112 | */ |
| 113 | public static final int DIFF_STATE = 1 << 0; |
| 114 | |
| 115 | /** |
| 116 | * Diff result: Other fields differ. |
| 117 | */ |
| 118 | public static final int DIFF_OTHER = 1 << 1; |
| 119 | |
| 120 | /** |
Michael Wright | 1c9977b | 2016-07-12 13:30:10 -0700 | [diff] [blame] | 121 | * Diff result: The color mode fields differ. |
| 122 | */ |
| 123 | public static final int DIFF_COLOR_MODE = 1 << 2; |
| 124 | |
| 125 | /** |
Wale Ogunwale | 361ca21 | 2014-11-20 11:42:38 -0800 | [diff] [blame] | 126 | * Gets the name of the display device, which may be derived from EDID or |
| 127 | * other sources. The name may be localized and displayed to the user. |
Jeff Brown | 848c2dc | 2012-08-19 20:18:08 -0700 | [diff] [blame] | 128 | */ |
| 129 | public String name; |
| 130 | |
| 131 | /** |
Wale Ogunwale | 361ca21 | 2014-11-20 11:42:38 -0800 | [diff] [blame] | 132 | * Unique Id of display device. |
| 133 | */ |
| 134 | public String uniqueId; |
| 135 | |
| 136 | /** |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 137 | * The width of the display in its natural orientation, in pixels. |
| 138 | * This value is not affected by display rotation. |
| 139 | */ |
| 140 | public int width; |
| 141 | |
| 142 | /** |
| 143 | * The height of the display in its natural orientation, in pixels. |
| 144 | * This value is not affected by display rotation. |
| 145 | */ |
| 146 | public int height; |
| 147 | |
Jeff Brown | cbad976 | 2012-09-04 21:57:59 -0700 | [diff] [blame] | 148 | /** |
P.Y. Laligand | b3b9eb3 | 2015-05-11 15:02:07 -0700 | [diff] [blame] | 149 | * The active mode of the display. |
Jeff Brown | cbad976 | 2012-09-04 21:57:59 -0700 | [diff] [blame] | 150 | */ |
P.Y. Laligand | b3b9eb3 | 2015-05-11 15:02:07 -0700 | [diff] [blame] | 151 | public int modeId; |
Jeff Brown | cbad976 | 2012-09-04 21:57:59 -0700 | [diff] [blame] | 152 | |
| 153 | /** |
P.Y. Laligand | b3b9eb3 | 2015-05-11 15:02:07 -0700 | [diff] [blame] | 154 | * The default mode of the display. |
Michael Wright | 3f145a2 | 2014-07-22 19:46:03 -0700 | [diff] [blame] | 155 | */ |
P.Y. Laligand | b3b9eb3 | 2015-05-11 15:02:07 -0700 | [diff] [blame] | 156 | public int defaultModeId; |
| 157 | |
| 158 | /** |
| 159 | * The supported modes of the display. |
| 160 | */ |
| 161 | public Display.Mode[] supportedModes = Display.Mode.EMPTY_ARRAY; |
Michael Wright | 3f145a2 | 2014-07-22 19:46:03 -0700 | [diff] [blame] | 162 | |
Michael Wright | 1c9977b | 2016-07-12 13:30:10 -0700 | [diff] [blame] | 163 | /** The active color mode of the display */ |
| 164 | public int colorMode; |
Michael Wright | 58e829f | 2015-09-15 00:13:26 +0100 | [diff] [blame] | 165 | |
Michael Wright | 1c9977b | 2016-07-12 13:30:10 -0700 | [diff] [blame] | 166 | /** The supported color modes of the display */ |
| 167 | public int[] supportedColorModes = { Display.COLOR_MODE_DEFAULT }; |
Michael Wright | 58e829f | 2015-09-15 00:13:26 +0100 | [diff] [blame] | 168 | |
Michael Wright | 3f145a2 | 2014-07-22 19:46:03 -0700 | [diff] [blame] | 169 | /** |
Michael Wright | 9ff94c0 | 2016-03-30 18:05:40 -0700 | [diff] [blame] | 170 | * The HDR capabilities this display claims to support. |
| 171 | */ |
| 172 | public Display.HdrCapabilities hdrCapabilities; |
| 173 | |
| 174 | /** |
Jeff Brown | cbad976 | 2012-09-04 21:57:59 -0700 | [diff] [blame] | 175 | * The nominal apparent density of the display in DPI used for layout calculations. |
| 176 | * This density is sensitive to the viewing distance. A big TV and a tablet may have |
| 177 | * the same apparent density even though the pixels on the TV are much bigger than |
| 178 | * those on the tablet. |
| 179 | */ |
Dianne Hackborn | 908aecc | 2012-07-31 16:37:34 -0700 | [diff] [blame] | 180 | public int densityDpi; |
Jeff Brown | cbad976 | 2012-09-04 21:57:59 -0700 | [diff] [blame] | 181 | |
| 182 | /** |
| 183 | * The physical density of the display in DPI in the X direction. |
| 184 | * This density should specify the physical size of each pixel. |
| 185 | */ |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 186 | public float xDpi; |
Jeff Brown | cbad976 | 2012-09-04 21:57:59 -0700 | [diff] [blame] | 187 | |
| 188 | /** |
| 189 | * The physical density of the display in DPI in the X direction. |
| 190 | * This density should specify the physical size of each pixel. |
| 191 | */ |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 192 | public float yDpi; |
| 193 | |
Jeff Brown | cbad976 | 2012-09-04 21:57:59 -0700 | [diff] [blame] | 194 | /** |
Andy McFadden | e8b1aeb | 2014-06-13 14:05:40 -0700 | [diff] [blame] | 195 | * This is a positive value indicating the phase offset of the VSYNC events provided by |
| 196 | * Choreographer relative to the display refresh. For example, if Choreographer reports |
| 197 | * that the refresh occurred at time N, it actually occurred at (N - appVsyncOffsetNanos). |
| 198 | */ |
| 199 | public long appVsyncOffsetNanos; |
| 200 | |
| 201 | /** |
| 202 | * This is how far in advance a buffer must be queued for presentation at |
| 203 | * a given time. If you want a buffer to appear on the screen at |
| 204 | * time N, you must submit the buffer before (N - bufferDeadlineNanos). |
| 205 | */ |
| 206 | public long presentationDeadlineNanos; |
| 207 | |
| 208 | /** |
Jeff Brown | cbad976 | 2012-09-04 21:57:59 -0700 | [diff] [blame] | 209 | * Display flags. |
| 210 | */ |
Jeff Brown | bd6e150 | 2012-08-28 03:27:37 -0700 | [diff] [blame] | 211 | public int flags; |
| 212 | |
Jeff Brown | d728bf5 | 2012-09-08 18:05:28 -0700 | [diff] [blame] | 213 | /** |
| 214 | * The touch attachment, per {@link DisplayViewport#touch}. |
| 215 | */ |
| 216 | public int touch; |
| 217 | |
Jeff Brown | 27f1d67 | 2012-10-17 18:32:34 -0700 | [diff] [blame] | 218 | /** |
| 219 | * The additional rotation to apply to all content presented on the display device |
| 220 | * relative to its physical coordinate system. Default is {@link Surface#ROTATION_0}. |
| 221 | * <p> |
| 222 | * This field can be used to compensate for the fact that the display has been |
| 223 | * physically rotated relative to its natural orientation such as an HDMI monitor |
| 224 | * that has been mounted sideways to appear to be portrait rather than landscape. |
| 225 | * </p> |
| 226 | */ |
| 227 | public int rotation = Surface.ROTATION_0; |
| 228 | |
Jeff Brown | 92130f6 | 2012-10-24 21:28:33 -0700 | [diff] [blame] | 229 | /** |
| 230 | * Display type. |
| 231 | */ |
| 232 | public int type; |
| 233 | |
| 234 | /** |
| 235 | * Display address, or null if none. |
| 236 | * Interpretation varies by display type. |
| 237 | */ |
| 238 | public String address; |
| 239 | |
Jeff Brown | a506a6e | 2013-06-04 00:02:38 -0700 | [diff] [blame] | 240 | /** |
Jeff Brown | 037c33e | 2014-04-09 00:31:55 -0700 | [diff] [blame] | 241 | * Display state. |
| 242 | */ |
| 243 | public int state = Display.STATE_ON; |
| 244 | |
| 245 | /** |
Jeff Brown | a506a6e | 2013-06-04 00:02:38 -0700 | [diff] [blame] | 246 | * The UID of the application that owns this display, or zero if it is owned by the system. |
| 247 | * <p> |
| 248 | * If the display is private, then only the owner can use it. |
| 249 | * </p> |
| 250 | */ |
| 251 | public int ownerUid; |
| 252 | |
| 253 | /** |
| 254 | * The package name of the application that owns this display, or null if it is |
| 255 | * owned by the system. |
| 256 | * <p> |
| 257 | * If the display is private, then only the owner can use it. |
| 258 | * </p> |
| 259 | */ |
| 260 | public String ownerPackageName; |
| 261 | |
Jeff Brown | cbad976 | 2012-09-04 21:57:59 -0700 | [diff] [blame] | 262 | public void setAssumedDensityForExternalDisplay(int width, int height) { |
| 263 | densityDpi = Math.min(width, height) * DisplayMetrics.DENSITY_XHIGH / 1080; |
| 264 | // Technically, these values should be smaller than the apparent density |
| 265 | // but we don't know the physical size of the display. |
| 266 | xDpi = densityDpi; |
| 267 | yDpi = densityDpi; |
| 268 | } |
| 269 | |
Jeff Brown | 4ed8fe7 | 2012-08-30 18:18:29 -0700 | [diff] [blame] | 270 | @Override |
| 271 | public boolean equals(Object o) { |
| 272 | return o instanceof DisplayDeviceInfo && equals((DisplayDeviceInfo)o); |
| 273 | } |
| 274 | |
| 275 | public boolean equals(DisplayDeviceInfo other) { |
Jeff Brown | 10acf6d | 2015-04-14 14:20:47 -0700 | [diff] [blame] | 276 | return other != null && diff(other) == 0; |
| 277 | } |
| 278 | |
| 279 | /** |
| 280 | * Computes the difference between display device infos. |
| 281 | * Assumes other is not null. |
| 282 | */ |
| 283 | public int diff(DisplayDeviceInfo other) { |
| 284 | int diff = 0; |
| 285 | if (state != other.state) { |
| 286 | diff |= DIFF_STATE; |
| 287 | } |
Michael Wright | 1c9977b | 2016-07-12 13:30:10 -0700 | [diff] [blame] | 288 | if (colorMode != other.colorMode) { |
| 289 | diff |= DIFF_COLOR_MODE; |
| 290 | } |
Jeff Brown | 10acf6d | 2015-04-14 14:20:47 -0700 | [diff] [blame] | 291 | if (!Objects.equal(name, other.name) |
| 292 | || !Objects.equal(uniqueId, other.uniqueId) |
| 293 | || width != other.width |
| 294 | || height != other.height |
P.Y. Laligand | b3b9eb3 | 2015-05-11 15:02:07 -0700 | [diff] [blame] | 295 | || modeId != other.modeId |
| 296 | || defaultModeId != other.defaultModeId |
| 297 | || !Arrays.equals(supportedModes, other.supportedModes) |
Michael Wright | 1c9977b | 2016-07-12 13:30:10 -0700 | [diff] [blame] | 298 | || !Arrays.equals(supportedColorModes, other.supportedColorModes) |
Michael Wright | 9ff94c0 | 2016-03-30 18:05:40 -0700 | [diff] [blame] | 299 | || !Objects.equal(hdrCapabilities, other.hdrCapabilities) |
Jeff Brown | 10acf6d | 2015-04-14 14:20:47 -0700 | [diff] [blame] | 300 | || densityDpi != other.densityDpi |
| 301 | || xDpi != other.xDpi |
| 302 | || yDpi != other.yDpi |
| 303 | || appVsyncOffsetNanos != other.appVsyncOffsetNanos |
| 304 | || presentationDeadlineNanos != other.presentationDeadlineNanos |
| 305 | || flags != other.flags |
| 306 | || touch != other.touch |
| 307 | || rotation != other.rotation |
| 308 | || type != other.type |
| 309 | || !Objects.equal(address, other.address) |
| 310 | || ownerUid != other.ownerUid |
| 311 | || !Objects.equal(ownerPackageName, other.ownerPackageName)) { |
| 312 | diff |= DIFF_OTHER; |
| 313 | } |
| 314 | return diff; |
Jeff Brown | 4ed8fe7 | 2012-08-30 18:18:29 -0700 | [diff] [blame] | 315 | } |
| 316 | |
| 317 | @Override |
| 318 | public int hashCode() { |
| 319 | return 0; // don't care |
| 320 | } |
| 321 | |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 322 | public void copyFrom(DisplayDeviceInfo other) { |
Jeff Brown | 848c2dc | 2012-08-19 20:18:08 -0700 | [diff] [blame] | 323 | name = other.name; |
Wale Ogunwale | 361ca21 | 2014-11-20 11:42:38 -0800 | [diff] [blame] | 324 | uniqueId = other.uniqueId; |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 325 | width = other.width; |
| 326 | height = other.height; |
P.Y. Laligand | b3b9eb3 | 2015-05-11 15:02:07 -0700 | [diff] [blame] | 327 | modeId = other.modeId; |
| 328 | defaultModeId = other.defaultModeId; |
| 329 | supportedModes = other.supportedModes; |
Michael Wright | 1c9977b | 2016-07-12 13:30:10 -0700 | [diff] [blame] | 330 | colorMode = other.colorMode; |
| 331 | supportedColorModes = other.supportedColorModes; |
Michael Wright | 9ff94c0 | 2016-03-30 18:05:40 -0700 | [diff] [blame] | 332 | hdrCapabilities = other.hdrCapabilities; |
Dianne Hackborn | 908aecc | 2012-07-31 16:37:34 -0700 | [diff] [blame] | 333 | densityDpi = other.densityDpi; |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 334 | xDpi = other.xDpi; |
| 335 | yDpi = other.yDpi; |
Andy McFadden | e8b1aeb | 2014-06-13 14:05:40 -0700 | [diff] [blame] | 336 | appVsyncOffsetNanos = other.appVsyncOffsetNanos; |
| 337 | presentationDeadlineNanos = other.presentationDeadlineNanos; |
Jeff Brown | bd6e150 | 2012-08-28 03:27:37 -0700 | [diff] [blame] | 338 | flags = other.flags; |
Jeff Brown | d728bf5 | 2012-09-08 18:05:28 -0700 | [diff] [blame] | 339 | touch = other.touch; |
Jeff Brown | 27f1d67 | 2012-10-17 18:32:34 -0700 | [diff] [blame] | 340 | rotation = other.rotation; |
Jeff Brown | 92130f6 | 2012-10-24 21:28:33 -0700 | [diff] [blame] | 341 | type = other.type; |
| 342 | address = other.address; |
Jeff Brown | 037c33e | 2014-04-09 00:31:55 -0700 | [diff] [blame] | 343 | state = other.state; |
Jeff Brown | a506a6e | 2013-06-04 00:02:38 -0700 | [diff] [blame] | 344 | ownerUid = other.ownerUid; |
| 345 | ownerPackageName = other.ownerPackageName; |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 346 | } |
| 347 | |
Jeff Brown | 848c2dc | 2012-08-19 20:18:08 -0700 | [diff] [blame] | 348 | // For debugging purposes |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 349 | @Override |
| 350 | public String toString() { |
Jeff Brown | a506a6e | 2013-06-04 00:02:38 -0700 | [diff] [blame] | 351 | StringBuilder sb = new StringBuilder(); |
| 352 | sb.append("DisplayDeviceInfo{\""); |
Wale Ogunwale | 361ca21 | 2014-11-20 11:42:38 -0800 | [diff] [blame] | 353 | sb.append(name).append("\": uniqueId=\"").append(uniqueId).append("\", "); |
| 354 | sb.append(width).append(" x ").append(height); |
P.Y. Laligand | b3b9eb3 | 2015-05-11 15:02:07 -0700 | [diff] [blame] | 355 | sb.append(", modeId ").append(modeId); |
| 356 | sb.append(", defaultModeId ").append(defaultModeId); |
| 357 | sb.append(", supportedModes ").append(Arrays.toString(supportedModes)); |
Michael Wright | 1c9977b | 2016-07-12 13:30:10 -0700 | [diff] [blame] | 358 | sb.append(", colorMode ").append(colorMode); |
| 359 | sb.append(", supportedColorModes ").append(Arrays.toString(supportedColorModes)); |
Michael Wright | 9ff94c0 | 2016-03-30 18:05:40 -0700 | [diff] [blame] | 360 | sb.append(", HdrCapabilities ").append(hdrCapabilities); |
Michael Wright | 3f145a2 | 2014-07-22 19:46:03 -0700 | [diff] [blame] | 361 | sb.append(", density ").append(densityDpi); |
Jeff Brown | a506a6e | 2013-06-04 00:02:38 -0700 | [diff] [blame] | 362 | sb.append(", ").append(xDpi).append(" x ").append(yDpi).append(" dpi"); |
Andy McFadden | e8b1aeb | 2014-06-13 14:05:40 -0700 | [diff] [blame] | 363 | sb.append(", appVsyncOff ").append(appVsyncOffsetNanos); |
| 364 | sb.append(", presDeadline ").append(presentationDeadlineNanos); |
Jeff Brown | a506a6e | 2013-06-04 00:02:38 -0700 | [diff] [blame] | 365 | sb.append(", touch ").append(touchToString(touch)); |
| 366 | sb.append(", rotation ").append(rotation); |
| 367 | sb.append(", type ").append(Display.typeToString(type)); |
| 368 | if (address != null) { |
| 369 | sb.append(", address ").append(address); |
| 370 | } |
Jeff Brown | 037c33e | 2014-04-09 00:31:55 -0700 | [diff] [blame] | 371 | sb.append(", state ").append(Display.stateToString(state)); |
Jeff Brown | a506a6e | 2013-06-04 00:02:38 -0700 | [diff] [blame] | 372 | if (ownerUid != 0 || ownerPackageName != null) { |
| 373 | sb.append(", owner ").append(ownerPackageName); |
| 374 | sb.append(" (uid ").append(ownerUid).append(")"); |
| 375 | } |
| 376 | sb.append(flagsToString(flags)); |
| 377 | sb.append("}"); |
| 378 | return sb.toString(); |
Jeff Brown | d728bf5 | 2012-09-08 18:05:28 -0700 | [diff] [blame] | 379 | } |
| 380 | |
| 381 | private static String touchToString(int touch) { |
| 382 | switch (touch) { |
| 383 | case TOUCH_NONE: |
| 384 | return "NONE"; |
| 385 | case TOUCH_INTERNAL: |
| 386 | return "INTERNAL"; |
| 387 | case TOUCH_EXTERNAL: |
| 388 | return "EXTERNAL"; |
| 389 | default: |
| 390 | return Integer.toString(touch); |
| 391 | } |
Jeff Brown | bd6e150 | 2012-08-28 03:27:37 -0700 | [diff] [blame] | 392 | } |
| 393 | |
| 394 | private static String flagsToString(int flags) { |
| 395 | StringBuilder msg = new StringBuilder(); |
| 396 | if ((flags & FLAG_DEFAULT_DISPLAY) != 0) { |
| 397 | msg.append(", FLAG_DEFAULT_DISPLAY"); |
| 398 | } |
Jeff Brown | 27f1d67 | 2012-10-17 18:32:34 -0700 | [diff] [blame] | 399 | if ((flags & FLAG_ROTATES_WITH_CONTENT) != 0) { |
| 400 | msg.append(", FLAG_ROTATES_WITH_CONTENT"); |
Jeff Brown | c5df37c | 2012-09-13 11:45:07 -0700 | [diff] [blame] | 401 | } |
Jeff Brown | 77aebfd | 2012-10-01 21:07:03 -0700 | [diff] [blame] | 402 | if ((flags & FLAG_SECURE) != 0) { |
| 403 | msg.append(", FLAG_SECURE"); |
| 404 | } |
| 405 | if ((flags & FLAG_SUPPORTS_PROTECTED_BUFFERS) != 0) { |
| 406 | msg.append(", FLAG_SUPPORTS_PROTECTED_BUFFERS"); |
Jeff Brown | bd6e150 | 2012-08-28 03:27:37 -0700 | [diff] [blame] | 407 | } |
Jeff Brown | a506a6e | 2013-06-04 00:02:38 -0700 | [diff] [blame] | 408 | if ((flags & FLAG_PRIVATE) != 0) { |
| 409 | msg.append(", FLAG_PRIVATE"); |
| 410 | } |
| 411 | if ((flags & FLAG_NEVER_BLANK) != 0) { |
| 412 | msg.append(", FLAG_NEVER_BLANK"); |
| 413 | } |
Jeff Brown | 7d00aff | 2013-08-02 19:03:49 -0700 | [diff] [blame] | 414 | if ((flags & FLAG_PRESENTATION) != 0) { |
| 415 | msg.append(", FLAG_PRESENTATION"); |
| 416 | } |
Jeff Brown | d14c8c9 | 2014-01-07 18:13:09 -0800 | [diff] [blame] | 417 | if ((flags & FLAG_OWN_CONTENT_ONLY) != 0) { |
| 418 | msg.append(", FLAG_OWN_CONTENT_ONLY"); |
| 419 | } |
Adam Powell | 49e7ff9 | 2015-05-14 16:18:53 -0700 | [diff] [blame] | 420 | if ((flags & FLAG_ROUND) != 0) { |
| 421 | msg.append(", FLAG_ROUND"); |
| 422 | } |
Jeff Brown | bd6e150 | 2012-08-28 03:27:37 -0700 | [diff] [blame] | 423 | return msg.toString(); |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 424 | } |
| 425 | } |