blob: e6c6b1205b289b17e10a033a4b929db25a206e7e [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001/*
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
17package android.view;
18
Siva Velusamy0d857b92015-04-22 10:23:56 -070019import android.annotation.NonNull;
Bryce Lee53b9fbd2015-02-06 12:06:34 -080020import android.annotation.SystemApi;
Jeff Browna492c3a2012-08-23 19:48:44 -070021import android.app.Presentation;
22import android.content.Context;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080023import android.content.pm.ActivityInfo;
Alan Viveretteccb11e12014-07-08 16:04:02 -070024import android.graphics.Insets;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080025import android.graphics.PixelFormat;
Alan Viveretteccb11e12014-07-08 16:04:02 -070026import android.graphics.Rect;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080027import android.os.IBinder;
28import android.os.Parcel;
29import android.os.Parcelable;
30import android.text.TextUtils;
31import android.util.Log;
32
33
34/**
35 * The interface that apps use to talk to the window manager.
36 * <p>
37 * Use <code>Context.getSystemService(Context.WINDOW_SERVICE)</code> to get one of these.
Jeff Browna492c3a2012-08-23 19:48:44 -070038 * </p><p>
39 * Each window manager instance is bound to a particular {@link Display}.
40 * To obtain a {@link WindowManager} for a different display, use
41 * {@link Context#createDisplayContext} to obtain a {@link Context} for that
42 * display, then use <code>Context.getSystemService(Context.WINDOW_SERVICE)</code>
43 * to get the WindowManager.
44 * </p><p>
45 * The simplest way to show a window on another display is to create a
46 * {@link Presentation}. The presentation will automatically obtain a
47 * {@link WindowManager} and {@link Context} for that display.
48 * </p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080049 *
50 * @see android.content.Context#getSystemService
51 * @see android.content.Context#WINDOW_SERVICE
52 */
53public interface WindowManager extends ViewManager {
54 /**
55 * Exception that is thrown when trying to add view whose
Jorim Jaggi380ecb82014-03-14 17:25:20 +010056 * {@link LayoutParams} {@link LayoutParams#token}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080057 * is invalid.
58 */
59 public static class BadTokenException extends RuntimeException {
60 public BadTokenException() {
61 }
62
63 public BadTokenException(String name) {
64 super(name);
65 }
66 }
67
68 /**
Craig Mautner6018aee2012-10-23 14:27:49 -070069 * Exception that is thrown when calling {@link #addView} to a secondary display that cannot
70 * be found. See {@link android.app.Presentation} for more information on secondary displays.
71 */
72 public static class InvalidDisplayException extends RuntimeException {
73 public InvalidDisplayException() {
74 }
75
76 public InvalidDisplayException(String name) {
77 super(name);
78 }
79 }
80
81 /**
Jeff Browna492c3a2012-08-23 19:48:44 -070082 * Returns the {@link Display} upon which this {@link WindowManager} instance
83 * will create new windows.
84 * <p>
85 * Despite the name of this method, the display that is returned is not
86 * necessarily the primary display of the system (see {@link Display#DEFAULT_DISPLAY}).
87 * The returned display could instead be a secondary display that this
88 * window manager instance is managing. Think of it as the display that
89 * this {@link WindowManager} instance uses by default.
90 * </p><p>
91 * To create windows on a different display, you need to obtain a
92 * {@link WindowManager} for that {@link Display}. (See the {@link WindowManager}
93 * class documentation for more information.)
94 * </p>
95 *
96 * @return The display that this window manager is managing.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080097 */
98 public Display getDefaultDisplay();
Jeff Browna492c3a2012-08-23 19:48:44 -070099
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800100 /**
101 * Special variation of {@link #removeView} that immediately invokes
102 * the given view hierarchy's {@link View#onDetachedFromWindow()
103 * View.onDetachedFromWindow()} methods before returning. This is not
104 * for normal applications; using it correctly requires great care.
Wonsik Kim475e3f02014-03-17 11:17:47 +0000105 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800106 * @param view The view to be removed.
107 */
108 public void removeViewImmediate(View view);
Jeff Brownd32460c2012-07-20 16:15:36 -0700109
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800110 public static class LayoutParams extends ViewGroup.LayoutParams
111 implements Parcelable {
112 /**
113 * X position for this window. With the default gravity it is ignored.
Fabrice Di Meglio9e3b0022011-06-06 16:30:29 -0700114 * When using {@link Gravity#LEFT} or {@link Gravity#START} or {@link Gravity#RIGHT} or
115 * {@link Gravity#END} it provides an offset from the given edge.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800116 */
Romain Guy529b60a2010-08-03 18:05:47 -0700117 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800118 public int x;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000119
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800120 /**
121 * Y position for this window. With the default gravity it is ignored.
122 * When using {@link Gravity#TOP} or {@link Gravity#BOTTOM} it provides
123 * an offset from the given edge.
124 */
Romain Guy529b60a2010-08-03 18:05:47 -0700125 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800126 public int y;
127
128 /**
129 * Indicates how much of the extra space will be allocated horizontally
130 * to the view associated with these LayoutParams. Specify 0 if the view
131 * should not be stretched. Otherwise the extra pixels will be pro-rated
132 * among all views whose weight is greater than 0.
133 */
Romain Guy529b60a2010-08-03 18:05:47 -0700134 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800135 public float horizontalWeight;
136
137 /**
138 * Indicates how much of the extra space will be allocated vertically
139 * to the view associated with these LayoutParams. Specify 0 if the view
140 * should not be stretched. Otherwise the extra pixels will be pro-rated
141 * among all views whose weight is greater than 0.
142 */
Romain Guy529b60a2010-08-03 18:05:47 -0700143 @ViewDebug.ExportedProperty
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800144 public float verticalWeight;
Romain Guy529b60a2010-08-03 18:05:47 -0700145
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800146 /**
147 * The general type of window. There are three main classes of
148 * window types:
149 * <ul>
150 * <li> <strong>Application windows</strong> (ranging from
151 * {@link #FIRST_APPLICATION_WINDOW} to
152 * {@link #LAST_APPLICATION_WINDOW}) are normal top-level application
153 * windows. For these types of windows, the {@link #token} must be
154 * set to the token of the activity they are a part of (this will
155 * normally be done for you if {@link #token} is null).
156 * <li> <strong>Sub-windows</strong> (ranging from
157 * {@link #FIRST_SUB_WINDOW} to
158 * {@link #LAST_SUB_WINDOW}) are associated with another top-level
159 * window. For these types of windows, the {@link #token} must be
160 * the token of the window it is attached to.
161 * <li> <strong>System windows</strong> (ranging from
162 * {@link #FIRST_SYSTEM_WINDOW} to
163 * {@link #LAST_SYSTEM_WINDOW}) are special types of windows for
164 * use by the system for specific purposes. They should not normally
165 * be used by applications, and a special permission is required
166 * to use them.
167 * </ul>
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700168 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800169 * @see #TYPE_BASE_APPLICATION
170 * @see #TYPE_APPLICATION
171 * @see #TYPE_APPLICATION_STARTING
172 * @see #TYPE_APPLICATION_PANEL
173 * @see #TYPE_APPLICATION_MEDIA
174 * @see #TYPE_APPLICATION_SUB_PANEL
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700175 * @see #TYPE_APPLICATION_ABOVE_SUB_PANEL
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800176 * @see #TYPE_APPLICATION_ATTACHED_DIALOG
177 * @see #TYPE_STATUS_BAR
178 * @see #TYPE_SEARCH_BAR
179 * @see #TYPE_PHONE
180 * @see #TYPE_SYSTEM_ALERT
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800181 * @see #TYPE_TOAST
182 * @see #TYPE_SYSTEM_OVERLAY
183 * @see #TYPE_PRIORITY_PHONE
184 * @see #TYPE_STATUS_BAR_PANEL
185 * @see #TYPE_SYSTEM_DIALOG
186 * @see #TYPE_KEYGUARD_DIALOG
187 * @see #TYPE_SYSTEM_ERROR
188 * @see #TYPE_INPUT_METHOD
189 * @see #TYPE_INPUT_METHOD_DIALOG
190 */
Joe Onorato8f2bd432010-03-25 11:45:28 -0700191 @ViewDebug.ExportedProperty(mapping = {
192 @ViewDebug.IntToString(from = TYPE_BASE_APPLICATION, to = "TYPE_BASE_APPLICATION"),
193 @ViewDebug.IntToString(from = TYPE_APPLICATION, to = "TYPE_APPLICATION"),
194 @ViewDebug.IntToString(from = TYPE_APPLICATION_STARTING, to = "TYPE_APPLICATION_STARTING"),
195 @ViewDebug.IntToString(from = TYPE_APPLICATION_PANEL, to = "TYPE_APPLICATION_PANEL"),
196 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA, to = "TYPE_APPLICATION_MEDIA"),
197 @ViewDebug.IntToString(from = TYPE_APPLICATION_SUB_PANEL, to = "TYPE_APPLICATION_SUB_PANEL"),
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700198 @ViewDebug.IntToString(from = TYPE_APPLICATION_ABOVE_SUB_PANEL, to = "TYPE_APPLICATION_ABOVE_SUB_PANEL"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700199 @ViewDebug.IntToString(from = TYPE_APPLICATION_ATTACHED_DIALOG, to = "TYPE_APPLICATION_ATTACHED_DIALOG"),
Scott Andersonaeb77232012-05-31 18:55:54 -0700200 @ViewDebug.IntToString(from = TYPE_APPLICATION_MEDIA_OVERLAY, to = "TYPE_APPLICATION_MEDIA_OVERLAY"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700201 @ViewDebug.IntToString(from = TYPE_STATUS_BAR, to = "TYPE_STATUS_BAR"),
202 @ViewDebug.IntToString(from = TYPE_SEARCH_BAR, to = "TYPE_SEARCH_BAR"),
203 @ViewDebug.IntToString(from = TYPE_PHONE, to = "TYPE_PHONE"),
204 @ViewDebug.IntToString(from = TYPE_SYSTEM_ALERT, to = "TYPE_SYSTEM_ALERT"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700205 @ViewDebug.IntToString(from = TYPE_TOAST, to = "TYPE_TOAST"),
206 @ViewDebug.IntToString(from = TYPE_SYSTEM_OVERLAY, to = "TYPE_SYSTEM_OVERLAY"),
207 @ViewDebug.IntToString(from = TYPE_PRIORITY_PHONE, to = "TYPE_PRIORITY_PHONE"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700208 @ViewDebug.IntToString(from = TYPE_SYSTEM_DIALOG, to = "TYPE_SYSTEM_DIALOG"),
209 @ViewDebug.IntToString(from = TYPE_KEYGUARD_DIALOG, to = "TYPE_KEYGUARD_DIALOG"),
210 @ViewDebug.IntToString(from = TYPE_SYSTEM_ERROR, to = "TYPE_SYSTEM_ERROR"),
211 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD, to = "TYPE_INPUT_METHOD"),
Jeff Brown3b2b3542010-10-15 00:54:27 -0700212 @ViewDebug.IntToString(from = TYPE_INPUT_METHOD_DIALOG, to = "TYPE_INPUT_METHOD_DIALOG"),
Jeff Brownbfcb60a2011-09-08 18:51:14 -0700213 @ViewDebug.IntToString(from = TYPE_WALLPAPER, to = "TYPE_WALLPAPER"),
214 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_PANEL, to = "TYPE_STATUS_BAR_PANEL"),
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700215 @ViewDebug.IntToString(from = TYPE_SECURE_SYSTEM_OVERLAY, to = "TYPE_SECURE_SYSTEM_OVERLAY"),
Jeff Brownbfcb60a2011-09-08 18:51:14 -0700216 @ViewDebug.IntToString(from = TYPE_DRAG, to = "TYPE_DRAG"),
217 @ViewDebug.IntToString(from = TYPE_STATUS_BAR_SUB_PANEL, to = "TYPE_STATUS_BAR_SUB_PANEL"),
218 @ViewDebug.IntToString(from = TYPE_POINTER, to = "TYPE_POINTER"),
219 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR, to = "TYPE_NAVIGATION_BAR"),
220 @ViewDebug.IntToString(from = TYPE_VOLUME_OVERLAY, to = "TYPE_VOLUME_OVERLAY"),
Scott Andersonaeb77232012-05-31 18:55:54 -0700221 @ViewDebug.IntToString(from = TYPE_BOOT_PROGRESS, to = "TYPE_BOOT_PROGRESS"),
222 @ViewDebug.IntToString(from = TYPE_HIDDEN_NAV_CONSUMER, to = "TYPE_HIDDEN_NAV_CONSUMER"),
223 @ViewDebug.IntToString(from = TYPE_DREAM, to = "TYPE_DREAM"),
Jeff Brownbd6e1502012-08-28 03:27:37 -0700224 @ViewDebug.IntToString(from = TYPE_NAVIGATION_BAR_PANEL, to = "TYPE_NAVIGATION_BAR_PANEL"),
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700225 @ViewDebug.IntToString(from = TYPE_DISPLAY_OVERLAY, to = "TYPE_DISPLAY_OVERLAY"),
keunyounga446bf02013-06-21 19:07:57 -0700226 @ViewDebug.IntToString(from = TYPE_MAGNIFICATION_OVERLAY, to = "TYPE_MAGNIFICATION_OVERLAY"),
Dianne Hackborne30e02f2014-05-27 18:24:45 -0700227 @ViewDebug.IntToString(from = TYPE_PRIVATE_PRESENTATION, to = "TYPE_PRIVATE_PRESENTATION"),
228 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION, to = "TYPE_VOICE_INTERACTION"),
Jorim Jaggi225d3b52015-04-01 11:18:57 -0700229 @ViewDebug.IntToString(from = TYPE_VOICE_INTERACTION_STARTING, to = "TYPE_VOICE_INTERACTION_STARTING"),
Joe Onorato8f2bd432010-03-25 11:45:28 -0700230 })
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800231 public int type;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000232
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800233 /**
234 * Start of window types that represent normal application windows.
235 */
236 public static final int FIRST_APPLICATION_WINDOW = 1;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000237
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800238 /**
239 * Window type: an application window that serves as the "base" window
240 * of the overall application; all other application windows will
241 * appear on top of it.
Craig Mautner5962b122012-10-05 14:45:52 -0700242 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800243 */
244 public static final int TYPE_BASE_APPLICATION = 1;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000245
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800246 /**
247 * Window type: a normal application window. The {@link #token} must be
248 * an Activity token identifying who the window belongs to.
Craig Mautner5962b122012-10-05 14:45:52 -0700249 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800250 */
251 public static final int TYPE_APPLICATION = 2;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000252
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800253 /**
254 * Window type: special application window that is displayed while the
255 * application is starting. Not for use by applications themselves;
256 * this is used by the system to display something until the
257 * application can show its own windows.
Craig Mautner5962b122012-10-05 14:45:52 -0700258 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800259 */
260 public static final int TYPE_APPLICATION_STARTING = 3;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000261
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800262 /**
263 * End of types of application windows.
264 */
265 public static final int LAST_APPLICATION_WINDOW = 99;
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700266
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800267 /**
268 * Start of types of sub-windows. The {@link #token} of these windows
269 * must be set to the window they are attached to. These types of
270 * windows are kept next to their attached window in Z-order, and their
271 * coordinate space is relative to their attached window.
272 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700273 public static final int FIRST_SUB_WINDOW = 1000;
274
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800275 /**
276 * Window type: a panel on top of an application window. These windows
277 * appear on top of their attached window.
278 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700279 public static final int TYPE_APPLICATION_PANEL = FIRST_SUB_WINDOW;
280
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800281 /**
John Spurlock33291d82013-03-13 14:45:14 -0400282 * Window type: window for showing media (such as video). These windows
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800283 * are displayed behind their attached window.
284 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700285 public static final int TYPE_APPLICATION_MEDIA = FIRST_SUB_WINDOW + 1;
286
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800287 /**
288 * Window type: a sub-panel on top of an application window. These
289 * windows are displayed on top their attached window and any
290 * {@link #TYPE_APPLICATION_PANEL} panels.
291 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700292 public static final int TYPE_APPLICATION_SUB_PANEL = FIRST_SUB_WINDOW + 2;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800293
294 /** Window type: like {@link #TYPE_APPLICATION_PANEL}, but layout
295 * of the window happens as that of a top-level window, <em>not</em>
296 * as a child of its container.
297 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700298 public static final int TYPE_APPLICATION_ATTACHED_DIALOG = FIRST_SUB_WINDOW + 3;
299
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800300 /**
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700301 * Window type: window for showing overlays on top of media windows.
302 * These windows are displayed between TYPE_APPLICATION_MEDIA and the
303 * application window. They should be translucent to be useful. This
304 * is a big ugly hack so:
305 * @hide
306 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700307 public static final int TYPE_APPLICATION_MEDIA_OVERLAY = FIRST_SUB_WINDOW + 4;
308
309 /**
310 * Window type: a above sub-panel on top of an application window and it's
311 * sub-panel windows. These windows are displayed on top of their attached window
312 * and any {@link #TYPE_APPLICATION_SUB_PANEL} panels.
313 */
314 public static final int TYPE_APPLICATION_ABOVE_SUB_PANEL = FIRST_SUB_WINDOW + 5;
315
Dianne Hackbornc4d5d022009-05-21 17:32:42 -0700316 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800317 * End of types of sub-windows.
318 */
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700319 public static final int LAST_SUB_WINDOW = 1999;
320
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800321 /**
322 * Start of system-specific window types. These are not normally
323 * created by applications.
324 */
325 public static final int FIRST_SYSTEM_WINDOW = 2000;
Wale Ogunwale0a4dc222015-04-14 12:58:42 -0700326
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800327 /**
328 * Window type: the status bar. There can be only one status bar
329 * window; it is placed at the top of the screen, and all other
330 * windows are shifted down so they are below it.
Craig Mautner88400d32012-09-30 12:35:45 -0700331 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800332 */
333 public static final int TYPE_STATUS_BAR = FIRST_SYSTEM_WINDOW;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000334
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800335 /**
336 * Window type: the search bar. There can be only one search bar
337 * window; it is placed at the top of the screen.
Craig Mautner88400d32012-09-30 12:35:45 -0700338 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800339 */
340 public static final int TYPE_SEARCH_BAR = FIRST_SYSTEM_WINDOW+1;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000341
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800342 /**
343 * Window type: phone. These are non-application windows providing
344 * user interaction with the phone (in particular incoming calls).
345 * These windows are normally placed above all applications, but behind
346 * the status bar.
Craig Mautner88400d32012-09-30 12:35:45 -0700347 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800348 */
349 public static final int TYPE_PHONE = FIRST_SYSTEM_WINDOW+2;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000350
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800351 /**
352 * Window type: system window, such as low power alert. These windows
353 * are always on top of application windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700354 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800355 */
356 public static final int TYPE_SYSTEM_ALERT = FIRST_SYSTEM_WINDOW+3;
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100357
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800358 /**
359 * Window type: keyguard window.
Craig Mautner88400d32012-09-30 12:35:45 -0700360 * In multiuser systems shows on all users' windows.
Jorim Jaggie411fdf2014-07-28 23:00:44 +0200361 * @removed
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800362 */
363 public static final int TYPE_KEYGUARD = FIRST_SYSTEM_WINDOW+4;
Jorim Jaggi380ecb82014-03-14 17:25:20 +0100364
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800365 /**
366 * Window type: transient notifications.
Craig Mautner88400d32012-09-30 12:35:45 -0700367 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800368 */
369 public static final int TYPE_TOAST = FIRST_SYSTEM_WINDOW+5;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000370
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800371 /**
372 * Window type: system overlay windows, which need to be displayed
373 * on top of everything else. These windows must not take input
374 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700375 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800376 */
377 public static final int TYPE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+6;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000378
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800379 /**
380 * Window type: priority phone UI, which needs to be displayed even if
381 * the keyguard is active. These windows must not take input
382 * focus, or they will interfere with the keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700383 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800384 */
385 public static final int TYPE_PRIORITY_PHONE = FIRST_SYSTEM_WINDOW+7;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000386
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800387 /**
388 * Window type: panel that slides out from the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700389 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800390 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800391 public static final int TYPE_SYSTEM_DIALOG = FIRST_SYSTEM_WINDOW+8;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000392
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800393 /**
394 * Window type: dialogs that the keyguard shows
Craig Mautner88400d32012-09-30 12:35:45 -0700395 * In multiuser systems shows on all users' windows.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800396 */
397 public static final int TYPE_KEYGUARD_DIALOG = FIRST_SYSTEM_WINDOW+9;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000398
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800399 /**
400 * Window type: internal system error windows, appear on top of
401 * everything they can.
Craig Mautner88400d32012-09-30 12:35:45 -0700402 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800403 */
404 public static final int TYPE_SYSTEM_ERROR = FIRST_SYSTEM_WINDOW+10;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000405
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800406 /**
407 * Window type: internal input methods windows, which appear above
408 * the normal UI. Application windows may be resized or panned to keep
409 * the input focus visible while this window is displayed.
Craig Mautner88400d32012-09-30 12:35:45 -0700410 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800411 */
412 public static final int TYPE_INPUT_METHOD = FIRST_SYSTEM_WINDOW+11;
413
414 /**
415 * Window type: internal input methods dialog windows, which appear above
416 * the current input method window.
Craig Mautner88400d32012-09-30 12:35:45 -0700417 * In multiuser systems shows only on the owning user's window.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800418 */
419 public static final int TYPE_INPUT_METHOD_DIALOG= FIRST_SYSTEM_WINDOW+12;
420
421 /**
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700422 * Window type: wallpaper window, placed behind any window that wants
423 * to sit on top of the wallpaper.
Craig Mautner88400d32012-09-30 12:35:45 -0700424 * In multiuser systems shows only on the owning user's window.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700425 */
426 public static final int TYPE_WALLPAPER = FIRST_SYSTEM_WINDOW+13;
427
428 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -0800429 * Window type: panel that slides out from over the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700430 * In multiuser systems shows on all users' windows.
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800431 */
432 public static final int TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14;
Jeff Brown3b2b3542010-10-15 00:54:27 -0700433
434 /**
435 * Window type: secure system overlay windows, which need to be displayed
436 * on top of everything else. These windows must not take input
437 * focus, or they will interfere with the keyguard.
438 *
439 * This is exactly like {@link #TYPE_SYSTEM_OVERLAY} except that only the
440 * system itself is allowed to create these overlays. Applications cannot
441 * obtain permission to create secure system overlays.
Craig Mautner88400d32012-09-30 12:35:45 -0700442 *
443 * In multiuser systems shows only on the owning user's window.
Jeff Brown3b2b3542010-10-15 00:54:27 -0700444 * @hide
445 */
446 public static final int TYPE_SECURE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+15;
447
Dianne Hackbornbadc47e2009-11-08 17:37:07 -0800448 /**
Christopher Tatea53146c2010-09-07 11:57:52 -0700449 * Window type: the drag-and-drop pseudowindow. There is only one
450 * drag layer (at most), and it is placed on top of all other windows.
Craig Mautner88400d32012-09-30 12:35:45 -0700451 * In multiuser systems shows only on the owning user's window.
Christopher Tatea53146c2010-09-07 11:57:52 -0700452 * @hide
453 */
Jeff Brown3b2b3542010-10-15 00:54:27 -0700454 public static final int TYPE_DRAG = FIRST_SYSTEM_WINDOW+16;
Christopher Tatea53146c2010-09-07 11:57:52 -0700455
456 /**
Joe Onorato29fc2c92010-11-24 10:26:50 -0800457 * Window type: panel that slides out from under the status bar
Craig Mautner88400d32012-09-30 12:35:45 -0700458 * In multiuser systems shows on all users' windows.
Joe Onoratoa89e9032010-11-24 11:13:44 -0800459 * @hide
Joe Onorato29fc2c92010-11-24 10:26:50 -0800460 */
461 public static final int TYPE_STATUS_BAR_SUB_PANEL = FIRST_SYSTEM_WINDOW+17;
462
Jeff Brown83c09682010-12-23 17:50:18 -0800463 /**
464 * Window type: (mouse) pointer
Craig Mautner88400d32012-09-30 12:35:45 -0700465 * In multiuser systems shows on all users' windows.
Jeff Brown83c09682010-12-23 17:50:18 -0800466 * @hide
467 */
468 public static final int TYPE_POINTER = FIRST_SYSTEM_WINDOW+18;
Joe Onorato29fc2c92010-11-24 10:26:50 -0800469
470 /**
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400471 * Window type: Navigation bar (when distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -0700472 * In multiuser systems shows on all users' windows.
Daniel Sandler8956dbb2011-04-22 07:55:02 -0400473 * @hide
474 */
475 public static final int TYPE_NAVIGATION_BAR = FIRST_SYSTEM_WINDOW+19;
476
477 /**
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700478 * Window type: The volume level overlay/dialog shown when the user
479 * changes the system volume.
Craig Mautner88400d32012-09-30 12:35:45 -0700480 * In multiuser systems shows on all users' windows.
Dianne Hackborne8ecde12011-08-03 18:55:19 -0700481 * @hide
482 */
483 public static final int TYPE_VOLUME_OVERLAY = FIRST_SYSTEM_WINDOW+20;
484
485 /**
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700486 * Window type: The boot progress dialog, goes on top of everything
487 * in the world.
Craig Mautner88400d32012-09-30 12:35:45 -0700488 * In multiuser systems shows on all users' windows.
Dianne Hackborn29aae6f2011-08-18 18:30:09 -0700489 * @hide
490 */
491 public static final int TYPE_BOOT_PROGRESS = FIRST_SYSTEM_WINDOW+21;
492
493 /**
Dianne Hackborndf89e652011-10-06 22:35:11 -0700494 * Window type: Fake window to consume touch events when the navigation
495 * bar is hidden.
Craig Mautner88400d32012-09-30 12:35:45 -0700496 * In multiuser systems shows on all users' windows.
Dianne Hackborndf89e652011-10-06 22:35:11 -0700497 * @hide
498 */
499 public static final int TYPE_HIDDEN_NAV_CONSUMER = FIRST_SYSTEM_WINDOW+22;
500
501 /**
Daniel Sandler7d276c32012-01-30 14:33:52 -0500502 * Window type: Dreams (screen saver) window, just above keyguard.
Craig Mautner88400d32012-09-30 12:35:45 -0700503 * In multiuser systems shows only on the owning user's window.
Daniel Sandler7d276c32012-01-30 14:33:52 -0500504 * @hide
505 */
506 public static final int TYPE_DREAM = FIRST_SYSTEM_WINDOW+23;
507
508 /**
Jim Millere898ac52012-04-06 17:10:57 -0700509 * Window type: Navigation bar panel (when navigation bar is distinct from status bar)
Craig Mautner88400d32012-09-30 12:35:45 -0700510 * In multiuser systems shows on all users' windows.
Jim Millere898ac52012-04-06 17:10:57 -0700511 * @hide
512 */
513 public static final int TYPE_NAVIGATION_BAR_PANEL = FIRST_SYSTEM_WINDOW+24;
514
515 /**
Jeff Brownbd6e1502012-08-28 03:27:37 -0700516 * Window type: Display overlay window. Used to simulate secondary display devices.
Craig Mautner88400d32012-09-30 12:35:45 -0700517 * In multiuser systems shows on all users' windows.
Jeff Brownbd6e1502012-08-28 03:27:37 -0700518 * @hide
519 */
520 public static final int TYPE_DISPLAY_OVERLAY = FIRST_SYSTEM_WINDOW+26;
521
522 /**
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700523 * Window type: Magnification overlay window. Used to highlight the magnified
524 * portion of a display when accessibility magnification is enabled.
Craig Mautner88400d32012-09-30 12:35:45 -0700525 * In multiuser systems shows on all users' windows.
Svetoslav Ganov1cf70bb2012-08-06 10:53:34 -0700526 * @hide
527 */
528 public static final int TYPE_MAGNIFICATION_OVERLAY = FIRST_SYSTEM_WINDOW+27;
529
530 /**
Jim Miller5ecd8112013-01-09 18:50:26 -0800531 * Window type: keyguard scrim window. Shows if keyguard needs to be restarted.
532 * In multiuser systems shows on all users' windows.
533 * @hide
534 */
535 public static final int TYPE_KEYGUARD_SCRIM = FIRST_SYSTEM_WINDOW+29;
536
Craig Mautner88400d32012-09-30 12:35:45 -0700537 /**
keunyounga446bf02013-06-21 19:07:57 -0700538 * Window type: Window for Presentation on top of private
539 * virtual display.
540 */
541 public static final int TYPE_PRIVATE_PRESENTATION = FIRST_SYSTEM_WINDOW+30;
542
543 /**
Dianne Hackborne30e02f2014-05-27 18:24:45 -0700544 * Window type: Windows in the voice interaction layer.
545 * @hide
546 */
547 public static final int TYPE_VOICE_INTERACTION = FIRST_SYSTEM_WINDOW+31;
548
549 /**
Svetoslav3a5c7212014-10-14 09:54:26 -0700550 * Window type: Windows that are overlaid <em>only</em> by an {@link
551 * android.accessibilityservice.AccessibilityService} for interception of
552 * user interactions without changing the windows an accessibility service
553 * can introspect. In particular, an accessibility service can introspect
554 * only windows that a sighted user can interact with which is they can touch
555 * these windows or can type into these windows. For example, if there
556 * is a full screen accessibility overlay that is touchable, the windows
557 * below it will be introspectable by an accessibility service regardless
558 * they are covered by a touchable window.
559 */
560 public static final int TYPE_ACCESSIBILITY_OVERLAY = FIRST_SYSTEM_WINDOW+32;
561
562 /**
Jorim Jaggi225d3b52015-04-01 11:18:57 -0700563 * Window type: Starting window for voice interaction layer.
564 * @hide
565 */
566 public static final int TYPE_VOICE_INTERACTION_STARTING = FIRST_SYSTEM_WINDOW+33;
567
568 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800569 * End of types of system windows.
570 */
571 public static final int LAST_SYSTEM_WINDOW = 2999;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800572
Mathias Agopiand2112302010-12-07 19:38:17 -0800573 /** @deprecated this is ignored, this value is set automatically when needed. */
574 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800575 public static final int MEMORY_TYPE_NORMAL = 0;
Mathias Agopiand2112302010-12-07 19:38:17 -0800576 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -0700577 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800578 public static final int MEMORY_TYPE_HARDWARE = 1;
Mathias Agopiand2112302010-12-07 19:38:17 -0800579 /** @deprecated this is ignored, this value is set automatically when needed. */
Mathias Agopian317a6282009-08-13 17:29:02 -0700580 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800581 public static final int MEMORY_TYPE_GPU = 2;
Mathias Agopiand2112302010-12-07 19:38:17 -0800582 /** @deprecated this is ignored, this value is set automatically when needed. */
583 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800584 public static final int MEMORY_TYPE_PUSH_BUFFERS = 3;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000585
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800586 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700587 * @deprecated this is ignored
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800588 */
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700589 @Deprecated
590 public int memoryType;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000591
Mike Lockwoodef731622010-01-27 17:51:34 -0500592 /** Window flag: as long as this window is visible to the user, allow
Wonsik Kim475e3f02014-03-17 11:17:47 +0000593 * the lock screen to activate while the screen is on.
594 * This can be used independently, or in combination with
Christopher Tate95f78502010-01-29 15:57:34 -0800595 * {@link #FLAG_KEEP_SCREEN_ON} and/or {@link #FLAG_SHOW_WHEN_LOCKED} */
Mike Lockwoodef731622010-01-27 17:51:34 -0500596 public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001;
597
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800598 /** Window flag: everything behind this window will be dimmed.
599 * Use {@link #dimAmount} to control the amount of dim. */
600 public static final int FLAG_DIM_BEHIND = 0x00000002;
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700601
602 /** Window flag: blur everything behind this window.
603 * @deprecated Blurring is no longer supported. */
604 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800605 public static final int FLAG_BLUR_BEHIND = 0x00000004;
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700606
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800607 /** Window flag: this window won't ever get key input focus, so the
608 * user can not send key or other button events to it. Those will
609 * instead go to whatever focusable window is behind it. This flag
610 * will also enable {@link #FLAG_NOT_TOUCH_MODAL} whether or not that
611 * is explicitly set.
Wonsik Kim475e3f02014-03-17 11:17:47 +0000612 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800613 * <p>Setting this flag also implies that the window will not need to
614 * interact with
Wonsik Kim475e3f02014-03-17 11:17:47 +0000615 * a soft input method, so it will be Z-ordered and positioned
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800616 * independently of any active input method (typically this means it
617 * gets Z-ordered on top of the input method, so it can use the full
618 * screen for its content and cover the input method if needed. You
619 * can use {@link #FLAG_ALT_FOCUSABLE_IM} to modify this behavior. */
620 public static final int FLAG_NOT_FOCUSABLE = 0x00000008;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000621
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800622 /** Window flag: this window can never receive touch events. */
623 public static final int FLAG_NOT_TOUCHABLE = 0x00000010;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000624
John Spurlock33291d82013-03-13 14:45:14 -0400625 /** Window flag: even when this window is focusable (its
626 * {@link #FLAG_NOT_FOCUSABLE} is not set), allow any pointer events
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800627 * outside of the window to be sent to the windows behind it. Otherwise
628 * it will consume all pointer events itself, regardless of whether they
629 * are inside of the window. */
630 public static final int FLAG_NOT_TOUCH_MODAL = 0x00000020;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000631
John Spurlock33291d82013-03-13 14:45:14 -0400632 /** Window flag: when set, if the device is asleep when the touch
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800633 * screen is pressed, you will receive this first touch event. Usually
634 * the first touch event is consumed by the system since the user can
635 * not see what they are pressing on.
Jeff Brown037c33e2014-04-09 00:31:55 -0700636 *
637 * @deprecated This flag has no effect.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800638 */
Jeff Brown037c33e2014-04-09 00:31:55 -0700639 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800640 public static final int FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000641
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800642 /** Window flag: as long as this window is visible to the user, keep
643 * the device's screen turned on and bright. */
644 public static final int FLAG_KEEP_SCREEN_ON = 0x00000080;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000645
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800646 /** Window flag: place the window within the entire screen, ignoring
John Spurlock33291d82013-03-13 14:45:14 -0400647 * decorations around the border (such as the status bar). The
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800648 * window must correctly position its contents to take the screen
649 * decoration into account. This flag is normally set for you
650 * by Window as described in {@link Window#setFlags}. */
651 public static final int FLAG_LAYOUT_IN_SCREEN = 0x00000100;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000652
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800653 /** Window flag: allow window to extend outside of the screen. */
654 public static final int FLAG_LAYOUT_NO_LIMITS = 0x00000200;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000655
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800656 /**
John Spurlock33291d82013-03-13 14:45:14 -0400657 * Window flag: hide all screen decorations (such as the status bar) while
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800658 * this window is displayed. This allows the window to use the entire
659 * display space for itself -- the status bar will be hidden when
Chet Haase45c89c22013-04-29 16:04:40 -0700660 * an app window with this flag set is on the top layer. A fullscreen window
661 * will ignore a value of {@link #SOFT_INPUT_ADJUST_RESIZE} for the window's
662 * {@link #softInputMode} field; the window will stay fullscreen
663 * and will not resize.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800664 *
665 * <p>This flag can be controlled in your theme through the
666 * {@link android.R.attr#windowFullscreen} attribute; this attribute
667 * is automatically set for you in the standard fullscreen themes
668 * such as {@link android.R.style#Theme_NoTitleBar_Fullscreen},
669 * {@link android.R.style#Theme_Black_NoTitleBar_Fullscreen},
670 * {@link android.R.style#Theme_Light_NoTitleBar_Fullscreen},
671 * {@link android.R.style#Theme_Holo_NoActionBar_Fullscreen},
672 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Fullscreen},
673 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Fullscreen}, and
674 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Fullscreen}.</p>
675 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800676 public static final int FLAG_FULLSCREEN = 0x00000400;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000677
John Spurlock33291d82013-03-13 14:45:14 -0400678 /** Window flag: override {@link #FLAG_FULLSCREEN} and force the
679 * screen decorations (such as the status bar) to be shown. */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800680 public static final int FLAG_FORCE_NOT_FULLSCREEN = 0x00000800;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000681
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800682 /** Window flag: turn on dithering when compositing this window to
Jeff Brown3cc321e2012-07-16 16:04:23 -0700683 * the screen.
684 * @deprecated This flag is no longer used. */
685 @Deprecated
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800686 public static final int FLAG_DITHER = 0x00001000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000687
John Spurlock33291d82013-03-13 14:45:14 -0400688 /** Window flag: treat the content of the window as secure, preventing
Jeff Brownf0681b32012-10-23 17:35:57 -0700689 * it from appearing in screenshots or from being viewed on non-secure
690 * displays.
691 *
692 * <p>See {@link android.view.Display#FLAG_SECURE} for more details about
693 * secure surfaces and secure displays.
694 */
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800695 public static final int FLAG_SECURE = 0x00002000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000696
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800697 /** Window flag: a special mode where the layout parameters are used
698 * to perform scaling of the surface when it is composited to the
699 * screen. */
700 public static final int FLAG_SCALED = 0x00004000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000701
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800702 /** Window flag: intended for windows that will often be used when the user is
703 * holding the screen against their face, it will aggressively filter the event
704 * stream to prevent unintended presses in this situation that may not be
Wonsik Kim475e3f02014-03-17 11:17:47 +0000705 * desired for a particular window, when such an event stream is detected, the
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800706 * application will receive a CANCEL motion event to indicate this so applications
Wonsik Kim475e3f02014-03-17 11:17:47 +0000707 * can handle this accordingly by taking no action on the event
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800708 * until the finger is released. */
709 public static final int FLAG_IGNORE_CHEEK_PRESSES = 0x00008000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000710
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800711 /** Window flag: a special option only for use in combination with
712 * {@link #FLAG_LAYOUT_IN_SCREEN}. When requesting layout in the
713 * screen your window may appear on top of or behind screen decorations
714 * such as the status bar. By also including this flag, the window
715 * manager will report the inset rectangle needed to ensure your
716 * content is not covered by screen decorations. This flag is normally
717 * set for you by Window as described in {@link Window#setFlags}.*/
718 public static final int FLAG_LAYOUT_INSET_DECOR = 0x00010000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000719
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800720 /** Window flag: invert the state of {@link #FLAG_NOT_FOCUSABLE} with
721 * respect to how this window interacts with the current method. That
722 * is, if FLAG_NOT_FOCUSABLE is set and this flag is set, then the
723 * window will behave as if it needs to interact with the input method
724 * and thus be placed behind/away from it; if FLAG_NOT_FOCUSABLE is
725 * not set and this flag is set, then the window will behave as if it
726 * doesn't need to interact with the input method and can be placed
727 * to use more space and cover the input method.
728 */
729 public static final int FLAG_ALT_FOCUSABLE_IM = 0x00020000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000730
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800731 /** Window flag: if you have set {@link #FLAG_NOT_TOUCH_MODAL}, you
732 * can set this flag to receive a single special MotionEvent with
733 * the action
734 * {@link MotionEvent#ACTION_OUTSIDE MotionEvent.ACTION_OUTSIDE} for
735 * touches that occur outside of your window. Note that you will not
736 * receive the full down/move/up gesture, only the location of the
737 * first down as an ACTION_OUTSIDE.
738 */
739 public static final int FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000740
Suchi Amalapurapud1a93372009-05-14 17:54:31 -0700741 /** Window flag: special flag to let windows be shown when the screen
742 * is locked. This will let application windows take precedence over
743 * key guard or any other lock screens. Can be used with
744 * {@link #FLAG_KEEP_SCREEN_ON} to turn screen on and display windows
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700745 * directly before showing the key guard window. Can be used with
746 * {@link #FLAG_DISMISS_KEYGUARD} to automatically fully dismisss
747 * non-secure keyguards. This flag only applies to the top-most
748 * full-screen window.
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700749 */
Suchi Amalapurapud1a93372009-05-14 17:54:31 -0700750 public static final int FLAG_SHOW_WHEN_LOCKED = 0x00080000;
751
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700752 /** Window flag: ask that the system wallpaper be shown behind
753 * your window. The window surface must be translucent to be able
754 * to actually see the wallpaper behind it; this flag just ensures
755 * that the wallpaper surface will be there if this window actually
756 * has translucent regions.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800757 *
758 * <p>This flag can be controlled in your theme through the
759 * {@link android.R.attr#windowShowWallpaper} attribute; this attribute
760 * is automatically set for you in the standard wallpaper themes
761 * such as {@link android.R.style#Theme_Wallpaper},
762 * {@link android.R.style#Theme_Wallpaper_NoTitleBar},
763 * {@link android.R.style#Theme_Wallpaper_NoTitleBar_Fullscreen},
764 * {@link android.R.style#Theme_Holo_Wallpaper},
765 * {@link android.R.style#Theme_Holo_Wallpaper_NoTitleBar},
766 * {@link android.R.style#Theme_DeviceDefault_Wallpaper}, and
767 * {@link android.R.style#Theme_DeviceDefault_Wallpaper_NoTitleBar}.</p>
Dianne Hackborn4c62fc02009-08-08 20:40:27 -0700768 */
769 public static final int FLAG_SHOW_WALLPAPER = 0x00100000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000770
Dianne Hackborn93e462b2009-09-15 22:50:40 -0700771 /** Window flag: when set as a window is being added or made
772 * visible, once the window has been shown then the system will
773 * poke the power manager's user activity (as if the user had woken
774 * up the device) to turn the screen on. */
775 public static final int FLAG_TURN_SCREEN_ON = 0x00200000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000776
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700777 /** Window flag: when set the window will cause the keyguard to
778 * be dismissed, only if it is not a secure lock keyguard. Because such
779 * a keyguard is not needed for security, it will never re-appear if
780 * the user navigates to another window (in contrast to
781 * {@link #FLAG_SHOW_WHEN_LOCKED}, which will only temporarily
782 * hide both secure and non-secure keyguards but ensure they reappear
783 * when the user moves to another UI that doesn't hide them).
784 * If the keyguard is currently active and is secure (requires an
785 * unlock pattern) than the user will still need to confirm it before
786 * seeing this window, unless {@link #FLAG_SHOW_WHEN_LOCKED} has
Daniel Sandlerae069f72010-06-17 21:56:26 -0400787 * also been set.
788 */
Dianne Hackborn9bfb7072009-09-22 11:37:40 -0700789 public static final int FLAG_DISMISS_KEYGUARD = 0x00400000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000790
Jeff Brown01ce2e92010-09-26 22:20:12 -0700791 /** Window flag: when set the window will accept for touch events
792 * outside of its bounds to be sent to other windows that also
793 * support split touch. When this flag is not set, the first pointer
794 * that goes down determines the window to which all subsequent touches
795 * go until all pointers go up. When this flag is set, each pointer
796 * (not necessarily the first) that goes down determines the window
797 * to which all subsequent touches of that pointer will go until that
798 * pointer goes up thereby enabling touches with multiple pointers
799 * to be split across multiple windows.
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800800 */
Jeff Brown01ce2e92010-09-26 22:20:12 -0700801 public static final int FLAG_SPLIT_TOUCH = 0x00800000;
Wonsik Kim475e3f02014-03-17 11:17:47 +0000802
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800803 /**
Romain Guy72f0a272011-01-09 16:01:46 -0800804 * <p>Indicates whether this window should be hardware accelerated.
805 * Requesting hardware acceleration does not guarantee it will happen.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800806 *
Romain Guy72f0a272011-01-09 16:01:46 -0800807 * <p>This flag can be controlled programmatically <em>only</em> to enable
808 * hardware acceleration. To enable hardware acceleration for a given
809 * window programmatically, do the following:</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800810 *
Romain Guy72f0a272011-01-09 16:01:46 -0800811 * <pre>
812 * Window w = activity.getWindow(); // in Activity's onCreate() for instance
813 * w.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
814 * WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
815 * </pre>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800816 *
Romain Guy72f0a272011-01-09 16:01:46 -0800817 * <p>It is important to remember that this flag <strong>must</strong>
818 * be set before setting the content view of your activity or dialog.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800819 *
Romain Guy72f0a272011-01-09 16:01:46 -0800820 * <p>This flag cannot be used to disable hardware acceleration after it
821 * was enabled in your manifest using
822 * {@link android.R.attr#hardwareAccelerated}. If you need to selectively
823 * and programmatically disable hardware acceleration (for automated testing
824 * for instance), make sure it is turned off in your manifest and enable it
825 * on your activity or dialog when you need it instead, using the method
826 * described above.</p>
Dianne Hackbornc652de82013-02-15 16:32:56 -0800827 *
Romain Guy72f0a272011-01-09 16:01:46 -0800828 * <p>This flag is automatically set by the system if the
829 * {@link android.R.attr#hardwareAccelerated android:hardwareAccelerated}
830 * XML attribute is set to true on an activity or on the application.</p>
Dianne Hackbornd9b3b7e2010-11-16 18:22:49 -0800831 */
832 public static final int FLAG_HARDWARE_ACCELERATED = 0x01000000;
Daniel Sandler611fae42010-06-17 10:45:00 -0400833
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800834 /**
835 * Window flag: allow window contents to extend in to the screen's
Dianne Hackbornc652de82013-02-15 16:32:56 -0800836 * overscan area, if there is one. The window should still correctly
837 * position its contents to take the overscan area into account.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800838 *
839 * <p>This flag can be controlled in your theme through the
840 * {@link android.R.attr#windowOverscan} attribute; this attribute
841 * is automatically set for you in the standard overscan themes
Ying Wang4e0eb222013-04-18 20:39:48 -0700842 * such as
Dianne Hackborn1bf1af62013-02-25 16:48:53 -0800843 * {@link android.R.style#Theme_Holo_NoActionBar_Overscan},
844 * {@link android.R.style#Theme_Holo_Light_NoActionBar_Overscan},
845 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_Overscan}, and
846 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_Overscan}.</p>
847 *
848 * <p>When this flag is enabled for a window, its normal content may be obscured
849 * to some degree by the overscan region of the display. To ensure key parts of
850 * that content are visible to the user, you can use
851 * {@link View#setFitsSystemWindows(boolean) View.setFitsSystemWindows(boolean)}
852 * to set the point in the view hierarchy where the appropriate offsets should
853 * be applied. (This can be done either by directly calling this function, using
854 * the {@link android.R.attr#fitsSystemWindows} attribute in your view hierarchy,
855 * or implementing you own {@link View#fitSystemWindows(android.graphics.Rect)
856 * View.fitSystemWindows(Rect)} method).</p>
857 *
858 * <p>This mechanism for positioning content elements is identical to its equivalent
859 * use with layout and {@link View#setSystemUiVisibility(int)
860 * View.setSystemUiVisibility(int)}; here is an example layout that will correctly
861 * position its UI elements with this overscan flag is set:</p>
862 *
863 * {@sample development/samples/ApiDemos/res/layout/overscan_activity.xml complete}
Dianne Hackbornc652de82013-02-15 16:32:56 -0800864 */
865 public static final int FLAG_LAYOUT_IN_OVERSCAN = 0x02000000;
866
John Spurlockbd957402013-10-03 11:38:39 -0400867 /**
868 * Window flag: request a translucent status bar with minimal system-provided
869 * background protection.
870 *
871 * <p>This flag can be controlled in your theme through the
872 * {@link android.R.attr#windowTranslucentStatus} attribute; this attribute
873 * is automatically set for you in the standard translucent decor themes
874 * such as
875 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
876 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
877 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
878 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
879 *
880 * <p>When this flag is enabled for a window, it automatically sets
881 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
882 * {@link View#SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN}.</p>
883 */
884 public static final int FLAG_TRANSLUCENT_STATUS = 0x04000000;
885
886 /**
887 * Window flag: request a translucent navigation bar with minimal system-provided
888 * background protection.
889 *
890 * <p>This flag can be controlled in your theme through the
891 * {@link android.R.attr#windowTranslucentNavigation} attribute; this attribute
892 * is automatically set for you in the standard translucent decor themes
893 * such as
894 * {@link android.R.style#Theme_Holo_NoActionBar_TranslucentDecor},
895 * {@link android.R.style#Theme_Holo_Light_NoActionBar_TranslucentDecor},
896 * {@link android.R.style#Theme_DeviceDefault_NoActionBar_TranslucentDecor}, and
897 * {@link android.R.style#Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor}.</p>
898 *
899 * <p>When this flag is enabled for a window, it automatically sets
900 * the system UI visibility flags {@link View#SYSTEM_UI_FLAG_LAYOUT_STABLE} and
901 * {@link View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION}.</p>
902 */
903 public static final int FLAG_TRANSLUCENT_NAVIGATION = 0x08000000;
904
Adam Lesinski6a591f52013-10-01 18:11:17 -0700905 /**
906 * Flag for a window in local focus mode.
907 * Window in local focus mode can control focus independent of window manager using
908 * {@link Window#setLocalFocus(boolean, boolean)}.
909 * Usually window in this mode will not get touch/key events from window manager, but will
910 * get events only via local injection using {@link Window#injectInputEvent(InputEvent)}.
911 */
912 public static final int FLAG_LOCAL_FOCUS_MODE = 0x10000000;
913
Jeff Brown98db5fa2011-06-08 15:37:10 -0700914 /** Window flag: Enable touches to slide out of a window into neighboring
915 * windows in mid-gesture instead of being captured for the duration of
916 * the gesture.
917 *
918 * This flag changes the behavior of touch focus for this window only.
919 * Touches can slide out of the window but they cannot necessarily slide
920 * back in (unless the other window with touch focus permits it).
921 *
922 * {@hide}
923 */
Adam Lesinski6a591f52013-10-01 18:11:17 -0700924 public static final int FLAG_SLIPPERY = 0x20000000;
Jeff Brown98db5fa2011-06-08 15:37:10 -0700925
Daniel Sandlere02d8082010-10-08 15:13:22 -0400926 /**
Wale Ogunwale393b1c12014-10-18 16:22:01 -0700927 * Window flag: When requesting layout with an attached window, the attached window may
928 * overlap with the screen decorations of the parent window such as the navigation bar. By
929 * including this flag, the window manager will layout the attached window within the decor
930 * frame of the parent window such that it doesn't overlap with screen decorations.
Daniel Sandlere02d8082010-10-08 15:13:22 -0400931 */
Wale Ogunwale393b1c12014-10-18 16:22:01 -0700932 public static final int FLAG_LAYOUT_ATTACHED_IN_DECOR = 0x40000000;
Daniel Sandlere02d8082010-10-08 15:13:22 -0400933
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800934 /**
Adrian Roos217ccd22014-05-09 14:29:04 +0200935 * Flag indicating that this Window is responsible for drawing the background for the
936 * system bars. If set, the system bars are drawn with a transparent background and the
937 * corresponding areas in this window are filled with the colors specified in
938 * {@link Window#getStatusBarColor()} and {@link Window#getNavigationBarColor()}.
939 */
940 public static final int FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS = 0x80000000;
941
942 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700943 * Various behavioral options/flags. Default is none.
Wonsik Kim475e3f02014-03-17 11:17:47 +0000944 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700945 * @see #FLAG_ALLOW_LOCK_WHILE_SCREEN_ON
946 * @see #FLAG_DIM_BEHIND
947 * @see #FLAG_NOT_FOCUSABLE
948 * @see #FLAG_NOT_TOUCHABLE
949 * @see #FLAG_NOT_TOUCH_MODAL
950 * @see #FLAG_TOUCHABLE_WHEN_WAKING
951 * @see #FLAG_KEEP_SCREEN_ON
952 * @see #FLAG_LAYOUT_IN_SCREEN
953 * @see #FLAG_LAYOUT_NO_LIMITS
954 * @see #FLAG_FULLSCREEN
955 * @see #FLAG_FORCE_NOT_FULLSCREEN
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700956 * @see #FLAG_SECURE
957 * @see #FLAG_SCALED
958 * @see #FLAG_IGNORE_CHEEK_PRESSES
959 * @see #FLAG_LAYOUT_INSET_DECOR
960 * @see #FLAG_ALT_FOCUSABLE_IM
961 * @see #FLAG_WATCH_OUTSIDE_TOUCH
962 * @see #FLAG_SHOW_WHEN_LOCKED
963 * @see #FLAG_SHOW_WALLPAPER
964 * @see #FLAG_TURN_SCREEN_ON
965 * @see #FLAG_DISMISS_KEYGUARD
966 * @see #FLAG_SPLIT_TOUCH
967 * @see #FLAG_HARDWARE_ACCELERATED
keunyoung30f420f2013-08-02 14:23:10 -0700968 * @see #FLAG_LOCAL_FOCUS_MODE
Adrian Roos217ccd22014-05-09 14:29:04 +0200969 * @see #FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
Dianne Hackborn5d927c22011-09-02 12:22:18 -0700970 */
971 @ViewDebug.ExportedProperty(flagMapping = {
972 @ViewDebug.FlagToString(mask = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON, equals = FLAG_ALLOW_LOCK_WHILE_SCREEN_ON,
973 name = "FLAG_ALLOW_LOCK_WHILE_SCREEN_ON"),
974 @ViewDebug.FlagToString(mask = FLAG_DIM_BEHIND, equals = FLAG_DIM_BEHIND,
975 name = "FLAG_DIM_BEHIND"),
976 @ViewDebug.FlagToString(mask = FLAG_BLUR_BEHIND, equals = FLAG_BLUR_BEHIND,
977 name = "FLAG_BLUR_BEHIND"),
978 @ViewDebug.FlagToString(mask = FLAG_NOT_FOCUSABLE, equals = FLAG_NOT_FOCUSABLE,
979 name = "FLAG_NOT_FOCUSABLE"),
980 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCHABLE, equals = FLAG_NOT_TOUCHABLE,
981 name = "FLAG_NOT_TOUCHABLE"),
982 @ViewDebug.FlagToString(mask = FLAG_NOT_TOUCH_MODAL, equals = FLAG_NOT_TOUCH_MODAL,
983 name = "FLAG_NOT_TOUCH_MODAL"),
984 @ViewDebug.FlagToString(mask = FLAG_TOUCHABLE_WHEN_WAKING, equals = FLAG_TOUCHABLE_WHEN_WAKING,
985 name = "FLAG_TOUCHABLE_WHEN_WAKING"),
986 @ViewDebug.FlagToString(mask = FLAG_KEEP_SCREEN_ON, equals = FLAG_KEEP_SCREEN_ON,
987 name = "FLAG_KEEP_SCREEN_ON"),
988 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_IN_SCREEN, equals = FLAG_LAYOUT_IN_SCREEN,
989 name = "FLAG_LAYOUT_IN_SCREEN"),
990 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_NO_LIMITS, equals = FLAG_LAYOUT_NO_LIMITS,
991 name = "FLAG_LAYOUT_NO_LIMITS"),
992 @ViewDebug.FlagToString(mask = FLAG_FULLSCREEN, equals = FLAG_FULLSCREEN,
993 name = "FLAG_FULLSCREEN"),
994 @ViewDebug.FlagToString(mask = FLAG_FORCE_NOT_FULLSCREEN, equals = FLAG_FORCE_NOT_FULLSCREEN,
995 name = "FLAG_FORCE_NOT_FULLSCREEN"),
996 @ViewDebug.FlagToString(mask = FLAG_DITHER, equals = FLAG_DITHER,
997 name = "FLAG_DITHER"),
998 @ViewDebug.FlagToString(mask = FLAG_SECURE, equals = FLAG_SECURE,
999 name = "FLAG_SECURE"),
1000 @ViewDebug.FlagToString(mask = FLAG_SCALED, equals = FLAG_SCALED,
1001 name = "FLAG_SCALED"),
1002 @ViewDebug.FlagToString(mask = FLAG_IGNORE_CHEEK_PRESSES, equals = FLAG_IGNORE_CHEEK_PRESSES,
1003 name = "FLAG_IGNORE_CHEEK_PRESSES"),
1004 @ViewDebug.FlagToString(mask = FLAG_LAYOUT_INSET_DECOR, equals = FLAG_LAYOUT_INSET_DECOR,
1005 name = "FLAG_LAYOUT_INSET_DECOR"),
1006 @ViewDebug.FlagToString(mask = FLAG_ALT_FOCUSABLE_IM, equals = FLAG_ALT_FOCUSABLE_IM,
1007 name = "FLAG_ALT_FOCUSABLE_IM"),
1008 @ViewDebug.FlagToString(mask = FLAG_WATCH_OUTSIDE_TOUCH, equals = FLAG_WATCH_OUTSIDE_TOUCH,
1009 name = "FLAG_WATCH_OUTSIDE_TOUCH"),
1010 @ViewDebug.FlagToString(mask = FLAG_SHOW_WHEN_LOCKED, equals = FLAG_SHOW_WHEN_LOCKED,
1011 name = "FLAG_SHOW_WHEN_LOCKED"),
1012 @ViewDebug.FlagToString(mask = FLAG_SHOW_WALLPAPER, equals = FLAG_SHOW_WALLPAPER,
1013 name = "FLAG_SHOW_WALLPAPER"),
1014 @ViewDebug.FlagToString(mask = FLAG_TURN_SCREEN_ON, equals = FLAG_TURN_SCREEN_ON,
1015 name = "FLAG_TURN_SCREEN_ON"),
1016 @ViewDebug.FlagToString(mask = FLAG_DISMISS_KEYGUARD, equals = FLAG_DISMISS_KEYGUARD,
1017 name = "FLAG_DISMISS_KEYGUARD"),
1018 @ViewDebug.FlagToString(mask = FLAG_SPLIT_TOUCH, equals = FLAG_SPLIT_TOUCH,
1019 name = "FLAG_SPLIT_TOUCH"),
1020 @ViewDebug.FlagToString(mask = FLAG_HARDWARE_ACCELERATED, equals = FLAG_HARDWARE_ACCELERATED,
keunyoung30f420f2013-08-02 14:23:10 -07001021 name = "FLAG_HARDWARE_ACCELERATED"),
1022 @ViewDebug.FlagToString(mask = FLAG_LOCAL_FOCUS_MODE, equals = FLAG_LOCAL_FOCUS_MODE,
John Spurlockbd957402013-10-03 11:38:39 -04001023 name = "FLAG_LOCAL_FOCUS_MODE"),
1024 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_STATUS, equals = FLAG_TRANSLUCENT_STATUS,
1025 name = "FLAG_TRANSLUCENT_STATUS"),
1026 @ViewDebug.FlagToString(mask = FLAG_TRANSLUCENT_NAVIGATION, equals = FLAG_TRANSLUCENT_NAVIGATION,
Adrian Roos217ccd22014-05-09 14:29:04 +02001027 name = "FLAG_TRANSLUCENT_NAVIGATION"),
1028 @ViewDebug.FlagToString(mask = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS, equals = FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS,
1029 name = "FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS")
Jon Miranda4597e982014-07-29 07:25:49 -07001030 }, formatToHexString = true)
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001031 public int flags;
1032
1033 /**
John Reck61375a82014-09-18 19:27:48 +00001034 * If the window has requested hardware acceleration, but this is not
1035 * allowed in the process it is in, then still render it as if it is
1036 * hardware accelerated. This is used for the starting preview windows
1037 * in the system process, which don't need to have the overhead of
1038 * hardware acceleration (they are just a static rendering), but should
1039 * be rendered as such to match the actual window of the app even if it
1040 * is hardware accelerated.
1041 * Even if the window isn't hardware accelerated, still do its rendering
1042 * as if it was.
1043 * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows
1044 * that need hardware acceleration (e.g. LockScreen), where hardware acceleration
1045 * is generally disabled. This flag must be specified in addition to
1046 * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system
1047 * windows.
1048 *
1049 * @hide
1050 */
1051 public static final int PRIVATE_FLAG_FAKE_HARDWARE_ACCELERATED = 0x00000001;
1052
1053 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001054 * In the system process, we globally do not use hardware acceleration
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001055 * because there are many threads doing UI there and they conflict.
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001056 * If certain parts of the UI that really do want to use hardware
1057 * acceleration, this flag can be set to force it. This is basically
1058 * for the lock screen. Anyone else using it, you are probably wrong.
Wonsik Kim475e3f02014-03-17 11:17:47 +00001059 *
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001060 * @hide
1061 */
1062 public static final int PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED = 0x00000002;
1063
1064 /**
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001065 * By default, wallpapers are sent new offsets when the wallpaper is scrolled. Wallpapers
Ken Wakasaf76a50c2012-03-09 19:56:35 +09001066 * may elect to skip these notifications if they are not doing anything productive with
Chet Haasea8e5a2b2011-10-28 13:18:16 -07001067 * them (they do not affect the wallpaper scrolling operation) by calling
1068 * {@link
1069 * android.service.wallpaper.WallpaperService.Engine#setOffsetNotificationsEnabled(boolean)}.
1070 *
1071 * @hide
1072 */
1073 public static final int PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS = 0x00000004;
1074
Craig Mautner88400d32012-09-30 12:35:45 -07001075 /** In a multiuser system if this flag is set and the owner is a system process then this
1076 * window will appear on all user screens. This overrides the default behavior of window
1077 * types that normally only appear on the owning user's screen. Refer to each window type
1078 * to determine its default behavior.
1079 *
1080 * {@hide} */
1081 public static final int PRIVATE_FLAG_SHOW_FOR_ALL_USERS = 0x00000010;
1082
Dianne Hackborn73ab6a42011-12-13 11:16:23 -08001083 /**
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001084 * Never animate position changes of the window.
1085 *
1086 * {@hide} */
1087 public static final int PRIVATE_FLAG_NO_MOVE_ANIMATION = 0x00000040;
1088
Adam Lesinski6a591f52013-10-01 18:11:17 -07001089 /** Window flag: special flag to limit the size of the window to be
1090 * original size ([320x480] x density). Used to create window for applications
1091 * running under compatibility mode.
1092 *
1093 * {@hide} */
1094 public static final int PRIVATE_FLAG_COMPATIBLE_WINDOW = 0x00000080;
1095
1096 /** Window flag: a special option intended for system dialogs. When
1097 * this flag is set, the window will demand focus unconditionally when
1098 * it is created.
1099 * {@hide} */
1100 public static final int PRIVATE_FLAG_SYSTEM_ERROR = 0x00000100;
1101
John Spurlock3f7cd512013-10-07 12:25:09 -04001102 /** Window flag: maintain the previous translucent decor state when this window
John Spurlockbd957402013-10-03 11:38:39 -04001103 * becomes top-most.
1104 * {@hide} */
1105 public static final int PRIVATE_FLAG_INHERIT_TRANSLUCENT_DECOR = 0x00000200;
1106
Dianne Hackborn1c5383c2013-04-15 15:07:21 -07001107 /**
Jorim Jaggi380ecb82014-03-14 17:25:20 +01001108 * Flag whether the current window is a keyguard window, meaning that it will hide all other
1109 * windows behind it except for windows with flag {@link #FLAG_SHOW_WHEN_LOCKED} set.
1110 * Further, this can only be set by {@link LayoutParams#TYPE_STATUS_BAR}.
1111 * {@hide}
1112 */
1113 public static final int PRIVATE_FLAG_KEYGUARD = 0x00000400;
1114
1115 /**
Filip Gruszczynskib8c06942014-12-04 15:02:18 -08001116 * Flag that prevents the wallpaper behind the current window from receiving touch events.
1117 *
1118 * {@hide}
1119 */
1120 public static final int PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS = 0x00000800;
1121
1122 /**
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001123 * Control flags that are private to the platform.
1124 * @hide
1125 */
1126 public int privateFlags;
1127
1128 /**
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001129 * Value for {@link #needsMenuKey} for a window that has not explicitly specified if it
1130 * needs {@link #NEEDS_MENU_SET_TRUE} or doesn't need {@link #NEEDS_MENU_SET_FALSE} a menu
1131 * key. For this case, we should look at windows behind it to determine the appropriate
1132 * value.
1133 *
1134 * @hide
1135 */
1136 public static final int NEEDS_MENU_UNSET = 0;
1137
1138 /**
1139 * Value for {@link #needsMenuKey} for a window that has explicitly specified it needs a
1140 * menu key.
1141 *
1142 * @hide
1143 */
1144 public static final int NEEDS_MENU_SET_TRUE = 1;
1145
1146 /**
1147 * Value for {@link #needsMenuKey} for a window that has explicitly specified it doesn't
1148 * needs a menu key.
1149 *
1150 * @hide
1151 */
1152 public static final int NEEDS_MENU_SET_FALSE = 2;
1153
1154 /**
1155 * State variable for a window belonging to an activity that responds to
1156 * {@link KeyEvent#KEYCODE_MENU} and therefore needs a Menu key. For devices where Menu is a
1157 * physical button this variable is ignored, but on devices where the Menu key is drawn in
1158 * software it may be hidden unless this variable is set to {@link #NEEDS_MENU_SET_TRUE}.
1159 *
1160 * (Note that Action Bars, when available, are the preferred way to offer additional
1161 * functions otherwise accessed via an options menu.)
1162 *
1163 * {@hide}
1164 */
1165 public int needsMenuKey = NEEDS_MENU_UNSET;
1166
1167 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001168 * Given a particular set of window manager flags, determine whether
1169 * such a window may be a target for an input method when it has
1170 * focus. In particular, this checks the
1171 * {@link #FLAG_NOT_FOCUSABLE} and {@link #FLAG_ALT_FOCUSABLE_IM}
1172 * flags and returns true if the combination of the two corresponds
1173 * to a window that needs to be behind the input method so that the
1174 * user can type into it.
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001175 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001176 * @param flags The current window manager flags.
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001177 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001178 * @return Returns true if such a window should be behind/interact
1179 * with an input method, false if not.
1180 */
1181 public static boolean mayUseInputMethod(int flags) {
1182 switch (flags&(FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM)) {
1183 case 0:
1184 case FLAG_NOT_FOCUSABLE|FLAG_ALT_FOCUSABLE_IM:
1185 return true;
1186 }
1187 return false;
1188 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001189
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001190 /**
1191 * Mask for {@link #softInputMode} of the bits that determine the
1192 * desired visibility state of the soft input area for this window.
1193 */
1194 public static final int SOFT_INPUT_MASK_STATE = 0x0f;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001195
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001196 /**
1197 * Visibility state for {@link #softInputMode}: no state has been specified.
1198 */
1199 public static final int SOFT_INPUT_STATE_UNSPECIFIED = 0;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001200
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001201 /**
1202 * Visibility state for {@link #softInputMode}: please don't change the state of
1203 * the soft input area.
1204 */
1205 public static final int SOFT_INPUT_STATE_UNCHANGED = 1;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001206
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001207 /**
1208 * Visibility state for {@link #softInputMode}: please hide any soft input
1209 * area when normally appropriate (when the user is navigating
1210 * forward to your window).
1211 */
1212 public static final int SOFT_INPUT_STATE_HIDDEN = 2;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001213
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001214 /**
1215 * Visibility state for {@link #softInputMode}: please always hide any
1216 * soft input area when this window receives focus.
1217 */
1218 public static final int SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001219
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001220 /**
1221 * Visibility state for {@link #softInputMode}: please show the soft
1222 * input area when normally appropriate (when the user is navigating
1223 * forward to your window).
1224 */
1225 public static final int SOFT_INPUT_STATE_VISIBLE = 4;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001226
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001227 /**
1228 * Visibility state for {@link #softInputMode}: please always make the
1229 * soft input area visible when this window receives input focus.
1230 */
1231 public static final int SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001232
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001233 /**
1234 * Mask for {@link #softInputMode} of the bits that determine the
1235 * way that the window should be adjusted to accommodate the soft
1236 * input window.
1237 */
1238 public static final int SOFT_INPUT_MASK_ADJUST = 0xf0;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001239
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001240 /** Adjustment option for {@link #softInputMode}: nothing specified.
1241 * The system will try to pick one or
1242 * the other depending on the contents of the window.
1243 */
1244 public static final int SOFT_INPUT_ADJUST_UNSPECIFIED = 0x00;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001245
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001246 /** Adjustment option for {@link #softInputMode}: set to allow the
1247 * window to be resized when an input
1248 * method is shown, so that its contents are not covered by the input
Scott Mainf10e6332010-06-11 09:03:22 -07001249 * method. This can <em>not</em> be combined with
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001250 * {@link #SOFT_INPUT_ADJUST_PAN}; if
1251 * neither of these are set, then the system will try to pick one or
Chet Haase45c89c22013-04-29 16:04:40 -07001252 * the other depending on the contents of the window. If the window's
1253 * layout parameter flags include {@link #FLAG_FULLSCREEN}, this
1254 * value for {@link #softInputMode} will be ignored; the window will
1255 * not resize, but will stay fullscreen.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001256 */
1257 public static final int SOFT_INPUT_ADJUST_RESIZE = 0x10;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001258
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001259 /** Adjustment option for {@link #softInputMode}: set to have a window
1260 * pan when an input method is
1261 * shown, so it doesn't need to deal with resizing but just panned
1262 * by the framework to ensure the current input focus is visible. This
Scott Mainf10e6332010-06-11 09:03:22 -07001263 * can <em>not</em> be combined with {@link #SOFT_INPUT_ADJUST_RESIZE}; if
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001264 * neither of these are set, then the system will try to pick one or
1265 * the other depending on the contents of the window.
1266 */
1267 public static final int SOFT_INPUT_ADJUST_PAN = 0x20;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001268
Dianne Hackborndea3ef72010-10-28 14:24:22 -07001269 /** Adjustment option for {@link #softInputMode}: set to have a window
1270 * not adjust for a shown input method. The window will not be resized,
1271 * and it will not be panned to make its focus visible.
1272 */
1273 public static final int SOFT_INPUT_ADJUST_NOTHING = 0x30;
1274
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001275 /**
1276 * Bit for {@link #softInputMode}: set when the user has navigated
1277 * forward to the window. This is normally set automatically for
1278 * you by the system, though you may want to set it in certain cases
1279 * when you are displaying a window yourself. This flag will always
1280 * be cleared automatically after the window is displayed.
1281 */
1282 public static final int SOFT_INPUT_IS_FORWARD_NAVIGATION = 0x100;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001283
1284 /**
Gilles Debunnebe2c4f92011-01-17 15:14:32 -08001285 * Desired operating mode for any soft input area. May be any combination
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001286 * of:
Wonsik Kim475e3f02014-03-17 11:17:47 +00001287 *
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001288 * <ul>
1289 * <li> One of the visibility states
1290 * {@link #SOFT_INPUT_STATE_UNSPECIFIED}, {@link #SOFT_INPUT_STATE_UNCHANGED},
1291 * {@link #SOFT_INPUT_STATE_HIDDEN}, {@link #SOFT_INPUT_STATE_ALWAYS_VISIBLE}, or
1292 * {@link #SOFT_INPUT_STATE_VISIBLE}.
1293 * <li> One of the adjustment options
1294 * {@link #SOFT_INPUT_ADJUST_UNSPECIFIED},
1295 * {@link #SOFT_INPUT_ADJUST_RESIZE}, or
1296 * {@link #SOFT_INPUT_ADJUST_PAN}.
Dianne Hackborn1bf1af62013-02-25 16:48:53 -08001297 * </ul>
1298 *
1299 *
1300 * <p>This flag can be controlled in your theme through the
1301 * {@link android.R.attr#windowSoftInputMode} attribute.</p>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001302 */
1303 public int softInputMode;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001304
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001305 /**
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001306 * Placement of window within the screen as per {@link Gravity}. Both
1307 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1308 * android.graphics.Rect) Gravity.apply} and
1309 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
1310 * Gravity.applyDisplay} are used during window layout, with this value
1311 * given as the desired gravity. For example you can specify
1312 * {@link Gravity#DISPLAY_CLIP_HORIZONTAL Gravity.DISPLAY_CLIP_HORIZONTAL} and
1313 * {@link Gravity#DISPLAY_CLIP_VERTICAL Gravity.DISPLAY_CLIP_VERTICAL} here
1314 * to control the behavior of
1315 * {@link Gravity#applyDisplay(int, android.graphics.Rect, android.graphics.Rect)
1316 * Gravity.applyDisplay}.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001317 *
1318 * @see Gravity
1319 */
1320 public int gravity;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001321
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001322 /**
1323 * The horizontal margin, as a percentage of the container's width,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001324 * between the container and the widget. See
1325 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1326 * android.graphics.Rect) Gravity.apply} for how this is used. This
1327 * field is added with {@link #x} to supply the <var>xAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001328 */
1329 public float horizontalMargin;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001330
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001331 /**
1332 * The vertical margin, as a percentage of the container's height,
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001333 * between the container and the widget. See
1334 * {@link Gravity#apply(int, int, int, android.graphics.Rect, int, int,
1335 * android.graphics.Rect) Gravity.apply} for how this is used. This
1336 * field is added with {@link #y} to supply the <var>yAdj</var> parameter.
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001337 */
1338 public float verticalMargin;
Alan Viveretteccb11e12014-07-08 16:04:02 -07001339
1340 /**
1341 * Positive insets between the drawing surface and window content.
1342 *
1343 * @hide
1344 */
Alan Viverette3aa1ffb2014-10-30 12:22:08 -07001345 public final Rect surfaceInsets = new Rect();
Alan Viverette5435a302015-01-29 10:25:34 -08001346
1347 /**
1348 * Whether the surface insets have been manually set. When set to
1349 * {@code false}, the view root will automatically determine the
1350 * appropriate surface insets.
1351 *
1352 * @see #surfaceInsets
1353 * @hide
1354 */
1355 public boolean hasManualSurfaceInsets;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001356
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001357 /**
1358 * The desired bitmap format. May be one of the constants in
1359 * {@link android.graphics.PixelFormat}. Default is OPAQUE.
1360 */
1361 public int format;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001362
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001363 /**
1364 * A style resource defining the animations to use for this window.
1365 * This must be a system resource; it can not be an application resource
1366 * because the window manager does not have access to applications.
1367 */
1368 public int windowAnimations;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001369
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001370 /**
1371 * An alpha value to apply to this entire window.
1372 * An alpha of 1.0 means fully opaque and 0.0 means fully transparent
1373 */
1374 public float alpha = 1.0f;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001375
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001376 /**
1377 * When {@link #FLAG_DIM_BEHIND} is set, this is the amount of dimming
1378 * to apply. Range is from 1.0 for completely opaque to 0.0 for no
1379 * dim.
1380 */
1381 public float dimAmount = 1.0f;
Dianne Hackborndea3ef72010-10-28 14:24:22 -07001382
1383 /**
1384 * Default value for {@link #screenBrightness} and {@link #buttonBrightness}
1385 * indicating that the brightness value is not overridden for this window
1386 * and normal brightness policy should be used.
1387 */
1388 public static final float BRIGHTNESS_OVERRIDE_NONE = -1.0f;
1389
1390 /**
1391 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
1392 * indicating that the screen or button backlight brightness should be set
1393 * to the lowest value when this window is in front.
1394 */
1395 public static final float BRIGHTNESS_OVERRIDE_OFF = 0.0f;
1396
1397 /**
1398 * Value for {@link #screenBrightness} and {@link #buttonBrightness}
1399 * indicating that the screen or button backlight brightness should be set
1400 * to the hightest value when this window is in front.
1401 */
1402 public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001403
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001404 /**
1405 * This can be used to override the user's preferred brightness of
1406 * the screen. A value of less than 0, the default, means to use the
1407 * preferred screen brightness. 0 to 1 adjusts the brightness from
1408 * dark to full bright.
1409 */
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001410 public float screenBrightness = BRIGHTNESS_OVERRIDE_NONE;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001411
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001412 /**
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001413 * This can be used to override the standard behavior of the button and
1414 * keyboard backlights. A value of less than 0, the default, means to
1415 * use the standard backlight behavior. 0 to 1 adjusts the brightness
1416 * from dark to full bright.
1417 */
1418 public float buttonBrightness = BRIGHTNESS_OVERRIDE_NONE;
1419
1420 /**
Craig Mautner3c174372013-02-21 17:54:37 -08001421 * Value for {@link #rotationAnimation} to define the animation used to
1422 * specify that this window will rotate in or out following a rotation.
1423 */
1424 public static final int ROTATION_ANIMATION_ROTATE = 0;
1425
1426 /**
1427 * Value for {@link #rotationAnimation} to define the animation used to
1428 * specify that this window will fade in or out following a rotation.
1429 */
1430 public static final int ROTATION_ANIMATION_CROSSFADE = 1;
1431
1432 /**
1433 * Value for {@link #rotationAnimation} to define the animation used to
1434 * specify that this window will immediately disappear or appear following
1435 * a rotation.
1436 */
1437 public static final int ROTATION_ANIMATION_JUMPCUT = 2;
1438
1439 /**
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07001440 * Define the exit and entry animations used on this window when the device is rotated.
1441 * This only has an affect if the incoming and outgoing topmost
Craig Mautner3c174372013-02-21 17:54:37 -08001442 * opaque windows have the #FLAG_FULLSCREEN bit set and are not covered
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07001443 * by other windows. All other situations default to the
1444 * {@link #ROTATION_ANIMATION_ROTATE} behavior.
Wonsik Kim475e3f02014-03-17 11:17:47 +00001445 *
Craig Mautner3c174372013-02-21 17:54:37 -08001446 * @see #ROTATION_ANIMATION_ROTATE
1447 * @see #ROTATION_ANIMATION_CROSSFADE
1448 * @see #ROTATION_ANIMATION_JUMPCUT
1449 */
1450 public int rotationAnimation = ROTATION_ANIMATION_ROTATE;
1451
1452 /**
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001453 * Identifier for this window. This will usually be filled in for
1454 * you.
1455 */
1456 public IBinder token = null;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001457
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001458 /**
1459 * Name of the package owning this window.
1460 */
1461 public String packageName = null;
Wonsik Kim475e3f02014-03-17 11:17:47 +00001462
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001463 /**
1464 * Specific orientation value for a window.
1465 * May be any of the same values allowed
Wonsik Kim475e3f02014-03-17 11:17:47 +00001466 * for {@link android.content.pm.ActivityInfo#screenOrientation}.
1467 * If not set, a default value of
1468 * {@link android.content.pm.ActivityInfo#SCREEN_ORIENTATION_UNSPECIFIED}
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001469 * will be used.
1470 */
1471 public int screenOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
Joe Onorato664644d2011-01-23 17:53:23 -08001472
1473 /**
Michael Wright3f145a22014-07-22 19:46:03 -07001474 * The preferred refresh rate for the window.
1475 *
1476 * This must be one of the supported refresh rates obtained for the display(s) the window
1477 * is on.
1478 *
1479 * @see Display#getSupportedRefreshRates()
1480 */
1481 public float preferredRefreshRate;
1482
1483 /**
Joe Onorato664644d2011-01-23 17:53:23 -08001484 * Control the visibility of the status bar.
Joe Onorato14782f72011-01-25 19:53:17 -08001485 *
1486 * @see View#STATUS_BAR_VISIBLE
1487 * @see View#STATUS_BAR_HIDDEN
Joe Onorato664644d2011-01-23 17:53:23 -08001488 */
1489 public int systemUiVisibility;
1490
1491 /**
Joe Onorato14782f72011-01-25 19:53:17 -08001492 * @hide
1493 * The ui visibility as requested by the views in this hierarchy.
1494 * the combined value should be systemUiVisibility | subtreeSystemUiVisibility.
1495 */
1496 public int subtreeSystemUiVisibility;
1497
1498 /**
Joe Onorato664644d2011-01-23 17:53:23 -08001499 * Get callbacks about the system ui visibility changing.
Wonsik Kim475e3f02014-03-17 11:17:47 +00001500 *
Joe Onorato664644d2011-01-23 17:53:23 -08001501 * TODO: Maybe there should be a bitfield of optional callbacks that we need.
1502 *
1503 * @hide
1504 */
1505 public boolean hasSystemUiListeners;
1506
Jeff Brown474dcb52011-06-14 20:22:50 -07001507 /**
1508 * When this window has focus, disable touch pad pointer gesture processing.
1509 * The window will receive raw position updates from the touch pad instead
1510 * of pointer movements and synthetic touch events.
1511 *
1512 * @hide
1513 */
1514 public static final int INPUT_FEATURE_DISABLE_POINTER_GESTURES = 0x00000001;
1515
1516 /**
Jeff Browncc4f7db2011-08-30 20:34:48 -07001517 * Does not construct an input channel for this window. The channel will therefore
1518 * be incapable of receiving input.
1519 *
1520 * @hide
1521 */
1522 public static final int INPUT_FEATURE_NO_INPUT_CHANNEL = 0x00000002;
1523
1524 /**
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001525 * When this window has focus, does not call user activity for all input events so
1526 * the application will have to do it itself. Should only be used by
1527 * the keyguard and phone app.
1528 * <p>
1529 * Should only be used by the keyguard and phone app.
1530 * </p>
1531 *
1532 * @hide
1533 */
1534 public static final int INPUT_FEATURE_DISABLE_USER_ACTIVITY = 0x00000004;
1535
1536 /**
Jeff Brown474dcb52011-06-14 20:22:50 -07001537 * Control special features of the input subsystem.
1538 *
Craig Mautnerbdcc9a52013-04-19 13:06:53 -07001539 * @see #INPUT_FEATURE_DISABLE_POINTER_GESTURES
Jeff Browncc4f7db2011-08-30 20:34:48 -07001540 * @see #INPUT_FEATURE_NO_INPUT_CHANNEL
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001541 * @see #INPUT_FEATURE_DISABLE_USER_ACTIVITY
Jeff Brown474dcb52011-06-14 20:22:50 -07001542 * @hide
1543 */
1544 public int inputFeatures;
1545
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001546 /**
1547 * Sets the number of milliseconds before the user activity timeout occurs
1548 * when this window has focus. A value of -1 uses the standard timeout.
1549 * A value of 0 uses the minimum support display timeout.
1550 * <p>
1551 * This property can only be used to reduce the user specified display timeout;
1552 * it can never make the timeout longer than it normally would be.
1553 * </p><p>
1554 * Should only be used by the keyguard and phone app.
1555 * </p>
1556 *
1557 * @hide
1558 */
1559 public long userActivityTimeout = -1;
1560
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001561 public LayoutParams() {
Romain Guy980a9382010-01-08 15:06:28 -08001562 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001563 type = TYPE_APPLICATION;
1564 format = PixelFormat.OPAQUE;
1565 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001566
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001567 public LayoutParams(int _type) {
Romain Guy980a9382010-01-08 15:06:28 -08001568 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001569 type = _type;
1570 format = PixelFormat.OPAQUE;
1571 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001572
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001573 public LayoutParams(int _type, int _flags) {
Romain Guy980a9382010-01-08 15:06:28 -08001574 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001575 type = _type;
1576 flags = _flags;
1577 format = PixelFormat.OPAQUE;
1578 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001579
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001580 public LayoutParams(int _type, int _flags, int _format) {
Romain Guy980a9382010-01-08 15:06:28 -08001581 super(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001582 type = _type;
1583 flags = _flags;
1584 format = _format;
1585 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001586
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001587 public LayoutParams(int w, int h, int _type, int _flags, int _format) {
1588 super(w, h);
1589 type = _type;
1590 flags = _flags;
1591 format = _format;
1592 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001593
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001594 public LayoutParams(int w, int h, int xpos, int ypos, int _type,
1595 int _flags, int _format) {
1596 super(w, h);
1597 x = xpos;
1598 y = ypos;
1599 type = _type;
1600 flags = _flags;
1601 format = _format;
1602 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001603
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001604 public final void setTitle(CharSequence title) {
1605 if (null == title)
1606 title = "";
Wonsik Kim475e3f02014-03-17 11:17:47 +00001607
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001608 mTitle = TextUtils.stringOrSpannedString(title);
1609 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001610
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001611 public final CharSequence getTitle() {
1612 return mTitle;
1613 }
Bryce Lee53b9fbd2015-02-06 12:06:34 -08001614
1615 /** @hide */
1616 @SystemApi
1617 public final void setUserActivityTimeout(long timeout) {
1618 userActivityTimeout = timeout;
1619 }
1620
1621 /** @hide */
1622 @SystemApi
1623 public final long getUserActivityTimeout() {
1624 return userActivityTimeout;
1625 }
1626
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001627 public int describeContents() {
1628 return 0;
1629 }
1630
1631 public void writeToParcel(Parcel out, int parcelableFlags) {
1632 out.writeInt(width);
1633 out.writeInt(height);
1634 out.writeInt(x);
1635 out.writeInt(y);
1636 out.writeInt(type);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001637 out.writeInt(flags);
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001638 out.writeInt(privateFlags);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001639 out.writeInt(softInputMode);
1640 out.writeInt(gravity);
1641 out.writeFloat(horizontalMargin);
1642 out.writeFloat(verticalMargin);
1643 out.writeInt(format);
1644 out.writeInt(windowAnimations);
1645 out.writeFloat(alpha);
1646 out.writeFloat(dimAmount);
1647 out.writeFloat(screenBrightness);
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001648 out.writeFloat(buttonBrightness);
Craig Mautner3c174372013-02-21 17:54:37 -08001649 out.writeInt(rotationAnimation);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001650 out.writeStrongBinder(token);
1651 out.writeString(packageName);
1652 TextUtils.writeToParcel(mTitle, out, parcelableFlags);
1653 out.writeInt(screenOrientation);
Michael Wright3f145a22014-07-22 19:46:03 -07001654 out.writeFloat(preferredRefreshRate);
Joe Onorato664644d2011-01-23 17:53:23 -08001655 out.writeInt(systemUiVisibility);
Joe Onorato14782f72011-01-25 19:53:17 -08001656 out.writeInt(subtreeSystemUiVisibility);
Joe Onorato664644d2011-01-23 17:53:23 -08001657 out.writeInt(hasSystemUiListeners ? 1 : 0);
Jeff Brown474dcb52011-06-14 20:22:50 -07001658 out.writeInt(inputFeatures);
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001659 out.writeLong(userActivityTimeout);
Alan Viverette49a22e82014-07-12 20:01:27 -07001660 out.writeInt(surfaceInsets.left);
1661 out.writeInt(surfaceInsets.top);
1662 out.writeInt(surfaceInsets.right);
1663 out.writeInt(surfaceInsets.bottom);
Alan Viverette5435a302015-01-29 10:25:34 -08001664 out.writeInt(hasManualSurfaceInsets ? 1 : 0);
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001665 out.writeInt(needsMenuKey);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001666 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001667
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001668 public static final Parcelable.Creator<LayoutParams> CREATOR
1669 = new Parcelable.Creator<LayoutParams>() {
1670 public LayoutParams createFromParcel(Parcel in) {
1671 return new LayoutParams(in);
1672 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001673
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001674 public LayoutParams[] newArray(int size) {
1675 return new LayoutParams[size];
1676 }
1677 };
Wonsik Kim475e3f02014-03-17 11:17:47 +00001678
1679
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001680 public LayoutParams(Parcel in) {
1681 width = in.readInt();
1682 height = in.readInt();
1683 x = in.readInt();
1684 y = in.readInt();
1685 type = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001686 flags = in.readInt();
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001687 privateFlags = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001688 softInputMode = in.readInt();
1689 gravity = in.readInt();
1690 horizontalMargin = in.readFloat();
1691 verticalMargin = in.readFloat();
1692 format = in.readInt();
1693 windowAnimations = in.readInt();
1694 alpha = in.readFloat();
1695 dimAmount = in.readFloat();
1696 screenBrightness = in.readFloat();
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001697 buttonBrightness = in.readFloat();
Craig Mautner3c174372013-02-21 17:54:37 -08001698 rotationAnimation = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001699 token = in.readStrongBinder();
1700 packageName = in.readString();
1701 mTitle = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(in);
1702 screenOrientation = in.readInt();
Michael Wright3f145a22014-07-22 19:46:03 -07001703 preferredRefreshRate = in.readFloat();
Joe Onorato664644d2011-01-23 17:53:23 -08001704 systemUiVisibility = in.readInt();
Joe Onorato14782f72011-01-25 19:53:17 -08001705 subtreeSystemUiVisibility = in.readInt();
Joe Onorato664644d2011-01-23 17:53:23 -08001706 hasSystemUiListeners = in.readInt() != 0;
Jeff Brown474dcb52011-06-14 20:22:50 -07001707 inputFeatures = in.readInt();
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001708 userActivityTimeout = in.readLong();
Alan Viverette49a22e82014-07-12 20:01:27 -07001709 surfaceInsets.left = in.readInt();
1710 surfaceInsets.top = in.readInt();
1711 surfaceInsets.right = in.readInt();
1712 surfaceInsets.bottom = in.readInt();
Alan Viverette5435a302015-01-29 10:25:34 -08001713 hasManualSurfaceInsets = in.readInt() != 0;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001714 needsMenuKey = in.readInt();
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001715 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001716
Romain Guy72998072009-06-22 11:09:20 -07001717 @SuppressWarnings({"PointlessBitwiseExpression"})
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001718 public static final int LAYOUT_CHANGED = 1<<0;
1719 public static final int TYPE_CHANGED = 1<<1;
1720 public static final int FLAGS_CHANGED = 1<<2;
1721 public static final int FORMAT_CHANGED = 1<<3;
1722 public static final int ANIMATION_CHANGED = 1<<4;
1723 public static final int DIM_AMOUNT_CHANGED = 1<<5;
1724 public static final int TITLE_CHANGED = 1<<6;
1725 public static final int ALPHA_CHANGED = 1<<7;
1726 public static final int MEMORY_TYPE_CHANGED = 1<<8;
1727 public static final int SOFT_INPUT_MODE_CHANGED = 1<<9;
1728 public static final int SCREEN_ORIENTATION_CHANGED = 1<<10;
1729 public static final int SCREEN_BRIGHTNESS_CHANGED = 1<<11;
Craig Mautner3c174372013-02-21 17:54:37 -08001730 public static final int ROTATION_ANIMATION_CHANGED = 1<<12;
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001731 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001732 public static final int BUTTON_BRIGHTNESS_CHANGED = 1<<13;
Joe Onorato664644d2011-01-23 17:53:23 -08001733 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001734 public static final int SYSTEM_UI_VISIBILITY_CHANGED = 1<<14;
Joe Onorato664644d2011-01-23 17:53:23 -08001735 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001736 public static final int SYSTEM_UI_LISTENER_CHANGED = 1<<15;
Jeff Brown474dcb52011-06-14 20:22:50 -07001737 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001738 public static final int INPUT_FEATURES_CHANGED = 1<<16;
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001739 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001740 public static final int PRIVATE_FLAGS_CHANGED = 1<<17;
Romain Guyf21c9b02011-09-06 16:56:54 -07001741 /** {@hide} */
Craig Mautner3c174372013-02-21 17:54:37 -08001742 public static final int USER_ACTIVITY_TIMEOUT_CHANGED = 1<<18;
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001743 /** {@hide} */
John Spurlockbd957402013-10-03 11:38:39 -04001744 public static final int TRANSLUCENT_FLAGS_CHANGED = 1<<19;
1745 /** {@hide} */
Alan Viverette49a22e82014-07-12 20:01:27 -07001746 public static final int SURFACE_INSETS_CHANGED = 1<<20;
Alan Viveretteccb11e12014-07-08 16:04:02 -07001747 /** {@hide} */
Michael Wright3f145a22014-07-22 19:46:03 -07001748 public static final int PREFERRED_REFRESH_RATE_CHANGED = 1 << 21;
1749 /** {@hide} */
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001750 public static final int NEEDS_MENU_KEY_CHANGED = 1 << 22;
1751 /** {@hide} */
Romain Guyf21c9b02011-09-06 16:56:54 -07001752 public static final int EVERYTHING_CHANGED = 0xffffffff;
1753
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07001754 // internal buffer to backup/restore parameters under compatibility mode.
1755 private int[] mCompatibilityParamsBackup = null;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001756
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001757 public final int copyFrom(LayoutParams o) {
1758 int changes = 0;
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001759
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001760 if (width != o.width) {
1761 width = o.width;
Chet Haase40e03832011-10-06 08:34:13 -07001762 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001763 }
1764 if (height != o.height) {
1765 height = o.height;
Chet Haase40e03832011-10-06 08:34:13 -07001766 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001767 }
1768 if (x != o.x) {
1769 x = o.x;
1770 changes |= LAYOUT_CHANGED;
1771 }
1772 if (y != o.y) {
1773 y = o.y;
1774 changes |= LAYOUT_CHANGED;
1775 }
1776 if (horizontalWeight != o.horizontalWeight) {
1777 horizontalWeight = o.horizontalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07001778 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001779 }
1780 if (verticalWeight != o.verticalWeight) {
1781 verticalWeight = o.verticalWeight;
Chet Haase40e03832011-10-06 08:34:13 -07001782 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001783 }
1784 if (horizontalMargin != o.horizontalMargin) {
1785 horizontalMargin = o.horizontalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07001786 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001787 }
1788 if (verticalMargin != o.verticalMargin) {
1789 verticalMargin = o.verticalMargin;
Chet Haase40e03832011-10-06 08:34:13 -07001790 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001791 }
1792 if (type != o.type) {
1793 type = o.type;
1794 changes |= TYPE_CHANGED;
1795 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001796 if (flags != o.flags) {
John Spurlockbd957402013-10-03 11:38:39 -04001797 final int diff = flags ^ o.flags;
1798 if ((diff & (FLAG_TRANSLUCENT_STATUS | FLAG_TRANSLUCENT_NAVIGATION)) != 0) {
1799 changes |= TRANSLUCENT_FLAGS_CHANGED;
1800 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001801 flags = o.flags;
Chet Haase40e03832011-10-06 08:34:13 -07001802 changes |= FLAGS_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001803 }
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001804 if (privateFlags != o.privateFlags) {
1805 privateFlags = o.privateFlags;
1806 changes |= PRIVATE_FLAGS_CHANGED;
1807 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001808 if (softInputMode != o.softInputMode) {
1809 softInputMode = o.softInputMode;
1810 changes |= SOFT_INPUT_MODE_CHANGED;
1811 }
1812 if (gravity != o.gravity) {
1813 gravity = o.gravity;
Chet Haase40e03832011-10-06 08:34:13 -07001814 changes |= LAYOUT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001815 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001816 if (format != o.format) {
1817 format = o.format;
Chet Haase40e03832011-10-06 08:34:13 -07001818 changes |= FORMAT_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001819 }
1820 if (windowAnimations != o.windowAnimations) {
1821 windowAnimations = o.windowAnimations;
1822 changes |= ANIMATION_CHANGED;
1823 }
1824 if (token == null) {
1825 // NOTE: token only copied if the recipient doesn't
1826 // already have one.
1827 token = o.token;
1828 }
1829 if (packageName == null) {
1830 // NOTE: packageName only copied if the recipient doesn't
1831 // already have one.
1832 packageName = o.packageName;
1833 }
1834 if (!mTitle.equals(o.mTitle)) {
1835 mTitle = o.mTitle;
1836 changes |= TITLE_CHANGED;
1837 }
1838 if (alpha != o.alpha) {
1839 alpha = o.alpha;
1840 changes |= ALPHA_CHANGED;
1841 }
1842 if (dimAmount != o.dimAmount) {
1843 dimAmount = o.dimAmount;
1844 changes |= DIM_AMOUNT_CHANGED;
1845 }
1846 if (screenBrightness != o.screenBrightness) {
1847 screenBrightness = o.screenBrightness;
1848 changes |= SCREEN_BRIGHTNESS_CHANGED;
1849 }
Mike Lockwoodfb73f792009-11-20 11:31:18 -05001850 if (buttonBrightness != o.buttonBrightness) {
1851 buttonBrightness = o.buttonBrightness;
1852 changes |= BUTTON_BRIGHTNESS_CHANGED;
1853 }
Craig Mautner3c174372013-02-21 17:54:37 -08001854 if (rotationAnimation != o.rotationAnimation) {
1855 rotationAnimation = o.rotationAnimation;
1856 changes |= ROTATION_ANIMATION_CHANGED;
1857 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001858
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001859 if (screenOrientation != o.screenOrientation) {
1860 screenOrientation = o.screenOrientation;
Chet Haase40e03832011-10-06 08:34:13 -07001861 changes |= SCREEN_ORIENTATION_CHANGED;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001862 }
Romain Guy529b60a2010-08-03 18:05:47 -07001863
Michael Wright3f145a22014-07-22 19:46:03 -07001864 if (preferredRefreshRate != o.preferredRefreshRate) {
1865 preferredRefreshRate = o.preferredRefreshRate;
1866 changes |= PREFERRED_REFRESH_RATE_CHANGED;
1867 }
1868
Joe Onorato14782f72011-01-25 19:53:17 -08001869 if (systemUiVisibility != o.systemUiVisibility
1870 || subtreeSystemUiVisibility != o.subtreeSystemUiVisibility) {
Joe Onorato664644d2011-01-23 17:53:23 -08001871 systemUiVisibility = o.systemUiVisibility;
Joe Onorato14782f72011-01-25 19:53:17 -08001872 subtreeSystemUiVisibility = o.subtreeSystemUiVisibility;
Joe Onorato664644d2011-01-23 17:53:23 -08001873 changes |= SYSTEM_UI_VISIBILITY_CHANGED;
1874 }
1875
1876 if (hasSystemUiListeners != o.hasSystemUiListeners) {
1877 hasSystemUiListeners = o.hasSystemUiListeners;
1878 changes |= SYSTEM_UI_LISTENER_CHANGED;
1879 }
1880
Jeff Brown474dcb52011-06-14 20:22:50 -07001881 if (inputFeatures != o.inputFeatures) {
1882 inputFeatures = o.inputFeatures;
1883 changes |= INPUT_FEATURES_CHANGED;
1884 }
1885
Jeff Brown1e3b98d2012-09-30 18:58:59 -07001886 if (userActivityTimeout != o.userActivityTimeout) {
1887 userActivityTimeout = o.userActivityTimeout;
1888 changes |= USER_ACTIVITY_TIMEOUT_CHANGED;
1889 }
1890
Alan Viverette49a22e82014-07-12 20:01:27 -07001891 if (!surfaceInsets.equals(o.surfaceInsets)) {
1892 surfaceInsets.set(o.surfaceInsets);
1893 changes |= SURFACE_INSETS_CHANGED;
Alan Viveretteccb11e12014-07-08 16:04:02 -07001894 }
1895
Alan Viverette5435a302015-01-29 10:25:34 -08001896 if (hasManualSurfaceInsets != o.hasManualSurfaceInsets) {
1897 hasManualSurfaceInsets = o.hasManualSurfaceInsets;
1898 changes |= SURFACE_INSETS_CHANGED;
1899 }
1900
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001901 if (needsMenuKey != o.needsMenuKey) {
1902 needsMenuKey = o.needsMenuKey;
1903 changes |= NEEDS_MENU_KEY_CHANGED;
1904 }
1905
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001906 return changes;
1907 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07001908
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001909 @Override
1910 public String debug(String output) {
1911 output += "Contents of " + this + ":";
1912 Log.d("Debug", output);
1913 output = super.debug("");
1914 Log.d("Debug", output);
1915 Log.d("Debug", "");
1916 Log.d("Debug", "WindowManager.LayoutParams={title=" + mTitle + "}");
1917 return "";
1918 }
Wonsik Kim475e3f02014-03-17 11:17:47 +00001919
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001920 @Override
1921 public String toString() {
1922 StringBuilder sb = new StringBuilder(256);
1923 sb.append("WM.LayoutParams{");
1924 sb.append("(");
1925 sb.append(x);
1926 sb.append(',');
1927 sb.append(y);
1928 sb.append(")(");
Romain Guy980a9382010-01-08 15:06:28 -08001929 sb.append((width== MATCH_PARENT ?"fill":(width==WRAP_CONTENT?"wrap":width)));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001930 sb.append('x');
Romain Guy980a9382010-01-08 15:06:28 -08001931 sb.append((height== MATCH_PARENT ?"fill":(height==WRAP_CONTENT?"wrap":height)));
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001932 sb.append(")");
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001933 if (horizontalMargin != 0) {
1934 sb.append(" hm=");
1935 sb.append(horizontalMargin);
1936 }
1937 if (verticalMargin != 0) {
1938 sb.append(" vm=");
1939 sb.append(verticalMargin);
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001940 }
1941 if (gravity != 0) {
1942 sb.append(" gr=#");
1943 sb.append(Integer.toHexString(gravity));
1944 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001945 if (softInputMode != 0) {
1946 sb.append(" sim=#");
1947 sb.append(Integer.toHexString(softInputMode));
1948 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001949 sb.append(" ty=");
1950 sb.append(type);
1951 sb.append(" fl=#");
1952 sb.append(Integer.toHexString(flags));
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001953 if (privateFlags != 0) {
Adam Lesinski95c42972013-10-02 10:13:27 -07001954 if ((privateFlags & PRIVATE_FLAG_COMPATIBLE_WINDOW) != 0) {
1955 sb.append(" compatible=true");
1956 }
Dianne Hackborn5d927c22011-09-02 12:22:18 -07001957 sb.append(" pfl=0x").append(Integer.toHexString(privateFlags));
1958 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07001959 if (format != PixelFormat.OPAQUE) {
1960 sb.append(" fmt=");
1961 sb.append(format);
1962 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001963 if (windowAnimations != 0) {
1964 sb.append(" wanim=0x");
1965 sb.append(Integer.toHexString(windowAnimations));
1966 }
1967 if (screenOrientation != ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) {
1968 sb.append(" or=");
1969 sb.append(screenOrientation);
1970 }
Dianne Hackborn8eb2e242010-11-01 12:31:24 -07001971 if (alpha != 1.0f) {
1972 sb.append(" alpha=");
1973 sb.append(alpha);
1974 }
1975 if (screenBrightness != BRIGHTNESS_OVERRIDE_NONE) {
1976 sb.append(" sbrt=");
1977 sb.append(screenBrightness);
1978 }
1979 if (buttonBrightness != BRIGHTNESS_OVERRIDE_NONE) {
1980 sb.append(" bbrt=");
1981 sb.append(buttonBrightness);
1982 }
Craig Mautner3c174372013-02-21 17:54:37 -08001983 if (rotationAnimation != ROTATION_ANIMATION_ROTATE) {
1984 sb.append(" rotAnim=");
1985 sb.append(rotationAnimation);
1986 }
Michael Wright3f145a22014-07-22 19:46:03 -07001987 if (preferredRefreshRate != 0) {
1988 sb.append(" preferredRefreshRate=");
1989 sb.append(preferredRefreshRate);
1990 }
Joe Onorato664644d2011-01-23 17:53:23 -08001991 if (systemUiVisibility != 0) {
1992 sb.append(" sysui=0x");
1993 sb.append(Integer.toHexString(systemUiVisibility));
1994 }
Joe Onorato14782f72011-01-25 19:53:17 -08001995 if (subtreeSystemUiVisibility != 0) {
1996 sb.append(" vsysui=0x");
1997 sb.append(Integer.toHexString(subtreeSystemUiVisibility));
1998 }
Joe Onorato664644d2011-01-23 17:53:23 -08001999 if (hasSystemUiListeners) {
2000 sb.append(" sysuil=");
2001 sb.append(hasSystemUiListeners);
2002 }
Dianne Hackborna44abeb2011-08-08 19:24:01 -07002003 if (inputFeatures != 0) {
2004 sb.append(" if=0x").append(Integer.toHexString(inputFeatures));
2005 }
Jeff Brown1e3b98d2012-09-30 18:58:59 -07002006 if (userActivityTimeout >= 0) {
2007 sb.append(" userActivityTimeout=").append(userActivityTimeout);
2008 }
Andreas Gampe007cfa72015-03-15 14:19:43 -07002009 if (surfaceInsets.left != 0 || surfaceInsets.top != 0 || surfaceInsets.right != 0 ||
Andreas Gampe11090062015-03-16 09:45:34 -07002010 surfaceInsets.bottom != 0 || hasManualSurfaceInsets) {
Alan Viverette49a22e82014-07-12 20:01:27 -07002011 sb.append(" surfaceInsets=").append(surfaceInsets);
Alan Viverette5435a302015-01-29 10:25:34 -08002012 if (hasManualSurfaceInsets) {
2013 sb.append(" (manual)");
2014 }
Alan Viveretteccb11e12014-07-08 16:04:02 -07002015 }
Wale Ogunwale393b1c12014-10-18 16:22:01 -07002016 if (needsMenuKey != NEEDS_MENU_UNSET) {
2017 sb.append(" needsMenuKey=");
2018 sb.append(needsMenuKey);
2019 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002020 sb.append('}');
2021 return sb.toString();
2022 }
Mitsuru Oshima8d112672009-04-27 12:01:23 -07002023
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002024 /**
2025 * Scale the layout params' coordinates and size.
Mitsuru Oshima64f59342009-06-21 00:03:11 -07002026 * @hide
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002027 */
Mitsuru Oshima64f59342009-06-21 00:03:11 -07002028 public void scale(float scale) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07002029 x = (int) (x * scale + 0.5f);
2030 y = (int) (y * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002031 if (width > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07002032 width = (int) (width * scale + 0.5f);
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002033 }
2034 if (height > 0) {
Mitsuru Oshima61324e52009-07-21 15:40:36 -07002035 height = (int) (height * scale + 0.5f);
Mitsuru Oshima8d112672009-04-27 12:01:23 -07002036 }
2037 }
2038
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002039 /**
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002040 * Backup the layout parameters used in compatibility mode.
2041 * @see LayoutParams#restore()
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002042 */
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002043 void backup() {
2044 int[] backup = mCompatibilityParamsBackup;
2045 if (backup == null) {
Mitsuru Oshima64f59342009-06-21 00:03:11 -07002046 // we backup 4 elements, x, y, width, height
2047 backup = mCompatibilityParamsBackup = new int[4];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002048 }
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002049 backup[0] = x;
2050 backup[1] = y;
2051 backup[2] = width;
2052 backup[3] = height;
Mitsuru Oshimae5fb3282009-06-09 21:16:08 -07002053 }
2054
2055 /**
2056 * Restore the layout params' coordinates, size and gravity
2057 * @see LayoutParams#backup()
2058 */
2059 void restore() {
2060 int[] backup = mCompatibilityParamsBackup;
2061 if (backup != null) {
2062 x = backup[0];
2063 y = backup[1];
2064 width = backup[2];
Mitsuru Oshima3d914922009-05-13 22:29:15 -07002065 height = backup[3];
2066 }
2067 }
2068
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002069 private CharSequence mTitle = "";
Siva Velusamy0d857b92015-04-22 10:23:56 -07002070
2071 /** @hide */
2072 @Override
2073 protected void encodeProperties(@NonNull ViewHierarchyEncoder encoder) {
2074 super.encodeProperties(encoder);
2075
2076 encoder.addProperty("x", x);
2077 encoder.addProperty("y", y);
2078 encoder.addProperty("horizontalWeight", horizontalWeight);
2079 encoder.addProperty("verticalWeight", verticalWeight);
2080 encoder.addProperty("type", type);
2081 encoder.addProperty("flags", flags);
2082 }
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08002083 }
2084}