Display.java revision c652de8141f5b8e3c6bcf8916842b6e106413b1a
19066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/*
29066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Copyright (C) 2006 The Android Open Source Project
39066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project *
49066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Licensed under the Apache License, Version 2.0 (the "License");
59066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * you may not use this file except in compliance with the License.
69066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * You may obtain a copy of the License at
79066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project *
89066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project *      http://www.apache.org/licenses/LICENSE-2.0
99066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project *
109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Unless required by applicable law or agreed to in writing, software
119066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * distributed under the License is distributed on an "AS IS" BASIS,
129066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
139066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * See the License for the specific language governing permissions and
149066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * limitations under the License.
159066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */
169066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectpackage android.view;
189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
19fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brownimport android.graphics.PixelFormat;
20ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackbornimport android.graphics.Point;
21ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackbornimport android.graphics.Rect;
22bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brownimport android.hardware.display.DisplayManagerGlobal;
23ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackbornimport android.os.SystemClock;
249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport android.util.DisplayMetrics;
25fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brownimport android.util.Log;
269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
27bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown/**
28fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown * Provides information about the size and density of a logical display.
29fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown * <p>
30fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown * The display area is described in two different ways.
31fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown * <ul>
32fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown * <li>The application display area specifies the part of the display that may contain
33fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown * an application window, excluding the system decorations.  The application display area may
34fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown * be smaller than the real display area because the system subtracts the space needed
35fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown * for decor elements such as the status bar.  Use the following methods to query the
36fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown * application display area: {@link #getSize}, {@link #getRectSize} and {@link #getMetrics}.</li>
37fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown * <li>The real display area specifies the part of the display that contains content
38fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown * including the system decorations.  Even so, the real display area may be smaller than the
39fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown * physical size of the display if the window manager is emulating a smaller display
40fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown * using (adb shell am display-size).  Use the following methods to query the
41fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown * real display area: {@link #getRealSize}, {@link #getRealMetrics}.</li>
42fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown * </ul>
43fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown * </p><p>
44fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown * A logical display does not necessarily represent a particular physical display device
45fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown * such as the built-in screen or an external monitor.  The contents of a logical
46fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown * display may be presented on one or more physical displays according to the devices
47fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown * that are currently attached and whether mirroring has been enabled.
48fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown * </p>
49bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown */
50fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brownpublic final class Display {
51fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown    private static final String TAG = "Display";
52bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown    private static final boolean DEBUG = false;
53fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown
54bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown    private final DisplayManagerGlobal mGlobal;
55fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown    private final int mDisplayId;
564ed8fe75e1dde1a2b9576f3862aecc5a572c56b5Jeff Brown    private final int mLayerStack;
5792130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown    private final int mFlags;
5892130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown    private final int mType;
5992130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown    private final String mAddress;
60fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown    private final CompatibilityInfoHolder mCompatibilityInfo;
61bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown
62bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown    private DisplayInfo mDisplayInfo; // never null
63bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown    private boolean mIsValid;
64fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown
65fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown    // Temporary display metrics structure used for compatibility mode.
66fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown    private final DisplayMetrics mTempMetrics = new DisplayMetrics();
67fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown
68fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown    // We cache the app width and height properties briefly between calls
69fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown    // to getHeight() and getWidth() to ensure that applications perceive
70fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown    // consistent results when the size changes (most of the time).
71fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown    // Applications should now be using getSize() instead.
72fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown    private static final int CACHED_APP_SIZE_DURATION_MILLIS = 20;
73fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown    private long mLastCachedAppSizeUpdate;
74fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown    private int mCachedAppWidthCompat;
75fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown    private int mCachedAppHeightCompat;
765fd2169eabd77e6bfafaf456e58051a3bafb2bcaDianne Hackborn
779066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
7898365d7663cbd82979a5700faf0050220b01084dJeff Brown     * The default Display id, which is the id of the built-in primary display
7998365d7663cbd82979a5700faf0050220b01084dJeff Brown     * assuming there is one.
809066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
819066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public static final int DEFAULT_DISPLAY = 0;
829066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
839066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
8477aebfdbae489c3712ae3f9bca29d01fb1f09dc2Jeff Brown     * Display flag: Indicates that the display supports compositing content
8577aebfdbae489c3712ae3f9bca29d01fb1f09dc2Jeff Brown     * that is stored in protected graphics buffers.
86c5df37c285221d0fb113f55b9e78b35632241d3fJeff Brown     * <p>
87f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * If this flag is set then the display device supports compositing protected buffers.
88f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * </p><p>
89f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * If this flag is not set then the display device may not support compositing
90f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * protected buffers; the user may see a blank region on the screen instead of
91f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * the protected content.
92f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * </p><p>
9377aebfdbae489c3712ae3f9bca29d01fb1f09dc2Jeff Brown     * Secure (DRM) video decoders may allocate protected graphics buffers to request that
9477aebfdbae489c3712ae3f9bca29d01fb1f09dc2Jeff Brown     * a hardware-protected path be provided between the video decoder and the external
9577aebfdbae489c3712ae3f9bca29d01fb1f09dc2Jeff Brown     * display sink.  If a hardware-protected path is not available, then content stored
9677aebfdbae489c3712ae3f9bca29d01fb1f09dc2Jeff Brown     * in protected graphics buffers may not be composited.
97c5df37c285221d0fb113f55b9e78b35632241d3fJeff Brown     * </p><p>
98f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * An application can use the absence of this flag as a hint that it should not use protected
99f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * buffers for this display because the content may not be visible.  For example,
100f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * if the flag is not set then the application may choose not to show content on this
101f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * display, show an informative error message, select an alternate content stream
102f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * or adopt a different strategy for decoding content that does not rely on
103f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * protected buffers.
104c5df37c285221d0fb113f55b9e78b35632241d3fJeff Brown     * </p>
105f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     *
106f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * @see #getFlags
107c5df37c285221d0fb113f55b9e78b35632241d3fJeff Brown     */
10877aebfdbae489c3712ae3f9bca29d01fb1f09dc2Jeff Brown    public static final int FLAG_SUPPORTS_PROTECTED_BUFFERS = 1 << 0;
109c5df37c285221d0fb113f55b9e78b35632241d3fJeff Brown
110c5df37c285221d0fb113f55b9e78b35632241d3fJeff Brown    /**
111f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * Display flag: Indicates that the display has a secure video output and
112f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * supports compositing secure surfaces.
113f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * <p>
114f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * If this flag is set then the display device has a secure video output
115f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * and is capable of showing secure surfaces.  It may also be capable of
116f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * showing {@link #FLAG_SUPPORTS_PROTECTED_BUFFERS protected buffers}.
117f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * </p><p>
118f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * If this flag is not set then the display device may not have a secure video
119f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * output; the user may see a blank region on the screen instead of
120f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * the contents of secure surfaces or protected buffers.
121f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * </p><p>
122f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * Secure surfaces are used to prevent content rendered into those surfaces
123f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * by applications from appearing in screenshots or from being viewed
124f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * on non-secure displays.  Protected buffers are used by secure video decoders
125f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * for a similar purpose.
126f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * </p><p>
127f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * An application creates a window with a secure surface by specifying the
128f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * {@link WindowManager.LayoutParams#FLAG_SECURE} window flag.
129f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * Likewise, an application creates a {@link SurfaceView} with a secure surface
130f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * by calling {@link SurfaceView#setSecure} before attaching the secure view to
131f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * its containing window.
132f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * </p><p>
133f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * An application can use the absence of this flag as a hint that it should not create
134f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * secure surfaces or protected buffers on this display because the content may
135f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * not be visible.  For example, if the flag is not set then the application may
136f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * choose not to show content on this display, show an informative error message,
137f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * select an alternate content stream or adopt a different strategy for decoding
138f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * content that does not rely on secure surfaces or protected buffers.
139f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * </p>
140f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     *
141f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * @see #getFlags
142f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     */
143f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown    public static final int FLAG_SECURE = 1 << 1;
144f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown
145f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown    /**
14692130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     * Display type: Unknown display type.
14792130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     * @hide
14892130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     */
14992130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown    public static final int TYPE_UNKNOWN = 0;
15092130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown
15192130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown    /**
15292130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     * Display type: Built-in display.
15392130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     * @hide
15492130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     */
15592130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown    public static final int TYPE_BUILT_IN = 1;
15692130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown
15792130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown    /**
15892130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     * Display type: HDMI display.
15992130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     * @hide
16092130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     */
16192130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown    public static final int TYPE_HDMI = 2;
16292130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown
16392130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown    /**
16492130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     * Display type: WiFi display.
16592130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     * @hide
16692130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     */
16792130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown    public static final int TYPE_WIFI = 3;
16892130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown
16992130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown    /**
17092130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     * Display type: Overlay display.
17192130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     * @hide
17292130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     */
17392130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown    public static final int TYPE_OVERLAY = 4;
17492130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown
17592130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown    /**
176fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * Internal method to create a display.
177fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * Applications should use {@link android.view.WindowManager#getDefaultDisplay()}
17898365d7663cbd82979a5700faf0050220b01084dJeff Brown     * or {@link android.hardware.display.DisplayManager#getDisplay}
17998365d7663cbd82979a5700faf0050220b01084dJeff Brown     * to get a display object.
180fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     *
181fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * @hide
1829066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
183bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown    public Display(DisplayManagerGlobal global,
184bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown            int displayId, DisplayInfo displayInfo /*not null*/,
185bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown            CompatibilityInfoHolder compatibilityInfo) {
186bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown        mGlobal = global;
187fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown        mDisplayId = displayId;
188bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown        mDisplayInfo = displayInfo;
189fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown        mCompatibilityInfo = compatibilityInfo;
190bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown        mIsValid = true;
19192130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown
19292130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown        // Cache properties that cannot change as long as the display is valid.
19392130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown        mLayerStack = displayInfo.layerStack;
19492130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown        mFlags = displayInfo.flags;
19592130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown        mType = displayInfo.type;
19692130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown        mAddress = displayInfo.address;
1975fd2169eabd77e6bfafaf456e58051a3bafb2bcaDianne Hackborn    }
1985fd2169eabd77e6bfafaf456e58051a3bafb2bcaDianne Hackborn
1999066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
200fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * Gets the display id.
201fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * <p>
202fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * Each logical display has a unique id.
203fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * The default display has id {@link #DEFAULT_DISPLAY}.
204fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * </p>
2059066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
2069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public int getDisplayId() {
207fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown        return mDisplayId;
2089066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
2099066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
2109066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
211bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown     * Returns true if this display is still valid, false if the display has been removed.
212bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown     *
213bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown     * If the display is invalid, then the methods of this class will
214bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown     * continue to report the most recently observed display information.
215bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown     * However, it is unwise (and rather fruitless) to continue using a
216bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown     * {@link Display} object after the display's demise.
217bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown     *
218bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown     * It's possible for a display that was previously invalid to become
219bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown     * valid again if a display with the same id is reconnected.
220bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown     *
221bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown     * @return True if the display is still valid.
222bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown     */
223bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown    public boolean isValid() {
224bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown        synchronized (this) {
225bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown            updateDisplayInfoLocked();
226bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown            return mIsValid;
227bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown        }
228bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown    }
229bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown
230bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown    /**
2312ab1b7d9abc1b720b63ae01abcf1df0dc780eed4Jeff Brown     * Gets a full copy of the display information.
2322ab1b7d9abc1b720b63ae01abcf1df0dc780eed4Jeff Brown     *
2332ab1b7d9abc1b720b63ae01abcf1df0dc780eed4Jeff Brown     * @param outDisplayInfo The object to receive the copy of the display information.
234bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown     * @return True if the display is still valid.
2352ab1b7d9abc1b720b63ae01abcf1df0dc780eed4Jeff Brown     * @hide
2362ab1b7d9abc1b720b63ae01abcf1df0dc780eed4Jeff Brown     */
237bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown    public boolean getDisplayInfo(DisplayInfo outDisplayInfo) {
2382ab1b7d9abc1b720b63ae01abcf1df0dc780eed4Jeff Brown        synchronized (this) {
2392ab1b7d9abc1b720b63ae01abcf1df0dc780eed4Jeff Brown            updateDisplayInfoLocked();
2402ab1b7d9abc1b720b63ae01abcf1df0dc780eed4Jeff Brown            outDisplayInfo.copyFrom(mDisplayInfo);
241bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown            return mIsValid;
2422ab1b7d9abc1b720b63ae01abcf1df0dc780eed4Jeff Brown        }
2432ab1b7d9abc1b720b63ae01abcf1df0dc780eed4Jeff Brown    }
2442ab1b7d9abc1b720b63ae01abcf1df0dc780eed4Jeff Brown
2452ab1b7d9abc1b720b63ae01abcf1df0dc780eed4Jeff Brown    /**
24698365d7663cbd82979a5700faf0050220b01084dJeff Brown     * Gets the display's layer stack.
24798365d7663cbd82979a5700faf0050220b01084dJeff Brown     *
24898365d7663cbd82979a5700faf0050220b01084dJeff Brown     * Each display has its own independent layer stack upon which surfaces
24998365d7663cbd82979a5700faf0050220b01084dJeff Brown     * are placed to be managed by surface flinger.
25098365d7663cbd82979a5700faf0050220b01084dJeff Brown     *
2514ed8fe75e1dde1a2b9576f3862aecc5a572c56b5Jeff Brown     * @return The display's layer stack number.
25298365d7663cbd82979a5700faf0050220b01084dJeff Brown     * @hide
25398365d7663cbd82979a5700faf0050220b01084dJeff Brown     */
25498365d7663cbd82979a5700faf0050220b01084dJeff Brown    public int getLayerStack() {
2554ed8fe75e1dde1a2b9576f3862aecc5a572c56b5Jeff Brown        return mLayerStack;
25698365d7663cbd82979a5700faf0050220b01084dJeff Brown    }
25798365d7663cbd82979a5700faf0050220b01084dJeff Brown
25898365d7663cbd82979a5700faf0050220b01084dJeff Brown    /**
259c5df37c285221d0fb113f55b9e78b35632241d3fJeff Brown     * Returns a combination of flags that describe the capabilities of the display.
260c5df37c285221d0fb113f55b9e78b35632241d3fJeff Brown     *
261c5df37c285221d0fb113f55b9e78b35632241d3fJeff Brown     * @return The display flags.
262c5df37c285221d0fb113f55b9e78b35632241d3fJeff Brown     *
26377aebfdbae489c3712ae3f9bca29d01fb1f09dc2Jeff Brown     * @see #FLAG_SUPPORTS_PROTECTED_BUFFERS
264f0681b34dffc1510cbd9c3da5c3a7e695553fa8dJeff Brown     * @see #FLAG_SECURE
265c5df37c285221d0fb113f55b9e78b35632241d3fJeff Brown     */
266c5df37c285221d0fb113f55b9e78b35632241d3fJeff Brown    public int getFlags() {
26792130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown        return mFlags;
26892130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown    }
26992130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown
27092130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown    /**
27192130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     * Gets the display type.
27292130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     *
27392130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     * @return The display type.
27492130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     *
27592130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     * @see #TYPE_UNKNOWN
27692130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     * @see #TYPE_BUILT_IN
27792130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     * @see #TYPE_HDMI
27892130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     * @see #TYPE_WIFI
27992130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     * @see #TYPE_OVERLAY
28092130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     * @hide
28192130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     */
28292130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown    public int getType() {
28392130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown        return mType;
28492130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown    }
28592130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown
28692130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown    /**
28792130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     * Gets the display address, or null if none.
28892130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     * Interpretation varies by display type.
28992130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     *
29092130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     * @return The display address.
29192130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     * @hide
29292130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     */
29392130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown    public String getAddress() {
29492130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown        return mAddress;
295c5df37c285221d0fb113f55b9e78b35632241d3fJeff Brown    }
296c5df37c285221d0fb113f55b9e78b35632241d3fJeff Brown
297c5df37c285221d0fb113f55b9e78b35632241d3fJeff Brown    /**
29898365d7663cbd82979a5700faf0050220b01084dJeff Brown     * Gets the compatibility info used by this display instance.
29998365d7663cbd82979a5700faf0050220b01084dJeff Brown     *
30098365d7663cbd82979a5700faf0050220b01084dJeff Brown     * @return The compatibility info holder, or null if none is required.
30198365d7663cbd82979a5700faf0050220b01084dJeff Brown     * @hide
30298365d7663cbd82979a5700faf0050220b01084dJeff Brown     */
30398365d7663cbd82979a5700faf0050220b01084dJeff Brown    public CompatibilityInfoHolder getCompatibilityInfo() {
30498365d7663cbd82979a5700faf0050220b01084dJeff Brown        return mCompatibilityInfo;
30598365d7663cbd82979a5700faf0050220b01084dJeff Brown    }
30698365d7663cbd82979a5700faf0050220b01084dJeff Brown
30798365d7663cbd82979a5700faf0050220b01084dJeff Brown    /**
3084ed8fe75e1dde1a2b9576f3862aecc5a572c56b5Jeff Brown     * Gets the name of the display.
30992130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     * <p>
31092130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     * Note that some displays may be renamed by the user.
31192130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     * </p>
31292130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     *
3134ed8fe75e1dde1a2b9576f3862aecc5a572c56b5Jeff Brown     * @return The display's name.
3144ed8fe75e1dde1a2b9576f3862aecc5a572c56b5Jeff Brown     */
3154ed8fe75e1dde1a2b9576f3862aecc5a572c56b5Jeff Brown    public String getName() {
31692130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown        synchronized (this) {
31792130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown            updateDisplayInfoLocked();
31892130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown            return mDisplayInfo.name;
31992130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown        }
3204ed8fe75e1dde1a2b9576f3862aecc5a572c56b5Jeff Brown    }
3214ed8fe75e1dde1a2b9576f3862aecc5a572c56b5Jeff Brown
3224ed8fe75e1dde1a2b9576f3862aecc5a572c56b5Jeff Brown    /**
323bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     * Gets the size of the display, in pixels.
324bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     * <p>
325bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     * Note that this value should <em>not</em> be used for computing layouts,
326bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     * since a device will typically have screen decoration (such as a status bar)
3275cb70b54156fb305d579a1cc167424c8705bfdf7Dianne Hackborn     * along the edges of the display that reduce the amount of application
328bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     * space available from the size returned here.  Layouts should instead use
329bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     * the window size.
330bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     * </p><p>
331bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     * The size is adjusted based on the current rotation of the display.
332bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     * </p><p>
333bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     * The size returned by this method does not necessarily represent the
334bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     * actual raw size (native resolution) of the display.  The returned size may
335fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * be adjusted to exclude certain system decoration elements that are always visible.
336bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     * It may also be scaled to provide compatibility with older applications that
337bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     * were originally designed for smaller displays.
338bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     * </p>
339bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     *
340bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     * @param outSize A {@link Point} object to receive the size information.
3419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
342ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn    public void getSize(Point outSize) {
343fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown        synchronized (this) {
344fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            updateDisplayInfoLocked();
345fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            mDisplayInfo.getAppMetrics(mTempMetrics, mCompatibilityInfo);
346fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            outSize.x = mTempMetrics.widthPixels;
347fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            outSize.y = mTempMetrics.heightPixels;
348ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn        }
349ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn    }
350fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown
3519066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
352bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     * Gets the size of the display as a rectangle, in pixels.
353bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     *
354bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     * @param outSize A {@link Rect} object to receive the size information.
355bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     * @see #getSize(Point)
3569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
357ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn    public void getRectSize(Rect outSize) {
358fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown        synchronized (this) {
359fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            updateDisplayInfoLocked();
360fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            mDisplayInfo.getAppMetrics(mTempMetrics, mCompatibilityInfo);
361fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            outSize.set(0, 0, mTempMetrics.widthPixels, mTempMetrics.heightPixels);
362ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn        }
363ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn    }
3649066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
365ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn    /**
36668c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn     * Return the range of display sizes an application can expect to encounter
36768c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn     * under normal operation, as long as there is no physical change in screen
36868c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn     * size.  This is basically the sizes you will see as the orientation
36968c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn     * changes, taking into account whatever screen decoration there is in
37068c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn     * each rotation.  For example, the status bar is always at the top of the
37168c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn     * screen, so it will reduce the height both in landscape and portrait, and
37268c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn     * the smallest height returned here will be the smaller of the two.
37368c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn     *
37468c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn     * This is intended for applications to get an idea of the range of sizes
37568c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn     * they will encounter while going through device rotations, to provide a
37668c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn     * stable UI through rotation.  The sizes here take into account all standard
37768c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn     * system decorations that reduce the size actually available to the
37868c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn     * application: the status bar, navigation bar, system bar, etc.  It does
37968c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn     * <em>not</em> take into account more transient elements like an IME
38068c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn     * soft keyboard.
38168c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn     *
38268c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn     * @param outSmallestSize Filled in with the smallest width and height
38368c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn     * that the application will encounter, in pixels (not dp units).  The x
38468c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn     * (width) dimension here directly corresponds to
38568c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn     * {@link android.content.res.Configuration#smallestScreenWidthDp
38668c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn     * Configuration.smallestScreenWidthDp}, except the value here is in raw
38768c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn     * screen pixels rather than dp units.  Your application may of course
38868c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn     * still get smaller space yet if, for example, a soft keyboard is
38968c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn     * being displayed.
39068c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn     * @param outLargestSize Filled in with the largest width and height
39168c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn     * that the application will encounter, in pixels (not dp units).  Your
39268c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn     * application may of course still get larger space than this if,
39368c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn     * for example, screen decorations like the status bar are being hidden.
39468c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn     */
39568c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn    public void getCurrentSizeRange(Point outSmallestSize, Point outLargestSize) {
396fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown        synchronized (this) {
397fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            updateDisplayInfoLocked();
398fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            outSmallestSize.x = mDisplayInfo.smallestNominalAppWidth;
399fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            outSmallestSize.y = mDisplayInfo.smallestNominalAppHeight;
400fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            outLargestSize.x = mDisplayInfo.largestNominalAppWidth;
401fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            outLargestSize.y = mDisplayInfo.largestNominalAppHeight;
40268c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn        }
40368c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn    }
40468c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn
40568c33ca7ce1f142eb5f1e1f90118aeba4c9db1e3Dianne Hackborn    /**
406ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn     * Return the maximum screen size dimension that will happen.  This is
407ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn     * mostly for wallpapers.
408ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn     * @hide
409ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn     */
410ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn    public int getMaximumSizeDimension() {
411fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown        synchronized (this) {
412fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            updateDisplayInfoLocked();
413fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            return Math.max(mDisplayInfo.logicalWidth, mDisplayInfo.logicalHeight);
414ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn        }
415ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn    }
416ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn
417ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn    /**
418ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn     * @deprecated Use {@link #getSize(Point)} instead.
419ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn     */
420ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn    @Deprecated
421ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn    public int getWidth() {
422fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown        synchronized (this) {
423fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            updateCachedAppSizeIfNeededLocked();
424fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            return mCachedAppWidthCompat;
425ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn        }
426ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn    }
427ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn
428ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn    /**
429ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn     * @deprecated Use {@link #getSize(Point)} instead.
430ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn     */
431ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn    @Deprecated
432ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn    public int getHeight() {
433fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown        synchronized (this) {
434fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            updateCachedAppSizeIfNeededLocked();
435fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            return mCachedAppHeightCompat;
436bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown        }
437bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown    }
438ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn
439bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown    /**
440c652de8141f5b8e3c6bcf8916842b6e106413b1aDianne Hackborn     * @hide
441c652de8141f5b8e3c6bcf8916842b6e106413b1aDianne Hackborn     * Return a rectangle defining the insets of the overscan region of the display.
442c652de8141f5b8e3c6bcf8916842b6e106413b1aDianne Hackborn     * Each field of the rectangle is the number of pixels the overscan area extends
443c652de8141f5b8e3c6bcf8916842b6e106413b1aDianne Hackborn     * into the display on that side.
444c652de8141f5b8e3c6bcf8916842b6e106413b1aDianne Hackborn     */
445c652de8141f5b8e3c6bcf8916842b6e106413b1aDianne Hackborn    public void getOverscanInsets(Rect outRect) {
446c652de8141f5b8e3c6bcf8916842b6e106413b1aDianne Hackborn        synchronized (this) {
447c652de8141f5b8e3c6bcf8916842b6e106413b1aDianne Hackborn            updateDisplayInfoLocked();
448c652de8141f5b8e3c6bcf8916842b6e106413b1aDianne Hackborn            outRect.set(mDisplayInfo.overscanLeft, mDisplayInfo.overscanTop,
449c652de8141f5b8e3c6bcf8916842b6e106413b1aDianne Hackborn                    mDisplayInfo.overscanRight, mDisplayInfo.overscanBottom);
450c652de8141f5b8e3c6bcf8916842b6e106413b1aDianne Hackborn        }
451c652de8141f5b8e3c6bcf8916842b6e106413b1aDianne Hackborn    }
452c652de8141f5b8e3c6bcf8916842b6e106413b1aDianne Hackborn
453c652de8141f5b8e3c6bcf8916842b6e106413b1aDianne Hackborn    /**
4545cb70b54156fb305d579a1cc167424c8705bfdf7Dianne Hackborn     * Returns the rotation of the screen from its "natural" orientation.
4555cb70b54156fb305d579a1cc167424c8705bfdf7Dianne Hackborn     * The returned value may be {@link Surface#ROTATION_0 Surface.ROTATION_0}
4565cb70b54156fb305d579a1cc167424c8705bfdf7Dianne Hackborn     * (no rotation), {@link Surface#ROTATION_90 Surface.ROTATION_90},
4575cb70b54156fb305d579a1cc167424c8705bfdf7Dianne Hackborn     * {@link Surface#ROTATION_180 Surface.ROTATION_180}, or
4585cb70b54156fb305d579a1cc167424c8705bfdf7Dianne Hackborn     * {@link Surface#ROTATION_270 Surface.ROTATION_270}.  For
4595cb70b54156fb305d579a1cc167424c8705bfdf7Dianne Hackborn     * example, if a device has a naturally tall screen, and the user has
4605cb70b54156fb305d579a1cc167424c8705bfdf7Dianne Hackborn     * turned it on its side to go into a landscape orientation, the value
4615cb70b54156fb305d579a1cc167424c8705bfdf7Dianne Hackborn     * returned here may be either {@link Surface#ROTATION_90 Surface.ROTATION_90}
4625cb70b54156fb305d579a1cc167424c8705bfdf7Dianne Hackborn     * or {@link Surface#ROTATION_270 Surface.ROTATION_270} depending on
4635cb70b54156fb305d579a1cc167424c8705bfdf7Dianne Hackborn     * the direction it was turned.  The angle is the rotation of the drawn
4645cb70b54156fb305d579a1cc167424c8705bfdf7Dianne Hackborn     * graphics on the screen, which is the opposite direction of the physical
4655cb70b54156fb305d579a1cc167424c8705bfdf7Dianne Hackborn     * rotation of the device.  For example, if the device is rotated 90
4665cb70b54156fb305d579a1cc167424c8705bfdf7Dianne Hackborn     * degrees counter-clockwise, to compensate rendering will be rotated by
4675cb70b54156fb305d579a1cc167424c8705bfdf7Dianne Hackborn     * 90 degrees clockwise and thus the returned value here will be
4685cb70b54156fb305d579a1cc167424c8705bfdf7Dianne Hackborn     * {@link Surface#ROTATION_90 Surface.ROTATION_90}.
4695cb70b54156fb305d579a1cc167424c8705bfdf7Dianne Hackborn     */
4705cb70b54156fb305d579a1cc167424c8705bfdf7Dianne Hackborn    public int getRotation() {
471fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown        synchronized (this) {
472fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            updateDisplayInfoLocked();
473fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            return mDisplayInfo.rotation;
474fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown        }
4755cb70b54156fb305d579a1cc167424c8705bfdf7Dianne Hackborn    }
476fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown
4775cb70b54156fb305d579a1cc167424c8705bfdf7Dianne Hackborn    /**
4784c904a3bf3dbe98607b5e3f706ee8ef8887ee104Joe Onorato     * @deprecated use {@link #getRotation}
4799066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     * @return orientation of this display.
4809066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
481fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown    @Deprecated
482fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown    public int getOrientation() {
483fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown        return getRotation();
484fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown    }
4859066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
4869066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
487fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * Gets the pixel format of the display.
488fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * @return One of the constants defined in {@link android.graphics.PixelFormat}.
489fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     *
490fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * @deprecated This method is no longer supported.
491fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * The result is always {@link PixelFormat#RGBA_8888}.
4929066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
493fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown    @Deprecated
4949066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public int getPixelFormat() {
495fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown        return PixelFormat.RGBA_8888;
4969066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
497fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown
4989066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
499fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * Gets the refresh rate of this display in frames per second.
5009066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
5019066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public float getRefreshRate() {
502fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown        synchronized (this) {
503fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            updateDisplayInfoLocked();
504fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            return mDisplayInfo.refreshRate;
505fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown        }
5069066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
507fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown
5089066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    /**
509bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     * Gets display metrics that describe the size and density of this display.
510bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     * <p>
511bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     * The size is adjusted based on the current rotation of the display.
512bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     * </p><p>
513bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     * The size returned by this method does not necessarily represent the
514bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     * actual raw size (native resolution) of the display.  The returned size may
515bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     * be adjusted to exclude certain system decor elements that are always visible.
516bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     * It may also be scaled to provide compatibility with older applications that
517bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     * were originally designed for smaller displays.
518bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     * </p>
519bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     *
520bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown     * @param outMetrics A {@link DisplayMetrics} object to receive the metrics.
5219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project     */
5229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public void getMetrics(DisplayMetrics outMetrics) {
523fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown        synchronized (this) {
524fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            updateDisplayInfoLocked();
525fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            mDisplayInfo.getAppMetrics(outMetrics, mCompatibilityInfo);
52668066c2f38e47b56f0510c56eafd827731a0dc08Dianne Hackborn        }
52768066c2f38e47b56f0510c56eafd827731a0dc08Dianne Hackborn    }
52868066c2f38e47b56f0510c56eafd827731a0dc08Dianne Hackborn
52968066c2f38e47b56f0510c56eafd827731a0dc08Dianne Hackborn    /**
530fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * Gets the real size of the display without subtracting any window decor or
531fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * applying any compatibility scale factors.
532fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * <p>
533fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * The size is adjusted based on the current rotation of the display.
534fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * </p><p>
535fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * The real size may be smaller than the physical size of the screen when the
536fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * window manager is emulating a smaller display (using adb shell am display-size).
537fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * </p>
538fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     *
539fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * @param outSize Set to the real size of the display.
54068066c2f38e47b56f0510c56eafd827731a0dc08Dianne Hackborn     */
541fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown    public void getRealSize(Point outSize) {
542fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown        synchronized (this) {
543fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            updateDisplayInfoLocked();
544fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            outSize.x = mDisplayInfo.logicalWidth;
545fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            outSize.y = mDisplayInfo.logicalHeight;
546bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown        }
547bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown    }
548bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown
549bc68a59c024bdb745dac8e2ec7408a9f30595f1aJeff Brown    /**
550fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * Gets display metrics based on the real size of this display.
551fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * <p>
552fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * The size is adjusted based on the current rotation of the display.
553fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * </p><p>
554fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * The real size may be smaller than the physical size of the screen when the
555fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * window manager is emulating a smaller display (using adb shell am display-size).
556fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * </p>
557fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     *
558fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown     * @param outMetrics A {@link DisplayMetrics} object to receive the metrics.
55993de746e5554bc9397ca8109f57875d92e64eabcJeff Brown     */
560fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown    public void getRealMetrics(DisplayMetrics outMetrics) {
561fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown        synchronized (this) {
562fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            updateDisplayInfoLocked();
563fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            mDisplayInfo.getLogicalMetrics(outMetrics, null);
564fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown        }
56593de746e5554bc9397ca8109f57875d92e64eabcJeff Brown    }
56693de746e5554bc9397ca8109f57875d92e64eabcJeff Brown
567fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown    private void updateDisplayInfoLocked() {
568bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown        // Note: The display manager caches display info objects on our behalf.
569bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown        DisplayInfo newInfo = mGlobal.getDisplayInfo(mDisplayId);
570bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown        if (newInfo == null) {
571bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown            // Preserve the old mDisplayInfo after the display is removed.
572bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown            if (mIsValid) {
573bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown                mIsValid = false;
574bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown                if (DEBUG) {
575bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown                    Log.d(TAG, "Logical display " + mDisplayId + " was removed.");
576bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown                }
577bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown            }
578bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown        } else {
579bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown            // Use the new display info.  (It might be the same object if nothing changed.)
580bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown            mDisplayInfo = newInfo;
581bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown            if (!mIsValid) {
582bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown                mIsValid = true;
583bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown                if (DEBUG) {
584bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown                    Log.d(TAG, "Logical display " + mDisplayId + " was recreated.");
585bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown                }
586bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown            }
587fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown        }
5889066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
5899066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
590fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown    private void updateCachedAppSizeIfNeededLocked() {
591fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown        long now = SystemClock.uptimeMillis();
592fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown        if (now > mLastCachedAppSizeUpdate + CACHED_APP_SIZE_DURATION_MILLIS) {
593fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            updateDisplayInfoLocked();
594fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            mDisplayInfo.getAppMetrics(mTempMetrics, mCompatibilityInfo);
595fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            mCachedAppWidthCompat = mTempMetrics.widthPixels;
596fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            mCachedAppHeightCompat = mTempMetrics.heightPixels;
597fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown            mLastCachedAppSizeUpdate = now;
598fa25bf5382467b1018bd9af7f1cb30a23d7d59f7Jeff Brown        }
599ac8dea12c17aa047e03a358110aeb60401d36aa2Dianne Hackborn    }
600bf5740e75efd87ae0213486e78e029403804c6f0Jeff Brown
601bf5740e75efd87ae0213486e78e029403804c6f0Jeff Brown    // For debugging purposes
602bf5740e75efd87ae0213486e78e029403804c6f0Jeff Brown    @Override
603bf5740e75efd87ae0213486e78e029403804c6f0Jeff Brown    public String toString() {
604bf5740e75efd87ae0213486e78e029403804c6f0Jeff Brown        synchronized (this) {
605bf5740e75efd87ae0213486e78e029403804c6f0Jeff Brown            updateDisplayInfoLocked();
606bf5740e75efd87ae0213486e78e029403804c6f0Jeff Brown            mDisplayInfo.getAppMetrics(mTempMetrics, mCompatibilityInfo);
607bf5740e75efd87ae0213486e78e029403804c6f0Jeff Brown            return "Display id " + mDisplayId + ": " + mDisplayInfo
608bd6e1500aedc5461e832f69e76341bff0e55fa2bJeff Brown                    + ", " + mTempMetrics + ", isValid=" + mIsValid;
609bf5740e75efd87ae0213486e78e029403804c6f0Jeff Brown        }
610bf5740e75efd87ae0213486e78e029403804c6f0Jeff Brown    }
61192130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown
61292130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown    /**
61392130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     * @hide
61492130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown     */
61592130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown    public static String typeToString(int type) {
61692130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown        switch (type) {
61792130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown            case TYPE_UNKNOWN:
61892130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown                return "UNKNOWN";
61992130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown            case TYPE_BUILT_IN:
62092130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown                return "BUILT_IN";
62192130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown            case TYPE_HDMI:
62292130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown                return "HDMI";
62392130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown            case TYPE_WIFI:
62492130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown                return "WIFI";
62592130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown            case TYPE_OVERLAY:
62692130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown                return "OVERLAY";
62792130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown            default:
62892130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown                return Integer.toString(type);
62992130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown        }
63092130f6407dc51c58b3b941d28a6daf4e04b8d62Jeff Brown    }
6319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project}
6329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
633