The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2006 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.view; |
| 18 | |
Craig Mautner | 48d0d18 | 2013-06-11 07:53:06 -0700 | [diff] [blame] | 19 | import android.content.res.CompatibilityInfo; |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 20 | import android.graphics.PixelFormat; |
Dianne Hackborn | ac8dea1 | 2011-04-20 18:18:51 -0700 | [diff] [blame] | 21 | import android.graphics.Point; |
| 22 | import android.graphics.Rect; |
Jeff Brown | bd6e150 | 2012-08-28 03:27:37 -0700 | [diff] [blame] | 23 | import android.hardware.display.DisplayManagerGlobal; |
Jeff Brown | a506a6e | 2013-06-04 00:02:38 -0700 | [diff] [blame] | 24 | import android.os.Process; |
Dianne Hackborn | ac8dea1 | 2011-04-20 18:18:51 -0700 | [diff] [blame] | 25 | import android.os.SystemClock; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 26 | import android.util.DisplayMetrics; |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 27 | import android.util.Log; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 28 | |
Jeff Brown | bc68a59 | 2011-07-25 12:58:12 -0700 | [diff] [blame] | 29 | /** |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 30 | * Provides information about the size and density of a logical display. |
| 31 | * <p> |
| 32 | * The display area is described in two different ways. |
| 33 | * <ul> |
| 34 | * <li>The application display area specifies the part of the display that may contain |
| 35 | * an application window, excluding the system decorations. The application display area may |
| 36 | * be smaller than the real display area because the system subtracts the space needed |
| 37 | * for decor elements such as the status bar. Use the following methods to query the |
| 38 | * application display area: {@link #getSize}, {@link #getRectSize} and {@link #getMetrics}.</li> |
| 39 | * <li>The real display area specifies the part of the display that contains content |
| 40 | * including the system decorations. Even so, the real display area may be smaller than the |
| 41 | * physical size of the display if the window manager is emulating a smaller display |
| 42 | * using (adb shell am display-size). Use the following methods to query the |
| 43 | * real display area: {@link #getRealSize}, {@link #getRealMetrics}.</li> |
| 44 | * </ul> |
| 45 | * </p><p> |
| 46 | * A logical display does not necessarily represent a particular physical display device |
| 47 | * such as the built-in screen or an external monitor. The contents of a logical |
| 48 | * display may be presented on one or more physical displays according to the devices |
| 49 | * that are currently attached and whether mirroring has been enabled. |
| 50 | * </p> |
Jeff Brown | bc68a59 | 2011-07-25 12:58:12 -0700 | [diff] [blame] | 51 | */ |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 52 | public final class Display { |
| 53 | private static final String TAG = "Display"; |
Jeff Brown | bd6e150 | 2012-08-28 03:27:37 -0700 | [diff] [blame] | 54 | private static final boolean DEBUG = false; |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 55 | |
Jeff Brown | bd6e150 | 2012-08-28 03:27:37 -0700 | [diff] [blame] | 56 | private final DisplayManagerGlobal mGlobal; |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 57 | private final int mDisplayId; |
Jeff Brown | 4ed8fe7 | 2012-08-30 18:18:29 -0700 | [diff] [blame] | 58 | private final int mLayerStack; |
Jeff Brown | 92130f6 | 2012-10-24 21:28:33 -0700 | [diff] [blame] | 59 | private final int mFlags; |
| 60 | private final int mType; |
| 61 | private final String mAddress; |
Jeff Brown | a506a6e | 2013-06-04 00:02:38 -0700 | [diff] [blame] | 62 | private final int mOwnerUid; |
| 63 | private final String mOwnerPackageName; |
Craig Mautner | 48d0d18 | 2013-06-11 07:53:06 -0700 | [diff] [blame] | 64 | private final DisplayAdjustments mDisplayAdjustments; |
Jeff Brown | bd6e150 | 2012-08-28 03:27:37 -0700 | [diff] [blame] | 65 | |
| 66 | private DisplayInfo mDisplayInfo; // never null |
| 67 | private boolean mIsValid; |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 68 | |
| 69 | // Temporary display metrics structure used for compatibility mode. |
| 70 | private final DisplayMetrics mTempMetrics = new DisplayMetrics(); |
| 71 | |
| 72 | // We cache the app width and height properties briefly between calls |
| 73 | // to getHeight() and getWidth() to ensure that applications perceive |
| 74 | // consistent results when the size changes (most of the time). |
| 75 | // Applications should now be using getSize() instead. |
| 76 | private static final int CACHED_APP_SIZE_DURATION_MILLIS = 20; |
| 77 | private long mLastCachedAppSizeUpdate; |
| 78 | private int mCachedAppWidthCompat; |
| 79 | private int mCachedAppHeightCompat; |
Dianne Hackborn | 5fd2169 | 2011-06-07 14:09:47 -0700 | [diff] [blame] | 80 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 81 | /** |
Jeff Brown | 98365d7 | 2012-08-19 20:30:52 -0700 | [diff] [blame] | 82 | * The default Display id, which is the id of the built-in primary display |
| 83 | * assuming there is one. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 84 | */ |
| 85 | public static final int DEFAULT_DISPLAY = 0; |
| 86 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 87 | /** |
Jeff Brown | 77aebfd | 2012-10-01 21:07:03 -0700 | [diff] [blame] | 88 | * Display flag: Indicates that the display supports compositing content |
| 89 | * that is stored in protected graphics buffers. |
Jeff Brown | c5df37c | 2012-09-13 11:45:07 -0700 | [diff] [blame] | 90 | * <p> |
Jeff Brown | f0681b3 | 2012-10-23 17:35:57 -0700 | [diff] [blame] | 91 | * If this flag is set then the display device supports compositing protected buffers. |
| 92 | * </p><p> |
| 93 | * If this flag is not set then the display device may not support compositing |
| 94 | * protected buffers; the user may see a blank region on the screen instead of |
| 95 | * the protected content. |
| 96 | * </p><p> |
Jeff Brown | 77aebfd | 2012-10-01 21:07:03 -0700 | [diff] [blame] | 97 | * Secure (DRM) video decoders may allocate protected graphics buffers to request that |
| 98 | * a hardware-protected path be provided between the video decoder and the external |
| 99 | * display sink. If a hardware-protected path is not available, then content stored |
| 100 | * in protected graphics buffers may not be composited. |
Jeff Brown | c5df37c | 2012-09-13 11:45:07 -0700 | [diff] [blame] | 101 | * </p><p> |
Jeff Brown | f0681b3 | 2012-10-23 17:35:57 -0700 | [diff] [blame] | 102 | * An application can use the absence of this flag as a hint that it should not use protected |
| 103 | * buffers for this display because the content may not be visible. For example, |
| 104 | * if the flag is not set then the application may choose not to show content on this |
| 105 | * display, show an informative error message, select an alternate content stream |
| 106 | * or adopt a different strategy for decoding content that does not rely on |
| 107 | * protected buffers. |
Jeff Brown | c5df37c | 2012-09-13 11:45:07 -0700 | [diff] [blame] | 108 | * </p> |
Jeff Brown | f0681b3 | 2012-10-23 17:35:57 -0700 | [diff] [blame] | 109 | * |
| 110 | * @see #getFlags |
Jeff Brown | c5df37c | 2012-09-13 11:45:07 -0700 | [diff] [blame] | 111 | */ |
Jeff Brown | 77aebfd | 2012-10-01 21:07:03 -0700 | [diff] [blame] | 112 | public static final int FLAG_SUPPORTS_PROTECTED_BUFFERS = 1 << 0; |
Jeff Brown | c5df37c | 2012-09-13 11:45:07 -0700 | [diff] [blame] | 113 | |
| 114 | /** |
Jeff Brown | f0681b3 | 2012-10-23 17:35:57 -0700 | [diff] [blame] | 115 | * Display flag: Indicates that the display has a secure video output and |
| 116 | * supports compositing secure surfaces. |
| 117 | * <p> |
| 118 | * If this flag is set then the display device has a secure video output |
| 119 | * and is capable of showing secure surfaces. It may also be capable of |
| 120 | * showing {@link #FLAG_SUPPORTS_PROTECTED_BUFFERS protected buffers}. |
| 121 | * </p><p> |
| 122 | * If this flag is not set then the display device may not have a secure video |
| 123 | * output; the user may see a blank region on the screen instead of |
| 124 | * the contents of secure surfaces or protected buffers. |
| 125 | * </p><p> |
| 126 | * Secure surfaces are used to prevent content rendered into those surfaces |
| 127 | * by applications from appearing in screenshots or from being viewed |
| 128 | * on non-secure displays. Protected buffers are used by secure video decoders |
| 129 | * for a similar purpose. |
| 130 | * </p><p> |
| 131 | * An application creates a window with a secure surface by specifying the |
| 132 | * {@link WindowManager.LayoutParams#FLAG_SECURE} window flag. |
| 133 | * Likewise, an application creates a {@link SurfaceView} with a secure surface |
| 134 | * by calling {@link SurfaceView#setSecure} before attaching the secure view to |
| 135 | * its containing window. |
| 136 | * </p><p> |
| 137 | * An application can use the absence of this flag as a hint that it should not create |
| 138 | * secure surfaces or protected buffers on this display because the content may |
| 139 | * not be visible. For example, if the flag is not set then the application may |
| 140 | * choose not to show content on this display, show an informative error message, |
| 141 | * select an alternate content stream or adopt a different strategy for decoding |
| 142 | * content that does not rely on secure surfaces or protected buffers. |
| 143 | * </p> |
| 144 | * |
| 145 | * @see #getFlags |
| 146 | */ |
| 147 | public static final int FLAG_SECURE = 1 << 1; |
| 148 | |
| 149 | /** |
Jeff Brown | a506a6e | 2013-06-04 00:02:38 -0700 | [diff] [blame] | 150 | * Display flag: Indicates that the display is private. Only the application that |
| 151 | * owns the display can create windows on it. |
| 152 | * <p> |
| 153 | * This flag is associated with displays that were created using |
| 154 | * {@link android.hardware.display.DisplayManager#createPrivateVirtualDisplay}. |
| 155 | * </p> |
| 156 | * |
| 157 | * @see #getFlags |
| 158 | */ |
| 159 | public static final int FLAG_PRIVATE = 1 << 2; |
| 160 | |
| 161 | /** |
Jeff Brown | 92130f6 | 2012-10-24 21:28:33 -0700 | [diff] [blame] | 162 | * Display type: Unknown display type. |
| 163 | * @hide |
| 164 | */ |
| 165 | public static final int TYPE_UNKNOWN = 0; |
| 166 | |
| 167 | /** |
| 168 | * Display type: Built-in display. |
| 169 | * @hide |
| 170 | */ |
| 171 | public static final int TYPE_BUILT_IN = 1; |
| 172 | |
| 173 | /** |
| 174 | * Display type: HDMI display. |
| 175 | * @hide |
| 176 | */ |
| 177 | public static final int TYPE_HDMI = 2; |
| 178 | |
| 179 | /** |
| 180 | * Display type: WiFi display. |
| 181 | * @hide |
| 182 | */ |
| 183 | public static final int TYPE_WIFI = 3; |
| 184 | |
| 185 | /** |
| 186 | * Display type: Overlay display. |
| 187 | * @hide |
| 188 | */ |
| 189 | public static final int TYPE_OVERLAY = 4; |
| 190 | |
| 191 | /** |
Jeff Brown | a506a6e | 2013-06-04 00:02:38 -0700 | [diff] [blame] | 192 | * Display type: Virtual display. |
| 193 | * @hide |
| 194 | */ |
| 195 | public static final int TYPE_VIRTUAL = 5; |
| 196 | |
| 197 | /** |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 198 | * Internal method to create a display. |
| 199 | * Applications should use {@link android.view.WindowManager#getDefaultDisplay()} |
Jeff Brown | 98365d7 | 2012-08-19 20:30:52 -0700 | [diff] [blame] | 200 | * or {@link android.hardware.display.DisplayManager#getDisplay} |
| 201 | * to get a display object. |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 202 | * |
| 203 | * @hide |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 204 | */ |
Jeff Brown | bd6e150 | 2012-08-28 03:27:37 -0700 | [diff] [blame] | 205 | public Display(DisplayManagerGlobal global, |
| 206 | int displayId, DisplayInfo displayInfo /*not null*/, |
Craig Mautner | 48d0d18 | 2013-06-11 07:53:06 -0700 | [diff] [blame] | 207 | DisplayAdjustments daj) { |
Jeff Brown | bd6e150 | 2012-08-28 03:27:37 -0700 | [diff] [blame] | 208 | mGlobal = global; |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 209 | mDisplayId = displayId; |
Jeff Brown | bd6e150 | 2012-08-28 03:27:37 -0700 | [diff] [blame] | 210 | mDisplayInfo = displayInfo; |
Craig Mautner | 1abaa53 | 2013-06-28 12:03:32 -0700 | [diff] [blame] | 211 | mDisplayAdjustments = new DisplayAdjustments(daj); |
Jeff Brown | bd6e150 | 2012-08-28 03:27:37 -0700 | [diff] [blame] | 212 | mIsValid = true; |
Jeff Brown | 92130f6 | 2012-10-24 21:28:33 -0700 | [diff] [blame] | 213 | |
| 214 | // Cache properties that cannot change as long as the display is valid. |
| 215 | mLayerStack = displayInfo.layerStack; |
| 216 | mFlags = displayInfo.flags; |
| 217 | mType = displayInfo.type; |
| 218 | mAddress = displayInfo.address; |
Jeff Brown | a506a6e | 2013-06-04 00:02:38 -0700 | [diff] [blame] | 219 | mOwnerUid = displayInfo.ownerUid; |
| 220 | mOwnerPackageName = displayInfo.ownerPackageName; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 221 | } |
Dianne Hackborn | 5fd2169 | 2011-06-07 14:09:47 -0700 | [diff] [blame] | 222 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 223 | /** |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 224 | * Gets the display id. |
| 225 | * <p> |
| 226 | * Each logical display has a unique id. |
| 227 | * The default display has id {@link #DEFAULT_DISPLAY}. |
| 228 | * </p> |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 229 | */ |
| 230 | public int getDisplayId() { |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 231 | return mDisplayId; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 232 | } |
| 233 | |
| 234 | /** |
Jeff Brown | bd6e150 | 2012-08-28 03:27:37 -0700 | [diff] [blame] | 235 | * Returns true if this display is still valid, false if the display has been removed. |
| 236 | * |
| 237 | * If the display is invalid, then the methods of this class will |
| 238 | * continue to report the most recently observed display information. |
| 239 | * However, it is unwise (and rather fruitless) to continue using a |
| 240 | * {@link Display} object after the display's demise. |
| 241 | * |
| 242 | * It's possible for a display that was previously invalid to become |
| 243 | * valid again if a display with the same id is reconnected. |
| 244 | * |
| 245 | * @return True if the display is still valid. |
| 246 | */ |
| 247 | public boolean isValid() { |
| 248 | synchronized (this) { |
| 249 | updateDisplayInfoLocked(); |
| 250 | return mIsValid; |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | /** |
Jeff Brown | 2ab1b7d9 | 2012-08-08 01:46:41 -0700 | [diff] [blame] | 255 | * Gets a full copy of the display information. |
| 256 | * |
| 257 | * @param outDisplayInfo The object to receive the copy of the display information. |
Jeff Brown | bd6e150 | 2012-08-28 03:27:37 -0700 | [diff] [blame] | 258 | * @return True if the display is still valid. |
Jeff Brown | 2ab1b7d9 | 2012-08-08 01:46:41 -0700 | [diff] [blame] | 259 | * @hide |
| 260 | */ |
Jeff Brown | bd6e150 | 2012-08-28 03:27:37 -0700 | [diff] [blame] | 261 | public boolean getDisplayInfo(DisplayInfo outDisplayInfo) { |
Jeff Brown | 2ab1b7d9 | 2012-08-08 01:46:41 -0700 | [diff] [blame] | 262 | synchronized (this) { |
| 263 | updateDisplayInfoLocked(); |
| 264 | outDisplayInfo.copyFrom(mDisplayInfo); |
Jeff Brown | bd6e150 | 2012-08-28 03:27:37 -0700 | [diff] [blame] | 265 | return mIsValid; |
Jeff Brown | 2ab1b7d9 | 2012-08-08 01:46:41 -0700 | [diff] [blame] | 266 | } |
| 267 | } |
| 268 | |
| 269 | /** |
Jeff Brown | 98365d7 | 2012-08-19 20:30:52 -0700 | [diff] [blame] | 270 | * Gets the display's layer stack. |
| 271 | * |
| 272 | * Each display has its own independent layer stack upon which surfaces |
| 273 | * are placed to be managed by surface flinger. |
| 274 | * |
Jeff Brown | 4ed8fe7 | 2012-08-30 18:18:29 -0700 | [diff] [blame] | 275 | * @return The display's layer stack number. |
Jeff Brown | 98365d7 | 2012-08-19 20:30:52 -0700 | [diff] [blame] | 276 | * @hide |
| 277 | */ |
| 278 | public int getLayerStack() { |
Jeff Brown | 4ed8fe7 | 2012-08-30 18:18:29 -0700 | [diff] [blame] | 279 | return mLayerStack; |
Jeff Brown | 98365d7 | 2012-08-19 20:30:52 -0700 | [diff] [blame] | 280 | } |
| 281 | |
| 282 | /** |
Jeff Brown | c5df37c | 2012-09-13 11:45:07 -0700 | [diff] [blame] | 283 | * Returns a combination of flags that describe the capabilities of the display. |
| 284 | * |
| 285 | * @return The display flags. |
| 286 | * |
Jeff Brown | 77aebfd | 2012-10-01 21:07:03 -0700 | [diff] [blame] | 287 | * @see #FLAG_SUPPORTS_PROTECTED_BUFFERS |
Jeff Brown | f0681b3 | 2012-10-23 17:35:57 -0700 | [diff] [blame] | 288 | * @see #FLAG_SECURE |
Jeff Brown | a506a6e | 2013-06-04 00:02:38 -0700 | [diff] [blame] | 289 | * @see #FLAG_PRIVATE |
Jeff Brown | c5df37c | 2012-09-13 11:45:07 -0700 | [diff] [blame] | 290 | */ |
| 291 | public int getFlags() { |
Jeff Brown | 92130f6 | 2012-10-24 21:28:33 -0700 | [diff] [blame] | 292 | return mFlags; |
| 293 | } |
| 294 | |
| 295 | /** |
| 296 | * Gets the display type. |
| 297 | * |
| 298 | * @return The display type. |
| 299 | * |
| 300 | * @see #TYPE_UNKNOWN |
| 301 | * @see #TYPE_BUILT_IN |
| 302 | * @see #TYPE_HDMI |
| 303 | * @see #TYPE_WIFI |
| 304 | * @see #TYPE_OVERLAY |
Jeff Brown | a506a6e | 2013-06-04 00:02:38 -0700 | [diff] [blame] | 305 | * @see #TYPE_VIRTUAL |
Jeff Brown | 92130f6 | 2012-10-24 21:28:33 -0700 | [diff] [blame] | 306 | * @hide |
| 307 | */ |
| 308 | public int getType() { |
| 309 | return mType; |
| 310 | } |
| 311 | |
| 312 | /** |
| 313 | * Gets the display address, or null if none. |
| 314 | * Interpretation varies by display type. |
| 315 | * |
| 316 | * @return The display address. |
| 317 | * @hide |
| 318 | */ |
| 319 | public String getAddress() { |
| 320 | return mAddress; |
Jeff Brown | c5df37c | 2012-09-13 11:45:07 -0700 | [diff] [blame] | 321 | } |
| 322 | |
| 323 | /** |
Jeff Brown | a506a6e | 2013-06-04 00:02:38 -0700 | [diff] [blame] | 324 | * Gets the UID of the application that owns this display, or zero if it is |
| 325 | * owned by the system. |
| 326 | * <p> |
| 327 | * If the display is private, then only the owner can use it. |
| 328 | * </p> |
| 329 | * |
| 330 | * @hide |
| 331 | */ |
| 332 | public int getOwnerUid() { |
| 333 | return mOwnerUid; |
| 334 | } |
| 335 | |
| 336 | /** |
| 337 | * Gets the package name of the application that owns this display, or null if it is |
| 338 | * owned by the system. |
| 339 | * <p> |
| 340 | * If the display is private, then only the owner can use it. |
| 341 | * </p> |
| 342 | * |
| 343 | * @hide |
| 344 | */ |
| 345 | public String getOwnerPackageName() { |
| 346 | return mOwnerPackageName; |
| 347 | } |
| 348 | |
| 349 | /** |
Jeff Brown | 98365d7 | 2012-08-19 20:30:52 -0700 | [diff] [blame] | 350 | * Gets the compatibility info used by this display instance. |
| 351 | * |
Craig Mautner | 48d0d18 | 2013-06-11 07:53:06 -0700 | [diff] [blame] | 352 | * @return The display adjustments holder, or null if none is required. |
Jeff Brown | 98365d7 | 2012-08-19 20:30:52 -0700 | [diff] [blame] | 353 | * @hide |
| 354 | */ |
Craig Mautner | 48d0d18 | 2013-06-11 07:53:06 -0700 | [diff] [blame] | 355 | public DisplayAdjustments getDisplayAdjustments() { |
| 356 | return mDisplayAdjustments; |
Jeff Brown | 98365d7 | 2012-08-19 20:30:52 -0700 | [diff] [blame] | 357 | } |
| 358 | |
| 359 | /** |
Jeff Brown | 4ed8fe7 | 2012-08-30 18:18:29 -0700 | [diff] [blame] | 360 | * Gets the name of the display. |
Jeff Brown | 92130f6 | 2012-10-24 21:28:33 -0700 | [diff] [blame] | 361 | * <p> |
| 362 | * Note that some displays may be renamed by the user. |
| 363 | * </p> |
| 364 | * |
Jeff Brown | 4ed8fe7 | 2012-08-30 18:18:29 -0700 | [diff] [blame] | 365 | * @return The display's name. |
| 366 | */ |
| 367 | public String getName() { |
Jeff Brown | 92130f6 | 2012-10-24 21:28:33 -0700 | [diff] [blame] | 368 | synchronized (this) { |
| 369 | updateDisplayInfoLocked(); |
| 370 | return mDisplayInfo.name; |
| 371 | } |
Jeff Brown | 4ed8fe7 | 2012-08-30 18:18:29 -0700 | [diff] [blame] | 372 | } |
| 373 | |
| 374 | /** |
Jeff Brown | bc68a59 | 2011-07-25 12:58:12 -0700 | [diff] [blame] | 375 | * Gets the size of the display, in pixels. |
| 376 | * <p> |
| 377 | * Note that this value should <em>not</em> be used for computing layouts, |
| 378 | * since a device will typically have screen decoration (such as a status bar) |
Dianne Hackborn | 5cb70b5 | 2010-02-25 17:01:14 -0800 | [diff] [blame] | 379 | * along the edges of the display that reduce the amount of application |
Jeff Brown | bc68a59 | 2011-07-25 12:58:12 -0700 | [diff] [blame] | 380 | * space available from the size returned here. Layouts should instead use |
| 381 | * the window size. |
| 382 | * </p><p> |
| 383 | * The size is adjusted based on the current rotation of the display. |
| 384 | * </p><p> |
| 385 | * The size returned by this method does not necessarily represent the |
| 386 | * actual raw size (native resolution) of the display. The returned size may |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 387 | * be adjusted to exclude certain system decoration elements that are always visible. |
Jeff Brown | bc68a59 | 2011-07-25 12:58:12 -0700 | [diff] [blame] | 388 | * It may also be scaled to provide compatibility with older applications that |
| 389 | * were originally designed for smaller displays. |
| 390 | * </p> |
| 391 | * |
| 392 | * @param outSize A {@link Point} object to receive the size information. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 393 | */ |
Dianne Hackborn | ac8dea1 | 2011-04-20 18:18:51 -0700 | [diff] [blame] | 394 | public void getSize(Point outSize) { |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 395 | synchronized (this) { |
| 396 | updateDisplayInfoLocked(); |
Craig Mautner | 48d0d18 | 2013-06-11 07:53:06 -0700 | [diff] [blame] | 397 | mDisplayInfo.getAppMetrics(mTempMetrics, mDisplayAdjustments); |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 398 | outSize.x = mTempMetrics.widthPixels; |
| 399 | outSize.y = mTempMetrics.heightPixels; |
Dianne Hackborn | ac8dea1 | 2011-04-20 18:18:51 -0700 | [diff] [blame] | 400 | } |
| 401 | } |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 402 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 403 | /** |
Jeff Brown | bc68a59 | 2011-07-25 12:58:12 -0700 | [diff] [blame] | 404 | * Gets the size of the display as a rectangle, in pixels. |
| 405 | * |
| 406 | * @param outSize A {@link Rect} object to receive the size information. |
| 407 | * @see #getSize(Point) |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 408 | */ |
Dianne Hackborn | ac8dea1 | 2011-04-20 18:18:51 -0700 | [diff] [blame] | 409 | public void getRectSize(Rect outSize) { |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 410 | synchronized (this) { |
| 411 | updateDisplayInfoLocked(); |
Craig Mautner | 48d0d18 | 2013-06-11 07:53:06 -0700 | [diff] [blame] | 412 | mDisplayInfo.getAppMetrics(mTempMetrics, mDisplayAdjustments); |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 413 | outSize.set(0, 0, mTempMetrics.widthPixels, mTempMetrics.heightPixels); |
Dianne Hackborn | ac8dea1 | 2011-04-20 18:18:51 -0700 | [diff] [blame] | 414 | } |
| 415 | } |
| 416 | |
| 417 | /** |
Dianne Hackborn | 68c33ca | 2012-04-19 14:51:25 -0700 | [diff] [blame] | 418 | * Return the range of display sizes an application can expect to encounter |
| 419 | * under normal operation, as long as there is no physical change in screen |
| 420 | * size. This is basically the sizes you will see as the orientation |
| 421 | * changes, taking into account whatever screen decoration there is in |
| 422 | * each rotation. For example, the status bar is always at the top of the |
| 423 | * screen, so it will reduce the height both in landscape and portrait, and |
| 424 | * the smallest height returned here will be the smaller of the two. |
| 425 | * |
| 426 | * This is intended for applications to get an idea of the range of sizes |
| 427 | * they will encounter while going through device rotations, to provide a |
| 428 | * stable UI through rotation. The sizes here take into account all standard |
| 429 | * system decorations that reduce the size actually available to the |
| 430 | * application: the status bar, navigation bar, system bar, etc. It does |
| 431 | * <em>not</em> take into account more transient elements like an IME |
| 432 | * soft keyboard. |
| 433 | * |
| 434 | * @param outSmallestSize Filled in with the smallest width and height |
| 435 | * that the application will encounter, in pixels (not dp units). The x |
| 436 | * (width) dimension here directly corresponds to |
| 437 | * {@link android.content.res.Configuration#smallestScreenWidthDp |
| 438 | * Configuration.smallestScreenWidthDp}, except the value here is in raw |
| 439 | * screen pixels rather than dp units. Your application may of course |
| 440 | * still get smaller space yet if, for example, a soft keyboard is |
| 441 | * being displayed. |
| 442 | * @param outLargestSize Filled in with the largest width and height |
| 443 | * that the application will encounter, in pixels (not dp units). Your |
| 444 | * application may of course still get larger space than this if, |
| 445 | * for example, screen decorations like the status bar are being hidden. |
| 446 | */ |
| 447 | public void getCurrentSizeRange(Point outSmallestSize, Point outLargestSize) { |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 448 | synchronized (this) { |
| 449 | updateDisplayInfoLocked(); |
| 450 | outSmallestSize.x = mDisplayInfo.smallestNominalAppWidth; |
| 451 | outSmallestSize.y = mDisplayInfo.smallestNominalAppHeight; |
| 452 | outLargestSize.x = mDisplayInfo.largestNominalAppWidth; |
| 453 | outLargestSize.y = mDisplayInfo.largestNominalAppHeight; |
Dianne Hackborn | 68c33ca | 2012-04-19 14:51:25 -0700 | [diff] [blame] | 454 | } |
| 455 | } |
| 456 | |
| 457 | /** |
Dianne Hackborn | ac8dea1 | 2011-04-20 18:18:51 -0700 | [diff] [blame] | 458 | * Return the maximum screen size dimension that will happen. This is |
| 459 | * mostly for wallpapers. |
| 460 | * @hide |
| 461 | */ |
| 462 | public int getMaximumSizeDimension() { |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 463 | synchronized (this) { |
| 464 | updateDisplayInfoLocked(); |
| 465 | return Math.max(mDisplayInfo.logicalWidth, mDisplayInfo.logicalHeight); |
Dianne Hackborn | ac8dea1 | 2011-04-20 18:18:51 -0700 | [diff] [blame] | 466 | } |
| 467 | } |
| 468 | |
| 469 | /** |
| 470 | * @deprecated Use {@link #getSize(Point)} instead. |
| 471 | */ |
| 472 | @Deprecated |
| 473 | public int getWidth() { |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 474 | synchronized (this) { |
| 475 | updateCachedAppSizeIfNeededLocked(); |
| 476 | return mCachedAppWidthCompat; |
Dianne Hackborn | ac8dea1 | 2011-04-20 18:18:51 -0700 | [diff] [blame] | 477 | } |
| 478 | } |
| 479 | |
| 480 | /** |
| 481 | * @deprecated Use {@link #getSize(Point)} instead. |
| 482 | */ |
| 483 | @Deprecated |
| 484 | public int getHeight() { |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 485 | synchronized (this) { |
| 486 | updateCachedAppSizeIfNeededLocked(); |
| 487 | return mCachedAppHeightCompat; |
Dianne Hackborn | ac8dea1 | 2011-04-20 18:18:51 -0700 | [diff] [blame] | 488 | } |
| 489 | } |
| 490 | |
Jeff Brown | bc68a59 | 2011-07-25 12:58:12 -0700 | [diff] [blame] | 491 | /** |
Dianne Hackborn | c652de8 | 2013-02-15 16:32:56 -0800 | [diff] [blame] | 492 | * @hide |
| 493 | * Return a rectangle defining the insets of the overscan region of the display. |
| 494 | * Each field of the rectangle is the number of pixels the overscan area extends |
| 495 | * into the display on that side. |
| 496 | */ |
| 497 | public void getOverscanInsets(Rect outRect) { |
| 498 | synchronized (this) { |
| 499 | updateDisplayInfoLocked(); |
| 500 | outRect.set(mDisplayInfo.overscanLeft, mDisplayInfo.overscanTop, |
| 501 | mDisplayInfo.overscanRight, mDisplayInfo.overscanBottom); |
| 502 | } |
| 503 | } |
| 504 | |
| 505 | /** |
Dianne Hackborn | 5cb70b5 | 2010-02-25 17:01:14 -0800 | [diff] [blame] | 506 | * Returns the rotation of the screen from its "natural" orientation. |
| 507 | * The returned value may be {@link Surface#ROTATION_0 Surface.ROTATION_0} |
| 508 | * (no rotation), {@link Surface#ROTATION_90 Surface.ROTATION_90}, |
| 509 | * {@link Surface#ROTATION_180 Surface.ROTATION_180}, or |
| 510 | * {@link Surface#ROTATION_270 Surface.ROTATION_270}. For |
| 511 | * example, if a device has a naturally tall screen, and the user has |
| 512 | * turned it on its side to go into a landscape orientation, the value |
| 513 | * returned here may be either {@link Surface#ROTATION_90 Surface.ROTATION_90} |
| 514 | * or {@link Surface#ROTATION_270 Surface.ROTATION_270} depending on |
| 515 | * the direction it was turned. The angle is the rotation of the drawn |
| 516 | * graphics on the screen, which is the opposite direction of the physical |
| 517 | * rotation of the device. For example, if the device is rotated 90 |
| 518 | * degrees counter-clockwise, to compensate rendering will be rotated by |
| 519 | * 90 degrees clockwise and thus the returned value here will be |
| 520 | * {@link Surface#ROTATION_90 Surface.ROTATION_90}. |
| 521 | */ |
| 522 | public int getRotation() { |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 523 | synchronized (this) { |
| 524 | updateDisplayInfoLocked(); |
| 525 | return mDisplayInfo.rotation; |
| 526 | } |
Dianne Hackborn | 5cb70b5 | 2010-02-25 17:01:14 -0800 | [diff] [blame] | 527 | } |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 528 | |
Dianne Hackborn | 5cb70b5 | 2010-02-25 17:01:14 -0800 | [diff] [blame] | 529 | /** |
Joe Onorato | 4c904a3 | 2010-02-26 12:35:55 -0800 | [diff] [blame] | 530 | * @deprecated use {@link #getRotation} |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 531 | * @return orientation of this display. |
| 532 | */ |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 533 | @Deprecated |
| 534 | public int getOrientation() { |
| 535 | return getRotation(); |
| 536 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 537 | |
| 538 | /** |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 539 | * Gets the pixel format of the display. |
| 540 | * @return One of the constants defined in {@link android.graphics.PixelFormat}. |
| 541 | * |
| 542 | * @deprecated This method is no longer supported. |
| 543 | * The result is always {@link PixelFormat#RGBA_8888}. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 544 | */ |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 545 | @Deprecated |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 546 | public int getPixelFormat() { |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 547 | return PixelFormat.RGBA_8888; |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 548 | } |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 549 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 550 | /** |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 551 | * Gets the refresh rate of this display in frames per second. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 552 | */ |
| 553 | public float getRefreshRate() { |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 554 | synchronized (this) { |
| 555 | updateDisplayInfoLocked(); |
| 556 | return mDisplayInfo.refreshRate; |
| 557 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 558 | } |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 559 | |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 560 | /** |
Jeff Brown | bc68a59 | 2011-07-25 12:58:12 -0700 | [diff] [blame] | 561 | * Gets display metrics that describe the size and density of this display. |
| 562 | * <p> |
| 563 | * The size is adjusted based on the current rotation of the display. |
| 564 | * </p><p> |
| 565 | * The size returned by this method does not necessarily represent the |
| 566 | * actual raw size (native resolution) of the display. The returned size may |
| 567 | * be adjusted to exclude certain system decor elements that are always visible. |
| 568 | * It may also be scaled to provide compatibility with older applications that |
| 569 | * were originally designed for smaller displays. |
| 570 | * </p> |
| 571 | * |
| 572 | * @param outMetrics A {@link DisplayMetrics} object to receive the metrics. |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 573 | */ |
| 574 | public void getMetrics(DisplayMetrics outMetrics) { |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 575 | synchronized (this) { |
| 576 | updateDisplayInfoLocked(); |
Craig Mautner | 48d0d18 | 2013-06-11 07:53:06 -0700 | [diff] [blame] | 577 | mDisplayInfo.getAppMetrics(outMetrics, mDisplayAdjustments); |
Dianne Hackborn | 68066c2 | 2011-04-21 17:26:39 -0700 | [diff] [blame] | 578 | } |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 579 | } |
Dianne Hackborn | 5fd2169 | 2011-06-07 14:09:47 -0700 | [diff] [blame] | 580 | |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 581 | /** |
| 582 | * Gets the real size of the display without subtracting any window decor or |
| 583 | * applying any compatibility scale factors. |
| 584 | * <p> |
| 585 | * The size is adjusted based on the current rotation of the display. |
| 586 | * </p><p> |
| 587 | * The real size may be smaller than the physical size of the screen when the |
| 588 | * window manager is emulating a smaller display (using adb shell am display-size). |
| 589 | * </p> |
| 590 | * |
| 591 | * @param outSize Set to the real size of the display. |
| 592 | */ |
| 593 | public void getRealSize(Point outSize) { |
| 594 | synchronized (this) { |
| 595 | updateDisplayInfoLocked(); |
| 596 | outSize.x = mDisplayInfo.logicalWidth; |
| 597 | outSize.y = mDisplayInfo.logicalHeight; |
| 598 | } |
Dianne Hackborn | 68066c2 | 2011-04-21 17:26:39 -0700 | [diff] [blame] | 599 | } |
| 600 | |
| 601 | /** |
Jeff Brown | bc68a59 | 2011-07-25 12:58:12 -0700 | [diff] [blame] | 602 | * Gets display metrics based on the real size of this display. |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 603 | * <p> |
| 604 | * The size is adjusted based on the current rotation of the display. |
| 605 | * </p><p> |
| 606 | * The real size may be smaller than the physical size of the screen when the |
| 607 | * window manager is emulating a smaller display (using adb shell am display-size). |
| 608 | * </p> |
| 609 | * |
| 610 | * @param outMetrics A {@link DisplayMetrics} object to receive the metrics. |
Dianne Hackborn | 68066c2 | 2011-04-21 17:26:39 -0700 | [diff] [blame] | 611 | */ |
| 612 | public void getRealMetrics(DisplayMetrics outMetrics) { |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 613 | synchronized (this) { |
| 614 | updateDisplayInfoLocked(); |
Craig Mautner | 48d0d18 | 2013-06-11 07:53:06 -0700 | [diff] [blame] | 615 | mDisplayInfo.getLogicalMetrics(outMetrics, |
| 616 | CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO, |
| 617 | mDisplayAdjustments.getActivityToken()); |
Jeff Brown | bc68a59 | 2011-07-25 12:58:12 -0700 | [diff] [blame] | 618 | } |
Dianne Hackborn | 68066c2 | 2011-04-21 17:26:39 -0700 | [diff] [blame] | 619 | } |
| 620 | |
Jeff Brown | a506a6e | 2013-06-04 00:02:38 -0700 | [diff] [blame] | 621 | /** |
| 622 | * Returns true if the specified UID has access to this display. |
| 623 | * @hide |
| 624 | */ |
| 625 | public boolean hasAccess(int uid) { |
| 626 | return Display.hasAccess(uid, mFlags, mOwnerUid); |
| 627 | } |
| 628 | |
| 629 | /** @hide */ |
| 630 | public static boolean hasAccess(int uid, int flags, int ownerUid) { |
| 631 | return (flags & Display.FLAG_PRIVATE) == 0 |
| 632 | || uid == ownerUid |
| 633 | || uid == Process.SYSTEM_UID |
| 634 | || uid == 0; |
| 635 | } |
| 636 | |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 637 | private void updateDisplayInfoLocked() { |
Jeff Brown | bd6e150 | 2012-08-28 03:27:37 -0700 | [diff] [blame] | 638 | // Note: The display manager caches display info objects on our behalf. |
| 639 | DisplayInfo newInfo = mGlobal.getDisplayInfo(mDisplayId); |
| 640 | if (newInfo == null) { |
| 641 | // Preserve the old mDisplayInfo after the display is removed. |
| 642 | if (mIsValid) { |
| 643 | mIsValid = false; |
| 644 | if (DEBUG) { |
| 645 | Log.d(TAG, "Logical display " + mDisplayId + " was removed."); |
| 646 | } |
| 647 | } |
| 648 | } else { |
| 649 | // Use the new display info. (It might be the same object if nothing changed.) |
| 650 | mDisplayInfo = newInfo; |
| 651 | if (!mIsValid) { |
| 652 | mIsValid = true; |
| 653 | if (DEBUG) { |
| 654 | Log.d(TAG, "Logical display " + mDisplayId + " was recreated."); |
| 655 | } |
| 656 | } |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 657 | } |
Jeff Brown | bc68a59 | 2011-07-25 12:58:12 -0700 | [diff] [blame] | 658 | } |
| 659 | |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 660 | private void updateCachedAppSizeIfNeededLocked() { |
| 661 | long now = SystemClock.uptimeMillis(); |
| 662 | if (now > mLastCachedAppSizeUpdate + CACHED_APP_SIZE_DURATION_MILLIS) { |
| 663 | updateDisplayInfoLocked(); |
Craig Mautner | 48d0d18 | 2013-06-11 07:53:06 -0700 | [diff] [blame] | 664 | mDisplayInfo.getAppMetrics(mTempMetrics, mDisplayAdjustments); |
Jeff Brown | fa25bf5 | 2012-07-23 19:26:30 -0700 | [diff] [blame] | 665 | mCachedAppWidthCompat = mTempMetrics.widthPixels; |
| 666 | mCachedAppHeightCompat = mTempMetrics.heightPixels; |
| 667 | mLastCachedAppSizeUpdate = now; |
| 668 | } |
Jeff Brown | bc68a59 | 2011-07-25 12:58:12 -0700 | [diff] [blame] | 669 | } |
Jeff Brown | bf5740e | 2012-08-19 23:20:02 -0700 | [diff] [blame] | 670 | |
| 671 | // For debugging purposes |
| 672 | @Override |
| 673 | public String toString() { |
| 674 | synchronized (this) { |
| 675 | updateDisplayInfoLocked(); |
Craig Mautner | 48d0d18 | 2013-06-11 07:53:06 -0700 | [diff] [blame] | 676 | mDisplayInfo.getAppMetrics(mTempMetrics, mDisplayAdjustments); |
Jeff Brown | bf5740e | 2012-08-19 23:20:02 -0700 | [diff] [blame] | 677 | return "Display id " + mDisplayId + ": " + mDisplayInfo |
Jeff Brown | bd6e150 | 2012-08-28 03:27:37 -0700 | [diff] [blame] | 678 | + ", " + mTempMetrics + ", isValid=" + mIsValid; |
Jeff Brown | bf5740e | 2012-08-19 23:20:02 -0700 | [diff] [blame] | 679 | } |
| 680 | } |
Jeff Brown | 92130f6 | 2012-10-24 21:28:33 -0700 | [diff] [blame] | 681 | |
| 682 | /** |
| 683 | * @hide |
| 684 | */ |
| 685 | public static String typeToString(int type) { |
| 686 | switch (type) { |
| 687 | case TYPE_UNKNOWN: |
| 688 | return "UNKNOWN"; |
| 689 | case TYPE_BUILT_IN: |
| 690 | return "BUILT_IN"; |
| 691 | case TYPE_HDMI: |
| 692 | return "HDMI"; |
| 693 | case TYPE_WIFI: |
| 694 | return "WIFI"; |
| 695 | case TYPE_OVERLAY: |
| 696 | return "OVERLAY"; |
Jeff Brown | a506a6e | 2013-06-04 00:02:38 -0700 | [diff] [blame] | 697 | case TYPE_VIRTUAL: |
| 698 | return "VIRTUAL"; |
Jeff Brown | 92130f6 | 2012-10-24 21:28:33 -0700 | [diff] [blame] | 699 | default: |
| 700 | return Integer.toString(type); |
| 701 | } |
| 702 | } |
The Android Open Source Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 703 | } |
| 704 | |