blob: a947b41067941c0e45548e142d6c249f5ed34a4d [file] [log] [blame]
Jeff Brown4ed8fe72012-08-30 18:18:29 -07001/*
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
17package com.android.server.display;
18
19import android.graphics.Rect;
Jeff Brownc5df37c2012-09-13 11:45:07 -070020import android.view.Display;
Jeff Brown4ed8fe72012-08-30 18:18:29 -070021import android.view.DisplayInfo;
22import android.view.Surface;
23
24import java.io.PrintWriter;
Michael Wright3f145a22014-07-22 19:46:03 -070025import java.util.Arrays;
Jeff Brown4ed8fe72012-08-30 18:18:29 -070026import java.util.List;
27
28import libcore.util.Objects;
29
30/**
31 * Describes how a logical display is configured.
32 * <p>
33 * At this time, we only support logical displays that are coupled to a particular
34 * primary display device from which the logical display derives its basic properties
35 * such as its size, density and refresh rate.
36 * </p><p>
37 * A logical display may be mirrored onto multiple display devices in addition to its
38 * primary display device. Note that the contents of a logical display may not
39 * always be visible, even on its primary display device, such as in the case where
40 * the primary display device is currently mirroring content from a different
41 * logical display.
42 * </p><p>
43 * This object is designed to encapsulate as much of the policy of logical
44 * displays as possible. The idea is to make it easy to implement new kinds of
45 * logical displays mostly by making local changes to this class.
46 * </p><p>
47 * Note: The display manager architecture does not actually require logical displays
48 * to be associated with any individual display device. Logical displays and
49 * display devices are orthogonal concepts. Some mapping will exist between
50 * logical displays and display devices but it can be many-to-many and
51 * and some might have no relation at all.
52 * </p><p>
53 * Logical displays are guarded by the {@link DisplayManagerService.SyncRoot} lock.
54 * </p>
55 */
56final class LogicalDisplay {
57 private final DisplayInfo mBaseDisplayInfo = new DisplayInfo();
58
Jeff Brown8ec09432012-10-16 16:19:23 -070059 // The layer stack we use when the display has been blanked to prevent any
60 // of its content from appearing.
61 private static final int BLANK_LAYER_STACK = -1;
62
Jeff Brownd728bf52012-09-08 18:05:28 -070063 private final int mDisplayId;
Jeff Brown4ed8fe72012-08-30 18:18:29 -070064 private final int mLayerStack;
65 private DisplayInfo mOverrideDisplayInfo; // set by the window manager
66 private DisplayInfo mInfo;
67
68 // The display device that this logical display is based on and which
69 // determines the base metrics that it uses.
70 private DisplayDevice mPrimaryDisplayDevice;
71 private DisplayDeviceInfo mPrimaryDisplayDeviceInfo;
72
Craig Mautner722285e2012-09-07 13:55:58 -070073 // True if the logical display has unique content.
74 private boolean mHasContent;
75
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -070076 private int mRequestedModeId;
Michael Wright1c9977b2016-07-12 13:30:10 -070077 private int mRequestedColorMode;
Michael Wright3f145a22014-07-22 19:46:03 -070078
Filip Gruszczynskid2e86402015-02-19 13:05:03 -080079 // The display offsets to apply to the display projection.
80 private int mDisplayOffsetX;
81 private int mDisplayOffsetY;
82
Jeff Brown4ed8fe72012-08-30 18:18:29 -070083 // Temporary rectangle used when needed.
Mathias Agopian63f1c432012-09-04 19:29:13 -070084 private final Rect mTempLayerStackRect = new Rect();
85 private final Rect mTempDisplayRect = new Rect();
Jeff Brown4ed8fe72012-08-30 18:18:29 -070086
Jeff Brownd728bf52012-09-08 18:05:28 -070087 public LogicalDisplay(int displayId, int layerStack, DisplayDevice primaryDisplayDevice) {
88 mDisplayId = displayId;
Jeff Brown4ed8fe72012-08-30 18:18:29 -070089 mLayerStack = layerStack;
90 mPrimaryDisplayDevice = primaryDisplayDevice;
91 }
92
93 /**
Jeff Brownd728bf52012-09-08 18:05:28 -070094 * Gets the logical display id of this logical display.
95 *
96 * @return The logical display id.
97 */
98 public int getDisplayIdLocked() {
99 return mDisplayId;
100 }
101
102 /**
Jeff Brown4ed8fe72012-08-30 18:18:29 -0700103 * Gets the primary display device associated with this logical display.
104 *
105 * @return The primary display device.
106 */
107 public DisplayDevice getPrimaryDisplayDeviceLocked() {
108 return mPrimaryDisplayDevice;
109 }
110
111 /**
112 * Gets information about the logical display.
113 *
114 * @return The device info, which should be treated as immutable by the caller.
115 * The logical display should allocate a new display info object whenever
116 * the data changes.
117 */
118 public DisplayInfo getDisplayInfoLocked() {
119 if (mInfo == null) {
120 mInfo = new DisplayInfo();
P.Y. Laliganded896d42015-05-12 10:43:38 -0700121 mInfo.copyFrom(mBaseDisplayInfo);
Jeff Brown4ed8fe72012-08-30 18:18:29 -0700122 if (mOverrideDisplayInfo != null) {
P.Y. Laliganded896d42015-05-12 10:43:38 -0700123 mInfo.appWidth = mOverrideDisplayInfo.appWidth;
124 mInfo.appHeight = mOverrideDisplayInfo.appHeight;
125 mInfo.smallestNominalAppWidth = mOverrideDisplayInfo.smallestNominalAppWidth;
126 mInfo.smallestNominalAppHeight = mOverrideDisplayInfo.smallestNominalAppHeight;
127 mInfo.largestNominalAppWidth = mOverrideDisplayInfo.largestNominalAppWidth;
128 mInfo.largestNominalAppHeight = mOverrideDisplayInfo.largestNominalAppHeight;
129 mInfo.logicalWidth = mOverrideDisplayInfo.logicalWidth;
130 mInfo.logicalHeight = mOverrideDisplayInfo.logicalHeight;
131 mInfo.overscanLeft = mOverrideDisplayInfo.overscanLeft;
132 mInfo.overscanTop = mOverrideDisplayInfo.overscanTop;
133 mInfo.overscanRight = mOverrideDisplayInfo.overscanRight;
134 mInfo.overscanBottom = mOverrideDisplayInfo.overscanBottom;
135 mInfo.rotation = mOverrideDisplayInfo.rotation;
136 mInfo.logicalDensityDpi = mOverrideDisplayInfo.logicalDensityDpi;
Jeff Brownfe4ad332015-06-09 18:26:31 -0700137 mInfo.physicalXDpi = mOverrideDisplayInfo.physicalXDpi;
138 mInfo.physicalYDpi = mOverrideDisplayInfo.physicalYDpi;
Jeff Brown4ed8fe72012-08-30 18:18:29 -0700139 }
140 }
141 return mInfo;
142 }
143
144 /**
145 * Sets overridden logical display information from the window manager.
146 * This method can be used to adjust application insets, rotation, and other
147 * properties that the window manager takes care of.
148 *
149 * @param info The logical display information, may be null.
150 */
Jeff Brownef981a42013-08-07 14:13:37 -0700151 public boolean setDisplayInfoOverrideFromWindowManagerLocked(DisplayInfo info) {
Jeff Brown4ed8fe72012-08-30 18:18:29 -0700152 if (info != null) {
153 if (mOverrideDisplayInfo == null) {
154 mOverrideDisplayInfo = new DisplayInfo(info);
155 mInfo = null;
Jeff Brownef981a42013-08-07 14:13:37 -0700156 return true;
157 }
158 if (!mOverrideDisplayInfo.equals(info)) {
Jeff Brown4ed8fe72012-08-30 18:18:29 -0700159 mOverrideDisplayInfo.copyFrom(info);
160 mInfo = null;
Jeff Brownef981a42013-08-07 14:13:37 -0700161 return true;
Jeff Brown4ed8fe72012-08-30 18:18:29 -0700162 }
163 } else if (mOverrideDisplayInfo != null) {
164 mOverrideDisplayInfo = null;
165 mInfo = null;
Jeff Brownef981a42013-08-07 14:13:37 -0700166 return true;
Jeff Brown4ed8fe72012-08-30 18:18:29 -0700167 }
Jeff Brownef981a42013-08-07 14:13:37 -0700168 return false;
Dianne Hackbornc652de82013-02-15 16:32:56 -0800169 }
170
Jeff Brown4ed8fe72012-08-30 18:18:29 -0700171 /**
172 * Returns true if the logical display is in a valid state.
Craig Mautner722285e2012-09-07 13:55:58 -0700173 * This method should be checked after calling {@link #updateLocked} to handle the
Jeff Brown4ed8fe72012-08-30 18:18:29 -0700174 * case where a logical display should be removed because all of its associated
175 * display devices are gone or if it is otherwise no longer needed.
176 *
177 * @return True if the logical display is still valid.
178 */
179 public boolean isValidLocked() {
180 return mPrimaryDisplayDevice != null;
181 }
182
183 /**
184 * Updates the state of the logical display based on the available display devices.
185 * The logical display might become invalid if it is attached to a display device
186 * that no longer exists.
187 *
188 * @param devices The list of all connected display devices.
189 */
190 public void updateLocked(List<DisplayDevice> devices) {
191 // Nothing to update if already invalid.
192 if (mPrimaryDisplayDevice == null) {
193 return;
194 }
195
196 // Check whether logical display has become invalid.
197 if (!devices.contains(mPrimaryDisplayDevice)) {
198 mPrimaryDisplayDevice = null;
199 return;
200 }
201
202 // Bootstrap the logical display using its associated primary physical display.
203 // We might use more elaborate configurations later. It's possible that the
204 // configuration of several physical displays might be used to determine the
205 // logical display that they are sharing. (eg. Adjust size for pixel-perfect
206 // mirroring over HDMI.)
207 DisplayDeviceInfo deviceInfo = mPrimaryDisplayDevice.getDisplayDeviceInfoLocked();
208 if (!Objects.equal(mPrimaryDisplayDeviceInfo, deviceInfo)) {
209 mBaseDisplayInfo.layerStack = mLayerStack;
Jeff Brownc5df37c2012-09-13 11:45:07 -0700210 mBaseDisplayInfo.flags = 0;
Jeff Brown77aebfd2012-10-01 21:07:03 -0700211 if ((deviceInfo.flags & DisplayDeviceInfo.FLAG_SUPPORTS_PROTECTED_BUFFERS) != 0) {
212 mBaseDisplayInfo.flags |= Display.FLAG_SUPPORTS_PROTECTED_BUFFERS;
Jeff Brownc5df37c2012-09-13 11:45:07 -0700213 }
Jeff Brownf0681b32012-10-23 17:35:57 -0700214 if ((deviceInfo.flags & DisplayDeviceInfo.FLAG_SECURE) != 0) {
215 mBaseDisplayInfo.flags |= Display.FLAG_SECURE;
216 }
Jeff Browna506a6e2013-06-04 00:02:38 -0700217 if ((deviceInfo.flags & DisplayDeviceInfo.FLAG_PRIVATE) != 0) {
218 mBaseDisplayInfo.flags |= Display.FLAG_PRIVATE;
Andrii Kulian250d6532017-02-08 23:30:45 -0800219 // For private displays by default content is destroyed on removal.
220 mBaseDisplayInfo.removeMode = Display.REMOVE_MODE_DESTROY_CONTENT;
Jeff Browna506a6e2013-06-04 00:02:38 -0700221 }
Jeff Brown7d00aff2013-08-02 19:03:49 -0700222 if ((deviceInfo.flags & DisplayDeviceInfo.FLAG_PRESENTATION) != 0) {
223 mBaseDisplayInfo.flags |= Display.FLAG_PRESENTATION;
224 }
Adam Powell49e7ff92015-05-14 16:18:53 -0700225 if ((deviceInfo.flags & DisplayDeviceInfo.FLAG_ROUND) != 0) {
226 mBaseDisplayInfo.flags |= Display.FLAG_ROUND;
227 }
Andrii Kulian7211d2e2017-01-27 15:58:05 -0800228 if ((deviceInfo.flags & DisplayDeviceInfo.FLAG_CAN_SHOW_WITH_INSECURE_KEYGUARD) != 0) {
229 mBaseDisplayInfo.flags |= Display.FLAG_CAN_SHOW_WITH_INSECURE_KEYGUARD;
Andrii Kulianfc8f82b2017-01-26 13:17:27 -0800230 }
Jeff Brown92130f62012-10-24 21:28:33 -0700231 mBaseDisplayInfo.type = deviceInfo.type;
232 mBaseDisplayInfo.address = deviceInfo.address;
Jeff Brown4ed8fe72012-08-30 18:18:29 -0700233 mBaseDisplayInfo.name = deviceInfo.name;
Wale Ogunwale361ca212014-11-20 11:42:38 -0800234 mBaseDisplayInfo.uniqueId = deviceInfo.uniqueId;
Jeff Brown4ed8fe72012-08-30 18:18:29 -0700235 mBaseDisplayInfo.appWidth = deviceInfo.width;
236 mBaseDisplayInfo.appHeight = deviceInfo.height;
237 mBaseDisplayInfo.logicalWidth = deviceInfo.width;
238 mBaseDisplayInfo.logicalHeight = deviceInfo.height;
239 mBaseDisplayInfo.rotation = Surface.ROTATION_0;
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700240 mBaseDisplayInfo.modeId = deviceInfo.modeId;
241 mBaseDisplayInfo.defaultModeId = deviceInfo.defaultModeId;
242 mBaseDisplayInfo.supportedModes = Arrays.copyOf(
243 deviceInfo.supportedModes, deviceInfo.supportedModes.length);
Michael Wright1c9977b2016-07-12 13:30:10 -0700244 mBaseDisplayInfo.colorMode = deviceInfo.colorMode;
245 mBaseDisplayInfo.supportedColorModes = Arrays.copyOf(
246 deviceInfo.supportedColorModes,
247 deviceInfo.supportedColorModes.length);
Michael Wright9ff94c02016-03-30 18:05:40 -0700248 mBaseDisplayInfo.hdrCapabilities = deviceInfo.hdrCapabilities;
Jeff Brown4ed8fe72012-08-30 18:18:29 -0700249 mBaseDisplayInfo.logicalDensityDpi = deviceInfo.densityDpi;
250 mBaseDisplayInfo.physicalXDpi = deviceInfo.xDpi;
251 mBaseDisplayInfo.physicalYDpi = deviceInfo.yDpi;
Andy McFaddene8b1aeb2014-06-13 14:05:40 -0700252 mBaseDisplayInfo.appVsyncOffsetNanos = deviceInfo.appVsyncOffsetNanos;
253 mBaseDisplayInfo.presentationDeadlineNanos = deviceInfo.presentationDeadlineNanos;
Jeff Brown037c33e2014-04-09 00:31:55 -0700254 mBaseDisplayInfo.state = deviceInfo.state;
Jeff Brown4ed8fe72012-08-30 18:18:29 -0700255 mBaseDisplayInfo.smallestNominalAppWidth = deviceInfo.width;
256 mBaseDisplayInfo.smallestNominalAppHeight = deviceInfo.height;
257 mBaseDisplayInfo.largestNominalAppWidth = deviceInfo.width;
258 mBaseDisplayInfo.largestNominalAppHeight = deviceInfo.height;
Jeff Browna506a6e2013-06-04 00:02:38 -0700259 mBaseDisplayInfo.ownerUid = deviceInfo.ownerUid;
260 mBaseDisplayInfo.ownerPackageName = deviceInfo.ownerPackageName;
Jeff Brown4ed8fe72012-08-30 18:18:29 -0700261
262 mPrimaryDisplayDeviceInfo = deviceInfo;
263 mInfo = null;
264 }
265 }
266
267 /**
268 * Applies the layer stack and transformation to the given display device
269 * so that it shows the contents of this logical display.
270 *
271 * We know that the given display device is only ever showing the contents of
272 * a single logical display, so this method is expected to blow away all of its
273 * transformation properties to make it happen regardless of what the
274 * display device was previously showing.
275 *
276 * The caller must have an open Surface transaction.
277 *
278 * The display device may not be the primary display device, in the case
279 * where the display is being mirrored.
280 *
281 * @param device The display device to modify.
Jeff Brown8ec09432012-10-16 16:19:23 -0700282 * @param isBlanked True if the device is being blanked.
Jeff Brown4ed8fe72012-08-30 18:18:29 -0700283 */
Jeff Brown8ec09432012-10-16 16:19:23 -0700284 public void configureDisplayInTransactionLocked(DisplayDevice device,
285 boolean isBlanked) {
Jeff Brown4ed8fe72012-08-30 18:18:29 -0700286 // Set the layer stack.
Jeff Brown8ec09432012-10-16 16:19:23 -0700287 device.setLayerStackInTransactionLocked(isBlanked ? BLANK_LAYER_STACK : mLayerStack);
Jeff Brown4ed8fe72012-08-30 18:18:29 -0700288
Michael Wright1c9977b2016-07-12 13:30:10 -0700289 // Set the color mode and mode.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700290 if (device == mPrimaryDisplayDevice) {
Michael Wright1c9977b2016-07-12 13:30:10 -0700291 device.requestDisplayModesInTransactionLocked(
292 mRequestedColorMode, mRequestedModeId);
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700293 } else {
Michael Wright1c9977b2016-07-12 13:30:10 -0700294 device.requestDisplayModesInTransactionLocked(0, 0); // Revert to default.
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700295 }
296
297 // Only grab the display info now as it may have been changed based on the requests above.
298 final DisplayInfo displayInfo = getDisplayInfoLocked();
299 final DisplayDeviceInfo displayDeviceInfo = device.getDisplayDeviceInfoLocked();
Michael Wright3f145a22014-07-22 19:46:03 -0700300
Jeff Brown4ed8fe72012-08-30 18:18:29 -0700301 // Set the viewport.
302 // This is the area of the logical display that we intend to show on the
303 // display device. For now, it is always the full size of the logical display.
Mathias Agopian63f1c432012-09-04 19:29:13 -0700304 mTempLayerStackRect.set(0, 0, displayInfo.logicalWidth, displayInfo.logicalHeight);
Jeff Brown4ed8fe72012-08-30 18:18:29 -0700305
306 // Set the orientation.
307 // The orientation specifies how the physical coordinate system of the display
308 // is rotated when the contents of the logical display are rendered.
309 int orientation = Surface.ROTATION_0;
Scott Anderson8786ed92013-11-01 13:27:39 -0700310 if ((displayDeviceInfo.flags & DisplayDeviceInfo.FLAG_ROTATES_WITH_CONTENT) != 0) {
Jeff Brown4ed8fe72012-08-30 18:18:29 -0700311 orientation = displayInfo.rotation;
312 }
Jeff Brown4ed8fe72012-08-30 18:18:29 -0700313
Jeff Brown27f1d672012-10-17 18:32:34 -0700314 // Apply the physical rotation of the display device itself.
315 orientation = (orientation + displayDeviceInfo.rotation) % 4;
316
Jeff Brown4ed8fe72012-08-30 18:18:29 -0700317 // Set the frame.
318 // The frame specifies the rotated physical coordinates into which the viewport
319 // is mapped. We need to take care to preserve the aspect ratio of the viewport.
320 // Currently we maximize the area to fill the display, but we could try to be
321 // more clever and match resolutions.
322 boolean rotated = (orientation == Surface.ROTATION_90
323 || orientation == Surface.ROTATION_270);
324 int physWidth = rotated ? displayDeviceInfo.height : displayDeviceInfo.width;
325 int physHeight = rotated ? displayDeviceInfo.width : displayDeviceInfo.height;
326
327 // Determine whether the width or height is more constrained to be scaled.
328 // physWidth / displayInfo.logicalWidth => letter box
329 // or physHeight / displayInfo.logicalHeight => pillar box
330 //
331 // We avoid a division (and possible floating point imprecision) here by
332 // multiplying the fractions by the product of their denominators before
333 // comparing them.
Mathias Agopian63f1c432012-09-04 19:29:13 -0700334 int displayRectWidth, displayRectHeight;
Jeff Brownd46747a2015-04-15 19:02:36 -0700335 if ((displayInfo.flags & Display.FLAG_SCALING_DISABLED) != 0) {
336 displayRectWidth = displayInfo.logicalWidth;
337 displayRectHeight = displayInfo.logicalHeight;
338 } else if (physWidth * displayInfo.logicalHeight
Jeff Brown4ed8fe72012-08-30 18:18:29 -0700339 < physHeight * displayInfo.logicalWidth) {
340 // Letter box.
Mathias Agopian63f1c432012-09-04 19:29:13 -0700341 displayRectWidth = physWidth;
342 displayRectHeight = displayInfo.logicalHeight * physWidth / displayInfo.logicalWidth;
Jeff Brown4ed8fe72012-08-30 18:18:29 -0700343 } else {
344 // Pillar box.
Mathias Agopian63f1c432012-09-04 19:29:13 -0700345 displayRectWidth = displayInfo.logicalWidth * physHeight / displayInfo.logicalHeight;
346 displayRectHeight = physHeight;
Jeff Brown4ed8fe72012-08-30 18:18:29 -0700347 }
Mathias Agopian63f1c432012-09-04 19:29:13 -0700348 int displayRectTop = (physHeight - displayRectHeight) / 2;
349 int displayRectLeft = (physWidth - displayRectWidth) / 2;
350 mTempDisplayRect.set(displayRectLeft, displayRectTop,
351 displayRectLeft + displayRectWidth, displayRectTop + displayRectHeight);
352
Filip Gruszczynskid2e86402015-02-19 13:05:03 -0800353 mTempDisplayRect.left += mDisplayOffsetX;
354 mTempDisplayRect.right += mDisplayOffsetX;
355 mTempDisplayRect.top += mDisplayOffsetY;
356 mTempDisplayRect.bottom += mDisplayOffsetY;
Mathias Agopian63f1c432012-09-04 19:29:13 -0700357 device.setProjectionInTransactionLocked(orientation, mTempLayerStackRect, mTempDisplayRect);
Jeff Brown4ed8fe72012-08-30 18:18:29 -0700358 }
359
Craig Mautner722285e2012-09-07 13:55:58 -0700360 /**
361 * Returns true if the logical display has unique content.
362 * <p>
363 * If the display has unique content then we will try to ensure that it is
364 * visible on at least its primary display device. Otherwise we will ignore the
365 * logical display and perhaps show mirrored content on the primary display device.
366 * </p>
367 *
368 * @return True if the display has unique content.
369 */
370 public boolean hasContentLocked() {
371 return mHasContent;
372 }
373
374 /**
375 * Sets whether the logical display has unique content.
376 *
377 * @param hasContent True if the display has unique content.
378 */
379 public void setHasContentLocked(boolean hasContent) {
380 mHasContent = hasContent;
381 }
382
Michael Wright3f145a22014-07-22 19:46:03 -0700383 /**
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700384 * Requests the given mode.
Michael Wright3f145a22014-07-22 19:46:03 -0700385 */
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700386 public void setRequestedModeIdLocked(int modeId) {
387 mRequestedModeId = modeId;
Michael Wright3f145a22014-07-22 19:46:03 -0700388 }
389
390 /**
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700391 * Returns the pending requested mode.
Michael Wright3f145a22014-07-22 19:46:03 -0700392 */
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700393 public int getRequestedModeIdLocked() {
394 return mRequestedModeId;
Michael Wright3f145a22014-07-22 19:46:03 -0700395 }
396
Filip Gruszczynskid2e86402015-02-19 13:05:03 -0800397 /**
Michael Wright1c9977b2016-07-12 13:30:10 -0700398 * Requests the given color mode.
Michael Wright58e829f2015-09-15 00:13:26 +0100399 */
Michael Wright1c9977b2016-07-12 13:30:10 -0700400 public void setRequestedColorModeLocked(int colorMode) {
401 mRequestedColorMode = colorMode;
Michael Wright58e829f2015-09-15 00:13:26 +0100402 }
403
Michael Wright1c9977b2016-07-12 13:30:10 -0700404 /** Returns the pending requested color mode. */
405 public int getRequestedColorModeLocked() {
406 return mRequestedColorMode;
Michael Wright58e829f2015-09-15 00:13:26 +0100407 }
408
409 /**
Filip Gruszczynskid2e86402015-02-19 13:05:03 -0800410 * Gets the burn-in offset in X.
411 */
412 public int getDisplayOffsetXLocked() {
413 return mDisplayOffsetX;
414 }
415
416 /**
417 * Gets the burn-in offset in Y.
418 */
419 public int getDisplayOffsetYLocked() {
420 return mDisplayOffsetY;
421 }
422
423 /**
424 * Sets the burn-in offsets.
425 */
426 public void setDisplayOffsetsLocked(int x, int y) {
427 mDisplayOffsetX = x;
428 mDisplayOffsetY = y;
429 }
430
Jeff Brown4ed8fe72012-08-30 18:18:29 -0700431 public void dumpLocked(PrintWriter pw) {
Jeff Brownc2726642012-10-02 16:17:31 -0700432 pw.println("mDisplayId=" + mDisplayId);
Jeff Brown4ed8fe72012-08-30 18:18:29 -0700433 pw.println("mLayerStack=" + mLayerStack);
Jeff Brownc2726642012-10-02 16:17:31 -0700434 pw.println("mHasContent=" + mHasContent);
P.Y. Laligandb3b9eb32015-05-11 15:02:07 -0700435 pw.println("mRequestedMode=" + mRequestedModeId);
Michael Wright1c9977b2016-07-12 13:30:10 -0700436 pw.println("mRequestedColorMode=" + mRequestedColorMode);
Filip Gruszczynskid2e86402015-02-19 13:05:03 -0800437 pw.println("mDisplayOffset=(" + mDisplayOffsetX + ", " + mDisplayOffsetY + ")");
Jeff Brown4ed8fe72012-08-30 18:18:29 -0700438 pw.println("mPrimaryDisplayDevice=" + (mPrimaryDisplayDevice != null ?
439 mPrimaryDisplayDevice.getNameLocked() : "null"));
440 pw.println("mBaseDisplayInfo=" + mBaseDisplayInfo);
441 pw.println("mOverrideDisplayInfo=" + mOverrideDisplayInfo);
442 }
Michael Wrightc39d47a2014-07-08 18:07:36 -0700443}